Skip to content

Implement incremental hasher for computing txroot/etc without constructing database #724

@arnetheduck

Description

@arnetheduck

When computing MPT roots, the current version of the code works by constructing a database of the full value and then hashing up to the root - this is extremely inefficient due to the many allocations involved as well as the cost of maintaining the full data in memory - instead, it's possible to build an incremental hasher that:

  • only stores hashes, not values
  • every time a branch is full (ie has 16 children) collapses those into a single hash

Examples of this can be found:

Also related is #698

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions