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

chore(node/net): integrate the network driver inside the network actor#2376

Merged
theochap merged 1 commit intomainfrom
theo/send-payloads-to-network
Jul 8, 2025
Merged

chore(node/net): integrate the network driver inside the network actor#2376
theochap merged 1 commit intomainfrom
theo/send-payloads-to-network

Conversation

@theochap
Copy link
Member

@theochap theochap commented Jul 8, 2025

Description

This PR refactors the network driver and moves it inside the network actor. This reduces the levels of indirection and allow the network actor to comply more with the new builder refactor of the node services by avoiding to define channels inside the driver.

Changes:

NodeBuilder ->build NodeDriver ->(async) start NodeHandler

Close #2365

@theochap theochap self-assigned this Jul 8, 2025
@theochap theochap added K-chore Kind: chore A-node Area: cl node (eq. Go op-node) handles single-chain consensus A-services Area: rollup services/actors labels Jul 8, 2025
@theochap theochap moved this to In Review in Project Tracking Jul 8, 2025
@codecov
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.

Project coverage is 82.3%. Comparing base (22b1dd5) to head (3a2c987).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/node/p2p/src/gossip/driver.rs 0.0% 27 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.

Comment on lines 30 to 31
/// The frequency at which to inspect peer scores to ban poorly performing peers.
pub(super) const PEER_SCORE_INSPECT_FREQUENCY: Duration = Duration::from_secs(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be configurable too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can open an issue for it, I think we can configure it indeed!

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh actually it is already defined as a static constant here

/// The pper score inspect frequency.
/// The frequency at which peer scores are inspected.
pub static ref PEER_SCORE_INSPECT_FREQUENCY: Duration = 15 * Duration::from_secs(1);

Copy link
Member Author

Choose a reason for hiding this comment

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

How about we keep it constant for now then?

Copy link
Contributor

@refcell refcell 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 happy with this. Will make it easier to split up kona-p2p into separate discovery and gossip crates, so I'm a proponent.

I think there's a few small things remaining that could be cleaned up. Otherwise nice work!

Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

This looks good

@theochap theochap added this pull request to the merge queue Jul 8, 2025
Merged via the queue into main with commit 38a79d2 Jul 8, 2025
24 of 25 checks passed
@theochap theochap deleted the theo/send-payloads-to-network branch July 8, 2025 23:23
@github-project-automation github-project-automation bot moved this from In Review to Done in Project Tracking Jul 8, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2025
)

## Description

Rewire the sequencer unsafe payload sender from the engine to the
network.

Previously, the sequencer was sending the unsafe blocks it received from
the network `BuildTask` back to the network to call `InsertUnsafeTask`.
Since the `BuildTask` inserts the newly built payloads to the engine
state (like what the `InsertUnsafeTask` would do), this resulted in a
no-op.

Instead, the sequencer should send the payloads to the network to gossip
them to the p2p mesh.

## Misc

Close #2244
Built on top of #2376
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
op-rs/kona#2376)

## Description

This PR refactors the network driver and moves it inside the network
actor. This reduces the levels of indirection and allow the network
actor to comply more with the new builder refactor of the node services
by avoiding to define channels inside the driver.

Changes:

- Removes the `net` module inside `kona-p2p`. Moves the relevant files
to the `kona-node-services` crate.
- Removes the `broadcast` module inside the network actor. This can now
be directly handled using a mpsc channel inside the network actor to
implement the notion of queue. Outer interactions with the network actor
happen through the `NetworkActor` context (see for instance
op-rs/kona@main...theo/send-payloads-to-network#diff-b4e04fd02334c1ae45e956ad21312e81efacba5a7c1d477b176711dbae458c32R87-R126
or
op-rs/kona@main...theo/send-payloads-to-network#diff-00c31e9f9de711af31ebbd3b81f610ea12ea100a6a8d0db6a2ef86f52f298849L80-R75)
- Divides the network actor module with the following pattern to
propagate the lower level abstractions (resp
`Discv5Driver`/`Discv5Handler`/`GossipDriver`):
```
NodeBuilder ->build NodeDriver ->(async) start NodeHandler
```

Close op-rs/kona#2365
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
…-rs/kona#2378)

## Description

Rewire the sequencer unsafe payload sender from the engine to the
network.

Previously, the sequencer was sending the unsafe blocks it received from
the network `BuildTask` back to the network to call `InsertUnsafeTask`.
Since the `BuildTask` inserts the newly built payloads to the engine
state (like what the `InsertUnsafeTask` would do), this resulted in a
no-op.

Instead, the sequencer should send the payloads to the network to gossip
them to the p2p mesh.

## Misc

Close op-rs/kona#2244
Built on top of op-rs/kona#2376
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
op-rs/kona#2376)

## Description

This PR refactors the network driver and moves it inside the network
actor. This reduces the levels of indirection and allow the network
actor to comply more with the new builder refactor of the node services
by avoiding to define channels inside the driver.

Changes:

- Removes the `net` module inside `kona-p2p`. Moves the relevant files
to the `kona-node-services` crate.
- Removes the `broadcast` module inside the network actor. This can now
be directly handled using a mpsc channel inside the network actor to
implement the notion of queue. Outer interactions with the network actor
happen through the `NetworkActor` context (see for instance
op-rs/kona@main...theo/send-payloads-to-network#diff-b4e04fd02334c1ae45e956ad21312e81efacba5a7c1d477b176711dbae458c32R87-R126
or
op-rs/kona@main...theo/send-payloads-to-network#diff-00c31e9f9de711af31ebbd3b81f610ea12ea100a6a8d0db6a2ef86f52f298849L80-R75)
- Divides the network actor module with the following pattern to
propagate the lower level abstractions (resp
`Discv5Driver`/`Discv5Handler`/`GossipDriver`):
```
NodeBuilder ->build NodeDriver ->(async) start NodeHandler
```

Close #2365
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-node Area: cl node (eq. Go op-node) handles single-chain consensus A-services Area: rollup services/actors K-chore Kind: chore

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(node/network): merge network driver and network actor

2 participants