Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Unreleased Changes

### Breaking Changes
- Removed the legacy web3j-based Eth1/PoW deposit-log fetching. A node no longer requires an Eth1 JSON-RPC endpoint to run; deposits are sourced from the finalized deposit-tree snapshot and in-protocol (EIP-6110) execution requests. The following CLI options have been removed: `--eth1-endpoints` / `--eth1-endpoint`, `--eth1-deposit-contract-max-request-size`.

### Additions and Improvements
- Added ssz output for validator balances api.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,7 @@ public TekuNodeConfigBuilder withDepositsFrom(final BesuNode eth1Node) {
mustBe(NodeType.BEACON_NODE);
configMap.put("Xinterop-enabled", false);
LOG.debug("eth1-deposit-contract-address={}}", eth1Node.getDepositContractAddress().toString());
LOG.debug("eth1-endpoint={}", eth1Node.getInternalJsonRpcUrl());
configMap.put("eth1-deposit-contract-address", eth1Node.getDepositContractAddress().toString());
configMap.put("eth1-endpoint", eth1Node.getInternalJsonRpcUrl());
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,32 @@
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import tech.pegasys.teku.ethereum.execution.types.Eth1Address;
import tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException;
import tech.pegasys.teku.infrastructure.http.UrlSanitizer;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.networks.Eth2Network;

public class PowchainConfiguration {
public static final int DEFAULT_ETH1_LOGS_MAX_BLOCK_RANGE = 10_000;
public static final boolean DEFAULT_USE_MISSING_DEPOSIT_EVENT_LOGGING = false;
public static final boolean DEFAULT_DEPOSIT_SNAPSHOT_ENABLED = true;
public static final boolean DEFAULT_DEPOSIT_CONTRACT_LOGS_SYNCING_ENABLED = true;
public static final String DEPOSIT_SNAPSHOT_URL_PATH = "/eth/v1/beacon/deposit_snapshot";

private final Spec spec;
private final List<String> eth1Endpoints;
private final Eth1Address depositContract;
private final Optional<UInt64> depositContractDeployBlock;
private final DepositTreeSnapshotConfiguration depositTreeSnapshotConfiguration;
private final int eth1LogsMaxBlockRange;
private final boolean useMissingDepositEventLogging;
private final boolean depositContractLogsSyncingEnabled;

private PowchainConfiguration(
final Spec spec,
final List<String> eth1Endpoints,
final Eth1Address depositContract,
final Optional<UInt64> depositContractDeployBlock,
final DepositTreeSnapshotConfiguration depositTreeSnapshotConfiguration,
final int eth1LogsMaxBlockRange,
final boolean useMissingDepositEventLogging,
final boolean depositContractLogsSyncingEnabled) {
final DepositTreeSnapshotConfiguration depositTreeSnapshotConfiguration) {
this.spec = spec;
this.eth1Endpoints = eth1Endpoints;
this.depositContract = depositContract;
this.depositContractDeployBlock = depositContractDeployBlock;
this.depositTreeSnapshotConfiguration = depositTreeSnapshotConfiguration;
this.eth1LogsMaxBlockRange = eth1LogsMaxBlockRange;
this.useMissingDepositEventLogging = useMissingDepositEventLogging;
this.depositContractLogsSyncingEnabled = depositContractLogsSyncingEnabled;
}

public static Builder builder() {
Expand Down Expand Up @@ -90,18 +77,6 @@ public DepositTreeSnapshotConfiguration getDepositTreeSnapshotConfiguration() {
return depositTreeSnapshotConfiguration;
}

public int getEth1LogsMaxBlockRange() {
return eth1LogsMaxBlockRange;
}

public boolean useMissingDepositEventLogging() {
return useMissingDepositEventLogging;
}

public boolean isDepositContractLogsSyncingEnabled() {
return depositContractLogsSyncingEnabled;
}

public static class Builder {
private Spec spec;
private List<String> eth1Endpoints = new ArrayList<>();
Expand All @@ -110,11 +85,7 @@ public static class Builder {
private Optional<String> customDepositSnapshotPath = Optional.empty();
private Optional<String> checkpointSyncDepositSnapshotUrl = Optional.empty();
private Optional<String> bundledDepositSnapshotPath = Optional.empty();
private int eth1LogsMaxBlockRange = DEFAULT_ETH1_LOGS_MAX_BLOCK_RANGE;
private boolean useMissingDepositEventLogging = DEFAULT_USE_MISSING_DEPOSIT_EVENT_LOGGING;
private boolean depositSnapshotEnabled = DEFAULT_DEPOSIT_SNAPSHOT_ENABLED;
private boolean depositContractLogsSyncingEnabled =
DEFAULT_DEPOSIT_CONTRACT_LOGS_SYNCING_ENABLED;

private Builder() {}

Expand All @@ -133,10 +104,7 @@ public PowchainConfiguration build() {
customDepositSnapshotPath,
checkpointSyncDepositSnapshotUrl,
bundledDepositSnapshotPath,
isBundledSnapshotEnabled),
eth1LogsMaxBlockRange,
useMissingDepositEventLogging,
depositContractLogsSyncingEnabled);
isBundledSnapshotEnabled));
}

private void validate() {
Expand Down Expand Up @@ -222,29 +190,9 @@ public Builder depositSnapshotEnabled(final boolean depositSnapshotEnabled) {
return this;
}

public Builder depositContractLogsSyncingEnabled(
final boolean depositContractLogsSyncingEnabled) {
this.depositContractLogsSyncingEnabled = depositContractLogsSyncingEnabled;
return this;
}

public Builder eth1LogsMaxBlockRange(final int eth1LogsMaxBlockRange) {
if (eth1LogsMaxBlockRange < 0) {
throw new InvalidConfigurationException(
String.format("Invalid eth1LogsMaxBlockRange: %d", eth1LogsMaxBlockRange));
}
this.eth1LogsMaxBlockRange = eth1LogsMaxBlockRange;
return this;
}

public Builder specProvider(final Spec spec) {
this.spec = spec;
return this;
}

public Builder useMissingDepositEventLogging(final boolean useMissingDepositEventLogging) {
this.useMissingDepositEventLogging = useMissingDepositEventLogging;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

package tech.pegasys.teku.cli.options;

import java.util.ArrayList;
import java.util.List;
import picocli.CommandLine;
import picocli.CommandLine.Help.Visibility;
import picocli.CommandLine.Option;
Expand All @@ -23,33 +21,6 @@

public class DepositOptions {

@Option(
names = {"--eth1-endpoints", "--eth1-endpoint"},
paramLabel = "<NETWORK>",
description = "URLs for Eth1 nodes.",
split = ",",
arity = "1..*")
private List<String> eth1Endpoints = new ArrayList<>();

@Option(
names = {"--eth1-deposit-contract-max-request-size"},
paramLabel = "<INTEGER>",
description =
"Maximum number of blocks to request deposit contract event logs for in a single request.",
arity = "1")
private int eth1LogsMaxBlockRange = PowchainConfiguration.DEFAULT_ETH1_LOGS_MAX_BLOCK_RANGE;

@Option(
names = {"--Xeth1-missing-deposits-event-logging-enabled"},
paramLabel = "<BOOLEAN>",
description = "Enable logging an event on each slot whenever deposits are missing",
hidden = true,
showDefaultValue = Visibility.ALWAYS,
arity = "0..1",
fallbackValue = "true")
private boolean useMissingDepositEventLogging =
PowchainConfiguration.DEFAULT_USE_MISSING_DEPOSIT_EVENT_LOGGING;

@CommandLine.Option(
names = {"--Xdeposit-snapshot"},
paramLabel = "<STRING>",
Expand All @@ -68,27 +39,11 @@ public class DepositOptions {
fallbackValue = "true")
private boolean depositSnapshotEnabled = PowchainConfiguration.DEFAULT_DEPOSIT_SNAPSHOT_ENABLED;

@Option(
names = {"--Xdeposit-contract-logs-syncing-enabled"},
paramLabel = "<BOOLEAN>",
description =
"Enable syncing of deposit contract logs from the Execution Engine node. This is required for block production.",
hidden = true,
showDefaultValue = Visibility.ALWAYS,
arity = "0..1",
fallbackValue = "true")
private boolean depositContractLogsSyncingEnabled =
PowchainConfiguration.DEFAULT_DEPOSIT_CONTRACT_LOGS_SYNCING_ENABLED;

public void configure(final TekuConfiguration.Builder builder) {
builder.powchain(
b -> {
b.eth1Endpoints(eth1Endpoints);
b.eth1LogsMaxBlockRange(eth1LogsMaxBlockRange);
b.useMissingDepositEventLogging(useMissingDepositEventLogging);
b.customDepositSnapshotPath(depositSnapshotPath);
b.depositSnapshotEnabled(depositSnapshotEnabled);
b.depositContractLogsSyncingEnabled(depositContractLogsSyncingEnabled);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ private String[] createCliArgs() {
"true",
"--eth1-deposit-contract-address",
"0x77f7bED277449F51505a4C54550B074030d989bC",
"--eth1-endpoint",
"http://localhost:8545",
"--ee-endpoint",
"http://localhost:8550",
"--metrics-enabled",
Expand Down Expand Up @@ -615,8 +613,7 @@ private TekuConfiguration.Builder expectedDefaultConfigurationBuilder() {
.powchain(
b -> {
b.depositContract(networkConfig.getEth1DepositContractAddress());
b.eth1Endpoints(new ArrayList<>())
.depositContractDeployBlock(networkConfig.getEth1DepositContractDeployBlock());
b.depositContractDeployBlock(networkConfig.getEth1DepositContractDeployBlock());
})
.storageConfiguration(
b ->
Expand Down Expand Up @@ -651,11 +648,7 @@ private TekuConfiguration.Builder expectedConfigurationBuilder() {
return TekuConfiguration.builder()
.eth2NetworkConfig(b -> b.applyMinimalNetworkDefaults().eth1DepositContractAddress(address))
.executionLayer(b -> b.engineEndpoint("http://localhost:8550"))
.powchain(
b ->
b.eth1Endpoints(List.of("http://localhost:8545"))
.depositContract(address)
.eth1LogsMaxBlockRange(10_000))
.powchain(b -> b.depositContract(address))
.store(b -> b.hotStatePersistenceFrequencyInEpochs(2))
.storageConfiguration(
b ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,70 +28,6 @@

public class DepositOptionsTest extends AbstractBeaconNodeCommandTest {

@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/");
}

@Test
public void shouldReportEth1EnabledIfEndpointSpecified() {
final String[] args = {"--eth1-endpoint", "http://example.com:1234/path/"};
final TekuConfiguration config = getTekuConfigurationFromArguments(args);
assertThat(config.powchain().isEnabled()).isTrue();
}

@Test
public void shouldReportEth1DisabledIfEndpointNotSpecified() {
final TekuConfiguration config = getTekuConfigurationFromArguments();
assertThat(config.powchain().isEnabled()).isFalse();
}

@Test
public void shouldReportEth1DisabledIfEndpointIsEmpty() {
final String[] args = {"--eth1-endpoint", " "};
final TekuConfiguration config = getTekuConfigurationFromArguments(args);
assertThat(config.powchain().isEnabled()).isFalse();
}

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

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

@ParameterizedTest(name = "{0}")
@ValueSource(strings = {"mainnet", "holesky", "gnosis", "sepolia"})
public void shouldSetDefaultBundleSnapshotPathForSupportedNetwork(final String network) {
Expand Down Expand Up @@ -183,11 +119,4 @@ public void shouldSetCheckpointSyncDepositSnapshotUrlWhenUsingCheckpointSyncUrl(
assertThat(depositTreeSnapshotConfiguration.getCustomDepositSnapshotPath())
.hasValue("/foo/bar");
}

@Test
public void shouldHaveDepositContractLogsSyncingEnabledByDefault() {
final String[] args = {};
final TekuConfiguration config = getTekuConfigurationFromArguments(args);
assertThat(config.powchain().isDepositContractLogsSyncingEnabled()).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Xinterop-enabled: True

# deposit
eth1-deposit-contract-address: "0x77f7bED277449F51505a4C54550B074030d989bC"
eth1-endpoint: "http://localhost:8545"

# validator
network: "mainnet"
Expand Down
2 changes: 0 additions & 2 deletions teku/src/test/resources/complete_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Xinterop-enabled: True

# deposit
eth1-deposit-contract-address: "0x77f7bED277449F51505a4C54550B074030d989bC"
eth1-endpoint: "http://localhost:8545"
#Xeth1-deposits-from-storage-enabled: true

# execution engine
ee-endpoint: "http://localhost:8550"
Expand Down
2 changes: 0 additions & 2 deletions teku/src/test/resources/depositOptions_config.yaml

This file was deleted.

Loading