Skip to content

Investigate cloning MDBX transaction in state provider builder #20432

@shekhirin

Description

@shekhirin

Summary

In StateProviderBuilder::build(), we currently create a new state provider by calling state_by_block_hash. MDBX supports cloning transactions via its API, which could potentially be leveraged here instead.

Context

https://github.com/paradigmxyz/reth/blob/main/crates/engine/tree/src/tree/mod.rs#L119-L122

pub fn build(&self) -> ProviderResult<StateProviderBox> {
    let mut provider = self.provider_factory.state_by_block_hash(self.historical)?;
    // ...
}

Task

  • Investigate whether using the MDBX transaction clone API would be beneficial here
  • Determine if cloning a transaction is cheaper than creating a new one via state_by_block_hash
  • If beneficial, implement the change using the appropriate MDBX API

Metadata

Metadata

Labels

A-dbRelated to the databaseC-perfA change motivated by improving speed, memory usage or disk footprint

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions