Repository navigation
Conversation
Legacy (type-0) EVM TSS transactions carry an EIP-155 signing preimage RLP([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]) in signableHex rather than a parseable serialized transaction. Previously, verification routing depended only on CoinFeature.TSS_VERIFY_USE_SERIALIZED_TX_HEX, so a type-0 transaction on an EIP-1559 chain failed to parse or skipped consistent serialized-byte verification. Add an optional CoinWithSerializedTxHexVerification hook checked by shouldVerifyWithSerializedTxHex(coin, unsignedTx) and implement it on AbstractEthLikeNewCoins using @ethereumjs/rlp to detect 6-element pre-EIP-155 and 9-element unsigned EIP-155 (r=0, s=0) legacy RLP lists. On both ECDSA MPCv1 (ecdsa.ts) and MPCv2 (ecdsaMPCv2.ts), missing or blank serializedTxHex now fails closed before signing on the serialized route, and assertSignableConsistency runs for consistency-capable coins. Type-2 EIP-1559 envelopes and pre-hashed signables (FLR/FLRP atomic, Starknet) keep their existing routes. Ticket: CECHO-2681
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
Contributor
|
|
9 tasks done
…xHex A coin with a pre-hashed route (FLR/FLRP atomic) chooses that route from serializedTxHex. When it was missing, signing fell through to the default branch and verified the SHA-256 digest as if it were a transaction. Reject the request before verification instead. Ticket: CECHO-2681
Reject 6-field pre-EIP-155 and chain-id-less 9-field legacy envelopes with InvalidTransactionError, run the coin envelope hook on feature-gated serialized-verify coins (BSC/XDC), and add the missing-serializedTxHex and pre-hashed guards to ECDSA MPCv1. Ticket: CECHO-2681
This branch has not been deployed
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
Routes legacy (type-0) EVM TSS transaction envelopes to
serializedTxHexverification even on EIP-1559 chains, instead of deciding solely fromCoinFeature.TSS_VERIFY_USE_SERIALIZED_TX_HEX.On an EIP-1559 chain, a type-0 transaction's
signableHexis the EIP-155 signing preimageRLP([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]), which is not a parseable serialized transaction under@ethereumjs/tx.Summary of changes
modules/sdk-core/src/bitgo/utils/tss/serializedTxHexVerify.ts(re-exported viatss/index.ts): adds optionalCoinWithSerializedTxHexVerificationinterface and updatesshouldVerifyWithSerializedTxHex(coin, unsignedTx?)to short-circuit onCoinFeature.TSS_VERIFY_USE_SERIALIZED_TX_HEXand otherwise delegate tocoin.shouldVerifyWithSerializedTxHex(unsignedTx).modules/abstract-eth/src/abstractEthLikeNewCoins.ts: implementsshouldVerifyWithSerializedTxHex(unsignedTx)using the existing@ethereumjs/rlpdecoder. Returnstrueonly for 6-element pre-EIP-155 or 9-element unsigned EIP-155 (r = 0, s = 0) flat RLP byte-string lists. Type-2 (0x02…), type-1 (0x01…), FLR/FLRP 32-byte pre-hashed digests, Tempo (0x76…), signed 9-element RLP, and malformed hex returnfalse.modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsa.ts&ecdsaMPCv2.ts: passunsignedTxtoshouldVerifyWithSerializedTxHex, fail closed withInvalidTransactionErrorwhenserializedTxHexis missing/blank on the serialized verification route, and runassertSignableConsistency(serializedTxHex, signableHex)for consistency-capable coins on that route.modules/sdk-core/src/bitgo/utils/tss/preHashedSignable.ts: guardsisAvalancheAtomicTxagainst undefinedserializedTxHex.Shared files with CECHO-2680 (#10203)
This PR is independent and targets
masterdirectly (not stacked on#10203). It shares two files with#10203:modules/abstract-eth/src/abstractEthLikeNewCoins.tsmodules/sdk-coin-eth/test/unit/tssPaymentVerification.tsWhichever PR merges second should rebase and re-run combined checks.
Limitations, exceptions, and open follow-ups (not claiming release readiness)
abstractEthLikeCommon.tsbuildTransactionWithNonce/updateUnsignedTxWithNewNonce) unconditionally setsserializedTxHex, and a Snowflake CDC query ofMARTS.WALLET_PLATFORM.BITGO2__TRANSACTION_REQUEST(2.85M EVM transaction txRequests from 2023-07-14 to 2026-11-19) showed 0 missing/empty values on transaction resources (all hex-less EVM txRequests weresignMessage/signTypedStructuredDatawithtransactions: []). However, CDC marts coverage cannot prove absence of pre-2023-07 Mongo documents, direct/bulk Mongo writes bypassing Mongoose schema validation, or out-of-repo writers.ecdsaMPCv2.ts,shouldUsePreHashedSignable(coin, unsignedTx)retains precedence over envelope routing, and the missing-serializedTxHexguard is scoped toverifyWithSerializedTxHex(notusePreHashedSignable) so pre-hashed flows such as FLR/FLRP atomic and Starknet are preserved without running EVMassertSignableConsistency.EvmCoin.verifyTssTransaction(modules/sdk-coin-evm/src/evmCoin.ts) still routes non-EIP-1559EvmCoinchains (kavaevm,tkavaevm,prividiumeth,tprividiumeth) throughverifyLegacyTssTransactionwithout decoding transaction bytes. Removing that bypass is tracked separately in CECHO-2683 (blocked by this ticket) and is intentionally not included here.Issue Number
CECHO-2681
Type of change
How Has This Been Tested?
yarn tsc --build --incremental) acrosssdk-lib-mpc,statics,sdk-core,abstract-eth,sdk-coin-eth,sdk-coin-bsc,sdk-coin-xdc,sdk-coin-flr,sdk-coin-flrp— 0 errors.lint-staged) +commitlint— passed.modules/sdk-core:serializedTxHexVerify.ts,preHashedSignable.ts,ecdsa.ts,ecdsaMPCv2.ts— 39 passing (including coin-detected legacy routing, missing/blank/undefinedserializedTxHexfail-closed, and FLR atomic pre-hashed precedence).modules/sdk-coin-eth:tssPaymentVerification.ts— 56 passing (including type-0 envelope detection, type-2 and pre-hashed/Tempo exclusion, full payment verifier on type-0 serialized bytes, unparsable type-0signableHexproof, and realEcdsaUtils/EcdsaMPCv2Utilssigning entry points for matching, mismatched, tamperedsignableHex, missingserializedTxHex, and type-2 direct-route regression).sdk-coin-bsc(11 passing),sdk-coin-xdc(11 passing),sdk-coin-flr(9 passing),sdk-coin-flrp(6 passing).Checklist: