fix: allow tx sign and tx hash without an RPC URL (#2455) - #2642
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the unnecessary requirement for an RPC URL when running offline-only commands (stellar tx sign and stellar tx hash). It introduces an opt-in network resolver for non-RPC contexts while keeping the existing strict RPC-required behavior unchanged for RPC-dependent commands.
Changes:
- Added
network::Args::get_no_rpc()(backed by a sharedresolve(require_rpc)helper) to allow passphrase-only resolution with an emptyrpc_url. - Switched
tx signandtx hashto useget_no_rpc()so they work without--rpc-url. - Updated help docs and added unit + integration tests covering the new offline behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| FULL_HELP_DOCS.md | Regenerated CLI help docs to remove the stale stellar xdr [CHANNEL] argument. |
| cmd/soroban-cli/src/config/network.rs | Introduces get_no_rpc() and shared resolver; adds unit tests for passphrase-only behavior vs strict RPC behavior. |
| cmd/soroban-cli/src/commands/tx/sign.rs | Uses get_no_rpc() so signing works without an RPC URL. |
| cmd/soroban-cli/src/commands/tx/hash.rs | Uses get_no_rpc() so hashing works without an RPC URL. |
| cmd/crates/soroban-test/tests/it/tx.rs | Adds offline integration tests for tx sign and tx hash requiring only --network-passphrase. |
| cmd/crates/soroban-test/tests/it/main.rs | Registers the new tx integration test module. |
fnando
force-pushed
the
fix/2455-tx-sign-no-rpc-url
branch
from
July 27, 2026 22:38
bebe638 to
8a59b6e
Compare
fnando
enabled auto-merge (squash)
July 27, 2026 22:39
Summary
stellar tx signandstellar tx hashno longer require an RPC URL. Both only need the network passphrase (it's mixed into the transaction hash that gets signed), and neither ever contacts an RPC server. Previously they errored withnetwork passphrase is used but rpc-url is missing, forcing the--rpc-url ""workaround fromstellar tx signshouldn't require an RPC URL #2455.network::Args::get_no_rpc()alongside the existing strictget(). Both share a privateresolve(require_rpc)helper; the only difference is that a passphrase-only invocation resolves to aNetworkwith an emptyrpc_urlinstead of erroring. RPC-dependent commands keep the strictget()unchanged.tx signandtx hashtoget_no_rpc().chorecommit that regeneratesFULL_HELP_DOCS.md, dropping the stalestellar xdr [CHANNEL]arg. It's unrelated to this fix but produced bymake docs/the pre-commit hook, since the committed docs were stale onmain.Fixes #2455.
Test plan
cargo test -p soroban-cli config::network::tests— 25 passed (incl. 4 new: passphrase-only resolves with emptyrpc_url; rpc-without-passphrase still errors; both-supplied preserves the URL; strictget()still rejects passphrase-only).cargo test -p soroban-test --test it tx::— 2 new offline integration tests pass (tx sign/tx hashsucceed with only--network-passphrase).echo $TX | stellar tx sign --network-passphrase "specified manually" --sign-with-key $SKandtx hashboth succeed (signing hash matches the issue).tx sendstill errors on missing rpc-url — regression preserved.cargo clippy -p soroban-cli --all-targetsclean;cargo fmt --all --checkclean.