use of tech.pegasys.teku.validator.api.AttesterDuty in project teku by ConsenSys.
the class AttestationDutyLoaderTest method shouldSubscribeToSubnetWhenValidatorIsAggregator.
@Test
void shouldSubscribeToSubnetWhenValidatorIsAggregator() {
final UInt64 slot = UInt64.ONE;
final Integer validatorIndex = VALIDATOR_INDICES.get(0);
final int committeeLength = 1;
final int committeeIndex = 3;
final int committeesAtSlot = 4;
final AttesterDuty duty = new AttesterDuty(validatorKey, validatorIndex, committeeLength, committeeIndex, committeesAtSlot, 0, slot);
when(validatorApiChannel.getAttestationDuties(UInt64.ONE, VALIDATOR_INDICES)).thenReturn(SafeFuture.completedFuture(Optional.of(new AttesterDuties(dataStructureUtil.randomBytes32(), List.of(duty)))));
when(scheduledDuties.scheduleProduction(any(), any(), any())).thenReturn(new SafeFuture<>());
when(signer.signAggregationSlot(slot, forkInfo)).thenReturn(SafeFuture.completedFuture(dataStructureUtil.randomSignature()));
final SafeFuture<Optional<SlotBasedScheduledDuties<?, ?>>> result = dutyLoader.loadDutiesForEpoch(UInt64.ONE);
assertThat(result).isCompleted();
verify(beaconCommitteeSubscriptions).subscribeToBeaconCommittee(new CommitteeSubscriptionRequest(validatorIndex, committeeIndex, UInt64.valueOf(committeesAtSlot), slot, true));
verify(beaconCommitteeSubscriptions).sendRequests();
}
Aggregations