cleanup(node/actor): Consolidate DerivationActor inbound channels#3229
cleanup(node/actor): Consolidate DerivationActor inbound channels#3229
Conversation
cabd1ab to
b13b3b0
Compare
2eb2f23 to
7434163
Compare
560eefa to
053cc5f
Compare
b3062d0 to
b1b1f7d
Compare
b1b1f7d to
7c564d5
Compare
| pipeline: PipelineSignalReceiver, | ||
|
|
||
| /// The engine's L2 safe head, according to updates from the Engine. | ||
| engine_l2_safe_head: L2BlockInfo, |
There was a problem hiding this comment.
Why isn't that a channel? It looks like this should be a watch::Receiver?
There was a problem hiding this comment.
There's little value in making this a watch::Receiver, as the process (at a very high level) is:
- DerivationActor sends EngineActor the safe head attributes
- DerivationActor halts derivation until it hears that EngineActor has updated the safe head
- Repeat
So there should never be safe head updates from the engine that the DerivationActor didn't send it (and is waiting on for an ack). We don't need to worry about frequent updates or stale data.
It also creates the explicit dependency between Engine and DerivationActor. The only [current] reason EngineActor exposes this info is for DerivationActor to read it.
crates/node/service/src/actors/engine/engine_request_processor.rs
Outdated
Show resolved
Hide resolved
crates/node/service/src/actors/engine/engine_request_processor.rs
Outdated
Show resolved
Hide resolved
crates/node/service/src/actors/engine/engine_request_processor.rs
Outdated
Show resolved
Hide resolved
7c564d5 to
1b933ec
Compare
theochap
left a comment
There was a problem hiding this comment.
Overall looks really good. A few nits here and there. Please make sure to run all the CI pipeline (including action-tests and acceptance tests that are skipped in CI) before merging that PR. This is a pretty big refactor so there may be some areas that may have been broken
| engine_processor, | ||
| engine_rpc_processor, | ||
| )) | ||
| } |
There was a problem hiding this comment.
The logic to build the engine here is a bit complicated and I am slightly worried that we're pushing so much explicit behavior at the rollup-node-service level. It may be fine to keep it that way for this PR, but we should think of a way to fit all the actors under similar patterns so that we can make the RollupNode more generic/easier to modify. This doesn't need to be done here and it will probably require changing the other actors but I'd like us to keep this goal in mind for future changes
There was a problem hiding this comment.
Hopefully we can remove StartData from RpcActor, which should allow us to remove StartData from NodeActor, and then this function can just take a Vec of NodeActor.
That will push this configuration up into the NodeCommand, but
- To me, it makes more sense for it to be there since the intention is for this to be a lib
- We can still have all of the construction helpers in this lib so they can be used by our CLI as well as anyone else using the lib (if they choose)
0769d7c to
9127b94
Compare
- Creates enum of supported inboud requests handled via a single channel - Creates client traits for all references and adds code to use them Also: - Reworks EngineActor to inject dependencies and remove NodeActor::StartData - Creates processor task traits and makes EngineActor generic over them
9127b94 to
7980116
Compare
Confirming that the following tests have passed:
cc: @theochap |
~Base branch: #3242 ~May conflict with #3229, #3253 Implement the kona light CL([Design doc](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md)): - [DerivationActor - Target Determination](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md#derivationactor---target-determination) - [EngineActor - Fork Choice Update](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md#engineactor---fork-choice-update) ```mermaid flowchart TB subgraph A ["Normal Mode (Derivation)"] direction TB subgraph A0 ["Rollup Node Service"] direction TB A_Derivation["DerivationActor<br/>(L1->L2 derivation)"] A_Engine["EngineActor"] A_UnsafeSrc["Unsafe Source<br/>(P2P gossip / Sequencer)"] end A_L1[(L1 RPC)] A_EL[(Execution Layer)] A_L1 -->|L1 info| A_Derivation A_UnsafeSrc -->|unsafe| A_Engine A_Derivation -->|"safe(attr)/finalized"| A_Engine A_Engine -->|engine API| A_EL end subgraph B ["Light CL Mode"] direction TB subgraph B0 ["Rollup Node Service"] direction TB B_DerivationX[["DerivationActor<br/>(NEW: Poll external syncStatus)"]] B_Engine["EngineActor"] B_UnsafeSrc["Unsafe Source<br/>(P2P gossip / Sequencer)"] end B_L1[(L1 RPC)] B_Ext[(External CL RPC<br/>optimism_syncStatus)] B_EL[(Execution Layer)] %% Connections B_Ext -->|safe/finalized/currentL1| B_DerivationX B_L1 -->|canonical L1 check| B_DerivationX B_DerivationX -->|"safe(blockInfo)/finalized (validated)"| B_Engine B_UnsafeSrc -->|unsafe| B_Engine %% Visual indicator for disabled actor B_Engine -->|engine API| B_EL end ``` ### Testing #### Acceptance Tests Running guidelines detailed at #3199: - [x] `TestFollowL2_Safe_Finalized_CurrentL1` - [x] `TestFollowL2_WithoutCLP2P` - [ ] `TestFollowL2_ReorgRecovery` (blocked by [kona: Check L2 reorg due to L1 reorg](ethereum-optimism/optimism#18676)) Injecting CurrentL1 is blocked by [kona: Revise SyncStatus CurrentL1 Selection](ethereum-optimism/optimism#18673) #### Local Sync Tests Validated with syncing op-sepolia between kona-node light CL <> sync tester, successfully finishing the initial EL sync and progress every safety levels reaching each tip. #### Devnet Tests Commit 0b36fdd is baked to `us-docker.pkg.dev/oplabs-tools-artifacts/dev-images/kona-node:0b36fdd-light-cl` and deployed at `changwan-0` devnet: - As a verifier: `changwan-0-kona-geth-f-rpc-3` [[grafana]](https://optimistic.grafana.net/d/nUSlc3d4k/bedrock-networks?orgId=1&refresh=30s&from=now-1h&to=now&timezone=browser&var-network=changwan-0&var-node=$__all&var-layer=$__all&var-safety=l2_finalized&var-cluster=$__all&var-konaNodes=changwan-0-kona-geth-f-rpc-3) - As a sequencer: `changwan-0-kona-geth-f-sequencer-3` [[grafana]](https://optimistic.grafana.net/d/nUSlc3d4k/bedrock-networks?orgId=1&refresh=30s&from=now-1h&to=now&timezone=browser&var-network=changwan-0&var-node=$__all&var-layer=$__all&var-safety=l2_finalized&var-cluster=$__all&var-konaNodes=changwan-0-kona-geth-f-sequencer-3) - As a standby | leader Noticed all {unsafe, safe, finalized} head progression as a kona node light CL.
~Base branch: op-rs/kona#3242 ~May conflict with op-rs/kona#3229, op-rs/kona#3253 Implement the kona light CL([Design doc](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md)): - [DerivationActor - Target Determination](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md#derivationactor---target-determination) - [EngineActor - Fork Choice Update](https://github.com/ethereum-optimism/design-docs/blob/main/protocol/kona-node-light-cl.md#engineactor---fork-choice-update) ```mermaid flowchart TB subgraph A ["Normal Mode (Derivation)"] direction TB subgraph A0 ["Rollup Node Service"] direction TB A_Derivation["DerivationActor<br/>(L1->L2 derivation)"] A_Engine["EngineActor"] A_UnsafeSrc["Unsafe Source<br/>(P2P gossip / Sequencer)"] end A_L1[(L1 RPC)] A_EL[(Execution Layer)] A_L1 -->|L1 info| A_Derivation A_UnsafeSrc -->|unsafe| A_Engine A_Derivation -->|"safe(attr)/finalized"| A_Engine A_Engine -->|engine API| A_EL end subgraph B ["Light CL Mode"] direction TB subgraph B0 ["Rollup Node Service"] direction TB B_DerivationX[["DerivationActor<br/>(NEW: Poll external syncStatus)"]] B_Engine["EngineActor"] B_UnsafeSrc["Unsafe Source<br/>(P2P gossip / Sequencer)"] end B_L1[(L1 RPC)] B_Ext[(External CL RPC<br/>optimism_syncStatus)] B_EL[(Execution Layer)] %% Connections B_Ext -->|safe/finalized/currentL1| B_DerivationX B_L1 -->|canonical L1 check| B_DerivationX B_DerivationX -->|"safe(blockInfo)/finalized (validated)"| B_Engine B_UnsafeSrc -->|unsafe| B_Engine %% Visual indicator for disabled actor B_Engine -->|engine API| B_EL end ``` ### Testing #### Acceptance Tests Running guidelines detailed at op-rs/kona#3199: - [x] `TestFollowL2_Safe_Finalized_CurrentL1` - [x] `TestFollowL2_WithoutCLP2P` - [ ] `TestFollowL2_ReorgRecovery` (blocked by [kona: Check L2 reorg due to L1 reorg](#18676)) Injecting CurrentL1 is blocked by [kona: Revise SyncStatus CurrentL1 Selection](#18673) #### Local Sync Tests Validated with syncing op-sepolia between kona-node light CL <> sync tester, successfully finishing the initial EL sync and progress every safety levels reaching each tip. #### Devnet Tests Commit op-rs/kona@0b36fdd is baked to `us-docker.pkg.dev/oplabs-tools-artifacts/dev-images/kona-node:0b36fdd-light-cl` and deployed at `changwan-0` devnet: - As a verifier: `changwan-0-kona-geth-f-rpc-3` [[grafana]](https://optimistic.grafana.net/d/nUSlc3d4k/bedrock-networks?orgId=1&refresh=30s&from=now-1h&to=now&timezone=browser&var-network=changwan-0&var-node=$__all&var-layer=$__all&var-safety=l2_finalized&var-cluster=$__all&var-konaNodes=changwan-0-kona-geth-f-rpc-3) - As a sequencer: `changwan-0-kona-geth-f-sequencer-3` [[grafana]](https://optimistic.grafana.net/d/nUSlc3d4k/bedrock-networks?orgId=1&refresh=30s&from=now-1h&to=now&timezone=browser&var-network=changwan-0&var-node=$__all&var-layer=$__all&var-safety=l2_finalized&var-cluster=$__all&var-konaNodes=changwan-0-kona-geth-f-sequencer-3) - As a standby | leader Noticed all {unsafe, safe, finalized} head progression as a kona node light CL.
See: #3223
This also reworks aspects of
EngineActor. See referenced issues.closes #3223, #3213, #3215, #3216, #3219, and #3072