-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Add test helper for Trie Proofs #6207
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
base: master
Are you sure you want to change the base?
Conversation
|
6f2b11d to
433e75b
Compare
WalkthroughA new test helper class Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this 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 beforeready()resolves.These getters access
trie.root()synchronously without waiting for the initialization to complete. If a consumer usesnew BlockTries(block)directly (instead ofBlockTries.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 awaitsready(). 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
📒 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. Thetx.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 forserializeTransaction, TransactionReceipt forserializeReceipt), and the key generation viaindexToKeyproperly matches the trie key format.
No description provided.