use of tech.pegasys.teku.statetransition.validation.InternalValidationResult in project teku by ConsenSys.
the class SignedContributionAndProofValidatorTest method shouldRejectAggregateSignatureIsInvalid.
@Test
void shouldRejectAggregateSignatureIsInvalid() {
final SignedContributionAndProof message = chainBuilder.createValidSignedContributionAndProofBuilder().addParticipantSignature(dataStructureUtil.randomSignature()).build();
assertThat(validator.validate(message)).isCompletedWithValueMatching(InternalValidationResult::isReject);
}
use of tech.pegasys.teku.statetransition.validation.InternalValidationResult in project teku by ConsenSys.
the class SignedContributionAndProofValidatorTest method shouldIgnoreWhenContributionIsNotFromTheCurrentSlot.
@Test
void shouldIgnoreWhenContributionIsNotFromTheCurrentSlot() {
final SignedContributionAndProof message = chainBuilder.createValidSignedContributionAndProofBuilder().build();
final UInt64 slot = message.getMessage().getContribution().getSlot().plus(1);
// disparity is 500 millis, so 1 second into next slot will be time
final UInt64 slotSeconds = slot.times(spec.getSecondsPerSlot(slot)).plus(1);
timeProvider.advanceTimeBy(Duration.ofSeconds(slotSeconds.longValue()));
storageSystem.chainUpdater().setCurrentSlot(message.getMessage().getContribution().getSlot().plus(1));
final SafeFuture<InternalValidationResult> result = validator.validate(message);
assertThat(result).isCompletedWithValue(IGNORE);
}
use of tech.pegasys.teku.statetransition.validation.InternalValidationResult in project teku by ConsenSys.
the class SignedContributionAndProofValidatorTest method shouldRejectWhenAggregatorIsNotInSyncCommittee.
@Test
void shouldRejectWhenAggregatorIsNotInSyncCommittee() {
final SignedContributionAndProof message = chainBuilder.createValidSignedContributionAndProofBuilder().aggregatorNotInSyncSubcommittee().build();
assertThat(validator.validate(message)).isCompletedWithValueMatching(InternalValidationResult::isReject);
}
use of tech.pegasys.teku.statetransition.validation.InternalValidationResult in project teku by ConsenSys.
the class SignedContributionAndProofValidatorTest method shouldAcceptWhenValidButBeaconBlockRootIsUnknown.
@Test
void shouldAcceptWhenValidButBeaconBlockRootIsUnknown() {
final SignedContributionAndProof message = chainBuilder.createValidSignedContributionAndProofBuilder(UInt64.ZERO, dataStructureUtil.randomBytes32()).build();
final SafeFuture<InternalValidationResult> result = validator.validate(message);
assertThat(result).isCompletedWithValue(ACCEPT);
}
use of tech.pegasys.teku.statetransition.validation.InternalValidationResult in project teku by ConsenSys.
the class SignedContributionAndProofValidatorTest method shouldRejectWhenAggregatorIndexIsUnknown.
@Test
void shouldRejectWhenAggregatorIndexIsUnknown() {
final SignedContributionAndProof message = chainBuilder.createValidSignedContributionAndProofBuilder().aggregatorIndex(UInt64.valueOf(10_000)).build();
assertThat(validator.validate(message)).isCompletedWithValueMatching(InternalValidationResult::isReject);
}
Aggregations