feat: add foreign chain tx config checker - #3716
Conversation
baddd27 to
3aecfd2
Compare
3aecfd2 to
926ba6b
Compare
There was a problem hiding this comment.
Not for this PR, but we should probably move this, backup CLI, ckd-example-cli (and whatever else CLI we may have) under /crates/tools.
| build_http_client(url, auth).map_err(|e| anyhow::anyhow!("failed to build HTTP client: {e}")) | ||
| } | ||
|
|
||
| fn prepare_aptos( |
There was a problem hiding this comment.
We can probably code from crates/node/src/providers/verify_foreign_tx.rs here (new_aptos_inspector and few more I guess) instead for constructiong auth&client, possibly with some refactoring.
That way we also test production path too.
There was a problem hiding this comment.
given that the mechanism there uses the fanout, it seems it would require a sizable refactor, we better leave it for a follow-up
Pull request overviewAdds a new standalone CLI, Changes:
Reviewed changesPer-file summary
FindingsNon-blocking (nits, follow-ups, suggestions):
The three previously raised threads (move under ✅ Approved |
There was a problem hiding this comment.
Pull request overview
Adds an operator-facing utility to validate foreign-chain RPC provider configuration offline, and factors shared RPC auth/url handling into a dedicated crate so both the node and the tester exercise the same auth resolution logic.
Changes:
- Introduce a new
foreign-chain-config-testerbinary crate that loads a config (--config), auto-detects or accepts--network, and checks each configured provider against a per-chain golden vector, reporting pass/fail/skip and exiting non-zero on any failure. - Extract
auth_config_to_rpc_authout ofmpc-nodeinto a new shared crateforeign-chain-rpc-auth, and update the node’s verify-foreign-tx provider wiring to use it. - Add golden vectors, per-chain check implementations, and table-style reporting (with unit tests) for the new tester.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/node/src/providers/verify_foreign_tx.rs | Switches RPC auth conversion to the new shared foreign-chain-rpc-auth crate. |
| crates/node/src/config.rs | Removes the old node-local auth_config_to_rpc_auth helper and its tests. |
| crates/node/Cargo.toml | Adds foreign-chain-rpc-auth dependency to node crate. |
| crates/foreign-chain-rpc-auth/Cargo.toml | New shared crate for converting config auth into inspector auth. |
| crates/foreign-chain-rpc-auth/src/lib.rs | Implements (and tests) the shared auth_config_to_rpc_auth helper. |
| crates/foreign-chain-config-tester/Cargo.toml | New binary crate manifest and dependencies. |
| crates/foreign-chain-config-tester/src/main.rs | CLI entrypoint, config parsing + network detection, per-provider execution, exit code logic, and some unit tests. |
| crates/foreign-chain-config-tester/src/config.rs | Parses foreign_chains subtree from YAML/TOML in multiple supported layouts; network auto-detection. |
| crates/foreign-chain-config-tester/src/golden.rs | Network-specific golden vectors and hex/felt decoding helpers (with tests). |
| crates/foreign-chain-config-tester/src/checks.rs | Per-chain inspector-based verification routines (with tests). |
| crates/foreign-chain-config-tester/src/report.rs | Aggregates results and renders a human-readable aligned report (with tests). |
| crates/foreign-chain-config-tester/README.md | Usage and output documentation, including note about potential secret exposure in URLs. |
| Cargo.toml | Adds the new crates to the workspace and workspace dependency list. |
| Cargo.lock | Locks new crates and dependency graph updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #3721