Skip to content

feat: memoized receipt root on BlockOutput#155

Merged
prestwich merged 1 commit intomainfrom
prestwich/receipt-root-blockoutput
Apr 2, 2026
Merged

feat: memoized receipt root on BlockOutput#155
prestwich merged 1 commit intomainfrom
prestwich/receipt-root-blockoutput

Conversation

@prestwich
Copy link
Copy Markdown
Member

@prestwich prestwich commented Apr 2, 2026

Summary

  • Add memoized receipt_root() and seal() methods to BlockOutput
  • seal() computes both bloom and receipt root in a single pass via ordered_trie_root_with_encoder, deriving the block bloom as a side effect of trie encoding
  • into_parts() now returns Option<Bloom> and Option<B256> for memoized values
  • into_sealed_parts() seals first and returns guaranteed (Vec<T>, Vec<Address>, Bloom, B256)
  • receipt_root() requires T: TxReceipt + Encodable2718; logs_bloom() retains the weaker TxReceipt<Log = Log> bound
  • Test vectors sourced from alloy-rs/alloy and paradigmxyz/reth
  • Adds CLAUDE.md with project commands, style guidelines, and versioning policy
  • Breaking: into_parts() return type changed; bumps version to 0.34.2

Closes #12
ENG-2119

Test plan

  • cargo clippy -p trevm --all-features --all-targets passes
  • cargo clippy -p trevm --no-default-features --all-targets passes
  • cargo t -p trevm — 39 unit + 10 doc tests pass
  • Verify downstream consumers of into_parts() are updated for new return type

🤖 Generated with Claude Code

@prestwich prestwich requested a review from Evalir April 2, 2026 17:19
@prestwich prestwich force-pushed the prestwich/receipt-root-blockoutput branch from 4aa7288 to b8e18a8 Compare April 2, 2026 18:08
prestwich added a commit to init4tech/signet-sdk that referenced this pull request Apr 2, 2026
Add OnceLock-based memoization for transactions_root using the
seal/unseal pattern. Wire receipts_root from trevm's new
BlockOutput::receipt_root() accessor. Both roots are now set
explicitly in construct_header instead of relying on Default.

BREAKING: requires trevm >=0.34.2 (init4tech/trevm#155)

ENG-2120

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

lgtm. the single pass seal() is super elegant

@prestwich prestwich merged commit 9982b06 into main Apr 2, 2026
6 checks passed
prestwich added a commit to init4tech/signet-sdk that referenced this pull request Apr 3, 2026
Add OnceLock-based memoization for transactions_root using the
seal/unseal pattern. Wire receipts_root from trevm's new
BlockOutput::receipt_root() accessor. Both roots are now set
explicitly in construct_header instead of relying on Default.

BREAKING: requires trevm >=0.34.2 (init4tech/trevm#155)

ENG-2120

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convenience method on BlockOutput to calculate receipt root and bloom

2 participants