foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.34k stars 1.77k forks source link

bug(`cast run`): `cast` does not select correct hardfork for given transaction #8446

Open JamieShip opened 4 months ago

JamieShip commented 4 months ago

Component

Cast

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

What version of Foundry are you on?

forge 0.2.0 (ef62fdb 2024-07-12T00:22:06.894449000Z)

What command(s) is the bug in?

cast run

Operating System

macOS (Apple Silicon)

Describe the bug

curl 'archive rpc url' \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceTransaction","params":["0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc", {"tracer": "callTracer"}], "id":1,"jsonrpc":"2.0"}'

but when I use cast run to repro the tx it revert locally.

cast run 0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc --rpc-url=https://rpc.ankr.com/eth
zerosnacks commented 4 months ago

Looks like this is related to cast not picking up the correct hard fork number to execute the transaction against

When running cast run 0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc --rpc-url=https://rpc.ankr.com/eth --evm-version spuriousDragon the transaction executes succesfully

JamieShip commented 4 months ago

Looks like this is related to cast not picking up the correct hard fork number to execute the transaction against

When running cast run 0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc --rpc-url=https://rpc.ankr.com/eth --evm-version spuriousDragon the transaction executes succesfully

Thanks! And I wonder:

maybe stupid Q:

curl -X POST https://rpc.ankr.com/eth -d '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc"],"id":1}'

there’s only 8 traces of the tx missing the trace of calling the 0x4 precompile contract. Can check the 0x4 precompile contract call using following command:

curl 'archive rpc url' \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceTransaction","params":["0x6b5ca68eb4c4b38690ec12ba9f85409b618759646e50ab53b28f9d67f74978fc", {"tracer": "callTracer"}], "id":1,"jsonrpc":"2.0"}'
grandizzy commented 1 week ago

looking to add a warning if the evm version cannot be inferred automatically