@Test public void getCommitteesFromStateWithCache_shouldReturnCommitteeAssignments() { BeaconState state = dataStructureUtil.randomBeaconState(); List<CommitteeAssignment> data = client.getCommitteesFromState(state, get_current_epoch(state)); assertThat(data.size()).isEqualTo(SLOTS_PER_EPOCH); }
public List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch) { List<CommitteeAssignment> result = new ArrayList<>(); final UInt64 startingSlot = compute_start_slot_at_epoch(epoch); int committeeCount = get_committee_count_per_slot(state, epoch).intValue(); for (int i = 0; i < SLOTS_PER_EPOCH; i++) { UInt64 slot = startingSlot.plus(i); for (int j = 0; j < committeeCount; j++) { UInt64 idx = UInt64.valueOf(j); List<Integer> committee = CommitteeUtil.get_beacon_committee(state, slot, idx); result.add(new CommitteeAssignment(committee, idx, slot)); } } return result; }
CombinedChainDataClient { public List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch) { List<CommitteeAssignment> result = new ArrayList<>(); final UInt64 startingSlot = compute_start_slot_at_epoch(epoch); int committeeCount = get_committee_count_per_slot(state, epoch).intValue(); for (int i = 0; i < SLOTS_PER_EPOCH; i++) { UInt64 slot = startingSlot.plus(i); for (int j = 0; j < committeeCount; j++) { UInt64 idx = UInt64.valueOf(j); List<Integer> committee = CommitteeUtil.get_beacon_committee(state, slot, idx); result.add(new CommitteeAssignment(committee, idx, slot)); } } return result; } }
CombinedChainDataClient { public List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch) { List<CommitteeAssignment> result = new ArrayList<>(); final UInt64 startingSlot = compute_start_slot_at_epoch(epoch); int committeeCount = get_committee_count_per_slot(state, epoch).intValue(); for (int i = 0; i < SLOTS_PER_EPOCH; i++) { UInt64 slot = startingSlot.plus(i); for (int j = 0; j < committeeCount; j++) { UInt64 idx = UInt64.valueOf(j); List<Integer> committee = CommitteeUtil.get_beacon_committee(state, slot, idx); result.add(new CommitteeAssignment(committee, idx, slot)); } } return result; } CombinedChainDataClient(
      final RecentChainData recentChainData, final StorageQueryChannel historicalChainData);  CombinedChainDataClient(
      final RecentChainData recentChainData,
      final StorageQueryChannel historicalChainData,
      final StateTransition stateTransition); }
CombinedChainDataClient { public List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch) { List<CommitteeAssignment> result = new ArrayList<>(); final UInt64 startingSlot = compute_start_slot_at_epoch(epoch); int committeeCount = get_committee_count_per_slot(state, epoch).intValue(); for (int i = 0; i < SLOTS_PER_EPOCH; i++) { UInt64 slot = startingSlot.plus(i); for (int j = 0; j < committeeCount; j++) { UInt64 idx = UInt64.valueOf(j); List<Integer> committee = CommitteeUtil.get_beacon_committee(state, slot, idx); result.add(new CommitteeAssignment(committee, idx, slot)); } } return result; } CombinedChainDataClient(
      final RecentChainData recentChainData, final StorageQueryChannel historicalChainData);  CombinedChainDataClient(
      final RecentChainData recentChainData,
      final StorageQueryChannel historicalChainData,
      final StateTransition stateTransition); SafeFuture<Optional<SignedBeaconBlock>> getBlockAtSlotExact(final UInt64 slot); SafeFuture<Optional<SignedBeaconBlock>> getBlockAtSlotExact(
      final UInt64 slot, final Bytes32 headBlockRoot); SafeFuture<Optional<SignedBeaconBlock>> getBlockInEffectAtSlot(final UInt64 slot); SafeFuture<Optional<BeaconBlockAndState>> getBlockAndStateInEffectAtSlot(
      final UInt64 slot); SafeFuture<Optional<SignedBlockAndState>> getSignedBlockAndStateInEffectAtSlot(
      final UInt64 slot); SafeFuture<Optional<BeaconState>> getStateAtSlotExact(final UInt64 slot); SafeFuture<Optional<CheckpointState>> getCheckpointStateAtEpoch(final UInt64 epoch); SafeFuture<CheckpointState> getCheckpointState(
      final UInt64 epoch, final SignedBlockAndState latestBlockAndState); boolean isFinalized(final UInt64 slot); boolean isFinalizedEpoch(final UInt64 epoch); SafeFuture<Optional<CheckpointState>> retrieveFinalizedCheckpointAndState(); SafeFuture<Optional<BeaconState>> getLatestStateAtSlot(final UInt64 slot); SafeFuture<Optional<BeaconState>> getStateByBlockRoot(final Bytes32 blockRoot); SafeFuture<Optional<BeaconState>> getStateByStateRoot(final Bytes32 stateRoot); Optional<BeaconState> getBestState(); Optional<Bytes32> getBestBlockRoot(); Optional<SignedBeaconBlock> getBestBlock(); boolean isStoreAvailable(); boolean isChainDataFullyAvailable(); List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch); Optional<UInt64> getGenesisTime(); UInt64 getHeadSlot(); UInt64 getHeadEpoch(); Optional<ForkInfo> getHeadForkInfo(); UInt64 getCurrentSlot(); UInt64 getCurrentEpoch(); @VisibleForTesting UpdatableStore getStore(); NavigableMap<UInt64, Bytes32> getAncestorRoots(
      final UInt64 startSlot, final UInt64 step, final UInt64 count); SafeFuture<Optional<SignedBeaconBlock>> getBlockByBlockRoot(final Bytes32 blockRoot); SafeFuture<Optional<UInt64>> getSlotByStateRoot(final Bytes32 stateRoot); }
CombinedChainDataClient { public List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch) { List<CommitteeAssignment> result = new ArrayList<>(); final UInt64 startingSlot = compute_start_slot_at_epoch(epoch); int committeeCount = get_committee_count_per_slot(state, epoch).intValue(); for (int i = 0; i < SLOTS_PER_EPOCH; i++) { UInt64 slot = startingSlot.plus(i); for (int j = 0; j < committeeCount; j++) { UInt64 idx = UInt64.valueOf(j); List<Integer> committee = CommitteeUtil.get_beacon_committee(state, slot, idx); result.add(new CommitteeAssignment(committee, idx, slot)); } } return result; } CombinedChainDataClient(
      final RecentChainData recentChainData, final StorageQueryChannel historicalChainData);  CombinedChainDataClient(
      final RecentChainData recentChainData,
      final StorageQueryChannel historicalChainData,
      final StateTransition stateTransition); SafeFuture<Optional<SignedBeaconBlock>> getBlockAtSlotExact(final UInt64 slot); SafeFuture<Optional<SignedBeaconBlock>> getBlockAtSlotExact(
      final UInt64 slot, final Bytes32 headBlockRoot); SafeFuture<Optional<SignedBeaconBlock>> getBlockInEffectAtSlot(final UInt64 slot); SafeFuture<Optional<BeaconBlockAndState>> getBlockAndStateInEffectAtSlot(
      final UInt64 slot); SafeFuture<Optional<SignedBlockAndState>> getSignedBlockAndStateInEffectAtSlot(
      final UInt64 slot); SafeFuture<Optional<BeaconState>> getStateAtSlotExact(final UInt64 slot); SafeFuture<Optional<CheckpointState>> getCheckpointStateAtEpoch(final UInt64 epoch); SafeFuture<CheckpointState> getCheckpointState(
      final UInt64 epoch, final SignedBlockAndState latestBlockAndState); boolean isFinalized(final UInt64 slot); boolean isFinalizedEpoch(final UInt64 epoch); SafeFuture<Optional<CheckpointState>> retrieveFinalizedCheckpointAndState(); SafeFuture<Optional<BeaconState>> getLatestStateAtSlot(final UInt64 slot); SafeFuture<Optional<BeaconState>> getStateByBlockRoot(final Bytes32 blockRoot); SafeFuture<Optional<BeaconState>> getStateByStateRoot(final Bytes32 stateRoot); Optional<BeaconState> getBestState(); Optional<Bytes32> getBestBlockRoot(); Optional<SignedBeaconBlock> getBestBlock(); boolean isStoreAvailable(); boolean isChainDataFullyAvailable(); List<CommitteeAssignment> getCommitteesFromState(BeaconState state, UInt64 epoch); Optional<UInt64> getGenesisTime(); UInt64 getHeadSlot(); UInt64 getHeadEpoch(); Optional<ForkInfo> getHeadForkInfo(); UInt64 getCurrentSlot(); UInt64 getCurrentEpoch(); @VisibleForTesting UpdatableStore getStore(); NavigableMap<UInt64, Bytes32> getAncestorRoots(
      final UInt64 startSlot, final UInt64 step, final UInt64 count); SafeFuture<Optional<SignedBeaconBlock>> getBlockByBlockRoot(final Bytes32 blockRoot); SafeFuture<Optional<UInt64>> getSlotByStateRoot(final Bytes32 stateRoot);  }