Skip to content

Commit 3c31370

Browse files
committed
consensus-test: stub ref script size to 0 in tests
1 parent 7fa043d commit 3c31370

File tree

7 files changed

+18
-3
lines changed
  • ouroboros-consensus-cardano/src/unstable-byronspec/Ouroboros/Consensus/ByronSpec/Ledger
  • ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator
  • ouroboros-consensus

7 files changed

+18
-3
lines changed

ouroboros-consensus-cardano/src/unstable-byronspec/Ouroboros/Consensus/ByronSpec/Ledger/Mempool.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ instance LedgerSupportsMempool ByronSpecBlock where
5656
txInBlockSize = const 0
5757

5858
txForgetValidated = forgetValidatedByronSpecGenTx
59+
60+
txRefScriptSize _cfg _tlst _tx = 0

ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/A.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ instance LedgerSupportsMempool BlockA where
331331

332332
txForgetValidated = forgetValidatedGenTxA
333333

334+
txRefScriptSize _cfg _tlst _tx = 0
335+
334336
newtype instance TxId (GenTx BlockA) = TxIdA Int
335337
deriving stock (Show, Eq, Ord, Generic)
336338
deriving newtype (NoThunks, Serialise)

ouroboros-consensus-diffusion/test/consensus-test/Test/Consensus/HardFork/Combinator/B.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ instance LedgerSupportsMempool BlockB where
267267

268268
txForgetValidated = \case {}
269269

270+
txRefScriptSize _cfg _tlst _tx = 0
271+
270272
data instance TxId (GenTx BlockB)
271273
deriving stock (Show, Eq, Ord, Generic)
272274
deriving anyclass (NoThunks, Serialise)

ouroboros-consensus/bench/mempool-bench/Bench/Consensus/Mempool/TestBlock.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ instance Ledger.LedgerSupportsMempool TestBlock where
152152

153153
txForgetValidated (ValidatedGenTx tx) = tx
154154

155+
txRefScriptSize _cfg _tlst _tx = 0
156+
155157
newtype instance Ledger.TxId (Ledger.GenTx TestBlock) = TestBlockTxId Tx
156158
deriving stock (Generic)
157159
deriving newtype (Show, Ord, Eq)

ouroboros-consensus/src/unstable-mock-block/Ouroboros/Consensus/Mock/Ledger/Block.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ instance MockProtocolSpecific c ext
438438

439439
txForgetValidated = forgetValidatedSimpleGenTx
440440

441+
txRefScriptSize _cfg _tlst _tx = 0
442+
441443
newtype instance TxId (GenTx (SimpleBlock c ext)) = SimpleGenTxId {
442444
unSimpleGenTxId :: Mock.TxId
443445
}

ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE LambdaCase #-}
44
{-# LANGUAGE NamedFieldPuns #-}
55
{-# LANGUAGE NumericUnderscores #-}
6+
{-# LANGUAGE ParallelListComp #-}
67
{-# LANGUAGE RankNTypes #-}
78
{-# LANGUAGE RecordWildCards #-}
89
{-# LANGUAGE ScopedTypeVariables #-}
@@ -845,7 +846,9 @@ prop_TxSeq_lookupByTicketNo_complete xs =
845846
| (tx, tn) <- TxSeq.toTuples txseq ]
846847
where
847848
txseq :: TxSeq Int
848-
txseq = TxSeq.fromList $ zipWith3 TxTicket xs (map TicketNo [0..]) (repeat 0)
849+
txseq =
850+
TxSeq.fromList
851+
$ [ TxTicket x (TicketNo i) 0 0 | x <- xs | i <- [0..] ]
849852

850853
-- | Only finds elements in the sequence
851854
prop_TxSeq_lookupByTicketNo_sound ::
@@ -873,7 +876,7 @@ prop_TxSeq_lookupByTicketNo_sound smalls small =
873876
txseq =
874877
foldl' (TxSeq.:>) TxSeq.Empty $ map mkTicket haystack
875878

876-
mkTicket x = TxTicket x (mkTicketNo x) 0
879+
mkTicket x = TxTicket x (mkTicketNo x) 0 0
877880
mkTicketNo = TicketNo . toEnum
878881

879882
-- | Test that the 'fst' of the result of 'splitAfterTxSize' only contains
@@ -948,7 +951,7 @@ instance Arbitrary TxSizeSplitTestSetup where
948951
-- | Convert a 'TxSizeSplitTestSetup' to a 'TxSeq'.
949952
txSizeSplitTestSetupToTxSeq :: TxSizeSplitTestSetup -> TxSeq Int
950953
txSizeSplitTestSetupToTxSeq TxSizeSplitTestSetup { tssTxSizes } =
951-
TxSeq.fromList [TxTicket 0 (TicketNo 0) tssTxSize | tssTxSize <- tssTxSizes]
954+
TxSeq.fromList [TxTicket 0 (TicketNo 0) tssTxSize 0 | tssTxSize <- tssTxSizes]
952955

953956
{-------------------------------------------------------------------------------
954957
TicketNo Properties

ouroboros-consensus/test/consensus-test/Test/Consensus/Mempool/Fairness/TestBlock.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ instance Ledger.LedgerSupportsMempool TestBlock where
100100

101101
txForgetValidated (ValidatedGenTx tx) = tx
102102

103+
txRefScriptSize _cfg _tlst _tx = 0
104+
103105
{-------------------------------------------------------------------------------
104106
Ledger support
105107
-------------------------------------------------------------------------------}

0 commit comments

Comments
 (0)