diff --git a/pallas-txbuilder/src/transaction/model.rs b/pallas-txbuilder/src/transaction/model.rs index bc4e4c4..8e20281 100644 --- a/pallas-txbuilder/src/transaction/model.rs +++ b/pallas-txbuilder/src/transaction/model.rs @@ -433,7 +433,22 @@ impl StagingTransaction { /// VotingProcedure>>` map and pass the encoded bytes here. /// /// Used for DRep / SPO / committee voting on Conway governance actions. + /// + /// **Empty-map footgun**: Conway ledger expects this field to be + /// omitted (i.e. `None`) when there are no votes. Passing an empty + /// CBOR map (`0xa0`) gets through pallas-codec's + /// `NonEmptyKeyValuePairs::decode` (the upstream empty-map check is + /// commented out) but the resulting tx fails ledger validation at + /// submit time. **Don't call this builder if the map is empty — + /// just omit it.** The debug_assert below catches accidental empty- + /// map calls in dev/test builds. pub fn voting_procedures(mut self, cbor_bytes: Vec) -> Self { + debug_assert_ne!( + cbor_bytes.as_slice(), + &[0xa0u8], + "voting_procedures called with empty CBOR map — Conway ledger \ + rejects this; omit the field instead", + ); self.voting_procedures = Some(cbor_bytes); self }