Skip to content

Commit 9e91ac5

Browse files
Remove Slot in favor of Read.SlotNo
1 parent 876db4b commit 9e91ac5

File tree

5 files changed

+13
-38
lines changed

5 files changed

+13
-38
lines changed

lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Network/Mock.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ genesis :: Read.ChainPoint
9696
genesis = Read.Origin
9797

9898
getBlockPoint :: Read.Block -> Read.ChainPoint
99-
getBlockPoint = Read.At . Read.slot . Read.blockHeaderBody . Read.blockHeader
99+
getBlockPoint = Read.At . Read.slotNo . Read.blockHeaderBody . Read.blockHeader
100100

101101
mkNextBlock :: Read.ChainPoint -> [Tx Conway] -> Read.Block
102102
mkNextBlock tipOld txs =
@@ -105,7 +105,7 @@ mkNextBlock tipOld txs =
105105
{ Read.blockHeaderBody = Read.BHBody
106106
{ Read.prev = Nothing
107107
, Read.blockno = toEnum $ fromEnum slotNext
108-
, Read.slot = slotNext
108+
, Read.slotNo = slotNext
109109
, Read.bhash = ()
110110
}
111111
, Read.blockHeaderSignature = ()

lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ rollForwardUTxO isOurs block u =
176176
UTxOHistory.appendBlock slot deltaUTxO u
177177
where
178178
(deltaUTxO,_) = Balance.applyBlock isOurs block (UTxOHistory.getUTxO u)
179-
slot = Read.slot . Read.blockHeaderBody $ Read.blockHeader block
179+
slot = Read.slotNo . Read.blockHeaderBody $ Read.blockHeader block
180180

181181
rollBackward
182182
:: Read.ChainPoint

lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Submissions.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ import qualified Data.Delta as Delta
3131
Types
3232
------------------------------------------------------------------------------}
3333
type TxSubmissions
34-
= Sbm.Submissions () Read.Slot (Read.TxId, Read.Tx)
34+
= Sbm.Submissions () Read.SlotNo (Read.TxId, Read.Tx)
3535
type TxSubmissionsStatus
36-
= Sbm.TxStatusMeta () Read.Slot (Read.TxId, Read.Tx)
36+
= Sbm.TxStatusMeta () Read.SlotNo (Read.TxId, Read.Tx)
3737
type DeltaTxSubmissions1
38-
= Sbm.Operation () Read.Slot (Read.TxId, Read.Tx)
38+
= Sbm.Operation () Read.SlotNo (Read.TxId, Read.Tx)
3939
type DeltaTxSubmissions
4040
= [DeltaTxSubmissions1]
4141

@@ -56,7 +56,7 @@ empty = Sbm.mkEmpty 0
5656

5757
-- | Add a /new/ transaction to the local submission pool
5858
-- with the most recent submission slot.
59-
add :: Read.Tx -> Read.Slot -> DeltaTxSubmissions
59+
add :: Read.Tx -> Read.SlotNo -> DeltaTxSubmissions
6060
add = undefined
6161

6262
listInSubmission :: TxSubmissions -> Set Read.Tx
@@ -69,5 +69,5 @@ rollForward block = [ Sbm.RollForward tip txs ]
6969
txids = undefined block
7070
txs = map (tip,) txids
7171

72-
rollBackward :: Read.Slot -> DeltaTxSubmissions
72+
rollBackward :: Read.SlotNo -> DeltaTxSubmissions
7373
rollBackward = undefined

lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/UTxOHistory.hs

+2-17
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,10 @@ module Cardano.Wallet.Deposit.Pure.UTxOHistory
77
, getUTxO
88
) where
99

10-
import Cardano.Wallet.Deposit.Pure.UTxO.DeltaUTxO
11-
( DeltaUTxO
12-
)
1310
import Cardano.Wallet.Deposit.Pure.UTxO.UTxOHistory
14-
( UTxOHistory
11+
( DeltaUTxOHistory (..)
12+
, UTxOHistory
1513
, appendBlock
1614
, empty
1715
, getUTxO
1816
)
19-
import Cardano.Wallet.Deposit.Read
20-
( Slot
21-
, SlotNo
22-
)
23-
24-
-- | Changes to the UTxO history.
25-
data DeltaUTxOHistory
26-
= -- | New slot tip, changes within that block.
27-
AppendBlock SlotNo DeltaUTxO
28-
| -- | Rollback tip.
29-
Rollback Slot
30-
| -- | Move finality forward.
31-
Prune SlotNo

lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Read.hs

+3-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
-- TODO: Match this up with the @Read@ hierarchy.
88
module Cardano.Wallet.Deposit.Read
99
( Network (..)
10-
, Slot
1110
, Read.SlotNo
1211
, toSlot
1312
, fromSlot
@@ -79,18 +78,9 @@ import qualified Data.ByteString.Short as SBS
7978
------------------------------------------------------------------------------}
8079
data Network = Testnet | Mainnet
8180

82-
-- Spec: type Slot = Natural
83-
type Slot = Read.SlotNo
84-
85-
toSlot :: Natural -> Slot
86-
toSlot = Read.SlotNo
87-
88-
fromSlot :: Slot -> Natural
89-
fromSlot (Read.SlotNo sl) = sl
90-
9181
data ChainPoint
9282
= Origin
93-
| At Slot
83+
| At Read.SlotNo
9484
deriving (Eq, Ord, Show)
9585

9686
-- | Synonym for readability.
@@ -154,7 +144,7 @@ type Sig = ()
154144
data BHBody = BHBody
155145
{ prev :: Maybe HashHeader
156146
, blockno :: BlockNo
157-
, slot :: Slot
147+
, slotNo :: Read.SlotNo
158148
, bhash :: HashBBody
159149
}
160150
deriving (Eq, Ord, Show)
@@ -166,7 +156,7 @@ dummyBHBody :: BHBody
166156
dummyBHBody = BHBody
167157
{ prev = Nothing
168158
, blockno = 128
169-
, slot = Read.SlotNo 42
159+
, slotNo = Read.SlotNo 42
170160
, bhash = ()
171161
}
172162

0 commit comments

Comments
 (0)