Skip to content

bug(anvil): persistent state seems to ignore timestamp changes #10331

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

Open
2 tasks done
pvgo80 opened this issue Apr 17, 2025 · 1 comment
Open
2 tasks done

bug(anvil): persistent state seems to ignore timestamp changes #10331

pvgo80 opened this issue Apr 17, 2025 · 1 comment
Assignees
Labels
C-anvil Command: anvil T-bug Type: bug

Comments

@pvgo80
Copy link

pvgo80 commented Apr 17, 2025

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.3.0 (a5c5be5 2025-01-06T00:23:40.588668993Z)

What version of Foundryup are you on?

No response

What command(s) is the bug in?

anvil --fork-url https://mainnet.swell-rpc.com --state a --state-interval 10 --chain-id 7566690 --auto-impersonate --fork-block-number 5672511

Operating System

None

Describe the bug

Newer blocks after restarting anvil ignore the previous block timestamp.

Steps to reproduce:

# anvil --fork-url https://mainnet.swell-rpc.com --state a --state-interval 10 --chain-id 7566690 --auto-impersonate --fork-block-number 5672511

❯ cast age latest
Mon Apr  7 16:02:05 2025

❯ cast rpc evm_setNextBlockTimestamp $(date +%s)
null

❯ cast rpc anvil_mine
null

❯ cast age latest
Thu Apr 17 19:33:45 2025

❯ cast block

hash                 0xdf0ac0c25c0fb9887b1d4297fcc9137e08e80851ad062524b9b848ad7ffde33b
number               5672512
parentHash           0x232db3a3b42961dbada3599779554acd5c0514a03c17310b91461dca9a82457d
timestamp            1744918425 (Thu, 17 Apr 2025 19:33:45 +0000)

# (anvil restart) anvil --fork-url https://mainnet.swell-rpc.com --state a --state-interval 10 --chain-id 7566690 --auto-impersonate --fork-block-number 5672511

❯ cast block

hash                 0xdf0ac0c25c0fb9887b1d4297fcc9137e08e80851ad062524b9b848ad7ffde33b
number               5672512
parentHash           0x232db3a3b42961dbada3599779554acd5c0514a03c17310b91461dca9a82457d
timestamp            1744918425 (Thu, 17 Apr 2025 19:33:45 +0000)

❯ cast age latest
Thu Apr 17 19:33:45 2025

❯ cast rpc anvil_mine
null

❯ cast age latest
Mon Apr  7 16:02:34 2025

❯ cast block

hash                 0x211e24b15071c2e1a36d26287e05ed890fdf0138e8b99d1fd5140a5bbb39ae43
number               5672513
parentHash           0xdf0ac0c25c0fb9887b1d4297fcc9137e08e80851ad062524b9b848ad7ffde33b
timestamp            1744041754 (Mon, 7 Apr 2025 16:02:34 +0000)
@pvgo80 pvgo80 added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Apr 17, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Apr 17, 2025
@yash-atreya
Copy link
Member

Thanks for reporting! Able to reproduce on latest nightly.

@yash-atreya yash-atreya added C-anvil Command: anvil T-to-investigate Type: to investigate and removed T-needs-triage Type: this issue needs to be labelled labels Apr 18, 2025
@yash-atreya yash-atreya changed the title Anvil's persistent state seems to ignore timestamp changes bug(anvil): persistent state seems to ignore timestamp changes Apr 18, 2025
@grandizzy grandizzy removed the T-to-investigate Type: to investigate label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug
Projects
Status: Todo
Development

No branches or pull requests

3 participants