use of com.radixdlt.hotstuff.sync.GetVerticesRequest 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.sync.GetVerticesRequest in project radixdlt by radixdlt.
the class FProposalsPerViewDropperTest method given_incorrect_module_where_vertex_sync_is_disabled__then_test_should_fail_against_drop_proposal_adversary.
/**
* Tests a configuration of 4 nodes with a dropping proposal adversary Test should fail with
* GetVertices RPC disabled
*/
@Test
public void given_incorrect_module_where_vertex_sync_is_disabled__then_test_should_fail_against_drop_proposal_adversary() {
SimulationTest test = bftTestBuilder.addOverrideModuleToAllInitialNodes(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<RemoteEventDispatcher<GetVerticesRequest>>() {
}).toInstance((node, request) -> {
});
}
}).build();
final var runningTest = test.run();
final var checkResults = runningTest.awaitCompletion();
assertThat(checkResults).hasEntrySatisfying(Monitor.CONSENSUS_NO_TIMEOUTS, error -> assertThat(error).isPresent());
}
use of com.radixdlt.hotstuff.sync.GetVerticesRequest in project radixdlt by radixdlt.
the class OneNodeAlwaysAliveSafetyTest method setup.
@Before
public void setup() {
var allNodes = nodeKeys.stream().map(k -> BFTNode.create(k.getPublicKey())).toList();
this.network = new DeterministicNetwork(allNodes, MessageSelector.firstSelector(), (message, queue) -> message.message() instanceof GetVerticesRequest || message.message() instanceof LocalSyncRequest);
Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<ImmutableSet<BFTNode>>() {
}).toInstance(ImmutableSet.copyOf(allNodes));
}
@ProvidesIntoSet
public NodeEventProcessor<?> updateChecker() {
return new NodeEventProcessor<>(ViewQuorumReached.class, (node, viewQuorumReached) -> {
if (viewQuorumReached.votingResult() instanceof FormedQC && ((FormedQC) viewQuorumReached.votingResult()).getQC().getCommitted().isPresent()) {
lastNodeToCommit = network.lookup(node);
}
});
}
}, new SafetyCheckerModule(), new NodeEventsModule()).injectMembers(this);
this.nodeCreators = nodeKeys.stream().<Supplier<Injector>>map(k -> () -> createRunner(k, allNodes)).toList();
for (var nodeCreator : nodeCreators) {
this.nodes.add(nodeCreator.get());
}
}
Aggregations