fix(bsc): port transfer validation from base class into verifyTssTransaction - #9403
Draft
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Draft
fix(bsc): port transfer validation from base class into verifyTssTransaction#9403bitgo-ai-agent-dev[bot] wants to merge 3 commits into
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Conversation
Remove the stub verifyTssTransaction overrides from Bsc and BscToken that unconditionally returned true after only shallow presence checks. Both classes now inherit AbstractEthLikeNewCoins.verifyTssTransaction, which decodes txHex and validates native-BNB and BEP-20 transfers against the declared recipients. The original override was added in commit 3d29436 (COIN-3222, May 2025) to unblock a txHex-decoding crash in the transaction builder. That issue is no longer present, so the bypass can be removed. Add regression tests confirming: - Native BNB TSS transfer with matching recipient passes - Native BNB TSS transfer with mismatched recipient throws - BEP-20 TSS token transfer with matching calldata recipient passes - BEP-20 TSS token transfer with mismatched calldata recipient throws Ticket: WCI-1169 Session-Id: 4ade7ff7-085e-476d-b280-f4d3dd01c105 Task-Id: 9e3fa483-2a00-47db-aa04-c64b6f003a77
Contributor
ralph-bitgo
Bot
force-pushed
the
wci-1169-bsc-remove-weak-verifytsstransaction
branch
from
August 3, 2026 10:24
a180e39 to
b505c8b
Compare
bitgo-ai-agent-dev
Bot
force-pushed
the
wci-1169-bsc-remove-weak-verifytsstransaction
branch
from
August 3, 2026 10:24
b505c8b to
b968966
Compare
…saction Replace the unconditional-return-true stub in Bsc and BscToken with the same 'transfer' calldata validation that AbstractEthLikeNewCoins already performs: - native BNB (data === '0x'): verifies destination address and amount match the declared recipient - BEP-20 transfer() (0xa9059cbb): decodes ABI calldata, verifies recipient address and token amount, including the WalletConnect recipients[0].data fallback The original stub was introduced in commit 3d29436 (COIN-3222, May 2025) to unblock a txHex-decoding crash in the transaction builder. That issue is resolved; this brings BSC to parity with ETH and other AbstractEthLikeNewCoins coins without removing the override. The shallow presence guards (missing txParams, missing params, hop+batch conflict) are retained from the original override, with the addition of the missing txPrebuild.consolidateId check that the base class also performs. Add regression tests confirming: - Native BNB TSS transfer with matching recipient passes - Native BNB TSS transfer with mismatched recipient throws - BEP-20 TSS token transfer with matching calldata recipient passes - BEP-20 TSS token transfer with mismatched calldata recipient throws Ticket: WCI-1169 Session-Id: 4ade7ff7-085e-476d-b280-f4d3dd01c105 Task-Id: 9e3fa483-2a00-47db-aa04-c64b6f003a77
ralph-bitgo
Bot
force-pushed
the
wci-1169-bsc-remove-weak-verifytsstransaction
branch
from
August 3, 2026 11:11
2e6ca82 to
98afd5e
Compare
Replace the ethereumjs-util addHexPrefix import (not in sdk-coin-bsc deps) with an inline helper. ethereumjs-util is a transitive dep of abstract-eth, not a direct dep of sdk-coin-bsc, so relying on it was fragile. Add two tests for the WalletConnect recipients[0].data flow in verifyTssTransaction: - BEP-20 with matching recipients[0].data passes - BEP-20 with tampered txHex calldata but correct recipients[0].data throws (tampered-recipient rejection) Ticket: WCI-1169 Session-Id: 4ade7ff7-085e-476d-b280-f4d3dd01c105 Task-Id: 9e3fa483-2a00-47db-aa04-c64b6f003a77
bitgo-ai-agent-dev
Bot
force-pushed
the
wci-1169-bsc-remove-weak-verifytsstransaction
branch
from
August 3, 2026 11:14
652bec2 to
6c6f12a
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.
What
verifyTssTransactioninBsc(modules/sdk-coin-bsc/src/bsc.ts) andBscToken(modules/sdk-coin-bsc/src/bscToken.ts) with the same'transfer'calldata validationAbstractEthLikeNewCoinsalready performs:data === '0x'): verifies destination address and amount match the declared recipienttransfer()(0xa9059cbb): decodes ABI calldata, verifies recipient address and token amount, including the WalletConnectrecipients[0].datafallbacktxPrebuild.consolidateIdcheck from the base classWhy
3d294365bd(COIN-3222, May 2025) as a temporary bypass becausegetTransactionBuilder().from(txHex).build()was crashing for BSC at the time. It was never reverted, leaving BSC without any txHex-level validation for over a year.txParamsthat pass the shallow checks regardless of the actualtxHexcontents — there was no comparison between what was being signed and what the user intended.'transfer'path.Test plan
yarn run unit-test --scope @bitgo/sdk-coin-bsc— all existing tests pass, 4 newverifyTssTransactiontests passTxIntentMismatchRecipientErrorTxIntentMismatchRecipientErrorTicket: WCI-1169