Skip to content

Network-upgrade check: getNetworkStatus() and unsupported_network_upgrade errors - #24

Open
ETIM-PAUL wants to merge 8 commits into
red-dev-inc:mainfrom
ETIM-PAUL:pr/network-upgrade-check
Open

ETIM-PAUL wants to merge 8 commits into
red-dev-inc:mainfrom
ETIM-PAUL:pr/network-upgrade-check

Conversation

@ETIM-PAUL

@ETIM-PAUL ETIM-PAUL commented Oct 28, 2026 •

Copy link
Copy Markdown

What

The wallet now notices when the server's chain is on a network upgrade the library doesn't support, and refuses to act on it.

  • getNetworkStatus() compares the server's GetLightdInfo (consensus branch id and height) with what the library expects at that height. It returns the list of known upgrades, the next upgrade if one is scheduled, and warnings. It never throws on a mismatch.
  • sync, create_proposed_transactions, pczt_shield and PCZT creation check first. On a mismatch they throw an Error with code: "unsupported_network_upgrade", plus chain_branch_id, chain_height and newest_known_upgrade.
  • The known upgrades come from librustzcash itself, by walking back BranchId::height_bounds, so the list stays in step with the crates.
  • If the server announces an upcoming upgrade (the upgradeName/upgradeHeight fields in the lightwalletd proto), the status reports it. If the library doesn't know that upgrade, there's an early warning.

Why

When a network upgrade activates, a wallet library that's too old can build transactions the network rejects, or scan the chain wrongly. Today it fails with low-level errors. A typed error lets apps tell users to update.

Stack

This is PR 4 of 4 and builds on #23 (and #22, #21). This PR's own changes: ETIM-PAUL/WebZjs-red-dev@pr/raw-memo-access...pr/network-upgrade-check

Testing

  • 12 unit tests use fake LightdInfo values: match, unknown branch, a library that's behind, a server that announces an upgrade, and others. fmt, clippy and the wasm build are clean.
  • Live: a testnet wallet against the testnet server, and a mainnet wallet against the mainnet server, both report supported. A testnet wallet pointed at the mainnet server is a real mismatch: getNetworkStatus() reports supported: false, and sync throws unsupported_network_upgrade with the chain fields.
  • Not seen live: the early warning. Neither public server currently announces an upcoming upgrade.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant