This repository was archived by the owner on Jan 27, 2026. It is now read-only.
feature: implement libp2p node for worker, validator, and orchestrator#622
Merged
feature: implement libp2p node for worker, validator, and orchestrator#622
Conversation
This was referenced Jul 11, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the existing iroh-based P2P implementation with a new libp2p-based p2p crate, refactors state handling to store keypairs instead of seeds/IDs, and wires up request–response channels in the worker, validator, and orchestrator.
- Remove old iroh seed/ID utilities and update
SystemStateto persistp2p_keypairvia custom serde functions. - Introduce a new
Servicefor P2P in the worker, validator, and orchestrator, using request–response protocols (authentication, hardware challenge, invite, logs, restart). - Update CLI, heartbeat, Docker bridge, and API routes to send and receive P2P messages through
oneshotchannels andp2p::Service.
Reviewed Changes
Copilot reviewed 45 out of 47 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/worker/src/utils/p2p.rs | Removed old iroh-based seed and node ID generation utilities. |
| crates/worker/src/state/system_state.rs | Refactored persisted state to store p2p_keypair with custom serde. |
| crates/worker/src/p2p/mod.rs | Added new libp2p-based Service handling request–response protocols. |
| crates/validator/src/validators/hardware_challenge.rs | Switched to sending hardware challenges over channels via p2p. |
| crates/orchestrator/src/api/routes/nodes.rs | Reworked restart/logs routes to use oneshot requests/responses. |
Comments suppressed due to low confidence (3)
crates/worker/src/operations/heartbeat/service.rs:179
- [nitpick] Since
p2p_idis always provided, consider making the heartbeat request field non-optional to simplify the signature and remove theOption<String>wrapper.
p2p_id: Some(p2p_id.to_string()), // TODO: this should always be `Some`
crates/worker/src/p2p/mod.rs:1
- The new P2P
Servicehas no dedicated unit or integration tests. Consider adding tests forbuild_p2p_node,run, and message handling to ensure correct protocol behavior.
use anyhow::Context as _;
crates/worker/src/docker/service.rs:184
- The
${WORKER_P2P_SEED}placeholder replacement was removed but the template may still include it. Ensure any task command templates are updated to remove or handle this placeholder.
arg.replace("${SOCKET_PATH}", &task_bridge_socket_path)
JannikSt
suggested changes
Jul 11, 2025
Member
JannikSt
left a comment
There was a problem hiding this comment.
Great work! The basic flow of nodes joining the orchestrator works smooth now! Some comments attached.
JannikSt
approved these changes
Jul 11, 2025
|
nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.