Skip to content

Conversation

@axelKingsley
Copy link
Contributor

@axelKingsley axelKingsley commented Oct 16, 2024

What

Uses the new Dependency Set Configuration to spin up database constructs for exactly the chains specified.

How

I split out the "AddL2FromRPC" functionality into two parts:

openChainDBs

Creates the LogDB and FromDA DBs for the given chain and attaches it to the SupervisorBackend.chainsDB.

addProcessorFromRPC attachRPC

Connects via RPC to determine ChainID, and then attaches a new processor to SupervisorBackend.ChainProcessors.
If the discovered ChainID is not part of the dependency set (determined by known processors), this attachment fails.

Chain-Processors are now instantiated upfront, to allow attaching of RPCs during runtime, and to make the test-setup a little more sane (we can attach a mock source with AttachProcessorSource now)

Additionally

The SupervisorBackend now tracks a map for ChainMetrics, as both the Processor and Database want to use it, and the processor may not be attached until later.

Now, when users use the AddRPC function on the Supervisor, it only follows the addProcessorFromRPC path.

And a minor bugfix in the logs db, to read the full block seal properly.

TODO:

  • Unit Tests (done: there's a backend test asserting the presence of DBs and unsafe/cross-unsafe block functionality)
  • Creating the fromda objects inside the ChainsDB when the call is made (done)

Metadata

Fix #12487

@axelKingsley axelKingsley requested review from a user and protolambda October 16, 2024 21:29
Copy link
Contributor Author

@axelKingsley axelKingsley left a comment

Choose a reason for hiding this comment

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

I'm the author of this PR so I can't approve it, but since @protolambda added some things, I'm going to review/annotate things to make review as easy as possible for @tyler-smith.

@protolambda generally in favor of the changes you added.

  • I see you removed checkProcessorCoverage, first taking out the error return, then removing the function altogether. I think that function is pretty helpful because it can signal to callers that the backend isn't properly initialized yet, and the log messages would be very nice to see if ever a supervisor is failing due to incomplete coverage.
  • Looks like you put together a different synchronization mechanism for the Processors. That's fine, but I'm not sure it really belonged in this PR.

I would approve this if I wasn't the author :)

Co-authored-by: Axel Kingsley <axel.kingsley@gmail.com>
@protolambda protolambda enabled auto-merge October 17, 2024 17:58
@protolambda protolambda added this pull request to the merge queue Oct 17, 2024
Merged via the queue into develop with commit c26ab41 Oct 17, 2024
@protolambda protolambda deleted the interop/use-dependency-set branch October 17, 2024 18:16
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
* Initialize using Dependency Set Configuration

* op-supervisor: init fromda, route fromda metrics, handle cross-unsafe, improve backend resource initialization

* op-supervisor: attach RPC, create processors upfront, implement backend test

* op-supervisor: fix dependency set configuration and test setup

* Update op-supervisor/supervisor/backend/backend.go

Co-authored-by: Axel Kingsley <axel.kingsley@gmail.com>

---------

Co-authored-by: protolambda <proto@protolambda.com>
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.

Interop: use dependency-set to define chain sub-services

2 participants