feat: network-aware EVM defaults and bootstrap-peer fallback#27
Merged
Nic-dorman merged 5 commits intomainfrom Apr 21, 2026
Merged
feat: network-aware EVM defaults and bootstrap-peer fallback#27Nic-dorman merged 5 commits intomainfrom
Nic-dorman merged 5 commits intomainfrom
Conversation
Two quality-of-life fixes for running antd against a real network without a devnet manifest. EVM defaults - New `antd/src/evm_defaults.rs` resolves `(rpc_url, token, vault)` from `--network` + optional `EVM_NETWORK` preset + individual env overrides. - When `--network default`, the preset defaults to `arbitrum-one`, picking addresses from `evmlib::Network::ArbitrumOne` so mainnet is the opt-out path rather than opt-in. - `EVM_NETWORK=arbitrum-sepolia` selects the Sepolia testnet preset; any individual `EVM_RPC_URL` / `EVM_PAYMENT_TOKEN_ADDRESS` / `EVM_PAYMENT_VAULT_ADDRESS` (or legacy `EVM_DATA_PAYMENTS_ADDRESS`) env var still overrides. - `--network local` keeps its existing `http://127.0.0.1:8545` + empty addresses default — devnet tooling still provides addresses via env. - The EVM `new_custom` call is now guarded against empty token/vault to avoid a panic in local-with-no-env scenarios, matching prior behaviour. - Both internal-signer (`AUTONOMI_WALLET_KEY` set) and external-signer branches now use the same resolver. Previously, `EVM_RPC_URL` silently defaulted to `http://127.0.0.1:8545` for every `--network default` deployment. External clients like indelible consumed that URL from `PrepareUpload` responses and failed with a confusing "dial tcp 127.0.0.1:8545" error — but only AFTER paying the full ~7 min antd encryption + quote round-trip on mainnet. Bootstrap-peer fallback - New `antd/src/peers.rs` reads ant-client's shared `bootstrap_peers.toml` (via `ant_core::config::load_bootstrap_peers`) as a fallback when `--peers` / `ANTD_PEERS` is empty and `--network` is not `local`. `SocketAddr` entries are converted to `/ip4/<ip>/udp/<port>/quic` multiaddrs. - Explicit `--peers` / env still wins. `--network local` never falls back. Previously antd required operators to know the MultiAddr format and set `ANTD_PEERS` separately from every other ant-* tool. The shared toml is already populated by ant-node installs; having antd read it matches ant-cli's behaviour and removes a setup step. Tests - `evm_defaults`: unit tests with an injected env lookup closure covering default/local/sepolia presets, individual overrides, legacy `EVM_DATA_PAYMENTS_ADDRESS`, and the precedence of `EVM_PAYMENT_VAULT_ADDRESS` over it. - `peers`: unit tests covering IPv4 and IPv6 socket → multiaddr conversion. Discovered while validating indelible PR #8 (network timeouts + DataCost probe) against Arbitrum One mainnet on 2026-04-21. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The helper's closure captures an owned HashMap via `move`, so it doesn't borrow from `pairs` and shouldn't claim to. CI's rustc rejected `+ '_` because `&[(&str, &str)]` has three possible input lifetimes and none were named. 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
Two quality-of-life fixes for running antd against a real network without a devnet manifest. Discovered while testing indelible against Arbitrum One mainnet on 2026-04-21 — both issues surfaced as confusing, late-failing errors that cost real time to debug.
1. Network-aware EVM defaults
Before this PR,
EVM_RPC_URLsilently defaulted to `http://127.0.0.1:8545\` for every `--network default` deployment. External clients consumed that URL from `PrepareUpload` responses and failed with `dial tcp 127.0.0.1:8545: connection refused` — but only after paying the full ~7 min antd encryption + quote round-trip on mainnet.New `antd/src/evm_defaults.rs` resolves `(rpc_url, token, vault)` from `--network` + optional `EVM_NETWORK` preset + individual env overrides:
2. Bootstrap-peer fallback
New `antd/src/peers.rs` reads ant-client's shared `bootstrap_peers.toml` via `ant_core::config::load_bootstrap_peers` as a fallback when `--peers` / `ANTD_PEERS` is empty and we're not on the local devnet. `SocketAddr` entries are converted to `/ip4//udp//quic` multiaddrs that saorsa-core accepts.
Explicit `--peers` / env still wins; `--network local` never falls back. Previously antd required operators to know the MultiAddr format and set `ANTD_PEERS` separately from every other ant-* tool, even though ant-node installs already populate the shared toml.
Test plan
Out of scope
Doesn't change the existing `AUTONOMI_WALLET_KEY` / internal-signer wallet loading path semantics — it just routes both branches through the same resolver.
Separately filed: antd HTTP handlers appear to be starved by saorsa-core NAT-traversal churn during initial bootstrap (20–30 min window). That's upstream in saorsa-core and has in-flight PRs.
🤖 Generated with Claude Code