Skip to content

feat(storage-api): add consuming state root variant#26442

Open
0xMars42 wants to merge 1 commit into
paradigmxyz:mainfrom
0xMars42:feat/state-root-consuming-api
Open

feat(storage-api): add consuming state root variant#26442
0xMars42 wants to merge 1 commit into
paradigmxyz:mainfrom
0xMars42:feat/state-root-consuming-api

Conversation

@0xMars42

Copy link
Copy Markdown
Contributor

Closes #17998.

Adds StateRootProvider::state_root_with_updates_consumed, a self: Box<Self> variant with a default that delegates to the borrowing version, so no existing implementation changes behavior. MemoryOverlayStateProvider and its Ref override it to move the cached TrieInput into the computation instead of cloning the aggregate of every in-memory block, and the engine's synchronous and serial-fallback state root jobs now call it on the provider they were about to drop.

This removes the second full copy made on every such computation; the first one (aggregating the per-block sorted state into the cached input) remains. The block builder path in BasicBlockBuilder::finish still clones, since the provider is borrowed by the execution database and reused by the assembler there: consuming it needs an ownership restructuring left for a follow-up, as are the proof and witness paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

State root calculation API that consumes the state provider

1 participant