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

enable loading state from forge script ran against anvil #469

Open
0xalpharush opened this issue Aug 31, 2024 · 2 comments
Open

enable loading state from forge script ran against anvil #469

0xalpharush opened this issue Aug 31, 2024 · 2 comments

Comments

@0xalpharush
Copy link
Contributor

I think we should be able to run Anvil, run a deploy script against its RPC, and load the output of anvil_dumpState
https://github.com/ethereum-optimism/optimism/blob/develop/op-chain-ops/foundry/allocs.go#L26

@0xalpharush
Copy link
Contributor Author

@0xalpharush
Copy link
Contributor Author

0xalpharush commented Sep 27, 2024

The primitive of loading alloc's produced by forge test is done e.g. https://github.com/0xalpharush/foundry-dumpstate/blob/e18fe00b9d783ae99f4b0777a4491cf8e950c6d5/test/Counter.t.sol#L15

You can also use anvil for rmm-core as shown here. First, start anvil: anvil --dump-state dump-state.json. Then run npx hardhat test test/unit/unit_test_seed.test.ts --network localhost

What remains to be done is some way to map the ABI to the deployed address since the contract created event likely won't register the right ABI given the code is included in the genesis block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@0xalpharush and others