Skip to content

Compute trie input asynchronously #19250

@mediocregopher

Description

@mediocregopher

Describe the feature

compute_trie_input is used to compute the in-memory overlay which will be passed to the MultiProofTask so that proof computation can take into account in-memory blocks which haven't been persisted to the database yet.

fn compute_trie_input<TP: DBProvider + BlockNumReader + TrieReader>(
&self,
persisting_kind: PersistingKind,
provider: TP,
parent_hash: B256,
state: &EngineApiTreeState<N>,
allocated_trie_input: Option<TrieInput>,
) -> ProviderResult<TrieInput> {

This step takes a few milliseconds on every block:

Image

Once #18906 is complete this method will no longer rely on the state of persistence to perform its computation, as it will no longer deal with collecting reverts.

At that point it will be possible to not compute the trie input at the start of a block's payload validation, but instead at the end of its parent, after the RPC response has been returned to the caller.

This will likely involve modifying ExecutedBlock to retain the full trie input. It will also require that when in-memory blocks are removed from the tree the trie input of each block is re-computed, as the trie input of one in-memory block is dependent on the trie input of its parent.

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-engineRelated to the engine implementationC-perfA change motivated by improving speed, memory usage or disk footprint

Type

No type

Projects

Status

Next Up

Relationships

None yet

Development

No branches or pull requests

Issue actions