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()));
}
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);
}
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);
}
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();
}
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);
}
Aggregations