BWS/BWC: Fix - tx proposal amount precision loss - #4247
Open
gabrielbazan7 wants to merge 2 commits into
Open
gabrielbazan7 wants to merge 2 commits into
gabrielbazan7 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The signature fallback trusts unauthenticated mutability flags, allowing altered transaction outputs to pass verification.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Preserves transaction amount precision across BWS/BWC while maintaining transaction verification and accurate balance checks.
Changes:
- Stops default number-format conversion and validates explicit formats.
- Uses exact totals and avoids amount mutation/string concatenation.
- Adds precision, signing, routing, allowance, and escrow regressions.
File summaries
| File | Description |
|---|---|
packages/bitcore-wallet-service/test/numberformat-routes.test.ts |
Tests route format validation. |
packages/bitcore-wallet-service/test/model/txproposal.test.ts |
Tests exact totals and formatting. |
packages/bitcore-wallet-service/test/integration/server.test.ts |
Tests exact token allowance checks. |
packages/bitcore-wallet-service/test/chain/xrp.test.ts |
Tests XRP precision handling. |
packages/bitcore-wallet-service/test/chain/sol.test.ts |
Tests SOL precision handling. |
packages/bitcore-wallet-service/test/chain/eth.test.ts |
Tests ETH precision handling. |
packages/bitcore-wallet-service/test/chain/btc.test.ts |
Tests BTC string amounts. |
packages/bitcore-wallet-service/src/types/expressapp.d.ts |
Updates validation return type. |
packages/bitcore-wallet-service/src/lib/server.ts |
Uses exact allowance totals. |
packages/bitcore-wallet-service/src/lib/routes/wallets.ts |
Stops invalid-format requests. |
packages/bitcore-wallet-service/src/lib/routes/transactions.ts |
Stops invalid-format requests. |
packages/bitcore-wallet-service/src/lib/routes/helpers/error.ts |
Handles absent request context. |
packages/bitcore-wallet-service/src/lib/routes/context.ts |
Returns format-validation status. |
packages/bitcore-wallet-service/src/lib/model/txproposal.ts |
Preserves amounts and verifies rebuilt transactions. |
packages/bitcore-wallet-service/src/lib/chain/xrp/index.ts |
Uses exact XRP totals. |
packages/bitcore-wallet-service/src/lib/chain/sol/index.ts |
Uses exact SOL totals. |
packages/bitcore-wallet-service/src/lib/chain/eth/index.ts |
Uses exact ETH totals. |
packages/bitcore-wallet-service/src/lib/chain/btc/index.ts |
Avoids BTC amount mutation and concatenation. |
packages/bitcore-wallet-client/test/numberformat.test.ts |
Tests client format behavior. |
packages/bitcore-wallet-client/test/numberformat-signing.test.ts |
Tests precision-safe signing flows. |
packages/bitcore-wallet-client/test/escrow-amount-types.test.ts |
Tests BCH escrow amount types. |
packages/bitcore-wallet-client/test/amount-type-divergence.test.ts |
Documents EVM numeric divergence. |
packages/bitcore-wallet-client/src/lib/verifier.ts |
Restricts raw-signature fallback. |
packages/bitcore-wallet-client/src/lib/common/utils.ts |
Normalizes escrow arithmetic. |
packages/bitcore-wallet-client/src/lib/bulkclient.ts |
Removes default bulk formatting. |
packages/bitcore-wallet-client/src/lib/api.ts |
Omits number formatting by default. |
Review details
- Files reviewed: 25/26 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gabrielbazan7
force-pushed
the
fix/formatnumbers1
branch
from
September 16, 2026 13:23
20f3c04 to
893df43
Compare
gabrielbazan7
force-pushed
the
fix/formatnumbers1
branch
from
September 16, 2026 13:32
893df43 to
f268132
Compare
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.
Description
Fixes "Server response could not be verified" when sending an amount that a JavaScript number cannot
round-trip (e.g. 0.07 of an 18-decimal token). BWS no longer converts amount types, and BWC no longer
asks it to.
Changelog
Checklist