Skip to content

Use Vec<(B256, Option<...>)> in HashedPostStateCursors #18848

@mediocregopher

Description

@mediocregopher

Describe the feature

The HashedPostStateAccountCursor and HashedPostStateStorageCursor currently use a combination of iterator over updated accounts/slots and a separate HashSet of cleared accounts/slots to act as an overlay over the underlying Cursor.

This could be made more efficient by removing the HashSet on each, and making the iterator into an iterator over an Option<Account> (for accounts) or U256 (for storages, U256::ZERO indicates deleted).

This change will require accompanying changes to HashedPostStateSorted.

A previous PR was already merged, #18479 , which performed essentially this exact change but for TrieUpdates. This PR can be used as a guide; the logic and necessary changes should be effectively the same, just the types are different.

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-trieRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions