feat(lang): capture a policy's ref when withdrawing from its credential#335
Merged
Conversation
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>
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.
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
fromor minting/burning under a policy. So aref-backed policy used as a withdrawalfromshould contribute itsrefUTxO as a reference input.Change
WithdrawalField::Fromnow lowers undercapturing_policy_refs(), mirroringMintBlockField::AmountandInputBlockField::From. One line; the existing accumulator/drain handles the rest (withdrawals lower viaadhoc, before the drain inTxDef::into_lower).Spec
The merged spec (#334) listed the executing positions as input
from/ mint / burn. Withdrawal is a Cardano construct, so:ref-backedfromis referenced per §7.13.4.Test
New
withdrawexample tx (cardano::withdrawal { from: <ref-backed policy> }) asserts one reference input.cargo test -p tx3-lang: 167 passed, 0 failed.🤖 Generated with Claude Code