pallas-txbuilder: thread voting_procedures through StagingTransaction → Conway build

Fills the third of pallas-txbuilder's Conway TODOs (after auxiliary_data
+ certificates):

- StagingTransaction gains `voting_procedures: Option<Vec<u8>>` (opaque
  CBOR — same Eq-derive workaround as auxiliary_data + certificates)
- Builder methods .voting_procedures(cbor_bytes) + .clear_voting_procedures()
- conway::build_conway_raw decodes via VotingProcedures::decode_fragment
  and assigns to TransactionBody.voting_procedures

VotingProcedures is itself a NonEmptyKeyValuePairs<Voter,
NonEmptyKeyValuePairs<GovActionId, VotingProcedure>> map, so callers
pre-assemble the full map and encode once.

Tests:
- voting_procedures_plumb_through_to_tx_body — encode DRepKey vote-Yes
  on a synthetic GovActionId, build, decode, assert round-trip
- no_voting_procedures_means_none — negative path
This commit is contained in:
Kayos 2026-05-06 07:11:23 -07:00
parent 310b0fe562
commit 507fd9da15
3 changed files with 120 additions and 3 deletions

View file

@ -57,7 +57,32 @@ Tests added:
asserts the cert round-trips byte-for-byte.
- `no_certificates_means_none` — negative path.
### 3. `pallas-addresses``pub fn new` on `StakeAddress`
### 3. `pallas-txbuilder``voting_procedures` field on `StagingTransaction`
Upstream had `voting_procedures: None, // TODO` in the conway builder.
Without this, **DRep / SPO / committee voting on Conway governance
actions can't ride a tx built with pallas-txbuilder.**
Added 2026-05-06:
- `pub voting_procedures: Option<Vec<u8>>` field (opaque CBOR for the
same `Eq`-derive reason as `auxiliary_data`).
- Builder methods `.voting_procedures(cbor_bytes)` and
`.clear_voting_procedures()`.
- `conway::build_conway_raw` decodes via `VotingProcedures::decode_fragment`
and assigns to `TransactionBody.voting_procedures`.
The `VotingProcedures` type is itself a single map
(`NonEmptyKeyValuePairs<Voter, NonEmptyKeyValuePairs<GovActionId,
VotingProcedure>>`), so callers pre-assemble the full map and encode
once. No staged accumulator needed.
Tests added:
- `voting_procedures_plumb_through_to_tx_body` — encodes a
single DRepKey-vote-Yes on a synthetic GovActionId, builds, decodes,
asserts the vote round-trips byte-for-byte.
- `no_voting_procedures_means_none` — negative path.
### 4. `pallas-addresses``pub fn new` on `StakeAddress`
Upstream defined `pub struct StakeAddress(Network, StakePayload)` with
**unexported tuple fields** and no `new()` constructor — so external
@ -103,6 +128,7 @@ per change) for upstream review ergonomics:
- `pallas-txbuilder: thread auxiliary_data through StagingTransaction → Conway build`
- `pallas-txbuilder: thread certificates through StagingTransaction → Conway build`
- `pallas-txbuilder: thread voting_procedures through StagingTransaction → Conway build`
- `pallas-addresses: pub fn new on StakeAddress`
## Change discipline going forward