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
When setting --block-time to a value <1s (e.g. 0.01s), blocks will be created at the desired <1s rate, but block timestamps will still increase by 1s for each block. This results in block.timestamp rapidly getting far ahead of wall time.
--block-time values above 1s have correct intervals (e.g. timestamp increases by 2s per block with a --block-time of 2s), so this only seems to apply for values <1s.
Reproduction (observe how each block's timestamp goes up by 1s):
I guess the fix here might be non-trivial (or even wontfix), as block.timestamp is an integer ofc. I was imagining anvil maintain a separate internal "true" timestamp (lets call it true_timestamp) stored with decimals, and incrementing block.timestamp only when floor(true_timestamp) increases.
yeah, I believe this breaks assumptions that timestamp always increases by at least one, but I can see how this could be useful and we can technically do it because we don't validate the timestamp.
@yash-atreya we can support float parsing and see what else we'd need to change in the time manager to support <1s intervals
right that's fair — up to you guys if you think it'd be okay to implement! fwiw if this does end up getting implemented, ideally the change would carry over to auto mining as well (as rn if you automine 100 blocks within 1s, block timestamp gets ahead of wall time by ~100s) — though as i say this i realize how confusing this could get... 😅 (maybe put this behavior behind a flag?)
Component
Anvil
Have you ensured that all of these are up to date?
What version of Foundry are you on?
anvil 0.2.0 (a470d63 2024-05-16T00:20:38.420768000Z)
What command(s) is the bug in?
anvil --block-time 0.01
Operating System
macOS (Apple Silicon)
Describe the bug
When setting
--block-time
to a value <1s (e.g. 0.01s), blocks will be created at the desired <1s rate, but block timestamps will still increase by 1s for each block. This results inblock.timestamp
rapidly getting far ahead of wall time.--block-time
values above 1s have correct intervals (e.g. timestamp increases by 2s per block with a--block-time
of 2s), so this only seems to apply for values <1s.Reproduction (observe how each block's timestamp goes up by 1s):
The text was updated successfully, but these errors were encountered: