You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
client: verify each rpc_url serves the configured chain at startup #3025
The client never checks that a configured rpc_url serves the chain the config names. The node does: check_deployment_preflight (crates/node/src/runtime/mod.rs) fails bring-up when a payment chain's RPC reports a different eth_chainId.
On the client side:
build_provider (crates/client/src/provider.rs) uses .fetch_chain_id(), so it signs transactions for whatever chain the RPC reports.
build_read_provider reads without any chain check.
Only publish, sweep, receipt and node earnings compare eth_chainId themselves.
An RPC pointed at the wrong chain therefore runs decdn get, the pool commands, top-ups and decdn gateway against that chain with no error. Where a PaymentPool sits at the same address on the other chain (deterministic deploys across testnets), pool reads decode as "no record". #3015 would then retire the stored row of a funded pool.
Fix
Add an async ChainConfig::verify() in decdn-client (session.rs). It reads eth_chainId once for each distinct RPC (governance chain and each payment pool) and fails on a mismatch, with the same message shape as the node's preflight.
Call it once at the start of every client entry point: the SDK's pull/session setup (so the mobile apps and sponsord get it), decdn get, decdn gateway and the pool commands.
In build_provider, pin the verified chain id with .with_chain_id(expected) in place of .fetch_chain_id(), so no transaction is signed for a chain the config does not name.
Drop the per-command checks in publish, sweep, receipt and node earnings where the startup check now covers them.
Done when
A client command or SDK pull with a mismatched rpc_url fails before any chain read or write, naming the configured and served chain ids.
A test covers the mismatch for the SDK entry point and for decdn get.
Activity