Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/kind-planes-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/data-transport-layer': patch
---

Add L1 sync shutoff block
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,19 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
(await this.state.db.getHighestSyncedL1Block()) ||
this.state.startingL1BlockNumber
const currentL1Block = await this.state.l1RpcProvider.getBlockNumber()
const targetL1Block = Math.min(
let targetL1Block = Math.min(
highestSyncedL1Block + this.options.logsPerPollingInterval,
currentL1Block - this.options.confirmations
)

// Don't sync beyond the shutoff block!
if (this.options.l1SyncShutoffBlock !== undefined) {
targetL1Block = Math.min(
targetL1Block,
this.options.l1SyncShutoffBlock
)
}

// We're already at the head, so no point in attempting to sync.
if (highestSyncedL1Block === targetL1Block) {
await sleep(this.options.pollingInterval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface L1DataTransportServiceOptions {
l2RpcProvider: string
l2RpcProviderUser?: string
l2RpcProviderPassword?: string
l1SyncShutoffBlock?: number
metrics?: Metrics
dbPath: string
logsPerPollingInterval: number
Expand Down
1 change: 1 addition & 0 deletions packages/data-transport-layer/src/services/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type ethNetwork = 'mainnet' | 'kovan' | 'goerli'
l1RpcProviderUser: config.str('l1-rpc-user'),
l1RpcProviderPassword: config.str('l1-rpc-password'),
addressManager: config.str('address-manager'),
l1SyncShutoffBlock: config.uint('l1-sync-shutoff-block'),
pollingInterval: config.uint('polling-interval', 5000),
logsPerPollingInterval: config.uint('logs-per-polling-interval', 2000),
dangerouslyCatchAllErrors: config.bool(
Expand Down