MCPcopy
hub / github.com/canopy-network/canopy / TestStartCommitProcessPhase

Function TestStartCommitProcessPhase

bft/bft_test.go:584–680  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

582}
583
584func TestStartCommitProcessPhase(t *testing.T) {
585 tests := []struct {
586 name string
587 detail string
588 proposalReceived bool
589 validProposal bool
590 isProposer bool
591 hasPartialQCDSE bool
592 hasEVDSE bool
593 }{
594 {
595 name: "no proposal received",
596 detail: `no proposal was received`,
597 },
598 {
599 name: "sender not proposer",
600 detail: `sender is not the set proposer`,
601 proposalReceived: true,
602 },
603 {
604 name: "proposer sent invalid proposal",
605 detail: `the proposer sent a proposal that did not correspond with the block set in the propose phase`,
606 proposalReceived: true,
607 isProposer: true,
608 },
609 {
610 name: "received +2/3 prop vote",
611 detail: `received +2/3 quorum on the precommit votes from replicas`,
612 proposalReceived: true,
613 isProposer: true,
614 validProposal: true,
615 },
616 {
617 name: "received +2/3 prop vote and has partial qc DSE stored",
618 detail: `received +2/3 quorum on the precommit votes from replicas and has double sign evidence stored in the form of a conflicting partial qc`,
619 proposalReceived: true,
620 isProposer: true,
621 validProposal: true,
622 hasPartialQCDSE: true,
623 },
624 }
625 for _, test := range tests {
626 t.Run(test.name, func(t *testing.T) {
627 // setup
628 c := newTestConsensus(t, CommitProcess, 3)
629 if test.hasPartialQCDSE {
630 c.simPrecommitPhase(t, 1)
631 c.newPartialQCDoubleSign(t, Precommit)
632 }
633 if test.hasEVDSE {
634 c.simProposePhase(t, 1, true, ByzantineEvidence{}, nil, 1)
635 c.newElectionVoteDoubleSign(t)
636 }
637 c.bft.Round++
638 multiKey, block, results := crypto.MultiPublicKeyI(nil), []byte(nil), &lib.CertificateResult{}
639 if !test.isProposer {
640 c.bft.ProposerKey = []byte("some other proposer")
641 }

Callers

nothing calls this directly

Calls 15

HashMethod · 0.95
MultiPublicKeyIInterface · 0.92
newTestConsensusFunction · 0.85
RunMethod · 0.80
simPrecommitPhaseMethod · 0.80
simProposePhaseMethod · 0.80
simCommitPhaseMethod · 0.80
EqualMethod · 0.80
NewTestBlockHashMethod · 0.80

Tested by

no test coverage detected