Skip to content

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Dec 15, 2025

No description provided.

@Amxx Amxx requested a review from a team as a code owner December 15, 2025 09:24
@Amxx Amxx added tests Test suite and helpers. ignore-changeset labels Dec 15, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 15, 2025

⚠️ No Changeset found

Latest commit: 433e75b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

A new test helper class BlockTries is introduced in test/helpers/trie.js to build and manage Merkle Patricia Tries for block transactions and receipts. The class provides methods to generate proofs, access trie roots, and serialize transactions and receipts. Additionally, test/utils/cryptography/TrieProof.test.js is refactored to use the new BlockTries helper instead of manually constructing tries and computing proofs.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to evaluate whether the description relates to the changeset. Add a pull request description explaining the purpose of the BlockTries helper class and how it simplifies trie proof testing.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a new test helper class (BlockTries) for handling Merkle Patricia Tries and Trie Proofs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/helpers/trie.js (1)

41-47: Root getters may return incorrect values if accessed before ready() resolves.

These getters access trie.root() synchronously without waiting for the initialization to complete. If a consumer uses new BlockTries(block) directly (instead of BlockTries.from()), accessing these getters immediately would return the empty trie root rather than the populated one.

The current test usage via BlockTries.from() is safe since it awaits ready(). Consider adding a JSDoc warning or making these async-aware if broader usage is expected.

  get transactionTrieRoot() {
+   // Note: Only access after ready() has resolved (e.g., via BlockTries.from())
    return ethers.hexlify(this.transactionTrie.root());
  }

  get receiptTrieRoot() {
+   // Note: Only access after ready() has resolved (e.g., via BlockTries.from())
    return ethers.hexlify(this.receiptTrie.root());
  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e19973 and 433e75b.

📒 Files selected for processing (2)
  • test/helpers/trie.js (1 hunks)
  • test/utils/cryptography/TrieProof.test.js (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
test/helpers/trie.js (1)
test/utils/cryptography/TrieProof.test.js (9)
  • require (1-1)
  • require (2-2)
  • require (3-3)
  • require (5-5)
  • require (6-6)
  • require (7-7)
  • require (8-8)
  • require (9-9)
  • receipt (100-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: slither
  • GitHub Check: tests-foundry
  • GitHub Check: tests
  • GitHub Check: tests-upgradeable
  • GitHub Check: coverage
  • GitHub Check: halmos
🔇 Additional comments (4)
test/helpers/trie.js (3)

59-70: LGTM!

The receipt serialization correctly implements the EIP-2718 typed transaction envelope format, with proper handling of legacy (type 0) receipts without a prefix and typed receipts with the type byte prepended.


11-26: LGTM!

The parallel initialization pattern efficiently populates both tries, and the promise chain correctly propagates to _ready. The tx.wait() call ensures receipt is available before insertion.


72-78: LGTM!

The key encoding correctly uses RLP-encoded indices with leading zeros stripped, matching Ethereum's transaction/receipt trie key format.

test/utils/cryptography/TrieProof.test.js (1)

85-104: LGTM!

The refactored code correctly uses BlockTries.from() to ensure tries are populated before accessing roots and proofs. The serialization calls pass the appropriate objects (Transaction for serializeTransaction, TransactionReceipt for serializeReceipt), and the key generation via indexToKey properly matches the trie key format.

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

Labels

ignore-changeset tests Test suite and helpers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant