Repository navigation
feat: enable Safe recovery for ICP (offline mode) - #10055
Merged
Merged
Conversation
Contributor
Add an offline mode to Icp.recover()
- Icp.recover() gains broadcast?: boolean (default true); when false it
returns the signed transaction payload ({ id, tx, txHex, coin })
without submitting it to the network
- buildSafeRecoverKeyParams() gains the ecdsaMpc (slot 3) arm:
signed mode re-encrypts the derived child reduced shares under a
fresh v1 passphrase, unsigned mode returns the child common keychain;
both set broadcast: false so the coin-agnostic Safe engine stays
offline
- RecoveryOptions.userKey/backupKey/walletPassphrase are now optional so
typed unsigned sweeps compile
- Icp.recover() fails closed with RecoveryKeyMismatchError when bitgoKey
or rootAddress does not match the recovery keys
- getBuilderFactory() uses _staticsCoin so ticp builds testnet
transactions
Ticket: WCN-2886
pranishnepal
force-pushed
the
WCN-2886
branch
from
October 23, 2026 21:22
822bd96 to
5f267cc
Compare
Contributor
|
|
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.
kisslove-dewangan
left a comment
Contributor
There was a problem hiding this comment.
pls check ci test failing
danielpeng1
approved these changes
Oct 26, 2026
s84krish
approved these changes
Oct 26, 2026
Contributor
|
@claude review |
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
bhavidhingra
approved these changes
Oct 26, 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.
What
Enables Safe (offline) recovery for ICP.
Icp.recover()gains abroadcast?: booleanoption (default
true); whenfalseit returns the signed transaction payload insteadof submitting it to the network. The Safe key-derivation pipeline
(
deriveSafeWalletKeys→buildSafeRecoverKeyParams→coin.recover()) now works forICP's slot-3
ecdsaMpckeys.Why
Safe recovery (WCN-2732) requires "nothing auto-broadcasts" —
recover()is the probeduring account scanning, and ICP was the one coin whose
recover()always submitted thesweep to the live network. This change makes the offline guarantee hold at the SDK layer.
Changes
sdk-coin-icp:broadcast?: booleanonRecoveryOptions; offline returns thesigned payload (
{ id, tx, txHex, coin }) with zero network writes;userKey/backupKey/walletPassphraseoptional so typed unsigned sweeps compile; fail-closedRecoveryKeyMismatchErroronbitgoKey/rootAddressmismatch;getBuilderFactory()uses
_staticsCoin(fixesticpbuilding mainnet canister IDs).sdk-core:buildSafeRecoverKeyParamsgains theecdsaMpcarm (signed re-encryptschild reduced shares under a fresh v1 passphrase; unsigned returns the child common
keychain). Both modes set
broadcast: false— Safe recovery is offline by construction,matching every other coin's
recover().Testing
modules/sdk-coin-icp(transactionRecover.ts) andmodules/sdk-core(
safe/recovery.ts)icpSafeRecovery.ts: real DKG roots → derive → map →recover()with realDKLS 2-of-2 signing; signature verified cryptographically; broadcast never called