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
Have you ensured that all of these are up to date?
Foundry
Foundryup
What version of Foundry are you on?
No response
What command(s) is the bug in?
anvil -f "FORK_URL" --port PORT --fork-block-number BLOCK_NUMBER
Operating System
Linux
Describe the bug
Running anvil_reset doesn't seem to reset the addresses contract code.
For example say that I ran anvil -f "FORK_URL" --port PORT --fork-block-number BLOCK_NUMBER where the FORK_URL is some eth mainnet endpoint and then running
This seems to be working as expected with Hardhat when using hardhat_reset where the result is instead {"jsonrpc":"2.0","id":69,"result":"0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006332e31302e300000000000000000000000000000000000000000000000000000"} as it's the expected outcome when querying the contract on sepolia.
The address 0x16Fc5058F25648194471939df75CF27A2fdC48BC on mainnet doesn't contain contract code but then on Sepolia it does and I believe that this code is not being updated on the reset call.
zerosnacks
changed the title
anvil_reset seems to not reset the addresses contract code
bug(anvil): anvil_reset seems to not reset the addresses contract code
Aug 16, 2024
Component
Anvil
Have you ensured that all of these are up to date?
What version of Foundry are you on?
No response
What command(s) is the bug in?
anvil -f "FORK_URL" --port PORT --fork-block-number BLOCK_NUMBER
Operating System
Linux
Describe the bug
Running
anvil_reset
doesn't seem to reset the addresses contract code.For example say that I ran
anvil -f "FORK_URL" --port PORT --fork-block-number BLOCK_NUMBER
where theFORK_URL
is some eth mainnet endpoint and then runningThis results is
{"jsonrpc":"2.0","id":69,"result":"0x"}
This is expected since
0x16Fc5058F25648194471939df75CF27A2fdC48BC
is the portalAddress contract on Mainnet Sepolia.However when running
anvil_reset
and then running the abovecurl
command the result is the same{"jsonrpc":"2.0","id":69,"result":"0x"}
This seems to be working as expected with Hardhat when using
hardhat_reset
where the result is instead{"jsonrpc":"2.0","id":69,"result":"0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006332e31302e300000000000000000000000000000000000000000000000000000"}
as it's the expected outcome when querying the contract on sepolia.The address
0x16Fc5058F25648194471939df75CF27A2fdC48BC
on mainnet doesn't contain contract code but then on Sepolia it does and I believe that this code is not being updated on thereset
call.This can be check with
This results is
{"jsonrpc":"2.0","id":31337,"result":"0x"}
I believe it might be because the fork creates a default storage but not entirely sure.
Not sure this is the intended behavior, but it would be great to have a similar behavior as
hardhat_reset
The text was updated successfully, but these errors were encountered: