diff --git a/op-chain-ops/cmd/celo-migrate/ancients.go b/op-chain-ops/cmd/celo-migrate/ancients.go index 5f2ea2717874..926f58a98e2f 100644 --- a/op-chain-ops/cmd/celo-migrate/ancients.go +++ b/op-chain-ops/cmd/celo-migrate/ancients.go @@ -66,7 +66,7 @@ func migrateAncientsDb(oldDBPath, newDBPath string, batchSize, bufferSize uint64 return numAncientsNewBefore, numAncientsNewBefore, nil } - log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize) + log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld-1, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize) g, ctx := errgroup.WithContext(context.Background()) readChan := make(chan RLPBlockRange, bufferSize) diff --git a/op-chain-ops/cmd/celo-migrate/non-ancients.go b/op-chain-ops/cmd/celo-migrate/non-ancients.go index 2d2c1726ac18..0183f9059d5a 100644 --- a/op-chain-ops/cmd/celo-migrate/non-ancients.go +++ b/op-chain-ops/cmd/celo-migrate/non-ancients.go @@ -51,8 +51,9 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui // get the last block number hash := rawdb.ReadHeadHeaderHash(newDB) lastBlock := *rawdb.ReadHeaderNumber(newDB, hash) + lastAncient := numAncients - 1 - log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-numAncients, "lastAncientBlock", numAncients) + log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-lastAncient, "lastAncientBlock", lastAncient) for i := numAncients; i <= lastBlock; i += batchSize { numbersHash := rawdb.ReadAllHashesInRange(newDB, i, i+batchSize-1) @@ -88,8 +89,8 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui } } - if numAncients > 0 { - toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, numAncients) + if lastAncient > 0 { + toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, lastAncient) log.Info("Removing frozen blocks", "process", "non-ancients", "count", len(toBeRemoved)) batch := newDB.NewBatch() for _, numberHash := range toBeRemoved {