|
21 | 21 | import static tech.pegasys.teku.infrastructure.async.SafeFutureAssert.safeJoin;
|
22 | 22 | import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE;
|
23 | 23 |
|
| 24 | +import it.unimi.dsi.fastutil.ints.IntSet; |
24 | 25 | import java.util.Optional;
|
25 | 26 | import org.junit.jupiter.api.BeforeEach;
|
26 | 27 | import org.junit.jupiter.api.Test;
|
|
29 | 30 | import tech.pegasys.teku.beacon.sync.events.SyncState;
|
30 | 31 | import tech.pegasys.teku.beacon.sync.events.SyncStateProvider;
|
31 | 32 | import tech.pegasys.teku.beacon.sync.events.SyncStateTracker;
|
| 33 | +import tech.pegasys.teku.ethereum.json.types.validator.AttesterDuties; |
32 | 34 | import tech.pegasys.teku.ethereum.performance.trackers.BlockProductionPerformanceFactory;
|
33 | 35 | import tech.pegasys.teku.infrastructure.async.SafeFuture;
|
34 | 36 | import tech.pegasys.teku.infrastructure.metrics.StubMetricsSystem;
|
@@ -192,4 +194,30 @@ public void createUnsignedAttestation_withLatestBlockFromAnOldEpoch() {
|
192 | 194 | assertThat(attestation.getSource()).isEqualTo(genesisCheckpoint);
|
193 | 195 | assertThat(attestation.getTarget()).isEqualTo(expectedTarget);
|
194 | 196 | }
|
| 197 | + |
| 198 | + @Test |
| 199 | + public void getAttestationDuties_withRecentBlockAvailable() { |
| 200 | + chainUpdater.initializeGenesis(); |
| 201 | + final UInt64 epoch = UInt64.valueOf(3); |
| 202 | + final UInt64 slot = spec.computeStartSlotAtEpoch(epoch); |
| 203 | + |
| 204 | + // todo might not need |
| 205 | + // final ChainBuilder.BlockOptions blockOptions = ChainBuilder.BlockOptions.create(); |
| 206 | + // final List<Attestation> attestations = |
| 207 | + // attestationPool.getAttestations(Optional.of(slot), Optional.empty()); |
| 208 | + // attestations.forEach(blockOptions::addAttestation); |
| 209 | + // |
| 210 | + // chainUpdater.advanceChain(slot, blockOptions); |
| 211 | + // chainUpdater.addNewBestBlock(); |
| 212 | + |
| 213 | + chainUpdater.advanceChain(slot); |
| 214 | + |
| 215 | + final SafeFuture<Optional<AttesterDuties>> result = |
| 216 | + handler.getAttestationDuties(epoch, IntSet.of(1, 2)); |
| 217 | + assertThatSafeFuture(result).isCompletedWithNonEmptyOptional(); |
| 218 | + final AttesterDuties attesterDuties = safeJoin(result).orElseThrow(); |
| 219 | + assertThat(attesterDuties.isExecutionOptimistic()).isFalse(); |
| 220 | + assertThat(attesterDuties.getDependentRoot()).isEqualTo(null); // fixme find expected |
| 221 | + assertThat(attesterDuties.getDuties()).isEqualTo(null); // fixme find expected |
| 222 | + } |
195 | 223 | }
|
0 commit comments