Skip to content

ops: integrate op-fetcher #951

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

Merged
merged 31 commits into from
Apr 10, 2025
Merged

ops: integrate op-fetcher #951

merged 31 commits into from
Apr 10, 2025

Conversation

bitwiseguy
Copy link
Collaborator

@bitwiseguy bitwiseguy commented Mar 27, 2025

Overview

Integrates op-fetcher from the monorepo into this repo in order to pull chain config info on-demand from onchain instead of relying on static, hard-coded addresses in the chain config .toml files. This will help prevent data in the chain config .toml and codegen files from going stale and requiring manual updates. Instead, a daily ci job will run and open a pr to update the following codegen files if it notices any diffs between what is onchain and what is stored offchain in the registry:

  • addresses.json
  • chainList.json
  • chainList.toml
  • CHAINS.md

Details

The existing ops/cmd/codegen command has been modified to use op-fetcher instead of pulling all of its information from hardcoded information in the chain config .toml files.

In addition to contract and roles addresses, op-fetcher also outputs a faultProofsStatus struct. This information is now stored in the ChainListEntry struct that comprises chainList.json and chainList.toml.

Usage

  1. Update all chains: this is how the ci job will invoke the command. Any superchain (mainnet, sepolia, sepolia-dev-0) will be updated if an l1-rpc-url with the appropriate l1 chainId is provided.
go run ./cmd/codegen \
  --l1-rpc-urls="$SEPOLIA_RPC_URL,$MAINNET_RPC_URL"
  1. Update all chains for a single superchain:
go run ./cmd/codegen \
  --l1-rpc-urls="$SEPOLIA_RPC_URL,$MAINNET_RPC_URL" \
  --superchains="mainnet"
  1. Update specific chains by passing a --chain-ids flag: this will be used when an individual chain is added or modified. This command will fail if none of the given l1-rpc-urls have the appropriate l1 chainId to query the l2(s) contracts.
go run ./cmd/codegen \
  --l1-rpc-urls="$SEPOLIA_RPC_URL,$MAINNET_RPC_URL" \
  --chain-ids=<l2-chain-id>

Related Issues

Follow-up Work

Remove all addresses from the individual chain config .toml files except the following ones. The full collection of addresses should be read from the more up-to-date addresses.json file, or read on-demand using op-fetcher.

@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 36.64596% with 306 lines in your changes missing coverage. Please review.

Project coverage is 41.92%. Comparing base (fb90035) to head (f903fa2).

Files with missing lines Patch % Lines
ops/internal/manage/fetch_onchain.go 38.09% 63 Missing and 2 partials ⚠️
ops/cmd/codegen/main.go 0.00% 53 Missing ⚠️
ops/internal/manage/codegen.go 65.49% 31 Missing and 18 partials ⚠️
ops/internal/config/chain.go 35.82% 41 Missing and 2 partials ⚠️
ops/internal/config/superchain.go 0.00% 33 Missing ⚠️
ops/internal/paths/paths.go 0.00% 29 Missing ⚠️
ops/cmd/sync_staging/main.go 0.00% 15 Missing ⚠️
ops/internal/config/address.go 48.27% 14 Missing and 1 partial ⚠️
ops/internal/manage/collect.go 60.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #951      +/-   ##
==========================================
- Coverage   43.64%   41.92%   -1.73%     
==========================================
  Files          39       40       +1     
  Lines        2305     2674     +369     
==========================================
+ Hits         1006     1121     +115     
- Misses       1210     1450     +240     
- Partials       89      103      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bitwiseguy bitwiseguy requested a review from mslipper April 4, 2025 03:51
@bitwiseguy bitwiseguy marked this pull request as ready for review April 4, 2025 03:51
@bitwiseguy bitwiseguy requested a review from a team as a code owner April 4, 2025 03:51
@bitwiseguy bitwiseguy mentioned this pull request Apr 4, 2025
@bitwiseguy bitwiseguy force-pushed the ss/onchain-fetcher-integration branch from 3b3658d to ec4c61f Compare April 7, 2025 17:25
Copy link
Contributor

@mslipper mslipper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few gaps before this is ready to merge. Specifically:

  • Stuff that touches the disk should use an FS helper in paths
  • We should be scanning the disk once for all chain configs/superchains, then using in-memory data for further filtering operations. This is the architecture for other ops tools, and makes things much simpler

@bitwiseguy bitwiseguy removed the F-do-not-merge Flag: Do Not Merge label Apr 10, 2025
@bitwiseguy bitwiseguy added this pull request to the merge queue Apr 10, 2025
Merged via the queue into main with commit 5dc054c Apr 10, 2025
10 checks passed
@bitwiseguy bitwiseguy deleted the ss/onchain-fetcher-integration branch April 10, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

retrieve chain's L1 contract addresses onchain display fault proof status for chains
3 participants