Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
td202 committed Jan 8, 2024
1 parent 98508e6 commit 1db5c9f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ catchupWithTwoBranchesResponse sProtocolVersion =
}
SBlockHashVersion1 ->
DerivableBlockHashesV1
{ dbhv1BlockResultHash = read "f36a049939054eac3e8662e4ab0310d8e12381ee2ba77a9c16fa19c205ea64b3"
{ dbhv1BlockResultHash = read "15de5c588b1eef119b2c03e7baf124deb0b3a01260ccc43cb7e470922d67c531"
}
}
TestBlocks.succeedReceiveBlock b4
Expand Down Expand Up @@ -586,7 +586,7 @@ testMakeCatchupStatus sProtocolVersion =
}
SBlockHashVersion1 ->
DerivableBlockHashesV1
{ dbhv1BlockResultHash = read "f36a049939054eac3e8662e4ab0310d8e12381ee2ba77a9c16fa19c205ea64b3"
{ dbhv1BlockResultHash = read "15de5c588b1eef119b2c03e7baf124deb0b3a01260ccc43cb7e470922d67c531"
}
}
TestBlocks.succeedReceiveBlock b4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1db5c9f

Please sign in to comment.