Search in sources :

Example 6 with WeightedRotatingLeaders

use of com.radixdlt.hotstuff.liveness.WeightedRotatingLeaders in project radixdlt by radixdlt.

the class ConsensusModuleTest method setup.

@Before
public void setup() {
    var accumulatorState = new AccumulatorState(0, HashUtils.zero256());
    var genesis = UnverifiedVertex.createGenesis(LedgerHeader.genesis(accumulatorState, null, 0));
    var hashedGenesis = new VerifiedVertex(genesis, HashUtils.zero256());
    var qc = QuorumCertificate.ofGenesis(hashedGenesis, LedgerHeader.genesis(accumulatorState, null, 0));
    this.validatorKeyPair = ECKeyPair.generateNew();
    this.validatorBftNode = BFTNode.create(this.validatorKeyPair.getPublicKey());
    var validatorSet = BFTValidatorSet.from(Stream.of(BFTValidator.from(this.validatorBftNode, UInt256.ONE)));
    var vertexStoreState = VerifiedVertexStoreState.create(HighQC.from(qc), hashedGenesis, Optional.empty(), hasher);
    var proposerElection = new WeightedRotatingLeaders(validatorSet);
    this.bftConfiguration = new BFTConfiguration(proposerElection, validatorSet, vertexStoreState);
    this.ecKeyPair = ECKeyPair.generateNew();
    this.requestSender = rmock(RemoteEventDispatcher.class);
    this.responseSender = rmock(RemoteEventDispatcher.class);
    this.errorResponseSender = rmock(RemoteEventDispatcher.class);
    Guice.createInjector(new ConsensusModule(), new CryptoModule(), getExternalModule()).injectMembers(this);
}
Also used : VerifiedVertex(com.radixdlt.hotstuff.bft.VerifiedVertex) AccumulatorState(com.radixdlt.ledger.AccumulatorState) BFTConfiguration(com.radixdlt.hotstuff.BFTConfiguration) RemoteEventDispatcher(com.radixdlt.environment.RemoteEventDispatcher) WeightedRotatingLeaders(com.radixdlt.hotstuff.liveness.WeightedRotatingLeaders) Before(org.junit.Before)

Aggregations

VerifiedVertex (com.radixdlt.hotstuff.bft.VerifiedVertex)6 WeightedRotatingLeaders (com.radixdlt.hotstuff.liveness.WeightedRotatingLeaders)6 BFTConfiguration (com.radixdlt.hotstuff.BFTConfiguration)5 AccumulatorState (com.radixdlt.ledger.AccumulatorState)5 Hasher (com.radixdlt.crypto.Hasher)4 EventDispatcher (com.radixdlt.environment.EventDispatcher)4 LedgerHeader (com.radixdlt.hotstuff.LedgerHeader)4 UnverifiedVertex (com.radixdlt.hotstuff.UnverifiedVertex)4 BFTNode (com.radixdlt.hotstuff.bft.BFTNode)4 View (com.radixdlt.hotstuff.bft.View)4 AbstractModule (com.google.inject.AbstractModule)3 Inject (com.google.inject.Inject)3 TypeLiteral (com.google.inject.TypeLiteral)3 SystemCounters (com.radixdlt.counters.SystemCounters)3 SystemCountersImpl (com.radixdlt.counters.SystemCountersImpl)3 RemoteEventDispatcher (com.radixdlt.environment.RemoteEventDispatcher)3 HighQC (com.radixdlt.hotstuff.HighQC)3 LedgerProof (com.radixdlt.hotstuff.LedgerProof)3 QuorumCertificate (com.radixdlt.hotstuff.QuorumCertificate)3 BFTValidatorSet (com.radixdlt.hotstuff.bft.BFTValidatorSet)3