fix expectedhash in trimsoliditycbormetadata#14
Conversation
WalkthroughThe pull request updates two contract files: adding EVM_LOG3 to the NON_STATIC_OPS constant in IExtrospectInterpreterV1.sol, and updating a Solidity CBOR metadata hash value in LibExtrospectBytecode.sol. Both are minimal changes to constants and configuration values. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/lib/LibExtrospectBytecode.sol`:
- Line 58: The hardcoded expectedHash value in LibExtrospectBytecode.sol may be
off by a nibble; add a verification path and proof: update the code around
trimSolidityCBORMetadata and checkCBORTrimmedBytecodeHash to include a
deterministic derivation comment or a helper function that computes the expected
CBOR hash from the CBOR suffix (and replace the bytes32(uint256(...)) literal
with an explicit 0x-prefixed hex literal to preserve the leading zero), and add
a small regression test that runs trimSolidityCBORMetadata on known-good
bytecode and asserts the returned hash matches the derived value to prevent
silent failures.
| //slither-disable-next-line too-many-digits | ||
| uint256 maskB = 0x000000000000000000000000000000000000000000FFFFFFFFFFFF000000FFFF; | ||
| bytes32 expectedHash = bytes32(uint256(0xe55864b80a56accebaca64500e23598f6acfb743a5475323f0b7f2d0d268c62)); | ||
| bytes32 expectedHash = bytes32(uint256(0x0e55864b80a56accebaca64500e23598f6acfb743a5475323f0b7f2d0d268c62)); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Add a verification path for the updated expected CBOR hash.
This one‑nibble change can silently make trimSolidityCBORMetadata fail and cause checkCBORTrimmedBytecodeHash to revert even for valid bytecode. Please add a small regression test or a documented derivation for the expected hash so the change is provably correct. Also consider using a hex literal to make the leading zero explicit.
💡 Optional clarity tweak for the literal
- bytes32 expectedHash = bytes32(uint256(0x0e55864b80a56accebaca64500e23598f6acfb743a5475323f0b7f2d0d268c62));
+ bytes32 expectedHash = hex"0e55864b80a56accebaca64500e23598f6acfb743a5475323f0b7f2d0d268c62";🤖 Prompt for AI Agents
In `@src/lib/LibExtrospectBytecode.sol` at line 58, The hardcoded expectedHash
value in LibExtrospectBytecode.sol may be off by a nibble; add a verification
path and proof: update the code around trimSolidityCBORMetadata and
checkCBORTrimmedBytecodeHash to include a deterministic derivation comment or a
helper function that computes the expected CBOR hash from the CBOR suffix (and
replace the bytes32(uint256(...)) literal with an explicit 0x-prefixed hex
literal to preserve the leading zero), and add a small regression test that runs
trimSolidityCBORMetadata on known-good bytecode and asserts the returned hash
matches the derived value to prevent silent failures.
Motivation
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit