Skip to content

How to run a stateless transition with the current state in reth-exex #44

@djm07073

Description

@djm07073

Hello, I’d like to simulate some contract code using exex. What’s the recommended way to use the block executor with the current state? I need to run a stateless transition based on the current EVM database

fn main() -> eyre::Result<()> {
    reth::cli::Cli::parse_args().run(|builder, _| async move {
        let handle = builder
            .node(EthereumNode::default())
            .install_exex("...", move |ctx| async {
                let mut block_executor = ctx.block_executor().clone();
                // block_executor. ??
            })
            .launch().await?;

        handle.wait_for_node_exit().await
    })
}

Also, when my node is still syncing, reth-exex might end up simulating against an outdated state from a peer. I’d like to run simulations only against the latest block state (not the committed block, which I understand is already exposed via ExEx notifications).

Is there a way to access the most recent block from a connected peer during sync, so that I can simulate using that up-to-date state instead of an older one to avoid a unnecessary simulation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions