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

Bound env variables (NUMBER, TIMESTAMP) by reasonable values #2143

Open
palinatolmach opened this issue Oct 27, 2023 · 3 comments
Open

Bound env variables (NUMBER, TIMESTAMP) by reasonable values #2143

palinatolmach opened this issue Oct 27, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@palinatolmach
Copy link
Contributor

Currently, environmental variables such as block.number and block.timestamp are symbolic and are only bounded by the type range constraints. We can further restrict their values by adding some reasonable bounds, e.g., #rangeUInt(32, NUMBER) for block.number, which is ~3 orders of magnitude larger that current block number, as suggested by @ehildenb.

@lucasmt
Copy link
Contributor

lucasmt commented Jan 31, 2024

I have PR #2277 open to add bounds to the block.timestamp variable, and block.number is already bounded here. But from what I understand this issue is proposing to have stricter bounds for them based on what values we can reasonably expect these variables to have. Is this still something we want?

@anvacaru
Copy link
Contributor

anvacaru commented Feb 1, 2024

I'd say to merge it as it is. We can further constrain block.number if we see fit.

@palinatolmach
Copy link
Contributor Author

Moving it into backlog for it to be addressed if/when we run into this issue. As suggested by @lucasmt, an alternative is to use vm.assume to provide bounds on the value, e.g., vm.assume(block.number < 65536);.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants