Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use block.timestamp instead of block.number #46

Merged
merged 6 commits into from
Oct 1, 2024

Conversation

xorsal
Copy link
Contributor

@xorsal xorsal commented Sep 26, 2024

🤖 Linear

We probably need to update events as well.

Closes OPO-647

Copy link

linear bot commented Sep 26, 2024

@xorsal
Copy link
Contributor Author

xorsal commented Sep 26, 2024

Tried bumping husky to fix a weird error I'm getting in prophet-modules when I use the dependency@defi-wonderland/prophet-core#de18a05 but husky v9 dropped support Node 14 and 16.

package.json Outdated Show resolved Hide resolved
@xorsal xorsal changed the base branch from dev to chore/bump-husky September 27, 2024 17:56
Comment on lines 135 to 137
responseCreatedAt[_responseId] = uint128(block.number);
responseCreatedAt[_responseId] = uint128(block.timestamp);

emit ResponseProposed(_requestId, _responseId, _response, block.number);
Copy link
Member

@0xJabberwock 0xJabberwock Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be questioned whether emitting the block.number or block.timestamp is useful anymore.

Also, does it make sense to cast to uint128?

Copy link
Contributor Author

@xorsal xorsal Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be questioned whether emitting the block.number or block.timestamp is useful anymore.

I agree. Initially I thought block.number was unnecessary and changing it to emit block.timestamp was better, but in truth, both values can be easily obtained. I wonder if it changes anything for the offchain team.

edit: 0xYaco confirmed they don't use this parameter, and they can even take it from the event metadata.

Also, does it make sense to cast to uint128?

This one seems altogether unnecessary. I couldn't find a specific use for it in any of the four mappings using uint128 block.numbers (now timestamps as per this PR).

edit: timestamp could be packed into uint40 (max 34865 years) or uint96 for (2.51 quintillion years), but I don't think it's worthy.

Base automatically changed from chore/bump-husky to dev September 30, 2024 07:33
Copy link
Member

@gas1cent gas1cent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beauty 🙌🏻

@gas1cent gas1cent merged commit 4d28a0e into dev Oct 1, 2024
3 checks passed
@gas1cent gas1cent deleted the feat/rollback-to-timestamps branch October 1, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants