use of com.radixdlt.consensus.TimestampedECDSASignatures in project radixdlt by radixdlt.
the class VerifiedVertexStoreStateCreationTest method creating_vertex_store_with_committed_qc_not_matching_vertex_should_fail.
@Test
public void creating_vertex_store_with_committed_qc_not_matching_vertex_should_fail() {
BFTHeader genesisHeader = new BFTHeader(View.of(0), genesisHash, mock(LedgerHeader.class));
BFTHeader otherHeader = new BFTHeader(View.of(0), HashUtils.random256(), mock(LedgerHeader.class));
VoteData voteData = new VoteData(genesisHeader, genesisHeader, otherHeader);
QuorumCertificate badRootQC = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
assertThatThrownBy(() -> VerifiedVertexStoreState.create(HighQC.from(badRootQC), genesisVertex, Optional.empty(), hasher)).isInstanceOf(IllegalStateException.class);
}
use of com.radixdlt.consensus.TimestampedECDSASignatures in project radixdlt by radixdlt.
the class VerifiedVertexStoreStateCreationTest method creating_vertex_store_with_root_not_committed_should_fail.
@Test
public void creating_vertex_store_with_root_not_committed_should_fail() {
BFTHeader genesisHeader = new BFTHeader(View.of(0), genesisHash, mock(LedgerHeader.class));
VoteData voteData = new VoteData(genesisHeader, genesisHeader, null);
QuorumCertificate badRootQC = new QuorumCertificate(voteData, new TimestampedECDSASignatures());
assertThatThrownBy(() -> VerifiedVertexStoreState.create(HighQC.from(badRootQC), genesisVertex, Optional.empty(), hasher)).isInstanceOf(IllegalStateException.class);
}
use of com.radixdlt.consensus.TimestampedECDSASignatures in project radixdlt by radixdlt.
the class RadixEngineStateComputerTest method committing_epoch_change_with_additional_cmds_should_fail.
// TODO: should catch this and log it somewhere as proof of byzantine quorum
@Test
public void committing_epoch_change_with_additional_cmds_should_fail() throws Exception {
// Arrange
var keyPair = ECKeyPair.generateNew();
var cmd0 = systemUpdateCommand(0, 2);
var cmd1 = registerCommand(keyPair);
var ledgerProof = new LedgerProof(HashUtils.random256(), LedgerHeader.create(0, View.of(9), new AccumulatorState(3, HashUtils.zero256()), 0), new TimestampedECDSASignatures());
var commandsAndProof = VerifiedTxnsAndProof.create(ImmutableList.of(cmd0, cmd1), ledgerProof);
// Act
// Assert
assertThatThrownBy(() -> sut.commit(commandsAndProof, null)).isInstanceOf(ByzantineQuorumException.class);
}
use of com.radixdlt.consensus.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);
}
use of com.radixdlt.consensus.TimestampedECDSASignatures in project radixdlt by radixdlt.
the class RadixEngineStateComputerTest method committing_epoch_change_when_there_shouldnt_be_one__should_fail.
// TODO: should catch this and log it somewhere as proof of byzantine quorum
@Test
public void committing_epoch_change_when_there_shouldnt_be_one__should_fail() throws TxBuilderException {
// Arrange
var cmd0 = systemUpdateCommand(1, 1);
var ledgerProof = new LedgerProof(HashUtils.random256(), LedgerHeader.create(0, View.of(9), new AccumulatorState(3, HashUtils.zero256()), 0, BFTValidatorSet.from(Stream.of(BFTValidator.from(BFTNode.random(), UInt256.ONE)))), new TimestampedECDSASignatures());
var commandsAndProof = VerifiedTxnsAndProof.create(ImmutableList.of(cmd0), ledgerProof);
// Act
// Assert
assertThatThrownBy(() -> sut.commit(commandsAndProof, null)).isInstanceOf(ByzantineQuorumException.class);
}
Aggregations