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

--state seems to not work with --fork-block-number #9539

Closed
2 tasks done
naps62 opened this issue Dec 11, 2024 · 0 comments · Fixed by #9543
Closed
2 tasks done

--state seems to not work with --fork-block-number #9539

naps62 opened this issue Dec 11, 2024 · 0 comments · Fixed by #9543
Assignees
Labels
C-anvil Command: anvil T-bug Type: bug

Comments

@naps62
Copy link
Contributor

naps62 commented Dec 11, 2024

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

anvil 0.2.0 (59f354c 2024-12-11T00:25:55.121360682Z)

What command(s) is the bug in?

anvil --fork-url ... --fork-block-number ... --state

Operating System

Linux

Describe the bug

I've seen some recent work (#9215) that fixed issues when --state and --fork-url are used together.

However, some issues still seem to persist if --fork-block-number is added to the mix.

to reproduce:

  • anvil --fork-url https://eth.llamarpc.com --fork-block-number 21381199 --state foo
  • in a separate terminal: cast rpc anvil_mine
  • kill anvil, and restart with the same command. current block number will have reverted back to the original

Use case:
I have a docker-compose setup where anvil is spawned in fork mode, and with persistence enabled to make the whole setup resilient.
In some cases, I want to ensure this setup targets a specific block number of the forked chain).
The docker image runs anvil --fork-url ... --fork-block-number ... --state /data/anvil

When restarting the docker-compose setup, the same command will be triggered.

I suppose a quick hack to fix this is to patch the docker entrypoint so that, depending on whether the state file exists, --state or --fork-block-number is added, but not both. This seems like it shouldn't be necessary though

@naps62 naps62 added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Dec 11, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Dec 11, 2024
@yash-atreya yash-atreya self-assigned this Dec 12, 2024
@yash-atreya yash-atreya moved this from Todo to Ready For Review in Foundry Dec 12, 2024
@yash-atreya yash-atreya added C-anvil Command: anvil and removed T-needs-triage Type: this issue needs to be labelled labels Dec 12, 2024
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Dec 12, 2024
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: Done
Development

Successfully merging a pull request may close this issue.

2 participants