Repository navigation
Use FastNear RPC for NEAR by default and accept an RPC URL as the network - #177
Conversation
…work rpc.mainnet.near.org and rpc.testnet.near.org are deprecated and rate-limit, which made transactions expire before broadcast. --network now resolves mainnet and testnet to FastNear and also accepts an RPC URL directly.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6 Astra
Verdict (advisory): Request changes
Reviewed eb4afb9eedc18bcf575ebd9cc36786842c497a5f against 97b60495905aff0e57398cf1285fe30b568ab547.
[P2] Preserve a canonical network label for cold signing — src/near/rpc.rs:48–49
The newly supported --network https://rpc.mainnet.fastnear.com is accepted by this resolver, but the cold-wallet paths for near send, DAO proposals/votes, and near sign-cold --send pass that same string to sign_transaction_cold. That function calls NearSignRequest::new, whose network allowlist is exactly mainnet/testnet (src/near/cold.rs:157, src/qr/sign_request.rs:114–125). These commands therefore fail before displaying a signing QR with:
NEAR network "https://rpc.mainnet.fastnear.com" is not one of ["mainnet", "testnet"]
I reproduced this against the built PR library: NearRpcClient::for_network(url, None) succeeds, then sign_transaction_cold(..., url, ...) returns that error. Keep URL selection separate from the signing network: either retain URLs exclusively in --rpc-url, or resolve the endpoint's canonical chain label before building the cold-signing request. Add coverage across the resolver/signing boundary; the new resolver-only test misses this failure.
Validation:
SKIP_CIRCUIT_BUILD=1 cargo test --locked --lib near::: 37 passed.SKIP_CIRCUIT_BUILD=1 cargo test --locked --lib qr::sign_request::tests::near_: 4 passed.SKIP_CIRCUIT_BUILD=1 cargo build --locked --lib, a standalone cold-signing reproduction, pinnedcargo +nightly-2026-08-31 fmt --all -- --check, andgit diff --checkcompleted successfully.- Read-only
statusandview_accountrequests succeeded against both new endpoints and reported the intended chains. Endpoint documentation checked: FastNear RPC, NEAR RPC providers. - GitHub's Linux/macOS build-and-test, format, Clippy/docs, security, and dependency checks passed; Examples was still running at the final check. No transactions were broadcast.
--network accepts mainnet, testnet, or one of their known endpoints (FastNear and rpc.*.near.org); the cold-signing request and the explorer link always use the label, which is what the wallet checks. Any other endpoint goes in --rpc-url.
|
Addressed in dc6f9c6: |
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6 Astra
Verdict (advisory): Approve
Reviewed the full diff at dc6f9c65673a7c50efe9f3f001212cce72163c3a against 97b60495905aff0e57398cf1285fe30b568ab547. The earlier cold-signing blocker is resolved: known endpoints become canonical labels before constructing NearSignRequest, and explorer links use the same resolver. RPC overrides retain precedence. No blocking findings remain.
[P3, non-blocking] Canonicalize the printed near-cli submission hint — src/cli/near.rs:458–460
With near sign-cold --network https://rpc.mainnet.fastnear.com without --send, signing now succeeds, but the suggested submission command still contains network-config https://rpc.mainnet.fastnear.com. near-cli looks up that argument as a configured network name, so the hint fails with a normal configuration. Use network_label(network) here too, producing network-config mainnet. This affects the helper text; the signed output and direct --send path remain usable.
Validation:
SKIP_CIRCUIT_BUILD=1 cargo test --locked --lib near::: 38 passed, including the new resolver and cold-request regressions.SKIP_CIRCUIT_BUILD=1 cargo test --locked --lib qr::sign_request::tests::near_: 4 passed.cargo +nightly-2026-08-31 fmt --all -- --checkandgit diff --check: passed.- Read-only
statusandview_accountcalls succeeded on both defaults; they reported the expected mainnet/testnet chains. Checked endpoint references in FastNear documentation and NEAR's provider list. No transactions were broadcast. - GitHub Linux build/tests, format, Clippy/docs, security, and dependency checks passed. macOS build/tests and Examples were still running at the final check.
rpc.mainnet.near.org/rpc.testnet.near.orgare deprecated and rate-limit; against mainnet they made transactions expire before broadcast. Everyquantus nearcommand that talks to the chain (send,dao,create-account,keys,sign-cold --send) goes throughNearRpcClient::for_network, so the change is in one place:mainnet→https://rpc.mainnet.fastnear.com,testnet→https://test.rpc.fastnear.com--networkalso accepts an RPC URL directly;--rpc-urlstill overridesTest covers the two names, a URL as network,
--rpc-urlprecedence and an unknown name.cargo test --lib near::rpcpasses, clippy clean.Replaces the RPC part of #176; the rest of that PR is covered by #174/#175.