use of com.radixdlt.hotstuff.bft.BFTNode in project radixdlt by radixdlt.
the class LocalSyncServiceTest method when_status_timeout_with_no_responses__then_should_reschedule_another_check.
@Test
public void when_status_timeout_with_no_responses__then_should_reschedule_another_check() {
final LedgerProof currentHeader = createHeaderAtStateVersion(10L);
final BFTNode waiting1 = createPeer();
setupPeersView(waiting1);
final var syncState = SyncState.SyncCheckState.init(currentHeader, ImmutableSet.of(waiting1));
this.setupSyncServiceWithState(syncState);
this.localSyncService.syncCheckReceiveStatusTimeoutEventProcessor().process(SyncCheckReceiveStatusTimeout.create());
verifyNoMoreInteractions(syncRequestDispatcher);
}
use of com.radixdlt.hotstuff.bft.BFTNode in project radixdlt by radixdlt.
the class FProposalsPerViewDropper method test.
@Override
public boolean test(SimulationNetwork.MessageInTransit msg) {
if (msg.getContent() instanceof Proposal) {
final Proposal proposal = (Proposal) msg.getContent();
final View view = proposal.getVertex().getView();
final Set<BFTNode> nodesToDrop = proposalToDrop.computeIfAbsent(view, v -> {
final List<BFTNode> nodes = Lists.newArrayList(validatorSet);
if (random != null) {
Collections.shuffle(nodes, random);
}
return ImmutableSet.copyOf(nodes.subList(0, faultySize));
});
if (proposalCount.merge(view, 1, Integer::sum).equals(validatorSet.size())) {
proposalToDrop.remove(view);
proposalCount.remove(view);
}
return nodesToDrop.contains(msg.getReceiver());
}
return false;
}
use of com.radixdlt.hotstuff.bft.BFTNode in project radixdlt by radixdlt.
the class MessageCentralValidatorSync method responses.
public Flowable<RemoteEvent<GetVerticesResponse>> responses() {
return this.createFlowable(GetVerticesResponseMessage.class, (src, msg) -> {
BFTNode node = BFTNode.create(src.getPublicKey());
// TODO: Move hasher to a more appropriate place
ImmutableList<VerifiedVertex> hashedVertices = msg.getVertices().stream().map(v -> new VerifiedVertex(v, hasher.hash(v))).collect(ImmutableList.toImmutableList());
return RemoteEvent.create(node, new GetVerticesResponse(hashedVertices));
});
}
use of com.radixdlt.hotstuff.bft.BFTNode in project radixdlt by radixdlt.
the class VoteSerializeTest method get.
private static Vote get() {
View view = View.of(1234567891L);
HashCode id = HashUtils.random256();
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader header = new BFTHeader(view, id, ledgerHeader);
BFTHeader parent = new BFTHeader(View.of(1234567890L), HashUtils.random256(), ledgerHeader);
VoteData voteData = new VoteData(header, parent, null);
BFTNode author = BFTNode.create(ECKeyPair.generateNew().getPublicKey());
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
HighQC highQC = HighQC.from(qc, qc, Optional.empty());
return new Vote(author, voteData, 123456L, ECDSASignature.zeroSignature(), highQC, Optional.empty());
}
use of com.radixdlt.hotstuff.bft.BFTNode in project radixdlt by radixdlt.
the class ProposalSerializeTest method get.
private static Proposal get() {
View view = View.of(1234567891L);
HashCode id = HashUtils.random256();
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader header = new BFTHeader(view, id, ledgerHeader);
BFTHeader parent = new BFTHeader(View.of(1234567890L), HashUtils.random256(), ledgerHeader);
VoteData voteData = new VoteData(header, parent, null);
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
var txn = Txn.create(new byte[] { 0, 1, 2, 3 });
// add a particle to ensure atom is valid and has at least one shard
BFTNode author = BFTNode.create(ECKeyPair.generateNew().getPublicKey());
UnverifiedVertex vertex = UnverifiedVertex.create(qc, view, List.of(txn), author);
return new Proposal(vertex, qc, ECDSASignature.zeroSignature(), Optional.empty());
}
Aggregations