Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(supervisor): pre-interop db support#2368

Merged
itschaindev merged 17 commits intomainfrom
feat/preinter-db-support
Jul 9, 2025
Merged

feat(supervisor): pre-interop db support#2368
itschaindev merged 17 commits intomainfrom
feat/preinter-db-support

Conversation

@dhyaniarun1993
Copy link
Collaborator

Closes #2351
Part of #2272

@dhyaniarun1993 dhyaniarun1993 added the W-supervisor Workstream: supervisor label Jul 8, 2025
@codecov
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 36 lines in your changes missing coverage. Please review.

Project coverage is 82.3%. Comparing base (42839d1) to head (2250cec).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/supervisor/storage/src/chaindb.rs 81.1% 17 Missing ⚠️
crates/supervisor/core/src/supervisor.rs 0.0% 14 Missing ⚠️
...ervisor/storage/src/providers/head_ref_provider.rs 75.0% 3 Missing ⚠️
...visor/storage/src/providers/derivation_provider.rs 96.2% 1 Missing ⚠️
...s/supervisor/storage/src/providers/log_provider.rs 98.3% 1 Missing ⚠️

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dhyaniarun1993 dhyaniarun1993 marked this pull request as ready for review July 9, 2025 07:50
Copilot AI review requested due to automatic review settings July 9, 2025 07:50
@dhyaniarun1993 dhyaniarun1993 changed the title [WIP] feat(supervisor): pre-interop db support feat(supervisor): pre-interop db support Jul 9, 2025
@dhyaniarun1993 dhyaniarun1993 self-assigned this Jul 9, 2025
@dhyaniarun1993 dhyaniarun1993 added the A-db Area: database label Jul 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds pre-interop database initialization support by introducing dedicated initialization methods for both derivation and log storage, updating consumers to call these methods, and adapting tests and metrics accordingly.

  • Introduce initialise_derivation_storage and initialise_log_storage in storage traits and providers
  • Refactor ChainDb to use new initialization methods and update supervisor/bootstrap code
  • Enhance tests, metrics, and configuration to support the new initialization flow

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/supervisor/storage/src/traits.rs Added initialise_derivation_storage and initialise_log_storage methods to writer traits
crates/supervisor/storage/src/providers/log_provider.rs Implemented initialise_log_storage, changed missing-block error to DatabaseNotInitialised, added empty-storage test
crates/supervisor/storage/src/providers/head_ref_provider.rs Enhanced update_safety_head_ref to prevent downgrading and renamed parameter to incoming_head_ref
crates/supervisor/storage/src/providers/derivation_provider.rs Implemented initialise_derivation_storage, switched EntryNotFound to DatabaseNotInitialised, extended tests
crates/supervisor/storage/src/metrics.rs Updated metrics method list to include new initialization and renamed methods
crates/supervisor/storage/src/chaindb.rs Removed unified initialise, added calls to new init methods in ChainDb, left TODOs
crates/supervisor/core/src/supervisor.rs Replaced db.initialise with separate init calls for log and derivation storage
crates/supervisor/core/src/logindexer/indexer.rs Added test stub for initialise_log_storage in LogStorageWriter impl
crates/supervisor/core/src/config/rollup_config_set.rs Derived Default for Genesis and RollupConfig
crates/supervisor/core/src/chain_processor/task.rs Added _rollup_config field and updated constructor/tests with initialise_* stubs
crates/supervisor/core/src/chain_processor/chain.rs Added rollup_config field, increased channel buffer, updated tests for new init methods
Comments suppressed due to low confidence (10)

crates/supervisor/storage/src/providers/log_provider.rs:149

  • Replacing EntryNotFound with DatabaseNotInitialised here conflates missing entries and uninitialized database states; consider preserving a distinct error for EntryNotFound or document the new semantics clearly.
            StorageError::DatabaseNotInitialised

crates/supervisor/storage/src/providers/derivation_provider.rs:564

  • [nitpick] This test comment refers to a second initialization but calls insert_pair; consider renaming the helper or aligning the test to use an initialize_* helper for clarity.
        assert!(insert_pair(&db, &anchor).is_ok());

crates/supervisor/storage/src/chaindb.rs:72

  • Rather than scattering two separate init calls, provide a single initialize(anchor) method on ChainDb to encapsulate both log and derivation initialization and reduce the chance of forgetting one.
// todo: make sure all get method return DatabaseNotInitialised error if db is not initialised

crates/supervisor/core/src/config/rollup_config_set.rs:10

  • [nitpick] Deriving Default for Genesis may produce semantically invalid default anchors. Consider whether a meaningful default is appropriate or remove Default.
#[derive(Debug, Default, Clone)]

crates/supervisor/storage/src/traits.rs:63

  • [nitpick] The doc comment uses US spelling Initializes whereas the method name uses British spelling initialise_derivation_storage; consider aligning spelling for consistency.
    /// Initializes the derivation storage with a given [`DerivedRefPair`].

crates/supervisor/core/src/logindexer/indexer.rs:170

  • In this test stub impl LogStorageWriter for Db, the method signature has no body and will cause a compilation error. Add a body (e.g., Ok(())).
            fn initialise_log_storage(&self, _block: BlockInfo) -> Result<(), StorageError>;

crates/supervisor/core/src/chain_processor/task.rs:497

  • Test stub for initialise_log_storage is missing a method body. Provide an implementation (e.g., returning Ok(())) for this trait in tests.
            fn initialise_log_storage(

crates/supervisor/core/src/chain_processor/task.rs:517

  • Test stub for initialise_derivation_storage lacks a method body. Implement the stub to return Ok(()) to satisfy the trait in tests.
            fn initialise_derivation_storage(

crates/supervisor/core/src/chain_processor/chain.rs:244

  • In the test impl LogStorageWriter for Db, initialise_log_storage has no body. Add a default body to avoid compilation errors.
            fn initialise_log_storage(

crates/supervisor/core/src/chain_processor/chain.rs:264

  • The test stub for initialise_derivation_storage is missing an implementation. Provide a stub body (e.g., Ok(())).
            fn initialise_derivation_storage(

@itschaindev itschaindev added this pull request to the merge queue Jul 9, 2025
Merged via the queue into main with commit 0a1aaa6 Jul 9, 2025
25 checks passed
@itschaindev itschaindev deleted the feat/preinter-db-support branch July 9, 2025 15:21
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-db Area: database W-supervisor Workstream: supervisor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(supervisor/core): initialise database post interop

3 participants