use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.
the class MockedRecoveryModule method view.
@Provides
private ViewUpdate view(BFTConfiguration configuration, ProposerElection proposerElection) {
HighQC highQC = configuration.getVertexStoreState().getHighQC();
View view = highQC.highestQC().getView().next();
final BFTNode leader = proposerElection.getProposer(view);
final BFTNode nextLeader = proposerElection.getProposer(view.next());
return ViewUpdate.create(view, highQC, leader, nextLeader);
}
use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.
the class PacemakerState method processQC.
@Override
public void processQC(HighQC highQC) {
log.trace("QuorumCertificate: {}", highQC);
final View view = highQC.getHighestView();
if (view.gte(this.currentView)) {
this.highQC = highQC;
this.updateView(view.next());
} else {
log.trace("Ignoring QC for view {}: current view is {}", view, this.currentView);
}
}
use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.
the class BFTHeaderSerializeTest method get.
private static BFTHeader get() {
View view = View.of(1234567890L);
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
return new BFTHeader(view, HashUtils.random256(), ledgerHeader);
}
use of com.radixdlt.consensus.bft.View in project radixdlt by radixdlt.
the class HighQCTest method get.
private static HighQC get() {
View view = View.of(1234567891L);
HashCode id = HashUtils.random256();
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader header = new BFTHeader(view, id, ledgerHeader);
BFTHeader parent = new BFTHeader(View.of(1234567890L), HashUtils.random256(), ledgerHeader);
BFTHeader commit = new BFTHeader(View.of(1234567889L), HashUtils.random256(), ledgerHeader);
VoteData voteData = new VoteData(header, parent, commit);
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
return HighQC.from(qc, qc, Optional.empty());
}
use of com.radixdlt.consensus.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();
}
Aggregations