Skip to content

Commit d3b0243

Browse files
authored
Merge branch 'master' into 1019-dijkstra-stubs-for-ledger-rules
2 parents 40792f3 + c660581 commit d3b0243

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

src/Ledger/Dijkstra/Specification/Abstract.lagda.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ open import Ledger.Dijkstra.Specification.Certs govStructure
1212
1313
record indexOf : Type where
1414
field
15-
indexOfDCert : DCert → List DCert → Maybe Ix
16-
indexOfRewardAddress : RewardAddress → Withdrawals → Maybe Ix
17-
indexOfTxIn : TxIn → ℙ TxIn → Maybe Ix
18-
indexOfPolicyId : ScriptHash → ℙ ScriptHash → Maybe Ix
19-
indexOfVote : GovVoter → List GovVoter → Maybe Ix
20-
indexOfProposal : GovProposal → List GovProposal → Maybe Ix
21-
indexOfGuard : TxId × ScriptHash → ℙ (TxId × ScriptHash) → Maybe Ix
15+
indexOfDCert : DCert → List DCert → Maybe Ix
16+
indexOfRewardAddress : RewardAddress → Withdrawals → Maybe Ix
17+
indexOfTxIn : TxIn → ℙ TxIn → Maybe Ix
18+
indexOfPolicyId : ScriptHash → ℙ ScriptHash → Maybe Ix
19+
indexOfVote : GovVoter → List GovVoter → Maybe Ix
20+
indexOfProposal : GovProposal → List GovProposal → Maybe Ix
21+
indexOfGuard : Credential → List Credential → Maybe Ix
2222
2323
record AbstractFunctions : Type where
2424
field txScriptFee : Prices → ExUnits → Fees

src/Ledger/Dijkstra/Specification/Script/Validation.lagda.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,36 @@ open import Ledger.Dijkstra.Specification.Certs govStructure
2222

2323
```agda
2424
data ScriptPurpose : Type where
25-
Cert : DCert → ScriptPurpose
26-
Rwrd : RewardAddress → ScriptPurpose
27-
Mint : ScriptHash → ScriptPurpose
28-
Spend : TxIn → ScriptPurpose
29-
Vote : GovVoter → ScriptPurpose
30-
Propose : GovProposal → ScriptPurpose
31-
Guard : (TxId × ScriptHash) → ScriptPurpose
25+
Cert : DCert → ScriptPurpose
26+
Rwrd : RewardAddress → ScriptPurpose
27+
Mint : ScriptHash → ScriptPurpose
28+
Spend : TxIn → ScriptPurpose
29+
Vote : GovVoter → ScriptPurpose
30+
Propose : GovProposal → ScriptPurpose
31+
Guard : Credential → ScriptPurpose
3232
```
3333

34+
Note that `Guard c` always indexes into *the current `tx`'s* `txGuards`:
35+
36+
+ if `tx : TopLevelTx`, it indexes into the top-level guard set's list-view;
37+
+ if `tx : SubLevelTx`, it indexes into the subTx's guard set's list-view.
38+
3439
<!--
3540
```agda
3641
private variable
3742
ℓ : TxLevel
3843
3944
rdptr : (Tx ℓ) → ScriptPurpose → Maybe (RedeemerPtr ℓ)
4045
rdptr tx = λ where
41-
(Cert h) → map (Cert ,_) $ indexOfDCert h txCerts
42-
(Rwrd h) → map (Reward ,_) $ indexOfRewardAddress h txWithdrawals
43-
(Mint h) → map (Mint ,_) $ indexOfPolicyId h (policies mint)
44-
(Spend h) → map (Spend ,_) $ indexOfTxIn h txIns
45-
(Vote h) → map (Vote ,_) $ indexOfVote h (map GovVote.voter txGovVotes)
46-
(Propose h) → map (Propose ,_) $ indexOfProposal h txGovProposals
47-
(Guard h) → map (Guard ,_) $ indexOfGuard h (getTxScripts tx)
48-
where open TxBody (TxBodyOf tx)
46+
(Cert h) → map (Cert ,_) $ indexOfDCert h txCerts
47+
(Rwrd h) → map (Reward ,_) $ indexOfRewardAddress h txWithdrawals
48+
(Mint h) → map (Mint ,_) $ indexOfPolicyId h (policies mint)
49+
(Spend h) → map (Spend ,_) $ indexOfTxIn h txIns
50+
(Vote h) → map (Vote ,_) $ indexOfVote h (map GovVote.voter txGovVotes)
51+
(Propose h) → map (Propose ,_) $ indexOfProposal h txGovProposals
52+
(Guard c) → map (Guard ,_) $ indexOfGuard c (setToList txGuards)
53+
where open TxBody (TxBodyOf tx)
54+
4955
-- getSubTxScripts : TopLevelTx → ℙ (TxId × ScriptHash)
5056
5157
indexedRdmrs : (Tx ℓ) → ScriptPurpose → Maybe (Redeemer × ExUnits)

0 commit comments

Comments
 (0)