fix(cli): refuse ambiguous EVM network selection (devnet manifest vs mainnet default)#156
Closed
Nic-dorman wants to merge 1 commit into
Closed
fix(cli): refuse ambiguous EVM network selection (devnet manifest vs mainnet default)#156Nic-dorman wants to merge 1 commit into
Nic-dorman wants to merge 1 commit into
Conversation
…nt-core (V2-743, V2-471) --evm-network defaulted to arbitrum-one, so a user passing --devnet-manifest with a custom EVM block (but not --evm-network local) silently paid against the mainnet vault address on the manifest's chain: the tx 'succeeds' as a no-op against an EOA, gas is spent, ANT allowance goes to a useless spender, and every chunk PUT then fails median-payment verification. The failure reads like a payment-protocol bug, not a flag bug (V2-471). - string->EvmNetwork resolution (incl. manifest evm-block parsing for 'local') moves to ant_core::config::resolve_evm_network with typed errors, per the V2-189 audit (finding #5) — frontends share one implementation - no default network: payment ops without --evm-network now fail with a clear 'choose arbitrum-one | arbitrum-sepolia | local' error before any tokens move (per the fix proposed on V2-471; magic manifest-overrides-preset precedence deliberately rejected there) - selecting a preset while the manifest carries an EVM block warns that the manifest's EVM config is ignored - ant-cli drops its direct reqwest dependency (last use was the moved URL parse) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
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
Fixes the silent-payment-failure trap around
--evm-networkand completes audit finding #5 (EVM resolution belongs in ant-core). Stacked on #155 (base branchrefactor/v2-189-cli-thinning) — merge that first, then retarget/merge this; CI runs once this retargets to main.The trap:
--evm-networkdefaulted toarbitrum-oneunconditionally, so--devnet-manifestwith a custom EVM block but without--evm-network localsilently paid against the hardcoded mainnet vault address on the manifest's chain. On Sepolia that address is an EOA: the tx "succeeds" as a no-op, gas is spent, the ANT allowance goes to a useless spender, and every subsequent chunk PUT fails median-payment verification — looking like a payment-protocol bug rather than a flag bug.Changes:
EvmNetworkresolution (including manifestevm-block parsing forlocal) moves toant_core::config::resolve_evm_networkwith typed errors (EvmNetworkAmbiguous,UnsupportedEvmNetwork,EvmManifestRequired,InvalidEvmManifest), so every frontend shares one implementation. (EvmNetworkandDevnetManifestare foreign re-exports, so the resolver is a free function inant_core::confignext toresolve_bootstrap_peersrather than an inherent method.)arbitrum-one— except when a devnet manifest carrying anevmblock is loaded. That one combination (the only path where the trap fires) now errors and asks for an explicit choice:localto use the manifest's EVM config, or a preset to override it.reqwestdependency — the moved URL parse was the last use.Testing
resolve_evm_network(mainnet default with no manifest / manifest-without-evm, ambiguous error when manifest has an evm block, preset mapping,localhappy path with URL/address round-trip, missing manifest/evm block, unknown name, bad manifest values); full workspace suite passes; clippy/fmt clean.local+ manifest → resolves;mainnet→ unsupported error;localwithout manifest → manifest-required error.🤖 Generated with Claude Code