Search in sources :

Example 1 with InteropConfig

use of tech.pegasys.teku.validator.api.InteropConfig in project teku by ConsenSys.

the class BeaconChainController method setupInteropState.

protected void setupInteropState() {
    final InteropConfig config = beaconConfig.interopConfig();
    STATUS_LOG.generatingMockStartGenesis(config.getInteropGenesisTime(), config.getInteropNumberOfValidators());
    final BeaconState genesisState = InteropStartupUtil.createMockedStartInitialBeaconState(spec, config.getInteropGenesisTime(), config.getInteropNumberOfValidators());
    recentChainData.initializeFromGenesis(genesisState, timeProvider.getTimeInSeconds());
    EVENT_LOG.genesisEvent(genesisState.hashTreeRoot(), recentChainData.getBestBlockRoot().orElseThrow(), genesisState.getGenesis_time());
}
Also used : InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) BeaconState(tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState)

Example 2 with InteropConfig

use of tech.pegasys.teku.validator.api.InteropConfig in project teku by ConsenSys.

the class BeaconNodeCommandTest method interopEnabled_shouldNotRequireAValue.

@Test
public void interopEnabled_shouldNotRequireAValue() {
    final InteropConfig config = getTekuConfigurationFromArguments("--Xinterop-enabled").beaconChain().interopConfig();
    assertThat(config.isInteropEnabled()).isTrue();
}
Also used : InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) Test(org.junit.jupiter.api.Test)

Example 3 with InteropConfig

use of tech.pegasys.teku.validator.api.InteropConfig in project teku by ConsenSys.

the class ValidatorLoaderTest method initializeInteropValidatorsWhenInteropIsEnabled.

@Test
void initializeInteropValidatorsWhenInteropIsEnabled() {
    final int ownedValidatorCount = 10;
    final InteropConfig interopConfig = InteropConfig.builder().specProvider(spec).interopEnabled(true).interopOwnedValidatorCount(ownedValidatorCount).build();
    final ValidatorConfig config = ValidatorConfig.builder().build();
    final ValidatorLoader validatorLoader = ValidatorLoader.create(spec, config, interopConfig, httpClientFactory, slashingProtector, slashingProtectionLogger, publicKeyLoader, asyncRunner, metricsSystem, Optional.empty());
    validatorLoader.loadValidators();
    final OwnedValidators validators = validatorLoader.getOwnedValidators();
    assertThat(validators.getValidatorCount()).isEqualTo(ownedValidatorCount);
}
Also used : InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) Test(org.junit.jupiter.api.Test)

Example 4 with InteropConfig

use of tech.pegasys.teku.validator.api.InteropConfig in project teku by ConsenSys.

the class ValidatorLoaderTest method doNotInitializeInteropValidatorsWhenInteropIsDisabled.

@Test
void doNotInitializeInteropValidatorsWhenInteropIsDisabled() {
    final int ownedValidatorCount = 10;
    final InteropConfig interopConfig = InteropConfig.builder().specProvider(spec).interopEnabled(false).interopOwnedValidatorCount(ownedValidatorCount).build();
    final ValidatorConfig config = ValidatorConfig.builder().build();
    final ValidatorLoader validatorLoader = ValidatorLoader.create(spec, config, interopConfig, httpClientFactory, slashingProtector, slashingProtectionLogger, publicKeyLoader, asyncRunner, metricsSystem, Optional.empty());
    validatorLoader.loadValidators();
    final OwnedValidators validators = validatorLoader.getOwnedValidators();
    assertThat(validators.hasNoValidators()).isTrue();
}
Also used : InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) ValidatorConfig(tech.pegasys.teku.validator.api.ValidatorConfig) Test(org.junit.jupiter.api.Test)

Aggregations

InteropConfig (tech.pegasys.teku.validator.api.InteropConfig)4 Test (org.junit.jupiter.api.Test)3 ValidatorConfig (tech.pegasys.teku.validator.api.ValidatorConfig)2 BeaconState (tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState)1