Repository navigation
feat(sdk-coin-icp): allow account consolidations (CECHO-2439) - #9955
Merged
hitansh-madan merged 2 commits intoOct 15, 2026
Merged
hitansh-madan merged 2 commits into
hitansh-madan merged 2 commits into
Conversation
Contributor
Contributor
|
|
Override allowsAccountConsolidations() so sdk-core buildAccountConsolidations and sendAccountConsolidation(s) no longer throw for ICP. Mirrors TON (ton.ts:101); the wallet platform remains the eligibility gate (V2 wallets only).
…HO-2439) Derive the index-1 address in the V2 verification fixture the same way verifyMPCWalletAddress does (unhardened m/1, first 33 bytes) and pin the V2 contract: the derived address verifies at index 1 and is rejected at index 0; memo-suffixed addresses are rejected for V2 wallets. Builder pass-through: the fee operation keeps the bare sender address, and a memo-suffixed recipient survives building verbatim.
hitansh-madan
force-pushed
the
hitanshmadan/cecho-2439-icp-allows-consolidations-v2-tests
branch
from
October 14, 2026 09:52
77215d4 to
46063f9
Compare
hitansh-madan
marked this pull request as ready for review
October 14, 2026 10:14
parasgarg-bitgo
approved these changes
Oct 15, 2026
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.
Problem
sdk-core's account-consolidation entry points throw before doing any work for coins that don't opt in:
BaseCoin.allowsAccountConsolidations()defaults tofalse(modules/sdk-core/src/statics/baseCoin.ts:175)wallet.buildAccountConsolidations,wallet.sendAccountConsolidation, andwallet.sendAccountConsolidationsall gate on it and throw"<coin> does not allow account consolidations."(modules/sdk-core/src/bitgo/wallet/wallet.ts:3836,3887,3929)sdk-coin-icp never overrode it, so consolidating an ICP wallet through the SDK fails before the request ever reaches the wallet platform — blocking the V2 derived-address consolidation flow (funds sitting on
m/1..Nreceive addresses cannot be swept to the root from SDK-driven clients).Change
modules/sdk-coin-icp/src/icp.ts— overrideallowsAccountConsolidations()to returntrue(mirrors TON,modules/sdk-coin-ton/src/ton.ts:101). This is the only production change. The wallet platform remains the eligibility gate and enforces V2-wallets-only (CECHO-2443); the SDK flag only stops the unconditional client-side throw.Tests
isWalletAddressalready branches onwalletVersion(from #9758): v1 checks the memo-stripped root at index 0, and the v2 path verifies atparams.indexviaverifyMPCWalletAddress→deriveMPCWalletAddress(unhardenedm/{index}from the commonKeychain). What was missing was coverage of the V2 contract beyond index 0 — all existing V2 tests used index 0:verifyMPCWalletAddressdoes (new Ecdsa().deriveUnhardened(commonKeychain, 'm/1'), first 33 bytes →utils.getAddressFromPublicKey), so the expected address is traceable rather than a hardcoded literal. It verifies atindex: 1and is rejected atindex: 0, proving the index is actually used in verification.rootAddress?memoId=5is rejected for a V2 wallet; V2 must never accept memo addresses.metadata.memowithDEFAULT_MEMO(0); the fee operation keeps the bare sender address; and a memo-suffixed recipient (...?memoId=0) survives building verbatim. Builders never strip suffixes — V1 byte-compatibility and wallet-platform recipient matching both rely on that.V1 describe blocks are untouched.
CECHO-2439