You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uint256 a = block.timestamp;
console2.log(a);
vm.warp(a+1);
console2.log(a);
This snippet prints 1 and 2 to the console. Seems block.timestamp gets reevaluated instead of using the stored value for a from the stack? Is this expected behaviour?
The text was updated successfully, but these errors were encountered:
It's a Solidity optimization we can't get around. The compiler assumes block.timestamp evaluates to a constant so instead of pushing the value on the stack it just replaces all occurrences of a with a call to the TIMESTAMP opcode.
I don't think so, but I'm not sure - this was reported once before in this issue: #1373 There is some additional context in there, but no clear solution
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (49f35c7 2022-06-30T00:06:55.326479Z)
What command(s) is the bug in?
No response
Operating System
macOS (Apple Silicon)
Describe the bug
This snippet prints 1 and 2 to the console. Seems block.timestamp gets reevaluated instead of using the stored value for a from the stack? Is this expected behaviour?
The text was updated successfully, but these errors were encountered: