Repository navigation
v0.8.3: wallet fixes (#141 #142 #147 #148) - #154
Merged
Merged
Conversation
Once rand_sendTransaction has answered with a hash, rand prints
`submitted <kind> <hash>` on stderr (kind = the node's action.kind,
`transfer` for a plain bundle) before it waits. The commit and receipt
waits retry polls that time out, are reset or get a node error, backing
off 0.5 s -> 5 s, until the deadline; a wait that never sees the commit
is ConfirmationUnknown, which rand exits 4 on ("submitted, confirmation
unknown", the hash, the last poll's failure and a `rand tx <hash>`
hint). A rejection is still exit 1. Covers every command on the shared
wait path: send, token create/mint/burn, program deploy/call/invoke,
bond, bridge, multisig, perps and governance bundle-less actions, and
faucet.
New global --wait-timeout <SECS> / RAND_WAIT_TIMEOUT. A rescan or
height read that fails after a seen commit now says it committed.
Exit codes documented in docs/cli.md.
Fixes #141
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy
`--initial` and `--fixed-supply` now read display units at the token's own --decimals, like `token mint --amount`, `token burn` and `send --asset`: `--decimals 6 --initial 1000000` is a million tokens, not one. The base-unit form moves to `--initial-units` / `--fixed-supply-units`; clap refuses a flag together with its twin. A fractional amount past --decimals is refused, naming the flag and the -units alternative. On success `token create` echoes the mint as `minted <display> <SYMBOL> (<N> units) to <rand1…>`. Behaviour change, listed in CHANGELOG (Unreleased, v0.8.3); docs/cli.md, docs/tokens.md and docs/shielded.md updated. Fixes #142 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy
…owns
Since scan heads (v0.8.0) `leaf_page` read `rand_getScanLeaves`, trial-
decrypted the heads, and then fetched full envelopes with
`rand_getCommitments` only around the leaves `may_be_ours` matched:
first by gap-merged span, from v0.8.2 by aligned 256-leaf chunk
(RPC-201). Either way the node serving the scan saw, keyed by IP, which
leaves (or chunks) were the wallet's, and a leaf index plus its height
names the transaction.
`leaf_page` now reads `rand_getCommitments(cursor, 500)` and nothing
else, so the request sequence depends only on the cursor and the tree's
size; ownership is decided locally after the page arrives. The
heads/chunk machinery (`fetch_chunks`, `heads_page`, `may_be_ours`,
`RpcClient::{with_scan_chunk, scan_chunk}`, DEFAULT/MAX_SCAN_CHUNK) is
gone; `--scan-chunk` is still parsed (hidden) and ignored with a
warning. `RpcClient::scan_leaves` stays for other callers.
Tests: two wallets, one owning every kind of leaf and one owning none,
make byte-identical request logs (every method, every param) over the
same chain, with full pages only and no heads read; the same over 2 000
leaves of chain 21's 1 860-byte envelope, which also measures the cost:
3 885 B of JSON a leaf vs 1 720 B for a head (2.26x, the whole increase
for a wallet whose notes sat in no chunk; 1.07x for this test's wallet,
whose notes sat in 4 of 8 chunks).
Docs: shielded.md's scanning bullet now says what the node sees;
rpc.md's scan-heads section and changelog; cli.md's --scan-chunk row.
Fixes #147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy
…KS5 or HTTP Enables reqwest's `socks` feature in the client (no new crates: reqwest 0.12.28 proxies through hyper-util, already in the lock). New global `--proxy <URL>` / `RAND_PROXY` takes socks5h:// (Tor: socks5h://127.0.0.1:9050, names resolved at the proxy), socks5://, http:// or https://; anything else is refused naming --proxy. `rand` sets it as the process default before any client exists (`set_default_proxy`), so every RpcClient and every RemoteProver (--prover, `prover pair`, the trusted pool) goes through it; explicit `RpcClient::with_proxy` / `RemoteProver::with_proxy` exist too. A proxy is added with reqwest's `.proxy()`, which turns the HTTP(S)_PROXY environment off, and a proxy that is down fails the request: nothing falls back to a direct connection. Tests, against a minimal SOCKS5 stub (no auth, CONNECT): the RPC client and the remote prover reach their servers only as the stub's CONNECT target; a dead proxy fails the call; the scheme check; and the `rand` binary end to end with --proxy and with RAND_PROXY, plus a dead proxy that leaves the node untouched. Docs: --proxy row and a Tor recipe in docs/cli.md, a line in docs/shielded.md, CHANGELOG. Fixes #148 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dendisuhubdy
added a commit
that referenced
this pull request
Oct 28, 2026
- CHANGELOG.md, Unreleased v0.8.3, "Node": #156 (issues #151 #152 #153) carried no entry; its three items are added from the PR's own measurements. - docs/rpc.md changelog, "newest first": the #147 wallet entry moves up beside the other v0.8.3 entries (#154 had put it under v0.8.2), and a v0.8.3 entry records the client-visible parts of #145 and #157 — the stem's `unknown` status, the meaning of the returned hash, `-32005`, and `rand_status.admission_bytes` / `admission_budget_bytes`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four wallet fixes from the chain-21 network experiment, one commit each. All are client-only: no node, RPC or chain change.
#141:
randno longer exits 1 after a successful submitrand_sendTransactionreturns a hash,randprintssubmitted <kind> <hash>on stderr, before waiting.<kind>is the node's ownaction.kind, and a plain bundle istransfer. It goes to stderr so stdout contracts such asorder <hash>and$(rand address)don't change.faucetkeeps its existingsubmitted mint …line on stdout.wait_for_transaction) and the receipt wait (wait_for_receipt) retry status polls that time out, are reset, or get a node error. The retry delay starts at 0.5 s and doubles up to 5 s, until the wait's deadline.ConfirmationUnknownerror andrandexits 4. The message says "submitted, confirmation unknown" and gives the hash, the last poll's failure, and arand tx <hash>hint. A rejection is still exit 1.--wait-timeout <SECS>/RAND_WAIT_TIMEOUT.docs/cli.md.#142:
token create --initial/--fixed-supplytake display units--decimals, the same astoken mint --amount.--initial-units/--fixed-supply-unitstake base units; clap refuses a flag together with its-unitstwin.token createechoesminted <display> <SYMBOL> (<N> units) to <rand1…>.docs/cli.md,docs/tokens.mdanddocs/shielded.md.#147: the scan no longer reveals which leaves are the wallet's
leaf_pagenow readsrand_getCommitments(cursor, 500)and nothing else. The request sequence depends only on the cursor and the tree size, and ownership is decided locally after each page arrives.Removed the heads/chunk path:
rand_getScanLeavesreads,fetch_chunks,heads_page,may_be_ours, andRpcClient::{with_scan_chunk, scan_chunk}.--scan-chunkis still accepted (now hidden) and ignored, with a warning.Fixed the docs:
docs/shielded.md's scanning bullet (it claimed the scan "reveals nothing about which leaves are yours"), therand_getScanLeavessection and changelog indocs/rpc.md, and the--scan-chunkrow indocs/cli.md.Measured byte cost (test
a_scan_reads_the_same_full_pages_for_every_wallet_and_measures_their_cost). Setup: 2 000 leaves with chain 21's 1 860-byte envelope; the wallet owns 6 leaves spread over 4 of the 8 chunks of 256 leaves.So a full row costs 2.26× a head. That is the whole increase for a wallet whose notes fell in no chunk. For this test's wallet, whose old scan already read half the envelopes, the increase is 1.07×.
#148:
--proxy <URL>/RAND_PROXYsocksfeature. Cargo.lock is unchanged because reqwest 0.12.28 proxies through hyper-util, which is already a dependency.socks5h://(Tor:socks5h://127.0.0.1:9050),socks5://,http://,https://. Any other scheme is refused.randsets the proxy as the process default before any client exists, so every RPC client and every remote prover goes through it:--prover,prover pair, and the trusted pool.HTTP(S)_PROXYenvironment variables. If the proxy is down, the request fails; nothing falls back to a direct connection.docs/cli.md(the repo has nodocs/wallet.md) and a line todocs/shielded.md.Tests
New tests:
rand send exits 1 after a successful submit when a status poll times out #141: 6 unit tests in
lib.rs:-32603) is retried until the commit;ConfirmationUnknown;--wait-timeoutoverride wins;submittedline uses the node's kind names.Also 2 CLI tests: a faucet whose polls fail exits 4 with the hash, and a rejection exits 1;
perp orderprintssubmitted perp_order <hash>before exit 4. I updatedcreate_token_keeps_the_pending_key_when_a_call_after_the_send_fails, which now expectsConfirmationUnknown(the authority key is still kept).token create --initial / --fixed-supply read base units; every other token amount is display units #142: a unit test for the amount helper, the parse test extended to the
-unitsflags, and 2 new CLI refusal cases.Privacy: wallet scan fetches commitments only for matching leaves, revealing owned leaf indices to the RPC #147:
two_wallets_make_identical_requests_whatever_they_own: a wallet that owns every kind of leaf and one that owns none produce identical request logs (every method, every parameter), with only fixed-size pages and no heads read. Plus the 2 000-leaf measurement test above, which also checks that the two wallets' request logs are identical.Privacy: client has no SOCKS5/Tor proxy support (--proxy) #148: a minimal SOCKS5 stub. Tests: the RPC client and the remote prover each reach their server only through the stub; a dead proxy fails the call; the scheme check; and
rand --proxy/RAND_PROXYend to end, including a dead proxy that leaves the node untouched.Commands run (niced, 4 build jobs,
RAYON_NUM_THREADS=4):cargo test -p randprotocol-client --no-fail-fast: 347 passed, 0 failed, 2 ignored (the 2 arewallet_flow's existing#[ignore]d tests). Per binary: lib 248,randbin 26, cli_perp 12, cli_rpc 29, cli_scripts 3, cli_token_bridge 9, rpc_methods 10, wallet_flow 10 + 2 ignored (real-node end-to-end with proving, 1 101 s), doc-tests 0cargo clippy --no-deps -p randprotocol-client --all-targets -- -D warnings: clean.cargo check -p randprotocol-node --all-targets: clean.I did not run the full workspace suite.
Closes #141
Closes #142
Closes #147
Closes #148
🤖 Generated with Claude Code
https://claude.ai/code/session_01GFs5h141Ct6RTGGrCTQ1vy