Skip to content

Add JS debugtrace_transaction support to anvil #11091

@mattsse

Description

@mattsse

Component

Anvil

Describe the feature you would like

we want support for debugtrace_transaction an JS tracing for anvil
ref #11052

to do this we need a new helper function that works like

/// Helper function to execute a closure with the database at a specific block
pub async fn with_database_at<F, T>(
&self,
block_request: Option<BlockRequest>,
f: F,
) -> Result<T, BlockchainError>
where
F: FnOnce(Box<dyn MaybeFullDatabase + '_>, BlockEnv) -> T,
{

but also transacts all previous txs before the target tx in a block
basically like this

https://github.com/paradigmxyz/reth/blob/876e964cbcbd85ade6fdec40bb35f08690332854/crates/rpc/rpc-eth-api/src/helpers/call.rs#L653-L684

this is more or less how

/// Creates the pending block
///
/// This will execute all transaction in the order they come but will not mine the block
pub async fn with_pending_block<F, T>(
&self,
pool_transactions: Vec<Arc<PoolTransaction>>,
f: F,
) -> T
where
F: FnOnce(Box<dyn MaybeFullDatabase + '_>, BlockInfo) -> T,
{

already works, so we can adapt this a bit so that it works with a set of txs, a new helper fns

TODO

  • add debug_traceTransaction handling for JS and add required functionality

@Soubhik-10

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions