fix(validate): handle non-conway utxos in conway txs#729
Conversation
📝 WalkthroughWalkthroughThis pull request refines witness validation logic in Conway validation by improving address extraction to support multiple output types (Conway through Byron), reordering tx_hash extraction, and enhancing the witness verification flow with explicit conditional handling and remaining witness checks. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pallas-validate/src/phase1/conway.rs (2)
296-329:⚠️ Potential issue | 🟠 MajorByron UTxO inputs will always fail with
InputDecoding.The comment on line 316 says "Byron outputs are handled separately below," but the
elsebranch at lines 327–328 simply returnsErr(PostAlonzo(InputDecoding)). There is no separate Byron handling — any Conway transaction spending a Byron UTxO will be rejected.If Byron inputs are intentionally unsupported (e.g., bootstrap witnesses aren't implemented), remove the misleading comment and add an explicit note. If they should be supported, Byron inputs need dedicated handling (bootstrap witness verification or a skip-and-delegate path).
Proposed fix (if Byron is intentionally unsupported)
} else { - // Byron outputs are handled separately below + // Byron outputs are not currently supported in validation; + // they would require bootstrap witness verification. None };
1356-1370:⚠️ Potential issue | 🔴 Critical
check_remaining_vk_witsonly validates the first uncovered witness.The
return Ok(())on line 1363 causes the function to exit after verifying the first uncovered witness, skipping signature verification for all subsequent uncovered witnesses. Every uncovered witness should be checked.Proposed fix
fn check_remaining_vk_wits( wits: &mut [(bool, VKeyWitness)], data_to_verify: &[u8], ) -> ValidationResult { for (covered, vkey_wit) in wits { if !*covered { - if verify_signature(vkey_wit, data_to_verify) { - return Ok(()); - } else { + if !verify_signature(vkey_wit, data_to_verify) { return Err(PostAlonzo(VKWrongSignature)); } } } Ok(()) }
Summary by CodeRabbit