Commit 1a1ff860 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

Merge pull request #2201 from ethereum-optimism/sc/dtl-patch-contexts

feat(dtl): add patch contexts
parents bdb8de13 275eb818
---
'@eth-optimism/data-transport-layer': patch
---
Include patch contexts for bss hf1
export const PATCH_CONTEXTS = {
10: {
2817218: 1643139411,
2817287: 1643139718,
2817898: 1643140952,
2818512: 1643141859,
2818984: 1643142762,
2819864: 1643144275,
2820902: 1643146079,
2821157: 1643146389,
2821170: 1643146389,
2821339: 1643146689,
2821772: 1643147604,
2821814: 1643147909,
2821952: 1643147909,
2822262: 1643148824,
2822342: 1643149130,
2822425: 1643149130,
2822602: 1643149430,
2822742: 1643149733,
2822987: 1643150660,
2822999: 1643150660,
2823039: 1643150964,
2823046: 1643150964,
2823055: 1643150964,
2823096: 1643151269,
2823205: 1643151572,
2823260: 1643151572,
2823306: 1643151572,
2823322: 1643151572,
2823413: 1643151872,
2823419: 1643151872,
2823460: 1643151872,
2823561: 1643152174,
2823592: 1643152174,
2824036: 1643152774,
2824050: 1643153075,
2824107: 1643153075,
2824247: 1643153376,
2832642: 1643173416,
2835330: 1643181396,
2838173: 1643188371,
2838174: 1643188371,
2838175: 1643188371,
2840388: 1643192601,
2844171: 1643202366,
2845370: 1643204181,
2845931: 1643205096,
2846484: 1643205696,
2894118: 1643281866,
2894119: 1643281866,
2959506: 1643399826,
2967959: 1643419611,
2971530: 1643432181,
2974571: 1643443881,
2981176: 1643465226,
2984205: 1643470986,
2995760: 1643498166,
2996847: 1643501211,
2997086: 1643501811,
2997087: 1643501811,
2997569: 1643503026,
2998970: 1643506101,
3000041: 1643510376,
3000042: 1643510376,
3000973: 1643514306,
3001008: 1643514606,
3001009: 1643514606,
3002529: 1643520081,
3008446: 1643541501,
3009141: 1643543016,
3012287: 1643551521,
3012348: 1643551821,
3022052: 1643574336,
3042815: 1643624616,
3043000: 1643625516,
3060328: 1643656446,
3060471: 1643656746,
3064982: 1643667996,
3070655: 1643683461,
},
}
...@@ -4,6 +4,7 @@ import { BigNumber } from 'ethers' ...@@ -4,6 +4,7 @@ import { BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { SimpleDB } from './simple-db' import { SimpleDB } from './simple-db'
import { PATCH_CONTEXTS } from './patch-contexts'
import { import {
EnqueueEntry, EnqueueEntry,
StateRootBatchEntry, StateRootBatchEntry,
...@@ -32,6 +33,7 @@ interface Indexed { ...@@ -32,6 +33,7 @@ interface Indexed {
} }
interface ExtraTransportDBOptions { interface ExtraTransportDBOptions {
l2ChainId?: number
bssHardfork1Index?: number bssHardfork1Index?: number
} }
...@@ -307,6 +309,12 @@ export class TransportDB { ...@@ -307,6 +309,12 @@ export class TransportDB {
timestamp = transaction.timestamp timestamp = transaction.timestamp
} }
// Override with patch contexts if necessary
const contexts = PATCH_CONTEXTS[this.opts.l2ChainId]
if (contexts && contexts[transaction.index + 1]) {
timestamp = contexts[transaction.index + 1]
}
return { return {
...transaction, ...transaction,
...{ ...{
......
...@@ -109,6 +109,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> { ...@@ -109,6 +109,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
protected async _init(): Promise<void> { protected async _init(): Promise<void> {
this.state.db = new TransportDB(this.options.db, { this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index, bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
}) })
this.l1IngestionMetrics = registerMetrics(this.metrics) this.l1IngestionMetrics = registerMetrics(this.metrics)
......
...@@ -87,6 +87,7 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> { ...@@ -87,6 +87,7 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
this.state.db = new TransportDB(this.options.db, { this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index, bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
}) })
this.state.l2RpcProvider = this.state.l2RpcProvider =
......
...@@ -89,6 +89,7 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> { ...@@ -89,6 +89,7 @@ export class L1TransportServer extends BaseService<L1TransportServerOptions> {
this.state.db = new TransportDB(this.options.db, { this.state.db = new TransportDB(this.options.db, {
bssHardfork1Index: this.options.bssHardfork1Index, bssHardfork1Index: this.options.bssHardfork1Index,
l2ChainId: this.options.l2ChainId,
}) })
this.state.l1RpcProvider = this.state.l1RpcProvider =
......
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