use of tech.pegasys.teku.spec.config.SpecConfig in project teku by ConsenSys.
the class MinimumGenesisTimeBlockFinderTest method withMinGenesisTime.
private void withMinGenesisTime(final long minGenesisTime, final Optional<UInt64> eth1DepositContractDeployBlock) {
final SpecConfig config = SpecConfigLoader.loadConfig("minimal", builder -> builder.minGenesisTime(UInt64.valueOf(minGenesisTime)));
minimumGenesisTimeBlockFinder = new MinimumGenesisTimeBlockFinder(config, eth1Provider, eth1DepositContractDeployBlock);
}
use of tech.pegasys.teku.spec.config.SpecConfig in project teku by ConsenSys.
the class ConfigProviderTest method shouldParseResultOfConfig.
@Test
void shouldParseResultOfConfig() {
final GetSpecResponse response = configProvider.getConfig();
final SpecConfig specConfig = SpecConfigLoader.loadRemoteConfig(response.data);
final SpecConfig expectedConfig = spec.getGenesisSpecConfig();
assertThat(specConfig).isEqualToComparingFieldByField(expectedConfig);
}
use of tech.pegasys.teku.spec.config.SpecConfig in project teku by ConsenSys.
the class BlockProposalTestUtil method get_eth1_data_stub.
private Eth1Data get_eth1_data_stub(BeaconState state, UInt64 current_epoch) {
final SpecConfig specConfig = spec.atSlot(state.getSlot()).getConfig();
final int epochsPerPeriod = specConfig.getEpochsPerEth1VotingPeriod();
UInt64 votingPeriod = current_epoch.dividedBy(epochsPerPeriod);
return new Eth1Data(Hash.sha256(SSZ.encodeUInt64(epochsPerPeriod)), state.getEth1_deposit_index(), Hash.sha256(Hash.sha256(SSZ.encodeUInt64(votingPeriod.longValue()))));
}
use of tech.pegasys.teku.spec.config.SpecConfig in project teku by ConsenSys.
the class BeaconBlockBodySchemaPhase0Test method create_mainnet.
@Test
public void create_mainnet() {
final Spec spec = TestSpecFactory.createMainnetPhase0();
final SpecConfig specConfig = spec.getGenesisSpecConfig();
final BeaconBlockBodySchemaPhase0 specA = BeaconBlockBodySchemaPhase0.create(specConfig, new AttesterSlashingSchema(new IndexedAttestationSchema(specConfig)));
final BeaconBlockBodySchemaPhase0 specB = BeaconBlockBodySchemaPhase0.create(specConfig, new AttesterSlashingSchema(new IndexedAttestationSchema(specConfig)));
assertThat(specA).isEqualTo(specB);
}
use of tech.pegasys.teku.spec.config.SpecConfig in project teku by ConsenSys.
the class AbstractBeaconStateSchemaTest method changeSpecConfigTest.
@Test
public void changeSpecConfigTest() {
final Spec standardSpec = TestSpecFactory.createMinimalPhase0();
final SpecConfig modifiedConfig = SpecConfigLoader.loadConfig("minimal", b -> b.slotsPerHistoricalRoot(123).historicalRootsLimit(123).epochsPerEth1VotingPeriod(123).validatorRegistryLimit(123L).epochsPerHistoricalVector(123).epochsPerSlashingsVector(123).maxAttestations(123));
BeaconState s1 = getSchema(modifiedConfig).createEmpty();
BeaconState s2 = getSchema(standardSpec.getGenesisSpecConfig()).createEmpty();
assertThat(s1.getBlock_roots().getSchema()).isNotEqualTo(s2.getBlock_roots().getSchema());
assertThat(s1.getState_roots().getSchema()).isNotEqualTo(s2.getState_roots().getSchema());
assertThat(s1.getHistorical_roots().getSchema()).isNotEqualTo(s2.getHistorical_roots().getSchema());
assertThat(s1.getEth1_data_votes().getSchema()).isNotEqualTo(s2.getEth1_data_votes().getSchema());
assertThat(s1.getValidators().getSchema()).isNotEqualTo(s2.getValidators().getSchema());
assertThat(s1.getBalances().getSchema()).isNotEqualTo(s2.getBalances().getSchema());
assertThat(s1.getRandao_mixes().getSchema()).isNotEqualTo(s2.getRandao_mixes().getSchema());
assertThat(s1.getSlashings().getSchema()).isNotEqualTo(s2.getSlashings().getSchema());
}
Aggregations