Skip to content

fix(antd): embed mainnet bootstrap_peers.toml as compile-time fallback#55

Merged
Nic-dorman merged 2 commits into
mainfrom
fix/antd-bundle-bootstrap-peers
May 6, 2026
Merged

fix(antd): embed mainnet bootstrap_peers.toml as compile-time fallback#55
Nic-dorman merged 2 commits into
mainfrom
fix/antd-bundle-bootstrap-peers

Conversation

@Nic-dorman
Copy link
Copy Markdown
Collaborator

Summary

Closes #36.

A user who downloads only the antd release binary cannot reach mainnet out of the box: the on-disk fallback at %APPDATA%\ant\bootstrap_peers.toml is only populated by the upstream ant-client installer, and the antd release archive ships only the bare binary. The daemon logs a warning and every chunk operation fails.

This adds a third fallback tier — antd/resources/bootstrap_peers.toml is vendored from ant-client/resources/bootstrap_peers.toml and embedded via include_str!. Used only when:

  • --peers / ANTD_PEERS is empty, AND
  • the on-disk bootstrap_peers.toml is missing or empty, AND
  • --network != "local".

Existing setups (CLI/env, or anyone who already has the on-disk file from an ant-client install) are unaffected — those sources still take precedence.

Files

  • antd/resources/bootstrap_peers.toml — vendored copy of the 7 mainnet peers, with a header noting the upstream source and refresh cadence.
  • antd/src/peers.rs — new compiled_in_default_peers() parses the embedded TOML at runtime.
  • antd/src/main.rs — adds the third fallback tier between the on-disk file and the no-peers warning.
  • antd/Cargo.toml / Cargo.lock — promote toml = "0.8" from transitive to direct dep (already in lockfile, zero compile-time impact).

Test plan

  • Unit test: compiled_in_default_peers_parses_and_yields_multiaddrs confirms the embedded TOML round-trips into ≥1 valid /ip4/.../udp/.../quic MultiAddr.
  • cargo test — 19/19 pass.
  • Smoke run on Windows with %APPDATA%\ant\bootstrap_peers.toml moved aside: log shows loaded compiled-in default bootstrap peers (count=7) and the no-peers warning no longer fires.
  • Reviewer: confirm the vendored peer list at antd/resources/bootstrap_peers.toml matches the current upstream ant-client/resources/bootstrap_peers.toml. If it has rotated since this PR was opened, refresh before merge.

Refresh process

Update antd/resources/bootstrap_peers.toml whenever the upstream ant-client peer list rotates — same cadence as a regular antd release. The header comment in the file documents this.

🤖 Generated with Claude Code

Nic-dorman and others added 2 commits May 5, 2026 11:51
A user who downloads only the antd release binary cannot reach mainnet
out of the box: the on-disk fallback at %APPDATA%\ant\bootstrap_peers.toml
is only populated by the upstream ant-client installer, and the antd
release archive ships only the bare binary. The daemon then logs a
warning and every chunk operation fails.

Vendor ant-client/resources/bootstrap_peers.toml at antd/resources/
and load it via include_str! as a third tier after CLI/env and the
on-disk file. The new fallback only fires when --network != "local"
and all higher-precedence sources were empty, so existing setups are
unaffected. Refresh the vendored copy at release time if the upstream
peer list rotates.

Smoke-tested locally: with %APPDATA%\ant\bootstrap_peers.toml moved
aside, antd now logs `loaded compiled-in default bootstrap peers
(count=7)` instead of the no-peers warning.

Closes #36.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI's rustfmt 1.95.0 wants the include_str! const on a single line; my
local formatter had wrapped it. No semantic change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman merged commit 80a8ed5 into main May 6, 2026
3 checks passed
@Nic-dorman Nic-dorman deleted the fix/antd-bundle-bootstrap-peers branch May 6, 2026 12:16
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.

antd: fresh release binary cannot reach mainnet without manually copying bootstrap_peers.toml

1 participant