Area
Wallet
Affected package or service and version
@bsv/wallet-toolbox — src/sdk/WERR_errors.ts, src/sdk/WalletErrorFromJson.ts. Current on main at 82ab4d3c.
Defect
WERR_NETWORK_CHAIN is defined and faithfully deserialized, but nothing ever throws it. Occurrences across src/:
| file |
occurrences |
sdk/WERR_errors.ts |
2 (the class definition) |
sdk/WalletErrorFromJson.ts |
3 (the deserializer arm) |
sdk/__test/WalletError.test.ts |
5 (a round-trip test) |
throw new WERR_NETWORK_CHAIN appears 0 times in src/.
Its message — "Configured network chain is invalid or does not match across services" — describes a real hazard, but absent a caller-side preflight a live sync between stores on different chains simply proceeds and merges. I found no chain comparison anywhere in WalletStorageManager's sync path or in EntitySyncState.
Minimal reproduction
Static: grep -rn "throw new WERR_NETWORK_CHAIN" src/ returns nothing, while the class and its deserializer arm both exist.
Expected behavior
Either the sync handshake compares chains and throws this error before any chunk moves (makeAvailable() settings already carry the chain), or the unused error class is removed so it does not read as an implemented guard.
Actual behavior and evidence
Defined, deserializable, never thrown. A reader encountering the class reasonably concludes cross-chain sync is guarded; it is not.
For anyone auditing this: src/storage/portable/index.ts does check for a chain mismatch, but only in the separate offline importBRC38 portable-import path, and it throws a bare Error, not WERR_NETWORK_CHAIN. That check does not cover the live syncToWriter/syncFromReader/processSyncChunk path this report is about and should not be mistaken for one that does.
Environment
Static analysis of main at 82ab4d3c; no runtime claim made.
Area
Wallet
Affected package or service and version
@bsv/wallet-toolbox—src/sdk/WERR_errors.ts,src/sdk/WalletErrorFromJson.ts. Current onmainat82ab4d3c.Defect
WERR_NETWORK_CHAINis defined and faithfully deserialized, but nothing ever throws it. Occurrences acrosssrc/:sdk/WERR_errors.tssdk/WalletErrorFromJson.tssdk/__test/WalletError.test.tsthrow new WERR_NETWORK_CHAINappears 0 times insrc/.Its message — "Configured network chain is invalid or does not match across services" — describes a real hazard, but absent a caller-side preflight a live sync between stores on different chains simply proceeds and merges. I found no chain comparison anywhere in
WalletStorageManager's sync path or inEntitySyncState.Minimal reproduction
Static:
grep -rn "throw new WERR_NETWORK_CHAIN" src/returns nothing, while the class and its deserializer arm both exist.Expected behavior
Either the sync handshake compares chains and throws this error before any chunk moves (
makeAvailable()settings already carry the chain), or the unused error class is removed so it does not read as an implemented guard.Actual behavior and evidence
Defined, deserializable, never thrown. A reader encountering the class reasonably concludes cross-chain sync is guarded; it is not.
For anyone auditing this:
src/storage/portable/index.tsdoes check for a chain mismatch, but only in the separate offlineimportBRC38portable-import path, and it throws a bareError, notWERR_NETWORK_CHAIN. That check does not cover the livesyncToWriter/syncFromReader/processSyncChunkpath this report is about and should not be mistaken for one that does.Environment
Static analysis of
mainat82ab4d3c; no runtime claim made.