paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
4k stars 1.22k forks source link

callBundle based on block index state #12353

Open ciaranmcveigh5 opened 2 weeks ago

ciaranmcveigh5 commented 2 weeks ago

Describe the feature

let EthCallBundle { txs, block_number, state_block_number, timestamp, gas_limit, difficulty, base_fee, } = bundle;

Typically callBundle is used to simulate top of block and get a builder payment (pre-execution) using state_block_number for state

More and more we're seeing that it would be useful to use callBundle (post-execution) when your bundle doesn't land and no other searcher bundle lands after the target transaction for debugging, you would do this by simulating from block index "n" of block_number rather than top of block from state_block_number (where index "n" is determined by where the target transaction lands in the block)

For bundles that simulate fine top of block but don't land this would quickly tell you if the bundle didn't land because of state changes higher up in the block

Would be open to this as an optional flag on callBundle (assuming there was a PR that implemented the logic), block_index, if block_index isn't present use state_block_number if it is use the block_index of block_number for the simulation

Achieving this debugging at the api level via a callBundle rather than via a product that provides a UI to do the same thing would be very useful

Additional context

No response

mattsse commented 1 week ago

I think that makes sense, this would just be an additional argument here https://github.com/alloy-rs/alloy/blob/e747b1e863fe647ca45489ba59c867a47c937fdc/crates/rpc-types-mev/src/eth_calls.rs#L13 right?