View on GitHub
File Changes
            (hsPkgs.ouroboros-consensus)
            (hsPkgs.io-sim-classes)
            (hsPkgs.io-sim)
+
            (hsPkgs.binary-search)
            (hsPkgs.cborg)
            (hsPkgs.containers)
            (hsPkgs.contra-tracer)
                    io-sim-classes,
                    io-sim,

                      
+
                    binary-search,
                    cborg,
                    containers,
                    contra-tracer,
import           Data.Maybe (fromJust)
import           Data.Time (Day (..), UTCTime (..))

                      
+
import           Numeric.Search.Range (searchFromTo)
import           Test.QuickCheck
import           Test.Tasty
import           Test.Tasty.QuickCheck
                Ref.viable params lastSlot
                    (NodeJoinPlan (Map.insert nid s' m))
                    st
-
        s' <- genSlot (Ref.nextSlot st) lastSlot
-
            `suchThat` check
+
            lo = Ref.nextSlot st
+

                      
+
            -- @[email protected] is downward-closed, but 'searchFromTo' requires
+
            -- upward-closed, so we search in dualized range
+
            inn = (maxBound -) . unSlotNo
+
            out = SlotNo . (maxBound -)
+
        s' <- case out <$> searchFromTo (check . out) (inn lastSlot) (inn lo) of
+
            Just hi -> genSlot lo hi
+
            Nothing -> error $
+
                "Cannot find viable RealPBFT NodeJoinPlan: " ++
+
                show (nodeJoinPlan, st)

                      
        let m'  = Map.insert nid s' m

                      
  , outs     :: !(Seq Outcome)
    -- ^ the outcome of each the last @[email protected] slots
  }
+
  deriving (Eq, Show)

                      
newtype NumNominals = NumNominals Int
+
  deriving (Eq, Ord, Show)

                      
emptyState :: State
emptyState = State Seq.empty (NumNominals 0) 0 Seq.empty