Skip to content

Commit eb39227

Browse files
committed
fix: added README plus minor fixes
1 parent 926ba6b commit eb39227

3 files changed

Lines changed: 53 additions & 6 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Foreign-chain RPC config tester
2+
3+
A standalone tool that checks the foreign-chain RPC providers in an MPC node
4+
config, so a misconfiguration (unreachable URL, wrong/expired API key, or a
5+
provider pointed at the wrong network) is caught before the node hits it in
6+
production.
7+
8+
For each configured provider it runs a fixed request against a known reference
9+
transaction — the same inspector and auth handling the node uses — and compares
10+
the result against a known-good value. Every provider is checked independently:
11+
one bad provider does not stop the others from being reported.
12+
13+
## Usage
14+
15+
```bash
16+
cargo run -p foreign-chain-config-tester -- --config /path/to/user-config.toml
17+
```
18+
19+
`--config` accepts any of the config shapes the project uses, in YAML or TOML
20+
(format is inferred from the extension):
21+
22+
- the dstack `user-config.toml` (`foreign_chains` under `mpc_node_config.node`);
23+
- the launcher config (`foreign_chains` under `node`);
24+
- the legacy `config.yaml` (`foreign_chains` at the top level).
25+
26+
### Network
27+
28+
Reference transactions are network-specific. The network is auto-detected from
29+
the config (`chain_id`, falling back to `mpc_contract_id`). Override it — or set
30+
it for configs that carry no such field — with `--network`:
31+
32+
```bash
33+
cargo run -p foreign-chain-config-tester -- --config user-config.toml --network testnet
34+
```
35+
36+
## Output
37+
38+
A row per provider, plus a summary line. The process exits non-zero if any
39+
provider failed.
40+
41+
```
42+
CHAIN PROVIDER RESULT
43+
abstract public ✓ ok
44+
bitcoin public ✓ ok
45+
starknet public ✗ inner network client failed to fetch: Transaction hash not found
46+
aptos public – skipped (no testnet reference transaction for this chain)
47+
48+
3 passed, 1 failed, 1 skipped
49+
```

crates/foreign-chain-config-tester/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ rpc_url = "https://mainnet.base.org"
151151
kind = "none"
152152
"#;
153153

154-
const RUNTIME_YAML: &str = r#"
154+
const LEGACY_YAML: &str = r#"
155155
my_near_account_id: sam.test.near
156156
foreign_chains:
157157
base:
@@ -185,10 +185,10 @@ foreign_chains:
185185
}
186186

187187
#[test]
188-
fn parse_foreign_chains__should_read_top_level_runtime_yaml() {
188+
fn parse_foreign_chains__should_read_top_level_legacy_yaml() {
189189
// Given
190190
// When
191-
let fc = parse_foreign_chains(RUNTIME_YAML, Path::new("config.yaml")).unwrap();
191+
let fc = parse_foreign_chains(LEGACY_YAML, Path::new("config.yaml")).unwrap();
192192

193193
// Then
194194
assert!(fc.base.is_some());

crates/foreign-chain-config-tester/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ use crate::report::{ProviderResult, Status};
3131

3232
/// Verify a node's foreign-chain RPC provider configuration.
3333
///
34-
/// Probes every configured provider with a fixed golden request. Any API-key
35-
/// environment variables referenced by the config must be set, exactly as when
36-
/// running the node.
34+
/// Probes every configured provider with a fixed golden request.
3735
#[derive(Parser)]
3836
#[command(about, long_about = None)]
3937
struct Args {

0 commit comments

Comments
 (0)