@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.
- package/README.md +192 -11
- package/dist/account/builder.d.ts.map +1 -1
- package/dist/account/builder.js +32 -25
- package/dist/account/builder.js.map +1 -1
- package/dist/account/builder.test.js +73 -21
- package/dist/account/builder.test.js.map +1 -1
- package/dist/account/layout.d.ts +31 -0
- package/dist/account/layout.d.ts.map +1 -0
- package/dist/account/layout.js +31 -0
- package/dist/account/layout.js.map +1 -0
- package/dist/account/masm/account-components/auth.d.ts +1 -4
- package/dist/account/masm/account-components/auth.d.ts.map +1 -1
- package/dist/account/masm/account-components/auth.js +36 -53
- package/dist/account/masm/account-components/auth.js.map +1 -1
- package/dist/account/masm/index.d.ts +0 -1
- package/dist/account/masm/index.d.ts.map +1 -1
- package/dist/account/masm/index.js +0 -1
- package/dist/account/masm/index.js.map +1 -1
- package/dist/account/storage.d.ts +4 -0
- package/dist/account/storage.d.ts.map +1 -1
- package/dist/account/storage.js +9 -20
- package/dist/account/storage.js.map +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -5
- package/dist/client.js.map +1 -1
- package/dist/client.test.js +74 -16
- package/dist/client.test.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/inspector.d.ts +59 -1
- package/dist/inspector.d.ts.map +1 -1
- package/dist/inspector.js +157 -29
- package/dist/inspector.js.map +1 -1
- package/dist/inspector.test.js +246 -37
- package/dist/inspector.test.js.map +1 -1
- package/dist/multisig.d.ts +109 -33
- package/dist/multisig.d.ts.map +1 -1
- package/dist/multisig.js +307 -104
- package/dist/multisig.js.map +1 -1
- package/dist/multisig.test.js +582 -58
- package/dist/multisig.test.js.map +1 -1
- package/dist/procedures.d.ts +6 -7
- package/dist/procedures.d.ts.map +1 -1
- package/dist/procedures.js +6 -7
- package/dist/procedures.js.map +1 -1
- package/dist/proposal/metadata.d.ts.map +1 -1
- package/dist/proposal/metadata.js +13 -2
- package/dist/proposal/metadata.js.map +1 -1
- package/dist/proposal/metadata.test.js +57 -0
- package/dist/proposal/metadata.test.js.map +1 -1
- package/dist/prover/errors.d.ts +5 -0
- package/dist/prover/errors.d.ts.map +1 -1
- package/dist/prover/errors.js +7 -155
- package/dist/prover/errors.js.map +1 -1
- package/dist/prover/errors.test.js +5 -0
- package/dist/prover/errors.test.js.map +1 -1
- package/dist/prover/retry.d.ts +1 -6
- package/dist/prover/retry.d.ts.map +1 -1
- package/dist/prover/retry.js +5 -28
- package/dist/prover/retry.js.map +1 -1
- package/dist/prover/retry.test.js +1 -1
- package/dist/prover/retry.test.js.map +1 -1
- package/dist/prover/workflow.d.ts +4 -3
- package/dist/prover/workflow.d.ts.map +1 -1
- package/dist/prover/workflow.js +5 -2
- package/dist/prover/workflow.js.map +1 -1
- package/dist/prover/workflow.test.js +28 -3
- package/dist/prover/workflow.test.js.map +1 -1
- package/dist/retry/classify.d.ts +16 -0
- package/dist/retry/classify.d.ts.map +1 -0
- package/dist/retry/classify.js +187 -0
- package/dist/retry/classify.js.map +1 -0
- package/dist/retry/runtime.d.ts +13 -0
- package/dist/retry/runtime.d.ts.map +1 -0
- package/dist/retry/runtime.js +33 -0
- package/dist/retry/runtime.js.map +1 -0
- package/dist/rpc/config.d.ts +11 -0
- package/dist/rpc/config.d.ts.map +1 -0
- package/dist/rpc/config.js +17 -0
- package/dist/rpc/config.js.map +1 -0
- package/dist/rpc/config.test.d.ts +2 -0
- package/dist/rpc/config.test.d.ts.map +1 -0
- package/dist/rpc/config.test.js +24 -0
- package/dist/rpc/config.test.js.map +1 -0
- package/dist/rpc/errors.d.ts +2 -0
- package/dist/rpc/errors.d.ts.map +1 -0
- package/dist/rpc/errors.js +11 -0
- package/dist/rpc/errors.js.map +1 -0
- package/dist/rpc/errors.test.d.ts +2 -0
- package/dist/rpc/errors.test.d.ts.map +1 -0
- package/dist/rpc/errors.test.js +34 -0
- package/dist/rpc/errors.test.js.map +1 -0
- package/dist/rpc/retry.d.ts +4 -0
- package/dist/rpc/retry.d.ts.map +1 -0
- package/dist/rpc/retry.js +6 -0
- package/dist/rpc/retry.js.map +1 -0
- package/dist/rpc/retry.test.d.ts +2 -0
- package/dist/rpc/retry.test.d.ts.map +1 -0
- package/dist/rpc/retry.test.js +98 -0
- package/dist/rpc/retry.test.js.map +1 -0
- package/dist/transaction/index.d.ts +1 -1
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction/index.js +1 -1
- package/dist/transaction/index.js.map +1 -1
- package/dist/transaction/p2id.d.ts +17 -6
- package/dist/transaction/p2id.d.ts.map +1 -1
- package/dist/transaction/p2id.js +22 -31
- package/dist/transaction/p2id.js.map +1 -1
- package/dist/transaction/p2id.test.js +62 -24
- package/dist/transaction/p2id.test.js.map +1 -1
- package/dist/transaction/summary.d.ts +45 -2
- package/dist/transaction/summary.d.ts.map +1 -1
- package/dist/transaction/summary.js +42 -2
- package/dist/transaction/summary.js.map +1 -1
- package/dist/transaction/summary.test.d.ts +2 -0
- package/dist/transaction/summary.test.d.ts.map +1 -0
- package/dist/transaction/summary.test.js +26 -0
- package/dist/transaction/summary.test.js.map +1 -0
- package/dist/transaction/updateGuardian.d.ts.map +1 -1
- package/dist/transaction/updateGuardian.js +16 -18
- package/dist/transaction/updateGuardian.js.map +1 -1
- package/dist/transaction/updateProcedureThreshold.d.ts.map +1 -1
- package/dist/transaction/updateProcedureThreshold.js +15 -17
- package/dist/transaction/updateProcedureThreshold.js.map +1 -1
- package/dist/transaction/updateSigners.d.ts +6 -1
- package/dist/transaction/updateSigners.d.ts.map +1 -1
- package/dist/transaction/updateSigners.js +20 -17
- package/dist/transaction/updateSigners.js.map +1 -1
- package/dist/transaction.d.ts +2 -2
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +1 -1
- package/dist/transaction.js.map +1 -1
- package/dist/types/proposal.d.ts +28 -4
- package/dist/types/proposal.d.ts.map +1 -1
- package/dist/types/proposal.js +18 -0
- package/dist/types/proposal.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/signature.d.ts +11 -7
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/signature.js +24 -58
- package/dist/utils/signature.js.map +1 -1
- package/dist/utils/word.d.ts +7 -0
- package/dist/utils/word.d.ts.map +1 -1
- package/dist/utils/word.js +15 -0
- package/dist/utils/word.js.map +1 -1
- package/masm/account_components/auth/guarded_multisig.masm +42 -0
- package/package.json +7 -4
- package/src/account/builder.test.ts +111 -45
- package/src/account/builder.ts +45 -33
- package/src/account/layout.ts +33 -0
- package/src/account/masm/account-components/auth.ts +36 -56
- package/src/account/masm/index.ts +0 -1
- package/src/account/storage.ts +9 -22
- package/src/client.test.ts +87 -16
- package/src/client.ts +16 -3
- package/src/index.ts +27 -1
- package/src/inspector.test.ts +330 -38
- package/src/inspector.ts +196 -33
- package/src/multisig.test.ts +680 -63
- package/src/multisig.ts +400 -115
- package/src/procedures.ts +6 -7
- package/src/proposal/metadata.test.ts +76 -0
- package/src/proposal/metadata.ts +13 -2
- package/src/prover/errors.test.ts +8 -0
- package/src/prover/errors.ts +7 -175
- package/src/prover/retry.test.ts +1 -1
- package/src/prover/retry.ts +10 -35
- package/src/prover/workflow.test.ts +40 -4
- package/src/prover/workflow.ts +16 -4
- package/src/retry/classify.ts +220 -0
- package/src/retry/runtime.ts +45 -0
- package/src/rpc/config.test.ts +45 -0
- package/src/rpc/config.ts +30 -0
- package/src/rpc/errors.test.ts +69 -0
- package/src/rpc/errors.ts +12 -0
- package/src/rpc/retry.test.ts +144 -0
- package/src/rpc/retry.ts +12 -0
- package/src/transaction/index.ts +7 -1
- package/src/transaction/p2id.test.ts +112 -31
- package/src/transaction/p2id.ts +39 -38
- package/src/transaction/summary.test.ts +32 -0
- package/src/transaction/summary.ts +83 -4
- package/src/transaction/updateGuardian.ts +15 -25
- package/src/transaction/updateProcedureThreshold.ts +13 -29
- package/src/transaction/updateSigners.ts +38 -30
- package/src/transaction.ts +8 -1
- package/src/types/proposal.ts +43 -4
- package/src/types.ts +0 -1
- package/src/utils/signature.ts +32 -65
- package/src/utils/word.ts +17 -0
- package/dist/account/masm/auth.d.ts +0 -5
- package/dist/account/masm/auth.d.ts.map +0 -1
- package/dist/account/masm/auth.js +0 -1509
- package/dist/account/masm/auth.js.map +0 -1
- package/masm/account_components/auth/multisig.masm +0 -12
- package/masm/account_components/auth/multisig_ecdsa.masm +0 -12
- package/masm/account_components/auth/multisig_guardian.masm +0 -16
- package/masm/account_components/auth/multisig_guardian_ecdsa.masm +0 -16
- package/masm/auth/guardian.masm +0 -199
- package/masm/auth/guardian_ecdsa.masm +0 -195
- package/masm/auth/multisig.masm +0 -554
- package/masm/auth/multisig_ecdsa.masm +0 -554
- package/src/account/masm/auth.ts +0 -1512
package/src/account/storage.ts
CHANGED
|
@@ -2,21 +2,7 @@ import type { MultisigConfig } from '../types.js';
|
|
|
2
2
|
import { StorageSlot, StorageMap, Word } from '@miden-sdk/miden-sdk';
|
|
3
3
|
import { ensureHexPrefix } from '../utils/encoding.js';
|
|
4
4
|
import { getProcedureRoot } from '../procedures.js';
|
|
5
|
-
|
|
6
|
-
// Storage slot names matching the MASM definitions
|
|
7
|
-
const MULTISIG_SLOT_NAMES = {
|
|
8
|
-
THRESHOLD_CONFIG: 'openzeppelin::multisig::threshold_config',
|
|
9
|
-
SIGNER_PUBLIC_KEYS: 'openzeppelin::multisig::signer_public_keys',
|
|
10
|
-
SIGNER_SCHEME_IDS: 'openzeppelin::multisig::signer_scheme_ids',
|
|
11
|
-
EXECUTED_TRANSACTIONS: 'openzeppelin::multisig::executed_transactions',
|
|
12
|
-
PROCEDURE_THRESHOLDS: 'openzeppelin::multisig::procedure_thresholds',
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
const GUARDIAN_SLOT_NAMES = {
|
|
16
|
-
SELECTOR: 'openzeppelin::guardian::selector',
|
|
17
|
-
PUBLIC_KEY: 'openzeppelin::guardian::public_key',
|
|
18
|
-
SCHEME_ID: 'openzeppelin::guardian::scheme_id',
|
|
19
|
-
} as const;
|
|
5
|
+
import { MULTISIG_SLOT_NAMES, GUARDIAN_SLOT_NAMES } from './layout.js';
|
|
20
6
|
|
|
21
7
|
function signerMapKey(index: bigint): Word {
|
|
22
8
|
return new Word(new BigUint64Array([index, 0n, 0n, 0n]));
|
|
@@ -70,24 +56,25 @@ export class StorageLayoutBuilder {
|
|
|
70
56
|
return [slot0, slot1, slot2, slot3, slot4];
|
|
71
57
|
}
|
|
72
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The guarded-multisig has no enable/disable selector; the guardian is always present, so this
|
|
61
|
+
* returns just two slots: the guardian public-key map and its scheme map.
|
|
62
|
+
*/
|
|
73
63
|
buildGuardianSlots(config: MultisigConfig): StorageSlot[] {
|
|
74
|
-
const selector = config.guardianEnabled !== false ? 1n : 0n;
|
|
75
64
|
const schemeId = config.signatureScheme === 'ecdsa' ? 1n : 2n;
|
|
76
|
-
const
|
|
77
|
-
const slot0 = StorageSlot.fromValue(GUARDIAN_SLOT_NAMES.SELECTOR, selectorWord);
|
|
65
|
+
const zeroKey = signerMapKey(0n);
|
|
78
66
|
|
|
79
67
|
const guardianKeyMap = new StorageMap();
|
|
80
|
-
const zeroKey = signerMapKey(0n);
|
|
81
68
|
const guardianKey = Word.fromHex(ensureHexPrefix(config.guardianCommitment));
|
|
82
69
|
guardianKeyMap.insert(zeroKey, guardianKey);
|
|
83
|
-
const
|
|
70
|
+
const slot0 = StorageSlot.map(GUARDIAN_SLOT_NAMES.PUBLIC_KEY, guardianKeyMap);
|
|
84
71
|
|
|
85
72
|
const guardianSchemeMap = new StorageMap();
|
|
86
73
|
const guardianScheme = new Word(new BigUint64Array([schemeId, 0n, 0n, 0n]));
|
|
87
74
|
guardianSchemeMap.insert(zeroKey, guardianScheme);
|
|
88
|
-
const
|
|
75
|
+
const slot1 = StorageSlot.map(GUARDIAN_SLOT_NAMES.SCHEME_ID, guardianSchemeMap);
|
|
89
76
|
|
|
90
|
-
return [slot0, slot1
|
|
77
|
+
return [slot0, slot1];
|
|
91
78
|
}
|
|
92
79
|
}
|
|
93
80
|
|
package/src/client.test.ts
CHANGED
|
@@ -19,22 +19,27 @@ vi.mock('@miden-sdk/miden-sdk', () => ({
|
|
|
19
19
|
vault: vi.fn(),
|
|
20
20
|
})),
|
|
21
21
|
},
|
|
22
|
+
Word: vi.fn(),
|
|
22
23
|
}));
|
|
23
24
|
|
|
24
|
-
// Mock the AccountInspector
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
// Mock the AccountInspector, keeping the real assertCompleteDetectedConfig
|
|
26
|
+
// so load()'s fail-closed validation is exercised.
|
|
27
|
+
vi.mock('./inspector.js', async (importOriginal) => {
|
|
28
|
+
const actual = await importOriginal<typeof import('./inspector.js')>();
|
|
29
|
+
return {
|
|
30
|
+
...actual,
|
|
31
|
+
AccountInspector: {
|
|
32
|
+
fromAccount: vi.fn(() => ({
|
|
33
|
+
threshold: 2,
|
|
34
|
+
numSigners: 2,
|
|
35
|
+
signerCommitments: ['0x' + 'a'.repeat(64), '0x' + 'b'.repeat(64)],
|
|
36
|
+
guardianCommitment: '0x' + 'c'.repeat(64),
|
|
37
|
+
vaultBalances: [],
|
|
38
|
+
procedureThresholds: new Map(),
|
|
39
|
+
})),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
});
|
|
38
43
|
|
|
39
44
|
// Mock the account creation module
|
|
40
45
|
vi.mock('./account/index.js', () => ({
|
|
@@ -232,6 +237,66 @@ describe('MultisigClient', () => {
|
|
|
232
237
|
expect(webClient.accounts.insert).toHaveBeenCalledTimes(1);
|
|
233
238
|
});
|
|
234
239
|
|
|
240
|
+
it('fails closed when the detected signer set is incomplete (issue #306 review)', async () => {
|
|
241
|
+
const client = new MultisigClient(webClient, CLIENT_CONFIG);
|
|
242
|
+
|
|
243
|
+
const { AccountInspector } = await import('./inspector.js');
|
|
244
|
+
// Storage reports 3 signers but only 2 entries were readable — adopting
|
|
245
|
+
// this config would let membership proposals drop the missing key.
|
|
246
|
+
vi.mocked(AccountInspector.fromAccount).mockReturnValueOnce({
|
|
247
|
+
threshold: 2,
|
|
248
|
+
numSigners: 3,
|
|
249
|
+
signerCommitments: ['0x' + 'a'.repeat(64), '0x' + 'b'.repeat(64)],
|
|
250
|
+
guardianCommitment: '0x' + 'c'.repeat(64),
|
|
251
|
+
vaultBalances: [],
|
|
252
|
+
procedureThresholds: new Map(),
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
mockFetch.mockResolvedValueOnce({
|
|
256
|
+
ok: true,
|
|
257
|
+
json: async () => ({
|
|
258
|
+
account_id: '0x' + 'd'.repeat(30),
|
|
259
|
+
commitment: '0x' + 'e'.repeat(64),
|
|
260
|
+
state_json: { data: 'base64state' },
|
|
261
|
+
created_at: '2024-01-01T00:00:00Z',
|
|
262
|
+
updated_at: '2024-01-02T00:00:00Z',
|
|
263
|
+
}),
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
await expect(client.load('0x' + 'd'.repeat(30), mockSigner)).rejects.toThrow(
|
|
267
|
+
/incomplete signer set: storage reports 3 signers, read 2/,
|
|
268
|
+
);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('fails closed when the guardian commitment is missing', async () => {
|
|
272
|
+
const client = new MultisigClient(webClient, CLIENT_CONFIG);
|
|
273
|
+
|
|
274
|
+
const { AccountInspector } = await import('./inspector.js');
|
|
275
|
+
vi.mocked(AccountInspector.fromAccount).mockReturnValueOnce({
|
|
276
|
+
threshold: 1,
|
|
277
|
+
numSigners: 1,
|
|
278
|
+
signerCommitments: ['0x' + 'a'.repeat(64)],
|
|
279
|
+
guardianCommitment: null,
|
|
280
|
+
vaultBalances: [],
|
|
281
|
+
procedureThresholds: new Map(),
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
mockFetch.mockResolvedValueOnce({
|
|
285
|
+
ok: true,
|
|
286
|
+
json: async () => ({
|
|
287
|
+
account_id: '0x' + 'd'.repeat(30),
|
|
288
|
+
commitment: '0x' + 'e'.repeat(64),
|
|
289
|
+
state_json: { data: 'base64state' },
|
|
290
|
+
created_at: '2024-01-01T00:00:00Z',
|
|
291
|
+
updated_at: '2024-01-02T00:00:00Z',
|
|
292
|
+
}),
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
await expect(client.load('0x' + 'd'.repeat(30), mockSigner)).rejects.toThrow(
|
|
296
|
+
/missing guardian commitment/,
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
|
|
235
300
|
it('should throw if account not found on GUARDIAN', async () => {
|
|
236
301
|
const client = new MultisigClient(webClient, CLIENT_CONFIG);
|
|
237
302
|
|
|
@@ -239,12 +304,18 @@ describe('MultisigClient', () => {
|
|
|
239
304
|
ok: false,
|
|
240
305
|
status: 404,
|
|
241
306
|
statusText: 'Not Found',
|
|
242
|
-
|
|
307
|
+
headers: new Headers(),
|
|
308
|
+
text: async () =>
|
|
309
|
+
JSON.stringify({
|
|
310
|
+
code: 'account_not_found',
|
|
311
|
+
message: 'Account not found',
|
|
312
|
+
meta: { retryable: false },
|
|
313
|
+
}),
|
|
243
314
|
});
|
|
244
315
|
|
|
245
316
|
await expect(
|
|
246
317
|
client.load('0xnonexistent', mockSigner)
|
|
247
|
-
).rejects.toThrow();
|
|
318
|
+
).rejects.toThrow('Account not found');
|
|
248
319
|
});
|
|
249
320
|
|
|
250
321
|
it('should allow registerOnGuardian after load without explicit initial state', async () => {
|
package/src/client.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { GuardianHttpClient } from '@openzeppelin/guardian-client';
|
|
|
10
10
|
import type { StateObject } from '@openzeppelin/guardian-client';
|
|
11
11
|
import { Multisig } from './multisig.js';
|
|
12
12
|
import { createMultisigAccount } from './account/index.js';
|
|
13
|
-
import { AccountInspector } from './inspector.js';
|
|
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
16
|
import {
|
|
@@ -18,6 +18,11 @@ import {
|
|
|
18
18
|
type ProverConfig,
|
|
19
19
|
type ResolvedProverConfig,
|
|
20
20
|
} from './prover/config.js';
|
|
21
|
+
import {
|
|
22
|
+
resolveRpcConfig,
|
|
23
|
+
type RpcConfig,
|
|
24
|
+
type ResolvedRpcConfig,
|
|
25
|
+
} from './rpc/config.js';
|
|
21
26
|
|
|
22
27
|
interface AccountKeyBindingSigner {
|
|
23
28
|
bindAccountKey?(midenClient: MidenClient, accountId: string): Promise<void>;
|
|
@@ -48,6 +53,8 @@ export interface MultisigClientConfig {
|
|
|
48
53
|
midenRpcEndpoint: string;
|
|
49
54
|
/** Multisig-owned remote prover override and proof retry policy. */
|
|
50
55
|
prover?: ProverConfig;
|
|
56
|
+
/** Retry policy for idempotent Miden node reads; submission is never retried. */
|
|
57
|
+
rpc?: RpcConfig;
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
/**
|
|
@@ -95,12 +102,14 @@ export class MultisigClient {
|
|
|
95
102
|
private readonly midenClient: MidenClient;
|
|
96
103
|
private readonly midenRpcEndpoint: string;
|
|
97
104
|
private readonly proverConfig: ResolvedProverConfig;
|
|
105
|
+
private readonly rpcConfig: ResolvedRpcConfig;
|
|
98
106
|
private _guardianClient: GuardianHttpClient;
|
|
99
107
|
|
|
100
108
|
constructor(midenClient: MidenClient, config: MultisigClientConfig) {
|
|
101
109
|
this.midenClient = midenClient;
|
|
102
110
|
this.midenRpcEndpoint = requireMidenRpcEndpoint(config?.midenRpcEndpoint);
|
|
103
111
|
this.proverConfig = resolveProverConfig(config?.prover, midenClient.defaultProver);
|
|
112
|
+
this.rpcConfig = resolveRpcConfig(config?.rpc);
|
|
104
113
|
this._guardianClient = new GuardianHttpClient(
|
|
105
114
|
requireConfigValue('guardianEndpoint', config?.guardianEndpoint),
|
|
106
115
|
);
|
|
@@ -176,6 +185,7 @@ export class MultisigClient {
|
|
|
176
185
|
undefined,
|
|
177
186
|
this.midenRpcEndpoint,
|
|
178
187
|
this.proverConfig,
|
|
188
|
+
this.rpcConfig,
|
|
179
189
|
);
|
|
180
190
|
}
|
|
181
191
|
|
|
@@ -204,11 +214,13 @@ export class MultisigClient {
|
|
|
204
214
|
const account = Account.deserialize(accountBytes);
|
|
205
215
|
|
|
206
216
|
const detected = AccountInspector.fromAccount(account);
|
|
217
|
+
// Fail closed on a partial read: the detected signer set becomes the
|
|
218
|
+
// authoritative config that membership proposals rewrite on-chain.
|
|
219
|
+
assertCompleteDetectedConfig(detected);
|
|
207
220
|
const config: MultisigConfig = {
|
|
208
221
|
threshold: detected.threshold,
|
|
209
222
|
signerCommitments: detected.signerCommitments,
|
|
210
|
-
guardianCommitment: detected.guardianCommitment
|
|
211
|
-
guardianEnabled: detected.guardianEnabled,
|
|
223
|
+
guardianCommitment: detected.guardianCommitment,
|
|
212
224
|
procedureThresholds: Array.from(detected.procedureThresholds.entries()).map(
|
|
213
225
|
([procedure, threshold]) => ({ procedure, threshold })
|
|
214
226
|
),
|
|
@@ -229,6 +241,7 @@ export class MultisigClient {
|
|
|
229
241
|
accountId,
|
|
230
242
|
this.midenRpcEndpoint,
|
|
231
243
|
this.proverConfig,
|
|
244
|
+
this.rpcConfig,
|
|
232
245
|
);
|
|
233
246
|
}
|
|
234
247
|
}
|
package/src/index.ts
CHANGED
|
@@ -50,11 +50,22 @@ export {
|
|
|
50
50
|
type RecoveredAccount,
|
|
51
51
|
} from './client.js';
|
|
52
52
|
export type { ProverConfig, ProverRetryPolicy } from './prover/config.js';
|
|
53
|
+
export type { RpcConfig, RpcRetryPolicy } from './rpc/config.js';
|
|
53
54
|
export { lookupAuthDigest } from './lookupAuth.js';
|
|
54
|
-
export {
|
|
55
|
+
export {
|
|
56
|
+
Multisig,
|
|
57
|
+
type AccountState,
|
|
58
|
+
type CreateProposalOptions,
|
|
59
|
+
type CreateSignerProposalOptions,
|
|
60
|
+
type CreateP2idProposalOptions,
|
|
61
|
+
} from './multisig.js';
|
|
55
62
|
export { AccountInspector, type DetectedMultisigConfig, type VaultBalance } from './inspector.js';
|
|
56
63
|
export {
|
|
64
|
+
chainAnchorFromBase64,
|
|
65
|
+
chainAnchorToBase64,
|
|
57
66
|
executeForSummary,
|
|
67
|
+
executeForSummaryAt,
|
|
68
|
+
summarySalt,
|
|
58
69
|
buildUpdateSignersTransactionRequest,
|
|
59
70
|
buildUpdateProcedureThresholdTransactionRequest,
|
|
60
71
|
buildUpdateGuardianTransactionRequest,
|
|
@@ -63,6 +74,7 @@ export {
|
|
|
63
74
|
parseP2idNoteType,
|
|
64
75
|
p2idNoteTypeToMetadata,
|
|
65
76
|
type P2idTransactionOptions,
|
|
77
|
+
type P2ideHeightOptions,
|
|
66
78
|
} from './transaction.js';
|
|
67
79
|
|
|
68
80
|
export { GuardianHttpClient, GuardianHttpError } from '@openzeppelin/guardian-client';
|
|
@@ -75,6 +87,18 @@ export {
|
|
|
75
87
|
normalizeGuardianErrorCode,
|
|
76
88
|
} from '@openzeppelin/guardian-client';
|
|
77
89
|
export type { GuardianErrorCode } from '@openzeppelin/guardian-client';
|
|
90
|
+
export type {
|
|
91
|
+
HistoryDecodeSection,
|
|
92
|
+
HistoryDecodeWarning,
|
|
93
|
+
HistoryEntry,
|
|
94
|
+
HistoryEntryStatus,
|
|
95
|
+
HistoryNote,
|
|
96
|
+
HistoryNoteAsset,
|
|
97
|
+
HistoryNoteTag,
|
|
98
|
+
HistoryNoteVisibility,
|
|
99
|
+
HistoryOptions,
|
|
100
|
+
HistoryPage,
|
|
101
|
+
} from '@openzeppelin/guardian-client';
|
|
78
102
|
|
|
79
103
|
// Codeless transport-failure classification (feature 009, User Story 3).
|
|
80
104
|
export { isLikelyNetworkError, toUserFacingError } from './connectivity.js';
|
|
@@ -108,6 +132,8 @@ export {
|
|
|
108
132
|
isConsumeNotesV2,
|
|
109
133
|
isP2idNoteVisibility,
|
|
110
134
|
type P2idNoteVisibility,
|
|
135
|
+
MAX_P2IDE_BLOCK_HEIGHT,
|
|
136
|
+
parseP2ideHeight,
|
|
111
137
|
} from './types/proposal.js';
|
|
112
138
|
|
|
113
139
|
export {
|