Skip to content

Implement incremental storage root calculation #17547

@Rjected

Description

@Rjected

Describe the feature

The issue #12527 turns out to be because the XEN contract causes a from-scratch storage root calculation to allocate ~100G.

This assumption from the original root code is now false due to how large XEN is:

// We assume we can always calculate a storage root without
// OOMing. This opens us up to a potential DOS vector if
// a contract had too many storage entries and they were
// all buffered w/o us returning and committing our intermediate
// progress.
// TODO: We can consider introducing the TrieProgress::Progress/Complete
// abstraction inside StorageRoot, but let's give it a try as-is for now.

And the task described in the TODO is now relevant. This involves:

  1. Adding helpers for restoring a storage root computation progress
  2. Methods for stopping the storage root calculation after a threshold is met
  3. Data structures for saving the storage root progress
  4. Logic for stopping / resuming an incremental storage root calculation in StateRoot

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-staged-syncRelated to staged sync (pipelines and stages)A-trieRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestC-perfA change motivated by improving speed, memory usage or disk footprint

Type

No type

Projects

Status

Backlog

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions