diff --git a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/CatchUp.hs b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/CatchUp.hs index c096afa8bc..1663b5b951 100644 --- a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/CatchUp.hs +++ b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/CatchUp.hs @@ -451,7 +451,7 @@ catchupWithTwoBranchesResponse sProtocolVersion = } SBlockHashVersion1 -> DerivableBlockHashesV1 - { dbhv1BlockResultHash = read "f36a049939054eac3e8662e4ab0310d8e12381ee2ba77a9c16fa19c205ea64b3" + { dbhv1BlockResultHash = read "15de5c588b1eef119b2c03e7baf124deb0b3a01260ccc43cb7e470922d67c531" } } TestBlocks.succeedReceiveBlock b4 @@ -586,7 +586,7 @@ testMakeCatchupStatus sProtocolVersion = } SBlockHashVersion1 -> DerivableBlockHashesV1 - { dbhv1BlockResultHash = read "f36a049939054eac3e8662e4ab0310d8e12381ee2ba77a9c16fa19c205ea64b3" + { dbhv1BlockResultHash = read "15de5c588b1eef119b2c03e7baf124deb0b3a01260ccc43cb7e470922d67c531" } } TestBlocks.succeedReceiveBlock b4 diff --git a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Timeout.hs b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Timeout.hs index 1babee078d..600b7dfa46 100644 --- a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Timeout.hs +++ b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Timeout.hs @@ -398,22 +398,22 @@ testReceiveTimeoutMessage :: Spec testReceiveTimeoutMessage sProtocolVersion = describe "Receive timeout message" $ do - it "rejects obsolete round" $ receiveAndCheck sd obsoleteRoundMessage $ Rejected ObsoleteRound - it "rejects obsolete qc" $ receiveAndCheck sd obsoleteQCMessage $ Rejected ObsoleteQC - it "initializes catch-up upon future epoch" $ receiveAndCheck sd futureEpochTM CatchupRequired - it "rejects from a non finalizer" $ receiveAndCheck sd notAFinalizerQCMessage $ Rejected NotAFinalizer - it "rejects on unknown finalization committee" $ receiveAndCheck sd unknownFinalizationCommittee $ Rejected ObsoleteQC - it "rejects on an invalid signature" $ receiveAndCheck sd invalidSignatureMessage $ Rejected InvalidSignature - it "initializes catch-up upon a future round" $ receiveAndCheck sd futureRoundTM CatchupRequired - it "rejects when the qc points to an old finalized block" $ receiveAndCheck sd obsoleteQCPointer $ Rejected ObsoleteQCPointer - it "initializes catch-up when the qc pointer is unknown" $ receiveAndCheck sd unknownQCPointer CatchupRequired - it "rejects when the qc points to a dead block" $ receiveAndCheck sd qcPointerIsDead $ Rejected DeadQCPointer - it "initializes catch-up when qc pointer is pending" $ receiveAndCheck sd qcPointerIsPending CatchupRequired - it "returns duplicate upon a duplicate timeout message" $ receiveAndCheck sd duplicateMessage $ Rejected Duplicate - it "rejects double signing" $ receiveAndCheck sd doubleSignMessage $ Rejected DoubleSigning - it "received a valid timeout message" $ - receiveAndCheck sd validTimeoutMessage $ - Received $ + it "rejects obsolete round" $ receiveAndCheck sd obsoleteRoundMessage $ Rejected ObsoleteRound + it "rejects obsolete qc" $ receiveAndCheck sd obsoleteQCMessage $ Rejected ObsoleteQC + it "initializes catch-up upon future epoch" $ receiveAndCheck sd futureEpochTM CatchupRequired + it "rejects from a non finalizer" $ receiveAndCheck sd notAFinalizerQCMessage $ Rejected NotAFinalizer + it "rejects on unknown finalization committee" $ receiveAndCheck sd unknownFinalizationCommittee $ Rejected ObsoleteQC + it "rejects on an invalid signature" $ receiveAndCheck sd invalidSignatureMessage $ Rejected InvalidSignature + it "initializes catch-up upon a future round" $ receiveAndCheck sd futureRoundTM CatchupRequired + it "rejects when the qc points to an old finalized block" $ receiveAndCheck sd obsoleteQCPointer $ Rejected ObsoleteQCPointer + it "initializes catch-up when the qc pointer is unknown" $ receiveAndCheck sd unknownQCPointer CatchupRequired + it "rejects when the qc points to a dead block" $ receiveAndCheck sd qcPointerIsDead $ Rejected DeadQCPointer + it "initializes catch-up when qc pointer is pending" $ receiveAndCheck sd qcPointerIsPending CatchupRequired + it "returns duplicate upon a duplicate timeout message" $ receiveAndCheck sd duplicateMessage $ Rejected Duplicate + it "rejects double signing" $ receiveAndCheck sd doubleSignMessage $ Rejected DoubleSigning + it "received a valid timeout message" $ + receiveAndCheck sd validTimeoutMessage $ + Received $ PartiallyVerifiedTimeoutMessage validTimeoutMessage finalizers True (Present $ Common.someBlockPointer sProtocolVersion liveBlockHash 1 0) where -- A valid timeout message that should pass the initial verification. @@ -548,13 +548,13 @@ testReceiveTimeoutMessage sProtocolVersion = testExecuteTimeoutMessages :: forall pv. (IsConsensusV1 pv, IsProtocolVersion pv) => SProtocolVersion pv -> Spec testExecuteTimeoutMessages sProtocolVersion = describe "execute timeout messages" $ do - it "rejects message with invalid bls signature" $ execute invalidAggregateSignature InvalidAggregateSignature - it "accepts message where there is already checked a valid qc for the round" $ execute validMessageAbsentQCPointer ExecutionSuccess - it "rejects message with invalid qc signature (qc round is better than recorded highest qc)" $ execute invalidQCTimeoutMessage $ InvalidQC $ someInvalidQC 2 0 - it "accepts message where qc is ok (qc round is better than recorded highest qc)" $ execute newValidQCTimeoutMessage ExecutionSuccess - it "rejects message with qc round no greater than highest qc and invalic qc" $ execute wrongEpochMessage $ InvalidQC $ someInvalidQC 0 0 - it "accepts message with qc round no greather than highest qc and valid qc" $ execute oldValidQCTimeoutMessage ExecutionSuccess - it "accepts message with qc already checked for that round and qc checks out (qc round <= higest qc)" $ execute oldRoundValidTimeoutMessage ExecutionSuccess + it "rejects message with invalid bls signature" $ execute invalidAggregateSignature InvalidAggregateSignature + it "accepts message where there is already checked a valid qc for the round" $ execute validMessageAbsentQCPointer ExecutionSuccess + it "rejects message with invalid qc signature (qc round is better than recorded highest qc)" $ execute invalidQCTimeoutMessage $ InvalidQC $ someInvalidQC 2 0 + it "accepts message where qc is ok (qc round is better than recorded highest qc)" $ execute newValidQCTimeoutMessage ExecutionSuccess + it "rejects message with qc round no greater than highest qc and invalic qc" $ execute wrongEpochMessage $ InvalidQC $ someInvalidQC 0 0 + it "accepts message with qc round no greather than highest qc and valid qc" $ execute oldValidQCTimeoutMessage ExecutionSuccess + it "accepts message with qc already checked for that round and qc checks out (qc round <= higest qc)" $ execute oldRoundValidTimeoutMessage ExecutionSuccess where -- action that runs @executeTimeoutMessage@ on the provided -- timeout message and checks that it matches the expectation. @@ -675,10 +675,10 @@ testCheckTimeoutCertificate :: Spec testCheckTimeoutCertificate sProtocolVersion = describe "check timeout certificate" $ do - it "accepts timeout certificate" checkOkTC - it "rejects with wrong genesis" wrongGenesis - it "rejects when there is not enough weight" insufficientWeight - it "rejects when the signature is invalid" invalidSignature + it "accepts timeout certificate" checkOkTC + it "rejects with wrong genesis" wrongGenesis + it "rejects when there is not enough weight" insufficientWeight + it "rejects when the signature is invalid" invalidSignature where checkOkTC = runTest $ do finComm <- use $ skovEpochBakers . currentEpochBakers . bfFinalizers diff --git a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Types.hs b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Types.hs index d0bbe7135e..77ecc1658a 100644 --- a/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Types.hs +++ b/concordium-consensus/tests/consensus/ConcordiumTests/KonsensusV1/Types.hs @@ -319,7 +319,7 @@ propSerializeSignedBlock :: (IsProtocolVersion pv) => SProtocolVersion pv -> Property -propSerializeSignedBlock sProtocolVersion = +propSerializeSignedBlock _ = forAll (genSignedBlock @pv) $ \sb -> case runGet (getSignedBlock (TransactionTime 42)) $! runPut (putSignedBlock sb) of Left _ -> False