Devnet full protocol flow — US1 complete#20
Merged
Conversation
…vest/coalition_types.ak
Extends voucher_spend.ak with a coalition_hash parameter and the four settlement checks from specs/003-devnet-full-flow/contracts/voucher-datum.md: coalition ref input present + parseable, datum.shop_pk in shop_pks, signing reificator in reificator_pks and matches datum.reificator_pk, output carries same role-binding fields with only commit_spent updated. Migrates the #15 DevnetSpendSpec onto the new tx shape (single-member coalition bootstrap, threaded ref input) so the suite stays green at every commit. Extends Harvest.Transaction.spendVoucher with the coalition TxIn arg and reificator signatory. Refreshes the applied voucher_spend blueprint fixture.
T018: first settlement (c1, non-membership) — asserts commit_spent rotation after a full coalition-bootstrap + onboard + deploy + settle pipeline. T019: second settlement (c1-cert2) — exercises a different fixture bundle (d=15, C=200) to confirm the validator isn't pinned to one set of proof values. T020: negative — substitutes a non-coalition UTxO as the reference input, validator's find_coalition_ref returns None → rejected (SC-005). Generalises Fixtures.loadBundleVariant to load alternate fixture sets (c1-cert2, c2) while sharing VK and applied-script hex.
4c2c0f3 to
8c09d69
Compare
8c09d69 to
5c4eb17
Compare
Implements the voucher_redeem validator (5 checks from contracts/voucher-datum.md §Validator checks — redemption), off-chain redeemVoucher builder, blueprint fixture, and the DevnetRedeemSpec test scenarios (redeem, re-settle, negative).
5c4eb17 to
f19ac16
Compare
…ication The applied-voucher-spend.hex fixture contained the UNAPPLIED compiled code — aiken blueprint apply with -v dotted.title silently failed (exit 1). All devnet spend tests saw InvalidReturnValue because the script still had 2 extra lambda abstractions for vk and coalition_hash. Fix: use -m module -v validator -o plutus.json format which works correctly in aiken v1.1.21. Regenerated all three fixtures from a single aiken build for consistency (coalition-metadata hash changed slightly between Aiken versions, requiring all dependent fixtures to use the same hash).
The coalition-metadata UTxO is a CIP-31 reference input — it must not appear in regular inputs. Including it in inputUtxos caused BabbageNonDisjointRefInputs (inputs ∩ refInputs must be empty) and MissingScriptWitnessesUTXOW (consumed script input needs a redeemer). Removing it from inputUtxos in submitSpend and submitRedeem fixes both.
fundReificator used waitForUtxos which returns as soon as any UTxOs exist at the reificator address. After the spend spec, the address already has change UTxOs, so waitForUtxos returned immediately with stale UTxOs that don't contain the 50M fee output. Replace with waitForFunded that polls until UTxOs with the exact funded amounts appear.
Merge voucher_spend, voucher_redeem, and voucher_revert into a single
voucher_validator with a VoucherAction sum-type redeemer (Constr 0/1/2).
One script, one address — all operations share the same applied fixture.
Aiken: VoucherAction { Spend{...}, Redeem{...}, Revert{...} } with
inline fields, dispatching to handle_spend/handle_redeem/handle_revert.
Haskell: VoucherAction wrapper type with ToData that maps SpendRedeemer
to Constr 0, RedeemRedeemer to Constr 1, RevertRedeemer to Constr 2.
Fixes MissingScript error in DevnetRedeemSpec — the voucher UTxO is
now at the same address regardless of which operation consumes it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full devnet E2E protocol flow for US1 (#9), covering coalition bootstrap through settlement and redemption.
Architecture: unified voucher validator
All three operations (spend, redeem, revert) use a single on-chain validator with a `VoucherAction` sum-type redeemer. One script, one address — the redeemer variant (Constr 0/1/2) selects the operation.
Patches
CI fixes