diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index 97678a7d23..ea48ec8784 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -408,7 +408,7 @@ func isLeveldbNotExistError(err error) bool { func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeConfig, chainId *big.Int, cacheConfig *core.CacheConfig, persistentConfig *conf.PersistentConfig, l1Client arbutil.L1Interface, rollupAddrs chaininfo.RollupAddresses) (ethdb.Database, *core.BlockChain, error) { if !config.Init.Force { - if readOnlyDb, err := stack.OpenDatabaseWithFreezerWithExtraOptions("l2chaindata", 0, 0, "", "l2chaindata/", true, persistentConfig.Pebble.ExtraOptions("l2chaindata")); err == nil { + if readOnlyDb, err := stack.OpenDatabaseWithFreezerWithExtraOptions("l2chaindata", 0, 0, config.Persistent.Ancient, "l2chaindata/", true, persistentConfig.Pebble.ExtraOptions("l2chaindata")); err == nil { if chainConfig := gethexec.TryReadStoredChainConfig(readOnlyDb); chainConfig != nil { readOnlyDb.Close() if !arbmath.BigEquals(chainConfig.ChainID, chainId) { diff --git a/das/local_file_storage_service.go b/das/local_file_storage_service.go index 6b0a5f0070..621cf3efdb 100644 --- a/das/local_file_storage_service.go +++ b/das/local_file_storage_service.go @@ -199,7 +199,7 @@ func (s *LocalFileStorageService) Put(ctx context.Context, data []byte, expiry u } } - if !s.enableLegacyLayout && s.layout.expiryEnabled { + if !s.enableLegacyLayout { if err := createHardLink(batchPath, s.layout.expiryPath(key, expiry)); err != nil { return fmt.Errorf("couldn't create by-expiry-path index entry: %w", err) } @@ -360,11 +360,9 @@ func migrate(fl *flatLayout, tl *trieLayout) error { return err } - if tl.expiryEnabled { - expiryPath := tl.expiryPath(batch.key, uint64(batch.expiry.Unix())) - if err = createHardLink(newPath, expiryPath); err != nil { - return err - } + expiryPath := tl.expiryPath(batch.key, uint64(batch.expiry.Unix())) + if err = createHardLink(newPath, expiryPath); err != nil { + return err } migrated++ } @@ -698,10 +696,8 @@ func (l *trieLayout) startMigration() error { return err } - if l.expiryEnabled { - if err := os.MkdirAll(filepath.Join(l.root, byExpiryTimestamp+migratingSuffix), 0o700); err != nil { - return err - } + if err := os.MkdirAll(filepath.Join(l.root, byExpiryTimestamp+migratingSuffix), 0o700); err != nil { + return err } return nil @@ -726,10 +722,8 @@ func (l *trieLayout) commitMigration() error { return err } - if l.expiryEnabled { - if err := removeSuffix(byExpiryTimestamp); err != nil { - return err - } + if err := removeSuffix(byExpiryTimestamp); err != nil { + return err } syscall.Sync() diff --git a/das/local_file_storage_service_test.go b/das/local_file_storage_service_test.go index 0b2ba9749d..cc27e293e3 100644 --- a/das/local_file_storage_service_test.go +++ b/das/local_file_storage_service_test.go @@ -98,10 +98,9 @@ func TestMigrationNoExpiry(t *testing.T) { countEntries(t, &s.layout, 4) getByHashAndCheck(t, s, "a", "b", "c", "d") - _, err = s.layout.iterateBatchesByTimestamp(time.Unix(int64(now+10), 0)) - if err == nil { - Fail(t, "can't iterate by timestamp when expiry is disabled") - } + // Can still iterate by timestamp even if expiry disabled + countTimestampEntries(t, &s.layout, time.Unix(int64(now+11), 0), 4) + } func TestMigrationExpiry(t *testing.T) {