use of tech.pegasys.teku.spec.config.SpecConfig.GENESIS_EPOCH in project teku by ConsenSys.
the class GenesisGeneratorTest method shouldActivateToppedUpValidator.
@Test
public void shouldActivateToppedUpValidator() {
MockStartDepositGenerator mockStartDepositGenerator = new MockStartDepositGenerator(spec, new DepositGenerator(spec, true));
DepositData PARTIAL_DEPOSIT_DATA = mockStartDepositGenerator.createDeposits(VALIDATOR_KEYS.subList(0, 1), UInt64.valueOf(1000000000L)).get(0);
DepositData TOP_UP_DEPOSIT_DATA = mockStartDepositGenerator.createDeposits(VALIDATOR_KEYS.subList(0, 1), UInt64.valueOf(31000000000L)).get(0);
List<DepositData> INITIAL_DEPOSIT_DATA = List.of(PARTIAL_DEPOSIT_DATA, TOP_UP_DEPOSIT_DATA);
List<Deposit> INITIAL_DEPOSITS = IntStream.range(0, INITIAL_DEPOSIT_DATA.size()).mapToObj(index -> {
final DepositData data = INITIAL_DEPOSIT_DATA.get(index);
return new DepositWithIndex(data, UInt64.valueOf(index));
}).collect(toList());
genesisGenerator.updateCandidateState(Bytes32.ZERO, UInt64.ZERO, INITIAL_DEPOSITS);
final BeaconState state = genesisGenerator.getGenesisState();
Assertions.<Integer>assertThat(spec.getActiveValidatorIndices(state, GENESIS_EPOCH)).hasSize(1);
assertThat(genesisGenerator.getActiveValidatorCount()).isEqualTo(1);
}
Aggregations