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

Possibility to perform transactions replay intra-block when using CallContract #30598

Open
0xgiantkoala opened this issue Oct 15, 2024 · 3 comments

Comments

@0xgiantkoala
Copy link

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) ?

@s1na
Copy link
Contributor

s1na commented Oct 15, 2024

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.

@s1na
Copy link
Contributor

s1na commented Oct 15, 2024

Alternatively you can use eth_simulateV1 and pass in all prior txes and add your call on top.

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

No branches or pull requests

4 participants
@s1na @0xgiantkoala and others