use of com.radixdlt.consensus.LedgerProof 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.LedgerProof 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.LedgerProof 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);
}
use of com.radixdlt.consensus.LedgerProof in project radixdlt by radixdlt.
the class LocalSyncServiceTest method when_sync_check_is_triggered_at_non_idle__then_should_be_ignored.
@Test
public void when_sync_check_is_triggered_at_non_idle__then_should_be_ignored() {
final LedgerProof currentHeader = mock(LedgerProof.class);
this.setupSyncServiceWithState(SyncState.SyncCheckState.init(currentHeader, ImmutableSet.of()));
this.localSyncService.syncCheckTriggerEventProcessor().process(SyncCheckTrigger.create());
this.setupSyncServiceWithState(SyncState.SyncingState.init(currentHeader, ImmutableList.of(), currentHeader));
this.localSyncService.syncCheckTriggerEventProcessor().process(SyncCheckTrigger.create());
verifyNoMoreInteractions(peersView);
verifyNoMoreInteractions(statusRequestDispatcher);
}
use of com.radixdlt.consensus.LedgerProof in project radixdlt by radixdlt.
the class LocalSyncServiceTest method when_status_timeout_with_at_least_one_response__then_should_start_sync.
@Test
public void when_status_timeout_with_at_least_one_response__then_should_start_sync() {
final LedgerProof currentHeader = createHeaderAtStateVersion(10L);
final LedgerProof statusHeader1 = createHeaderAtStateVersion(12L);
final LedgerProof statusHeader2 = createHeaderAtStateVersion(20L);
final var waiting1 = createPeer();
final var waiting2 = createPeer();
setupPeersView(waiting1, waiting2);
final var syncState = SyncState.SyncCheckState.init(currentHeader, ImmutableSet.of(waiting1, waiting2));
this.setupSyncServiceWithState(syncState);
this.localSyncService.statusResponseEventProcessor().process(waiting1, StatusResponse.create(statusHeader1));
this.localSyncService.syncCheckReceiveStatusTimeoutEventProcessor().process(SyncCheckReceiveStatusTimeout.create());
// even though statusHeader2 is more up to date, it should be ignored because was received
// after a timeout event
this.localSyncService.statusResponseEventProcessor().process(waiting2, StatusResponse.create(statusHeader2));
verify(syncRequestDispatcher, times(1)).dispatch(eq(waiting1), any());
}
Aggregations