Commit a415d017 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix[dtl]: use the same L2 chain ID everywhere (#1122)

* fix[dtl]: use the same L2 chain ID everywhere

* chore: add changeset
parent cd1cfd44
---
'@eth-optimism/data-transport-layer': patch
---
Updates the DTL to use the same L2 chain ID everywhere
...@@ -53,6 +53,9 @@ const optionSettings = { ...@@ -53,6 +53,9 @@ const optionSettings = {
return validators.isUrl(val) || validators.isJsonRpcProvider(val) return validators.isUrl(val) || validators.isJsonRpcProvider(val)
}, },
}, },
l2ChainId: {
validate: validators.isInteger,
},
} }
export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
...@@ -65,7 +68,6 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { ...@@ -65,7 +68,6 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
contracts: OptimismContracts contracts: OptimismContracts
l1RpcProvider: JsonRpcProvider l1RpcProvider: JsonRpcProvider
startingL1BlockNumber: number startingL1BlockNumber: number
l2ChainId: number
} = {} as any } = {} as any
protected async _init(): Promise<void> { protected async _init(): Promise<void> {
...@@ -115,10 +117,6 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { ...@@ -115,10 +117,6 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
this.options.addressManager this.options.addressManager
) )
this.state.l2ChainId = ethers.BigNumber.from(
await this.state.contracts.OVM_ExecutionManager.ovmCHAINID()
).toNumber()
const startingL1BlockNumber = await this.state.db.getStartingL1Block() const startingL1BlockNumber = await this.state.db.getStartingL1Block()
if (startingL1BlockNumber) { if (startingL1BlockNumber) {
this.state.startingL1BlockNumber = startingL1BlockNumber this.state.startingL1BlockNumber = startingL1BlockNumber
...@@ -301,7 +299,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { ...@@ -301,7 +299,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
const parsedEvent = await handlers.parseEvent( const parsedEvent = await handlers.parseEvent(
event, event,
extraData, extraData,
this.state.l2ChainId this.options.l2ChainId
) )
await handlers.storeEvent(parsedEvent, this.state.db) await handlers.storeEvent(parsedEvent, this.state.db)
} }
......
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