use of com.radixdlt.hotstuff.bft.View in project radixdlt by radixdlt.
the class HighQCTest method get.
private static HighQC 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);
BFTHeader commit = new BFTHeader(View.of(1234567889L), HashUtils.random256(), ledgerHeader);
VoteData voteData = new VoteData(header, parent, commit);
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
return HighQC.from(qc, qc, Optional.empty());
}
use of com.radixdlt.hotstuff.bft.View 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.View in project radixdlt by radixdlt.
the class MovingWindowValidatorsTest method run.
private void run(int numNodes, int windowSize, long maxEpoch, View highView) {
DeterministicTest bftTest = DeterministicTest.builder().numNodes(numNodes).messageMutator(mutator()).messageSelector(firstSelector()).epochNodeIndexesMapping(windowedEpochToNodesMapper(windowSize, numNodes)).buildWithEpochs(highView).runUntil(DeterministicTest.hasReachedEpochView(EpochView.of(maxEpoch, highView)));
LinkedList<SystemCounters> testCounters = systemCounters(bftTest);
assertThat(testCounters).extracting(sc -> sc.get(CounterType.BFT_VERTEX_STORE_INDIRECT_PARENTS)).containsOnly(0L);
assertThat(testCounters).extracting(sc -> sc.get(CounterType.BFT_PACEMAKER_TIMEOUTS_SENT)).containsOnly(0L);
long maxCount = maxProcessedFor(numNodes, windowSize, maxEpoch, highView.number());
assertThat(testCounters).extracting(sc -> sc.get(CounterType.BFT_COMMITTED_VERTICES)).allMatch(between(maxCount - maxEpoch, maxCount));
}
use of com.radixdlt.hotstuff.bft.View in project radixdlt by radixdlt.
the class UnverifiedVertexSerializeTest method get.
private static UnverifiedVertex get() {
View view = View.of(1234567891L);
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader header = new BFTHeader(view, HashUtils.random256(), 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 });
return UnverifiedVertex.create(qc, view, List.of(txn), BFTNode.random());
}
use of com.radixdlt.hotstuff.bft.View in project radixdlt by radixdlt.
the class VoteDataSerializeTest method get.
private static VoteData get() {
View view = View.of(1234567890L);
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader committed = new BFTHeader(view, HashUtils.random256(), ledgerHeader);
BFTHeader parent = new BFTHeader(view.next(), HashUtils.random256(), ledgerHeader);
BFTHeader proposed = new BFTHeader(view.next().next(), HashUtils.random256(), ledgerHeader);
return new VoteData(proposed, parent, committed);
}
Aggregations