-
Notifications
You must be signed in to change notification settings - Fork 27
feature: implement libp2p node for worker, validator, and orchestrator #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! The basic flow of nodes joining the orchestrator works smooth now! Some comments attached.
|
nice! |
Uh oh!
There was an error while loading. Please reload this page.