Repository navigation
Description
A page can read the chain tip and the scanned height, both from the wallet summary, and no progress value. While sync() runs it cannot read the summary at all. The server's tip stays readable through get_latest_block, which takes no lock (bindgen/wallet.rs:604-610). I ran the lock behaviour at the head of #27 (9ad0a58) and read the same code on main (317d790).
How I ran it. A native harness calls the inner Rust Wallet methods that the wasm bindings wrap, over native tonic, against a public mainnet lightwalletd, at #27's head (it pins zcash_client_backend 0.25.0; main requires 0.24.0-rc.1). The key is a throwaway view key that holds no funds. The harness reads the tip through a new client on a clone of the same Channel, because the client field is pub(crate). The bindings and the browser transport were not exercised. The program and its output are in https://github.com/deegalabs/WebZjs/tree/409ce5a294db0a196a24e446f7687621bc9f3677/repro/birthday-lock-stall. Notes 1, 2 and 4 and the Ironwood paragraph are read from the code.
WalletSummaryexposeschain_tip_heightandfully_scanned_height.scan_progressis commented out (bindgen/wallet.rs:668-675 onmain, :681-690 at Feat/nu7 portable keys #27).suggest_scan_rangesexists on the innerWallet(wallet.rs:265) and has no#[wasm_bindgen]binding.sync()takes no progress callback.get_wallet_summarytakes the read lock (wallet.rs:296-302).Wallet::syncholds the write lock untilsync::runreturns (wallet.rs:279-294). So the summary call waits for the end of the sync. A page cannot read the scanned height, and so cannot draw progress from the heights, while it runs. In 3 of 3 runs, with a 50,000-block sync running,get_wallet_summaryreturned 2 to 3 ms aftersync()returned, having waited 30,081 to 35,736 ms. The tip read, an upper bound, answered in at most 18 to 58 ms.- Bounded sync steps, instance ids, close and worker poisoning #18 releases the lock between batches (sync_step), so a read can run between steps. It leaves
scan_progresscommented out (bindgen/wallet.rs:914), and so does Resumable, checkpointed full resync driven by sync steps #19. Neither adds a progress value.
One thing to fix before a progress value is exposed. The store pinned in #27 computes it from Sapling and Orchard outputs only, with no Ironwood term (wallet_read.rs:354-375). Since NU6.3 a transaction cannot add value to the Orchard pool (ZIP 2006), so a payment to an Orchard receiver lands in the Ironwood pool, and the value would leave that pool out. main pins the same progress code.
Fix to consider. Publish progress from the sync loop to the page without taking the wallet lock, for example a callback or a value updated after each batch. An open pull request on the upstream repository, ChainSafe/WebZjs#169, describes the lock problem in note 3 and adds a sync_progress() read.
🤖 Generated with Claude Code
Activity