From 186fbb22f340e569ca0877404d77d380d0b68056 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Thu, 24 Oct 2024 11:57:34 +1000 Subject: [PATCH 1/2] cleanup EphemeryNetwork and add max slot constant fixes #8777 Signed-off-by: Paul Harris --- .../teku/networks/EphemeryNetwork.java | 34 ++++++++----------- .../teku/networks/EphemeryNetworkTest.java | 15 ++++++++ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ethereum/networks/src/main/java/tech/pegasys/teku/networks/EphemeryNetwork.java b/ethereum/networks/src/main/java/tech/pegasys/teku/networks/EphemeryNetwork.java index 6a77fe8d4e3..fbc8f35635d 100644 --- a/ethereum/networks/src/main/java/tech/pegasys/teku/networks/EphemeryNetwork.java +++ b/ethereum/networks/src/main/java/tech/pegasys/teku/networks/EphemeryNetwork.java @@ -21,17 +21,17 @@ import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.config.SpecConfigLoader; import tech.pegasys.teku.spec.config.builder.SpecConfigBuilder; -import tech.pegasys.teku.spec.networks.Eth2Network; public class EphemeryNetwork { private static final long GENESIS_CHAINID = 39438135; - private static final long GENESIS_TIMESTAMP = 1720119600; + private static final long INITIAL_GENESIS_TIMESTAMP = 1720119600; private static final int PERIOD = 28; private static final long PERIOD_IN_SECONDS = (PERIOD * 24 * 60 * 60); + public static final long MAX_EPHEMERY_SLOT = (PERIOD_IN_SECONDS / 12) - 1; static long getPeriodsSinceGenesis(final TimeProvider timeProvider) { return ChronoUnit.DAYS.between( - Instant.ofEpochSecond(GENESIS_TIMESTAMP), + Instant.ofEpochSecond(INITIAL_GENESIS_TIMESTAMP), Instant.ofEpochMilli(timeProvider.getTimeInMillis().longValue())) / PERIOD; } @@ -43,23 +43,19 @@ public static void updateConfig(final SpecConfigBuilder builder) { static void updateConfig(final SpecConfigBuilder builder, final TimeProvider timeProvider) { final SpecConfig config = SpecConfigLoader.loadConfig("ephemery"); final SpecConfigBuilder rawConfigBuilder = builder.rawConfig(config.getRawConfig()); - - if (Eth2Network.EPHEMERY.configName().equals("ephemery")) { - final long currentTimestamp = timeProvider.getTimeInMillis().longValue() / 1000; - - final long updatedTimestamp = - GENESIS_TIMESTAMP + (getPeriodsSinceGenesis(timeProvider) * PERIOD_IN_SECONDS); - final long updatedChainId = GENESIS_CHAINID + getPeriodsSinceGenesis(timeProvider); - - try { - if (currentTimestamp > (GENESIS_TIMESTAMP + PERIOD_IN_SECONDS)) { - rawConfigBuilder.depositNetworkId(updatedChainId); - rawConfigBuilder.depositChainId(updatedChainId); - rawConfigBuilder.minGenesisTime(UInt64.valueOf(updatedTimestamp)); - } - } catch (RuntimeException e) { - throw new RuntimeException("Error updating genesis file: " + e.getMessage(), e); + final long periodsSinceInitialGenesis = getPeriodsSinceGenesis(timeProvider); + + try { + if (periodsSinceInitialGenesis > 0L) { + final long updatedChainId = GENESIS_CHAINID + periodsSinceInitialGenesis; + final long currentPeriodGenesis = + INITIAL_GENESIS_TIMESTAMP + (periodsSinceInitialGenesis * PERIOD_IN_SECONDS); + rawConfigBuilder.depositNetworkId(updatedChainId); + rawConfigBuilder.depositChainId(updatedChainId); + rawConfigBuilder.minGenesisTime(UInt64.valueOf(currentPeriodGenesis)); } + } catch (RuntimeException e) { + throw new RuntimeException("Error updating genesis file: " + e.getMessage(), e); } } } diff --git a/ethereum/networks/src/test/java/tech/pegasys/teku/networks/EphemeryNetworkTest.java b/ethereum/networks/src/test/java/tech/pegasys/teku/networks/EphemeryNetworkTest.java index ae0086b4649..adfcdd74575 100644 --- a/ethereum/networks/src/test/java/tech/pegasys/teku/networks/EphemeryNetworkTest.java +++ b/ethereum/networks/src/test/java/tech/pegasys/teku/networks/EphemeryNetworkTest.java @@ -34,6 +34,7 @@ import tech.pegasys.teku.spec.config.SpecConfigLoader; import tech.pegasys.teku.spec.config.SpecConfigReader; import tech.pegasys.teku.spec.config.builder.SpecConfigBuilder; +import tech.pegasys.teku.spec.logic.common.helpers.MiscHelpers; public class EphemeryNetworkTest { private static final long GENESIS_CHAINID = 39438135; @@ -187,6 +188,20 @@ public void shouldUpdateConfigForManyPeriods() { .isGreaterThan(genesisChainIdAfter1000Period + PERIOD_IN_SECONDS); } + @Test + void checkEphemeryMaxSlot() { + final Spec spec = + getSpec(phase0Builder -> phase0Builder.minGenesisTime(UInt64.valueOf(MIN_GENESIS_TIME))); + final long timeBeforeNextPeriod = MIN_GENESIS_TIME + PERIOD_IN_SECONDS - 1; + final MiscHelpers miscHelpers = new MiscHelpers(spec.getGenesisSpecConfig()); + assertThat( + miscHelpers + .computeSlotAtTime( + UInt64.valueOf(MIN_GENESIS_TIME), UInt64.valueOf(timeBeforeNextPeriod)) + .longValue()) + .isEqualTo(EphemeryNetwork.MAX_EPHEMERY_SLOT); + } + @Test void shouldNotUpdateConfigBeforeNextPeriod() { final Spec spec = From c615473b25469399ebfcfaab36a3e5ea102681d2 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Thu, 24 Oct 2024 16:17:33 +1000 Subject: [PATCH 2/2] Cleanup ephemery determination on startup so that it's linked explicitly to ephemery network Previously we were using a combination of a contract id and the chain id changing, but this improves the situation by explicitly considering the ephemery network. Signed-off-by: Paul Harris --- .../services/chainstorage/StorageService.java | 9 +++++-- .../chainstorage/StorageServiceTest.java | 3 ++- .../server/VersionedDatabaseFactory.java | 21 +++++++++++---- .../server/network/DatabaseNetwork.java | 12 ++++----- .../server/VersionedDatabaseFactoryTest.java | 16 ++++++++---- .../server/network/DatabaseNetworkTest.java | 26 ++++++++++++++----- .../admin/WeakSubjectivityCommand.java | 4 ++- .../cli/subcommand/debug/DebugDbCommand.java | 3 ++- .../teku/cli/util/DatabaseMigrater.java | 4 ++- .../services/BeaconNodeServiceController.java | 3 ++- 10 files changed, 71 insertions(+), 30 deletions(-) diff --git a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java index 53f43bdc332..7f7648b5c14 100644 --- a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java +++ b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java @@ -33,6 +33,7 @@ import tech.pegasys.teku.service.serviceutils.Service; import tech.pegasys.teku.service.serviceutils.ServiceConfig; import tech.pegasys.teku.spec.SpecMilestone; +import tech.pegasys.teku.spec.networks.Eth2Network; import tech.pegasys.teku.storage.api.CombinedStorageChannel; import tech.pegasys.teku.storage.api.Eth1DepositStorageChannel; import tech.pegasys.teku.storage.api.VoteUpdateChannel; @@ -66,16 +67,19 @@ public class StorageService extends Service implements StorageServiceFacade { private final boolean depositSnapshotStorageEnabled; private final boolean blobSidecarsStorageCountersEnabled; private static final Logger LOG = LogManager.getLogger(); + private final Optional maybeNetwork; public StorageService( final ServiceConfig serviceConfig, final StorageConfiguration storageConfiguration, final boolean depositSnapshotStorageEnabled, - final boolean blobSidecarsStorageCountersEnabled) { + final boolean blobSidecarsStorageCountersEnabled, + final Optional eth2Network) { this.serviceConfig = serviceConfig; this.config = storageConfiguration; this.depositSnapshotStorageEnabled = depositSnapshotStorageEnabled; this.blobSidecarsStorageCountersEnabled = blobSidecarsStorageCountersEnabled; + this.maybeNetwork = eth2Network; } @Override @@ -92,7 +96,8 @@ protected SafeFuture doStart() { new VersionedDatabaseFactory( serviceConfig.getMetricsSystem(), serviceConfig.getDataDirLayout().getBeaconDataDirectory(), - config); + config, + maybeNetwork); try { database = dbFactory.createDatabase(); } catch (EphemeryException e) { diff --git a/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java index 87176ec3319..e51cb1a6f3b 100644 --- a/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java +++ b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java @@ -80,7 +80,8 @@ void setUp(@TempDir final Path tempDir) { when(serviceConfig.createAsyncRunner(any(), anyInt(), anyInt(), anyInt())) .thenReturn(stubAsyncRunner); - storageService = new StorageService(serviceConfig, storageConfiguration, false, false); + storageService = + new StorageService(serviceConfig, storageConfiguration, false, false, Optional.empty()); } @Test diff --git a/storage/src/main/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactory.java b/storage/src/main/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactory.java index a722e51b323..f9c6daddd05 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactory.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactory.java @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; +import java.util.Optional; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.tuweni.bytes.Bytes; @@ -27,6 +28,7 @@ import tech.pegasys.teku.ethereum.execution.types.Eth1Address; import tech.pegasys.teku.infrastructure.io.SyncDataAccessor; import tech.pegasys.teku.spec.Spec; +import tech.pegasys.teku.spec.networks.Eth2Network; import tech.pegasys.teku.storage.server.kvstore.KvStoreConfiguration; import tech.pegasys.teku.storage.server.kvstore.schema.V6SchemaCombinedSnapshot; import tech.pegasys.teku.storage.server.leveldb.LevelDbDatabaseFactory; @@ -60,12 +62,17 @@ public class VersionedDatabaseFactory implements DatabaseFactory { private final Spec spec; private final boolean storeNonCanonicalBlocks; private final SyncDataAccessor dbSettingFileSyncDataAccessor; + private final Optional maybeNetwork; public VersionedDatabaseFactory( - final MetricsSystem metricsSystem, final Path dataPath, final StorageConfiguration config) { + final MetricsSystem metricsSystem, + final Path dataPath, + final StorageConfiguration config, + final Optional maybeNetwork) { this.metricsSystem = metricsSystem; this.dataDirectory = dataPath.toFile(); + this.maybeNetwork = maybeNetwork; this.createDatabaseVersion = config.getDataStorageCreateDbVersion(); this.maxKnownNodeCacheSize = config.getMaxKnownNodeCacheSize(); @@ -168,7 +175,8 @@ private Database createV4Database() { getNetworkFile(), spec.getGenesisSpecConfig().getGenesisForkVersion(), eth1Address, - spec.getGenesisSpecConfig().getDepositChainId()); + spec.getGenesisSpecConfig().getDepositChainId(), + maybeNetwork); return RocksDbDatabaseFactory.createV4( metricsSystem, KvStoreConfiguration.v4Settings(dbDirectory.toPath()), @@ -195,7 +203,8 @@ private Database createV5Database() { getNetworkFile(), spec.getGenesisSpecConfig().getGenesisForkVersion(), eth1Address, - spec.getGenesisSpecConfig().getDepositChainId()); + spec.getGenesisSpecConfig().getDepositChainId(), + maybeNetwork); return RocksDbDatabaseFactory.createV4( metricsSystem, metaData.getHotDbConfiguration().withDatabaseDir(dbDirectory.toPath()), @@ -241,7 +250,8 @@ private Database createLevelDbV1Database() { getNetworkFile(), spec.getGenesisSpecConfig().getGenesisForkVersion(), eth1Address, - spec.getGenesisSpecConfig().getDepositChainId()); + spec.getGenesisSpecConfig().getDepositChainId(), + maybeNetwork); return LevelDbDatabaseFactory.createLevelDb( metricsSystem, metaData.getHotDbConfiguration().withDatabaseDir(dbDirectory.toPath()), @@ -295,7 +305,8 @@ private KvStoreConfiguration initV6Configuration() throws IOException { getNetworkFile(), spec.getGenesisSpecConfig().getGenesisForkVersion(), eth1Address, - spec.getGenesisSpecConfig().getDepositChainId()); + spec.getGenesisSpecConfig().getDepositChainId(), + maybeNetwork); return metaData.getSingleDbConfiguration().getConfiguration(); } diff --git a/storage/src/main/java/tech/pegasys/teku/storage/server/network/DatabaseNetwork.java b/storage/src/main/java/tech/pegasys/teku/storage/server/network/DatabaseNetwork.java index c4aa809d782..4f87e6d0001 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/server/network/DatabaseNetwork.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/server/network/DatabaseNetwork.java @@ -26,8 +26,10 @@ import java.io.IOException; import java.util.Locale; import java.util.Objects; +import java.util.Optional; import tech.pegasys.teku.ethereum.execution.types.Eth1Address; import tech.pegasys.teku.infrastructure.bytes.Bytes4; +import tech.pegasys.teku.spec.networks.Eth2Network; import tech.pegasys.teku.storage.server.DatabaseStorageException; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -45,9 +47,6 @@ public class DatabaseNetwork { @VisibleForTesting final Long depositChainId; - private static final String EPHEMERY_DEPOSIT_CONTRACT_ADDRESS = - "0x4242424242424242424242424242424242424242"; - @JsonCreator DatabaseNetwork( @JsonProperty(value = "fork_version") final String forkVersion, @@ -67,7 +66,8 @@ public static DatabaseNetwork init( final File source, final Bytes4 forkVersion, final Eth1Address depositContract, - final Long depositChainId) + final Long depositChainId, + final Optional maybeNetwork) throws IOException { final String forkVersionString = forkVersion.toHexString().toLowerCase(Locale.ROOT); final String depositContractString = depositContract.toHexString().toLowerCase(Locale.ROOT); @@ -88,7 +88,7 @@ public static DatabaseNetwork init( "deposit contract", depositContractString, databaseNetwork.depositContract)); } if (databaseNetwork.depositChainId != null - && !depositContractString.equals(EPHEMERY_DEPOSIT_CONTRACT_ADDRESS) + && maybeNetwork.map(n -> !n.equals(Eth2Network.EPHEMERY)).orElse(true) && !databaseNetwork.depositChainId.equals(depositChainId)) { throw DatabaseStorageException.unrecoverable( formatMessage( @@ -97,7 +97,7 @@ public static DatabaseNetwork init( String.valueOf(databaseNetwork.depositChainId))); } if (databaseNetwork.depositChainId != null - && depositContractString.equals(EPHEMERY_DEPOSIT_CONTRACT_ADDRESS) + && maybeNetwork.map(n -> n.equals(Eth2Network.EPHEMERY)).orElse(false) && !databaseNetwork.depositChainId.equals(depositChainId)) { throw new EphemeryException(); } diff --git a/storage/src/test/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactoryTest.java b/storage/src/test/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactoryTest.java index fd256b787b8..991c77334db 100644 --- a/storage/src/test/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactoryTest.java +++ b/storage/src/test/java/tech/pegasys/teku/storage/server/VersionedDatabaseFactoryTest.java @@ -22,6 +22,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Optional; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -50,7 +51,8 @@ public void createDatabase_fromEmptyDataDir() throws Exception { StorageConfiguration.builder() .specProvider(spec) .eth1DepositContract(eth1Address) - .build()); + .build(), + Optional.empty()); try (final Database db = dbFactory.createDatabase()) { assertThat(db).isNotNull(); @@ -76,7 +78,8 @@ public void createDatabase_fromExistingDataDir() throws Exception { StorageConfiguration.builder() .specProvider(spec) .eth1DepositContract(eth1Address) - .build()); + .build(), + Optional.empty()); try (final Database db = dbFactory.createDatabase()) { assertThat(db).isNotNull(); @@ -97,7 +100,8 @@ public void createDatabase_invalidVersionFile() throws Exception { StorageConfiguration.builder() .specProvider(spec) .eth1DepositContract(eth1Address) - .build()); + .build(), + Optional.empty()); assertThatThrownBy(dbFactory::createDatabase) .isInstanceOf(DatabaseStorageException.class) @@ -115,7 +119,8 @@ public void createDatabase_dbExistsButNoVersionIsSaved() { StorageConfiguration.builder() .specProvider(spec) .eth1DepositContract(eth1Address) - .build()); + .build(), + Optional.empty()); assertThatThrownBy(dbFactory::createDatabase) .isInstanceOf(DatabaseStorageException.class) @@ -135,7 +140,8 @@ public void createDatabase_shouldAllowAllSupportedDatabases(final DatabaseVersio .eth1DepositContract(eth1Address) .dataStorageMode(DATA_STORAGE_MODE) .dataStorageCreateDbVersion(version) - .build()); + .build(), + Optional.empty()); assertThat(dbFactory.getDatabaseVersion()).isEqualTo(version); } diff --git a/storage/src/test/java/tech/pegasys/teku/storage/server/network/DatabaseNetworkTest.java b/storage/src/test/java/tech/pegasys/teku/storage/server/network/DatabaseNetworkTest.java index e52f529df75..e37e7dcc8c5 100644 --- a/storage/src/test/java/tech/pegasys/teku/storage/server/network/DatabaseNetworkTest.java +++ b/storage/src/test/java/tech/pegasys/teku/storage/server/network/DatabaseNetworkTest.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.nio.file.Files; import java.util.Locale; +import java.util.Optional; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -53,7 +54,8 @@ public void shouldCreateNetworkFile(@TempDir final File tempDir) throws IOExcept final Bytes4 fork = dataStructureUtil.randomFork().getCurrentVersion(); final Eth1Address eth1Address = dataStructureUtil.randomEth1Address(); final Long depositChainId = dataStructureUtil.randomLong(); - assertThat(DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId)) + assertThat( + DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId, Optional.empty())) .isEqualTo( new DatabaseNetwork( fork.toHexString().toLowerCase(Locale.ROOT), @@ -73,9 +75,13 @@ public void shouldThrowIfForkDiffers(@TempDir final File tempDir) throws IOExcep networkFile, dataStructureUtil.randomFork().getCurrentVersion(), eth1Address, - depositChainId); + depositChainId, + Optional.empty()); - assertThatThrownBy(() -> DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId)) + assertThatThrownBy( + () -> + DatabaseNetwork.init( + networkFile, fork, eth1Address, depositChainId, Optional.empty())) .isInstanceOf(DatabaseStorageException.class) .hasMessageStartingWith("Supplied fork version"); } @@ -88,9 +94,13 @@ public void shouldThrowIfDepositContractDiffers(@TempDir final File tempDir) thr final Eth1Address eth1Address = dataStructureUtil.randomEth1Address(); final Long depositChainId = dataStructureUtil.randomLong(); - DatabaseNetwork.init(networkFile, fork, dataStructureUtil.randomEth1Address(), depositChainId); + DatabaseNetwork.init( + networkFile, fork, dataStructureUtil.randomEth1Address(), depositChainId, Optional.empty()); - assertThatThrownBy(() -> DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId)) + assertThatThrownBy( + () -> + DatabaseNetwork.init( + networkFile, fork, eth1Address, depositChainId, Optional.empty())) .isInstanceOf(DatabaseStorageException.class) .hasMessageStartingWith("Supplied deposit contract"); } @@ -103,9 +113,11 @@ public void shouldNotThrowIfForkAndContractMatch(@TempDir final File tempDir) th final Eth1Address eth1Address = dataStructureUtil.randomEth1Address(); final Long depositChainId = dataStructureUtil.randomLong(); - DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId); + DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId, Optional.empty()); - assertDoesNotThrow(() -> DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId)); + assertDoesNotThrow( + () -> + DatabaseNetwork.init(networkFile, fork, eth1Address, depositChainId, Optional.empty())); } @Test diff --git a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/admin/WeakSubjectivityCommand.java b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/admin/WeakSubjectivityCommand.java index feb35863445..2623e890b89 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/admin/WeakSubjectivityCommand.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/admin/WeakSubjectivityCommand.java @@ -15,6 +15,7 @@ import static tech.pegasys.teku.infrastructure.logging.SubCommandLogger.SUB_COMMAND_LOG; +import java.util.Optional; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; import picocli.CommandLine; import tech.pegasys.teku.cli.converter.PicoCliVersionProvider; @@ -115,7 +116,8 @@ private Database createDatabase( StorageConfiguration.builder() .eth1DepositContract(networkConfiguration.getEth1DepositContractAddress()) .specProvider(spec) - .build()); + .build(), + Optional.empty()); return databaseFactory.createDatabase(); } diff --git a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java index 0c5a0e5e39e..3ea49fccd24 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/DebugDbCommand.java @@ -880,7 +880,8 @@ private Database createDatabase( StorageConfiguration.builder() .eth1DepositContract(networkConfiguration.getEth1DepositContractAddress()) .specProvider(spec) - .build()); + .build(), + Optional.empty()); return databaseFactory.createDatabase(); } diff --git a/teku/src/main/java/tech/pegasys/teku/cli/util/DatabaseMigrater.java b/teku/src/main/java/tech/pegasys/teku/cli/util/DatabaseMigrater.java index 476af0f2ae1..e41c8fd9892 100644 --- a/teku/src/main/java/tech/pegasys/teku/cli/util/DatabaseMigrater.java +++ b/teku/src/main/java/tech/pegasys/teku/cli/util/DatabaseMigrater.java @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Optional; import java.util.function.Consumer; import org.apache.commons.io.FileUtils; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -189,7 +190,8 @@ KvStoreDatabase createDatabase(final Path databasePath, final DatabaseVersion da .storeNonCanonicalBlocks(true) .eth1DepositContract(config.getEth1DepositContractAddress()) .dataStorageCreateDbVersion(databaseVersion) - .build()); + .build(), + Optional.empty()); final Database database = databaseFactory.createDatabase(); if (!(database instanceof KvStoreDatabase)) { throw new DatabaseMigraterError( diff --git a/teku/src/main/java/tech/pegasys/teku/services/BeaconNodeServiceController.java b/teku/src/main/java/tech/pegasys/teku/services/BeaconNodeServiceController.java index 7315a7cb4ea..5f128bbf74b 100644 --- a/teku/src/main/java/tech/pegasys/teku/services/BeaconNodeServiceController.java +++ b/teku/src/main/java/tech/pegasys/teku/services/BeaconNodeServiceController.java @@ -47,7 +47,8 @@ public BeaconNodeServiceController( .powchain() .getDepositTreeSnapshotConfiguration() .isBundledDepositSnapshotEnabled(), - tekuConfig.metricsConfig().isBlobSidecarsStorageCountersEnabled())); + tekuConfig.metricsConfig().isBlobSidecarsStorageCountersEnabled(), + tekuConfig.beaconChain().eth2NetworkConfig().getEth2Network())); Optional maybeExecutionWeb3jClientProvider = Optional.empty(); if (tekuConfig.executionLayer().isEnabled()) { // Need to make sure the execution engine is listening before starting the beacon chain