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

Anvil does not recover block number from state after restart. #5460

Closed
2 tasks done
kamenik opened this issue Jul 24, 2023 · 8 comments · Fixed by #6763
Closed
2 tasks done

Anvil does not recover block number from state after restart. #5460

kamenik opened this issue Jul 24, 2023 · 8 comments · Fixed by #6763
Assignees
Labels
T-bug Type: bug
Milestone

Comments

@kamenik
Copy link

kamenik commented Jul 24, 2023

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (35f2070 2023-07-24T15:04:54.605528057Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

After restart, anvil loads state from previously stored one, but starts count blocks from 1 again. I am running it as:

anvil --port 7545 --accounts 200 --mnemonic '........' --block-time 12 --state ./state.json --gas-limit 30000000

@kamenik kamenik added the T-bug Type: bug label Jul 24, 2023
@gakonst gakonst added this to Foundry Jul 24, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jul 24, 2023
@Evalir Evalir self-assigned this Jul 24, 2023
@Evalir Evalir added this to the v1.0.0 milestone Jul 24, 2023
@nambrot
Copy link

nambrot commented Oct 13, 2023

Also running into this

@mattsse
Copy link
Member

mattsse commented Oct 13, 2023

I see this only dumps the state

pub accounts: BTreeMap<Address, SerializableAccountRecord>,

maybe we should consider also including the block number etc?

@kkharji
Copy link

kkharji commented Dec 11, 2023

Yeah this would be awesome feature to have. For my use case I need to maintain transactions and block number between restarts. If someone can pointing me to right direction, I can open a PR/.

@mattsse
Copy link
Member

mattsse commented Dec 11, 2023

totally, forgot about this sorry.
will try to squeeze in this week.

@NikitaBerezhnoy
Copy link

Had problem with this bug. I want to launch anvil on a separate server and connect subgraph to it, so we can use it as a private dev testnet, but I use state file to deploy contracts and setup state (20k tx)

@escottalexander
Copy link

I would really love to see this fixed. It would make it possible for me to run Anvil instead of Ganache or Hardhat for my application.

@nhewage1997
Copy link

hi - would love to see this fixed as well. Our use case uses block number as checkpointing so being able to restore state including block number on restart would be huge

@mattsse
Copy link
Member

mattsse commented Jan 11, 2024

fixing as we speak,

very sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants