Skip to content

feat(mesh): stable libp2p identity (deploy-ready PeerIds for cross-DC bootnodes)#30

Merged
drewstone merged 1 commit into
mainfrom
feat/mesh-stable-identity
Jun 14, 2026
Merged

feat(mesh): stable libp2p identity (deploy-ready PeerIds for cross-DC bootnodes)#30
drewstone merged 1 commit into
mainfrom
feat/mesh-stable-identity

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

Prereq for the fleet HTTP→mesh cutover. The mesh used Keypair::generate_ed25519() — a random libp2p identity per boot, so a node's PeerId changed on every restart. Cross-DC discovery is impractical that way: bootnode multiaddrs are /ip4/<host>/tcp/<port>/p2p/<PeerId>, and a rotating PeerId can't be pinned in peers' configs.

Fix: derive the ed25519 transport key deterministically from the operator key (keccak256(key ‖ "surplus-mesh-libp2p-v1") as the seed — a domain-tagged hash, never the raw k256 secret). PeerId is now stable across restarts and computable offline, so SURPLUS_MESH_BOOTNODES is a one-time config. Boot logs the peer_id + listen addr for building the multiaddrs.

Verified: builds --features chain,mesh; the 3-node mesh_clob e2e still passes.

🤖 Generated with Claude Code

The mesh used `Keypair::generate_ed25519()` — a fresh random libp2p identity on
every boot, so the node's PeerId changed on each restart. That makes cross-DC
discovery impractical: bootnode multiaddrs are `/ip4/<host>/tcp/<port>/p2p/<PeerId>`,
and a PeerId that rotates every restart can't be pinned in peers' configs.

Derive the ed25519 transport key deterministically from the operator key
(keccak256(key ‖ "surplus-mesh-libp2p-v1") as the ed25519 seed — a separate
domain-tagged hash, never the raw k256 secret). The PeerId is now stable across
restarts AND computable offline, so `SURPLUS_MESH_BOOTNODES` can be configured
once. Boot now logs the peer_id + listen addr for building those multiaddrs.

Verified: builds --features chain,mesh; the 3-node mesh_clob e2e still passes.
@drewstone drewstone merged commit 0b2b99a into main Jun 14, 2026
8 checks passed
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.

1 participant