Open 0xgiantkoala opened 1 week ago
The debug_traceCall
method does support txIndex
field. It is not available in ethclient
tho unfortunately. If you directly called the rpc method you can:
debug_traceCall({ from: ..., to: ..., }, "0xblocknum", { "txIndex": 5, "tracer": "callTracer" })
I believe there was a PR for eth_call too but can't find it rn.
Alternatively you can use eth_simulateV1
and pass in all prior txes and add your call on top.
Currently,
gethclient.CallContract
supports blockNumber override.However, there are cases where I am interested in reading/simulating stuff intra block. (ie: top of block T and then replay first N transactions from block T + 1).
Basically, I need Foundry's
createSelectFork("rpc", "txHash")
in GETH.Is there an official and idiomatic way that allows me to do this (without needing to fork go-ethereum and implement the replay stuff myself) ?