fix(settlement): return false on malformed proof in Groth16SettlementVerifier#101
Conversation
…Verifier
abi.decode reverts on malformed/short proof bytes, which propagated
through MARKSettlementModule as a raw error instead of VerificationFailed.
Fix: check proof.length == 672 before decoding (fixed ABI encoding size:
uint256[2]+uint256[2][2]+uint256[2]+uint256[13] = 64+128+64+416 = 672).
Malformed proofs now return false cleanly.
Tests: testVerifySettlementReturnsFalseForMalformedProof,
testVerifySettlementReturnsFalseForEmptyProof
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR adds an upfront proof length validation to ChangesProof Length Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
abi.decodereverts on malformed or short proof bytes. This propagated throughMARKSettlementModule._consumeAndValidateas a raw ABI decode error instead ofVerificationFailed, since the module expectsverifySettlementto returnfalsefor invalid proofs — not revert.Fix
Check
proof.length == 672before decoding. The ABI encoding of(uint256[2], uint256[2][2], uint256[2], uint256[13])is always exactly 672 bytes (64+128+64+416). Malformed proofs now returnfalsecleanly.Tests
testVerifySettlementReturnsFalseForMalformedProoftestVerifySettlementReturnsFalseForEmptyProofScope
contracts/src/settlement, contracts/test/unit/settlement
Verification
Summary by CodeRabbit
Bug Fixes
Tests