Ledger¶
This module defines the ledger transition system where valid transactions transform the ledger state.
LEDGER Transition System Types¶
record SubLedgerEnv : Type where field slot : Slot ppolicy : Maybe ScriptHash pparams : PParams enactState : EnactState treasury : Treasury utxo₀ : UTxO rewards₀ : Rewards pState₀ : PState precedingDCerts : List DCert allScripts : ℙ Script isTopLevelValid : Bool record LedgerEnv : Type where field slot : Slot ppolicy : Maybe ScriptHash pparams : PParams enactState : EnactState treasury : Treasury
record LedgerState : Type where
field utxoSt : UTxOState govSt : GovState certState : CertState
Helper Functions¶
txgov : ∀ {ℓ} → TxBody ℓ → List (GovVote ⊎ GovProposal) txgov txb = map inj₂ txGovProposals ++ map inj₁ txGovVotes where open TxBody txb GovProposals+Votes : ∀ {ℓ} → Tx ℓ → List (GovVote ⊎ GovProposal) GovProposals+Votes tx = map inj₂ (ListOfGovProposalsOf tx) ++ map inj₁ (ListOfGovVotesOf tx) rmOrphanDRepVotes : CertState → GovState → GovState rmOrphanDRepVotes cs govSt = L.map (map₂ go) govSt where ifDRepRegistered : Credential → Type ifDRepRegistered c = c ∈ dom (DRepsOf cs) go : GovActionState → GovActionState go gas = record gas { votes = record (GovVotesOf gas) { gvDRep = filterKeys ifDRepRegistered (GovVotes.gvDRep (GovVotesOf gas)) } } allColdCreds : GovState → EnactState → ℙ Credential allColdCreds govSt es = ccCreds (es .cc) ∪ concatMapˢ (λ (_ , st) → proposedCC (GovActionOf st)) (fromList govSt)
LedgerState holds four coin-bearing components:
- UTxO state (UTxO balance plus fees plus donations);
- the rewards balance in
DState.rewards, summed bycoinFromRewards; -
the three
CertStatedeposit pots, summed bycoinFromDeposits: -
DState.deposits(stake-key deposits,Credential ⇀ Coin) PState.deposits(pool deposits,KeyHash ⇀ Coin)-
GState.deposits(DRepdeposits,Credential ⇀ Coin); -
the governance-action deposits, summed by
coinFromGovDepositoverGovActionState.depositfor each action in the currentGovState.
Components 2 and 3 are exactly getCoin of the
CertState. Component 4 is needed because the UTXO
batch-balance equation charges govProposalsDeposits on the
produced side: the deposit leaves the UTxO pot when a proposal is submitted and is
recorded in GovActionState.deposit by the GOV rule —
it is not kept in GState.deposits, so coinFromDeposits
alone does not account for it.
coinFromGovDeposit : GovState → Coin coinFromGovDeposit = foldr (λ (_ , gaSt) acc → GovActionState.deposit gaSt + acc) 0
LEDGER Transition System¶
New in Dijkstra¶
In Dijkstra we compute the set of "global" scripts and data once at the
top-level in the LEDGER rule. This is threaded through
SUBLEDGER to UTXOW/SUBUTXOW via
UTxOEnv/SubUTxOEnv.
-
allScripts : ℙ Script is the union of all scripts relevant to the entire batch: scripts referenced/witnessed by the top-level transaction plus scripts referenced/witnessed by every subtransaction (computed by
getAllScripts). -
legacyMode : Bool records whether the top-level transaction must be processed in legacy mode, i.e., whether some phase-2 script it needs uses a Plutus language older than V4 (computed by
isLegacyMode). The decision is made once, here, and threaded toUTXOW/UTXOviaUTxOEnvand toENTITIESviaEntitiesEnv.
Design Rationale for Ledger Rule Premises¶
- Batch-scoped phase-2 context.
We compute allScripts once, from the pre-batch UTxO snapshot
and the full batch (top-level transaction and all subtransactions). This ensures a
shared, batch-scoped pool of scripts for phase-2 validation.
-
Subtransactions are conditional on top-level validity.
-
If
IsValidFlagOf txTop ≡ true, then each subtransaction parametrizes its ownUTXOW/CERTS/GOVSrelation and the resulting (codomain) states are carried forward (viaSUBLEDGERS). -
If
IsValidFlagOf txTop ≡ false, thenSUBLEDGERSis the identity relation (no subtransaction effects are applied). -
Connecting top-level CERTS and GOVS relations relative to UTXOW.
We check top-level CERTS and GOVS relations before
top-level UTXOW because:
CERTStracks deposit updates (now included inCertState),-
UTXOaccounting needs the net deposit change of the whole batch in theUTxOEnv(used innewDepositsBatch/depositRefundsBatchin theUtxo.Accountingmodule). -
CertState and GovState Dependencies.
-
Top-level
CERTSrelates the post-SUBLEDGERSCertState(which reflects subtransaction certificates) to the finalCertState. - Top-level
GOVSrelates the post-SUBLEDGERSGovState(which relfects proposals/votes of subtransactions) to the finalGovState, and is parameterized by the finalCertState(so it sees the final registered DRep set after certificates). -
Orphan DRep votes are removed using the final (post-
CERTS)CertState. -
allColdCredsuses the finalGovState
The CertEnv assumed in the CERTS relation includes
allColdCreds govState₁ enactState to so that CC hot key registration can account
for both enacted CC credentials and any newly proposed CC actions that appear in
the final (post-subtransaction processing) GovState.
private variable Γ : SubLedgerEnv s s' s'' : LedgerState certs : List DCert subTxs : List SubLevelTx subTx : SubLevelTx pState₀ : PState data _⊢_⇀⦇_,SUBLEDGER⦈_ : SubLedgerEnv → LedgerState → SubLevelTx → LedgerState → Type where SUBLEDGER-V : ∙ isTopLevelValid ≡ true ∙ $\begin{pmatrix} \,\href{Ledger.Core.Specification.Epoch.html#954}{\htmlId{11598}{\htmlClass{Function}{\text{epoch}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{11604}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{11611}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#5214}{\htmlId{11616}{\htmlClass{Function}{\text{allColdCreds}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{11629}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{11639}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{11652}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \end{pmatrix}$ ⊢ certState₀ ⇀⦇ stx ,SUBENTITIES⦈ certState₁ ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Transaction.html#11562}{\htmlId{11718}{\htmlClass{Field}{\text{TxIdOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7450}{\htmlId{11725}{\htmlClass{Generalizable}{\text{stx}}}}\, \\ \,\href{Ledger.Core.Specification.Epoch.html#954}{\htmlId{11731}{\htmlClass{Function}{\text{epoch}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{11737}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{11744}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{11749}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{11759}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7317}{\htmlId{11772}{\htmlClass{Generalizable}{\text{certState₁}}}}\, \\ \,\href{Class.IsSet.html#916}{\htmlId{11785}{\htmlClass{Function}{\text{dom}}}}\, \,\htmlId{11789}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Dijkstra.Specification.Certs.html#7094}{\htmlId{11790}{\htmlClass{Field}{\text{RewardsOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7317}{\htmlId{11800}{\htmlClass{Generalizable}{\text{certState₁}}}}\,\,\htmlId{11810}{\htmlClass{Symbol}{\text{)}}}\, \end{pmatrix}$ ⊢ govState₀ ⇀⦇ GovProposals+Votes stx ,GOVS⦈ govState₁ ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{11879}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{11886}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{11891}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{11902}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{11910}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{11920}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{11928}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{11941}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ utxoState₀ ⇀⦇ stx ,SUBUTXOW⦈ utxoState₁ ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{12052}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{12059}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{12069}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{12074}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{12087}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{12098}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{12106}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{12117}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{12127}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{12135}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{12149}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{12171}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{12184}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{12196}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ stx ,SUBLEDGER⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7259}{\htmlId{12230}{\htmlClass{Generalizable}{\text{utxoState₁}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7365}{\htmlId{12243}{\htmlClass{Generalizable}{\text{govState₁}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7317}{\htmlId{12255}{\htmlClass{Generalizable}{\text{certState₁}}}}\, \end{pmatrix}$ SUBLEDGER-I : ∙ isTopLevelValid ≡ false ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{12327}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{12334}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{12339}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{12350}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{12358}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{12368}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{12376}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{12389}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ utxoState₀ ⇀⦇ stx ,SUBUTXOW⦈ utxoState₀ ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{12501}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{12508}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{12518}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{12523}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{12536}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{12547}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{12555}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{12566}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{12576}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{12584}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{12597}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{12619}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{12632}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{12644}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ stx ,SUBLEDGER⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{12678}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{12691}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{12703}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ data _⊢_⇀⦇_,SUBLEDGERS⦈_ : SubLedgerEnv → LedgerState → List SubLevelTx → LedgerState → Type where SUBLEDGERS-[] : Γ ⊢ s ⇀⦇ [] ,SUBLEDGERS⦈ s SUBLEDGERS-∷ : $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{12900}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{12907}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{12917}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{12922}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{12935}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{12946}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{12954}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{12965}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{12975}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{13001}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{13014}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ s ⇀⦇ subTx ,SUBLEDGER⦈ s' → $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{13073}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{13080}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{13090}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{13095}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{13108}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{13119}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{13127}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{13138}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{13148}{\htmlClass{Generalizable}{\text{certs}}}}\, \,\href{Data.List.Base.html#1712}{\htmlId{13154}{\htmlClass{Function Operator}{\text{++}}}}\, \,\href{Ledger.Dijkstra.Specification.Transaction.html#12598}{\htmlId{13157}{\htmlClass{Field}{\text{DCertsOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#11404}{\htmlId{13166}{\htmlClass{Generalizable}{\text{subTx}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{13174}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{13187}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ s' ⇀⦇ subTxs ,SUBLEDGERS⦈ s'' ─────────────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{13295}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{13302}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{13312}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{13317}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{13330}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7205}{\htmlId{13341}{\htmlClass{Generalizable}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7829}{\htmlId{13349}{\htmlClass{Generalizable}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11428}{\htmlId{13360}{\htmlClass{Generalizable}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#11352}{\htmlId{13370}{\htmlClass{Generalizable}{\text{certs}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7782}{\htmlId{13378}{\htmlClass{Generalizable}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7739}{\htmlId{13391}{\htmlClass{Generalizable}{\text{isTopLevelValid}}}}\, \end{pmatrix}$ ⊢ s ⇀⦇ subTx ∷ subTxs ,SUBLEDGERS⦈ s'' data _⊢_⇀⦇_,LEDGER⦈_ : LedgerEnv → LedgerState → TopLevelTx → LedgerState → Type where LEDGER-V : let utxo₀ : UTxO utxo₀ = UTxOOf utxoState₀ rewards₀ : Rewards rewards₀ = RewardsOf certState₀ pState₀ : PState pState₀ = PStateOf certState₀ allScripts : ℙ Script allScripts = getAllScripts tx utxo₀ legacyMode : Bool legacyMode = isLegacyMode utxo₀ allScripts tx in ∙ IsValidFlagOf tx ≡ true ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{13954}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{13961}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{13971}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{13976}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{13989}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13561}{\htmlId{14000}{\htmlClass{Bound}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13619}{\htmlId{14008}{\htmlClass{Bound}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13689}{\htmlId{14019}{\htmlClass{Bound}{\text{pState₀}}}}\, \\ \,\href{Agda.Builtin.List.html#184}{\htmlId{14029}{\htmlClass{InductiveConstructor}{\text{[]}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13755}{\htmlId{14034}{\htmlClass{Bound}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Transaction.html#14431}{\htmlId{14047}{\htmlClass{Field}{\text{IsValidFlagOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7401}{\htmlId{14061}{\htmlClass{Generalizable}{\text{tx}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{14070}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{14083}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{14095}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ SubTransactionsOf tx ,SUBLEDGERS⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7259}{\htmlId{14147}{\htmlClass{Generalizable}{\text{utxoState₁}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7365}{\htmlId{14160}{\htmlClass{Generalizable}{\text{govState₁}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7317}{\htmlId{14172}{\htmlClass{Generalizable}{\text{certState₁}}}}\, \end{pmatrix}$ ∙ $\begin{pmatrix} \,\href{Ledger.Core.Specification.Epoch.html#954}{\htmlId{14195}{\htmlClass{Function}{\text{epoch}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{14201}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{14208}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#5214}{\htmlId{14213}{\htmlClass{Function}{\text{allColdCreds}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7365}{\htmlId{14226}{\htmlClass{Generalizable}{\text{govState₁}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{14236}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13832}{\htmlId{14249}{\htmlClass{Bound}{\text{legacyMode}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13619}{\htmlId{14262}{\htmlClass{Bound}{\text{rewards₀}}}}\, \end{pmatrix}$ ⊢ certState₁ ⇀⦇ tx ,ENTITIES⦈ certState₂ ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Transaction.html#11562}{\htmlId{14324}{\htmlClass{Field}{\text{TxIdOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7401}{\htmlId{14331}{\htmlClass{Generalizable}{\text{tx}}}}\, \\ \,\href{Ledger.Core.Specification.Epoch.html#954}{\htmlId{14336}{\htmlClass{Function}{\text{epoch}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{14342}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{14349}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{14354}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{14364}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7328}{\htmlId{14377}{\htmlClass{Generalizable}{\text{certState₂}}}}\, \\ \,\href{Class.IsSet.html#916}{\htmlId{14390}{\htmlClass{Function}{\text{dom}}}}\, \,\htmlId{14394}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Dijkstra.Specification.Certs.html#7094}{\htmlId{14395}{\htmlClass{Field}{\text{RewardsOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7328}{\htmlId{14405}{\htmlClass{Generalizable}{\text{certState₂}}}}\,\,\htmlId{14415}{\htmlClass{Symbol}{\text{)}}}\, \end{pmatrix}$ ⊢ govState₁ ⇀⦇ GovProposals+Votes tx ,GOVS⦈ govState₂ ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{14483}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{14490}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{14495}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13561}{\htmlId{14506}{\htmlClass{Bound}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13689}{\htmlId{14514}{\htmlClass{Bound}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13755}{\htmlId{14524}{\htmlClass{Bound}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#13832}{\htmlId{14537}{\htmlClass{Bound}{\text{legacyMode}}}}\, \end{pmatrix}$ ⊢ utxoState₁ ⇀⦇ tx ,UTXOW⦈ utxoState₂ ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{14639}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{14646}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{14656}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{14661}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{14674}{\htmlClass{Generalizable}{\text{treasury}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{14689}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{14702}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{14714}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ tx ,LEDGER⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7270}{\htmlId{14744}{\htmlClass{Generalizable}{\text{utxoState₂}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#4841}{\htmlId{14757}{\htmlClass{Function}{\text{rmOrphanDRepVotes}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7328}{\htmlId{14775}{\htmlClass{Generalizable}{\text{certState₂}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7376}{\htmlId{14786}{\htmlClass{Generalizable}{\text{govState₂}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7328}{\htmlId{14798}{\htmlClass{Generalizable}{\text{certState₂}}}}\, \end{pmatrix}$ LEDGER-I : let utxo₀ : UTxO utxo₀ = UTxOOf utxoState₀ rewards₀ : Rewards rewards₀ = RewardsOf certState₀ pState₀ : PState pState₀ = PStateOf certState₀ allScripts : ℙ Script allScripts = getAllScripts tx utxo₀ legacyMode : Bool legacyMode = isLegacyMode utxo₀ allScripts tx in ∙ IsValidFlagOf tx ≡ false ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{15228}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{15235}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{15245}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{15250}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{15263}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#14834}{\htmlId{15274}{\htmlClass{Bound}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#14892}{\htmlId{15282}{\htmlClass{Bound}{\text{rewards₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#14962}{\htmlId{15293}{\htmlClass{Bound}{\text{pState₀}}}}\, \\ \,\href{Agda.Builtin.List.html#184}{\htmlId{15303}{\htmlClass{InductiveConstructor}{\text{[]}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#15028}{\htmlId{15308}{\htmlClass{Bound}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Transaction.html#14431}{\htmlId{15321}{\htmlClass{Field}{\text{IsValidFlagOf}}}}\, \,\href{Ledger.Dijkstra.Specification.Ledger.html#7401}{\htmlId{15335}{\htmlClass{Generalizable}{\text{tx}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{15344}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{15357}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{15369}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ SubTransactionsOf tx ,SUBLEDGERS⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{15421}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{15434}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{15446}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ∙ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{15469}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{15476}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{15481}{\htmlClass{Generalizable}{\text{treasury}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#14834}{\htmlId{15492}{\htmlClass{Bound}{\text{utxo₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#14962}{\htmlId{15500}{\htmlClass{Bound}{\text{pState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#15028}{\htmlId{15510}{\htmlClass{Bound}{\text{allScripts}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#15105}{\htmlId{15523}{\htmlClass{Bound}{\text{legacyMode}}}}\, \end{pmatrix}$ ⊢ utxoState₀ ⇀⦇ tx ,UTXOW⦈ utxoState₁ ──────────────────────────────── $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7499}{\htmlId{15625}{\htmlClass{Generalizable}{\text{slot}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7542}{\htmlId{15632}{\htmlClass{Generalizable}{\text{ppolicy}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7597}{\htmlId{15642}{\htmlClass{Generalizable}{\text{pp}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7643}{\htmlId{15647}{\htmlClass{Generalizable}{\text{enactState}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7692}{\htmlId{15660}{\htmlClass{Generalizable}{\text{treasury}}}}\, \end{pmatrix}$ ⊢ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7248}{\htmlId{15675}{\htmlClass{Generalizable}{\text{utxoState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{15688}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{15700}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$ ⇀⦇ tx ,LEDGER⦈ $\begin{pmatrix} \,\href{Ledger.Dijkstra.Specification.Ledger.html#7259}{\htmlId{15730}{\htmlClass{Generalizable}{\text{utxoState₁}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7354}{\htmlId{15743}{\htmlClass{Generalizable}{\text{govState₀}}}}\, \\ \,\href{Ledger.Dijkstra.Specification.Ledger.html#7306}{\htmlId{15755}{\htmlClass{Generalizable}{\text{certState₀}}}}\, \end{pmatrix}$