use of com.radixdlt.hotstuff.HighQC in project radixdlt by radixdlt.
the class MockedRecoveryModule method view.
@Provides
private ViewUpdate view(BFTConfiguration configuration, ProposerElection proposerElection) {
HighQC highQC = configuration.getVertexStoreState().getHighQC();
View view = highQC.highestQC().getView().next();
final BFTNode leader = proposerElection.getProposer(view);
final BFTNode nextLeader = proposerElection.getProposer(view.next());
return ViewUpdate.create(view, highQC, leader, nextLeader);
}
use of com.radixdlt.hotstuff.HighQC in project radixdlt by radixdlt.
the class ConsensusModuleTest method on_sync_request_timeout_should_retry.
@Test
public void on_sync_request_timeout_should_retry() {
// Arrange
QuorumCertificate parent = vertexStore.highQC().highestQC();
Pair<QuorumCertificate, VerifiedVertex> nextVertex = createNextVertex(parent, validatorKeyPair);
HighQC unsyncedHighQC = HighQC.from(nextVertex.getFirst(), nextVertex.getFirst(), Optional.empty());
bftSync.syncToQC(unsyncedHighQC, validatorBftNode);
GetVerticesRequest request = new GetVerticesRequest(nextVertex.getSecond().getId(), 1);
VertexRequestTimeout timeout = VertexRequestTimeout.create(request);
// Act
// FIXME: Remove when rate limit on send removed
nothrowSleep(100);
bftSync.vertexRequestTimeoutEventProcessor().process(timeout);
// Assert
verify(requestSender, times(2)).dispatch(eq(validatorBftNode), argThat(r -> r.getCount() == 1 && r.getVertexId().equals(nextVertex.getSecond().getId())));
}
use of com.radixdlt.hotstuff.HighQC in project radixdlt by radixdlt.
the class ConsensusModuleTest method on_synced_to_vertex_should_request_for_parent.
@Test
public void on_synced_to_vertex_should_request_for_parent() {
// Arrange
BFTNode bftNode = BFTNode.random();
QuorumCertificate parent = vertexStore.highQC().highestQC();
Pair<QuorumCertificate, VerifiedVertex> nextVertex = createNextVertex(parent, validatorKeyPair);
Pair<QuorumCertificate, VerifiedVertex> nextNextVertex = createNextVertex(nextVertex.getFirst(), validatorKeyPair);
HighQC unsyncedHighQC = HighQC.from(nextNextVertex.getFirst(), nextNextVertex.getFirst(), Optional.empty());
bftSync.syncToQC(unsyncedHighQC, bftNode);
// Act
// FIXME: Remove when rate limit on send removed
nothrowSleep(100);
GetVerticesResponse response = new GetVerticesResponse(ImmutableList.of(nextNextVertex.getSecond()));
bftSync.responseProcessor().process(bftNode, response);
// Assert
verify(requestSender, times(1)).dispatch(eq(bftNode), argThat(r -> r.getCount() == 1 && r.getVertexId().equals(nextVertex.getSecond().getId())));
}
use of com.radixdlt.hotstuff.HighQC in project radixdlt by radixdlt.
the class PacemakerStateTest method when_process_qc_for_wrong_view__then_ignored.
@Test
public void when_process_qc_for_wrong_view__then_ignored() {
HighQC highQC = mock(HighQC.class);
when(highQC.getHighestView()).thenReturn(View.of(1));
// Move ahead for a bit so we can send in a QC for a lower view
this.pacemakerState.processQC(highQCFor(View.of(0)));
this.pacemakerState.processQC(highQCFor(View.of(1)));
this.pacemakerState.processQC(highQCFor(View.of(2)));
verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(1))));
verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(2))));
verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(3))));
this.pacemakerState.processQC(highQC);
verifyNoMoreInteractions(viewUpdateSender);
}
use of com.radixdlt.hotstuff.HighQC 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;
}
Aggregations