use of com.radixdlt.environment.deterministic.network.DeterministicNetwork in project radixdlt by radixdlt.
the class RecoveryLivenessTest method setup.
@Before
public void setup() {
this.messageMutator = MessageMutator.nothing();
this.network = new DeterministicNetwork(nodeKeys.stream().map(k -> BFTNode.create(k.getPublicKey())).toList(), MessageSelector.firstSelector(), this::mutate);
var allNodes = nodeKeys.stream().map(k -> BFTNode.create(k.getPublicKey())).toList();
this.nodeCreators = nodeKeys.stream().<Supplier<Injector>>map(k -> () -> createRunner(k, allNodes)).toList();
for (Supplier<Injector> nodeCreator : nodeCreators) {
this.nodes.add(nodeCreator.get());
}
this.nodes.forEach(i -> i.getInstance(DeterministicProcessor.class).start());
}
use of com.radixdlt.environment.deterministic.network.DeterministicNetwork in project radixdlt by radixdlt.
the class DeterministicActorsTest method setup.
@SuppressWarnings("UnstableApiUsage")
@Before
public void setup() {
var allNodes = nodeKeys.stream().map(k -> BFTNode.create(k.getPublicKey())).toList();
this.network = new DeterministicNetwork(allNodes, MessageSelector.firstSelector(), MessageMutator.nothing());
var nodeCreators = Streams.mapWithIndex(nodeKeys.stream(), (k, i) -> (Supplier<Injector>) () -> createRunner(i == 1, k, allNodes)).toList();
deterministicRunner = new MultiNodeDeterministicRunner(nodeCreators, this::stopDatabase, network);
deterministicRunner.start();
}
use of com.radixdlt.environment.deterministic.network.DeterministicNetwork 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<List<BFTNode>>() {
}).toInstance(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