@sig-net/midnight 0.11.0 → 0.13.0
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 +19 -13
- package/dist/abi-serde.d.ts +89 -0
- package/dist/abi-serde.d.ts.map +1 -0
- package/dist/abi-serde.js +400 -0
- package/dist/abi-serde.js.map +1 -0
- package/dist/constants.d.ts +31 -23
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +38 -32
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +38 -18
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +52 -25
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.js +1 -1
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +180 -122
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +38 -28
- package/dist/managed/contract/index.js +302 -149
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +13 -13
- package/dist/signature-requests-state-reader.js +22 -22
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.js +3 -3
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +33 -36
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +26 -28
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +21 -21
- package/dist/signet-evtype2tx-requests.js +16 -16
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +27 -25
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +32 -30
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +27 -27
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +28 -29
- package/dist/signet-requests.js.map +1 -1
- package/package.json +3 -2
- package/src/Signet.compact +80 -65
- package/src/circuits.compact +45 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,4BAA4B;AAC5B,oFAAoF;AACpF,qFAAqF;AACrF,yDAAyD;AACzD,qEAAqE;AACrE,sEAAsE;AACtE,oFAAoF;AACpF,6DAA6D;AAC7D,oEAAoE;AACpE,0EAA0E;AAC1E,kDAAkD;AAElD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAE3B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,aAAa,EACb,eAAe,EACf,GAAG,GAEJ,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uDAAuD,GAAG,CAAC,CAAC;AAEzE,sEAAsE;AACtE,MAAM,CAAC,MAAM,+CAA+C,GAAG,CAAC,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC,uFAAuF;AACvF,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC;AAEzD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD,0EAA0E;AAC1E,kEAAkE;AAClE,6EAA6E;AAC7E
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","s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16>`). */
|
|
16
16
|
noWords: bigint;
|
|
17
17
|
/**
|
|
18
|
-
* ABI-ready big-endian 32-byte word slots, stored exactly as broadcast
|
|
19
|
-
*
|
|
18
|
+
* ABI-ready big-endian 32-byte word slots, stored exactly as broadcast.
|
|
19
|
+
* Capacity is the contract's `#maxWords` (vault: 2).
|
|
20
20
|
*/
|
|
21
21
|
words: Uint8Array[];
|
|
22
22
|
}
|
|
@@ -35,10 +35,10 @@ export interface EvmAccessListEntry {
|
|
|
35
35
|
/**
|
|
36
36
|
* The EVM transaction to be signed, decomposed into typed fields (Compact:
|
|
37
37
|
* `EvmType2TxParams<#maxCalldataWords, #maxAccessListEntries,
|
|
38
|
-
* #maxStorageKeysPerEntry
|
|
38
|
+
* #maxStorageKeysPerEntry>`, EIP-1559: https://eips.ethereum.org/EIPS/eip-1559).
|
|
39
39
|
* Compact `Bytes<N>` fields arrive as N-byte `Uint8Array`s, `Uint<N>` as
|
|
40
|
-
* `bigint`. Vector capacities are each contract's compile-time throttle
|
|
41
|
-
* the runtime counts say how many leading slots are real.
|
|
40
|
+
* `bigint`. Vector capacities are each contract's compile-time throttle,
|
|
41
|
+
* and the runtime counts say how many leading slots are real.
|
|
42
42
|
*/
|
|
43
43
|
export interface EvmType2TxParams {
|
|
44
44
|
/** EVM chain id (also expressed in the record's `caip2Id`). */
|
|
@@ -55,7 +55,7 @@ export interface EvmType2TxParams {
|
|
|
55
55
|
to: Uint8Array;
|
|
56
56
|
/** ETH sent with the call, wei. */
|
|
57
57
|
value: bigint;
|
|
58
|
-
/** Call data
|
|
58
|
+
/** Call data: `is_some: false` means a plain ETH transfer (`0x` data). */
|
|
59
59
|
calldata: Maybe<EvmCalldata>;
|
|
60
60
|
/** How many leading {@link accessList} entries are real. */
|
|
61
61
|
accessListEntryCount: bigint;
|
|
@@ -63,7 +63,7 @@ export interface EvmType2TxParams {
|
|
|
63
63
|
accessList: EvmAccessListEntry[];
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Descriptor of {@link EvmCalldata} at one word capacity
|
|
66
|
+
* Descriptor of {@link EvmCalldata} at one word capacity: the TS analogue
|
|
67
67
|
* of instantiating Compact's `EvmCalldata<#maxWords>`.
|
|
68
68
|
*
|
|
69
69
|
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
@@ -79,7 +79,7 @@ export declare function evmCalldataDescriptor(maxWords: number): CompactType<Evm
|
|
|
79
79
|
*/
|
|
80
80
|
export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): CompactType<EvmAccessListEntry>;
|
|
81
81
|
/**
|
|
82
|
-
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation
|
|
82
|
+
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation:
|
|
83
83
|
* the TS analogue of Compact's `EvmType2TxParams<#maxCalldataWords,
|
|
84
84
|
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
85
85
|
*
|
|
@@ -91,7 +91,7 @@ export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): Co
|
|
|
91
91
|
export declare function evmType2TxParamsDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number): CompactType<EvmType2TxParams>;
|
|
92
92
|
/**
|
|
93
93
|
* Descriptor of {@link SignBidirectionalEvent} at one EVM Type-2 capacity
|
|
94
|
-
* instantiation
|
|
94
|
+
* instantiation: the generic record descriptor
|
|
95
95
|
* (`signBidirectionalEventDescriptorWith`) over
|
|
96
96
|
* {@link evmType2TxParamsDescriptor}.
|
|
97
97
|
*
|
|
@@ -107,15 +107,15 @@ export declare function evmType2TxParamsDescriptor(maxCalldataWords: number, max
|
|
|
107
107
|
export declare function signBidirectionalEventDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number, lenOutputDeserialization: number, lenRespondSerialization: number): CompactType<SignBidirectionalEvent>;
|
|
108
108
|
/**
|
|
109
109
|
* Canonical id of a signet request: the persistent hash of the entire event
|
|
110
|
-
* record (which commits to every field, the sender address included
|
|
111
|
-
*
|
|
110
|
+
* record (which commits to every field, the sender address included, and
|
|
111
|
+
* deliberately carries no extra domain tag). TS twin of Signet.compact's
|
|
112
112
|
* `calculateRequestId` circuit (see the deviation note in
|
|
113
113
|
* signet-requests.ts), generic over the capacity instantiation via the
|
|
114
|
-
* record's own array lengths
|
|
114
|
+
* record's own array lengths: pass the record exactly as the ledger stores
|
|
115
115
|
* it, unused slots included and schemas at their declared widths.
|
|
116
116
|
*
|
|
117
117
|
* @param request - The full event record (contract-shaped, all slots).
|
|
118
|
-
* @returns The 32-byte request id
|
|
118
|
+
* @returns The 32-byte request id, the record's ledger map key.
|
|
119
119
|
*/
|
|
120
120
|
export declare function calculateRequestId(request: SignBidirectionalEvent): RequestId;
|
|
121
121
|
/**
|
|
@@ -174,7 +174,7 @@ export declare function abiWordToBool(word: Uint8Array): boolean;
|
|
|
174
174
|
* Assemble the raw calldata a request's words describe:
|
|
175
175
|
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
176
176
|
* ABI-ready (see {@link EvmCalldata}), so no byte of the stored record is
|
|
177
|
-
* reordered or reinterpreted on the way into the transaction
|
|
177
|
+
* reordered or reinterpreted on the way into the transaction. Slots past
|
|
178
178
|
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
179
179
|
* of the signer-side assembly documented on `EvmCalldata` in Signet.compact.
|
|
180
180
|
*
|
|
@@ -187,7 +187,7 @@ export declare function assembleCalldata(calldata: Maybe<EvmCalldata>): string;
|
|
|
187
187
|
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
188
188
|
* tagged words (see {@link assembleCalldata}), the count-trimmed access
|
|
189
189
|
* list, and the stored envelope fields. This is the canonical
|
|
190
|
-
* request→transaction transform
|
|
190
|
+
* request→transaction transform. Response-side verification
|
|
191
191
|
* (`signature-response-verification.ts`) and the signed-transaction builder
|
|
192
192
|
* below both go through it, so the transaction a client broadcasts is
|
|
193
193
|
* provably the one the MPC put its signature over.
|
|
@@ -201,8 +201,8 @@ export declare function signBidirectionalEventToUnsignedEvmTransaction(request:
|
|
|
201
201
|
/**
|
|
202
202
|
* Decode a response signature record (as posted to the signet contract's
|
|
203
203
|
* signature response log) into an ethers {@link Signature}. Goes through
|
|
204
|
-
* {@link mpcSignatureToEcdsaSignature}
|
|
205
|
-
*
|
|
204
|
+
* {@link mpcSignatureToEcdsaSignature}, so this and in-circuit claims decode
|
|
205
|
+
* a post identically:
|
|
206
206
|
* ethers' `r` is the ECDSA scalar (`bigR.x` reduced mod the curve order),
|
|
207
207
|
* not the raw coordinate, and a malformed record is rejected the same way
|
|
208
208
|
* in both paths.
|
|
@@ -214,13 +214,13 @@ export declare function signBidirectionalEventToUnsignedEvmTransaction(request:
|
|
|
214
214
|
export declare function signatureRespondedEventToSignature(response: SignatureRespondedEvent): Signature;
|
|
215
215
|
/**
|
|
216
216
|
* Encode an ECDSA signature as the response record posted to the signet
|
|
217
|
-
* contract
|
|
217
|
+
* contract: the inverse of {@link signatureRespondedEventToSignature}, for
|
|
218
218
|
* MPC-side posters (the fakenet signer, tests). An `r || s || v` signature
|
|
219
219
|
* carries only R.x and the parity of R.y, so the full R point the record
|
|
220
220
|
* stores is recovered on-curve (see {@link ecdsaSignatureToMpcSignature}).
|
|
221
221
|
*
|
|
222
222
|
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
223
|
-
* {@link Signature}) so signatures from ANY ethers instance qualify
|
|
223
|
+
* {@link Signature}) so signatures from ANY ethers instance qualify: posters
|
|
224
224
|
* living in other repos resolve their own ethers install, and nominal class
|
|
225
225
|
* typing would reject it.
|
|
226
226
|
*
|
|
@@ -234,12 +234,12 @@ export declare function signatureToSignatureRespondedEvent(signature: Pick<Signa
|
|
|
234
234
|
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
235
235
|
* signed (see {@link signBidirectionalEventToUnsignedEvmTransaction}) and
|
|
236
236
|
* attach the signature. Does NOT check that the signature recovers to the
|
|
237
|
-
* requester's derived address
|
|
237
|
+
* requester's derived address: the response log is unauthenticated, so
|
|
238
238
|
* verify first with `verifySignatureRespondedEvent`.
|
|
239
239
|
*
|
|
240
240
|
* @param request - The on-ledger request record.
|
|
241
241
|
* @param response - The posted signature record answering it.
|
|
242
|
-
* @returns The signed ethers transaction
|
|
242
|
+
* @returns The signed ethers transaction: `serialized` is the raw payload for
|
|
243
243
|
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
244
244
|
* sender.
|
|
245
245
|
* @throws Error if the request record is malformed (see
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// `Signet.compact`, their runtime descriptors, the ABI-word helpers, and the
|
|
4
4
|
// request -> transaction assembly the signer runs. Everything chain-agnostic
|
|
5
5
|
// (the request record itself, ids, the descriptor toolkit) lives in
|
|
6
|
-
// `signet-requests.ts
|
|
6
|
+
// `signet-requests.ts`. A future non-EVM decomposition gets a sibling of THIS
|
|
7
7
|
// file.
|
|
8
8
|
//
|
|
9
9
|
// The no-translation invariant lives here: words are stored ABI-ready and
|
|
@@ -24,7 +24,7 @@ const UINT_16 = new CompactTypeUnsignedInteger(2n ** 16n - 1n, 2);
|
|
|
24
24
|
const UINT_64 = new CompactTypeUnsignedInteger(2n ** 64n - 1n, 8);
|
|
25
25
|
const UINT_128 = new CompactTypeUnsignedInteger(2n ** 128n - 1n, 16);
|
|
26
26
|
/**
|
|
27
|
-
* Descriptor of {@link EvmCalldata} at one word capacity
|
|
27
|
+
* Descriptor of {@link EvmCalldata} at one word capacity: the TS analogue
|
|
28
28
|
* of instantiating Compact's `EvmCalldata<#maxWords>`.
|
|
29
29
|
*
|
|
30
30
|
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
@@ -52,7 +52,7 @@ export function evmAccessListEntryDescriptor(maxStorageKeys) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation
|
|
55
|
+
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation:
|
|
56
56
|
* the TS analogue of Compact's `EvmType2TxParams<#maxCalldataWords,
|
|
57
57
|
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
58
58
|
*
|
|
@@ -78,7 +78,7 @@ export function evmType2TxParamsDescriptor(maxCalldataWords, maxAccessListEntrie
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Descriptor of {@link SignBidirectionalEvent} at one EVM Type-2 capacity
|
|
81
|
-
* instantiation
|
|
81
|
+
* instantiation: the generic record descriptor
|
|
82
82
|
* (`signBidirectionalEventDescriptorWith`) over
|
|
83
83
|
* {@link evmType2TxParamsDescriptor}.
|
|
84
84
|
*
|
|
@@ -96,15 +96,15 @@ export function signBidirectionalEventDescriptor(maxCalldataWords, maxAccessList
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Canonical id of a signet request: the persistent hash of the entire event
|
|
99
|
-
* record (which commits to every field, the sender address included
|
|
100
|
-
*
|
|
99
|
+
* record (which commits to every field, the sender address included, and
|
|
100
|
+
* deliberately carries no extra domain tag). TS twin of Signet.compact's
|
|
101
101
|
* `calculateRequestId` circuit (see the deviation note in
|
|
102
102
|
* signet-requests.ts), generic over the capacity instantiation via the
|
|
103
|
-
* record's own array lengths
|
|
103
|
+
* record's own array lengths: pass the record exactly as the ledger stores
|
|
104
104
|
* it, unused slots included and schemas at their declared widths.
|
|
105
105
|
*
|
|
106
106
|
* @param request - The full event record (contract-shaped, all slots).
|
|
107
|
-
* @returns The 32-byte request id
|
|
107
|
+
* @returns The 32-byte request id, the record's ledger map key.
|
|
108
108
|
*/
|
|
109
109
|
export function calculateRequestId(request) {
|
|
110
110
|
const { txParams } = request;
|
|
@@ -203,7 +203,7 @@ export function abiWordToBool(word) {
|
|
|
203
203
|
* Assemble the raw calldata a request's words describe:
|
|
204
204
|
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
205
205
|
* ABI-ready (see {@link EvmCalldata}), so no byte of the stored record is
|
|
206
|
-
* reordered or reinterpreted on the way into the transaction
|
|
206
|
+
* reordered or reinterpreted on the way into the transaction. Slots past
|
|
207
207
|
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
208
208
|
* of the signer-side assembly documented on `EvmCalldata` in Signet.compact.
|
|
209
209
|
*
|
|
@@ -243,7 +243,7 @@ function decodeAccessList(txParams) {
|
|
|
243
243
|
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
244
244
|
* tagged words (see {@link assembleCalldata}), the count-trimmed access
|
|
245
245
|
* list, and the stored envelope fields. This is the canonical
|
|
246
|
-
* request→transaction transform
|
|
246
|
+
* request→transaction transform. Response-side verification
|
|
247
247
|
* (`signature-response-verification.ts`) and the signed-transaction builder
|
|
248
248
|
* below both go through it, so the transaction a client broadcasts is
|
|
249
249
|
* provably the one the MPC put its signature over.
|
|
@@ -271,8 +271,8 @@ export function signBidirectionalEventToUnsignedEvmTransaction(request) {
|
|
|
271
271
|
/**
|
|
272
272
|
* Decode a response signature record (as posted to the signet contract's
|
|
273
273
|
* signature response log) into an ethers {@link Signature}. Goes through
|
|
274
|
-
* {@link mpcSignatureToEcdsaSignature}
|
|
275
|
-
*
|
|
274
|
+
* {@link mpcSignatureToEcdsaSignature}, so this and in-circuit claims decode
|
|
275
|
+
* a post identically:
|
|
276
276
|
* ethers' `r` is the ECDSA scalar (`bigR.x` reduced mod the curve order),
|
|
277
277
|
* not the raw coordinate, and a malformed record is rejected the same way
|
|
278
278
|
* in both paths.
|
|
@@ -291,13 +291,13 @@ export function signatureRespondedEventToSignature(response) {
|
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* Encode an ECDSA signature as the response record posted to the signet
|
|
294
|
-
* contract
|
|
294
|
+
* contract: the inverse of {@link signatureRespondedEventToSignature}, for
|
|
295
295
|
* MPC-side posters (the fakenet signer, tests). An `r || s || v` signature
|
|
296
296
|
* carries only R.x and the parity of R.y, so the full R point the record
|
|
297
297
|
* stores is recovered on-curve (see {@link ecdsaSignatureToMpcSignature}).
|
|
298
298
|
*
|
|
299
299
|
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
300
|
-
* {@link Signature}) so signatures from ANY ethers instance qualify
|
|
300
|
+
* {@link Signature}) so signatures from ANY ethers instance qualify: posters
|
|
301
301
|
* living in other repos resolve their own ethers install, and nominal class
|
|
302
302
|
* typing would reject it.
|
|
303
303
|
*
|
|
@@ -319,12 +319,12 @@ export function signatureToSignatureRespondedEvent(signature) {
|
|
|
319
319
|
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
320
320
|
* signed (see {@link signBidirectionalEventToUnsignedEvmTransaction}) and
|
|
321
321
|
* attach the signature. Does NOT check that the signature recovers to the
|
|
322
|
-
* requester's derived address
|
|
322
|
+
* requester's derived address: the response log is unauthenticated, so
|
|
323
323
|
* verify first with `verifySignatureRespondedEvent`.
|
|
324
324
|
*
|
|
325
325
|
* @param request - The on-ledger request record.
|
|
326
326
|
* @param response - The posted signature record answering it.
|
|
327
|
-
* @returns The signed ethers transaction
|
|
327
|
+
* @returns The signed ethers transaction: `serialized` is the raw payload for
|
|
328
328
|
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
329
329
|
* sender.
|
|
330
330
|
* @throws Error if the request record is malformed (see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-evtype2tx-requests.js","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,8EAA8E;AAC9E,QAAQ;AACR,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AAEzE,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,SAAS,GAEV,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CA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;;;;GAgBG;AACH,MAAM,UAAU,4CAA4C,CAC1D,OAA+B,EAC/B,QAAiC;IAEjC,MAAM,WAAW,GAAG,8CAA8C,CAAC,OAAO,CAAC,CAAC;IAC5E,WAAW,CAAC,SAAS,GAAG,kCAAkC,CAAC,QAAQ,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -5,8 +5,8 @@ import type { RawContractState } from "./signature-state-reading.ts";
|
|
|
5
5
|
import type { SignBidirectionalEvent, RequestIdHex } from "./signet-requests.ts";
|
|
6
6
|
/**
|
|
7
7
|
* The least of midnight-js's `PublicDataProvider` the reader needs: raw
|
|
8
|
-
* contract state by address. Declared structurally
|
|
9
|
-
*
|
|
8
|
+
* contract state by address. Declared structurally so tests can satisfy it
|
|
9
|
+
* with a plain stub. Any full `PublicDataProvider`
|
|
10
10
|
* (e.g. `indexerPublicDataProvider`) is assignable to it.
|
|
11
11
|
*/
|
|
12
12
|
export interface SignetPublicStateSource {
|
|
@@ -26,7 +26,7 @@ export interface SignetRequestResponseReaderConfig {
|
|
|
26
26
|
/** Address of the signet-compliant requester contract (e.g. the vault). */
|
|
27
27
|
readonly requesterContractAddress: string;
|
|
28
28
|
/**
|
|
29
|
-
* Ledger field position of the requester contract's request index
|
|
29
|
+
* Ledger field position of the requester contract's request index: the
|
|
30
30
|
* same position the contract passes as `requestsIndexField` in its
|
|
31
31
|
* notifications. A contract is free to declare the index at any field, so
|
|
32
32
|
* the reader cannot assume one.
|
|
@@ -43,16 +43,16 @@ export interface SignatureResponseVerdict {
|
|
|
43
43
|
count: bigint;
|
|
44
44
|
/** The posted signature record, verbatim. */
|
|
45
45
|
response: SignatureRespondedEvent;
|
|
46
|
-
/** Recovered signer address
|
|
46
|
+
/** Recovered signer address, absent when the signature did not decode. */
|
|
47
47
|
signer?: string;
|
|
48
|
-
/** Why the post was rejected
|
|
48
|
+
/** Why the post was rejected, absent when the post is valid. */
|
|
49
49
|
rejectedReason?: string;
|
|
50
50
|
}
|
|
51
51
|
/** Result of {@link SignetRequestResponseReader['getVerifiedSignatureRespondedEvent']}. */
|
|
52
52
|
export interface VerifiedSignatureResponseResult {
|
|
53
53
|
/**
|
|
54
54
|
* The first valid response (lowest count), or `undefined` when no valid
|
|
55
|
-
* response has been posted yet
|
|
55
|
+
* response has been posted yet: poll again.
|
|
56
56
|
*/
|
|
57
57
|
verified?: SignatureRespondedEvent;
|
|
58
58
|
/**
|
|
@@ -64,7 +64,7 @@ export interface VerifiedSignatureResponseResult {
|
|
|
64
64
|
/**
|
|
65
65
|
* Reader over one requester contract / signet contract pair.
|
|
66
66
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
67
|
-
* are immutable
|
|
67
|
+
* are immutable, the ledger key is their hash), so repeated verification
|
|
68
68
|
* calls cost one responses-contract query each.
|
|
69
69
|
*/
|
|
70
70
|
export declare class SignetRequestResponseReader {
|
|
@@ -96,11 +96,11 @@ export declare class SignetRequestResponseReader {
|
|
|
96
96
|
getSignatureRequest(requestId: RequestIdHex): Promise<SignBidirectionalEvent>;
|
|
97
97
|
/**
|
|
98
98
|
* Fetch every response posted for `requestId`, in post (count) order.
|
|
99
|
-
* UNVERIFIED
|
|
100
|
-
* {@link getVerifiedSignatureRespondedEvent}.
|
|
99
|
+
* UNVERIFIED: any of them may be garbage (see
|
|
100
|
+
* {@link getVerifiedSignatureRespondedEvent}).
|
|
101
101
|
*
|
|
102
102
|
* @param requestId - The request id whose posts to enumerate.
|
|
103
|
-
* @returns The posted payloads, index = count
|
|
103
|
+
* @returns The posted payloads, index = count, empty when none yet.
|
|
104
104
|
* @throws Error when the responses contract has no state, or its counter
|
|
105
105
|
* disagrees with the log (inconsistent ledger).
|
|
106
106
|
*/
|
|
@@ -109,19 +109,19 @@ export declare class SignetRequestResponseReader {
|
|
|
109
109
|
* Fetch and verify the responses posted for `requestId`: each post's
|
|
110
110
|
* signature must recover to `expectedSigner`
|
|
111
111
|
* (compared case-insensitively) over the signing hash of the transaction
|
|
112
|
-
* the request record describes. The first valid post wins
|
|
113
|
-
* a verdict so callers can report the noise.
|
|
112
|
+
* the request record describes. The first valid post wins, and every post
|
|
113
|
+
* gets a verdict so callers can report the noise.
|
|
114
114
|
*
|
|
115
115
|
* @param requestId - The request id to fetch a verified response for.
|
|
116
116
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
117
|
-
* response must be signed by
|
|
117
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
118
118
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
119
119
|
* @throws Error when either contract has no state, the request is not on
|
|
120
120
|
* the requester's ledger, or the responses ledger is inconsistent.
|
|
121
121
|
*/
|
|
122
122
|
getVerifiedSignatureRespondedEvent(requestId: RequestIdHex, expectedSigner: string): Promise<VerifiedSignatureResponseResult>;
|
|
123
123
|
/**
|
|
124
|
-
* Rebuild the unsigned EIP-1559 transaction for `requestId
|
|
124
|
+
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
125
125
|
* transaction the MPC signs, assembled from the request record's decomposed
|
|
126
126
|
* fields. No responses-contract query: this needs only the request record
|
|
127
127
|
* (fetched via {@link getSignatureRequest}, cached).
|
|
@@ -136,30 +136,32 @@ export declare class SignetRequestResponseReader {
|
|
|
136
136
|
/**
|
|
137
137
|
* Assemble the broadcast-ready signed EIP-1559 transaction for `requestId`:
|
|
138
138
|
* rebuild the request's transaction and attach the first VERIFIED response
|
|
139
|
-
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}
|
|
140
|
-
* response log is unauthenticated, so an `expectedSigner` is required
|
|
141
|
-
* unverified posts are never attached).
|
|
139
|
+
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}:
|
|
140
|
+
* the response log is unauthenticated, so an `expectedSigner` is required
|
|
141
|
+
* and unverified posts are never attached).
|
|
142
142
|
*
|
|
143
143
|
* @param requestId - The request id to produce a signed transaction for.
|
|
144
144
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
145
|
-
* response must be signed by
|
|
145
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
146
146
|
* @returns The signed ethers transaction (`serialized` is the payload for
|
|
147
147
|
* `eth_sendRawTransaction`), or `undefined` when no valid response has
|
|
148
|
-
* been posted yet
|
|
148
|
+
* been posted yet: poll again.
|
|
149
149
|
* @throws Error when either contract has no state, the request is not on the
|
|
150
150
|
* requester's ledger, or the responses ledger is inconsistent.
|
|
151
151
|
*/
|
|
152
152
|
getSignedEvmTransaction(requestId: RequestIdHex, expectedSigner: string): Promise<Transaction | undefined>;
|
|
153
153
|
/**
|
|
154
154
|
* Fetch every respond-bidirectional response posted for `requestId`, in
|
|
155
|
-
* post (count) order. UNVERIFIED
|
|
156
|
-
* checking them, so any entry may be garbage
|
|
157
|
-
* trusting it (in-circuit at claim time, or off-chain
|
|
158
|
-
* `
|
|
159
|
-
*
|
|
155
|
+
* post (count) order. UNVERIFIED: the signet contract stores posts without
|
|
156
|
+
* checking them, so any entry may be garbage. Verify each candidate before
|
|
157
|
+
* trusting it (in-circuit at claim time, or off-chain: recompute the digest
|
|
158
|
+
* with the TS twin `calculateSignetAttestationDigest`, match it against the
|
|
159
|
+
* event's `attestationDigest`, and verify the ECDSA signature against the
|
|
160
|
+
* MPC response key you expect). An empty array simply means none posted
|
|
161
|
+
* yet: poll again.
|
|
160
162
|
*
|
|
161
163
|
* @param requestId - The request id whose responses to enumerate.
|
|
162
|
-
* @returns The posted records, index = count
|
|
164
|
+
* @returns The posted records, index = count, empty when none yet.
|
|
163
165
|
* @throws Error when the signet contract has no state, or its counter
|
|
164
166
|
* disagrees with the log (inconsistent ledger).
|
|
165
167
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,E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W,aAAa;IAc3B;;;;;;;;;OASG;IACG,mBAAmB,CACvB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,sBAAsB,CAAC;IAwBlC;;;;;;;;;OASG;IACG,qBAAqB,CACzB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAwBrC;;;;;;;;;;;;;OAaG;IACG,kCAAkC,CACtC,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,+BAA+B,CAAC;IAiC3C;;;;;;;;;;;OAWG;IACG,yBAAyB,CAC7B,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,WAAW,CAAC;IAMvB;;;;;;;;;;;;;;;OAeG;IACG,uBAAuB,CAC3B,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAcnC;;;;;;;;;;;;;;OAcG;IACG,6BAA6B,CACjC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAuBxC"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// the signet contract's signature response log, and verify each candidate
|
|
4
4
|
// against the request.
|
|
5
5
|
// This is the helper the Signet.compact "Response Ledger Layout" comment
|
|
6
|
-
// promises
|
|
7
|
-
// and take the first valid one
|
|
6
|
+
// promises: the log is UNAUTHENTICATED, so a client must verify every post
|
|
7
|
+
// and take the first valid one. This class packages that flow so every
|
|
8
8
|
// consumer (CLI poller, integration tests, a future UI) shares one
|
|
9
|
-
// implementation. Single-shot by design: each call queries state once
|
|
10
|
-
// caller owns any poll loop.
|
|
9
|
+
// implementation. Single-shot by design: each call queries state once, and
|
|
10
|
+
// the caller owns any poll loop.
|
|
11
11
|
import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
|
|
12
12
|
import { readSignetContractLedgerFromState, signetMapEntryKey, } from "./signet-contract-state-reader.js";
|
|
13
13
|
import { recoverSignatureResponseSigner } from "./signature-response-verification.js";
|
|
@@ -15,12 +15,12 @@ import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToU
|
|
|
15
15
|
/**
|
|
16
16
|
* Reader over one requester contract / signet contract pair.
|
|
17
17
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
18
|
-
* are immutable
|
|
18
|
+
* are immutable, the ledger key is their hash), so repeated verification
|
|
19
19
|
* calls cost one responses-contract query each.
|
|
20
20
|
*/
|
|
21
21
|
export class SignetRequestResponseReader {
|
|
22
22
|
config;
|
|
23
|
-
// Request records never change once stored
|
|
23
|
+
// Request records never change once stored, so cache them across calls.
|
|
24
24
|
requestCache = new Map();
|
|
25
25
|
/**
|
|
26
26
|
* @param config - The contract pair and state source to read through.
|
|
@@ -39,7 +39,7 @@ export class SignetRequestResponseReader {
|
|
|
39
39
|
async queryRawState(contractAddress, role) {
|
|
40
40
|
const state = await this.config.publicDataProvider.queryContractState(contractAddress);
|
|
41
41
|
if (!state?.data) {
|
|
42
|
-
throw new Error(`no state data found for ${role} contract '${contractAddress}'
|
|
42
|
+
throw new Error(`no state data found for ${role} contract '${contractAddress}' (is it deployed?)`);
|
|
43
43
|
}
|
|
44
44
|
return state.data;
|
|
45
45
|
}
|
|
@@ -62,18 +62,18 @@ export class SignetRequestResponseReader {
|
|
|
62
62
|
const request = lookupSignetRequestAt(raw, this.config.requesterRequestsIndexField, requestId);
|
|
63
63
|
if (request === undefined) {
|
|
64
64
|
throw new Error(`request ${requestId} is not on the requester contract's ledger ` +
|
|
65
|
-
`(request index at field ${this.config.requesterRequestsIndexField})
|
|
65
|
+
`(request index at field ${this.config.requesterRequestsIndexField}): was it submitted?`);
|
|
66
66
|
}
|
|
67
67
|
this.requestCache.set(requestId, request);
|
|
68
68
|
return request;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Fetch every response posted for `requestId`, in post (count) order.
|
|
72
|
-
* UNVERIFIED
|
|
73
|
-
* {@link getVerifiedSignatureRespondedEvent}.
|
|
72
|
+
* UNVERIFIED: any of them may be garbage (see
|
|
73
|
+
* {@link getVerifiedSignatureRespondedEvent}).
|
|
74
74
|
*
|
|
75
75
|
* @param requestId - The request id whose posts to enumerate.
|
|
76
|
-
* @returns The posted payloads, index = count
|
|
76
|
+
* @returns The posted payloads, index = count, empty when none yet.
|
|
77
77
|
* @throws Error when the responses contract has no state, or its counter
|
|
78
78
|
* disagrees with the log (inconsistent ledger).
|
|
79
79
|
*/
|
|
@@ -86,7 +86,7 @@ export class SignetRequestResponseReader {
|
|
|
86
86
|
const response = respondMap.get(signetMapEntryKey(requestId, count));
|
|
87
87
|
if (response === undefined) {
|
|
88
88
|
throw new Error(`response log has no entry ${count} for request ${requestId} ` +
|
|
89
|
-
`despite its counter reading ${totalPosts}
|
|
89
|
+
`despite its counter reading ${totalPosts}: ledger state is inconsistent`);
|
|
90
90
|
}
|
|
91
91
|
responses.push(response);
|
|
92
92
|
}
|
|
@@ -96,12 +96,12 @@ export class SignetRequestResponseReader {
|
|
|
96
96
|
* Fetch and verify the responses posted for `requestId`: each post's
|
|
97
97
|
* signature must recover to `expectedSigner`
|
|
98
98
|
* (compared case-insensitively) over the signing hash of the transaction
|
|
99
|
-
* the request record describes. The first valid post wins
|
|
100
|
-
* a verdict so callers can report the noise.
|
|
99
|
+
* the request record describes. The first valid post wins, and every post
|
|
100
|
+
* gets a verdict so callers can report the noise.
|
|
101
101
|
*
|
|
102
102
|
* @param requestId - The request id to fetch a verified response for.
|
|
103
103
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
104
|
-
* response must be signed by
|
|
104
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
105
105
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
106
106
|
* @throws Error when either contract has no state, the request is not on
|
|
107
107
|
* the requester's ledger, or the responses ledger is inconsistent.
|
|
@@ -138,7 +138,7 @@ export class SignetRequestResponseReader {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
|
-
* Rebuild the unsigned EIP-1559 transaction for `requestId
|
|
141
|
+
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
142
142
|
* transaction the MPC signs, assembled from the request record's decomposed
|
|
143
143
|
* fields. No responses-contract query: this needs only the request record
|
|
144
144
|
* (fetched via {@link getSignatureRequest}, cached).
|
|
@@ -155,16 +155,16 @@ export class SignetRequestResponseReader {
|
|
|
155
155
|
/**
|
|
156
156
|
* Assemble the broadcast-ready signed EIP-1559 transaction for `requestId`:
|
|
157
157
|
* rebuild the request's transaction and attach the first VERIFIED response
|
|
158
|
-
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}
|
|
159
|
-
* response log is unauthenticated, so an `expectedSigner` is required
|
|
160
|
-
* unverified posts are never attached).
|
|
158
|
+
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}:
|
|
159
|
+
* the response log is unauthenticated, so an `expectedSigner` is required
|
|
160
|
+
* and unverified posts are never attached).
|
|
161
161
|
*
|
|
162
162
|
* @param requestId - The request id to produce a signed transaction for.
|
|
163
163
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
164
|
-
* response must be signed by
|
|
164
|
+
* response must be signed by: the requester's MPC-derived address.
|
|
165
165
|
* @returns The signed ethers transaction (`serialized` is the payload for
|
|
166
166
|
* `eth_sendRawTransaction`), or `undefined` when no valid response has
|
|
167
|
-
* been posted yet
|
|
167
|
+
* been posted yet: poll again.
|
|
168
168
|
* @throws Error when either contract has no state, the request is not on the
|
|
169
169
|
* requester's ledger, or the responses ledger is inconsistent.
|
|
170
170
|
*/
|
|
@@ -173,21 +173,23 @@ export class SignetRequestResponseReader {
|
|
|
173
173
|
if (verified === undefined) {
|
|
174
174
|
return undefined;
|
|
175
175
|
}
|
|
176
|
-
// getSignatureRequest is cached
|
|
177
|
-
// fetched it, so this is a free lookup
|
|
176
|
+
// getSignatureRequest is cached: getVerifiedSignatureRespondedEvent already
|
|
177
|
+
// fetched it, so this is a free lookup.
|
|
178
178
|
const request = await this.getSignatureRequest(requestId);
|
|
179
179
|
return signBidirectionalEventToSignedEvmTransaction(request, verified);
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Fetch every respond-bidirectional response posted for `requestId`, in
|
|
183
|
-
* post (count) order. UNVERIFIED
|
|
184
|
-
* checking them, so any entry may be garbage
|
|
185
|
-
* trusting it (in-circuit at claim time, or off-chain
|
|
186
|
-
* `
|
|
187
|
-
*
|
|
183
|
+
* post (count) order. UNVERIFIED: the signet contract stores posts without
|
|
184
|
+
* checking them, so any entry may be garbage. Verify each candidate before
|
|
185
|
+
* trusting it (in-circuit at claim time, or off-chain: recompute the digest
|
|
186
|
+
* with the TS twin `calculateSignetAttestationDigest`, match it against the
|
|
187
|
+
* event's `attestationDigest`, and verify the ECDSA signature against the
|
|
188
|
+
* MPC response key you expect). An empty array simply means none posted
|
|
189
|
+
* yet: poll again.
|
|
188
190
|
*
|
|
189
191
|
* @param requestId - The request id whose responses to enumerate.
|
|
190
|
-
* @returns The posted records, index = count
|
|
192
|
+
* @returns The posted records, index = count, empty when none yet.
|
|
191
193
|
* @throws Error when the signet contract has no state, or its counter
|
|
192
194
|
* disagrees with the log (inconsistent ledger).
|
|
193
195
|
*/
|
|
@@ -200,7 +202,7 @@ export class SignetRequestResponseReader {
|
|
|
200
202
|
const response = respondBidirectionalMap.get(signetMapEntryKey(requestId, count));
|
|
201
203
|
if (response === undefined) {
|
|
202
204
|
throw new Error(`respond-bidirectional log has no entry ${count} for request ${requestId} ` +
|
|
203
|
-
`despite its counter reading ${totalPosts}
|
|
205
|
+
`despite its counter reading ${totalPosts}: ledger state is inconsistent`);
|
|
204
206
|
}
|
|
205
207
|
responses.push(response);
|
|
206
208
|
}
|