File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasCertDB Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff 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
104119deriving stock instance Show (Action Model a )
105120deriving stock instance Eq (Action Model a )
You can’t perform that action at this time.
0 commit comments