perf(primitives): avoid cloning receipts when calculating the root#8350
Merged
perf(primitives): avoid cloning receipts when calculating the root#8350
Conversation
shekhirin
approved these changes
May 22, 2024
crates/primitives/src/proofs.rs
Outdated
Member
There was a problem hiding this comment.
sigh, would be nice to have one method for both cases, unsure if it's possible though
87fe8d5 to
87d7357
Compare
87d7357 to
40155a1
Compare
mattsse
approved these changes
May 22, 2024
Comment on lines
+120
to
+122
| /// NOTE: Prefer [`calculate_receipt_root_optimism`] if you have log blooms memoized. | ||
| #[cfg(feature = "optimism")] | ||
| pub fn calculate_receipt_root_ref_optimism( | ||
| pub fn calculate_receipt_root_no_memo_optimism( |
Collaborator
There was a problem hiding this comment.
not to self to move this shortly
|
|
||
| /// Calculates the bloom filter for the receipt and returns the [ReceiptWithBloomRef] container | ||
| /// type. | ||
| pub fn with_bloom_ref(&self) -> ReceiptWithBloomRef<'_> { |
Member
Author
There was a problem hiding this comment.
thats what the type is called, it would also make more sense to highlight that this is slow and not have Into impls
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We can re-use the ref-type
ReceiptWithBloomRefinstead of cloning intoReceiptWithBloomto calculate the logs blooms and receipt root.Drive-by: use
encode_fixed_sizeto RLP encode the receipt index on the stack.Closes #8340