Search in sources :

Example 1 with Eth2NetworkConfiguration

use of tech.pegasys.teku.networks.Eth2NetworkConfiguration in project teku by ConsenSys.

the class UnusedValidatorClientOptions method configure.

public void configure(final TekuConfiguration.Builder builder, String network) {
    // Create a config instance so we can inspect the values in the other builders
    final Eth2NetworkConfiguration eth2Config = createEth2NetworkConfig(network);
    builder.eth2NetworkConfig(b -> this.configureEth2Network(b, network)).powchain(b -> {
        b.depositContract(eth2Config.getEth1DepositContractAddress());
        b.depositContractDeployBlock(eth2Config.getEth1DepositContractDeployBlock());
    }).storageConfiguration(b -> b.eth1DepositContract(eth2Config.getEth1DepositContractAddress())).p2p(b -> b.peerRateLimit(peerRateLimit).peerRequestLimit(peerRequestLimit)).discovery(b -> b.bootnodes(eth2Config.getDiscoveryBootnodes())).restApi(b -> b.eth1DepositContractAddress(eth2Config.getEth1DepositContractAddress()));
}
Also used : Option(picocli.CommandLine.Option) DEFAULT_PEER_RATE_LIMIT(tech.pegasys.teku.networking.eth2.P2PConfig.DEFAULT_PEER_RATE_LIMIT) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration) DEFAULT_PEER_REQUEST_LIMIT(tech.pegasys.teku.networking.eth2.P2PConfig.DEFAULT_PEER_REQUEST_LIMIT) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) StringUtils(org.apache.commons.lang3.StringUtils) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration)

Example 2 with Eth2NetworkConfiguration

use of tech.pegasys.teku.networks.Eth2NetworkConfiguration in project teku by ConsenSys.

the class DepositOptions method createDepositSender.

public DepositSender createDepositSender(final boolean verboseOutputEnabled) {
    final Eth2NetworkConfiguration networkConfig = Eth2NetworkConfiguration.builder(network).build();
    final tech.pegasys.teku.spec.Spec spec = networkConfig.getSpec();
    return new DepositSender(spec, eth1NodeUrl, getEth1Credentials(), getContractAddress(networkConfig), verboseOutputEnabled, getAmount(spec.getGenesisSpecConfig()), shutdownFunction, consoleAdapter);
}
Also used : DepositSender(tech.pegasys.teku.cli.subcommand.internal.validator.tools.DepositSender) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration)

Example 3 with Eth2NetworkConfiguration

use of tech.pegasys.teku.networks.Eth2NetworkConfiguration in project teku by ConsenSys.

the class Eth2P2PNetworkOptionsTest method overrideDepositContract.

@Test
public void overrideDepositContract() {
    beaconNodeCommand.parse(new String[] { "--network", "mainnet", "--eth1-deposit-contract-address", "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73" });
    TekuConfiguration tekuConfiguration = getResultingTekuConfiguration();
    Eth2NetworkConfiguration configuration = tekuConfiguration.eth2NetworkConfiguration();
    final Eth1Address configuredDepositContract = configuration.getEth1DepositContractAddress();
    assertThat(configuredDepositContract).isEqualTo(Eth1Address.fromHexString("0xfe3b557e8fb62b89f4916b721be55ceb828dbd73"));
    assertThat(createConfigBuilder().eth2NetworkConfig(b -> {
        b.applyNetworkDefaults(Eth2Network.MAINNET);
        b.eth1DepositContractAddress("0xfe3b557e8fb62b89f4916b721be55ceb828dbd73");
    }).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration) Eth1Address(tech.pegasys.teku.spec.datastructures.eth1.Eth1Address) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 4 with Eth2NetworkConfiguration

use of tech.pegasys.teku.networks.Eth2NetworkConfiguration in project teku by ConsenSys.

the class Eth2P2PNetworkOptionsTest method initialState_shouldDefaultToNetworkValue.

@Test
public void initialState_shouldDefaultToNetworkValue() {
    final String network = "prater";
    final Eth2NetworkConfiguration networkConfig = Eth2NetworkConfiguration.builder(network).build();
    assertThat(networkConfig.getInitialState()).isPresent();
    final TekuConfiguration config = getTekuConfigurationFromArguments("--network", network);
    assertThat(config.eth2NetworkConfiguration().getInitialState()).isEqualTo(networkConfig.getInitialState());
    assertThat(config.eth2NetworkConfiguration().isUsingCustomInitialState()).isFalse();
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 5 with Eth2NetworkConfiguration

use of tech.pegasys.teku.networks.Eth2NetworkConfiguration in project teku by ConsenSys.

the class Eth2P2PNetworkOptionsTest method initialState_shouldOverrideNetworkValue.

@Test
public void initialState_shouldOverrideNetworkValue() {
    final String state = "state.ssz";
    final String network = "prater";
    final Eth2NetworkConfiguration networkConfig = Eth2NetworkConfiguration.builder(network).build();
    assertThat(networkConfig.getInitialState()).isPresent();
    final TekuConfiguration config = getTekuConfigurationFromArguments("--initial-state", state, "--network", network);
    assertThat(config.eth2NetworkConfiguration().getInitialState()).contains(state);
    assertThat(config.eth2NetworkConfiguration().isUsingCustomInitialState()).isTrue();
    assertThat(createConfigBuilder().eth2NetworkConfig(b -> {
        b.applyNetworkDefaults(network);
        b.customInitialState(state);
    }).build()).usingRecursiveComparison().isEqualTo(config);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Aggregations

Eth2NetworkConfiguration (tech.pegasys.teku.networks.Eth2NetworkConfiguration)10 TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)7 Test (org.junit.jupiter.api.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)4 StringUtils (org.apache.commons.lang3.StringUtils)2 VersionedDatabaseFactory (tech.pegasys.teku.storage.server.VersionedDatabaseFactory)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Resources (com.google.common.io.Resources)1 IOException (java.io.IOException)1 URL (java.net.URL)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Path (java.nio.file.Path)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 OptionalInt (java.util.OptionalInt)1