fix(antd): embed mainnet bootstrap_peers.toml as compile-time fallback#55
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tomlis only populated by the upstreamant-clientinstaller, 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.tomlis vendored fromant-client/resources/bootstrap_peers.tomland embedded viainclude_str!. Used only when:--peers/ANTD_PEERSis empty, ANDbootstrap_peers.tomlis missing or empty, AND--network != "local".Existing setups (CLI/env, or anyone who already has the on-disk file from an
ant-clientinstall) 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— newcompiled_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— promotetoml = "0.8"from transitive to direct dep (already in lockfile, zero compile-time impact).Test plan
compiled_in_default_peers_parses_and_yields_multiaddrsconfirms the embedded TOML round-trips into ≥1 valid/ip4/.../udp/.../quicMultiAddr.cargo test— 19/19 pass.%APPDATA%\ant\bootstrap_peers.tomlmoved aside: log showsloaded compiled-in default bootstrap peers (count=7)and the no-peers warning no longer fires.antd/resources/bootstrap_peers.tomlmatches the current upstreamant-client/resources/bootstrap_peers.toml. If it has rotated since this PR was opened, refresh before merge.Refresh process
Update
antd/resources/bootstrap_peers.tomlwhenever the upstreamant-clientpeer list rotates — same cadence as a regular antd release. The header comment in the file documents this.🤖 Generated with Claude Code