-
Notifications
You must be signed in to change notification settings - Fork 20
[Dijkstra] Make ScriptPurpose.Guard and IndexOfGuard carry a Credential
#1011
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
[Dijkstra] Make ScriptPurpose.Guard and IndexOfGuard carry a Credential
#1011
Conversation
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.
Pull request overview
This PR implements changes to make ScriptPurpose.Guard and IndexOfGuard carry a Credential instead of (TxId × ScriptHash), as part of the Dijkstra era specification work on CIP-0112 and CIP-0118.
Key Changes
- Changed
ScriptPurpose.Guardto carry aCredential(which can be either a key hash or script hash) instead of(TxId × ScriptHash) - Updated
TxBodyfields to usetxGuards : ℙ Credentialinstead oftxRequiredGuards : ℙ KeyHash, and changedtxRequiredTopLevelGuardsfrom a map to a list of(Credential × Maybe Datum)pairs - Added helper functions for phase-1 validation including
groupRequiredTopLevelGuards,requiredTopLevelGuardsSatisfied, and related types
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Ledger/Dijkstra/Specification/Transaction.lagda.md | Core changes to transaction body fields (txGuards, reqSignerHashes, txRequiredTopLevelGuards) and addition of phase-1 validation functions and extensive documentation updates |
| src/Ledger/Dijkstra/Specification/Script/Validation.lagda.md | Updated ScriptPurpose.Guard type, modified rdptr to use setToList on txGuards, and updated TxInfo to include separate vkKey and txGuards fields |
| src/Ledger/Dijkstra/Specification/Abstract.lagda.md | Changed indexOfGuard signature from (TxId × ScriptHash) → ℙ (TxId × ScriptHash) to Credential → List Credential |
| src/Ledger/Dijkstra/Specification/Utxo.lagda.md | New skeleton file defining UTXO and UTXOS transitions with phase-1 checks |
| src/Ledger/Dijkstra/Specification/Utxow.lagda.md | New skeleton file defining UTXOW as wrapper around UTXO |
| src/Ledger/Dijkstra/Specification.lagda.md | Added imports for new Utxo and Utxow modules |
| src/Ledger/Conway/Specification/Utxow.lagda.md | Fixed source_path metadata from .lagda to .lagda.md |
| src/Ledger/Conway/Specification/Utxo.lagda.md | Added missing source metadata header |
| CHANGELOG.md | Documented semantic changes to txRequiredTopLevelGuards, txGuards, and reqSignerHashes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
29516cc to
2ba8844
Compare
286942e to
e65a1ea
Compare
deeb8ad to
df6879c
Compare
e65a1ea to
e727cdf
Compare
df6879c to
43ce03e
Compare
e727cdf to
8e4a2c9
Compare
43ce03e to
ec362bc
Compare
8e4a2c9 to
446d9c8
Compare
+ Remove contradiction between "ref inputs may refer to earlier tx outputs in the batch" vs "all inputs must exist before applying any tx in the batch." The new text punts the exact constraint to the UTxO rules (where it belongs). + Fix Plutus bullet (old "nor earlier versions" reads like "no Plutus at all"). + Align fees with current Agda (`txFee : InTopLevel …`), but leave room for later CIP-driven updates.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
agreeing with Carlos' observation/suggestion
Agreeing with Carlos' suggestion to avoid "request."
+ a minimal `UTXOS` rule as a stub/hook (so `UTXO` can call something), + a minimal `UTXO` rule with just the new phase-1 premise (plus an explicit "calls UTXOS"), + a minimal `UTXOW`; just a wrapper over `UTXO` for now.
ec362bc to
5a88696
Compare
Key idea: + Keep `txGuards` as a set **for now**. + Define an ordered view `guardsList : List Credential` via `setToList`. + Make `indexOfGuard` operate on that list. + Let `rdptr` compute the `Ix` using `indexOfGuard`. For the "required top-level guards requested by subTxs" (i.e., `txRequiredTopLevelGuards` requests), we don't need a new ScriptPurpose constructor yet, because: + phase-1 ensures those requested credentials are contained in top-level `txGuards` + the later work (#1004 / #1006) will decide how to construct TxInfo / datum arguments for running those guard scripts batch-wide
446d9c8 to
c43c71a
Compare
5a88696 to
2dbea3f
Compare
carlostome
left a comment
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.
LGTM!
Description
Stacked PR. (This PR should be rebased on and target
masteronce PR #1010 is merged.)This PR closes #1003 by changing the type/signature of
ScriptPurpose.GuardandIndexOfGuard, andguardsList : List CredentialviasetToList,indexOfGuardoperate on that list,rdptrcompute theIxusingindexOfGuard.For the "required top-level guards requested by subTxs" (
txRequiredTopLevelGuardsrequests), we don't need a newScriptPurposeconstructor yet, becausetxGuardsTxInforules for guards #1004 / [Dijkstra] batch-awarecollectP2ScriptsWithContext+ singleevalP2Scriptsat end #1006) will decide how to constructTxInfo/ datum arguments for running those guard scripts batch-wide.Copilot-generated Description
This pull request updates the representation and handling of "Guard" script purposes in the Dijkstra ledger specification. The main change is a shift from using a tuple of
TxId × ScriptHashto using aCredentialfor identifying guards, which simplifies and clarifies the indexing and referencing of guards throughout the codebase.Guard ScriptPurpose and Indexing Refactor:
Guardconstructor inScriptPurposefrom(TxId × ScriptHash)toCredential, and updated the documentation to clarify thatGuard calways indexes into the current transaction'stxGuardslist-view.indexOfGuardfunction in theindexOfrecord to take aCredentialand aList Credentialinstead of a tuple and a set, aligning it with the newGuardrepresentation.rdptrfunction to use the updatedindexOfGuardsignature and to index into thetxGuardslist forGuardpurposes, ensuring consistency with the new approach.Checklist
CHANGELOG.md