Skip to content

Make bench command operate on PayloadTypes #17087

Open
@mattsse

Description

@mattsse

Describe the feature

we currently do this:

let block_res = block_provider.get_block_by_number(next_block.into()).full().await;
let block = block_res.unwrap().unwrap();
let block = block
.into_inner()
.map_header(|header| header.map(|h| h.into_header_with_defaults()))
.try_map_transactions(|tx| {
// try to convert unknowns into op type so that we can also support optimism
tx.try_into_either::<op_alloy_consensus::OpTxEnvelope>()
})
.unwrap()
.into_consensus();
let blob_versioned_hashes =
block.body.blob_versioned_hashes_iter().copied().collect::<Vec<_>>();
// Convert to execution payload
let (payload, sidecar) = ExecutionPayload::from_block_slow(&block);
let header = block.header;
let head_block_hash = payload.block_hash();
let safe_block_hash =
block_provider.get_block_by_number(header.number.saturating_sub(32).into());
let finalized_block_hash =
block_provider.get_block_by_number(header.number.saturating_sub(64).into());

this is problematic if we want to use this for both op and eth

instead this should be converted into a command that accepts a closure for the conversion, or some other helper trait, simular to

pub trait DebugNode<N: FullNodeComponents>: Node<N> {

because we need special block -> payload conversion

TODO

  • introduce rpcblock -> payload conversion helper for this entrypoint
    pub async fn execute(self, ctx: CliContext) -> eyre::Result<()> {

    this can be a closure that takes the rpcblock and converts to Payload, hence the command also needs a NodeTypes generic hint

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-cliRelated to the reth CLIC-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions