Skip to content

feat(lang): capture a policy's ref when withdrawing from its credential#335

Merged
scarmuega merged 1 commit into
mainfrom
feat/withdrawal-policy-ref-capture
Jun 7, 2026
Merged

feat(lang): capture a policy's ref when withdrawing from its credential#335
scarmuega merged 1 commit into
mainfrom
feat/withdrawal-policy-ref-capture

Conversation

@scarmuega

Copy link
Copy Markdown
Contributor

Extends the policy reference-script tracking (#332, #333) to cardano::withdrawal.

Why

Withdrawing from a script stake credential runs that script — the same situation as spending via an input's from or minting/burning under a policy. So a ref-backed policy used as a withdrawal from should contribute its ref UTxO as a reference input.

Change

WithdrawalField::From now lowers under capturing_policy_refs(), mirroring MintBlockField::Amount and InputBlockField::From. One line; the existing accumulator/drain handles the rest (withdrawals lower via adhoc, before the drain in TxDef::into_lower).

Spec

The merged spec (#334) listed the executing positions as input from / mint / burn. Withdrawal is a Cardano construct, so:

  • §7.13.4 now notes chain extensions may define further executing positions.
  • §8.3 (Withdrawal) states a ref-backed from is referenced per §7.13.4.

Test

New withdraw example tx (cardano::withdrawal { from: <ref-backed policy> }) asserts one reference input. cargo test -p tx3-lang: 167 passed, 0 failed.

🤖 Generated with Claude Code

Withdrawing from a script stake credential runs its script, so a
ref-backed policy used as a `cardano::withdrawal` `from` should
contribute its `ref` UTxO as a reference input, like an input's `from`
or a mint/burn policy. Lower the withdrawal `from` under
`capturing_policy_refs()`.

Add a `withdraw` example tx and assert it contributes one reference
input. Record the new executing position in the spec: §7.13.4 notes that
chain extensions may add executing positions, and §8.3 states a
ref-backed `from` is referenced per §7.13.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scarmuega scarmuega merged commit 5cf2068 into main Jun 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant