Search in sources :

Example 21 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class DepositOptionsTest method shouldReadDepositOptionsFromConfigurationFile.

@Test
public void shouldReadDepositOptionsFromConfigurationFile() {
    final TekuConfiguration config = getTekuConfigurationFromFile("depositOptions_config.yaml");
    assertThat(config.powchain().isEnabled()).isTrue();
    assertThat(config.powchain().getEth1Endpoints()).containsExactly("http://example.com:1234/path/");
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 22 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class DepositOptionsTest method multiple_eth1Endpoints_areSupported_mixedParams.

@Test
public void multiple_eth1Endpoints_areSupported_mixedParams() {
    final String[] args = { "--eth1-endpoint", "http://example-single.com:1234/path/", "--eth1-endpoints", "http://example.com:1234/path/,http://example-2.com:1234/path/", "http://example-3.com:1234/path/" };
    final TekuConfiguration config = getTekuConfigurationFromArguments(args);
    assertThat(config.powchain().getEth1Endpoints()).containsExactlyInAnyOrder("http://example-single.com:1234/path/", "http://example.com:1234/path/", "http://example-2.com:1234/path/", "http://example-3.com:1234/path/");
    assertThat(config.powchain().isEnabled()).isTrue();
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 23 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class DepositOptionsTest method multiple_eth1Endpoints_areSupported.

@Test
public void multiple_eth1Endpoints_areSupported() {
    final String[] args = { "--eth1-endpoints", "http://example.com:1234/path/,http://example-2.com:1234/path/", "http://example-3.com:1234/path/" };
    final TekuConfiguration config = getTekuConfigurationFromArguments(args);
    assertThat(config.powchain().getEth1Endpoints()).containsExactlyInAnyOrder("http://example.com:1234/path/", "http://example-2.com:1234/path/", "http://example-3.com:1234/path/");
    assertThat(config.powchain().isEnabled()).isTrue();
    assertThat(createConfigBuilder().powchain(b -> b.eth1Endpoints(List.of("http://example.com:1234/path/", "http://example-2.com:1234/path/", "http://example-3.com:1234/path/"))).build()).usingRecursiveComparison().isEqualTo(config);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 24 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class Eth2P2PNetworkOptionsTest method initialState_shouldAcceptValue.

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

Example 25 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration 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)

Aggregations

TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)94 Test (org.junit.jupiter.api.Test)88 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)84 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)19 BeaconRestApiConfig (tech.pegasys.teku.beaconrestapi.BeaconRestApiConfig)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)12 List (java.util.List)10 Eth2NetworkConfiguration (tech.pegasys.teku.networks.Eth2NetworkConfiguration)9 Optional (java.util.Optional)8 URL (java.net.URL)7 OptionalInt (java.util.OptionalInt)6 Set (java.util.Set)6 JVM (org.hyperledger.besu.metrics.StandardMetricCategory.JVM)6 PROCESS (org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS)6 EVENTBUS (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS)6 LIBP2P (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P)6 NETWORK (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK)6 MetricsConfig (tech.pegasys.teku.infrastructure.metrics.MetricsConfig)5 P2PConfig (tech.pegasys.teku.networking.eth2.P2PConfig)5 DiscoveryConfig (tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig)5