Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: change proof internal repr to HashMap #43

Merged
merged 5 commits into from
Sep 26, 2024
Merged

Conversation

rkrasiuk
Copy link
Member

@rkrasiuk rkrasiuk commented Sep 26, 2024

Description

Change proof internal representation to HashMap. Proofs can be sorted once on demand.

Introduce new ProofNodes struct returned by ProofRetainer and a bunch of utility methods for working with it.

@rkrasiuk rkrasiuk added the enhancement New feature or request label Sep 26, 2024
pub fn take_proofs(&mut self) -> BTreeMap<Nibbles, Bytes> {
self.proof_retainer.take().map(ProofRetainer::into_proofs).unwrap_or_default()
/// Take and return retained proof nodes.
pub fn take_proof_nodes(&mut self) -> ProofNodes {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is breaking, but so is the type change, so doesn't matter imo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is #42

Copy link
Member Author

@rkrasiuk rkrasiuk Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not only a helper struct, but also forces users to revise their usage of proof nodes, because they might rely on them being sorted already (e.g. like we do in reth)

@rkrasiuk rkrasiuk merged commit 9e4f158 into main Sep 26, 2024
21 checks passed
@rkrasiuk rkrasiuk deleted the perf/proof-hashmap branch September 26, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants