Search in sources :

Example 21 with QuorumCertificate

use of com.radixdlt.hotstuff.QuorumCertificate in project radixdlt by radixdlt.

the class PacemakerStateTest method highQCFor.

private HighQC highQCFor(View view) {
    HighQC highQC = mock(HighQC.class);
    QuorumCertificate hqc = mock(QuorumCertificate.class);
    QuorumCertificate cqc = mock(QuorumCertificate.class);
    when(hqc.getView()).thenReturn(view);
    when(cqc.getView()).thenReturn(View.of(0));
    when(highQC.highestQC()).thenReturn(hqc);
    when(highQC.highestCommittedQC()).thenReturn(cqc);
    when(highQC.getHighestView()).thenReturn(view);
    return highQC;
}
Also used : HighQC(com.radixdlt.hotstuff.HighQC) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate)

Example 22 with QuorumCertificate

use of com.radixdlt.hotstuff.QuorumCertificate in project radixdlt by radixdlt.

the class PacemakerTest method setUp.

@Before
public void setUp() {
    HighQC highQC = mock(HighQC.class);
    QuorumCertificate committedQc = mock(QuorumCertificate.class);
    when(committedQc.getView()).thenReturn(View.of(0));
    when(highQC.highestCommittedQC()).thenReturn(committedQc);
    ViewUpdate initialViewUpdate = ViewUpdate.create(View.of(0), highQC, mock(BFTNode.class), mock(BFTNode.class));
    this.pacemaker = new Pacemaker(this.self, this.counters, this.validatorSet, this.vertexStore, this.safetyRules, this.timeoutDispatcher, this.timeoutSender, this.timeoutCalculator, this.nextTxnsGenerator, this.proposalDispatcher, this.voteDispatcher, hasher, timeSupplier, initialViewUpdate, new SystemCountersImpl());
}
Also used : HighQC(com.radixdlt.hotstuff.HighQC) ViewUpdate(com.radixdlt.hotstuff.bft.ViewUpdate) BFTNode(com.radixdlt.hotstuff.bft.BFTNode) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) SystemCountersImpl(com.radixdlt.counters.SystemCountersImpl) Before(org.junit.Before)

Example 23 with QuorumCertificate

use of com.radixdlt.hotstuff.QuorumCertificate in project radixdlt by radixdlt.

the class VerifiedVertexStoreStateCreationTest method creating_vertex_store_with_qc_not_matching_vertex_should_fail.

@Test
public void creating_vertex_store_with_qc_not_matching_vertex_should_fail() {
    BFTHeader genesisHeader = new BFTHeader(View.of(0), HashUtils.random256(), mock(LedgerHeader.class));
    VoteData voteData = new VoteData(genesisHeader, genesisHeader, genesisHeader);
    QuorumCertificate badRootQC = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
    assertThatThrownBy(() -> VerifiedVertexStoreState.create(HighQC.from(badRootQC), genesisVertex, Optional.empty(), hasher)).isInstanceOf(IllegalStateException.class);
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) BFTHeader(com.radixdlt.hotstuff.BFTHeader) LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) VoteData(com.radixdlt.hotstuff.VoteData) Test(org.junit.Test)

Example 24 with QuorumCertificate

use of com.radixdlt.hotstuff.QuorumCertificate in project radixdlt by radixdlt.

the class DifferentTimestampsCauseTimeoutTest method mutateQC.

private QuorumCertificate mutateQC(QuorumCertificate qc, int destination) {
    TimestampedECDSASignatures signatures = qc.getTimestampedSignatures();
    VoteData voteData = qc.getVoteData();
    return new QuorumCertificate(voteData, mutateTimestampedSignatures(signatures, destination));
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) VoteData(com.radixdlt.hotstuff.VoteData)

Example 25 with QuorumCertificate

use of com.radixdlt.hotstuff.QuorumCertificate in project radixdlt by radixdlt.

the class DifferentTimestampsCauseTimeoutTest method mutateProposal.

private Proposal mutateProposal(Proposal p, int destination) {
    QuorumCertificate committedQC = p.highQC().highestCommittedQC();
    UnverifiedVertex vertex = p.getVertex();
    ECDSASignature signature = p.getSignature();
    return new Proposal(mutateVertex(vertex, destination), committedQC, signature, Optional.empty());
}
Also used : QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) ECDSASignature(com.radixdlt.crypto.ECDSASignature) TimestampedECDSASignature(com.radixdlt.hotstuff.TimestampedECDSASignature) UnverifiedVertex(com.radixdlt.hotstuff.UnverifiedVertex) Proposal(com.radixdlt.hotstuff.Proposal)

Aggregations

QuorumCertificate (com.radixdlt.hotstuff.QuorumCertificate)25 HighQC (com.radixdlt.hotstuff.HighQC)14 LedgerHeader (com.radixdlt.hotstuff.LedgerHeader)13 Test (org.junit.Test)13 BFTHeader (com.radixdlt.hotstuff.BFTHeader)12 TimestampedECDSASignatures (com.radixdlt.hotstuff.TimestampedECDSASignatures)12 VoteData (com.radixdlt.hotstuff.VoteData)12 BFTNode (com.radixdlt.hotstuff.bft.BFTNode)9 VerifiedVertex (com.radixdlt.hotstuff.bft.VerifiedVertex)8 View (com.radixdlt.hotstuff.bft.View)8 UnverifiedVertex (com.radixdlt.hotstuff.UnverifiedVertex)7 EventDispatcher (com.radixdlt.environment.EventDispatcher)6 Before (org.junit.Before)6 HashCode (com.google.common.hash.HashCode)5 Txn (com.radixdlt.atom.Txn)5 ViewUpdate (com.radixdlt.hotstuff.bft.ViewUpdate)5 Hasher (com.radixdlt.crypto.Hasher)4 Ledger (com.radixdlt.hotstuff.Ledger)4 Proposal (com.radixdlt.hotstuff.Proposal)4 VerifiedVertexStoreState (com.radixdlt.hotstuff.bft.VerifiedVertexStoreState)4