-
Notifications
You must be signed in to change notification settings - Fork 20
[Dijkstra] batch-aware collectP2ScriptsWithContext
#1015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
williamdemeo
merged 8 commits into
master
from
1006-dijkstra-batch-aware-collectp2scriptswithcontext
Jan 13, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0bd0262
Fix prose explaining CIP 118.
williamdemeo 5e6773b
update CHANGELOG
williamdemeo cca73aa
add `TxInfo.txInfoSubTxs` field
williamdemeo 176ac49
clean up txInfoForPurpose
williamdemeo 97d3bad
[Dijkstra] Fix collectP2ScriptsWithContext: TxLevel-indexed txInfo + …
williamdemeo b655c74
improvements
williamdemeo d480c57
remove duplicates
williamdemeo ca47549
cleanup and explain two utxo arguments
williamdemeo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
59 changes: 59 additions & 0 deletions
59
src/Ledger/Dijkstra/Specification/Script/ScriptPurpose.lagda.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| source_branch: master | ||
| source_path: src/Ledger/Dijkstra/Specification/Script/ScriptPurpose.lagda.md | ||
| --- | ||
|
|
||
| # Script Purpose {#sec:script-purpose} | ||
|
|
||
| <!-- | ||
| ```agda | ||
| {-# OPTIONS --safe #-} | ||
|
|
||
| open import Ledger.Dijkstra.Specification.Transaction | ||
|
|
||
| module Ledger.Dijkstra.Specification.Script.ScriptPurpose (txs : TransactionStructure) where | ||
|
|
||
| open import Ledger.Prelude | ||
| open TransactionStructure txs | ||
| open import Ledger.Dijkstra.Specification.Certs govStructure | ||
| ``` | ||
| --> | ||
|
|
||
| ```agda | ||
| data ScriptPurpose : Type where | ||
| Cert : DCert → ScriptPurpose | ||
| Rwrd : RewardAddress → ScriptPurpose | ||
| Mint : ScriptHash → ScriptPurpose | ||
| Spend : TxIn → ScriptPurpose | ||
| Vote : GovVoter → ScriptPurpose | ||
| Propose : GovProposal → ScriptPurpose | ||
| Guard : Credential → ScriptPurpose | ||
| ``` | ||
|
|
||
| Note that `Guard c` always indexes into *the current `tx`'s* `txGuards`: | ||
|
|
||
| + if `tx : TopLevelTx`, it indexes into the top-level guard set's list-view; | ||
| + if `tx : SubLevelTx`, it indexes into the subTx's guard set's list-view. | ||
|
|
||
| ```agda | ||
| mutual | ||
| record TxInfo : Type where | ||
| inductive | ||
| field | ||
| realizedInputs : UTxO | ||
| txOuts : Ix ⇀ TxOut | ||
| txFee : Maybe Fees | ||
| mint : Value | ||
| txCerts : List DCert | ||
| txWithdrawals : Withdrawals | ||
| txVldt : Maybe Slot × Maybe Slot | ||
| vkKey : ℙ KeyHash -- native/phase-1/timelock signers | ||
| txGuards : ℙ Credential -- CIP-0112/0118 guards (required by tx body) | ||
| txData : ℙ Datum | ||
| txId : TxId | ||
| txInfoSubTxs : Maybe (List SubTxInfo) | ||
|
|
||
| SubTxInfo : Type | ||
| SubTxInfo = TxInfo | ||
|
|
||
| ``` |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not particularly happy about the namings
utxoSpend₀utxoRefView.In
utxoSpend₀the subscript 0 suggests (to me) is a snapshot of the original utxo while the suffixRefViewinutxoRefViewsuggest the same.For simplicity I'd suggest keeping
utxofor theutxoin the state and maybeutxo₀for the snapshot before subtransactions are applied.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that sounds good. The idea behind the current names is that the subscript 0 refers to the origin utxo, while RefView is the evolving one that the reference scripts see... but I'm fine with your proposed naming scheme, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rename
utxoSpend₀→utxo₀(pre-batch snapshot used for spending-input inspection +realizedInputs) and keeputxoRefView(ref-input lookup view, potentially evolving to include earlier-prefix outputs).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see an obvious way to avoid having two utxo arguments in the script functions defined near the bottom of the
Transactionsmodule. I agree it would be nicer if we could bind these utxos to aUTxOEnvand aUTxOState, but the functions are defined in theTransactionmodule and used in theScripts.Validationmodule, before theUTxOEnvandUTxOStatetypes are even defined.