-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
block.timestamp bugs when using skip #6180
Comments
unable to reproduce:
|
@mattsse what forge version are you running? |
@77abe77 are you compiling with via-ir? If so see the convo and links in #4934 (comment) |
@mds1 good catch, yes I am! will take a look |
@mds1 - maybe we should add Effectively this prevents the optimizer from doing this. Alternatively we could add a |
|
### 🕓 Changelog This commit refactors `TimelockController.t.sol` to use `getBlockTimestamp()` instead of `block.timestamp`, as `block.timestamp` is assumed to be constant across a transaction and will be optimised out by the compiler. For more details, see [issue](foundry-rs/foundry#6180). Additionally, `solhint` has been upgraded to the latest version, [`v5.0.4`](https://github.com/protofire/solhint/releases/tag/v5.0.4), and all submodules have been updated to their most recent commits. --------- Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (619f3c5 2023-10-22T00:19:08.867786000Z)
What command(s) is the bug in?
forge test -vvvv --mc "ForgeBug"
Operating System
None
Describe the bug
Two bugs, easy to reproduce:
Consists of 2 contracts
ForgeBug
andForgeBug1
Common bug in both contracts:
Actual Behavior:
duration (
end - start
) is always0
. Implying thatstart
is getting erroneously mutated along the way.Expected Behavior:
duration (
end - start
) should be non zero and thatstart
should be caching the first value ofblock.timestamp
ForgeBug Contract Additional Bug
Actual Behavior:
Expected Behavior:
ForgeTest1 has an unrolled for loop version of the test included and causes correct behavior (minus duration bug)
Logs:
The text was updated successfully, but these errors were encountered: