@openzeppelin/miden-multisig-client 0.16.1 → 0.17.0-rc.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.
Files changed (207) hide show
  1. package/README.md +192 -11
  2. package/dist/account/builder.d.ts.map +1 -1
  3. package/dist/account/builder.js +32 -25
  4. package/dist/account/builder.js.map +1 -1
  5. package/dist/account/builder.test.js +73 -21
  6. package/dist/account/builder.test.js.map +1 -1
  7. package/dist/account/layout.d.ts +31 -0
  8. package/dist/account/layout.d.ts.map +1 -0
  9. package/dist/account/layout.js +31 -0
  10. package/dist/account/layout.js.map +1 -0
  11. package/dist/account/masm/account-components/auth.d.ts +1 -4
  12. package/dist/account/masm/account-components/auth.d.ts.map +1 -1
  13. package/dist/account/masm/account-components/auth.js +36 -53
  14. package/dist/account/masm/account-components/auth.js.map +1 -1
  15. package/dist/account/masm/index.d.ts +0 -1
  16. package/dist/account/masm/index.d.ts.map +1 -1
  17. package/dist/account/masm/index.js +0 -1
  18. package/dist/account/masm/index.js.map +1 -1
  19. package/dist/account/storage.d.ts +4 -0
  20. package/dist/account/storage.d.ts.map +1 -1
  21. package/dist/account/storage.js +9 -20
  22. package/dist/account/storage.js.map +1 -1
  23. package/dist/client.d.ts +4 -0
  24. package/dist/client.d.ts.map +1 -1
  25. package/dist/client.js +10 -5
  26. package/dist/client.js.map +1 -1
  27. package/dist/client.test.js +74 -16
  28. package/dist/client.test.js.map +1 -1
  29. package/dist/index.d.ts +5 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/inspector.d.ts +59 -1
  34. package/dist/inspector.d.ts.map +1 -1
  35. package/dist/inspector.js +157 -29
  36. package/dist/inspector.js.map +1 -1
  37. package/dist/inspector.test.js +246 -37
  38. package/dist/inspector.test.js.map +1 -1
  39. package/dist/multisig.d.ts +109 -33
  40. package/dist/multisig.d.ts.map +1 -1
  41. package/dist/multisig.js +307 -104
  42. package/dist/multisig.js.map +1 -1
  43. package/dist/multisig.test.js +582 -58
  44. package/dist/multisig.test.js.map +1 -1
  45. package/dist/procedures.d.ts +6 -7
  46. package/dist/procedures.d.ts.map +1 -1
  47. package/dist/procedures.js +6 -7
  48. package/dist/procedures.js.map +1 -1
  49. package/dist/proposal/metadata.d.ts.map +1 -1
  50. package/dist/proposal/metadata.js +13 -2
  51. package/dist/proposal/metadata.js.map +1 -1
  52. package/dist/proposal/metadata.test.js +57 -0
  53. package/dist/proposal/metadata.test.js.map +1 -1
  54. package/dist/prover/errors.d.ts +5 -0
  55. package/dist/prover/errors.d.ts.map +1 -1
  56. package/dist/prover/errors.js +7 -155
  57. package/dist/prover/errors.js.map +1 -1
  58. package/dist/prover/errors.test.js +5 -0
  59. package/dist/prover/errors.test.js.map +1 -1
  60. package/dist/prover/retry.d.ts +1 -6
  61. package/dist/prover/retry.d.ts.map +1 -1
  62. package/dist/prover/retry.js +5 -28
  63. package/dist/prover/retry.js.map +1 -1
  64. package/dist/prover/retry.test.js +1 -1
  65. package/dist/prover/retry.test.js.map +1 -1
  66. package/dist/prover/workflow.d.ts +4 -3
  67. package/dist/prover/workflow.d.ts.map +1 -1
  68. package/dist/prover/workflow.js +5 -2
  69. package/dist/prover/workflow.js.map +1 -1
  70. package/dist/prover/workflow.test.js +28 -3
  71. package/dist/prover/workflow.test.js.map +1 -1
  72. package/dist/retry/classify.d.ts +16 -0
  73. package/dist/retry/classify.d.ts.map +1 -0
  74. package/dist/retry/classify.js +187 -0
  75. package/dist/retry/classify.js.map +1 -0
  76. package/dist/retry/runtime.d.ts +13 -0
  77. package/dist/retry/runtime.d.ts.map +1 -0
  78. package/dist/retry/runtime.js +33 -0
  79. package/dist/retry/runtime.js.map +1 -0
  80. package/dist/rpc/config.d.ts +11 -0
  81. package/dist/rpc/config.d.ts.map +1 -0
  82. package/dist/rpc/config.js +17 -0
  83. package/dist/rpc/config.js.map +1 -0
  84. package/dist/rpc/config.test.d.ts +2 -0
  85. package/dist/rpc/config.test.d.ts.map +1 -0
  86. package/dist/rpc/config.test.js +24 -0
  87. package/dist/rpc/config.test.js.map +1 -0
  88. package/dist/rpc/errors.d.ts +2 -0
  89. package/dist/rpc/errors.d.ts.map +1 -0
  90. package/dist/rpc/errors.js +11 -0
  91. package/dist/rpc/errors.js.map +1 -0
  92. package/dist/rpc/errors.test.d.ts +2 -0
  93. package/dist/rpc/errors.test.d.ts.map +1 -0
  94. package/dist/rpc/errors.test.js +34 -0
  95. package/dist/rpc/errors.test.js.map +1 -0
  96. package/dist/rpc/retry.d.ts +4 -0
  97. package/dist/rpc/retry.d.ts.map +1 -0
  98. package/dist/rpc/retry.js +6 -0
  99. package/dist/rpc/retry.js.map +1 -0
  100. package/dist/rpc/retry.test.d.ts +2 -0
  101. package/dist/rpc/retry.test.d.ts.map +1 -0
  102. package/dist/rpc/retry.test.js +98 -0
  103. package/dist/rpc/retry.test.js.map +1 -0
  104. package/dist/transaction/index.d.ts +1 -1
  105. package/dist/transaction/index.d.ts.map +1 -1
  106. package/dist/transaction/index.js +1 -1
  107. package/dist/transaction/index.js.map +1 -1
  108. package/dist/transaction/p2id.d.ts +17 -6
  109. package/dist/transaction/p2id.d.ts.map +1 -1
  110. package/dist/transaction/p2id.js +22 -31
  111. package/dist/transaction/p2id.js.map +1 -1
  112. package/dist/transaction/p2id.test.js +62 -24
  113. package/dist/transaction/p2id.test.js.map +1 -1
  114. package/dist/transaction/summary.d.ts +45 -2
  115. package/dist/transaction/summary.d.ts.map +1 -1
  116. package/dist/transaction/summary.js +42 -2
  117. package/dist/transaction/summary.js.map +1 -1
  118. package/dist/transaction/summary.test.d.ts +2 -0
  119. package/dist/transaction/summary.test.d.ts.map +1 -0
  120. package/dist/transaction/summary.test.js +26 -0
  121. package/dist/transaction/summary.test.js.map +1 -0
  122. package/dist/transaction/updateGuardian.d.ts.map +1 -1
  123. package/dist/transaction/updateGuardian.js +16 -18
  124. package/dist/transaction/updateGuardian.js.map +1 -1
  125. package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
  126. package/dist/transaction/updateProcedureThreshold.js +15 -17
  127. package/dist/transaction/updateProcedureThreshold.js.map +1 -1
  128. package/dist/transaction/updateSigners.d.ts +6 -1
  129. package/dist/transaction/updateSigners.d.ts.map +1 -1
  130. package/dist/transaction/updateSigners.js +20 -17
  131. package/dist/transaction/updateSigners.js.map +1 -1
  132. package/dist/transaction.d.ts +2 -2
  133. package/dist/transaction.d.ts.map +1 -1
  134. package/dist/transaction.js +1 -1
  135. package/dist/transaction.js.map +1 -1
  136. package/dist/types/proposal.d.ts +28 -4
  137. package/dist/types/proposal.d.ts.map +1 -1
  138. package/dist/types/proposal.js +18 -0
  139. package/dist/types/proposal.js.map +1 -1
  140. package/dist/types.d.ts +0 -1
  141. package/dist/types.d.ts.map +1 -1
  142. package/dist/utils/signature.d.ts +11 -7
  143. package/dist/utils/signature.d.ts.map +1 -1
  144. package/dist/utils/signature.js +24 -58
  145. package/dist/utils/signature.js.map +1 -1
  146. package/dist/utils/word.d.ts +7 -0
  147. package/dist/utils/word.d.ts.map +1 -1
  148. package/dist/utils/word.js +15 -0
  149. package/dist/utils/word.js.map +1 -1
  150. package/masm/account_components/auth/guarded_multisig.masm +42 -0
  151. package/package.json +7 -4
  152. package/src/account/builder.test.ts +111 -45
  153. package/src/account/builder.ts +45 -33
  154. package/src/account/layout.ts +33 -0
  155. package/src/account/masm/account-components/auth.ts +36 -56
  156. package/src/account/masm/index.ts +0 -1
  157. package/src/account/storage.ts +9 -22
  158. package/src/client.test.ts +87 -16
  159. package/src/client.ts +16 -3
  160. package/src/index.ts +27 -1
  161. package/src/inspector.test.ts +330 -38
  162. package/src/inspector.ts +196 -33
  163. package/src/multisig.test.ts +680 -63
  164. package/src/multisig.ts +400 -115
  165. package/src/procedures.ts +6 -7
  166. package/src/proposal/metadata.test.ts +76 -0
  167. package/src/proposal/metadata.ts +13 -2
  168. package/src/prover/errors.test.ts +8 -0
  169. package/src/prover/errors.ts +7 -175
  170. package/src/prover/retry.test.ts +1 -1
  171. package/src/prover/retry.ts +10 -35
  172. package/src/prover/workflow.test.ts +40 -4
  173. package/src/prover/workflow.ts +16 -4
  174. package/src/retry/classify.ts +220 -0
  175. package/src/retry/runtime.ts +45 -0
  176. package/src/rpc/config.test.ts +45 -0
  177. package/src/rpc/config.ts +30 -0
  178. package/src/rpc/errors.test.ts +69 -0
  179. package/src/rpc/errors.ts +12 -0
  180. package/src/rpc/retry.test.ts +144 -0
  181. package/src/rpc/retry.ts +12 -0
  182. package/src/transaction/index.ts +7 -1
  183. package/src/transaction/p2id.test.ts +112 -31
  184. package/src/transaction/p2id.ts +39 -38
  185. package/src/transaction/summary.test.ts +32 -0
  186. package/src/transaction/summary.ts +83 -4
  187. package/src/transaction/updateGuardian.ts +15 -25
  188. package/src/transaction/updateProcedureThreshold.ts +13 -29
  189. package/src/transaction/updateSigners.ts +38 -30
  190. package/src/transaction.ts +8 -1
  191. package/src/types/proposal.ts +43 -4
  192. package/src/types.ts +0 -1
  193. package/src/utils/signature.ts +32 -65
  194. package/src/utils/word.ts +17 -0
  195. package/dist/account/masm/auth.d.ts +0 -5
  196. package/dist/account/masm/auth.d.ts.map +0 -1
  197. package/dist/account/masm/auth.js +0 -1509
  198. package/dist/account/masm/auth.js.map +0 -1
  199. package/masm/account_components/auth/multisig.masm +0 -12
  200. package/masm/account_components/auth/multisig_ecdsa.masm +0 -12
  201. package/masm/account_components/auth/multisig_guardian.masm +0 -16
  202. package/masm/account_components/auth/multisig_guardian_ecdsa.masm +0 -16
  203. package/masm/auth/guardian.masm +0 -199
  204. package/masm/auth/guardian_ecdsa.masm +0 -195
  205. package/masm/auth/multisig.masm +0 -554
  206. package/masm/auth/multisig_ecdsa.masm +0 -554
  207. package/src/account/masm/auth.ts +0 -1512
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EAEpB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,wBAAwB,EACxB,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAElB,MAAM,iBAAiB,CAAC"}
@@ -11,11 +11,21 @@ export interface DetectedMultisigConfig {
11
11
  threshold: number;
12
12
  numSigners: number;
13
13
  signerCommitments: string[];
14
- guardianEnabled: boolean;
15
14
  guardianCommitment: string | null;
16
15
  vaultBalances: VaultBalance[];
17
16
  procedureThresholds: Map<ProcedureName, number>;
18
17
  }
18
+ /**
19
+ * Fail-closed validation for consuming a lenient `fromAccount()` result on a
20
+ * mutation path. `fromAccount` tolerates partial reads (absent entries are
21
+ * skipped), which is fine for inspection but not for callers that store the
22
+ * result as the authoritative config: membership proposals treat the signer
23
+ * set as the complete on-chain set, so adopting a truncated read could
24
+ * rewrite the account without the omitted keys.
25
+ */
26
+ export declare function assertCompleteDetectedConfig(detected: DetectedMultisigConfig): asserts detected is DetectedMultisigConfig & {
27
+ guardianCommitment: string;
28
+ };
19
29
  /**
20
30
  * Inspects an account to detect its multisig configuration.
21
31
  *
@@ -31,6 +41,49 @@ export interface DetectedMultisigConfig {
31
41
  */
32
42
  export declare class AccountInspector {
33
43
  private constructor();
44
+ /**
45
+ * Read the ordered approver (signer) public-key commitments of a
46
+ * guarded-multisig account from its
47
+ * `miden::standards::auth::multisig::approver_public_keys` storage map.
48
+ *
49
+ * Since the account uses the upstream `AuthGuardedMultisig` component,
50
+ * `Account.getPublicKeyCommitments()` also returns these commitments;
51
+ * this accessor is the strict, layout-insulated alternative: it validates
52
+ * the complete set against the configured signer count and throws instead
53
+ * of silently omitting unreadable entries, and it shields consumers from
54
+ * storage-layout changes across contract versions.
55
+ *
56
+ * The returned array is ordered by signer index as currently stored.
57
+ * Index 0 is the key listed first at creation only until the first
58
+ * membership change: removing a signer re-packs the indices. Hot/cold
59
+ * roles are a consumer-side convention, not part of on-chain state.
60
+ *
61
+ * Unlike `fromAccount()`, which tolerates partial reads, this throws if
62
+ * the account was built from a different contract version or any signer
63
+ * entry is absent — it never silently returns a truncated or empty list.
64
+ *
65
+ * The `account` must come from the same copy of `@miden-sdk/miden-sdk`
66
+ * that this package links; an account from a separately bundled SDK is
67
+ * rejected by the SDK's own instance checks (a descriptive error is
68
+ * thrown).
69
+ *
70
+ * @param account - The Account object from the Miden SDK
71
+ * @returns Signer public-key commitments as 0x-prefixed hex, ordered by signer index
72
+ */
73
+ static getSignerPublicKeyCommitments(account: Account): string[];
74
+ /**
75
+ * Read the guardian public-key commitment of a guarded-multisig account
76
+ * from its `miden::standards::auth::guardian::pub_key` storage map.
77
+ *
78
+ * The guarded-multisig component always includes a guardian, so this
79
+ * returns the commitment or throws: on an account from a different
80
+ * contract version, or when the guardian key entry is missing
81
+ * (inconsistent account state). Genuine storage read failures propagate.
82
+ *
83
+ * @param account - The Account object from the Miden SDK
84
+ * @returns The guardian commitment as 0x-prefixed hex
85
+ */
86
+ static getGuardianPublicKeyCommitment(account: Account): string;
34
87
  /**
35
88
  * Inspect a base64-encoded serialized account.
36
89
  *
@@ -41,6 +94,11 @@ export declare class AccountInspector {
41
94
  /**
42
95
  * Inspect a Miden SDK Account object.
43
96
  *
97
+ * Lenient by design (skips unreadable parts): `MultisigClient.load` uses
98
+ * it to reconstruct config from accounts it already trusts. Consumers that
99
+ * need a guarantee should use `getSignerPublicKeyCommitments` /
100
+ * `getGuardianPublicKeyCommitment`, which throw instead of degrading.
101
+ *
44
102
  * @param account - The Account object from Miden SDK
45
103
  * @returns Detected multisig configuration
46
104
  */
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAe1F,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,mBAAmB,EAAE,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAC3B,OAAO;IAEP;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,sBAAsB;IAM7D;;;;;OAKG;IAEH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB;CAkF7D"}
1
+ {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAK1F,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,mBAAmB,EAAE,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;CACjD;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAAC,QAAQ,IAAI,sBAAsB,GAAG;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAW7E;AA0DD;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAC3B,OAAO;IAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE;IAsChE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAa/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,sBAAsB;IAM7D;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB;CAgF7D"}
package/dist/inspector.js CHANGED
@@ -3,19 +3,70 @@
3
3
  */
4
4
  import { Account, Word } from '@miden-sdk/miden-sdk';
5
5
  import { base64ToUint8Array } from './utils/encoding.js';
6
- import { wordElementToBigInt, wordToHex } from './utils/word.js';
6
+ import { isEmptyWord, wordElementToBigInt, wordToHex } from './utils/word.js';
7
7
  import { getProcedureRoot, getProcedureNames } from './procedures.js';
8
- // Storage slot names matching the MASM definitions
9
- const MULTISIG_SLOT_NAMES = {
10
- THRESHOLD_CONFIG: 'openzeppelin::multisig::threshold_config',
11
- SIGNER_PUBLIC_KEYS: 'openzeppelin::multisig::signer_public_keys',
12
- EXECUTED_TRANSACTIONS: 'openzeppelin::multisig::executed_transactions',
13
- PROCEDURE_THRESHOLDS: 'openzeppelin::multisig::procedure_thresholds',
14
- };
15
- const GUARDIAN_SLOT_NAMES = {
16
- SELECTOR: 'openzeppelin::guardian::selector',
17
- PUBLIC_KEY: 'openzeppelin::guardian::public_key',
18
- };
8
+ import { MULTISIG_SLOT_NAMES, GUARDIAN_SLOT_NAMES, MAX_SIGNERS } from './account/layout.js';
9
+ /**
10
+ * Fail-closed validation for consuming a lenient `fromAccount()` result on a
11
+ * mutation path. `fromAccount` tolerates partial reads (absent entries are
12
+ * skipped), which is fine for inspection but not for callers that store the
13
+ * result as the authoritative config: membership proposals treat the signer
14
+ * set as the complete on-chain set, so adopting a truncated read could
15
+ * rewrite the account without the omitted keys.
16
+ */
17
+ export function assertCompleteDetectedConfig(detected) {
18
+ if (detected.numSigners === 0 || detected.signerCommitments.length !== detected.numSigners) {
19
+ throw new Error(`incomplete signer set: storage reports ${detected.numSigners} signers, read ${detected.signerCommitments.length}`);
20
+ }
21
+ if (!detected.guardianCommitment) {
22
+ throw new Error('missing guardian commitment: the guarded-multisig always includes a guardian');
23
+ }
24
+ }
25
+ /**
26
+ * Rejects accounts built from a different contract version before any
27
+ * layout-dependent read: against such an account the slot names and
28
+ * procedure-root-keyed maps below describe a different component, so reads
29
+ * would silently miss its state.
30
+ */
31
+ function assertPinnedContractVersion(account) {
32
+ if (!account.code().hasProcedure(Word.fromHex(getProcedureRoot('auth_tx')))) {
33
+ throw new Error('unsupported contract version: the account\'s code does not carry this ' +
34
+ "SDK's pinned guarded-multisig auth procedure; use the SDK release " +
35
+ 'matching the contract version the account was created with ' +
36
+ '(see docs/MULTISIG_SDK.md, "Contract version pinning")');
37
+ }
38
+ }
39
+ function indexMapKey(index) {
40
+ return new Word(new BigUint64Array([BigInt(index), 0n, 0n, 0n]));
41
+ }
42
+ /**
43
+ * Read one entry from a storage map, treating "no entry" uniformly.
44
+ *
45
+ * The SDK returns `undefined` only when the slot itself is absent or not a
46
+ * map; a key with no entry in an existing map comes back as `Word::empty()`
47
+ * (`StorageMap::get` is `unwrap_or_default()` in miden-protocol). The
48
+ * contract also zeroes removed approver entries, so an empty word always
49
+ * means "no entry" and is mapped to `undefined` here — matching the Rust
50
+ * readers.
51
+ */
52
+ function readMapWord(storage, slotName, key) {
53
+ let value;
54
+ try {
55
+ value = storage.getMapItem(slotName, key);
56
+ }
57
+ catch (error) {
58
+ // The SDK's storage rejects Word instances constructed by a different
59
+ // bundled copy of @miden-sdk/miden-sdk (wasm-bindgen instance check).
60
+ if (error instanceof Error && error.message.includes('expected instance of Word')) {
61
+ throw new Error(`cannot read ${slotName}: the account object comes from a different copy of @miden-sdk/miden-sdk than the one this package links; pass an Account created by the same SDK instance`, { cause: error });
62
+ }
63
+ throw error;
64
+ }
65
+ if (value === undefined || isEmptyWord(value)) {
66
+ return undefined;
67
+ }
68
+ return value;
69
+ }
19
70
  /**
20
71
  * Inspects an account to detect its multisig configuration.
21
72
  *
@@ -31,6 +82,80 @@ const GUARDIAN_SLOT_NAMES = {
31
82
  */
32
83
  export class AccountInspector {
33
84
  constructor() { }
85
+ /**
86
+ * Read the ordered approver (signer) public-key commitments of a
87
+ * guarded-multisig account from its
88
+ * `miden::standards::auth::multisig::approver_public_keys` storage map.
89
+ *
90
+ * Since the account uses the upstream `AuthGuardedMultisig` component,
91
+ * `Account.getPublicKeyCommitments()` also returns these commitments;
92
+ * this accessor is the strict, layout-insulated alternative: it validates
93
+ * the complete set against the configured signer count and throws instead
94
+ * of silently omitting unreadable entries, and it shields consumers from
95
+ * storage-layout changes across contract versions.
96
+ *
97
+ * The returned array is ordered by signer index as currently stored.
98
+ * Index 0 is the key listed first at creation only until the first
99
+ * membership change: removing a signer re-packs the indices. Hot/cold
100
+ * roles are a consumer-side convention, not part of on-chain state.
101
+ *
102
+ * Unlike `fromAccount()`, which tolerates partial reads, this throws if
103
+ * the account was built from a different contract version or any signer
104
+ * entry is absent — it never silently returns a truncated or empty list.
105
+ *
106
+ * The `account` must come from the same copy of `@miden-sdk/miden-sdk`
107
+ * that this package links; an account from a separately bundled SDK is
108
+ * rejected by the SDK's own instance checks (a descriptive error is
109
+ * thrown).
110
+ *
111
+ * @param account - The Account object from the Miden SDK
112
+ * @returns Signer public-key commitments as 0x-prefixed hex, ordered by signer index
113
+ */
114
+ static getSignerPublicKeyCommitments(account) {
115
+ assertPinnedContractVersion(account);
116
+ const storage = account.storage();
117
+ const thresholdConfig = storage.getItem(MULTISIG_SLOT_NAMES.THRESHOLD_CONFIG);
118
+ if (!thresholdConfig) {
119
+ throw new Error(`account has no ${MULTISIG_SLOT_NAMES.THRESHOLD_CONFIG} storage slot: not a guarded-multisig account`);
120
+ }
121
+ const numSigners = Number(wordElementToBigInt(thresholdConfig, 1));
122
+ if (numSigners === 0) {
123
+ throw new Error(`${MULTISIG_SLOT_NAMES.THRESHOLD_CONFIG} reports zero signers: not a guarded-multisig account`);
124
+ }
125
+ if (numSigners > MAX_SIGNERS) {
126
+ throw new Error(`${MULTISIG_SLOT_NAMES.THRESHOLD_CONFIG} reports ${numSigners} signers, exceeding the sanity limit of ${MAX_SIGNERS}: account storage is corrupt`);
127
+ }
128
+ const commitments = [];
129
+ for (let i = 0; i < numSigners; i++) {
130
+ const commitment = readMapWord(storage, MULTISIG_SLOT_NAMES.SIGNER_PUBLIC_KEYS, indexMapKey(i));
131
+ if (!commitment) {
132
+ throw new Error(`missing signer public key at index ${i} in ${MULTISIG_SLOT_NAMES.SIGNER_PUBLIC_KEYS} (expected ${numSigners} signers)`);
133
+ }
134
+ commitments.push(wordToHex(commitment));
135
+ }
136
+ return commitments;
137
+ }
138
+ /**
139
+ * Read the guardian public-key commitment of a guarded-multisig account
140
+ * from its `miden::standards::auth::guardian::pub_key` storage map.
141
+ *
142
+ * The guarded-multisig component always includes a guardian, so this
143
+ * returns the commitment or throws: on an account from a different
144
+ * contract version, or when the guardian key entry is missing
145
+ * (inconsistent account state). Genuine storage read failures propagate.
146
+ *
147
+ * @param account - The Account object from the Miden SDK
148
+ * @returns The guardian commitment as 0x-prefixed hex
149
+ */
150
+ static getGuardianPublicKeyCommitment(account) {
151
+ assertPinnedContractVersion(account);
152
+ const storage = account.storage();
153
+ const commitment = readMapWord(storage, GUARDIAN_SLOT_NAMES.PUBLIC_KEY, indexMapKey(0));
154
+ if (!commitment) {
155
+ throw new Error(`${GUARDIAN_SLOT_NAMES.PUBLIC_KEY} has no entry: inconsistent account state (the guarded-multisig always includes a guardian)`);
156
+ }
157
+ return wordToHex(commitment);
158
+ }
34
159
  /**
35
160
  * Inspect a base64-encoded serialized account.
36
161
  *
@@ -45,20 +170,29 @@ export class AccountInspector {
45
170
  /**
46
171
  * Inspect a Miden SDK Account object.
47
172
  *
173
+ * Lenient by design (skips unreadable parts): `MultisigClient.load` uses
174
+ * it to reconstruct config from accounts it already trusts. Consumers that
175
+ * need a guarantee should use `getSignerPublicKeyCommitments` /
176
+ * `getGuardianPublicKeyCommitment`, which throw instead of degrading.
177
+ *
48
178
  * @param account - The Account object from Miden SDK
49
179
  * @returns Detected multisig configuration
50
180
  */
51
181
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
182
  static fromAccount(account) {
183
+ // Reject accounts built from a different contract version before any
184
+ // procedure-root-keyed read: against such an account the reads below would
185
+ // silently miss its stored overrides (its `procedure_thresholds` map is
186
+ // keyed by *its* roots, not this SDK's) and report wrong thresholds.
187
+ assertPinnedContractVersion(account);
53
188
  const storage = account.storage();
54
189
  const slot0 = storage.getItem(MULTISIG_SLOT_NAMES.THRESHOLD_CONFIG);
55
- const threshold = Number(wordElementToBigInt(slot0, 0));
56
- const numSigners = Number(wordElementToBigInt(slot0, 1));
190
+ const threshold = slot0 ? Number(wordElementToBigInt(slot0, 0)) : 0;
191
+ const numSigners = slot0 ? Number(wordElementToBigInt(slot0, 1)) : 0;
57
192
  const signerCommitments = [];
58
- for (let i = 0; i < numSigners; i++) {
193
+ for (let i = 0; i < Math.min(numSigners, MAX_SIGNERS); i++) {
59
194
  try {
60
- const key = new Word(new BigUint64Array([BigInt(i), 0n, 0n, 0n]));
61
- const commitment = storage.getMapItem(MULTISIG_SLOT_NAMES.SIGNER_PUBLIC_KEYS, key);
195
+ const commitment = readMapWord(storage, MULTISIG_SLOT_NAMES.SIGNER_PUBLIC_KEYS, indexMapKey(i));
62
196
  if (commitment) {
63
197
  signerCommitments.push(wordToHex(commitment));
64
198
  }
@@ -67,18 +201,13 @@ export class AccountInspector {
67
201
  console.warn(error);
68
202
  }
69
203
  }
70
- let guardianEnabled = false;
204
+ // The guarded-multisig has no enable/disable selector; the guardian is always present.
205
+ // Read its public key directly from the guardian pub_key slot.
71
206
  let guardianCommitment = null;
72
207
  try {
73
- const guardianSlot0 = storage.getItem(GUARDIAN_SLOT_NAMES.SELECTOR);
74
- const selector = Number(wordElementToBigInt(guardianSlot0, 0));
75
- guardianEnabled = selector === 1;
76
- if (guardianEnabled) {
77
- const zeroKey = new Word(new BigUint64Array([0n, 0n, 0n, 0n]));
78
- const guardianKey = storage.getMapItem(GUARDIAN_SLOT_NAMES.PUBLIC_KEY, zeroKey);
79
- if (guardianKey) {
80
- guardianCommitment = wordToHex(guardianKey);
81
- }
208
+ const guardianKey = readMapWord(storage, GUARDIAN_SLOT_NAMES.PUBLIC_KEY, indexMapKey(0));
209
+ if (guardianKey) {
210
+ guardianCommitment = wordToHex(guardianKey);
82
211
  }
83
212
  }
84
213
  catch (error) {
@@ -105,7 +234,7 @@ export class AccountInspector {
105
234
  try {
106
235
  const rootHex = getProcedureRoot(procName);
107
236
  const rootWord = Word.fromHex(rootHex);
108
- const value = storage.getMapItem(MULTISIG_SLOT_NAMES.PROCEDURE_THRESHOLDS, rootWord);
237
+ const value = readMapWord(storage, MULTISIG_SLOT_NAMES.PROCEDURE_THRESHOLDS, rootWord);
109
238
  if (value) {
110
239
  const procThreshold = Number(wordElementToBigInt(value, 0));
111
240
  if (procThreshold > 0) {
@@ -121,7 +250,6 @@ export class AccountInspector {
121
250
  threshold,
122
251
  numSigners,
123
252
  signerCommitments,
124
- guardianEnabled,
125
253
  guardianCommitment,
126
254
  vaultBalances,
127
255
  procedureThresholds,
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.js","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAsB,MAAM,iBAAiB,CAAC;AAE1F,mDAAmD;AACnD,MAAM,mBAAmB,GAAG;IAC1B,gBAAgB,EAAE,0CAA0C;IAC5D,kBAAkB,EAAE,4CAA4C;IAChE,qBAAqB,EAAE,+CAA+C;IACtE,oBAAoB,EAAE,8CAA8C;CAC5D,CAAC;AAEX,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,kCAAkC;IAC5C,UAAU,EAAE,oCAAoC;CACxC,CAAC;AAiBX;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,gBAAgB;IAC3B,gBAAuB,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,UAAkB;QAChC,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACH,8DAA8D;IAC9D,MAAM,CAAC,WAAW,CAAC,OAAgB;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