Search in sources :

Example 6 with TimestampedECDSASignatures

use of com.radixdlt.hotstuff.TimestampedECDSASignatures in project radixdlt by radixdlt.

the class RadixEngineStateComputerTest method committing_epoch_high_views_should_fail.

// TODO: should catch this and log it somewhere as proof of byzantine quorum
@Test
// state not easily obtained where checked in the RadixEngine
@Ignore("FIXME: Reinstate when upper bound on epoch view is in place.")
public void committing_epoch_high_views_should_fail() throws TxBuilderException {
    // Arrange
    var cmd0 = systemUpdateCommand(10, 1);
    var ledgerProof = new LedgerProof(HashUtils.random256(), LedgerHeader.create(0, View.of(11), new AccumulatorState(3, HashUtils.zero256()), 0), new TimestampedECDSASignatures());
    var commandsAndProof = VerifiedTxnsAndProof.create(ImmutableList.of(cmd0), ledgerProof);
    // Act
    // Assert
    assertThatThrownBy(() -> sut.commit(commandsAndProof, null)).isInstanceOf(ByzantineQuorumException.class);
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) AccumulatorState(com.radixdlt.ledger.AccumulatorState) LedgerProof(com.radixdlt.hotstuff.LedgerProof) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with TimestampedECDSASignatures

use of com.radixdlt.hotstuff.TimestampedECDSASignatures in project radixdlt by radixdlt.

the class BerkeleyLedgerEntryStoreTest method storeMetadataWithForks.

private void storeMetadataWithForks(long epoch, ImmutableSet<ForkVotingResult> forkVotingResults) throws RadixEngineException {
    final var fakeTx = mock(REProcessedTxn.class);
    final var txn = mock(Txn.class);
    when(txn.getId()).thenReturn(AID.from(HashUtils.random256().asBytes()));
    when(fakeTx.getTxn()).thenReturn(txn);
    when(fakeTx.getGroupedStateUpdates()).thenReturn(List.of());
    when(txn.getPayload()).thenReturn(HashUtils.random256().asBytes());
    final var proof1 = LedgerAndBFTProof.create(new LedgerProof(HashUtils.random256(), LedgerHeader.create(epoch, View.of(0L), new AccumulatorState(epoch, /* using same state version as epoch */
    HashCode.fromInt(1)), 0L), new TimestampedECDSASignatures(Map.of()))).withForksVotingResults(forkVotingResults);
    sut.transaction(tx -> {
        tx.storeTxn(fakeTx);
        tx.storeMetadata(proof1);
        return null;
    });
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) AccumulatorState(com.radixdlt.ledger.AccumulatorState) LedgerProof(com.radixdlt.hotstuff.LedgerProof)

Example 8 with TimestampedECDSASignatures

use of com.radixdlt.hotstuff.TimestampedECDSASignatures 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());
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) BFTHeader(com.radixdlt.hotstuff.BFTHeader) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) View(com.radixdlt.hotstuff.bft.View) VoteData(com.radixdlt.hotstuff.VoteData)

Example 9 with TimestampedECDSASignatures

use of com.radixdlt.hotstuff.TimestampedECDSASignatures 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());
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) HighQC(com.radixdlt.hotstuff.HighQC) LedgerHeader(com.radixdlt.hotstuff.LedgerHeader) BFTHeader(com.radixdlt.hotstuff.BFTHeader) BFTNode(com.radixdlt.hotstuff.bft.BFTNode) Vote(com.radixdlt.hotstuff.Vote) HashCode(com.google.common.hash.HashCode) QuorumCertificate(com.radixdlt.hotstuff.QuorumCertificate) View(com.radixdlt.hotstuff.bft.View) VoteData(com.radixdlt.hotstuff.VoteData)

Example 10 with TimestampedECDSASignatures

use of com.radixdlt.hotstuff.TimestampedECDSASignatures in project radixdlt by radixdlt.

the class RemoteSyncResponseValidatorSetVerifierTest method setup.

@Before
public void setup() {
    this.validatorSet = mock(BFTValidatorSet.class);
    this.validatorSetVerifier = new RemoteSyncResponseValidatorSetVerifier(validatorSet);
    commandsAndProof = mock(DtoTxnsAndProof.class);
    DtoLedgerProof headerAndProof = mock(DtoLedgerProof.class);
    TimestampedECDSASignatures signatures = mock(TimestampedECDSASignatures.class);
    when(signatures.getSignatures()).thenReturn(ImmutableMap.of());
    when(headerAndProof.getSignatures()).thenReturn(signatures);
    when(commandsAndProof.getTail()).thenReturn(headerAndProof);
}
Also used : TimestampedECDSASignatures(com.radixdlt.hotstuff.TimestampedECDSASignatures) DtoLedgerProof(com.radixdlt.ledger.DtoLedgerProof) DtoTxnsAndProof(com.radixdlt.ledger.DtoTxnsAndProof) BFTValidatorSet(com.radixdlt.hotstuff.bft.BFTValidatorSet) Before(org.junit.Before)

Aggregations

TimestampedECDSASignatures (com.radixdlt.hotstuff.TimestampedECDSASignatures)18 QuorumCertificate (com.radixdlt.hotstuff.QuorumCertificate)9 VoteData (com.radixdlt.hotstuff.VoteData)9 Test (org.junit.Test)9 BFTHeader (com.radixdlt.hotstuff.BFTHeader)8 LedgerProof (com.radixdlt.hotstuff.LedgerProof)8 AccumulatorState (com.radixdlt.ledger.AccumulatorState)8 LedgerHeader (com.radixdlt.hotstuff.LedgerHeader)7 HashCode (com.google.common.hash.HashCode)3 View (com.radixdlt.hotstuff.bft.View)3 BFTNode (com.radixdlt.hotstuff.bft.BFTNode)2 Before (org.junit.Before)2 REEvent (com.radixdlt.constraintmachine.REEvent)1 EventDispatcher (com.radixdlt.environment.EventDispatcher)1 HighQC (com.radixdlt.hotstuff.HighQC)1 Ledger (com.radixdlt.hotstuff.Ledger)1 Proposal (com.radixdlt.hotstuff.Proposal)1 UnverifiedVertex (com.radixdlt.hotstuff.UnverifiedVertex)1 Vote (com.radixdlt.hotstuff.Vote)1 BFTValidatorSet (com.radixdlt.hotstuff.bft.BFTValidatorSet)1