Skip to content

feat: add custom EVM network support for local Anvil testnets#72

Merged
mickvandijke merged 2 commits intoWithAutonomi:mainfrom
mickvandijke:mick/custom-evm-network
Apr 15, 2026
Merged

feat: add custom EVM network support for local Anvil testnets#72
mickvandijke merged 2 commits intoWithAutonomi:mainfrom
mickvandijke:mick/custom-evm-network

Conversation

@mickvandijke
Copy link
Copy Markdown
Collaborator

Summary

Introduces --evm-rpc-url, --evm-payment-token, and --evm-payment-vault CLI flags (mirrored by ANT_EVM_RPC_URL / ANT_EVM_PAYMENT_TOKEN / ANT_EVM_PAYMENT_VAULT env vars) that override --evm-network, allowing nodes to point at a private Anvil instance with operator-deployed contracts instead of the public Arbitrum networks.

Adds a Custom { rpc_url, payment_token_address, payment_vault_address } variant to EvmNetworkConfig and threads it through NodeBuilder and WalletConfig via EvmNetwork::new_custom(...).

This is the same change already on mick/always-masque-relay (commit 8c3f0f3) — landing it on main avoids merge conflicts when that branch is rebased.

Motivation

The deploy/testnet-v2/ flow (and the external ant-testnet repo's testnet.py deploy) stands up a local Anvil droplet with the ANT token + payment vault deployed, then points every node at it. Without these flags, ant-node can only talk to Arbitrum One / Sepolia, so the testnet deploy fails with clap exit code 2 on unknown arguments.

Behaviour

  • --evm-rpc-url set + both address flags set → uses EvmNetworkConfig::Custom (overrides --evm-network).
  • --evm-rpc-url set but one of the address flags missing → hard error at startup.
  • Neither set → unchanged behaviour (--evm-network preset applies).

Test plan

  • cargo fmt --check passes
  • cargo clippy --all-targets -- -D warnings passes
  • cargo check --all-targets passes
  • Manual: deploy local Anvil testnet and confirm nodes connect and accept payments against the custom contracts

🤖 Generated with Claude Code

Introduces --evm-rpc-url, --evm-payment-token, and --evm-payment-vault
CLI flags that override --evm-network, allowing nodes to point at a
private Anvil instance with operator-deployed contracts instead of the
public Arbitrum networks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 15, 2026 09:37
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 support for pointing ant-node at a private/local EVM (e.g., Anvil) by allowing RPC URL + operator-deployed contract addresses to override the preset Arbitrum networks.

Changes:

  • Introduces EvmNetworkConfig::Custom { rpc_url, payment_token_address, payment_vault_address }.
  • Adds --evm-rpc-url, --evm-payment-token, --evm-payment-vault CLI flags (and env vars) to select the custom network and override --evm-network.
  • Threads the new config through payment verifier network selection and wallet config construction.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/config.rs Adds Custom EVM network config variant and updates serde representation.
src/bin/ant-node/cli.rs Adds CLI/env overrides to construct EvmNetworkConfig::Custom when --evm-rpc-url is set.
src/node.rs Extends verifier setup to support EvmNetworkConfig::Custom.
src/payment/wallet.rs Extends wallet config network mapping for Custom and adjusts constructor signature/tests.

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

Addresses Copilot review feedback on PR WithAutonomi#72.

- Add `EvmNetworkConfig::into_evm_network(self)` as the single place
  that resolves a config into the concrete `evmlib::Network`, removing
  the duplicated match arms in `node.rs` and `payment/wallet.rs`.
- Revert `WalletConfig::new` to take `EvmNetworkConfig` by value,
  restoring the pre-existing API. Consuming `self` in
  `into_evm_network` keeps clippy's `needless_pass_by_value` happy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mickvandijke mickvandijke merged commit d3f5ba9 into WithAutonomi:main Apr 15, 2026
12 checks passed
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.

3 participants