Skip to content

feat(elections): use static ADNL address by default#145

Merged
Keshoid merged 8 commits into
release/nodectl/v0.5.0from
feature/sma-87-use-static-adnl-address-in-elections-by-default
May 18, 2026
Merged

feat(elections): use static ADNL address by default#145
Keshoid merged 8 commits into
release/nodectl/v0.5.0from
feature/sma-87-use-static-adnl-address-in-elections-by-default

Conversation

@Keshoid
Copy link
Copy Markdown
Contributor

@Keshoid Keshoid commented May 15, 2026

Summary

Static ADNL was added as an opt-in in SMA-81. This PR makes it the default: nodectl auto-generates and persists a static ADNL per node on the first election cycle and reuses it thereafter. The motivation is that rotating ADNL every cycle breaks the Rust node's fastsync — peers that knew the validator by its previous ADNL can't locate it after the swap.

Existing elections.static_adnls entries continue to work unchanged. Operators who want the old per-cycle ephemeral behavior for a specific node can opt out.

Design

Precedence per node, evaluated each tick:

  1. Node is in the new elections.static_adnl_disabled set → fresh ephemeral ADNL each cycle (legacy behavior).
  2. Node has a elections.static_adnls[node] entry → re-register that static address.
  3. Neither → auto-generate one, persist it, then register.

Batched persistence. The runner has a per-tick "ensure static ADNL" prefix step. It collects all nodes missing a static ADNL (not disabled, not yet generated), generates each via the validator's control server, then persists every success in a single runtime_cfg.update_and_save(...) call — so 40 fresh nodes hit the config file once, not 40 times. After the first successful tick the step is a no-op.

Partial failure handling. If 38/40 succeed and 2 fail (e.g. control server temporarily unreachable), the 38 are saved; the 2 failed nodes skip this election cycle (their resolve_adnl_addr returns an error → that node's participation fails, others proceed). Next tick retries only the still-missing ones. Matches the existing pool_addr_cache pattern.

API

  • POST /v1/elections/static-adnl — unchanged, generates/rotates the static ADNL. Now also clears static_adnl_disabled for the node (rotation re-enables the static default).
  • DELETE /v1/elections/static-adnl/{node}new — opt the node out of static ADNL.
  • BindingElectionStatusDto gains static_adnl_disabled: bool, surfaced in GET /v1/elections/settings.

CLI

nodectl config elections static-adnl --node node0            # rotate / initialize
nodectl config elections static-adnl --node node0 --disable  # opt out

elections show now renders "disabled" in the Static ADNL column for opted-out nodes.

Closes SMA-87

Copilot AI review requested due to automatic review settings May 15, 2026 20:57
@linear
Copy link
Copy Markdown

linear Bot commented May 15, 2026

SMA-87

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Keshoid Keshoid requested review from ITBear and mrnkslv May 16, 2026 06:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Keshoid Keshoid requested a review from Lapo4kaKek May 17, 2026 18:32
@Keshoid Keshoid merged commit 058ae6b into release/nodectl/v0.5.0 May 18, 2026
8 of 11 checks passed
@Keshoid Keshoid deleted the feature/sma-87-use-static-adnl-address-in-elections-by-default branch May 18, 2026 07:32
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.

4 participants