Search in sources :

Example 1 with View

use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.

the class UnverifiedVertexTest method setUp.

@Before
public void setUp() {
    View baseView = View.of(1234567890L);
    HashCode id = HashUtils.random256();
    BFTHeader header = new BFTHeader(baseView.next(), id, mock(LedgerHeader.class));
    BFTHeader parent = new BFTHeader(baseView, HashUtils.random256(), mock(LedgerHeader.class));
    VoteData voteData = new VoteData(header, parent, parent);
    this.qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
    this.testObject = UnverifiedVertex.create(this.qc, baseView.next().next(), List.of(), BFTNode.random());
}
Also used : HashCode(com.google.common.hash.HashCode) View(com.radixdlt.consensus.bft.View) Before(org.junit.Before)

Example 2 with View

use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.

the class BFTHeaderTest method setUp.

@Before
public void setUp() {
    View view = View.of(1234567890L);
    this.id = HashUtils.random256();
    this.ledgerHeader = mock(LedgerHeader.class);
    this.testObject = new BFTHeader(view, id, ledgerHeader);
}
Also used : View(com.radixdlt.consensus.bft.View) Before(org.junit.Before)

Example 3 with View

use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.

the class EpochViewTest method testToString.

@Test
public void testToString() {
    View view = mock(View.class);
    EpochView epochView = EpochView.of(12345L, view);
    assertThat(epochView.toString()).isNotNull();
}
Also used : View(com.radixdlt.consensus.bft.View) Test(org.junit.Test)

Example 4 with View

use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.

the class EpochViewTest method testGetters.

@Test
public void testGetters() {
    View view = mock(View.class);
    EpochView epochView = EpochView.of(12345L, view);
    assertThat(epochView.getEpoch()).isEqualTo(12345L);
    assertThat(epochView.getView()).isEqualTo(view);
}
Also used : View(com.radixdlt.consensus.bft.View) Test(org.junit.Test)

Example 5 with View

use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.

the class PacemakerStateTest method when_process_qc_for_wrong_view__then_ignored.

@Test
public void when_process_qc_for_wrong_view__then_ignored() {
    HighQC highQC = mock(HighQC.class);
    when(highQC.getHighestView()).thenReturn(View.of(1));
    // Move ahead for a bit so we can send in a QC for a lower view
    this.pacemakerState.processQC(highQCFor(View.of(0)));
    this.pacemakerState.processQC(highQCFor(View.of(1)));
    this.pacemakerState.processQC(highQCFor(View.of(2)));
    verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(1))));
    verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(2))));
    verify(viewUpdateSender, times(1)).dispatch(argThat(v -> v.getCurrentView().equals(View.of(3))));
    this.pacemakerState.processQC(highQC);
    verifyNoMoreInteractions(viewUpdateSender);
}
Also used : HighQC(com.radixdlt.consensus.HighQC) TypedMocks.rmock(com.radixdlt.utils.TypedMocks.rmock) Mockito(org.mockito.Mockito) HighQC(com.radixdlt.consensus.HighQC) EventDispatcher(com.radixdlt.environment.EventDispatcher) BFTNode(com.radixdlt.consensus.bft.BFTNode) Mockito.times(org.mockito.Mockito.times) ViewUpdate(com.radixdlt.consensus.bft.ViewUpdate) Test(org.junit.Test) QuorumCertificate(com.radixdlt.consensus.QuorumCertificate) View(com.radixdlt.consensus.bft.View) Before(org.junit.Before) Test(org.junit.Test)

Aggregations

View (com.radixdlt.consensus.bft.View)24 BFTNode (com.radixdlt.consensus.bft.BFTNode)11 Test (org.junit.Test)10 HighQC (com.radixdlt.consensus.HighQC)8 BFTHeader (com.radixdlt.consensus.BFTHeader)7 HashCode (com.google.common.hash.HashCode)6 LedgerHeader (com.radixdlt.consensus.LedgerHeader)5 QuorumCertificate (com.radixdlt.consensus.QuorumCertificate)5 Vote (com.radixdlt.consensus.Vote)5 ViewUpdate (com.radixdlt.consensus.bft.ViewUpdate)5 Proposal (com.radixdlt.consensus.Proposal)4 VoteData (com.radixdlt.consensus.VoteData)4 TimestampedECDSASignatures (com.radixdlt.consensus.TimestampedECDSASignatures)3 BFTInsertUpdate (com.radixdlt.consensus.bft.BFTInsertUpdate)3 VerifiedVertex (com.radixdlt.consensus.bft.VerifiedVertex)3 ScheduledLocalTimeout (com.radixdlt.consensus.liveness.ScheduledLocalTimeout)3 SystemCounters (com.radixdlt.counters.SystemCounters)3 EventDispatcher (com.radixdlt.environment.EventDispatcher)3 Before (org.junit.Before)3 AbstractModule (com.google.inject.AbstractModule)2