Skip to content

Commit a8003a5

Browse files
committed
More refined precondition on PerasCertDB StateModel tests
1 parent b8c1491 commit a8003a5

File tree

1 file changed

+9
-1
lines changed
  • ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasCertDB

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@ instance StateModel Model where
113113

114114
precondition (Model model) = \case
115115
OpenDB -> not model.open
116-
_ -> model.open
116+
action ->
117+
model.open && case action of
118+
CloseDB -> True
119+
-- Do not add equivocating certificates.
120+
AddCert cert -> all p model.certs
121+
where
122+
p cert' = getPerasCertRound cert /= getPerasCertRound cert' || cert == cert'
123+
GetWeightSnapshot -> True
124+
GarbageCollect _slot -> True
117125

118126
deriving stock instance Show (Action Model a)
119127
deriving stock instance Eq (Action Model a)

0 commit comments

Comments
 (0)