Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk-core): add MPCv2 wallet creation #4438

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

alebusse
Copy link
Contributor

added MPCv2 wallet creation

WP-1686

TICKET: WP-1686

@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch 2 times, most recently from cbcd2ff to fb2416d Compare April 16, 2024 23:57
@alebusse alebusse changed the base branch from WP-0000-add-dkls-utils to master April 16, 2024 23:57
@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch 4 times, most recently from 87c629a to ac9bb4a Compare April 17, 2024 16:53
Copy link

socket-security bot commented Apr 17, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/[email protected] None 0 21.7 kB types
npm/[email protected] None 0 16.8 kB dougwilson
npm/[email protected] None 0 24.4 kB rreverser
npm/[email protected] None 0 34.6 kB tootallnate
npm/[email protected] None +2 50.9 kB sindresorhus
npm/[email protected] None 0 9.65 kB phated
npm/[email protected] None 0 5.64 kB chaijs
npm/[email protected] None 0 63.9 kB mikemcl
npm/[email protected] None +2 88.5 kB doowb
npm/[email protected] None +1 98.1 kB feross
npm/[email protected] None 0 4.37 kB sindresorhus
npm/[email protected] None +1 19.5 kB alexindigo
npm/[email protected] None 0 23.7 kB dougwilson
npm/[email protected] environment 0 29.1 kB kentcdodds
npm/[email protected] None +1 38.6 kB ljharb
npm/[email protected] None 0 11.4 kB feedic
npm/[email protected] None 0 44.6 kB feedic
npm/[email protected] environment, filesystem 0 24.9 kB motdotla
npm/[email protected] environment, filesystem 0 79.1 kB motdotla
npm/[email protected] None 0 6.23 kB mafintosh
npm/[email protected] None 0 57.7 kB feedic
npm/[email protected] eval 0 374 kB medikoo
npm/[email protected] filesystem, network +1 70.7 kB niftylettuce
npm/[email protected] filesystem +2 152 kB ryanzim
npm/[email protected] None 0 12.1 kB phated
npm/[email protected] filesystem +3 36.1 kB sindresorhus
npm/[email protected] None 0 124 kB mathias
npm/[email protected] None +3 39.6 kB dougwilson
npm/[email protected] network 0 26 kB tootallnate
npm/[email protected] None 0 336 kB ashtuchkin
npm/[email protected] None 0 10 kB evilebottnawi
npm/[email protected] None +1 19.8 kB phated
npm/[email protected] None 0 23.2 kB lukeed
npm/[email protected] None +1 30.5 kB isaacs
npm/[email protected] None 0 55.9 kB jonschlinkert
npm/[email protected] None 0 18.3 kB dougwilson
npm/[email protected] None 0 48.1 kB isaacs
npm/[email protected] None 0 7.65 kB medikoo
npm/[email protected] environment, filesystem, shell +2 54.5 kB sindresorhus
npm/[email protected] None 0 27.2 kB evilebottnawi
npm/[email protected] environment 0 29.5 kB rob-w
npm/[email protected] None 0 229 kB ljharb
npm/[email protected] None 0 6.36 kB cwmma
npm/[email protected] environment 0 124 kB matteo.collina
npm/[email protected] filesystem 0 20.5 kB paulmillr
npm/[email protected] filesystem 0 17.3 kB isaacs
npm/[email protected] None 0 94.2 kB npm-cli-ops
npm/[email protected] None 0 45 kB ljharb
npm/[email protected] None +1 9.64 kB sindresorhus
npm/[email protected] None 0 7.04 kB sindresorhus
npm/[email protected] None +1 57.9 kB gkz
npm/[email protected] None 0 14.2 kB timoxley
npm/[email protected] environment Transitive: filesystem +1 20.9 kB isaacs

🚮 Removed packages: npm/@babel/[email protected], npm/@hapi/[email protected], npm/@jridgewell/[email protected], npm/@protobufjs/[email protected], npm/@sideway/[email protected], npm/@sideway/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch 2 times, most recently from be9ebca to 2d852fe Compare April 17, 2024 17:36
// Get the BitGo public key based on user/enterprise feature flags
// If it doesn't work, use the default public key from the constants
const bitgoPublicGpgKey = (
(await this.getBitgoGpgPubkeyBasedOnFeatureFlags(params.enterprise)) ?? this.bitgoPublicGpgKey
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we switch to having DKLs using a baked in BitGo pub key instead of fetching from a server? It is much more secure that way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for now. We can do this before GA.

@zahin-mohammad zahin-mohammad marked this pull request as ready for review April 18, 2024 05:08
@zahin-mohammad zahin-mohammad requested review from a team as code owners April 18, 2024 05:08
Copy link
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(continuing review in person)

modules/sdk-core/src/bitgo/utils/tss/ecdsa/typesMPCv2.ts Outdated Show resolved Hide resolved
// Get the BitGo public key based on user/enterprise feature flags
// If it doesn't work, use the default public key from the constants
const bitgoPublicGpgKey = (
(await this.getBitgoGpgPubkeyBasedOnFeatureFlags(params.enterprise)) ?? this.bitgoPublicGpgKey
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for now. We can do this before GA.

zahin-mohammad
zahin-mohammad previously approved these changes Apr 18, 2024
MpcUtils =
this.baseCoin.getMPCAlgorithm() === 'eddsa'
? EDDSAUtils.default
: params.walletVersion === 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

walletVersion is specific to eth, it will not work for cosmos chains. What about using mpcTypeVersion instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cant introduce any new param, right now we are just using walletVersion to test but its gonna default to dkls later on, for every ecdsa coin that uses tss

}

if (isTss) {
if (!this.baseCoin.supportsTss()) {
throw new Error(`coin ${this.baseCoin.getFamily()} does not support TSS at this time`);
}
if (params.walletVersion === 5 && !this.baseCoin.supportsMPCv2()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are adding checks on walletVersion at multiple places, this will require changes when we onboard cosmos chains. I think we should introduce some other parameter like mpcVersionType and infer wallet version as 5 if it is evm chain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, cosmos chains uses a default wallet version or no wallet version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosmos chains don't use wallet version at all

* Flag indicating if this coin supports MPCv2 wallets.
* @returns {boolean} True if MPCv2 Wallets can be created for this coin
*/
supportsMPCv2(): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better move it to coinFeatures

@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch 2 times, most recently from 7d1cf4e to 4eaf7ff Compare April 18, 2024 18:38
@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch from 4eaf7ff to eaf5f62 Compare April 18, 2024 18:58
Copy link

socket-security bot commented Apr 18, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package Note
Install scripts npm/[email protected]
  • Install script: postinstall
  • Source: node -e "try{require('./_postinstall')}catch(e){}" || exit 0
Protestware/Troll package npm/[email protected]
  • Note: This package prints a protestware console message on install regarding Ukraine for users with Russian language locale

View full report↗︎

Next steps

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

What is protestware?

This package is a joke, parody, or includes undocumented or hidden behavior unrelated to its primary function.

Consider that consuming this package my come along with functionality unrelated to its primary purpose.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch 2 times, most recently from 7086f57 to ce51732 Compare April 18, 2024 23:05
@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch from ce51732 to b73d992 Compare April 25, 2024 16:52
added MPCv2 wallet creation

WP-1686

TICKET: WP-1686
@alebusse alebusse force-pushed the WP-1686-implement-mpcv2-wallet-creation branch from b73d992 to 3b15e71 Compare April 25, 2024 17:05
Copy link
Contributor

@pranavjain97 pranavjain97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@alebusse alebusse merged commit 044e057 into master Apr 26, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants