Skip to content

Commit

Permalink
formal-ledger-specification commit fbca6b45f0fcb4a06954569e6689c8316d…
Browse files Browse the repository at this point in the history
…60956a
  • Loading branch information
Soupstraw committed Apr 17, 2024
1 parent 166a14a commit 1ffb1d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions MAlonzo/Code/Ledger/Foreign/LedgerTypes.hs
Expand Up @@ -46,7 +46,8 @@ type Rational = (Integer, Integer)
type Coin = Integer
type Addr = Integer

type TxId = Integer
newtype TxId = MkTxId Integer
deriving (Generic, Show, Eq, Ord)
type Ix = Integer
type Epoch = Integer
type ScriptHash = Integer
Expand All @@ -70,7 +71,6 @@ type RdmrPtr = (Tag, Ix)
type ExUnits = (Integer, Integer)
type ProtVer = (Integer, Integer)
type GovActionID = (TxId, Integer)
newtype TxId = MkTxId Integer
data Credential
= ScriptObj Integer
| KeyHashObj Integer
Expand Down
20 changes: 10 additions & 10 deletions test/UtxowSpec.hs
Expand Up @@ -42,7 +42,7 @@ a2 :: Addr
a2 = 2

initUTxO :: UTxO
initUTxO = [ (0, 0) .-> (a0, (1000, (Nothing, Nothing))) ]
initUTxO = [ (MkTxId 0, 0) .-> (a0, (1000, (Nothing, Nothing))) ]

initState :: UTxOState
initState = MkUTxOState {utxo = initUTxO, fees = 0}
Expand All @@ -68,12 +68,12 @@ bodyFromSimple pp stxb = let s = 5 in MkTxBody

testTxBody1 :: TxBody
testTxBody1 = bodyFromSimple initParams $ MkSimpleTxBody
{ stxins = [(0, 0)]
, srefInputs = [(0, 0)]
{ stxins = [(MkTxId 0, 0)]
, srefInputs = [(MkTxId 0, 0)]
, stxouts = [ 0 .-> (a0, (890, (Nothing, Nothing)))
, 1 .-> (a1, (100, (Nothing, Nothing))) ]
, stxvldt = (Nothing, Just 10)
, stxid = 1
, stxid = MkTxId 1
, stxcerts = []}

testTx1 :: Tx
Expand All @@ -84,12 +84,12 @@ testTx1 = MkTx

testTxBody2 :: TxBody
testTxBody2 = bodyFromSimple initParams $ MkSimpleTxBody
{ stxins = [(1, 1)]
, srefInputs = [(1, 1)]
{ stxins = [(MkTxId 1, 1)]
, srefInputs = [(MkTxId 1, 1)]
, stxouts = [ 0 .-> (a2, (10, (Nothing, Nothing)))
, 1 .-> (a1, (80, (Nothing, Nothing))) ]
, stxvldt = (Nothing, Just 10)
, stxid = 2
, stxid = MkTxId 2
, stxcerts = []}

testTx2 :: Tx
Expand All @@ -108,8 +108,8 @@ spec = do
describe "utxowSteps" $
it "results in the expected state" $
utxowSteps initEnv initState [testTx1, testTx2] @?= Success (MkUTxOState
{ utxo = [ (1,0) .-> (a0, (890, (Nothing, Nothing)))
, (2,0) .-> (a2, (10, (Nothing, Nothing)))
, (2,1) .-> (a1, (80, (Nothing, Nothing))) ]
{ utxo = [ (MkTxId 1,0) .-> (a0, (890, (Nothing, Nothing)))
, (MkTxId 2,0) .-> (a2, (10, (Nothing, Nothing)))
, (MkTxId 2,1) .-> (a1, (80, (Nothing, Nothing))) ]
, fees = 20
})

0 comments on commit 1ffb1d1

Please sign in to comment.