@vultisig/core-mpc 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @vultisig/core-mpc
2
2
 
3
+ ## 1.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1813](https://github.com/vultisig/vultisig-sdk/pull/1813) [`aaa3aa9`](https://github.com/vultisig/vultisig-sdk/commit/aaa3aa93b62b6933f09ba8a33d09806d051215b9) Thanks [@Ehsan-saradar](https://github.com/Ehsan-saradar)! - fix(ripple): only declare genuine trust lines as TrustSet
8
+
9
+ `RippleSpecific.transaction_type` was set from the coin's shape alone, but an
10
+ issued-currency Payment has the identical shape — a non-native Ripple coin with
11
+ a `contractAddress`. So sending a token stamped that payload
12
+ `TRANSACTION_TYPE_RIPPLE_TRUST_SET`.
13
+
14
+ That is worse than the ambiguity it was meant to remove. Before the field
15
+ existed, a token send diverged: this SDK built a TrustSet, an iOS co-signer
16
+ built a Payment, and the ceremony failed without signing anything. With the
17
+ field set, every signer agrees to build a TrustSet — so the ceremony _completes_
18
+ over an operation the user never asked for, setting a trust-line limit to the
19
+ amount they meant to send. No funds move, and nothing surfaces it.
20
+
21
+ Declaring is an assertion, so it now requires more than the shape: a TrustSet is
22
+ addressed to the _issuer_, the party being trusted, while a Payment is addressed
23
+ to a recipient.
24
+
25
+ The signing fallback is deliberately left broad. Clients already released infer
26
+ TrustSet from a non-native coin alone, and honouring that inference is what keeps
27
+ a genuine TrustSet byte-identical across a mixed-version committee; narrowing it
28
+ would break MPC parity with every signer in the field. A token send therefore
29
+ returns to diverging safely rather than completing wrongly.
30
+
31
+ - Updated dependencies [[`2e1b8bb`](https://github.com/vultisig/vultisig-sdk/commit/2e1b8bb597d2d0fa052a121ab2757efa228314f5), [`67dd842`](https://github.com/vultisig/vultisig-sdk/commit/67dd8425a10f0c7b7833c02147fc0036e6ee7a64), [`3ea8b2c`](https://github.com/vultisig/vultisig-sdk/commit/3ea8b2c5133a16878991ec33d569fd8498837316)]:
32
+ - @vultisig/core-chain@2.35.0
33
+
3
34
  ## 1.19.0
4
35
 
5
36
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"ripple.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/mpc/keysign/chainSpecific/resolvers/ripple.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAOtD,eAAO,MAAM,2BAA2B,GAAI,oBAAoB,MAAM,GAAG,SAAS,KAAG,MAMpF,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,wBAAwB,CAAC,gBAAgB,CA0F7E,CAAA"}
1
+ {"version":3,"file":"ripple.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/mpc/keysign/chainSpecific/resolvers/ripple.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAOtD,eAAO,MAAM,2BAA2B,GAAI,oBAAoB,MAAM,GAAG,SAAS,KAAG,MAMpF,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,wBAAwB,CAAC,gBAAgB,CA8F7E,CAAA"}
@@ -8,7 +8,7 @@ import { isInError } from '@vultisig/lib-utils/error/isInError';
8
8
  import { maxBigInt } from '@vultisig/lib-utils/math/maxBigInt';
9
9
  import { BuildKeysignPayloadError } from '../../error.js';
10
10
  import { getKeysignCoin } from '../../utils/getKeysignCoin.js';
11
- import { hasRippleTrustSetShape } from '../../utils/isRippleTrustSet.js';
11
+ import { originatesRippleTrustSet } from '../../utils/isRippleTrustSet.js';
12
12
  import { resolveDestinationTag } from '../../utils/rippleDestinationTag.js';
13
13
  const minProtocolFee = 15n;
14
14
  const baseFeeMultiplier = 2n;
@@ -81,7 +81,11 @@ export const getRippleChainSpecific = async ({ keysignPayload, destinationTag, }
81
81
  // or "send this token", and the two sign different bytes — a co-signer that
82
82
  // reads the undiscriminated case as a Payment diverges from the TrustSet
83
83
  // built here, and the ceremony never completes.
84
- const isTrustSet = hasRippleTrustSetShape(keysignPayload);
84
+ //
85
+ // Only genuine originations are declared. Stamping a token send would make
86
+ // every signer agree to build a TrustSet from it, which is worse than the
87
+ // divergence: the ceremony completes over an operation nobody asked for.
88
+ const isTrustSet = originatesRippleTrustSet(keysignPayload);
85
89
  return create(RippleSpecificSchema, {
86
90
  sequence: BigInt(account_data.Sequence),
87
91
  lastLedgerSequence: getRippleLastLedgerSequence(ledgerCurrentIndex),
@@ -1 +1 @@
1
- {"version":3,"file":"ripple.js","sourceRoot":"","sources":["../../../../../../../packages/core/mpc/keysign/chainSpecific/resolvers/ripple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAA;AACtF,OAAO,EACL,oBAAoB,EACpB,eAAe,GAChB,MAAM,qEAAqE,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAE9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAGxE,MAAM,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAC5B,MAAM,+BAA+B,GAAG,UAAU,CAAA;AAClD,MAAM,wBAAwB,GAAG,E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E,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -1,17 +1,35 @@
1
1
  import { KeysignPayload } from '@vultisig/core-mpc/types/vultisig/keysign/v1/keysign_message_pb';
2
2
  /**
3
- * Whether the payload's shape alone reads as a TrustSet, i.e. how every signer
3
+ * Whether the payload's shape alone reads as a TrustSet i.e. how every signer
4
4
  * that predates `RippleSpecific.transaction_type` decides.
5
5
  *
6
- * This is what the builder uses to know it must set the field, and what the
7
- * signer falls back to when the field is absent. Keeping one definition is the
8
- * point: if the two drifted, a payload could be built as one operation and
9
- * signed as the other.
6
+ * Deliberately broad, and **only** for the signing fallback. Clients already in
7
+ * the field infer TrustSet from a non-native Ripple coin alone, so honouring
8
+ * that same inference is what keeps a TrustSet byte-identical across a
9
+ * mixed-version committee. Narrowing it would break MPC parity with every
10
+ * signer already released.
11
+ *
12
+ * Do not use this to decide what a payload *is*: an issued-currency Payment has
13
+ * the same shape. Use {@link originatesRippleTrustSet} when originating.
10
14
  *
11
15
  * A verbatim dApp transaction (`signRipple`) is excluded — it is signed exactly
12
16
  * as given and never rebuilt from the coin.
13
17
  */
14
18
  export declare const hasRippleTrustSetShape: ({ signData, coin }: KeysignPayload) => boolean;
19
+ /**
20
+ * Whether this payload is being originated as a TrustSet, and so should declare
21
+ * itself one on the wire.
22
+ *
23
+ * Stricter than {@link hasRippleTrustSetShape} because declaring is an
24
+ * assertion, not a guess. A send of an issued currency has the identical coin
25
+ * shape, and stamping that as a TrustSet would make every signer agree to build
26
+ * one — turning what used to be a safe divergence into a completed ceremony
27
+ * over an operation the user never asked for.
28
+ *
29
+ * A TrustSet is addressed to the *issuer*: it is the party being trusted. A
30
+ * Payment is addressed to a recipient. That is what separates them here.
31
+ */
32
+ export declare const originatesRippleTrustSet: (keysignPayload: KeysignPayload) => boolean;
15
33
  /**
16
34
  * Whether this Ripple payload describes a TrustSet — opening or modifying a
17
35
  * trust line, where the keysign amount is the trust-line LIMIT — rather than a
@@ -20,13 +38,9 @@ export declare const hasRippleTrustSetShape: ({ signData, coin }: KeysignPayload
20
38
  * A non-native Ripple coin cannot say this on its own: the same
21
39
  * `(currency, issuer)` pair means either operation, and the two produce
22
40
  * different signed bytes. `RippleSpecific.transaction_type` states it
23
- * explicitly, so it wins when present.
24
- *
25
- * The shape fallback is load-bearing for MPC byte-parity, not a convenience.
26
- * Clients shipped before the field infer TrustSet from a non-native coin alone,
27
- * so honouring that inference keeps a TrustSet byte-identical across a
28
- * mixed-version committee. Dropping it would break every signer already in the
29
- * field.
41
+ * explicitly, so it wins when present, and the shape decides only when it is
42
+ * absent — which is the mixed-version case documented on
43
+ * {@link hasRippleTrustSetShape}.
30
44
  */
31
45
  export declare const isRippleTrustSet: (keysignPayload: KeysignPayload) => boolean;
32
46
  //# sourceMappingURL=isRippleTrustSet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRippleTrustSet.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/mpc/keysign/utils/isRippleTrustSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iEAAiE,CAAA;AAKhG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GAAI,oBAAoB,cAAc,KAAG,OACe,CAAA;AAE3F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,cAAc,KAAG,OAQjE,CAAA"}
1
+ {"version":3,"file":"isRippleTrustSet.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/mpc/keysign/utils/isRippleTrustSet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iEAAiE,CAAA;AAMhG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAAI,oBAAoB,cAAc,KAAG,OACe,CAAA;AAE3F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GAAI,gBAAgB,cAAc,KAAG,OASzE,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,cAAc,KAAG,OAQjE,CAAA"}
@@ -1,18 +1,45 @@
1
+ import { parseRippleTokenId } from '@vultisig/core-chain/chains/ripple/issuedCurrency';
2
+ import { attempt } from '@vultisig/lib-utils/attempt';
1
3
  import { TransactionType } from '../../types/vultisig/keysign/v1/blockchain_specific_pb.js';
2
4
  import { getBlockchainSpecificValue } from '../chainSpecific/KeysignChainSpecific.js';
3
5
  /**
4
- * Whether the payload's shape alone reads as a TrustSet, i.e. how every signer
6
+ * Whether the payload's shape alone reads as a TrustSet i.e. how every signer
5
7
  * that predates `RippleSpecific.transaction_type` decides.
6
8
  *
7
- * This is what the builder uses to know it must set the field, and what the
8
- * signer falls back to when the field is absent. Keeping one definition is the
9
- * point: if the two drifted, a payload could be built as one operation and
10
- * signed as the other.
9
+ * Deliberately broad, and **only** for the signing fallback. Clients already in
10
+ * the field infer TrustSet from a non-native Ripple coin alone, so honouring
11
+ * that same inference is what keeps a TrustSet byte-identical across a
12
+ * mixed-version committee. Narrowing it would break MPC parity with every
13
+ * signer already released.
14
+ *
15
+ * Do not use this to decide what a payload *is*: an issued-currency Payment has
16
+ * the same shape. Use {@link originatesRippleTrustSet} when originating.
11
17
  *
12
18
  * A verbatim dApp transaction (`signRipple`) is excluded — it is signed exactly
13
19
  * as given and never rebuilt from the coin.
14
20
  */
15
21
  export const hasRippleTrustSetShape = ({ signData, coin }) => signData.case !== 'signRipple' && !!coin && !coin.isNativeToken && !!coin.contractAddress;
22
+ /**
23
+ * Whether this payload is being originated as a TrustSet, and so should declare
24
+ * itself one on the wire.
25
+ *
26
+ * Stricter than {@link hasRippleTrustSetShape} because declaring is an
27
+ * assertion, not a guess. A send of an issued currency has the identical coin
28
+ * shape, and stamping that as a TrustSet would make every signer agree to build
29
+ * one — turning what used to be a safe divergence into a completed ceremony
30
+ * over an operation the user never asked for.
31
+ *
32
+ * A TrustSet is addressed to the *issuer*: it is the party being trusted. A
33
+ * Payment is addressed to a recipient. That is what separates them here.
34
+ */
35
+ export const originatesRippleTrustSet = (keysignPayload) => {
36
+ if (!hasRippleTrustSetShape(keysignPayload)) {
37
+ return false;
38
+ }
39
+ const { coin, toAddress } = keysignPayload;
40
+ const issuer = attempt(() => parseRippleTokenId(coin?.contractAddress ?? '').issuer);
41
+ return 'data' in issuer && issuer.data === toAddress;
42
+ };
16
43
  /**
17
44
  * Whether this Ripple payload describes a TrustSet — opening or modifying a
18
45
  * trust line, where the keysign amount is the trust-line LIMIT — rather than a
@@ -21,13 +48,9 @@ export const hasRippleTrustSetShape = ({ signData, coin }) => signData.case !==
21
48
  * A non-native Ripple coin cannot say this on its own: the same
22
49
  * `(currency, issuer)` pair means either operation, and the two produce
23
50
  * different signed bytes. `RippleSpecific.transaction_type` states it
24
- * explicitly, so it wins when present.
25
- *
26
- * The shape fallback is load-bearing for MPC byte-parity, not a convenience.
27
- * Clients shipped before the field infer TrustSet from a non-native coin alone,
28
- * so honouring that inference keeps a TrustSet byte-identical across a
29
- * mixed-version committee. Dropping it would break every signer already in the
30
- * field.
51
+ * explicitly, so it wins when present, and the shape decides only when it is
52
+ * absent — which is the mixed-version case documented on
53
+ * {@link hasRippleTrustSetShape}.
31
54
  */
32
55
  export const isRippleTrustSet = (keysignPayload) => {
33
56
  const { transactionType } = getBlockchainSpecificValue(keysignPayload.blockchainSpecific, 'rippleSpecific');
@@ -1 +1 @@
1
- {"version":3,"file":"isRippleTrustSet.js","sourceRoot":"","sources":["../../../../../../packages/core/mpc/keysign/utils/isRippleTrustSet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAA;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAElF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAkB,EAAW,EAAE,CACpF,QAAQ,CAAC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AAE,SAAS,EAAE,GAAG,cAAc,CAAA;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAEpF,OAAO,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,CAAA;AACtD,CAAC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAA8B,EAAW,EAAE;IAC1E,MAAM,EAAE,eAAe,EAAE,GAAG,0BAA0B,CAAC,cAAc,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IAE3G,IAAI,eAAe,KAAK,eAAe,CAAC,gBAAgB,EAAE,CAAC;QACzD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,sBAAsB,CAAC,cAAc,CAAC,CAAA;AAC/C,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vultisig/core-mpc",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "MPC, keysign, and vault types shared across Vultisig clients",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1094,7 +1094,7 @@
1094
1094
  "@noble/hashes": "^1.8.0",
1095
1095
  "@solana/web3.js": "^1.98.4",
1096
1096
  "@trustwallet/wallet-core": "^4.7.0",
1097
- "@vultisig/core-chain": "2.34.0",
1097
+ "@vultisig/core-chain": "2.35.0",
1098
1098
  "@vultisig/core-config": "0.9.1",
1099
1099
  "@vultisig/lib-dkls": "0.9.0",
1100
1100
  "@vultisig/lib-mldsa": "0.9.0",