Skip to content

Commit 4e4ad00

Browse files
committed
PerasCertDB.StateMachine: generate chain-like boosted points
1 parent 83760bb commit 4e4ad00

File tree

1 file changed

+17
-2
lines changed
  • ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasCertDB

1 file changed

+17
-2
lines changed

ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasCertDB/StateMachine.hs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,27 @@ instance StateModel Model where
9494
action ->
9595
model.open && case action of
9696
CloseDB -> True
97-
-- Do not add equivocating certificates.
9897
AddCert cert -> all p model.certs
9998
where
100-
p cert' = perasCertRound cert /= perasCertRound cert' || cert == cert'
99+
p cert' = roundNoDeterminesCert && uniqueSlotNos
100+
where
101+
-- Do not add an equivocating certificate.
102+
roundNoDeterminesCert =
103+
perasCertRound cert == perasCertRound cert' =>> cert == cert'
104+
-- Do not add a certificate boosting a block in a slot in which we
105+
-- have already boosted another block.
106+
uniqueSlotNos =
107+
pointSlot boostPt == pointSlot boostPt' =>> boostPt == boostPt'
108+
where
109+
boostPt = perasCertBoostedBlock cert
110+
boostPt' = perasCertBoostedBlock cert'
101111
GetWeightSnapshot -> True
102112
GarbageCollect _slot -> True
113+
where
114+
-- Logical implication
115+
(=>>) :: Bool -> Bool -> Bool
116+
a =>> b = not a || b
117+
infixr 1 =>>
103118

104119
deriving stock instance Show (Action Model a)
105120
deriving stock instance Eq (Action Model a)

0 commit comments

Comments
 (0)