Skip to content

feat(cli): support custom testnets in pluto run#562

Merged
emlautarom1 merged 3 commits into
mainfrom
worktree-issue-531-custom-testnets-run
Jul 23, 2026
Merged

feat(cli): support custom testnets in pluto run#562
emlautarom1 merged 3 commits into
mainfrom
worktree-issue-531-custom-testnets-run

Conversation

@emlautarom1-agent

@emlautarom1-agent emlautarom1-agent Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #531. Part of #402 (app-wiring follow-up).

pluto run now honors a fully-specified --testnet-* custom network. The run bridge registers it via eth2util::network::add_test_network before the cluster lock is loaded in App::run, so the lock's custom genesis fork version resolves against the supported-networks registry during EIP-712 signature verification. This lifts the previous fail-fast rejection of --testnet-* for the supported path.

Why registration must precede lock load

With --no-verify off (the default), a v1.3.0+ lock's verify_signatures computes an EIP-712 digest that calls fork_version_to_chain_id -> network_from_fork_version, which rejects a fork version absent from the registry with Invalid fork version. Registering the custom testnet first makes that lookup succeed. This mirrors Charon, and follows the CLI-side registration precedent already in create_cluster.rs.

Tests

  • build_app_config_registers_fully_specified_testnet: a fully-specified testnet is registered by the bridge and its (previously-unknown) fork version then resolves via fork_version_to_network / fork_version_to_chain_id — the exact lookup the lock performs during load.
  • build_app_config_ignores_partial_testnet: a partial config is neither rejected nor registered.

Register a fully-specified --testnet-* custom network via
eth2util::network::add_test_network in the run bridge, before the
cluster lock is loaded in App::run, so the lock's custom genesis fork
version resolves against the supported-networks registry during EIP-712
signature verification (Charon app/app.go:171-173). This lifts the
former fail-fast rejection of --testnet-* in check_unsupported_flags for
the supported (fully-specified) path.

Partially-specified testnet flags stay ignored (Charon's IsNonZero
gate). The TestnetConfig->Network mapping leaks the owned CLI strings
into Network's &'static str fields (bounded to one custom testnet per
process) and clamps the i64 genesis timestamp to u64.

Closes #531

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables pluto run to honor fully-specified --testnet-* custom network flags by registering the custom network in eth2util::network before App::run loads/verifies the cluster lock, allowing fork-version lookups used during EIP-712 signature verification to succeed.

Changes:

  • Remove fail-fast rejection of fully-specified --testnet-* flags for pluto run.
  • Register a fully-specified custom testnet via pluto_eth2util::network::add_test_network during build_app_config (before App::run lock load).
  • Add tests covering (a) successful registration/lookup and (b) partial testnet flags being ignored and not registered.

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

Comment thread crates/cli/src/commands/run.rs
Comment thread crates/cli/src/commands/run.rs
@emlautarom1
emlautarom1 marked this pull request as ready for review July 22, 2026 01:18

@emlautarom1 emlautarom1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Boilerplate code (config threading). LGTM.

@emlautarom1
emlautarom1 merged commit 7dae3c7 into main Jul 23, 2026
13 checks passed
@emlautarom1
emlautarom1 deleted the worktree-issue-531-custom-testnets-run branch July 23, 2026 14:32
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.

feat(cli): support custom testnets in pluto run

3 participants