Skip to content

Commit

Permalink
p2p-governor: Fix prop_governor_target_known_1_valid_subset
Browse files Browse the repository at this point in the history
The environmentAllKnownPeers should not have been using Signal.stable.
This combinator picks the last value wihtin a time, but in this case
that's inappropriate since it messes with causality. We can and must
check this property for every change in order. Delaying updates until
they are stable means we miss updates and in this case it causes an
untrue property violation.
  • Loading branch information
dcoutts authored and coot committed Sep 28, 2021
1 parent f03fd47 commit adfb2cf
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -793,7 +793,10 @@ prop_governor_target_known_1_valid_subset env =
validState knownPeersEnv knownPeersGov =
knownPeersGov `Set.isSubsetOf` knownPeersEnv

in signalProperty 20 show (uncurry validState) $
in counterexample
"Signal key: (environment known peers, governor known peers)" $

signalProperty 20 show (uncurry validState) $
(,) <$> envKnownPeersSig
<*> govKnownPeersSig

Expand All @@ -816,8 +819,7 @@ environmentAllKnownPeers :: Set PeerAddr
-> Signal (Set PeerAddr)
environmentAllKnownPeers localRootPeers =
--TODO: implement this as a generic signalScanl style combinator
Signal.stable
. Signal.fromChangeEvents localRootPeers
Signal.fromChangeEvents localRootPeers
. Signal.primitiveTransformEvents (go localRootPeers)
where
go :: Set PeerAddr -> [E TraceMockEnv] -> [E (Set PeerAddr)]
Expand Down

0 comments on commit adfb2cf

Please sign in to comment.