Skip to content

[Feature] Provide txroot hash to executionPayload to block conversion #3444

@mattsse

Description

@mattsse

Component

rpc

Describe the feature you would like

this would currently decode the txs and compute the the root

pub fn try_into_block_with_sidecar<T: Decodable2718>(
self,
sidecar: &ExecutionPayloadSidecar,
) -> Result<Block<T>, PayloadError> {

via:

// Calculate the transactions root using encoded bytes
let transactions_root = alloy_consensus::proofs::ordered_trie_root_with_encoder(
&self.transactions,
|item, buf| buf.put_slice(item),
);

in reth payload validation we can avoid or rather optimize the root calc separately,

so it'd be nice to have an extra fn that also accepts the tx root hash directly, like

try_into_block_with_meta

or smth.

and ideally this unifies the existing fn:

pub fn into_block_raw(self) -> Result<Block<Bytes>, PayloadError> {
if self.extra_data.len() > MAXIMUM_EXTRA_DATA_SIZE {
return Err(PayloadError::ExtraData(self.extra_data));
}
// Calculate the transactions root using encoded bytes
let transactions_root = alloy_consensus::proofs::ordered_trie_root_with_encoder(
&self.transactions,
|item, buf| buf.put_slice(item),
);

with an extra fn that accepts an Optional txroot hash arg

@Soubhik-10 ?

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions