Commit 3659b731 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

Merge pull request #2238 from ethereum-optimism/sc/dtl-bss-hf-1-hardcode

feat(dtl): hardcode bss hf1 index into the dtl
parents 6bb6a1d6 baece507
---
'@eth-optimism/data-transport-layer': patch
---
Hardcodes BSS HF1 block into the DTL
......@@ -9,7 +9,6 @@ DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL=2000
DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS=true
DATA_TRANSPORT_LAYER__SERVER_HOSTNAME=0.0.0.0
DATA_TRANSPORT_LAYER__L1_START_HEIGHT=1
DATA_TRANSPORT_LAYER__BSS_HARDFORK_1_INDEX=0
DATA_TRANSPORT_LAYER__ADDRESS_MANAGER=
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=
......
export const BSS_HF1_INDEX = {
10: 2824317,
}
export * from './chain-constants'
export * from './patch-contexts'
......@@ -4,7 +4,7 @@ import { BigNumber } from 'ethers'
/* Imports: Internal */
import { SimpleDB } from './simple-db'
import { PATCH_CONTEXTS } from './patch-contexts'
import { PATCH_CONTEXTS, BSS_HF1_INDEX } from '../config'
import {
EnqueueEntry,
StateRootBatchEntry,
......@@ -34,7 +34,6 @@ interface Indexed {
interface ExtraTransportDBOptions {
l2ChainId?: number
bssHardfork1Index?: number
}
export class TransportDB {
......@@ -302,10 +301,10 @@ export class TransportDB {
}
let timestamp = enqueue.timestamp
if (
typeof this.opts.bssHardfork1Index === 'number' &&
transaction.index >= this.opts.bssHardfork1Index
) {
// BSS HF1 activates at block 0 if not specified.
const bssHf1Index = BSS_HF1_INDEX[this.opts.l2ChainId] || 0
if (transaction.index >= bssHf1Index) {
timestamp = transaction.timestamp
}
......
......@@ -108,7 +108,6 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
protected async _init(): Promise<void> {
this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
})
......
......@@ -86,7 +86,6 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
this.l2IngestionMetrics = registerMetrics(this.metrics)
this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
})
......
......@@ -9,6 +9,7 @@ import { L1IngestionService } from '../l1-ingestion/service'
import { L1TransportServer } from '../server/service'
import { validators } from '../../utils'
import { L2IngestionService } from '../l2-ingestion/service'
import { BSS_HF1_INDEX } from '../../config'
export interface L1DataTransportServiceOptions {
nodeEnv: string
......@@ -36,7 +37,6 @@ export interface L1DataTransportServiceOptions {
defaultBackend: string
l1GasPriceBackend: string
l1StartHeight?: number
bssHardfork1Index?: number
}
const optionSettings = {
......@@ -68,15 +68,14 @@ export class L1DataTransportService extends BaseService<L1DataTransportServiceOp
protected async _init(): Promise<void> {
this.logger.info('Initializing L1 Data Transport Service...')
if (this.options.bssHardfork1Index !== null && this.options.bssHardfork1Index !== undefined) {
this.logger.info(`BSS HF1 is active at block: ${this.options.bssHardfork1Index}`)
} else {
this.logger.info(`BSS HF1 is not active`)
}
this.state.db = level(this.options.dbPath)
await this.state.db.open()
// BSS HF1 activates at block 0 if not specified.
const bssHf1Index = BSS_HF1_INDEX[this.options.l2ChainId] || 0
this.logger.info(`L2 chain ID is: ${this.options.l2ChainId}`)
this.logger.info(`BSS HF1 will activate at: ${bssHf1Index}`)
this.state.metrics = new Metrics({
labels: {
environment: this.options.nodeEnv,
......
......@@ -51,7 +51,6 @@ type ethNetwork = 'mainnet' | 'kovan' | 'goerli'
useSentry: config.bool('use-sentry', false),
sentryDsn: config.str('sentry-dsn'),
sentryTraceRate: config.ufloat('sentry-trace-rate', 0.05),
bssHardfork1Index: config.uint('bss-hardfork-1-index', null),
})
const stop = async (signal) => {
......
......@@ -88,7 +88,6 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
}
this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment