use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.
the class MockedRecoveryModule method configuration.
@Provides
private BFTConfiguration configuration(@LastEpochProof LedgerProof proof, BFTValidatorSet validatorSet, Hasher hasher) {
var accumulatorState = new AccumulatorState(0, genesisHash);
UnverifiedVertex genesis = UnverifiedVertex.createGenesis(LedgerHeader.genesis(accumulatorState, validatorSet, 0));
VerifiedVertex verifiedGenesis = new VerifiedVertex(genesis, genesisHash);
LedgerHeader nextLedgerHeader = LedgerHeader.create(proof.getEpoch() + 1, View.genesis(), proof.getAccumulatorState(), proof.timestamp());
var genesisQC = QuorumCertificate.ofGenesis(verifiedGenesis, nextLedgerHeader);
var proposerElection = new WeightedRotatingLeaders(validatorSet);
return new BFTConfiguration(proposerElection, validatorSet, VerifiedVertexStoreState.create(HighQC.from(genesisQC), verifiedGenesis, Optional.empty(), hasher));
}
use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.
the class UnverifiedVertexSerializeTest method get.
private static UnverifiedVertex get() {
View view = View.of(1234567891L);
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader header = new BFTHeader(view, HashUtils.random256(), ledgerHeader);
BFTHeader parent = new BFTHeader(View.of(1234567890L), HashUtils.random256(), ledgerHeader);
VoteData voteData = new VoteData(header, parent, null);
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
var txn = Txn.create(new byte[] { 0, 1, 2, 3 });
return UnverifiedVertex.create(qc, view, List.of(txn), BFTNode.random());
}
use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.
the class VoteDataSerializeTest method get.
private static VoteData get() {
View view = View.of(1234567890L);
LedgerHeader ledgerHeader = LedgerHeaderMock.get();
BFTHeader committed = new BFTHeader(view, HashUtils.random256(), ledgerHeader);
BFTHeader parent = new BFTHeader(view.next(), HashUtils.random256(), ledgerHeader);
BFTHeader proposed = new BFTHeader(view.next().next(), HashUtils.random256(), ledgerHeader);
return new VoteData(proposed, parent, committed);
}
use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.
the class VoteSerializeTest method get.
private static Vote 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);
VoteData voteData = new VoteData(header, parent, null);
BFTNode author = BFTNode.create(ECKeyPair.generateNew().getPublicKey());
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
HighQC highQC = HighQC.from(qc, qc, Optional.empty());
return new Vote(author, voteData, 123456L, ECDSASignature.zeroSignature(), highQC, Optional.empty());
}
use of com.radixdlt.hotstuff.LedgerHeader in project radixdlt by radixdlt.
the class ProposalSerializeTest method get.
private static Proposal 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);
VoteData voteData = new VoteData(header, parent, null);
QuorumCertificate qc = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
var txn = Txn.create(new byte[] { 0, 1, 2, 3 });
// add a particle to ensure atom is valid and has at least one shard
BFTNode author = BFTNode.create(ECKeyPair.generateNew().getPublicKey());
UnverifiedVertex vertex = UnverifiedVertex.create(qc, view, List.of(txn), author);
return new Proposal(vertex, qc, ECDSASignature.zeroSignature(), Optional.empty());
}
Aggregations