Skip to content

feat: bootstrap peers auto-discovery and release cleanup#47

Open
jacderida wants to merge 2 commits intoWithAutonomi:mainfrom
jacderida:feat-bootstrap_nodes
Open

feat: bootstrap peers auto-discovery and release cleanup#47
jacderida wants to merge 2 commits intoWithAutonomi:mainfrom
jacderida:feat-bootstrap_nodes

Conversation

@jacderida
Copy link
Copy Markdown
Collaborator

Summary

  • Remove deb/rpm/msi installer artifacts from the release workflow, including WiX/systemd support files and Cargo.toml packaging metadata
  • Add bootstrap peers auto-discovery via a shipped bootstrap_peers.toml config file that the node loads automatically on startup when no --bootstrap CLI argument is provided
  • Ship 7 production bootstrap nodes across Vultr (Tokyo, Sydney, New Jersey, Los Angeles), Hetzner (Falkenstein, Ashburn), and AWS (Sao Paulo)

Bootstrap peers design

  • New BootstrapPeersConfig struct with TOML parsing and search-path discovery
  • Search order: $ANT_BOOTSTRAP_PEERS_PATH env var > exe directory > platform config dir > /etc/ant/ (unix)
  • Precedence: --bootstrap CLI > --config file > auto-discovered bootstrap_peers.toml > empty
  • Logs which bootstrap source was used on startup
  • Release archives now bundle bootstrap_peers.toml alongside the binary
  • README documents the file format, search paths per platform, and precedence rules

Test plan

  • cargo test — 301 tests pass, zero failures
  • cargo clippy — zero warnings
  • End-to-end test: spun up a DigitalOcean droplet, SCP'd the binary + config, verified auto-discovery and successful QUIC connection + DHT join to all 7 bootstrap nodes

🤖 Generated with Claude Code

…flow

The installers-linux (deb/rpm) and installers-windows (msi) jobs are no
longer needed. This removes the workflow jobs, their WiX/systemd support
files, Cargo.toml packaging metadata, and all installer references from
the sign, checksum, and release-notes steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 28, 2026 21:08
Copy link
Copy Markdown

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.

Pull request overview

Adds production bootstrap peer auto-discovery (via a shipped bootstrap_peers.toml) and simplifies the release pipeline by dropping deb/rpm/msi installer artifacts.

Changes:

  • Introduces BootstrapPeersConfig + discovery logic and logs the bootstrap source on startup.
  • Adds a shipped config/bootstrap_peers.toml with production bootstrap peer addresses and documents discovery/precedence in the README.
  • Removes packaging/installer assets (WiX/systemd metadata) and updates the release workflow to only build/sign tar/zip archives.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/config.rs Adds bootstrap peers config/discovery + unit tests.
src/bin/ant-node/cli.rs Implements precedence logic (CLI/config/auto-discover) and returns bootstrap source.
src/bin/ant-node/main.rs Logs which bootstrap source was selected at startup.
config/bootstrap_peers.toml Adds the production bootstrap peers list to ship with releases.
README.md Documents bootstrap peers file format, discovery paths, and precedence.
.github/workflows/release.yml Bundles bootstrap_peers.toml into release archives and removes installer build/signing steps.
Cargo.toml Removes deb/rpm packaging metadata.
Cargo.lock Updates lockfile for the new crate version.
CLAUDE.md Updates internal dev notes to reference the new bootstrap peers configuration approach.
wix/main.wxs Removed (dropping MSI packaging).
wix/license.rtf Removed (WiX installer asset).
systemd/ant-node.service Removed (dropping packaged systemd unit file).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

shell: pwsh
run: |
Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}", "target/${{ matrix.target }}/release/ant-keygen.exe" -DestinationPath "ant-node-cli-${{ matrix.friendly_name }}.zip"
Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}", "target/${{ matrix.target }}/release/ant-keygen.exe", "config/bootstrap_peers.toml" -DestinationPath "ant-node-cli-${{ matrix.friendly_name }}.zip"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

Windows release archive currently includes config/bootstrap_peers.toml from the repository root, which will be stored under a config/ subdirectory inside the zip. The node’s auto-discovery only checks for bootstrap_peers.toml next to the executable (and other well-known config dirs), so the shipped file won’t be found on Windows after extraction. Copy the file into target/${{ matrix.target }}/release/ (or otherwise place it at the zip root next to the binaries) and archive that path instead.

Suggested change
Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}", "target/${{ matrix.target }}/release/ant-keygen.exe", "config/bootstrap_peers.toml" -DestinationPath "ant-node-cli-${{ matrix.friendly_name }}.zip"
Copy-Item "config/bootstrap_peers.toml" "target/${{ matrix.target }}/release/bootstrap_peers.toml"
Push-Location "target/${{ matrix.target }}/release"
Compress-Archive -Path "${{ matrix.binary }}", "ant-keygen.exe", "bootstrap_peers.toml" -DestinationPath "../../../ant-node-cli-${{ matrix.friendly_name }}.zip"
Pop-Location

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. The Windows archive step now copies the file into the release directory first, matching the Unix approach. All three archive formats now place bootstrap_peers.toml next to the binary at the archive root.

Comment on lines +618 to +629
#[test]
fn test_bootstrap_peers_parse_valid_toml() {
let toml_str = r#"
peers = [
"127.0.0.1:10000",
"192.168.1.1:10001",
]
"#;
let config: BootstrapPeersConfig =
toml::from_str(toml_str).expect("valid TOML should parse");
assert_eq!(config.peers.len(), 2);
assert_eq!(config.peers[0].port(), 10000);
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

These tests rely on .expect(...) (and similar) but CI runs cargo clippy --all-targets and the repo’s clippy settings deny clippy::expect_used/unwrap_used. Add a #[allow(clippy::expect_used)] (and unwrap_used if needed) on this test module/tests (as done elsewhere in the repo), or rewrite the assertions to avoid expect/unwrap, otherwise clippy will fail in CI.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Already addressed — #[allow(clippy::unwrap_used, clippy::expect_used)] was added to the test module in the previous push.

Comment on lines +672 to +679
/// Env-var-based discovery tests must run serially because they mutate
/// a shared process-wide environment variable.
#[test]
fn test_bootstrap_peers_discover_env_var() {
// Sub-test 1: valid file with peers is discovered.
{
let dir = tempfile::tempdir().expect("create temp dir");
let path = dir.path().join("bootstrap_peers.toml");
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

This test mutates a process-wide environment variable (ANT_BOOTSTRAP_PEERS_PATH). Since the test suite runs in parallel by default, this can race with other tests and become flaky. Mark this test #[serial] (serial_test is already a dev-dependency) or use an explicit global mutex/guard to ensure env var mutations are isolated.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Added #[serial] from serial_test (already a dev-dependency) to the env var test. The two env var sub-tests were already consolidated into a single test function to reduce the race window, but #[serial] makes it robust against future additions.

Comment on lines +952 to +956
1. **Command-line arguments** (e.g., `--bootstrap`)
2. **Environment variables** (`ANT_*`)
3. **Configuration file** (`~/.ant-node/config.toml`)
3. **Configuration file** (`--config path/to/config.toml`)
4. **Bootstrap peers file** (auto-discovered `bootstrap_peers.toml`)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

README is now partially inconsistent with the actual bootstrap address format and the packaging changes in this PR: elsewhere it still describes --bootstrap/bootstrap = [...] values as libp2p multiaddrs (e.g. /ip4/.../udp/.../quic-v1), but the CLI/config types are SocketAddr and the new docs/examples use ip:port. Also, the “Running as a Service” section still references the removed systemd/ant-node.service and RPM/DEB installers. Please update those remaining sections to match the new ip:port format and the removal of installer artifacts.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Updated the CLI reference to show ip:port format instead of multiaddr, updated the config file example to use SocketAddr format with flat TOML structure, and updated the systemd section to provide an inline service file example instead of referencing the deleted systemd/ant-node.service.

@jacderida jacderida force-pushed the feat-bootstrap_nodes branch from 620c01b to 6d84b90 Compare March 28, 2026 21:19
Introduce `bootstrap_peers.toml`, a dedicated config file that provides
initial bootstrap peer addresses for joining the production network.
The file is auto-discovered on startup from well-known locations (next
to the binary, platform config dir, /etc/ant/) when no --bootstrap CLI
argument is provided.

- Add BootstrapPeersConfig struct with TOML parsing and search-path discovery
- Integrate into Cli::into_config() with clear precedence:
  --bootstrap CLI > --config file > auto-discovered bootstrap_peers.toml
- Log which bootstrap source was used on startup
- Ship bootstrap_peers.toml in release archives alongside binaries
- Add 7 production bootstrap node addresses
- Add unit tests for parsing, discovery, and edge cases
- Update README with bootstrap peers file format and search paths
- Clean up stale saorsa bootstrap references from CLAUDE.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 29, 2026 09:48
@jacderida jacderida force-pushed the feat-bootstrap_nodes branch from 6d84b90 to 3a40c14 Compare March 29, 2026 09:48
Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 9 out of 12 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if path.is_file() {
match Self::from_file(&path) {
Ok(config) if !config.peers.is_empty() => return Some((config, path)),
_ => {}
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

discover() silently ignores read/parse errors for a found bootstrap_peers.toml (including the env-var override) and falls through to other candidates/None. This can make misconfiguration hard to diagnose (the node may just report 'No bootstrap peers configured'). Consider returning a Result that surfaces the first error for the highest-priority matching path, or at least emitting a warning with the path and error.

Suggested change
_ => {}
Ok(_) => {
// Empty config: ignore and continue searching other candidates.
}
Err(err) => {
eprintln!(
"Warning: failed to load bootstrap peers from {}: {}",
path.display(),
err
);
}

Copilot uses AI. Check for mistakes.
Comment on lines 314 to 315
.\ant-node.exe --testnet
```
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

The release notes examples still use --testnet (e.g., .\ant-node.exe --testnet), but the current CLI does not define a --testnet flag (it uses --network-mode testnet). This PR also introduces production bootstrap auto-discovery via the shipped bootstrap_peers.toml, so the release notes should be updated to reflect the supported flags and the new default startup behavior.

Copilot uses AI. Check for mistakes.
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.

2 participants