Skip to content

server: LIGHT_NODE_PEERS — override the seed peers (relay-fleet spoke) - #26

Open
dkijania wants to merge 1 commit into
mainfrom
feat/light-node-peers
Open

server: LIGHT_NODE_PEERS — override the seed peers (relay-fleet spoke)#26
dkijania wants to merge 1 commit into
mainfrom
feat/light-node-peers

Conversation

@dkijania

Copy link
Copy Markdown
Collaborator

Lets a node dial a chosen peer set instead of the network's published seeds, keeping the network's chain_id. Paired with LIGHT_NODE_STATIC_PEERS=1, this pins a node to a trusted relay fleet — the wallet/exchange spoke in #17 — and never dials the public seeds. It's the piece #17 flagged as "the missing piece that makes static-peer mode usable by an external customer."

Change

  • LIGHT_NODE_PEERS = comma-separated multiaddrs. Parsed by parse_peer_override (trims entries, drops blanks; an all-blank value falls back to the network seeds), then leaked to 'static once at startup so the whole peer plumbing (gossip / sync-ledger reads / broadcast) stays borrow-free and unchanged. Multiaddr validity is still checked at dial time.
  • Usage for a fleet spoke: MINA_NETWORK=devnet LIGHT_NODE_PEERS=<hub1,hub2> LIGHT_NODE_STATIC_PEERS=1.

Validation

  • 3 hermetic unit tests for parse_peer_override (split/trim, drop-blank entries, all-blank → None). clippy -D warnings + fmt clean; 14 bin tests pass.
  • The static-peer connect behavior this feeds (no discovery, pin to the configured set) is already validated on the lightnet by gossip_relay / submit_mempool.
  • A live devnet override smoke test is deferred to CI / a clean environment — local runtime runs were blocked by shell/background flakiness this session (the binary itself is healthy: it starts and panics-with-message correctly foreground).

Follow-ups (still #17)

Multiple hubs + health-based failover; fold the subscribe_gossip network knobs into a GossipConfig struct; generalize persistent re-dial to discovery mode.

Refs #17

Lets a node dial a chosen peer set instead of the network's published seeds,
keeping the network's chain_id. Paired with LIGHT_NODE_STATIC_PEERS=1 this pins a
node to a trusted relay fleet (the wallet/exchange spoke in #17) and never dials
the public seeds — the missing piece that makes static-peer mode usable by an
external customer.

`LIGHT_NODE_PEERS` is comma-separated multiaddrs, parsed by `parse_peer_override`
(trims entries, drops blanks, all-blank => fall back to seeds) and leaked to
'static once at startup so the peer plumbing (gossip / sync-ledger reads /
broadcast) stays borrow-free. Multiaddr validity is checked at dial time as before.

Tested: 3 hermetic unit tests for parse_peer_override; clippy -D warnings + fmt
clean; 14 bin tests pass. The static-peer connect behavior this feeds is already
validated on the lightnet (gossip_relay / submit_mempool). A live devnet override
smoke test is left for CI / a clean env.

Refs #17

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ma8isK1FQpvLuKAPahhw5U
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