Search in sources :

Example 6 with ViewUpdate

use of com.radixdlt.hotstuff.bft.ViewUpdate in project radixdlt by radixdlt.

the class PacemakerTest method setUp.

@Before
public void setUp() {
    HighQC highQC = mock(HighQC.class);
    QuorumCertificate committedQc = mock(QuorumCertificate.class);
    when(committedQc.getView()).thenReturn(View.of(0));
    when(highQC.highestCommittedQC()).thenReturn(committedQc);
    ViewUpdate initialViewUpdate = ViewUpdate.create(View.of(0), highQC, mock(BFTNode.class), mock(BFTNode.class));
    this.pacemaker = new Pacemaker(this.self, this.counters, this.validatorSet, this.vertexStore, this.safetyRules, this.timeoutDispatcher, this.timeoutSender, this.timeoutCalculator, this.nextTxnsGenerator, this.proposalDispatcher, this.voteDispatcher, hasher, timeSupplier, initialViewUpdate, new SystemCountersImpl());
}
Also used : HighQC(com.radixdlt.hotstuff.HighQC) ViewUpdate(com.radixdlt.hotstuff.bft.ViewUpdate) BFTNode(com.radixdlt.hotstuff.bft.BFTNode) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) SystemCountersImpl(com.radixdlt.counters.SystemCountersImpl) Before(org.junit.Before)

Example 7 with ViewUpdate

use of com.radixdlt.hotstuff.bft.ViewUpdate in project radixdlt by radixdlt.

the class PacemakerTest method when_local_timeout__then_resend_previous_vote.

@Test
public void when_local_timeout__then_resend_previous_vote() {
    View view = View.of(0);
    Vote lastVote = mock(Vote.class);
    Vote lastVoteWithTimeout = mock(Vote.class);
    ImmutableSet<BFTNode> validators = rmock(ImmutableSet.class);
    when(this.safetyRules.getLastVote(view)).thenReturn(Optional.of(lastVote));
    when(this.safetyRules.timeoutVote(lastVote)).thenReturn(lastVoteWithTimeout);
    when(this.validatorSet.nodes()).thenReturn(validators);
    ViewUpdate viewUpdate = ViewUpdate.create(View.of(0), mock(HighQC.class), mock(BFTNode.class), mock(BFTNode.class));
    this.pacemaker.processLocalTimeout(ScheduledLocalTimeout.create(viewUpdate, 0L));
    verify(this.voteDispatcher, times(1)).dispatch(eq(validators), eq(lastVoteWithTimeout));
    verifyNoMoreInteractions(this.vertexStore);
    verify(this.safetyRules, times(1)).getLastVote(view);
    verify(this.safetyRules, times(1)).timeoutVote(lastVote);
    verifyNoMoreInteractions(this.safetyRules);
}
Also used : ViewUpdate(com.radixdlt.hotstuff.bft.ViewUpdate) HighQC(com.radixdlt.hotstuff.HighQC) BFTNode(com.radixdlt.hotstuff.bft.BFTNode) Vote(com.radixdlt.hotstuff.Vote) View(com.radixdlt.hotstuff.bft.View) Test(org.junit.Test)

Aggregations

ViewUpdate (com.radixdlt.hotstuff.bft.ViewUpdate)7 HighQC (com.radixdlt.hotstuff.HighQC)6 BFTNode (com.radixdlt.hotstuff.bft.BFTNode)6 Vote (com.radixdlt.hotstuff.Vote)5 BFTInsertUpdate (com.radixdlt.hotstuff.bft.BFTInsertUpdate)4 View (com.radixdlt.hotstuff.bft.View)4 AbstractModule (com.google.inject.AbstractModule)3 TypeLiteral (com.google.inject.TypeLiteral)3 SystemCounters (com.radixdlt.counters.SystemCounters)3 EventDispatcher (com.radixdlt.environment.EventDispatcher)3 RemoteEventDispatcher (com.radixdlt.environment.RemoteEventDispatcher)3 ScheduledEventDispatcher (com.radixdlt.environment.ScheduledEventDispatcher)3 BFTConfiguration (com.radixdlt.hotstuff.BFTConfiguration)3 Proposal (com.radixdlt.hotstuff.Proposal)3 BFTCommittedUpdate (com.radixdlt.hotstuff.bft.BFTCommittedUpdate)3 BFTHighQCUpdate (com.radixdlt.hotstuff.bft.BFTHighQCUpdate)3 BFTRebuildUpdate (com.radixdlt.hotstuff.bft.BFTRebuildUpdate)3 Self (com.radixdlt.hotstuff.bft.Self)3 HashSigner (com.radixdlt.hotstuff.HashSigner)2 BFTValidatorSet (com.radixdlt.hotstuff.bft.BFTValidatorSet)2