Search in sources :

Example 16 with View

use of com.radixdlt.hotstuff.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.hotstuff.bft.View) Before(org.junit.Before)

Example 17 with View

use of com.radixdlt.hotstuff.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.hotstuff.bft.View) Before(org.junit.Before)

Example 18 with View

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

the class LedgerProofTest method testGetters.

@Test
public void testGetters() {
    LedgerHeader l0 = mock(LedgerHeader.class);
    HashCode accumulatorHash = mock(HashCode.class);
    View view = mock(View.class);
    when(l0.getEpoch()).thenReturn(3L);
    AccumulatorState accumulatorState = mock(AccumulatorState.class);
    when(accumulatorState.getAccumulatorHash()).thenReturn(accumulatorHash);
    when(accumulatorState.getStateVersion()).thenReturn(12345L);
    when(l0.getAccumulatorState()).thenReturn(accumulatorState);
    when(l0.getView()).thenReturn(view);
    when(l0.timestamp()).thenReturn(2468L);
    when(l0.isEndOfEpoch()).thenReturn(true);
    var ledgerHeaderAndProof = new LedgerProof(HashUtils.random256(), l0, mock(TimestampedECDSASignatures.class));
    assertThat(ledgerHeaderAndProof.getEpoch()).isEqualTo(3L);
    assertThat(ledgerHeaderAndProof.getStateVersion()).isEqualTo(12345L);
    assertThat(ledgerHeaderAndProof.getView()).isEqualTo(view);
    assertThat(ledgerHeaderAndProof.timestamp()).isEqualTo(2468L);
    assertThat(ledgerHeaderAndProof.isEndOfEpoch()).isTrue();
}
Also used : AccumulatorState(com.radixdlt.ledger.AccumulatorState) HashCode(com.google.common.hash.HashCode) View(com.radixdlt.hotstuff.bft.View) Test(org.junit.Test)

Example 19 with View

use of com.radixdlt.hotstuff.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.hotstuff.bft.View) Test(org.junit.Test)

Example 20 with View

use of com.radixdlt.hotstuff.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.hotstuff.bft.View) Test(org.junit.Test)

Aggregations

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