Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Fix dtl huge range requests #864

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 2 additions & 0 deletions ops/docker/Dockerfile.packages
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ COPY packages/message-relayer/package.json ./packages/message-relayer/package.js
COPY integration-tests/package.json ./integration-tests/package.json
COPY ops_boba/api/package.json ./ops_boba/api/package.json

COPY packages/boba/register/package.json ./packages/boba/register/package.json
COPY packages/boba/contracts/package.json ./packages/boba/contracts/package.json
COPY packages/boba/gas-price-oracle/package.json ./packages/boba/gas-price-oracle/package.json
COPY packages/boba/turing/package.json ./packages/boba/turing/package.json
Expand Down Expand Up @@ -116,6 +117,7 @@ ENTRYPOINT ["./scripts/wait-for-l1-and-l2.sh", "./scripts/deployer.sh"]

FROM packages as data-transport-layer
WORKDIR /opt/optimism/packages
COPY --from=builder /opt/optimism/packages/boba/register ./boba/register
COPY --from=builder /opt/optimism/packages/data-transport-layer ./data-transport-layer
WORKDIR /opt/optimism/packages/data-transport-layer
RUN mkdir ./state-dumps
Expand Down
1 change: 1 addition & 0 deletions packages/data-transport-layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@sentry/node": "^7.30.0",
"@sentry/tracing": "^7.30.0",
"@types/express": "^4.17.12",
"@boba/register": "0.0.1",
"axios": "^0.21.1",
"bcfg": "^0.1.6",
"bfj": "^7.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fs from 'fs'
import { constants } from 'ethers'

export const getAddress = async (
contractAddress: string,
contractName: string
): Promise<string> => {
const dirname: string = 'node_modules/@boba/register/addresses' // TODO

try {
const files = await fs.readdirSync(
dirname,
{ withFileTypes: false }
)

for (const fileName of files) {
if (!fileName.includes(contractAddress)) {
continue
}
const content = fs.readFileSync(`${dirname}/${fileName}`, {
encoding: 'utf-8',
})
const parsed = JSON.parse(content)
return parsed[contractName] ?? constants.AddressZero
}
} catch (error) {
console.log(error.message)
throw new Error(
'Could not load address for contract from local json files!'
)
}
return constants.AddressZero
}
17 changes: 15 additions & 2 deletions packages/data-transport-layer/src/services/l1-ingestion/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from '../../utils'
import { EventHandlerSet } from '../../types'
import { L1DataTransportServiceOptions } from '../main/service'
import { getAddress } from "./addresses";

interface L1IngestionMetrics {
highestSyncedL1Block: Gauge<string>
Expand Down Expand Up @@ -486,7 +487,19 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
blockNumber
)
} else {
events = await this.state.contracts.Lib_AddressManager.queryFilter(
// import addresses_BobaBase from "@boba/register/addresses/addressesBobaBase_0xF8d0bF3a1411AC973A606f90B2d1ee0840e5979B"
// TODO: Instead look up from addresses.json file
const addrMgr = this.state.contracts.Lib_AddressManager.address
console.log("ADDDDDD", addrMgr)

const address = await getAddress(
this.state.contracts.Lib_AddressManager.address,
contractName
)
return address
}

/*events = await this.state.contracts.Lib_AddressManager.queryFilter(
this.state.contracts.Lib_AddressManager.filters.AddressSet(
contractName
),
Expand All @@ -499,7 +512,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
} else {
// Address wasn't set before this.
return constants.AddressZero
}
}*/
}

private async _findStartingL1BlockNumber(): Promise<number> {
Expand Down