Skip to content

Remove unused PaymentPurse alias and CoinPaymentInvoice type - #90

Merged
filvecchiato merged 1 commit into
codex/rfc-0016-merchant-paymentsfrom
vf/rfc-0017-remove-unused-types
May 15, 2026
Merged

Remove unused PaymentPurse alias and CoinPaymentInvoice type#90
filvecchiato merged 1 commit into
codex/rfc-0016-merchant-paymentsfrom
vf/rfc-0017-remove-unused-types

Conversation

@filvecchiato

Copy link
Copy Markdown
Collaborator

Summary

  • Remove PaymentPurse type alias from v01/payment.rs — defined but never referenced
  • Remove CoinPaymentInvoice struct from v01/coin_payment.rs — product-constructed wire format not used by any host trait method (the RFC documents it as a spec)

Test plan

  • cargo build --workspace
  • cargo test --workspace — all 18 tests pass
  • cargo +nightly fmt --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings

- PaymentPurse is defined but never referenced
- CoinPaymentInvoice is a product-constructed wire format not used
  by any host trait method; the RFC documents it as a spec
@filvecchiato
filvecchiato merged commit 0e97fd3 into codex/rfc-0016-merchant-payments May 15, 2026
9 checks passed
@filvecchiato
filvecchiato deleted the vf/rfc-0017-remove-unused-types branch May 15, 2026 14:24
TorstenStueber added a commit that referenced this pull request May 26, 2026
Adds the fee_balance field to State + four typed ops:

  State.fee_balance: u64               (Quint feeAccountBalance)
  FeeMode { Prepaid, FromOutput }      (Quint FeeMode)

  top_up_fee_account(amount) -> ()     (Quint topUpFeeAccount)
  deduct_fee(amount)         -> Result<(), Error>
  read_fee_balance()         -> u64
  select_fee_mode(fee)       -> FeeMode

The cascade landed via two-pass approach:

  Pass 1 (mechanical): replace_all adds
    `final(self).fee_balance == old(self).fee_balance` after every
    existing `final(self).next_age == old(self).next_age` postcondition,
    and the parallel form for every loop invariant. 42 + 10 sites
    auto-updated; baseline stays at 209 verified.

  Pass 2 (per-function): the two fee-account mutators that DO change
    fee_balance need ghost-capture proof scaffolding so Verus can see
    the partial-mutation preserves all other State fields. Same
    pattern documented in [[feedback-verus-ghost-field-mutation]]:
    capture old_*_vec / old_spec_* ghosts before the mutation, assert
    equality afterwards.

Unlocks task #89 (unload tokens) and is a template for the larger
events Vec cascade (task #92).

214 verified, 0 errors.
TorstenStueber added a commit that referenced this pull request May 26, 2026
Adds the Quint event stream:

  Event enum: 8 variants matching Quint Event types
              (CoinAvailable, CoinSpent, EntryAllocated, EntryReadinessChanged,
               EntryConsumed, OperationStarted, OperationProgress,
               OperationCompleted)
  State.events: Vec<Event>

  emit_event(e)       -> ()        append-only primitive
  event_count()       -> usize     event-stream length

The cascade landed via the same two-pass playbook from #90:
  1. Bulk add `final.events@ == old.events@` after every
     `final.next_extrinsic_id == old.next_extrinsic_id` site
     (postconditions + loop invariants).
  2. New emitter functions use the ghost-capture scaffold.

The events field is the biggest possible State extension by surface
area, and it landed without any per-function chasing — proving the
playbook is robust. From here, every wrapper that should emit events
(tracked_transfer, mark_op_done, etc.) just needs to add an
emit_event call + declare the emission in its postcondition.

219 verified, 0 errors.
TorstenStueber added a commit that referenced this pull request May 26, 2026
…ssion

Adds the Quint unload-token mechanics (§6.5):

  UnloadTokenClass { Free, Paid }
  UnloadToken { period, class, counter, consumed }
  State.tokens: Vec<UnloadToken>

  mint_token(period, class, counter) -> usize     chain emits token
  consume_token(idx)  -> Result<(), Error>        flip consumed flag
  token_count()       -> usize                    reader

consume_token is idempotent: returns Err(Internal) if the index is
out of range OR the token is already consumed; state stays unchanged
in both cases. Future work: surface a typed UnloadTokenNotAvailable
error variant.

This completes all four State-extension items raised by the user's
"are we stuck on Phase 6?" question. The proven cascade pattern
landed every one:
  - fee_balance      (task #90 ✅)
  - next_extrinsic_id (just-shipped)
  - events           (task #92 ✅)
  - total_in / total_out / paid_ring_membership
  - tokens           (task #89 ✅)

229 verified, 0 errors. The cascade isn't a blocker anymore — it's
a standard template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants