Skip to content

Commit eed967f

Browse files
committed
token algebras are era independent
1 parent 98b6828 commit eed967f

File tree

8 files changed

+21
-16
lines changed

8 files changed

+21
-16
lines changed

src/Ledger/Conway/Specification/Transaction.lagda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Ledger.Conway.Specification.PParams
2727
import Ledger.Conway.Specification.Script.Base
2828
import Ledger.Conway.Specification.Gov.Actions
2929
import Ledger.Conway.Specification.Certs
30-
import Ledger.Conway.Specification.TokenAlgebra.Base
30+
import Ledger.Core.Specification.TokenAlgebra.Base
3131
import Ledger.Core.Specification.Address
3232
3333
open import Relation.Nullary.Decidable using (⌊_⌋)
@@ -88,7 +88,7 @@ record TransactionStructure : Type₁ where
8888
8989
field cryptoStructure : _
9090
open CryptoStructure cryptoStructure public
91-
open Ledger.Conway.Specification.TokenAlgebra.Base ScriptHash public
91+
open Ledger.Core.Specification.TokenAlgebra.Base ScriptHash public
9292
open Ledger.Core.Specification.Address Network KeyHash ScriptHash ⦃ it ⦄ ⦃ it ⦄ ⦃ it ⦄ public
9393
9494
field epochStructure : _

src/Ledger/Conway/Specification/Utxo.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ instance
137137
```
138138
-->
139139

140-
*UTxO transitions*
140+
*UTxO transitions*
141141

142142
```agda
143143
data _⊢_⇀⦇_,UTXO⦈_ : UTxOEnv → UTxOState → Tx → UTxOState → Type

src/Ledger/Core/Specification/TokenAlgebra/Base.lagda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source_branch: master
3-
source_path: src/Ledger/Conway/Specification/TokenAlgebra/Base.lagda
3+
source_path: src/Ledger/Core/Specification/TokenAlgebra/Base.lagda
44
---
55

66
# Token Algebras {#sec:token-algebra}
@@ -11,7 +11,7 @@ Token algebras are used for multiple assets.
1111
```agda
1212
{-# OPTIONS --safe #-}
1313
open import Prelude using (Type)
14-
module Ledger.Conway.Specification.TokenAlgebra.Base (
14+
module Ledger.Core.Specification.TokenAlgebra.Base (
1515
```
1616
-->
1717
*Abstract types*

src/Ledger/Core/Specification/TokenAlgebra/Coin.lagda.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
source_branch: master
3-
source_path: src/Ledger/Conway/Specification/TokenAlgebra/Coin.lagda.md
3+
source_path: src/Ledger/Core/Specification/TokenAlgebra/Coin.lagda.md
44
---
55

66
```agda
77
{-# OPTIONS --safe #-}
88
open import Ledger.Prelude
99
10-
module Ledger.Conway.Specification.TokenAlgebra.Coin (X : Type) where
10+
module Ledger.Core.Specification.TokenAlgebra.Coin (X : Type) where
1111
1212
open import Algebra.Morphism.Construct.Identity
1313
using (isMonoidHomomorphism)
1414
15-
open import Ledger.Conway.Specification.TokenAlgebra.Base X
15+
open import Ledger.Core.Specification.TokenAlgebra.Base X
1616
1717
open TokenAlgebra
1818

src/Ledger/Core/Specification/TokenAlgebra/ValueSet.lagda.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source_branch: master
3-
source_path: src/Ledger/Conway/Specification/TokenAlgebra/ValueSet.lagda.md
3+
source_path: src/Ledger/Core/Specification/TokenAlgebra/ValueSet.lagda.md
44
---
55

66
## Value Set {#sec:value-set}
@@ -12,11 +12,11 @@ source_path: src/Ledger/Conway/Specification/TokenAlgebra/ValueSet.lagda.md
1212
1313
open import Prelude using (Type)
1414
15-
module Ledger.Conway.Specification.TokenAlgebra.ValueSet (PolicyId AssetName : Type) where
15+
module Ledger.Core.Specification.TokenAlgebra.ValueSet (PolicyId AssetName : Type) where
1616
1717
open import Ledger.Prelude hiding (lookup ; update ; isMagma ; isEquivalence) renaming (TotalMap to _⇒_)
1818
open _⇒_
19-
open import Ledger.Conway.Specification.TokenAlgebra.Base PolicyId using (TokenAlgebra)
19+
open import Ledger.Core.Specification.TokenAlgebra.Base PolicyId using (TokenAlgebra)
2020
2121
open import Algebra using (Op₂ ; IsSemigroup ; IsMonoid ; IsMagma ; IsCommutativeMonoid)
2222
open import Algebra.Morphism using (IsMonoidHomomorphism ; IsMagmaHomomorphism)

src/Ledger/Core/Specification/TokenAlgebra/ValueVector.lagda.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
source_branch: master
3-
source_path: src/Ledger/Conway/Specification/TokenAlgebra/ValueVector.lagda.md
3+
source_path: src/Ledger/Core/Specification/TokenAlgebra/ValueVector.lagda.md
44
---
55

66
```agda
77
{-# OPTIONS --safe #-}
88
open import Ledger.Prelude hiding (_∙_; ε)
99
10-
module Ledger.Conway.Specification.TokenAlgebra.ValueVector (PolicyId : Type) (n : ℕ) where
10+
module Ledger.Core.Specification.TokenAlgebra.ValueVector (PolicyId : Type) (n : ℕ) where
1111
1212
import Algebra as Alg
1313
open import Algebra.Construct.DirectProduct
@@ -19,7 +19,7 @@ open import Data.Vec as Vec
1919
import stdlib.Data.Vec.Instances as Vec
2020
import Data.Vec.Relation.Binary.Pointwise.Inductive as Vec
2121
22-
open import Ledger.Conway.Specification.TokenAlgebra.Base PolicyId
22+
open import Ledger.Core.Specification.TokenAlgebra.Base PolicyId
2323
2424
Quantity = ℕ
2525

src/Ledger/Dijkstra/Specification/TokenAlgebra/Base.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ source_path: src/Ledger/Dijkstra/Specification/TokenAlgebra/Base.lagda.md
77
open import Prelude using (Type)
88
module Ledger.Dijkstra.Specification.TokenAlgebra.Base (PolicyId : Type) where
99
10-
open import Ledger.Conway.Specification.TokenAlgebra.Base PolicyId public
10+
open import Ledger.Core.Specification.TokenAlgebra.Base PolicyId public
1111
```

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ The fields that depend on the transaction level use the auxiliary functions
191191
field
192192
txBody : TxBody txLevel
193193
txWitnesses : TxWitnesses txLevel
194-
isValid : InTopLevel txLevel Bool
194+
txSize : InSubLevel txLevel ℕ -- only in sub-level tx
195+
isValid : InTopLevel txLevel Bool -- only in top-level tx
195196
txAuxData : Maybe AuxiliaryData
196197
197198
record TxBody (txLevel : TxLevel) : Type where
@@ -391,6 +392,10 @@ could be either of them.
391392
getTxScripts {TxLevelSub} = getSubTxScripts
392393
getTxScripts {TxLevelTop} =
393394
concatMapˢ getSubTxScripts ∘ fromList ∘ TxBody.txSubTransactions ∘ TxBodyOf
395+
396+
getTopLevelTxSize : TopLevelTx → ℕ
397+
getTopLevelTxSize txTop = sum (map (λ subTx → subTx .txSize) (txTop .txBody .txSubTransactions))
398+
where open Tx; open TxBody
394399
```
395400
-->
396401

0 commit comments

Comments
 (0)