@openzeppelin/miden-multisig-client 0.17.0 → 0.18.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.
- package/README.md +159 -46
- package/dist/account/builder.d.ts +4 -4
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +17 -7
- package/dist/account/builder.js.map +1 -1
- package/dist/account/layout.d.ts +5 -5
- package/dist/account/layout.d.ts.map +1 -1
- package/dist/account/layout.js +5 -5
- package/dist/account/layout.js.map +1 -1
- package/dist/client.d.ts +18 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +79 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/multisig/authArgErrors.d.ts +14 -31
- package/dist/multisig/authArgErrors.d.ts.map +1 -1
- package/dist/multisig/authArgErrors.js +22 -46
- package/dist/multisig/authArgErrors.js.map +1 -1
- package/dist/multisig/consumeNotesErrors.d.ts +13 -1
- package/dist/multisig/consumeNotesErrors.d.ts.map +1 -1
- package/dist/multisig/consumeNotesErrors.js +17 -0
- package/dist/multisig/consumeNotesErrors.js.map +1 -1
- package/dist/multisig/signing.d.ts +1 -1
- package/dist/multisig/signing.d.ts.map +1 -1
- package/dist/multisig/signing.js +8 -3
- package/dist/multisig/signing.js.map +1 -1
- package/dist/multisig.d.ts +118 -11
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +421 -141
- package/dist/multisig.js.map +1 -1
- package/dist/procedures.d.ts +7 -7
- package/dist/procedures.js +7 -7
- package/dist/proposal/factory.d.ts.map +1 -1
- package/dist/proposal/factory.js +7 -0
- package/dist/proposal/factory.js.map +1 -1
- package/dist/raw-client.d.ts +1 -0
- package/dist/raw-client.d.ts.map +1 -1
- package/dist/raw-client.js +10 -2
- package/dist/raw-client.js.map +1 -1
- package/dist/recovery/publicNoteBackfill.js +1 -1
- package/dist/recovery/publicNoteBackfill.js.map +1 -1
- package/dist/retry/classify.d.ts +3 -0
- package/dist/retry/classify.d.ts.map +1 -1
- package/dist/retry/classify.js +2 -2
- package/dist/retry/classify.js.map +1 -1
- package/dist/signer.d.ts +1 -0
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +1 -0
- package/dist/signer.js.map +1 -1
- package/dist/signers/index.d.ts +1 -0
- package/dist/signers/index.d.ts.map +1 -1
- package/dist/signers/index.js +1 -0
- package/dist/signers/index.js.map +1 -1
- package/dist/signers/ledger.d.ts +25 -0
- package/dist/signers/ledger.d.ts.map +1 -0
- package/dist/signers/ledger.js +96 -0
- package/dist/signers/ledger.js.map +1 -0
- package/dist/state/adopt.d.ts +45 -0
- package/dist/state/adopt.d.ts.map +1 -0
- package/dist/state/adopt.js +101 -0
- package/dist/state/adopt.js.map +1 -0
- package/dist/transaction/authArgs.d.ts +57 -0
- package/dist/transaction/authArgs.d.ts.map +1 -0
- package/dist/transaction/authArgs.js +108 -0
- package/dist/transaction/authArgs.js.map +1 -0
- package/dist/transaction/consumeNotes.d.ts +9 -5
- package/dist/transaction/consumeNotes.d.ts.map +1 -1
- package/dist/transaction/consumeNotes.js +8 -23
- package/dist/transaction/consumeNotes.js.map +1 -1
- package/dist/transaction/noteAuthentication.d.ts +39 -0
- package/dist/transaction/noteAuthentication.d.ts.map +1 -0
- package/dist/transaction/noteAuthentication.js +94 -0
- package/dist/transaction/noteAuthentication.js.map +1 -0
- package/dist/transaction/options.d.ts +25 -0
- package/dist/transaction/options.d.ts.map +1 -1
- package/dist/transaction/p2id.d.ts +3 -2
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +36 -27
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/summary.d.ts +41 -15
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +71 -19
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/updateGuardian.d.ts +3 -3
- package/dist/transaction/updateGuardian.d.ts.map +1 -1
- package/dist/transaction/updateGuardian.js +5 -16
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.d.ts +3 -3
- package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +6 -16
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.d.ts +3 -3
- package/dist/transaction/updateSigners.d.ts.map +1 -1
- package/dist/transaction/updateSigners.js +9 -16
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.d.ts +3 -2
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +3 -2
- package/dist/transaction.js.map +1 -1
- package/dist/types/proposal.d.ts +31 -0
- package/dist/types/proposal.d.ts.map +1 -1
- package/dist/types/proposal.js +8 -0
- package/dist/types/proposal.js.map +1 -1
- package/dist/utils/eip712.d.ts +80 -0
- package/dist/utils/eip712.d.ts.map +1 -0
- package/dist/utils/eip712.js +49 -0
- package/dist/utils/eip712.js.map +1 -0
- package/dist/utils/signature.d.ts +4 -0
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/signature.js +49 -1
- package/dist/utils/signature.js.map +1 -1
- package/package.json +11 -6
- package/src/account/builder.ts +18 -7
- package/src/account/layout.ts +5 -5
- package/src/client.ts +94 -6
- package/src/index.ts +21 -3
- package/src/multisig/authArgErrors.ts +23 -56
- package/src/multisig/consumeNotesErrors.ts +20 -1
- package/src/multisig/signing.ts +8 -2
- package/src/multisig.ts +530 -183
- package/src/procedures.ts +7 -7
- package/src/proposal/factory.ts +7 -0
- package/src/raw-client.ts +11 -7
- package/src/recovery/publicNoteBackfill.ts +1 -1
- package/src/retry/classify.ts +3 -3
- package/src/signer.ts +1 -0
- package/src/signers/index.ts +1 -0
- package/src/signers/ledger.ts +122 -0
- package/src/state/adopt.ts +132 -0
- package/src/transaction/authArgs.ts +142 -0
- package/src/transaction/consumeNotes.ts +23 -30
- package/src/transaction/noteAuthentication.ts +136 -0
- package/src/transaction/options.ts +27 -0
- package/src/transaction/p2id.ts +45 -34
- package/src/transaction/summary.ts +86 -22
- package/src/transaction/updateGuardian.ts +8 -22
- package/src/transaction/updateProcedureThreshold.ts +8 -20
- package/src/transaction/updateSigners.ts +11 -22
- package/src/transaction.ts +12 -1
- package/src/types/proposal.ts +30 -0
- package/src/utils/eip712.ts +57 -0
- package/src/utils/signature.ts +57 -0
- package/src/prover/test-node.d.ts +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,SAAS,EAAE,SAAS,EAAa,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,qBAAqB,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,GAAW,EACX,SAA0B,QAAQ;IAElC,MAAM,QAAQ,GAAG,UAAU,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AC3B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openzeppelin/miden-multisig-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-rc.1",
|
|
4
4
|
"description": "TypeScript SDK for Miden multisig accounts with GUARDIAN integration",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,23 +34,28 @@
|
|
|
34
34
|
"build": "tsc",
|
|
35
35
|
"dev": "tsc --watch",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
|
+
"typecheck:tests": "tsc --noEmit -p tsconfig.test.json",
|
|
37
38
|
"clean": "rm -rf dist",
|
|
38
39
|
"test": "vitest run",
|
|
39
40
|
"test:watch": "vitest",
|
|
40
|
-
"test:browser": "playwright test --config playwright.config.ts"
|
|
41
|
+
"test:browser": "playwright test --config playwright.config.ts",
|
|
42
|
+
"test:qualification": "vitest run --config vitest.qualification.config.ts"
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
|
-
"@miden-sdk/miden-sdk": "0.
|
|
45
|
+
"@miden-sdk/miden-sdk": "0.17.0-rc.3",
|
|
44
46
|
"@noble/curves": "^1.9.7",
|
|
45
47
|
"@noble/hashes": "^2.0.1",
|
|
46
|
-
"@openzeppelin/guardian-client": "^0.
|
|
48
|
+
"@openzeppelin/guardian-client": "^0.18.0-rc.1"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
51
|
+
"@openzeppelin/guardian-operator-client": "^0.18.0-rc.1",
|
|
49
52
|
"@playwright/test": "^1.60.0",
|
|
53
|
+
"@types/node": "^24.13.5",
|
|
50
54
|
"fake-indexeddb": "^6.2.5",
|
|
55
|
+
"viem": "^2.47.5",
|
|
51
56
|
"typescript": "^5.7.2",
|
|
52
|
-
"vite": "^
|
|
53
|
-
"vitest": "^
|
|
57
|
+
"vite": "^6.4.3",
|
|
58
|
+
"vitest": "^5.0.0"
|
|
54
59
|
},
|
|
55
60
|
"engines": {
|
|
56
61
|
"node": ">=18"
|
package/src/account/builder.ts
CHANGED
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
type MidenClient,
|
|
16
16
|
} from "@miden-sdk/miden-sdk";
|
|
17
17
|
import { getProcedureRoot } from "../procedures.js";
|
|
18
|
+
import { isPublicMidenClient, type RawClientSource } from "../raw-client.js";
|
|
19
|
+
import { MAX_SIGNERS } from "./layout.js";
|
|
18
20
|
import type { MultisigConfig, CreateAccountResult } from "../types.js";
|
|
19
21
|
import { normalizeSignerCommitment } from "../utils/signature.js";
|
|
20
22
|
|
|
@@ -82,13 +84,13 @@ function buildGuardedMultisigComponent(
|
|
|
82
84
|
/**
|
|
83
85
|
* Creates a multisig account with GUARDIAN authentication.
|
|
84
86
|
*
|
|
85
|
-
* @param
|
|
87
|
+
* @param client - Initialized MidenClient, or the WASM client behind one
|
|
86
88
|
* @param config - Multisig configuration
|
|
87
|
-
* @param midenRpcEndpoint - RPC endpoint for the
|
|
89
|
+
* @param midenRpcEndpoint - RPC endpoint for the client's network
|
|
88
90
|
* @returns The created account and seed
|
|
89
91
|
*/
|
|
90
92
|
export async function createMultisigAccount(
|
|
91
|
-
|
|
93
|
+
client: RawClientSource,
|
|
92
94
|
config: MultisigConfig,
|
|
93
95
|
midenRpcEndpoint: string,
|
|
94
96
|
): Promise<CreateAccountResult> {
|
|
@@ -115,10 +117,14 @@ export async function createMultisigAccount(
|
|
|
115
117
|
|
|
116
118
|
const result = accountBuilder.buildWithoutSchemaCommitment();
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
if (isPublicMidenClient(client)) {
|
|
121
|
+
await client.accounts.insert({
|
|
122
|
+
account: result.account,
|
|
123
|
+
overwrite: false,
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
await client.newAccount(result.account, false);
|
|
127
|
+
}
|
|
122
128
|
|
|
123
129
|
return {
|
|
124
130
|
account: result.account,
|
|
@@ -149,6 +155,11 @@ export function validateMultisigConfig(config: MultisigConfig): void {
|
|
|
149
155
|
signerCommitments.add(normalizedCommitment);
|
|
150
156
|
}
|
|
151
157
|
|
|
158
|
+
if (config.signerCommitments.length > MAX_SIGNERS) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`too many signers (${config.signerCommitments.length}): a multisig account holds at most ${MAX_SIGNERS}`,
|
|
161
|
+
);
|
|
162
|
+
}
|
|
152
163
|
if (config.threshold > config.signerCommitments.length) {
|
|
153
164
|
throw new Error(
|
|
154
165
|
`threshold (${config.threshold}) cannot exceed number of signers (${config.signerCommitments.length})`,
|
package/src/account/layout.ts
CHANGED
|
@@ -25,9 +25,9 @@ export const GUARDIAN_SLOT_NAMES = {
|
|
|
25
25
|
} as const;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* The most approvers a multisig account can hold: `ApproverSet::MAX_APPROVERS`
|
|
29
|
+
* in miden-standards, enforced at account creation and again on-chain by
|
|
30
|
+
* `update_signers_and_threshold`. Readers bound their loops with it, so a
|
|
31
|
+
* corrupt `threshold_config` cannot drive an unbounded storage walk.
|
|
32
32
|
*/
|
|
33
|
-
export const MAX_SIGNERS =
|
|
33
|
+
export const MAX_SIGNERS = 64;
|
package/src/client.ts
CHANGED
|
@@ -13,6 +13,8 @@ import { createMultisigAccount } from './account/index.js';
|
|
|
13
13
|
import { AccountInspector, assertCompleteDetectedConfig } from './inspector.js';
|
|
14
14
|
import { getRawMidenClient, requireConfigValue, requireMidenRpcEndpoint } from './raw-client.js';
|
|
15
15
|
import type { MultisigConfig, Signer } from './types.js';
|
|
16
|
+
import { isSafeToAdoptGuardianState, readOnChainCommitment } from './state/adopt.js';
|
|
17
|
+
import { normalizeHexWord } from './utils/encoding.js';
|
|
16
18
|
import {
|
|
17
19
|
resolveProverConfig,
|
|
18
20
|
type ProverConfig,
|
|
@@ -141,7 +143,7 @@ export class MultisigClient {
|
|
|
141
143
|
* which would fail authentication first).
|
|
142
144
|
*
|
|
143
145
|
* @throws if `signer` does not implement `signLookupMessage`. The bundled
|
|
144
|
-
* `FalconSigner` and `
|
|
146
|
+
* `FalconSigner`, `EcdsaSigner`, and `LedgerSigner` do.
|
|
145
147
|
*/
|
|
146
148
|
async recoverByKey(signer: Signer): Promise<RecoveredAccount[]> {
|
|
147
149
|
this._guardianClient.setSigner(signer);
|
|
@@ -211,7 +213,9 @@ export class MultisigClient {
|
|
|
211
213
|
for (let i = 0; i < binaryString.length; i++) {
|
|
212
214
|
accountBytes[i] = binaryString.charCodeAt(i);
|
|
213
215
|
}
|
|
214
|
-
const
|
|
216
|
+
const incomingAccount = Account.deserialize(accountBytes);
|
|
217
|
+
|
|
218
|
+
const account = await this.adoptGuardianAccount(accountId, incomingAccount);
|
|
215
219
|
|
|
216
220
|
const detected = AccountInspector.fromAccount(account);
|
|
217
221
|
// Fail closed on a partial read: the detected signer set becomes the
|
|
@@ -226,10 +230,6 @@ export class MultisigClient {
|
|
|
226
230
|
),
|
|
227
231
|
};
|
|
228
232
|
|
|
229
|
-
const existingAccount = await this.midenClient.accounts.get(AccountId.fromHex(accountId));
|
|
230
|
-
if (!existingAccount) {
|
|
231
|
-
await this.midenClient.accounts.insert({ account, overwrite: true });
|
|
232
|
-
}
|
|
233
233
|
await bindSignerAccountKey(signer, this.midenClient, accountId);
|
|
234
234
|
|
|
235
235
|
return new Multisig(
|
|
@@ -244,4 +244,92 @@ export class MultisigClient {
|
|
|
244
244
|
this.rpcConfig,
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Reconcile the account GUARDIAN returned with the local store, and answer
|
|
250
|
+
* with the one that is actually current.
|
|
251
|
+
*
|
|
252
|
+
* Writing GUARDIAN's account only when the store held nothing meant a caller
|
|
253
|
+
* that already had the account kept its own copy while the returned
|
|
254
|
+
* `Multisig` carried a config derived from GUARDIAN's. One object, two
|
|
255
|
+
* sources, silently disagreeing: after a membership change the config said
|
|
256
|
+
* one thing and every account read said another, with no error.
|
|
257
|
+
*
|
|
258
|
+
* Overwriting unconditionally is not the fix either. Between pushing a delta
|
|
259
|
+
* and GUARDIAN canonicalizing it, local is legitimately ahead, and clobbering
|
|
260
|
+
* it would build the next transaction on a stale nonce. So this applies the
|
|
261
|
+
* same rule `syncState` does, and returns whichever account wins so the
|
|
262
|
+
* caller describes the state it will actually read.
|
|
263
|
+
*/
|
|
264
|
+
private async adoptGuardianAccount(
|
|
265
|
+
accountId: string,
|
|
266
|
+
incomingAccount: Account,
|
|
267
|
+
): Promise<Account> {
|
|
268
|
+
const localAccount = await this.midenClient.accounts.get(AccountId.fromHex(accountId));
|
|
269
|
+
if (!localAccount) {
|
|
270
|
+
// Still checked against chain, and through the same rule the other path
|
|
271
|
+
// uses. An empty store is the ordinary shape for loading an account this
|
|
272
|
+
// client has never held, so inserting without the check would make it the
|
|
273
|
+
// one path where GUARDIAN's word is taken on its own. Checking only that
|
|
274
|
+
// *some* commitment exists is not the check: it admits state that
|
|
275
|
+
// disagrees with chain, which is the thing being guarded against.
|
|
276
|
+
// Only for an account that has transacted. One that has not is not
|
|
277
|
+
// deployed, so there is no on-chain commitment to agree or disagree with,
|
|
278
|
+
// and reading the node for one would make loading a fresh account depend
|
|
279
|
+
// on the node as well as on GUARDIAN.
|
|
280
|
+
const transacted = incomingAccount.nonce().asInt() > BigInt(0);
|
|
281
|
+
const onChain = transacted
|
|
282
|
+
? await readOnChainCommitment(
|
|
283
|
+
this.midenRpcEndpoint,
|
|
284
|
+
AccountId.fromHex(accountId),
|
|
285
|
+
this.rpcConfig,
|
|
286
|
+
)
|
|
287
|
+
: null;
|
|
288
|
+
// The one rule the shared predicate cannot apply here. It keys its
|
|
289
|
+
// null-commitment guard on the *local* nonce, because `syncState`
|
|
290
|
+
// legitimately meets a higher incoming nonce with no local history. With
|
|
291
|
+
// no local record at all, the incoming nonce is the only evidence there
|
|
292
|
+
// is: an account GUARDIAN reports as having transacted is deployed, so a
|
|
293
|
+
// node reporting nothing for it is an RPC or gateway failure rather than
|
|
294
|
+
// an undeployed account. `readOnChainCommitment` reports a missing
|
|
295
|
+
// account by matching `not found`, which a 404 also says.
|
|
296
|
+
if (transacted && !onChain) {
|
|
297
|
+
throw new Error(
|
|
298
|
+
`Refusing to adopt GUARDIAN state for ${accountId}: it has transacted (nonce ${incomingAccount.nonce().asInt().toString()}) but the node reported no on-chain commitment, so it could not be checked against chain`
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
// Handed the commitment already read, rather than letting the predicate
|
|
302
|
+
// read it again: two reads can disagree, and the guard above would then
|
|
303
|
+
// have passed on a different answer than the comparison rejects.
|
|
304
|
+
await isSafeToAdoptGuardianState({
|
|
305
|
+
accountId,
|
|
306
|
+
incomingAccount,
|
|
307
|
+
readCommitment: () => Promise.resolve(onChain),
|
|
308
|
+
});
|
|
309
|
+
await this.midenClient.accounts.insert({ account: incomingAccount, overwrite: true });
|
|
310
|
+
return incomingAccount;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const localCommitment = normalizeHexWord(localAccount.to_commitment().toHex());
|
|
314
|
+
const incomingCommitment = normalizeHexWord(incomingAccount.to_commitment().toHex());
|
|
315
|
+
// Equal commitments are the same state, and the safety rule reads an equal
|
|
316
|
+
// nonce as divergence, so it must not be asked about a pair that agrees.
|
|
317
|
+
if (localCommitment === incomingCommitment) {
|
|
318
|
+
return localAccount;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const adopt = await isSafeToAdoptGuardianState({
|
|
322
|
+
accountId,
|
|
323
|
+
incomingAccount,
|
|
324
|
+
localAccount,
|
|
325
|
+
readCommitment: () =>
|
|
326
|
+
readOnChainCommitment(this.midenRpcEndpoint, AccountId.fromHex(accountId), this.rpcConfig),
|
|
327
|
+
});
|
|
328
|
+
if (!adopt) {
|
|
329
|
+
return localAccount;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
await this.midenClient.accounts.insert({ account: incomingAccount, overwrite: true });
|
|
333
|
+
return incomingAccount;
|
|
334
|
+
}
|
|
247
335
|
}
|
package/src/index.ts
CHANGED
|
@@ -67,14 +67,21 @@ export { AccountInspector, type DetectedMultisigConfig, type VaultBalance } from
|
|
|
67
67
|
export {
|
|
68
68
|
chainAnchorFromBase64,
|
|
69
69
|
chainAnchorToBase64,
|
|
70
|
+
chainAnchorBlockNum,
|
|
70
71
|
executeForSummary,
|
|
71
72
|
executeForSummaryAt,
|
|
72
|
-
|
|
73
|
+
summaryApprovalExpirationBlockNum,
|
|
74
|
+
summarySalt,
|
|
75
|
+
SummaryAnchorMismatchError,
|
|
73
76
|
buildUpdateSignersTransactionRequest,
|
|
74
77
|
buildUpdateProcedureThresholdTransactionRequest,
|
|
75
78
|
buildUpdateGuardianTransactionRequest,
|
|
76
79
|
buildConsumeNotesTransactionRequest,
|
|
80
|
+
buildConsumeNotesTransactionRequestFromNotes,
|
|
77
81
|
buildP2idTransactionRequest,
|
|
82
|
+
requestBoundBlockNum,
|
|
83
|
+
requestSaltHex,
|
|
84
|
+
MAX_APPROVAL_EXPIRATION_DELTA,
|
|
78
85
|
parseP2idNoteType,
|
|
79
86
|
p2idNoteTypeToMetadata,
|
|
80
87
|
type P2idTransactionOptions,
|
|
@@ -85,7 +92,12 @@ export {
|
|
|
85
92
|
// serialized summary exactly as import verification does. Returns normalized
|
|
86
93
|
// hex, directly comparable to `ExportedProposal.commitment` / `Proposal.id`.
|
|
87
94
|
export { computeCommitmentFromTxSummary } from './multisig/helpers.js';
|
|
88
|
-
export type {
|
|
95
|
+
export type {
|
|
96
|
+
MidenClientMultisigRequestOptions,
|
|
97
|
+
MidenClientSignatureOptions,
|
|
98
|
+
MultisigRequestOptions,
|
|
99
|
+
SignatureOptions,
|
|
100
|
+
} from './transaction/options.js';
|
|
89
101
|
|
|
90
102
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
91
103
|
export type { GuardianErrorMeta } from '@openzeppelin/guardian-client';
|
|
@@ -134,9 +146,12 @@ export type {
|
|
|
134
146
|
export {
|
|
135
147
|
FalconSigner,
|
|
136
148
|
EcdsaSigner,
|
|
149
|
+
Eip712Signer,
|
|
150
|
+
LedgerSigner,
|
|
137
151
|
ParaSigner,
|
|
138
152
|
MidenWalletSigner,
|
|
139
153
|
type ParaSigningContext,
|
|
154
|
+
type Eip1193SignerProvider,
|
|
140
155
|
type WalletSigningContext,
|
|
141
156
|
} from './signer.js';
|
|
142
157
|
export { PublicKeyFormat } from './utils/key.js';
|
|
@@ -157,6 +172,8 @@ export {
|
|
|
157
172
|
MAX_CONSUME_NOTES_METADATA_BYTES,
|
|
158
173
|
isConsumeNotesV1,
|
|
159
174
|
isConsumeNotesV2,
|
|
175
|
+
isProposalActionable,
|
|
176
|
+
type ProposalVerification,
|
|
160
177
|
isP2idNoteVisibility,
|
|
161
178
|
type P2idNoteVisibility,
|
|
162
179
|
MAX_P2IDE_BLOCK_HEIGHT,
|
|
@@ -173,11 +190,12 @@ export {
|
|
|
173
190
|
UnsupportedMetadataVersionError,
|
|
174
191
|
ConsumeNotesMetadataOversizeError,
|
|
175
192
|
LegacyConsumeNotesNoteMissingError,
|
|
193
|
+
ConsumeNoteNotAuthenticatedError,
|
|
176
194
|
} from './multisig/consumeNotesErrors.js';
|
|
177
195
|
|
|
178
196
|
export {
|
|
179
197
|
type AuthArgErrorCode,
|
|
180
|
-
|
|
198
|
+
MultisigAuthArgsMissingError,
|
|
181
199
|
ProposalSaltMalformedError,
|
|
182
200
|
} from './multisig/authArgErrors.js';
|
|
183
201
|
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
//! Typed failures
|
|
2
|
-
//!
|
|
3
|
-
//!
|
|
4
|
-
//! change constructs these, and the proposal paths that do arrive in the PR that commits
|
|
5
|
-
//! the anchored fee faucet. Landing the codes first keeps them out of that PR's diff and
|
|
6
|
-
//! lets a caller pin `code` before the raiser exists — `public-api.test.ts` covers the
|
|
7
|
-
//! barrel so a dropped re-export is caught either way.
|
|
1
|
+
//! Typed failures a caller branches on rather than reports: each means the proposal or
|
|
2
|
+
//! request itself is unusable, as against a transport or WASM failure a retry might clear.
|
|
3
|
+
//! `public-api.test.ts` covers the barrel so a dropped re-export is caught.
|
|
8
4
|
|
|
9
5
|
/** Stable error identifiers for auth-arg recovery failures. */
|
|
10
|
-
export type AuthArgErrorCode =
|
|
11
|
-
| 'proposal_auth_arg_unresolvable'
|
|
12
|
-
| 'proposal_salt_malformed'
|
|
13
|
-
| 'fee_faucet_anchor_mismatch';
|
|
6
|
+
export type AuthArgErrorCode = 'proposal_salt_malformed' | 'multisig_auth_args_missing';
|
|
14
7
|
|
|
15
8
|
/** How much of an untrusted value an error message will quote. */
|
|
16
9
|
const MAX_QUOTED_CHARS = 80;
|
|
@@ -56,11 +49,10 @@ function coerceForMessage(value: unknown): string {
|
|
|
56
49
|
* A proposal's recorded salt is not a readable 32-byte word, so no rebuild can
|
|
57
50
|
* use it.
|
|
58
51
|
*
|
|
59
|
-
* Coded
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* GUARDIAN able to strand a fully signed switch.
|
|
52
|
+
* Coded because `switch_guardian` recovery acts on it rather than reporting it:
|
|
53
|
+
* the salt is served by the GUARDIAN being switched away from, which can make it
|
|
54
|
+
* unreadable, and treating that as fatal would leave that GUARDIAN able to strand
|
|
55
|
+
* a fully signed switch.
|
|
64
56
|
*/
|
|
65
57
|
export class ProposalSaltMalformedError extends Error {
|
|
66
58
|
readonly code: AuthArgErrorCode = 'proposal_salt_malformed';
|
|
@@ -90,49 +82,24 @@ export class ProposalSaltMalformedError extends Error {
|
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
/**
|
|
93
|
-
* A
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `switch_guardian` is the exception, and deliberately so: it rebuilds from the
|
|
100
|
-
* summary's own auth arg, which reproduces the signed word but not the fee
|
|
101
|
-
* preimage behind it, so it executes only on a zero-fee chain.
|
|
102
|
-
*
|
|
103
|
-
* Coded because one caller acts on it rather than reporting it:
|
|
104
|
-
* `switch_guardian` recovery falls back to the summary's own auth arg when it
|
|
105
|
-
* sees this or {@link ProposalSaltMalformedError}, and must not extend that
|
|
106
|
-
* treatment to an unreadable anchor or a WASM failure.
|
|
85
|
+
* A request built for `accountId` came back without the multisig auth args.
|
|
86
|
+
* `feeAwareTransactionRequestBuilder` only attaches them to an account it can
|
|
87
|
+
* classify as a multisig, so this means the account is not in the client's
|
|
88
|
+
* store or its code is not the guarded-multisig component this client knows.
|
|
89
|
+
* Raised at build time: the alternative is an abort inside the auth procedure
|
|
90
|
+
* while it pipes a preimage the advice map does not hold.
|
|
107
91
|
*/
|
|
108
|
-
export class
|
|
109
|
-
readonly code: AuthArgErrorCode = '
|
|
110
|
-
readonly
|
|
111
|
-
readonly signedAuthArgHex: string;
|
|
112
|
-
readonly saltHex: string;
|
|
113
|
-
readonly feeFaucetIdHex: string;
|
|
92
|
+
export class MultisigAuthArgsMissingError extends Error {
|
|
93
|
+
readonly code: AuthArgErrorCode = 'multisig_auth_args_missing';
|
|
94
|
+
readonly accountId: string;
|
|
114
95
|
|
|
115
|
-
constructor(
|
|
116
|
-
proposalId: string;
|
|
117
|
-
signedAuthArgHex: string;
|
|
118
|
-
saltHex: string;
|
|
119
|
-
feeFaucetIdHex: string;
|
|
120
|
-
}) {
|
|
96
|
+
constructor(accountId: string) {
|
|
121
97
|
super(
|
|
122
|
-
`
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
`${quoteUntrusted(details.feeFaucetIdHex)}, so the signed transaction summary cannot ` +
|
|
126
|
-
`be reproduced ` +
|
|
127
|
-
'from that salt, and the proposal cannot be executed. Recreate the proposal and ' +
|
|
128
|
-
'collect signatures again, and have the original dropped server-side — while ' +
|
|
129
|
-
'GUARDIAN keeps serving it, syncing this account keeps failing on it',
|
|
98
|
+
`Account ${quoteUntrusted(accountId)} received no multisig auth args: the client does ` +
|
|
99
|
+
'not hold it as a guarded-multisig account, so a request built for it cannot be ' +
|
|
100
|
+
'authenticated. Import or create the account in this client first',
|
|
130
101
|
);
|
|
131
|
-
this.name = '
|
|
132
|
-
this.
|
|
133
|
-
this.signedAuthArgHex = details.signedAuthArgHex;
|
|
134
|
-
this.saltHex = details.saltHex;
|
|
135
|
-
this.feeFaucetIdHex = details.feeFaucetIdHex;
|
|
102
|
+
this.name = 'MultisigAuthArgsMissingError';
|
|
103
|
+
this.accountId = accountId;
|
|
136
104
|
}
|
|
137
105
|
}
|
|
138
|
-
|
|
@@ -8,7 +8,8 @@ export type ConsumeNotesErrorCode =
|
|
|
8
8
|
| 'consume_notes_note_binding_mismatch'
|
|
9
9
|
| 'consume_notes_unsupported_metadata_version'
|
|
10
10
|
| 'consume_notes_metadata_oversize'
|
|
11
|
-
| 'consume_notes_legacy_note_missing'
|
|
11
|
+
| 'consume_notes_legacy_note_missing'
|
|
12
|
+
| 'consume_notes_note_not_authenticated';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* v2 metadata's embedded `notes` array did not match its declared
|
|
@@ -72,3 +73,21 @@ export class LegacyConsumeNotesNoteMissingError extends Error {
|
|
|
72
73
|
this.noteId = noteId;
|
|
73
74
|
}
|
|
74
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A note a `consume_notes` proposal consumes could not be authenticated
|
|
79
|
+
* (its inclusion proof fetched from the node and imported into the local
|
|
80
|
+
* store). The signed summary commits to authenticated consumption, so an
|
|
81
|
+
* unauthenticated rebuild would never match it (issue #409).
|
|
82
|
+
*/
|
|
83
|
+
export class ConsumeNoteNotAuthenticatedError extends Error {
|
|
84
|
+
readonly code: ConsumeNotesErrorCode = 'consume_notes_note_not_authenticated';
|
|
85
|
+
readonly noteId: string;
|
|
86
|
+
readonly reason: string;
|
|
87
|
+
constructor(noteId: string, reason: string) {
|
|
88
|
+
super(`consume_notes: note ${noteId} could not be authenticated: ${reason}`);
|
|
89
|
+
this.name = 'ConsumeNoteNotAuthenticatedError';
|
|
90
|
+
this.noteId = noteId;
|
|
91
|
+
this.reason = reason;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/multisig/signing.ts
CHANGED
|
@@ -5,12 +5,18 @@ export function toGuardianSignature(
|
|
|
5
5
|
scheme: SignatureScheme,
|
|
6
6
|
signatureHex: string,
|
|
7
7
|
publicKey?: string,
|
|
8
|
+
messageFormat?: 'eip712',
|
|
8
9
|
): ProposalSignature {
|
|
9
10
|
if (scheme === 'ecdsa') {
|
|
10
11
|
if (!publicKey) {
|
|
11
12
|
throw new Error('ECDSA signature requires publicKey');
|
|
12
13
|
}
|
|
13
|
-
return {
|
|
14
|
+
return {
|
|
15
|
+
scheme: 'ecdsa',
|
|
16
|
+
signature: signatureHex,
|
|
17
|
+
publicKey,
|
|
18
|
+
...(messageFormat ? { messageFormat } : {}),
|
|
19
|
+
};
|
|
14
20
|
}
|
|
15
21
|
return { scheme: 'falcon', signature: signatureHex };
|
|
16
22
|
}
|
|
@@ -20,5 +26,5 @@ export async function buildGuardianSignatureFromSigner(
|
|
|
20
26
|
commitment: string,
|
|
21
27
|
): Promise<ProposalSignature> {
|
|
22
28
|
const signatureHex = await signer.signCommitment(commitment);
|
|
23
|
-
return toGuardianSignature(signer.scheme, signatureHex, signer.publicKey);
|
|
29
|
+
return toGuardianSignature(signer.scheme, signatureHex, signer.publicKey, signer.proposalMessageFormat);
|
|
24
30
|
}
|