Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChainDB q-s-m failure with GetIsValid (again) #123

Closed
amesgen opened this issue May 31, 2023 · 1 comment · Fixed by #284
Closed

ChainDB q-s-m failure with GetIsValid (again) #123

amesgen opened this issue May 31, 2023 · 1 comment · Fixed by #284
Assignees
Labels
bug Something isn't working

Comments

@amesgen
Copy link
Member

amesgen commented May 31, 2023

To reproduce, run

cabal run storage-test -- -p 'ChainDB q-s-m' --quickcheck-replay=616511

on fc1245d (master at time of writing), which yields (simplified):

    IsValid (IsValidResult {real = True, isValid = Just True}) 
:/= IsValid (IsValidResult {real = False, isValid = Nothing})
Full logs
ouroboros-storage
  Storage
    ChainDB
      ChainDB q-s-m
        sequential:
Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = Genesis,
      chainFollowers = Map.fromList
        [],
      nextFollowerId = 0},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    initLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    iterators = Map.fromList [],
    valid = Set.fromList [],
    invalid = Map.fromList [],
    currentSlot = SlotNo 0,
    maxClockSkew = 100000,
    isOpen = True},
  knownIters = RefEnv [],
  knownFollowers = RefEnv [],
  modelConfig = Opaque}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash 1684377399790728945
          , thPrevHash = GenesisHash
          , thBodyHash = TestBodyHash 590681868797176966
          , thSlotNo = SlotNo 0
          , thBlockNo = BlockNo 0
          , thChainLength = ChainLength 1
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 0
                , blockPointHash = TestHeaderHash 1684377399790728945
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = -Genesis
      +:>
        Genesis
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash
              1684377399790728945,
            thPrevHash = GenesisHash,
            thBodyHash = TestBodyHash
              590681868797176966,
            thSlotNo = SlotNo 0,
            thBlockNo = BlockNo 0,
            thChainLength = ChainLength 1,
            thIsEBB = RegularBlock},
          testBody = TestBody {
            tbForkNo = 2,
            tbIsValid = True}},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          -Origin
          +(At
            Block {
              blockPointSlot = SlotNo 0,
              blockPointHash = TestHeaderHash
                1684377399790728945}),
        lastAppliedHash = -GenesisHash
        +BlockHash
          (TestHeaderHash
            1684377399790728945)},
      headerState = HeaderState {
        headerStateTip = -Origin
        +At
          AnnTip {
            annTipSlotNo = SlotNo 0,
            annTipBlockNo = BlockNo 0,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash
                1684377399790728945)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList
      [
        +TestHeaderHash
          1684377399790728945],
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash 1327667169795437917
          , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
          , thBodyHash = TestBodyHash 590680769285548757
          , thSlotNo = SlotNo 3
          , thBlockNo = BlockNo 1
          , thChainLength = ChainLength 2
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 3
                , blockPointHash = TestHeaderHash 1327667169795437917
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        -Genesis
        +(:>
          Genesis
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash
              -1684377399790728945
              +1327667169795437917,
            thPrevHash = -GenesisHash
            +BlockHash
              (TestHeaderHash
                1684377399790728945),
            thBodyHash = TestBodyHash
              -590681868797176966
              +590680769285548757,
            thSlotNo = SlotNo -0 +3,
            thBlockNo = BlockNo -0 +1,
            thChainLength = ChainLength
              -1
              +2,
            thIsEBB = RegularBlock},
          testBody = TestBody {
            tbForkNo = -2 +3,
            tbIsValid = True}},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo -0 +3,
              blockPointHash = TestHeaderHash
                -1684377399790728945
                +1327667169795437917}),
        lastAppliedHash = BlockHash
          (TestHeaderHash
            -1684377399790728945
            +1327667169795437917)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo -0 +3,
            annTipBlockNo = BlockNo -0 +1,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash
                -1684377399790728945
                +1327667169795437917)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList
      [
        +TestHeaderHash
          1327667169795437917,
        TestHeaderHash
          1684377399790728945],
    currentSlot = SlotNo -0 +3,
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-1491201838780284349)
          , thPrevHash = BlockHash (TestHeaderHash 1327667169795437917)
          , thBodyHash = TestBodyHash 590680769285548757
          , thSlotNo = SlotNo 5
          , thBlockNo = BlockNo 2
          , thChainLength = ChainLength 3
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash
            `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-1491201838780284349`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1327667169795437917),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        (:>
          -Genesis
          +(:>
            Genesis
            TestBlock {
              testHeader = TestHeader {
                thHash = TestHeaderHash
                  1684377399790728945,
                thPrevHash = GenesisHash,
                thBodyHash = TestBodyHash
                  590681868797176966,
                thSlotNo = SlotNo 0,
                thBlockNo = BlockNo 0,
                thChainLength = ChainLength 1,
                thIsEBB = RegularBlock},
              testBody = TestBody {
                tbForkNo = 2,
                tbIsValid = True}})
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                -1684377399790728945
                +1327667169795437917,
              thPrevHash = -GenesisHash
              +BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                -590681868797176966
                +590680769285548757,
              thSlotNo = SlotNo -0 +3,
              thBlockNo = BlockNo -0 +1,
              thChainLength = ChainLength
                -1
                +2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = -2 +3,
              tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash
              -1327667169795437917
              +`-1491201838780284349`,
            thPrevHash = BlockHash
              (TestHeaderHash
                -1684377399790728945
                +1327667169795437917),
            thSlotNo = SlotNo -3 +5,
            thBlockNo = BlockNo -1 +2,
            thChainLength = ChainLength
              -2
              +3,
            thIsEBB = RegularBlock,
            thBodyHash = ...},
          testBody = ...},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo -3 +5,
              blockPointHash = TestHeaderHash
                -1327667169795437917
                +`-1491201838780284349`}),
        lastAppliedHash = BlockHash
          (TestHeaderHash
            -1327667169795437917
            +`-1491201838780284349`)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo -3 +5,
            annTipBlockNo = BlockNo -1 +2,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash
                -1327667169795437917
                +`-1491201838780284349`)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList
      [
        +TestHeaderHash
          `-1491201838780284349`,
        TestHeaderHash
          1327667169795437917,
        TestHeaderHash
          1684377399790728945],
    currentSlot = SlotNo -3 +5,
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-5844139728676329634)
          , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
          , thBodyHash = TestBodyHash 590681868797176966
          , thSlotNo = SlotNo 3
          , thBlockNo = BlockNo 1
          , thChainLength = ChainLength 2
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash
            `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-5844139728676329634`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-1491201838780284349`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1327667169795437917),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-4619175622128342186)
          , thPrevHash = BlockHash (TestHeaderHash (-5844139728676329634))
          , thBodyHash = TestBodyHash 590682968308805178
          , thSlotNo = SlotNo 4
          , thBlockNo = BlockNo 2
          , thChainLength = ChainLength 3
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 1 , tbIsValid = False }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash
            `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-5844139728676329634`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}},
        +_×_
          (TestHeaderHash
            `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-4619175622128342186`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  `-5844139728676329634`),
              thBodyHash = TestBodyHash
                590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 1,
              tbIsValid = False}},
        _×_
          (TestHeaderHash
            `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-1491201838780284349`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1327667169795437917),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    invalid = Map.fromList
      [
        +_×_
          (TestHeaderHash
            `-4619175622128342186`)
          (_×_
            (ValidationError
              (ExtValidationErrorLedger
                InvalidBlock))
            (SlotNo 4))],
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-2964422420463002170)
          , thPrevHash = BlockHash (TestHeaderHash (-4619175622128342186))
          , thBodyHash = TestBodyHash 590682968308805179
          , thSlotNo = SlotNo 7
          , thBlockNo = BlockNo 3
          , thChainLength = ChainLength 4
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 1 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash
            `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-5844139728676329634`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-4619175622128342186`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  `-5844139728676329634`),
              thBodyHash = TestBodyHash
                590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 1,
              tbIsValid = False}},
        +_×_
          (TestHeaderHash
            `-2964422420463002170`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-2964422420463002170`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  `-4619175622128342186`),
              thBodyHash = TestBodyHash
                590682968308805179,
              thSlotNo = SlotNo 7,
              thBlockNo = BlockNo 3,
              thChainLength = ChainLength 4,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 1,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-1491201838780284349`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1327667169795437917),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    currentSlot = SlotNo -5 +7,
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == GetIsValid
  (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) ==> Resp
  { getResp =
      Right (IsValid IsValidResult { real = True , isValid = Just True })
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash
            `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-5844139728676329634`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-4619175622128342186`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  `-5844139728676329634`),
              thBodyHash = TestBodyHash
                590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 1,
              tbIsValid = False}},
        _×_
          (TestHeaderHash
            `-2964422420463002170`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-2964422420463002170`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  `-4619175622128342186`),
              thBodyHash = TestBodyHash
                590682968308805179,
              thSlotNo = SlotNo 7,
              thBlockNo = BlockNo 3,
              thChainLength = ChainLength 4,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 1,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                `-1491201838780284349`,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1327667169795437917),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}},
        _×_
          (TestHeaderHash
            1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash
                590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 2,
              tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        (:>
          (:>
            Genesis
            TestBlock {
              testHeader = TestHeader {
                thHash = TestHeaderHash
                  1684377399790728945,
                thPrevHash = GenesisHash,
                thBodyHash = TestBodyHash
                  590681868797176966,
                thSlotNo = SlotNo 0,
                thBlockNo = BlockNo 0,
                thChainLength = ChainLength 1,
                thIsEBB = RegularBlock},
              testBody = TestBody {
                tbForkNo = 2,
                tbIsValid = True}})
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash
                1327667169795437917,
              thPrevHash = BlockHash
                (TestHeaderHash
                  1684377399790728945),
              thBodyHash = TestBodyHash
                590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {
              tbForkNo = 3,
              tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash
              `-1491201838780284349`,
            thPrevHash = BlockHash
              (TestHeaderHash
                1327667169795437917),
            thBodyHash = TestBodyHash
              590680769285548757,
            thSlotNo = SlotNo 5,
            thBlockNo = BlockNo 2,
            thChainLength = ChainLength 3,
            thIsEBB = RegularBlock},
          testBody = TestBody {
            tbForkNo = 3,
            tbIsValid = True}},
      chainFollowers = Map.fromList
        [],
      nextFollowerId = 0},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo 5,
              blockPointHash = TestHeaderHash
                `-1491201838780284349`}),
        lastAppliedHash = BlockHash
          (TestHeaderHash
            `-1491201838780284349`)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo 5,
            annTipBlockNo = BlockNo 2,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash
                `-1491201838780284349`)
              IsNotEBB},
        headerStateChainDep = `()`}},
    initLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    iterators = Map.fromList [],
    valid = Set.fromList
      [
        TestHeaderHash
          `-1491201838780284349`,
        TestHeaderHash
          1327667169795437917,
        TestHeaderHash
          1684377399790728945],
    invalid = Map.fromList
      [
        _×_
          (TestHeaderHash
            `-4619175622128342186`)
          (_×_
            (ValidationError
              (ExtValidationErrorLedger
                InvalidBlock))
            (SlotNo 4))],
    currentSlot = SlotNo 7,
    maxClockSkew = 100000,
    isOpen = True},
  knownIters = RefEnv [],
  knownFollowers = RefEnv [],
  modelConfig = Opaque}

FAIL (8.49s)
          *** Failed! Falsified (after 11369 tests and 13 shrinks):
          MaxClockSkew 100000
          SmallChunkInfo (UniformChunkSize (ChunkSize {chunkCanContainEBB = False, numRegularBlocks = 6}))
          Commands
            { unCommands =
                [ Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash 1684377399790728945
                               , thPrevHash = GenesisHash
                               , thBodyHash = TestBodyHash 590681868797176966
                               , thSlotNo = SlotNo 0
                               , thBlockNo = BlockNo 0
                               , thChainLength = ChainLength 1
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 0
                                    , blockPointHash = TestHeaderHash 1684377399790728945
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash 1327667169795437917
                               , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
                               , thBodyHash = TestBodyHash 590680769285548757
                               , thSlotNo = SlotNo 3
                               , thBlockNo = BlockNo 1
                               , thChainLength = ChainLength 2
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 3
                                    , blockPointHash = TestHeaderHash 1327667169795437917
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-1491201838780284349)
                               , thPrevHash = BlockHash (TestHeaderHash 1327667169795437917)
                               , thBodyHash = TestBodyHash 590680769285548757
                               , thSlotNo = SlotNo 5
                               , thBlockNo = BlockNo 2
                               , thChainLength = ChainLength 3
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-5844139728676329634)
                               , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
                               , thBodyHash = TestBodyHash 590681868797176966
                               , thSlotNo = SlotNo 3
                               , thBlockNo = BlockNo 1
                               , thChainLength = ChainLength 2
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-4619175622128342186)
                               , thPrevHash = BlockHash (TestHeaderHash (-5844139728676329634))
                               , thBodyHash = TestBodyHash 590682968308805178
                               , thSlotNo = SlotNo 4
                               , thBlockNo = BlockNo 2
                               , thChainLength = ChainLength 3
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 1 , tbIsValid = False }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-2964422420463002170)
                               , thPrevHash = BlockHash (TestHeaderHash (-4619175622128342186))
                               , thBodyHash = TestBodyHash 590682968308805179
                               , thSlotNo = SlotNo 7
                               , thBlockNo = BlockNo 3
                               , thChainLength = ChainLength 4
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 1 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (GetIsValid
                       (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))))
                    Resp
                      { getResp =
                          Right (IsValid IsValidResult { real = False , isValid = Nothing })
                      }
                    []
                ]
            }
          Model chain: Genesis :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 2, tbIsValid = True}} :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 3, tbIsValid = True}} :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 3, tbIsValid = True}}
          TraceEvents: TraceOpenEvent StartedOpeningDB
          TraceOpenEvent StartedOpeningImmutableDB
          TraceImmutableDBEvent NoValidLastLocation
          TraceOpenEvent (OpenedImmutableDB Origin 0)
          TraceOpenEvent StartedOpeningVolatileDB
          TraceOpenEvent OpenedVolatileDB
          TraceOpenEvent StartedOpeningLgrDB
          TraceLedgerReplayEvent (ReplayFromGenesis (ReplayGoal Origin))
          TraceOpenEvent OpenedLgrDB
          TraceInitChainSelEvent StartedInitChainSelection
          TraceInitChainSelEvent InitalChainSelected
          TraceOpenEvent (OpenedDB Origin Origin)
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (BlockNo 0) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (BlockNo 0) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (PushGoal {unPushGoal = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (Pushing {unPushing = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 0, blockPointHash = TestHeaderHash 1684377399790728945})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 0, newTipTrigger = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList []}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (BlockNo 1) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (BlockNo 1) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (PushGoal {unPushGoal = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (Pushing {unPushing = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 3, blockPointHash = TestHeaderHash 1327667169795437917})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 3, newTipTrigger = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (BlockNo 2) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (BlockNo 2) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (PushGoal {unPushGoal = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (Pushing {unPushing = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 3) (TestHeaderHash 1327667169795437917) (BlockNo 1), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 5, blockPointHash = TestHeaderHash (-1491201838780284349)})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349)), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 5, newTipTrigger = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (BlockNo 1) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (BlockNo 1) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}}]}}}))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (BlockNo 2) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (BlockNo 2) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 4, headerFieldBlockNo = BlockNo 2, headerFieldHash = TestHeaderHash (-4619175622128342186)}}]}}}))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (BlockNo 3) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (BlockNo 3) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 4, headerFieldBlockNo = BlockNo 2, headerFieldHash = TestHeaderHash (-4619175622128342186)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 7, headerFieldBlockNo = BlockNo 3, headerFieldHash = TestHeaderHash (-2964422420463002170)}}]}}}))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}) (PushGoal {unPushGoal = RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))}) (Pushing {unPushing = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}))))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}) (PushGoal {unPushGoal = RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))}) (Pushing {unPushing = RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))}))))
          TraceAddBlockEvent (AddBlockValidation (InvalidBlock (ExtValidationErrorLedger InvalidBlock) (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186)))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-5844139728676329634), thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)

          PostconditionFailed "AnnotateC \"real response didn't match model response\" (PredicateC (Resp {getResp = Right (IsValid (IsValidResult {real = True, isValid = Just True}))} :/= Resp {getResp = Right (IsValid (IsValidResult {real = False, isValid = Nothing}))}))" /= Ok
          Use --quickcheck-replay=616511 to reproduce.

This seems like exactly the same thing as IntersectMBO/ouroboros-network#3689 and the even older IntersectMBO/ouroboros-network#3389. I really thought that IntersectMBO/ouroboros-network#3990 would fix this for good, so maybe this is a different issue, or it regressed again since then?

@jorisdral jorisdral self-assigned this Aug 3, 2023
@jorisdral jorisdral added the bug Something isn't working label Aug 3, 2023
@jorisdral
Copy link
Contributor

My suspicion is that the model is incorrect in this case: it fails to mark a block as valid, even though the SUT eventually validates the block and finds that it is valid. See the model transitions below:

Full log
ouroboros-storage
  Storage
    ChainDB
      ChainDB q-s-m
        sequential: 
Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList [],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = Genesis,
      chainFollowers = Map.fromList [],
      nextFollowerId = 0},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    initLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    iterators = Map.fromList [],
    valid = Set.fromList [],
    invalid = Map.fromList [],
    currentSlot = SlotNo 0,
    maxClockSkew = 100000,
    isOpen = True},
  knownIters = RefEnv [],
  knownFollowers = RefEnv [],
  modelConfig = Opaque}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash 1684377399790728945
          , thPrevHash = GenesisHash
          , thBodyHash = TestBodyHash 590681868797176966
          , thSlotNo = SlotNo 0
          , thBlockNo = BlockNo 0
          , thChainLength = ChainLength 1
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 0
                , blockPointHash = TestHeaderHash 1684377399790728945
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = -Genesis
      +:>
        Genesis
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash 1684377399790728945,
            thPrevHash = GenesisHash,
            thBodyHash = TestBodyHash 590681868797176966,
            thSlotNo = SlotNo 0,
            thBlockNo = BlockNo 0,
            thChainLength = ChainLength 1,
            thIsEBB = RegularBlock},
          testBody = TestBody {tbForkNo = 2, tbIsValid = True}},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          -Origin
          +(At
            Block {
              blockPointSlot = SlotNo 0,
              blockPointHash = TestHeaderHash 1684377399790728945}),
        lastAppliedHash = -GenesisHash
        +BlockHash (TestHeaderHash 1684377399790728945)},
      headerState = HeaderState {
        headerStateTip = -Origin
        +At
          AnnTip {
            annTipSlotNo = SlotNo 0,
            annTipBlockNo = BlockNo 0,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash 1684377399790728945)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList [+TestHeaderHash 1684377399790728945],
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash 1327667169795437917
          , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
          , thBodyHash = TestBodyHash 590680769285548757
          , thSlotNo = SlotNo 3
          , thBlockNo = BlockNo 1
          , thChainLength = ChainLength 2
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 3
                , blockPointHash = TestHeaderHash 1327667169795437917
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        -Genesis
        +(:>
          Genesis
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash -1684377399790728945 +1327667169795437917,
            thPrevHash = -GenesisHash
            +BlockHash (TestHeaderHash 1684377399790728945),
            thBodyHash = TestBodyHash -590681868797176966 +590680769285548757,
            thSlotNo = SlotNo -0 +3,
            thBlockNo = BlockNo -0 +1,
            thChainLength = ChainLength -1 +2,
            thIsEBB = RegularBlock},
          testBody = TestBody {tbForkNo = -2 +3, tbIsValid = True}},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo -0 +3,
              blockPointHash = TestHeaderHash
                -1684377399790728945
                +1327667169795437917}),
        lastAppliedHash = BlockHash
          (TestHeaderHash -1684377399790728945 +1327667169795437917)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo -0 +3,
            annTipBlockNo = BlockNo -0 +1,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash -1684377399790728945 +1327667169795437917)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList
      [+TestHeaderHash 1327667169795437917, TestHeaderHash 1684377399790728945],
    currentSlot = SlotNo -0 +3,
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-1491201838780284349)
          , thPrevHash = BlockHash (TestHeaderHash 1327667169795437917)
          , thBodyHash = TestBodyHash 590680769285548757
          , thSlotNo = SlotNo 5
          , thBlockNo = BlockNo 2
          , thChainLength = ChainLength 3
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-1491201838780284349`,
              thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        (:>
          -Genesis
          +(:>
            Genesis
            TestBlock {
              testHeader = TestHeader {
                thHash = TestHeaderHash 1684377399790728945,
                thPrevHash = GenesisHash,
                thBodyHash = TestBodyHash 590681868797176966,
                thSlotNo = SlotNo 0,
                thBlockNo = BlockNo 0,
                thChainLength = ChainLength 1,
                thIsEBB = RegularBlock},
              testBody = TestBody {tbForkNo = 2, tbIsValid = True}})
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash -1684377399790728945 +1327667169795437917,
              thPrevHash = -GenesisHash
              +BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash -590681868797176966 +590680769285548757,
              thSlotNo = SlotNo -0 +3,
              thBlockNo = BlockNo -0 +1,
              thChainLength = ChainLength -1 +2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = -2 +3, tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash
              -1327667169795437917
              +`-1491201838780284349`,
            thPrevHash = BlockHash
              (TestHeaderHash -1684377399790728945 +1327667169795437917),
            thSlotNo = SlotNo -3 +5,
            thBlockNo = BlockNo -1 +2,
            thChainLength = ChainLength -2 +3,
            thIsEBB = RegularBlock,
            thBodyHash = ...},
          testBody = ...},
      nextFollowerId = 0,
      chainFollowers = ...},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo -3 +5,
              blockPointHash = TestHeaderHash
                -1327667169795437917
                +`-1491201838780284349`}),
        lastAppliedHash = BlockHash
          (TestHeaderHash -1327667169795437917 +`-1491201838780284349`)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo -3 +5,
            annTipBlockNo = BlockNo -1 +2,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash -1327667169795437917 +`-1491201838780284349`)
              IsNotEBB},
        headerStateChainDep = `()`}},
    valid = Set.fromList
      [
        +TestHeaderHash `-1491201838780284349`,
        TestHeaderHash 1327667169795437917,
        TestHeaderHash 1684377399790728945],
    currentSlot = SlotNo -3 +5,
    maxClockSkew = 100000,
    isOpen = True,
    initLedger = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-5844139728676329634)
          , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
          , thBodyHash = TestBodyHash 590681868797176966
          , thSlotNo = SlotNo 3
          , thBlockNo = BlockNo 1
          , thChainLength = ChainLength 2
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        +_×_
          (TestHeaderHash `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-5844139728676329634`,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}},
        _×_
          (TestHeaderHash `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-1491201838780284349`,
              thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-4619175622128342186)
          , thPrevHash = BlockHash (TestHeaderHash (-5844139728676329634))
          , thBodyHash = TestBodyHash 590682968308805178
          , thSlotNo = SlotNo 4
          , thBlockNo = BlockNo 2
          , thChainLength = ChainLength 3
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 1 , tbIsValid = False }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-5844139728676329634`,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}},
        +_×_
          (TestHeaderHash `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-4619175622128342186`,
              thPrevHash = BlockHash (TestHeaderHash `-5844139728676329634`),
              thBodyHash = TestBodyHash 590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 1, tbIsValid = False}},
        _×_
          (TestHeaderHash `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-1491201838780284349`,
              thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    invalid = Map.fromList
      [
        +_×_
          (TestHeaderHash `-4619175622128342186`)
          (_×_
            (ValidationError (ExtValidationErrorLedger InvalidBlock))
            (SlotNo 4))],
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == AddBlock
  TestBlock
    { testHeader =
        TestHeader
          { thHash = TestHeaderHash (-2964422420463002170)
          , thPrevHash = BlockHash (TestHeaderHash (-4619175622128342186))
          , thBodyHash = TestBodyHash 590682968308805179
          , thSlotNo = SlotNo 7
          , thBlockNo = BlockNo 3
          , thChainLength = ChainLength 4
          , thIsEBB = RegularBlock
          }
    , testBody = TestBody { tbForkNo = 1 , tbIsValid = True }
    } ==> Resp
  { getResp =
      Right
        (Point
           (At
              Block
                { blockPointSlot = SlotNo 5
                , blockPointHash = TestHeaderHash (-1491201838780284349)
                }))
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-5844139728676329634`,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}},
        _×_
          (TestHeaderHash `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-4619175622128342186`,
              thPrevHash = BlockHash (TestHeaderHash `-5844139728676329634`),
              thBodyHash = TestBodyHash 590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 1, tbIsValid = False}},
        +_×_
          (TestHeaderHash `-2964422420463002170`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-2964422420463002170`,
              thPrevHash = BlockHash (TestHeaderHash `-4619175622128342186`),
              thBodyHash = TestBodyHash 590682968308805179,
              thSlotNo = SlotNo 7,
              thBlockNo = BlockNo 3,
              thChainLength = ChainLength 4,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 1, tbIsValid = True}},
        _×_
          (TestHeaderHash `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-1491201838780284349`,
              thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    currentSlot = SlotNo -5 +7,
    maxClockSkew = 100000,
    isOpen = True,
    cps = ...},
  modelConfig = Opaque,
  knownIters = ...}

   == GetIsValid
  (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) ==> Resp
  { getResp =
      Right (IsValid IsValidResult { real = True , isValid = Just True })
  } [ 0 ]

Model {
  dbModel = Model {
    volatileDbBlocks = Map.fromList
      [
        _×_
          (TestHeaderHash `-5844139728676329634`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-5844139728676329634`,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}},
        _×_
          (TestHeaderHash `-4619175622128342186`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-4619175622128342186`,
              thPrevHash = BlockHash (TestHeaderHash `-5844139728676329634`),
              thBodyHash = TestBodyHash 590682968308805178,
              thSlotNo = SlotNo 4,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 1, tbIsValid = False}},
        _×_
          (TestHeaderHash `-2964422420463002170`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-2964422420463002170`,
              thPrevHash = BlockHash (TestHeaderHash `-4619175622128342186`),
              thBodyHash = TestBodyHash 590682968308805179,
              thSlotNo = SlotNo 7,
              thBlockNo = BlockNo 3,
              thChainLength = ChainLength 4,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 1, tbIsValid = True}},
        _×_
          (TestHeaderHash `-1491201838780284349`)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash `-1491201838780284349`,
              thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 5,
              thBlockNo = BlockNo 2,
              thChainLength = ChainLength 3,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1327667169795437917)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
        _×_
          (TestHeaderHash 1684377399790728945)
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1684377399790728945,
              thPrevHash = GenesisHash,
              thBodyHash = TestBodyHash 590681868797176966,
              thSlotNo = SlotNo 0,
              thBlockNo = BlockNo 0,
              thChainLength = ChainLength 1,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 2, tbIsValid = True}}],
    immutableDbChain = Genesis,
    cps = ChainProducerState {
      chainState = :>
        (:>
          (:>
            Genesis
            TestBlock {
              testHeader = TestHeader {
                thHash = TestHeaderHash 1684377399790728945,
                thPrevHash = GenesisHash,
                thBodyHash = TestBodyHash 590681868797176966,
                thSlotNo = SlotNo 0,
                thBlockNo = BlockNo 0,
                thChainLength = ChainLength 1,
                thIsEBB = RegularBlock},
              testBody = TestBody {tbForkNo = 2, tbIsValid = True}})
          TestBlock {
            testHeader = TestHeader {
              thHash = TestHeaderHash 1327667169795437917,
              thPrevHash = BlockHash (TestHeaderHash 1684377399790728945),
              thBodyHash = TestBodyHash 590680769285548757,
              thSlotNo = SlotNo 3,
              thBlockNo = BlockNo 1,
              thChainLength = ChainLength 2,
              thIsEBB = RegularBlock},
            testBody = TestBody {tbForkNo = 3, tbIsValid = True}})
        TestBlock {
          testHeader = TestHeader {
            thHash = TestHeaderHash `-1491201838780284349`,
            thPrevHash = BlockHash (TestHeaderHash 1327667169795437917),
            thBodyHash = TestBodyHash 590680769285548757,
            thSlotNo = SlotNo 5,
            thBlockNo = BlockNo 2,
            thChainLength = ChainLength 3,
            thIsEBB = RegularBlock},
          testBody = TestBody {tbForkNo = 3, tbIsValid = True}},
      chainFollowers = Map.fromList [],
      nextFollowerId = 0},
    currentLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point
          (At
            Block {
              blockPointSlot = SlotNo 5,
              blockPointHash = TestHeaderHash `-1491201838780284349`}),
        lastAppliedHash = BlockHash (TestHeaderHash `-1491201838780284349`)},
      headerState = HeaderState {
        headerStateTip = At
          AnnTip {
            annTipSlotNo = SlotNo 5,
            annTipBlockNo = BlockNo 2,
            annTipInfo = TipInfoIsEBB
              (TestHeaderHash `-1491201838780284349`)
              IsNotEBB},
        headerStateChainDep = `()`}},
    initLedger = ExtLedgerState {
      ledgerState = TestLedger {
        lastAppliedPoint = Point Origin,
        lastAppliedHash = GenesisHash},
      headerState = HeaderState {
        headerStateTip = Origin,
        headerStateChainDep = `()`}},
    iterators = Map.fromList [],
    valid = Set.fromList
      [
        TestHeaderHash `-1491201838780284349`,
        TestHeaderHash 1327667169795437917,
        TestHeaderHash 1684377399790728945],
    invalid = Map.fromList
      [
        _×_
          (TestHeaderHash `-4619175622128342186`)
          (_×_
            (ValidationError (ExtValidationErrorLedger InvalidBlock))
            (SlotNo 4))],
    currentSlot = SlotNo 7,
    maxClockSkew = 100000,
    isOpen = True},
  knownIters = RefEnv [],
  knownFollowers = RefEnv [],
  modelConfig = Opaque}

FAIL (8.53s)
          *** Failed! Falsified (after 11369 tests and 13 shrinks):
          MaxClockSkew 100000
          SmallChunkInfo (UniformChunkSize (ChunkSize {chunkCanContainEBB = False, numRegularBlocks = 6}))
          Commands
            { unCommands =
                [ Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash 1684377399790728945
                               , thPrevHash = GenesisHash
                               , thBodyHash = TestBodyHash 590681868797176966
                               , thSlotNo = SlotNo 0
                               , thBlockNo = BlockNo 0
                               , thChainLength = ChainLength 1
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 0
                                    , blockPointHash = TestHeaderHash 1684377399790728945
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash 1327667169795437917
                               , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
                               , thBodyHash = TestBodyHash 590680769285548757
                               , thSlotNo = SlotNo 3
                               , thBlockNo = BlockNo 1
                               , thChainLength = ChainLength 2
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 3
                                    , blockPointHash = TestHeaderHash 1327667169795437917
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-1491201838780284349)
                               , thPrevHash = BlockHash (TestHeaderHash 1327667169795437917)
                               , thBodyHash = TestBodyHash 590680769285548757
                               , thSlotNo = SlotNo 5
                               , thBlockNo = BlockNo 2
                               , thChainLength = ChainLength 3
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 3 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-5844139728676329634)
                               , thPrevHash = BlockHash (TestHeaderHash 1684377399790728945)
                               , thBodyHash = TestBodyHash 590681868797176966
                               , thSlotNo = SlotNo 3
                               , thBlockNo = BlockNo 1
                               , thChainLength = ChainLength 2
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 2 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-4619175622128342186)
                               , thPrevHash = BlockHash (TestHeaderHash (-5844139728676329634))
                               , thBodyHash = TestBodyHash 590682968308805178
                               , thSlotNo = SlotNo 4
                               , thBlockNo = BlockNo 2
                               , thChainLength = ChainLength 3
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 1 , tbIsValid = False }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (AddBlock
                       TestBlock
                         { testHeader =
                             TestHeader
                               { thHash = TestHeaderHash (-2964422420463002170)
                               , thPrevHash = BlockHash (TestHeaderHash (-4619175622128342186))
                               , thBodyHash = TestBodyHash 590682968308805179
                               , thSlotNo = SlotNo 7
                               , thBlockNo = BlockNo 3
                               , thChainLength = ChainLength 4
                               , thIsEBB = RegularBlock
                               }
                         , testBody = TestBody { tbForkNo = 1 , tbIsValid = True }
                         })
                    Resp
                      { getResp =
                          Right
                            (Point
                               (At
                                  Block
                                    { blockPointSlot = SlotNo 5
                                    , blockPointHash = TestHeaderHash (-1491201838780284349)
                                    }))
                      }
                    []
                , Command
                    (GetIsValid
                       (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))))
                    Resp
                      { getResp =
                          Right (IsValid IsValidResult { real = False , isValid = Nothing })
                      }
                    []
                ]
            }
          Model chain: Genesis :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 2, tbIsValid = True}} :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 3, tbIsValid = True}} :> TestBlock {testHeader = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}, testBody = TestBody {tbForkNo = 3, tbIsValid = True}}
          TraceEvents: TraceOpenEvent StartedOpeningDB
          TraceOpenEvent StartedOpeningImmutableDB
          TraceImmutableDBEvent NoValidLastLocation
          TraceOpenEvent (OpenedImmutableDB Origin 0)
          TraceOpenEvent StartedOpeningVolatileDB
          TraceOpenEvent OpenedVolatileDB
          TraceOpenEvent StartedOpeningLgrDB
          TraceLedgerReplayEvent (ReplayFromGenesis (ReplayGoal Origin))
          TraceOpenEvent OpenedLgrDB
          TraceInitChainSelEvent StartedInitChainSelection
          TraceInitChainSelEvent InitalChainSelected
          TraceOpenEvent (OpenedDB Origin Origin)
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (BlockNo 0) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)) (BlockNo 0) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (PushGoal {unPushGoal = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (Pushing {unPushing = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 0, blockPointHash = TestHeaderHash 1684377399790728945})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 0, newTipTrigger = RealPoint (SlotNo 0) (TestHeaderHash 1684377399790728945)}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList []}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (BlockNo 1) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)) (BlockNo 1) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (PushGoal {unPushGoal = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (Pushing {unPushing = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 3, blockPointHash = TestHeaderHash 1327667169795437917})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 3, newTipTrigger = RealPoint (SlotNo 3) (TestHeaderHash 1327667169795437917)}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}}]}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (BlockNo 2) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))) (BlockNo 2) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TryAddToCurrentChain (RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}) RisingEdge))
          TraceAddBlockEvent (PipeliningEvent (SetTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}) (FallingEdgeWith ())))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (PushGoal {unPushGoal = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (Pushing {unPushing = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 3) (TestHeaderHash 1327667169795437917) (BlockNo 1), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (ChangingSelection (At (Block {blockPointSlot = SlotNo 5, blockPointHash = TestHeaderHash (-1491201838780284349)})))
          TraceAddBlockEvent (AddedToCurrentChain [] (NewTipInfo {newTipPoint = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349)), newTipEpoch = EpochNo 0, newTipSlotInEpoch = 5, newTipTrigger = RealPoint (SlotNo 5) (TestHeaderHash (-1491201838780284349))}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}}) (AnchoredSeq {anchor = AnchorGenesis, unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1684377399790728945, thPrevHash = GenesisHash, thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 0, thBlockNo = BlockNo 0, thChainLength = ChainLength 1, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash 1327667169795437917, thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}},MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock}}]}}))
          TraceAddBlockEvent (PipeliningEvent (OutdatedTentativeHeader (TestHeader {thHash = TestHeaderHash (-1491201838780284349), thPrevHash = BlockHash (TestHeaderHash 1327667169795437917), thBodyHash = TestBodyHash 590680769285548757, thSlotNo = SlotNo 5, thBlockNo = BlockNo 2, thChainLength = ChainLength 3, thIsEBB = RegularBlock})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (BlockNo 1) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (BlockNo 1) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}}]}}}))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (BlockNo 2) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (BlockNo 2) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 4, headerFieldBlockNo = BlockNo 2, headerFieldHash = TestHeaderHash (-4619175622128342186)}}]}}}))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) RisingEdge)
          TraceAddBlockEvent (AddedBlockToQueue (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (FallingEdgeWith 1))
          TraceAddBlockEvent (PoppedBlockFromQueue (FallingEdgeWith (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170)))))
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (BlockNo 3) IsNotEBB RisingEdge)
          TraceAddBlockEvent (AddedBlockToVolatileDB (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (BlockNo 3) IsNotEBB (FallingEdgeWith ()))
          TraceAddBlockEvent (TrySwitchToAFork (RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))) (ChainDiff {getRollback = 2, getSuffix = AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 3, headerFieldBlockNo = BlockNo 1, headerFieldHash = TestHeaderHash (-5844139728676329634)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 4, headerFieldBlockNo = BlockNo 2, headerFieldHash = TestHeaderHash (-4619175622128342186)}},MeasuredWith {unMeasuredWith = HeaderFields {headerFieldSlot = SlotNo 7, headerFieldBlockNo = BlockNo 3, headerFieldHash = TestHeaderHash (-2964422420463002170)}}]}}}))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}) (PushGoal {unPushGoal = RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))}) (Pushing {unPushing = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}))))
          TraceAddBlockEvent (AddBlockValidation (UpdateLedgerDbTraceEvent (StartedPushingBlockToTheLedgerDb (PushStart {unPushStart = RealPoint (SlotNo 3) (TestHeaderHash (-5844139728676329634))}) (PushGoal {unPushGoal = RealPoint (SlotNo 7) (TestHeaderHash (-2964422420463002170))}) (Pushing {unPushing = RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186))}))))
          TraceAddBlockEvent (AddBlockValidation (InvalidBlock (ExtValidationErrorLedger InvalidBlock) (RealPoint (SlotNo 4) (TestHeaderHash (-4619175622128342186)))))
          TraceAddBlockEvent (AddBlockValidation (ValidCandidate (AnchoredSeq {anchor = Anchor (SlotNo 0) (TestHeaderHash 1684377399790728945) (BlockNo 0), unanchorSeq = SFT {fromStrict = fromList [MeasuredWith {unMeasuredWith = TestHeader {thHash = TestHeaderHash (-5844139728676329634), thPrevHash = BlockHash (TestHeaderHash 1684377399790728945), thBodyHash = TestBodyHash 590681868797176966, thSlotNo = SlotNo 3, thBlockNo = BlockNo 1, thChainLength = ChainLength 2, thIsEBB = RegularBlock}}]}})))
          TraceAddBlockEvent (PoppedBlockFromQueue RisingEdge)
          
          PostconditionFailed "AnnotateC \"real response didn't match model response\" (PredicateC (Resp {getResp = Right (IsValid (IsValidResult {real = True, isValid = Just True}))} :/= Resp {getResp = Right (IsValid (IsValidResult {real = False, isValid = Nothing}))}))" /= Ok
          Use --quickcheck-replay=616511 to reproduce.

1 out of 1 tests failed (8.53s)
Model transitions
VolDB   = []
Forks   = G
Chain   = G
Valid   = []
Invalid = []

== AddBlock (G > A, 1684377399790728945) ==>

VolDB   = [A]
Forks   = G---A
Chain   = G---A
Valid   = [A]
Invalid = []

== AddBlock (A > B, 1327667169795437917) ==>

VolDB   = [A, B]
Forks   = G---A---B
Chain   = G---A---B
Valid   = [A, B]
Invalid = []

== AddBlock (B > C, -1491201838780284349) ==>

VolDB   = [A, B, C]
Forks   = G---A---B---C
Chain   = G---A---B---C
Valid   = [A, B, C]
Invalid = []

== AddBlock (A > D, -5844139728676329634) ==>

VolDB   = [A, B, C, D]
Forks   = G---A---B---C 
               \
                \-D
Chain   = G---A---B---C
Valid   = [A, B, C]
Invalid = []

== AddBlock (D > E, -4619175622128342186) ==>

VolDB   = [A, B, C, D, E]
Forks   = G---A---B---C 
               \
                \-D---E
Chain   = G---A---B---C
Valid   = [A, B, C]
Invalid = [E]

== AddBlock (E > F, -2964422420463002170) ==>

VolDB   = [A, B, C, D, E, F]
Forks   = G---A---B---C 
               \
                \-D---E---F
Chain   = G---A---B---C
Valid   = [A, B, C]
Invalid = [E]

As soon as F is added to the unselected fork, the fork becomes longer than the selected chain, and is therefore eligible for chain selection. Part of trying to switch to this fork is to validate blocks D, E and F in order. The SUT sees that D is valid, but that E is invalid. As such, it marks E as invalid, but it now also knows that D is valid. Somehow, the model is not recording anywhere that D is valid.

github-merge-queue bot pushed a commit that referenced this issue Aug 17, 2023
…repancy (#284)

This PR is the third round of fighting with a ChainDB q-s-m model vs SUT
discrepancy for `getIsValid`, see #123 for the history. The two previous
rounds either introduced new bugs or left certain bugs unaddressed.

The approach of this PR is to highlight the *cumulative* change over all
of these different fixes compared to the initial implementation is. For
this, we first revert
IntersectMBO/ouroboros-network#3651,
IntersectMBO/ouroboros-network#3743 and
IntersectMBO/ouroboros-network#3990 in the
first four commits. It is recommended to skip these while reviewing.

The fifth commit in this PR is then fixing the bug in one go with the
benefit of hindsight, see its commit description for details.

Closes #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants