Skip to content

Commit 1dbfdd4

Browse files
committed
Partial integration test
1 parent 518c2b8 commit 1dbfdd4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Diff for: beacon/validator/src/integrationTest/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandlerIntegrationTest.java

+28
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static tech.pegasys.teku.infrastructure.async.SafeFutureAssert.safeJoin;
2222
import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE;
2323

24+
import it.unimi.dsi.fastutil.ints.IntSet;
2425
import java.util.Optional;
2526
import org.junit.jupiter.api.BeforeEach;
2627
import org.junit.jupiter.api.Test;
@@ -29,6 +30,7 @@
2930
import tech.pegasys.teku.beacon.sync.events.SyncState;
3031
import tech.pegasys.teku.beacon.sync.events.SyncStateProvider;
3132
import tech.pegasys.teku.beacon.sync.events.SyncStateTracker;
33+
import tech.pegasys.teku.ethereum.json.types.validator.AttesterDuties;
3234
import tech.pegasys.teku.ethereum.performance.trackers.BlockProductionPerformanceFactory;
3335
import tech.pegasys.teku.infrastructure.async.SafeFuture;
3436
import tech.pegasys.teku.infrastructure.metrics.StubMetricsSystem;
@@ -192,4 +194,30 @@ public void createUnsignedAttestation_withLatestBlockFromAnOldEpoch() {
192194
assertThat(attestation.getSource()).isEqualTo(genesisCheckpoint);
193195
assertThat(attestation.getTarget()).isEqualTo(expectedTarget);
194196
}
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+
}
195223
}

0 commit comments

Comments
 (0)