@sig-net/midnight 0.13.0 → 0.14.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 +13 -7
- package/dist/ecdsa-attestation.d.ts +29 -1
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +55 -0
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +0 -7
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +2 -4
- package/dist/managed/contract/index.js +46 -54
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +11 -11
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +8 -16
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +31 -7
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +34 -6
- package/dist/signet-request-response-reader.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +55 -63
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ The client-agnostic [Sig Network](https://sig.network) protocol library for the
|
|
|
13
13
|
```compact
|
|
14
14
|
import "@sig-net/midnight/src/Signet";
|
|
15
15
|
```
|
|
16
|
-
- **Compiled pure circuits** (`pureCircuits`): the executable reference implementation of the client-agnostic circuits (the deploy-time key pin, the notification packer, the ABI word builders and readers). Off-chain code calls these compiled artefacts, so it always agrees with what the contracts prove. The attestation digest and response verification are not among them: their compiled circuits are fixed-width oracles used only by this package's tests, and the sanctioned off-chain path is the TypeScript twin (`calculateSignetAttestationDigest`
|
|
16
|
+
- **Compiled pure circuits** (`pureCircuits`): the executable reference implementation of the client-agnostic circuits (the deploy-time key pin, the notification packer, the ABI word builders and readers). Off-chain code calls these compiled artefacts, so it always agrees with what the contracts prove. The attestation digest and response verification are not among them: their compiled circuits are fixed-width oracles used only by this package's tests, and the sanctioned off-chain path is the TypeScript twin (`calculateSignetAttestationDigest`, and `verifyRespondBidirectionalSignature` for ordinary ECDSA verification against the expected MPC response key), which those tests pin against the oracles: byte-for-byte for the digest, verdict-for-verdict for the verification.
|
|
17
17
|
- **TypeScript twins of the wire structs** and signet request-id computation.
|
|
18
18
|
- **State readers, request feed and resolver**: poll the signet contract for pending requests and their signature / remote-execution responses.
|
|
19
19
|
- **Crypto helpers**: epsilon derivation and ECDSA attestation verification.
|
|
@@ -33,8 +33,10 @@ The flow comprises 5 steps:
|
|
|
33
33
|
1. Client calls a contract on Midnight which requests a signature for a transaction destined for a foreign chain. The signature is made with a key derived for the requesting contract (see [Derived keys](#derived-keys)).
|
|
34
34
|
2. The Sig Network MPC honours the request, generating the transaction signature and posting it back to Midnight.
|
|
35
35
|
3. Client extracts the signature, using it to submit the signed transaction to the foreign chain.
|
|
36
|
-
4. The Sig Network MPC observes the foreign transaction and posts an attestation of the execution back to Midnight: the attestation digest `keccak256(requestId || serializedOutput)
|
|
37
|
-
5. Client obtains the execution output off chain (it broadcast the transaction in step 3, so it can read the result), extracts the posted attestation and submits both back to the Midnight contract, which recomputes the digest from the output bytes and verifies the MPC's signature in-circuit against the contract's own response key (see [Derived keys](#derived-keys)), completing the foreign transaction execution.
|
|
36
|
+
4. The Sig Network MPC observes the foreign transaction and posts an attestation of the execution back to Midnight: its ECDSA signature over the attestation digest `keccak256(requestId || serializedOutput)`. Both the digest and the output itself travel off chain.
|
|
37
|
+
5. Client obtains the execution output off chain (see the output recovery note below: it broadcast the transaction in step 3, so it can read the result), extracts the posted attestation and submits both back to the Midnight contract, which recomputes the digest from the output bytes and verifies the MPC's signature in-circuit against the contract's own response key (see [Derived keys](#derived-keys)), completing the foreign transaction execution.
|
|
38
|
+
|
|
39
|
+
> **Output recovery:** how the client reads the execution output is chain-specific. For EVM chains it is the mined call's return data, extracted with `debug_traceTransaction` (callTracer, top call frame), the same RPC method the MPC observes executions with. Clients without trace access can fetch the raw output from the fakenet responder's helper API at `GET /responses/{requestId}` (served by [`ResponsesApi.ts`](https://github.com/sig-net/solana-signet-program/blob/fakenet-v0.8.0/fakenet-signer/src/server/ResponsesApi.ts), port 3040 in the local stack). The fetched bytes are untrusted until step 5's in-circuit signature verification.
|
|
38
40
|
|
|
39
41
|
## Derived keys
|
|
40
42
|
|
|
@@ -209,11 +211,15 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
209
211
|
await new JsonRpcProvider(foreignChainRpcUrl).broadcastTransaction(signedTx.serialized);
|
|
210
212
|
```
|
|
211
213
|
|
|
212
|
-
4. Poll the Signet singleton for the MPC's attestation of the remote execution output (posted once the MPC observes the transaction execute on the foreign chain). The event carries
|
|
214
|
+
4. Poll the Signet singleton for the MPC's attestation of the remote execution output (posted once the MPC observes the transaction execute on the foreign chain). The event carries the MPC's signature alone: both the attestation digest and the serialised output itself travel off chain (you broadcast the transaction in step 3, so you can read its result). The log is unauthenticated, so use the verifying getter, as in step 2: it recomputes the digest over the output you present and returns only a post whose signature verifies against your contract's response key.
|
|
213
215
|
|
|
214
216
|
```ts
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
+
const respondBidirectionalEvent = await reader.getVerifiedRespondBidirectionalEvent(
|
|
218
|
+
requestId,
|
|
219
|
+
serializedOutput,
|
|
220
|
+
mpcResponseKey,
|
|
221
|
+
);
|
|
222
|
+
// undefined: no attestation of that output posted yet, poll again.
|
|
217
223
|
```
|
|
218
224
|
|
|
219
225
|
5. Deliver the response and the serialised output to your contract, which recomputes the attestation digest, verifies the event in-circuit against the response key pinned in Setup step 3, and consumes the request. The width argument is the exact packed size of your respond serialisation schema (a single bool packs to 1 byte):
|
|
@@ -268,7 +274,7 @@ const calldata = EvmCalldata<2> {
|
|
|
268
274
|
};
|
|
269
275
|
```
|
|
270
276
|
|
|
271
|
-
The readers run the same rules in the other direction, rejecting any non-canonical word outright (no silent truncation or coercion). Note that the builders and readers apply to CALLDATA words only. The serialised output a settle circuit verifies (the explicit `serializedOutput` argument `verifyRespondBidirectionalEvent`
|
|
277
|
+
The readers run the same rules in the other direction, rejecting any non-canonical word outright (no silent truncation or coercion). Note that the builders and readers apply to CALLDATA words only. The serialised output a settle circuit verifies (the explicit `serializedOutput` argument `verifyRespondBidirectionalEvent` recomputes the attestation digest from) is NOT ABI words: it is the packed respond payload produced from the request's respond serialisation schema (a bool packs to 1 byte). The circuit reads it with a single stdlib `deserialize<T, N>` call, where `T` is a struct mirroring the schema and `N` is the schema's packed size. For an ERC20 `transfer`'s `bool` return under a one-field bool schema:
|
|
272
278
|
|
|
273
279
|
```compact
|
|
274
280
|
struct TransferResult {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
2
2
|
import type { RequestId } from "./signet-requests.ts";
|
|
3
|
-
import type { MpcSignature } from "./signet-contract-state-reader.ts";
|
|
3
|
+
import type { MpcSignature, RespondBidirectionalEvent } from "./signet-contract-state-reader.ts";
|
|
4
4
|
export type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
5
5
|
/** secp256k1 curve (group) order n. */
|
|
6
6
|
export declare const SECP256K1_ORDER: bigint;
|
|
@@ -148,4 +148,32 @@ export declare function secp256k1PublicKeyOf(secretKey: Uint8Array): Secp256k1Po
|
|
|
148
148
|
* @returns The 32-byte attestation digest.
|
|
149
149
|
*/
|
|
150
150
|
export declare function calculateSignetAttestationDigest(requestId: RequestId, serializedOutput: Uint8Array): Uint8Array;
|
|
151
|
+
/**
|
|
152
|
+
* Off-chain check of a posted respond-bidirectional attestation: recompute
|
|
153
|
+
* the attestation digest of `(requestId, serializedOutput)` and verify the
|
|
154
|
+
* event's ECDSA signature over it against `mpcResponseKey`.
|
|
155
|
+
*
|
|
156
|
+
* The event carries the signature alone, so this check is the ONLY way to
|
|
157
|
+
* tell a genuine post from garbage: the signet contract's log is
|
|
158
|
+
* unauthenticated and every post is stored unverified. Use it to sift the
|
|
159
|
+
* candidates {@link SignetRequestResponseReader.getRespondBidirectionalEvents}
|
|
160
|
+
* returns before handing one to a contract. It is the off-chain counterpart
|
|
161
|
+
* of the in-circuit `verifyRespondBidirectionalEvent` and answers the same
|
|
162
|
+
* question, so a post this accepts is the post that proves at claim time.
|
|
163
|
+
*
|
|
164
|
+
* Malformed records are garbage, not faults: a signature whose components
|
|
165
|
+
* have the wrong width, whose `r` is off-curve, or which simply does not
|
|
166
|
+
* verify all return `false` rather than throwing. High-`s` signatures are
|
|
167
|
+
* accepted, matching the in-circuit verification (which enforces no low-`s`
|
|
168
|
+
* policy) rather than the signer's own normalisation.
|
|
169
|
+
*
|
|
170
|
+
* @param requestId - The 32-byte request id the response answers.
|
|
171
|
+
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
172
|
+
* @param event - The posted record to check, as read off the ledger.
|
|
173
|
+
* @param mpcResponseKey - The response key the requesting contract pinned:
|
|
174
|
+
* the MPC key derived for its address and the fixed "midnight response key"
|
|
175
|
+
* path (see {@link deriveMidnightResponseKey}).
|
|
176
|
+
* @returns Whether the post is a genuine attestation of that output.
|
|
177
|
+
*/
|
|
178
|
+
export declare function verifyRespondBidirectionalSignature(requestId: RequestId, serializedOutput: Uint8Array, event: RespondBidirectionalEvent, mpcResponseKey: Secp256k1Point): boolean;
|
|
151
179
|
//# sourceMappingURL=ecdsa-attestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE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CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,cAAc,CAO1E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAIZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,EAC5B,KAAK,EAAE,yBAAyB,EAChC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAyBT"}
|
|
@@ -256,4 +256,59 @@ export function secp256k1PublicKeyOf(secretKey) {
|
|
|
256
256
|
export function calculateSignetAttestationDigest(requestId, serializedOutput) {
|
|
257
257
|
return ethers.getBytes(ethers.keccak256(ethers.concat([requestId, serializedOutput])));
|
|
258
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Off-chain check of a posted respond-bidirectional attestation: recompute
|
|
261
|
+
* the attestation digest of `(requestId, serializedOutput)` and verify the
|
|
262
|
+
* event's ECDSA signature over it against `mpcResponseKey`.
|
|
263
|
+
*
|
|
264
|
+
* The event carries the signature alone, so this check is the ONLY way to
|
|
265
|
+
* tell a genuine post from garbage: the signet contract's log is
|
|
266
|
+
* unauthenticated and every post is stored unverified. Use it to sift the
|
|
267
|
+
* candidates {@link SignetRequestResponseReader.getRespondBidirectionalEvents}
|
|
268
|
+
* returns before handing one to a contract. It is the off-chain counterpart
|
|
269
|
+
* of the in-circuit `verifyRespondBidirectionalEvent` and answers the same
|
|
270
|
+
* question, so a post this accepts is the post that proves at claim time.
|
|
271
|
+
*
|
|
272
|
+
* Malformed records are garbage, not faults: a signature whose components
|
|
273
|
+
* have the wrong width, whose `r` is off-curve, or which simply does not
|
|
274
|
+
* verify all return `false` rather than throwing. High-`s` signatures are
|
|
275
|
+
* accepted, matching the in-circuit verification (which enforces no low-`s`
|
|
276
|
+
* policy) rather than the signer's own normalisation.
|
|
277
|
+
*
|
|
278
|
+
* @param requestId - The 32-byte request id the response answers.
|
|
279
|
+
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
280
|
+
* @param event - The posted record to check, as read off the ledger.
|
|
281
|
+
* @param mpcResponseKey - The response key the requesting contract pinned:
|
|
282
|
+
* the MPC key derived for its address and the fixed "midnight response key"
|
|
283
|
+
* path (see {@link deriveMidnightResponseKey}).
|
|
284
|
+
* @returns Whether the post is a genuine attestation of that output.
|
|
285
|
+
*/
|
|
286
|
+
export function verifyRespondBidirectionalSignature(requestId, serializedOutput, event, mpcResponseKey) {
|
|
287
|
+
let signature;
|
|
288
|
+
try {
|
|
289
|
+
signature = mpcSignatureToEcdsaSignature(event.signature);
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
const digest = calculateSignetAttestationDigest(requestId, serializedOutput);
|
|
295
|
+
// Compact form the verifier takes: r || s big-endian, and the key as
|
|
296
|
+
// uncompressed SEC1 (0x04 || x || y).
|
|
297
|
+
const compactSignature = new Uint8Array(64);
|
|
298
|
+
compactSignature.set(bigintToBytes32BE(signature.r), 0);
|
|
299
|
+
compactSignature.set(bigintToBytes32BE(signature.s), 32);
|
|
300
|
+
const publicKey = new Uint8Array(65);
|
|
301
|
+
publicKey[0] = 0x04;
|
|
302
|
+
publicKey.set(bigintToBytes32BE(mpcResponseKey.x), 1);
|
|
303
|
+
publicKey.set(bigintToBytes32BE(mpcResponseKey.y), 33);
|
|
304
|
+
try {
|
|
305
|
+
return secp256k1.verify(compactSignature, digest, publicKey, {
|
|
306
|
+
prehash: false,
|
|
307
|
+
lowS: false,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
259
314
|
//# sourceMappingURL=ecdsa-attestation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,kEAAkE;AAClE,uEAAuE;AACvE,2EAA2E;AAC3E,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,4DAA4D;AAC5D,oCAAoC;AACpC,EAAE;AACF,wEAAwE;AACxE,8BAA8B;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,kEAAkE;AAClE,uEAAuE;AACvE,2EAA2E;AAC3E,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,4DAA4D;AAC5D,oCAAoC;AACpC,EAAE;AACF,wEAAwE;AACxE,8BAA8B;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAavD,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAExD,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,8EAA8E,CAAC;AAExG;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,iEAAiE;QACjE,qD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AC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,gCAAgC,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAC7E,qEAAqE;IACrE,sCAAsC;IACtC,MAAM,gBAAgB,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC5C,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE;YAC3D,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
"type": "directory",
|
|
8
8
|
"contract-info.json": {
|
|
9
9
|
"type": "file",
|
|
10
|
-
"size":
|
|
11
|
-
"hash": "
|
|
10
|
+
"size": 7955,
|
|
11
|
+
"hash": "bdc0fba992f5d93b36bfe0a807b35d05943505a5fc9dc48c46ba33a4269c65c9"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"contract": {
|
|
15
15
|
"type": "directory",
|
|
16
16
|
"index.d.ts": {
|
|
17
17
|
"type": "file",
|
|
18
|
-
"size":
|
|
19
|
-
"hash": "
|
|
18
|
+
"size": 6388,
|
|
19
|
+
"hash": "c8f837fb853f415edca32eb789a5391a327ad168dd1d48e8b7eb72eadc5d7af8"
|
|
20
20
|
},
|
|
21
21
|
"index.js": {
|
|
22
22
|
"type": "file",
|
|
23
|
-
"size":
|
|
24
|
-
"hash": "
|
|
23
|
+
"size": 48928,
|
|
24
|
+
"hash": "cd4412517d099f20ca53775c282192bf5b5ea4727b2b63fd7d8e2e311bbc8a6c"
|
|
25
25
|
},
|
|
26
26
|
"index.js.map": {
|
|
27
27
|
"type": "file",
|
|
28
|
-
"size":
|
|
29
|
-
"hash": "
|
|
28
|
+
"size": 4664,
|
|
29
|
+
"hash": "26117f20d193b8494ad25ae56f22e64233b403ff613a6a880a426604e9f55c21"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -29,8 +29,7 @@ export type PureCircuits = {
|
|
|
29
29
|
serializedOutput_0: Uint8Array): Uint8Array;
|
|
30
30
|
verifyRespondBidirectionalEvent32(requestId_0: Uint8Array,
|
|
31
31
|
serializedOutput_0: Uint8Array,
|
|
32
|
-
respondBidirectionalEvent_0: {
|
|
33
|
-
signature: { bigR: { x: Uint8Array,
|
|
32
|
+
respondBidirectionalEvent_0: { signature: { bigR: { x: Uint8Array,
|
|
34
33
|
y: Uint8Array
|
|
35
34
|
},
|
|
36
35
|
s: Uint8Array,
|
|
@@ -68,8 +67,7 @@ export type Circuits<PS> = {
|
|
|
68
67
|
verifyRespondBidirectionalEvent32(context: __compactRuntime.CircuitContext<PS>,
|
|
69
68
|
requestId_0: Uint8Array,
|
|
70
69
|
serializedOutput_0: Uint8Array,
|
|
71
|
-
respondBidirectionalEvent_0: {
|
|
72
|
-
signature: { bigR: { x: Uint8Array,
|
|
70
|
+
respondBidirectionalEvent_0: { signature: { bigR: { x: Uint8Array,
|
|
73
71
|
y: Uint8Array
|
|
74
72
|
},
|
|
75
73
|
s: Uint8Array,
|
|
@@ -44,16 +44,15 @@ const _descriptor_4 = new _Signature_0();
|
|
|
44
44
|
|
|
45
45
|
class _RespondBidirectionalEvent_0 {
|
|
46
46
|
alignment() {
|
|
47
|
-
return
|
|
47
|
+
return _descriptor_4.alignment();
|
|
48
48
|
}
|
|
49
49
|
fromValue(value_0) {
|
|
50
50
|
return {
|
|
51
|
-
attestationDigest: _descriptor_0.fromValue(value_0),
|
|
52
51
|
signature: _descriptor_4.fromValue(value_0)
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
toValue(value_0) {
|
|
56
|
-
return
|
|
55
|
+
return _descriptor_4.toValue(value_0.signature);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
|
|
@@ -441,23 +440,20 @@ export class Contract {
|
|
|
441
440
|
{
|
|
442
441
|
const digest_0 = this._calculateSignetAttestationDigest_2(requestId_0,
|
|
443
442
|
serializedOutput_0);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
'Signet.compact line 357 char 12') },
|
|
459
|
-
mpcResponseKey_0);
|
|
460
|
-
return checkpointMatches_0 && signatureValid_0;
|
|
443
|
+
return this._secp256k1EcdsaVerify_0(digest_0,
|
|
444
|
+
{ r:
|
|
445
|
+
__compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
|
|
446
|
+
32,
|
|
447
|
+
this._reverseBytes32_0(respondBidirectionalEvent_0.signature.bigR.x),
|
|
448
|
+
'Secp256k1Scalar',
|
|
449
|
+
'Signet.compact line 349 char 12'),
|
|
450
|
+
s:
|
|
451
|
+
__compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
|
|
452
|
+
32,
|
|
453
|
+
this._reverseBytes32_0(respondBidirectionalEvent_0.signature.s),
|
|
454
|
+
'Secp256k1Scalar',
|
|
455
|
+
'Signet.compact line 350 char 12') },
|
|
456
|
+
mpcResponseKey_0);
|
|
461
457
|
}
|
|
462
458
|
_signetKeyHash_0(pk_0) { return this._persistentHash_0(pk_0); }
|
|
463
459
|
_evmAddressAbiWord_0(addr_0) {
|
|
@@ -468,7 +464,7 @@ export class Contract {
|
|
|
468
464
|
_numericAbiWord_0(value_0) {
|
|
469
465
|
const le_0 = Array.from(__compactRuntime.convertBigintToBytes(16,
|
|
470
466
|
value_0,
|
|
471
|
-
'Signet.compact line
|
|
467
|
+
'Signet.compact line 431 char 17'),
|
|
472
468
|
BigInt);
|
|
473
469
|
return Uint8Array.from([...Array.from(new Uint8Array(16), BigInt),
|
|
474
470
|
le_0[15],
|
|
@@ -500,7 +496,7 @@ export class Contract {
|
|
|
500
496
|
((e, i) => e.slice(i, i+16))(word_0,
|
|
501
497
|
Number(0n)),
|
|
502
498
|
'Field',
|
|
503
|
-
'Signet.compact line
|
|
499
|
+
'Signet.compact line 450 char 12')
|
|
504
500
|
===
|
|
505
501
|
0n,
|
|
506
502
|
'ABI word exceeds Uint<128>');
|
|
@@ -509,77 +505,77 @@ export class Contract {
|
|
|
509
505
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
510
506
|
Number(16n)),
|
|
511
507
|
'Field',
|
|
512
|
-
'Signet.compact line
|
|
508
|
+
'Signet.compact line 451 char 17');
|
|
513
509
|
const b1_0 = __compactRuntime.addField(__compactRuntime.mulField(b0_0, 256n),
|
|
514
510
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
515
511
|
1,
|
|
516
512
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
517
513
|
Number(17n)),
|
|
518
514
|
'Field',
|
|
519
|
-
'Signet.compact line
|
|
515
|
+
'Signet.compact line 452 char 30'));
|
|
520
516
|
const b2_0 = __compactRuntime.addField(__compactRuntime.mulField(b1_0, 256n),
|
|
521
517
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
522
518
|
1,
|
|
523
519
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
524
520
|
Number(18n)),
|
|
525
521
|
'Field',
|
|
526
|
-
'Signet.compact line
|
|
522
|
+
'Signet.compact line 453 char 30'));
|
|
527
523
|
const b3_0 = __compactRuntime.addField(__compactRuntime.mulField(b2_0, 256n),
|
|
528
524
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
529
525
|
1,
|
|
530
526
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
531
527
|
Number(19n)),
|
|
532
528
|
'Field',
|
|
533
|
-
'Signet.compact line
|
|
529
|
+
'Signet.compact line 454 char 30'));
|
|
534
530
|
const b4_0 = __compactRuntime.addField(__compactRuntime.mulField(b3_0, 256n),
|
|
535
531
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
536
532
|
1,
|
|
537
533
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
538
534
|
Number(20n)),
|
|
539
535
|
'Field',
|
|
540
|
-
'Signet.compact line
|
|
536
|
+
'Signet.compact line 455 char 30'));
|
|
541
537
|
const b5_0 = __compactRuntime.addField(__compactRuntime.mulField(b4_0, 256n),
|
|
542
538
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
543
539
|
1,
|
|
544
540
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
545
541
|
Number(21n)),
|
|
546
542
|
'Field',
|
|
547
|
-
'Signet.compact line
|
|
543
|
+
'Signet.compact line 456 char 30'));
|
|
548
544
|
const b6_0 = __compactRuntime.addField(__compactRuntime.mulField(b5_0, 256n),
|
|
549
545
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
550
546
|
1,
|
|
551
547
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
552
548
|
Number(22n)),
|
|
553
549
|
'Field',
|
|
554
|
-
'Signet.compact line
|
|
550
|
+
'Signet.compact line 457 char 30'));
|
|
555
551
|
const b7_0 = __compactRuntime.addField(__compactRuntime.mulField(b6_0, 256n),
|
|
556
552
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
557
553
|
1,
|
|
558
554
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
559
555
|
Number(23n)),
|
|
560
556
|
'Field',
|
|
561
|
-
'Signet.compact line
|
|
557
|
+
'Signet.compact line 458 char 30'));
|
|
562
558
|
const b8_0 = __compactRuntime.addField(__compactRuntime.mulField(b7_0, 256n),
|
|
563
559
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
564
560
|
1,
|
|
565
561
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
566
562
|
Number(24n)),
|
|
567
563
|
'Field',
|
|
568
|
-
'Signet.compact line
|
|
564
|
+
'Signet.compact line 459 char 30'));
|
|
569
565
|
const b9_0 = __compactRuntime.addField(__compactRuntime.mulField(b8_0, 256n),
|
|
570
566
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
571
567
|
1,
|
|
572
568
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
573
569
|
Number(25n)),
|
|
574
570
|
'Field',
|
|
575
|
-
'Signet.compact line
|
|
571
|
+
'Signet.compact line 460 char 30'));
|
|
576
572
|
const b10_0 = __compactRuntime.addField(__compactRuntime.mulField(b9_0, 256n),
|
|
577
573
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
578
574
|
1,
|
|
579
575
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
580
576
|
Number(26n)),
|
|
581
577
|
'Field',
|
|
582
|
-
'Signet.compact line
|
|
578
|
+
'Signet.compact line 461 char 30'));
|
|
583
579
|
const b11_0 = __compactRuntime.addField(__compactRuntime.mulField(b10_0,
|
|
584
580
|
256n),
|
|
585
581
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
@@ -587,7 +583,7 @@ export class Contract {
|
|
|
587
583
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
588
584
|
Number(27n)),
|
|
589
585
|
'Field',
|
|
590
|
-
'Signet.compact line
|
|
586
|
+
'Signet.compact line 462 char 30'));
|
|
591
587
|
const b12_0 = __compactRuntime.addField(__compactRuntime.mulField(b11_0,
|
|
592
588
|
256n),
|
|
593
589
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
@@ -595,7 +591,7 @@ export class Contract {
|
|
|
595
591
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
596
592
|
Number(28n)),
|
|
597
593
|
'Field',
|
|
598
|
-
'Signet.compact line
|
|
594
|
+
'Signet.compact line 463 char 30'));
|
|
599
595
|
const b13_0 = __compactRuntime.addField(__compactRuntime.mulField(b12_0,
|
|
600
596
|
256n),
|
|
601
597
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
@@ -603,7 +599,7 @@ export class Contract {
|
|
|
603
599
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
604
600
|
Number(29n)),
|
|
605
601
|
'Field',
|
|
606
|
-
'Signet.compact line
|
|
602
|
+
'Signet.compact line 464 char 30'));
|
|
607
603
|
const b14_0 = __compactRuntime.addField(__compactRuntime.mulField(b13_0,
|
|
608
604
|
256n),
|
|
609
605
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
@@ -611,7 +607,7 @@ export class Contract {
|
|
|
611
607
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
612
608
|
Number(30n)),
|
|
613
609
|
'Field',
|
|
614
|
-
'Signet.compact line
|
|
610
|
+
'Signet.compact line 465 char 30'));
|
|
615
611
|
const b15_0 = __compactRuntime.addField(__compactRuntime.mulField(b14_0,
|
|
616
612
|
256n),
|
|
617
613
|
__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
@@ -619,10 +615,10 @@ export class Contract {
|
|
|
619
615
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
620
616
|
Number(31n)),
|
|
621
617
|
'Field',
|
|
622
|
-
'Signet.compact line
|
|
618
|
+
'Signet.compact line 466 char 30'));
|
|
623
619
|
return ((t1) => {
|
|
624
620
|
if (t1 > 340282366920938463463374607431768211455n) {
|
|
625
|
-
throw new __compactRuntime.CompactError('Signet.compact line
|
|
621
|
+
throw new __compactRuntime.CompactError('Signet.compact line 467 char 12: cast from Field or Uint value to smaller Uint value failed: ' + t1 + ' is greater than 340282366920938463463374607431768211455');
|
|
626
622
|
}
|
|
627
623
|
return t1;
|
|
628
624
|
})(b15_0);
|
|
@@ -633,7 +629,7 @@ export class Contract {
|
|
|
633
629
|
((e, i) => e.slice(i, i+31))(word_0,
|
|
634
630
|
Number(0n)),
|
|
635
631
|
'Field',
|
|
636
|
-
'Signet.compact line
|
|
632
|
+
'Signet.compact line 473 char 12')
|
|
637
633
|
===
|
|
638
634
|
0n,
|
|
639
635
|
'ABI word is not a canonical Boolean');
|
|
@@ -642,7 +638,7 @@ export class Contract {
|
|
|
642
638
|
((e, i) => e.slice(i, i+1))(word_0,
|
|
643
639
|
Number(31n)),
|
|
644
640
|
'Field',
|
|
645
|
-
'Signet.compact line
|
|
641
|
+
'Signet.compact line 474 char 18');
|
|
646
642
|
__compactRuntime.assert(last_0 === 0n || last_0 === 1n,
|
|
647
643
|
'ABI word is not a canonical Boolean');
|
|
648
644
|
return last_0 === 1n;
|
|
@@ -669,10 +665,6 @@ export class Contract {
|
|
|
669
665
|
respondBidirectionalEvent_0,
|
|
670
666
|
mpcResponseKey_0);
|
|
671
667
|
}
|
|
672
|
-
_equal_0(x0, y0) {
|
|
673
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
674
|
-
return true;
|
|
675
|
-
}
|
|
676
668
|
}
|
|
677
669
|
export function ledger(stateOrChargedState) {
|
|
678
670
|
const state = stateOrChargedState instanceof __compactRuntime.StateValue ? stateOrChargedState : stateOrChargedState.state;
|
|
@@ -704,14 +696,14 @@ export const pureCircuits = {
|
|
|
704
696
|
if (!(typeof(callerAddress_0) === 'object' && callerAddress_0.bytes.buffer instanceof ArrayBuffer && callerAddress_0.bytes.BYTES_PER_ELEMENT === 1 && callerAddress_0.bytes.length === 32)) {
|
|
705
697
|
__compactRuntime.typeError('constructSignBidirectionalEventNotificationV1',
|
|
706
698
|
'argument 1',
|
|
707
|
-
'Signet.compact line
|
|
699
|
+
'Signet.compact line 218 char 3',
|
|
708
700
|
'struct ContractAddress<bytes: Bytes<32>>',
|
|
709
701
|
callerAddress_0)
|
|
710
702
|
}
|
|
711
703
|
if (!(typeof(requestsIndexField_0) === 'bigint' && requestsIndexField_0 >= 0n && requestsIndexField_0 <= 255n)) {
|
|
712
704
|
__compactRuntime.typeError('constructSignBidirectionalEventNotificationV1',
|
|
713
705
|
'argument 2',
|
|
714
|
-
'Signet.compact line
|
|
706
|
+
'Signet.compact line 218 char 3',
|
|
715
707
|
'Uint<0..256>',
|
|
716
708
|
requestsIndexField_0)
|
|
717
709
|
}
|
|
@@ -733,7 +725,7 @@ export const pureCircuits = {
|
|
|
733
725
|
if (!(addr_0.buffer instanceof ArrayBuffer && addr_0.BYTES_PER_ELEMENT === 1 && addr_0.length === 20)) {
|
|
734
726
|
__compactRuntime.typeError('evmAddressAbiWord',
|
|
735
727
|
'argument 1',
|
|
736
|
-
'Signet.compact line
|
|
728
|
+
'Signet.compact line 422 char 3',
|
|
737
729
|
'Bytes<20>',
|
|
738
730
|
addr_0)
|
|
739
731
|
}
|
|
@@ -747,7 +739,7 @@ export const pureCircuits = {
|
|
|
747
739
|
if (!(typeof(value_0) === 'bigint' && value_0 >= 0n && value_0 <= 340282366920938463463374607431768211455n)) {
|
|
748
740
|
__compactRuntime.typeError('numericAbiWord',
|
|
749
741
|
'argument 1',
|
|
750
|
-
'Signet.compact line
|
|
742
|
+
'Signet.compact line 428 char 3',
|
|
751
743
|
'Uint<0..340282366920938463463374607431768211456>',
|
|
752
744
|
value_0)
|
|
753
745
|
}
|
|
@@ -761,7 +753,7 @@ export const pureCircuits = {
|
|
|
761
753
|
if (!(typeof(value_0) === 'boolean')) {
|
|
762
754
|
__compactRuntime.typeError('boolAbiWord',
|
|
763
755
|
'argument 1',
|
|
764
|
-
'Signet.compact line
|
|
756
|
+
'Signet.compact line 441 char 3',
|
|
765
757
|
'Boolean',
|
|
766
758
|
value_0)
|
|
767
759
|
}
|
|
@@ -775,7 +767,7 @@ export const pureCircuits = {
|
|
|
775
767
|
if (!(word_0.buffer instanceof ArrayBuffer && word_0.BYTES_PER_ELEMENT === 1 && word_0.length === 32)) {
|
|
776
768
|
__compactRuntime.typeError('abiWordToUint128',
|
|
777
769
|
'argument 1',
|
|
778
|
-
'Signet.compact line
|
|
770
|
+
'Signet.compact line 449 char 3',
|
|
779
771
|
'Bytes<32>',
|
|
780
772
|
word_0)
|
|
781
773
|
}
|
|
@@ -789,7 +781,7 @@ export const pureCircuits = {
|
|
|
789
781
|
if (!(word_0.buffer instanceof ArrayBuffer && word_0.BYTES_PER_ELEMENT === 1 && word_0.length === 32)) {
|
|
790
782
|
__compactRuntime.typeError('abiWordToBool',
|
|
791
783
|
'argument 1',
|
|
792
|
-
'Signet.compact line
|
|
784
|
+
'Signet.compact line 472 char 3',
|
|
793
785
|
'Bytes<32>',
|
|
794
786
|
word_0)
|
|
795
787
|
}
|
|
@@ -886,11 +878,11 @@ export const pureCircuits = {
|
|
|
886
878
|
'Bytes<32>',
|
|
887
879
|
serializedOutput_0)
|
|
888
880
|
}
|
|
889
|
-
if (!(typeof(respondBidirectionalEvent_0) === 'object' &&
|
|
881
|
+
if (!(typeof(respondBidirectionalEvent_0) === 'object' && typeof(respondBidirectionalEvent_0.signature) === 'object' && typeof(respondBidirectionalEvent_0.signature.bigR) === 'object' && respondBidirectionalEvent_0.signature.bigR.x.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.signature.bigR.x.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.signature.bigR.x.length === 32 && respondBidirectionalEvent_0.signature.bigR.y.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.signature.bigR.y.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.signature.bigR.y.length === 32 && respondBidirectionalEvent_0.signature.s.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.signature.s.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.signature.s.length === 32 && typeof(respondBidirectionalEvent_0.signature.recoveryId) === 'bigint' && respondBidirectionalEvent_0.signature.recoveryId >= 0n && respondBidirectionalEvent_0.signature.recoveryId <= 255n)) {
|
|
890
882
|
__compactRuntime.typeError('verifyRespondBidirectionalEvent32',
|
|
891
883
|
'argument 3',
|
|
892
884
|
'circuits.compact line 55 char 1',
|
|
893
|
-
'struct RespondBidirectionalEvent<
|
|
885
|
+
'struct RespondBidirectionalEvent<signature: struct Signature<bigR: struct AffinePoint<x: Bytes<32>, y: Bytes<32>>, s: Bytes<32>, recoveryId: Uint<0..256>>>',
|
|
894
886
|
respondBidirectionalEvent_0)
|
|
895
887
|
}
|
|
896
888
|
return _dummyContract._verifyRespondBidirectionalEvent32_0(requestId_0,
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"sourceRoot": "../../../",
|
|
5
5
|
"sources": ["src/circuits.compact", "src/./Signet.compact", "compiler/zkir-v3-library.compact"],
|
|
6
6
|
"names": [],
|
|
7
|
-
"mappings": "
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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WAAoB;UACpB,kBAA2B;UAC3B,2BAAoD;UACpD,gBAA8B;;;;;;;;;;;;;;;;;;;;;;+DAH9B,WAAoB;+DACpB,kBAA2B;+DAC3B,2BAAoD;+DACpD,gBAA8B;GAQ/B;;;;;;"
|
|
8
8
|
}
|
|
@@ -58,17 +58,17 @@ export interface SignatureRespondedEvent {
|
|
|
58
58
|
export declare const signatureRespondedEventType: CompactType<SignatureRespondedEvent>;
|
|
59
59
|
/**
|
|
60
60
|
* The MPC's respond-bidirectional attestation of a request's remote EVM
|
|
61
|
-
* execution (Compact `RespondBidirectionalEvent`): the
|
|
62
|
-
* `keccak256(requestId || serializedOutput)
|
|
63
|
-
*
|
|
64
|
-
* digest (`calculateSignetAttestationDigest`) and
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* (in-circuit via
|
|
61
|
+
* execution (Compact `RespondBidirectionalEvent`): the ECDSA signature over
|
|
62
|
+
* the attestation digest `keccak256(requestId || serializedOutput)`. Both the
|
|
63
|
+
* digest and the output travel off chain: readers fetch the output, recompute
|
|
64
|
+
* the digest (`calculateSignetAttestationDigest`) and verify the signature
|
|
65
|
+
* over it. Stored UNVERIFIED by the signet contract, so that signature check
|
|
66
|
+
* against the expected MPC response key is the only thing separating a
|
|
67
|
+
* genuine post from garbage (in-circuit via
|
|
68
|
+
* `verifyRespondBidirectionalEvent`, off chain via
|
|
69
|
+
* {@link verifyRespondBidirectionalSignature}).
|
|
68
70
|
*/
|
|
69
71
|
export interface RespondBidirectionalEvent {
|
|
70
|
-
/** The signed attestation digest: `keccak256(requestId || serializedOutput)`. */
|
|
71
|
-
attestationDigest: Uint8Array;
|
|
72
72
|
/** ECDSA signature over the attestation digest. */
|
|
73
73
|
signature: MpcSignature;
|
|
74
74
|
}
|
|
@@ -91,8 +91,8 @@ export interface SignetMapKey {
|
|
|
91
91
|
*/
|
|
92
92
|
export declare const signetMapKeyType: CompactType<SignetMapKey>;
|
|
93
93
|
/**
|
|
94
|
-
* Hand-composed descriptor for {@link RespondBidirectionalEvent}
|
|
95
|
-
*
|
|
94
|
+
* Hand-composed descriptor for {@link RespondBidirectionalEvent}: the single
|
|
95
|
+
* {@link MpcSignature} field, matching the Compact struct.
|
|
96
96
|
*/
|
|
97
97
|
export declare const respondBidirectionalEventType: CompactType<RespondBidirectionalEvent>;
|
|
98
98
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,uFAAuF;AACvF,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAajD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;IACd,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,CAAC,EAAE,UAAU,CAAC;IACd,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AA2CD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,uBAAuB,CAuB5E,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,uFAAuF;AACvF,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAajD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;IACd,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,CAAC,EAAE,UAAU,CAAC;IACd,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AA2CD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,uBAAuB,CAuB5E,CAAC;AAE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AAM,EAAE,yBAAyB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzE;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,+CAA+C,CAC7D,GAAG,EAAE,gBAAgB,GACpB,kCAAkC,CAyBpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,4CAA4C,EAAE,kBAAkB,CAAC;IACjE;;;OAGG;IACH,qCAAqC,EAAE,kCAAkC,CAAC;IAC1E,6DAA6D;IAC7D,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,mFAAmF;IACnF,UAAU,EAAE,sBAAsB,CAAC;IACnC,yEAAyE;IACzE,8BAA8B,EAAE,kBAAkB,CAAC;IACnD,0FAA0F;IAC1F,uBAAuB,EAAE,yBAAyB,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,CA2BtB"}
|
|
@@ -138,39 +138,31 @@ export const signetMapKeyType = {
|
|
|
138
138
|
},
|
|
139
139
|
};
|
|
140
140
|
/**
|
|
141
|
-
* Hand-composed descriptor for {@link RespondBidirectionalEvent}
|
|
142
|
-
*
|
|
141
|
+
* Hand-composed descriptor for {@link RespondBidirectionalEvent}: the single
|
|
142
|
+
* {@link MpcSignature} field, matching the Compact struct.
|
|
143
143
|
*/
|
|
144
144
|
export const respondBidirectionalEventType = {
|
|
145
|
-
/** @returns
|
|
145
|
+
/** @returns Alignment of the struct's single signature field. */
|
|
146
146
|
alignment() {
|
|
147
|
-
return
|
|
148
|
-
.alignment()
|
|
149
|
-
.concat(mpcSignatureType.alignment());
|
|
147
|
+
return mpcSignatureType.alignment();
|
|
150
148
|
},
|
|
151
149
|
/**
|
|
152
|
-
* Decode one response record from an aligned value
|
|
153
|
-
* by field.
|
|
150
|
+
* Decode one response record from an aligned value.
|
|
154
151
|
*
|
|
155
152
|
* @param value - Mutable aligned value cursor: pass a copy.
|
|
156
153
|
* @returns The decoded record.
|
|
157
154
|
*/
|
|
158
155
|
fromValue(value) {
|
|
159
|
-
return {
|
|
160
|
-
attestationDigest: bytes32.fromValue(value),
|
|
161
|
-
signature: mpcSignatureType.fromValue(value),
|
|
162
|
-
};
|
|
156
|
+
return { signature: mpcSignatureType.fromValue(value) };
|
|
163
157
|
},
|
|
164
158
|
/**
|
|
165
159
|
* Encode a response record into its aligned on-ledger representation.
|
|
166
160
|
*
|
|
167
161
|
* @param record - The record to encode.
|
|
168
|
-
* @returns The aligned value
|
|
162
|
+
* @returns The aligned value.
|
|
169
163
|
*/
|
|
170
164
|
toValue(record) {
|
|
171
|
-
return
|
|
172
|
-
.toValue(record.attestationDigest)
|
|
173
|
-
.concat(mpcSignatureType.toValue(record.signature));
|
|
165
|
+
return mpcSignatureType.toValue(record.signature);
|
|
174
166
|
},
|
|
175
167
|
};
|
|
176
168
|
/** Descriptor for the notification's packed V1 payload (`Bytes<128>`). */
|
|
@@ -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,8E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,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA2C;IACnF
|
|
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,+DAA+D;AAE/D,yEAAyE;AACzE,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAEzC,oEAAoE;AACpE,MAAM,E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|
|
2
2
|
import type { Transaction } from "ethers";
|
|
3
3
|
import { type SignatureRespondedEvent, type RespondBidirectionalEvent } from "./signet-contract-state-reader.ts";
|
|
4
|
+
import { type Secp256k1Point } from "./ecdsa-attestation.ts";
|
|
4
5
|
import type { RawContractState } from "./signature-state-reading.ts";
|
|
5
|
-
import type
|
|
6
|
+
import { type SignBidirectionalEvent, type RequestIdHex } from "./signet-requests.ts";
|
|
6
7
|
/**
|
|
7
8
|
* The least of midnight-js's `PublicDataProvider` the reader needs: raw
|
|
8
9
|
* contract state by address. Declared structurally so tests can satisfy it
|
|
@@ -153,12 +154,11 @@ export declare class SignetRequestResponseReader {
|
|
|
153
154
|
/**
|
|
154
155
|
* Fetch every respond-bidirectional response posted for `requestId`, in
|
|
155
156
|
* post (count) order. UNVERIFIED: the signet contract stores posts without
|
|
156
|
-
* checking them, so any entry may be garbage.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* yet: poll again.
|
|
157
|
+
* checking them, so any entry may be garbage. Each post carries a signature
|
|
158
|
+
* and nothing else, so verifying it against the MPC response key you expect
|
|
159
|
+
* is the only way to pick the genuine one: in-circuit at claim time, or off
|
|
160
|
+
* chain with {@link verifyRespondBidirectionalSignature} over the output you
|
|
161
|
+
* fetched. An empty array simply means none posted yet: poll again.
|
|
162
162
|
*
|
|
163
163
|
* @param requestId - The request id whose responses to enumerate.
|
|
164
164
|
* @returns The posted records, index = count, empty when none yet.
|
|
@@ -166,5 +166,29 @@ export declare class SignetRequestResponseReader {
|
|
|
166
166
|
* disagrees with the log (inconsistent ledger).
|
|
167
167
|
*/
|
|
168
168
|
getRespondBidirectionalEvents(requestId: RequestIdHex): Promise<RespondBidirectionalEvent[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch the respond-bidirectional posts for `requestId` and return the
|
|
171
|
+
* first (lowest count) one whose signature verifies over
|
|
172
|
+
* `serializedOutput` against `mpcResponseKey`: the off-chain twin of the
|
|
173
|
+
* check the client contract runs in-circuit, and the only way to pick a
|
|
174
|
+
* genuine post out of an unauthenticated log now that posts carry nothing
|
|
175
|
+
* but a signature.
|
|
176
|
+
*
|
|
177
|
+
* The output must be the exact unpadded bytes the attestation commits to
|
|
178
|
+
* (the packed respond payload, recomputed from the execution output the
|
|
179
|
+
* client fetched), so a post that verifies here is the post that proves at
|
|
180
|
+
* claim time.
|
|
181
|
+
*
|
|
182
|
+
* @param requestId - The request id to fetch a verified attestation for.
|
|
183
|
+
* @param serializedOutput - The serialised execution output the attestation
|
|
184
|
+
* must commit to, exact unpadded bytes.
|
|
185
|
+
* @param mpcResponseKey - The MPC response key the requesting contract
|
|
186
|
+
* pinned at deploy (see `deriveMidnightResponseKey`).
|
|
187
|
+
* @returns The first verifying post, or `undefined` when none has been
|
|
188
|
+
* posted yet (poll again) or none attests this output.
|
|
189
|
+
* @throws Error when the signet contract has no state, or its counter
|
|
190
|
+
* disagrees with the log (inconsistent ledger).
|
|
191
|
+
*/
|
|
192
|
+
getVerifiedRespondBidirectionalEvent(requestId: RequestIdHex, serializedOutput: Uint8Array, mpcResponseKey: Secp256k1Point): Promise<RespondBidirectionalEvent | undefined>;
|
|
169
193
|
}
|
|
170
194
|
//# sourceMappingURL=signet-request-response-reader.d.ts.map
|
|
@@ -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,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.d.ts","s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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";
|
|
14
|
+
import { verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.js";
|
|
14
15
|
import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
|
|
16
|
+
import { requestIdBytes, } from "./signet-requests.js";
|
|
15
17
|
/**
|
|
16
18
|
* Reader over one requester contract / signet contract pair.
|
|
17
19
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
@@ -181,12 +183,11 @@ export class SignetRequestResponseReader {
|
|
|
181
183
|
/**
|
|
182
184
|
* Fetch every respond-bidirectional response posted for `requestId`, in
|
|
183
185
|
* post (count) order. UNVERIFIED: the signet contract stores posts without
|
|
184
|
-
* checking them, so any entry may be garbage.
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* yet: poll again.
|
|
186
|
+
* checking them, so any entry may be garbage. Each post carries a signature
|
|
187
|
+
* and nothing else, so verifying it against the MPC response key you expect
|
|
188
|
+
* is the only way to pick the genuine one: in-circuit at claim time, or off
|
|
189
|
+
* chain with {@link verifyRespondBidirectionalSignature} over the output you
|
|
190
|
+
* fetched. An empty array simply means none posted yet: poll again.
|
|
190
191
|
*
|
|
191
192
|
* @param requestId - The request id whose responses to enumerate.
|
|
192
193
|
* @returns The posted records, index = count, empty when none yet.
|
|
@@ -208,5 +209,32 @@ export class SignetRequestResponseReader {
|
|
|
208
209
|
}
|
|
209
210
|
return responses;
|
|
210
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Fetch the respond-bidirectional posts for `requestId` and return the
|
|
214
|
+
* first (lowest count) one whose signature verifies over
|
|
215
|
+
* `serializedOutput` against `mpcResponseKey`: the off-chain twin of the
|
|
216
|
+
* check the client contract runs in-circuit, and the only way to pick a
|
|
217
|
+
* genuine post out of an unauthenticated log now that posts carry nothing
|
|
218
|
+
* but a signature.
|
|
219
|
+
*
|
|
220
|
+
* The output must be the exact unpadded bytes the attestation commits to
|
|
221
|
+
* (the packed respond payload, recomputed from the execution output the
|
|
222
|
+
* client fetched), so a post that verifies here is the post that proves at
|
|
223
|
+
* claim time.
|
|
224
|
+
*
|
|
225
|
+
* @param requestId - The request id to fetch a verified attestation for.
|
|
226
|
+
* @param serializedOutput - The serialised execution output the attestation
|
|
227
|
+
* must commit to, exact unpadded bytes.
|
|
228
|
+
* @param mpcResponseKey - The MPC response key the requesting contract
|
|
229
|
+
* pinned at deploy (see `deriveMidnightResponseKey`).
|
|
230
|
+
* @returns The first verifying post, or `undefined` when none has been
|
|
231
|
+
* posted yet (poll again) or none attests this output.
|
|
232
|
+
* @throws Error when the signet contract has no state, or its counter
|
|
233
|
+
* disagrees with the log (inconsistent ledger).
|
|
234
|
+
*/
|
|
235
|
+
async getVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey) {
|
|
236
|
+
const events = await this.getRespondBidirectionalEvents(requestId);
|
|
237
|
+
return events.find((event) => verifyRespondBidirectionalSignature(requestIdBytes(requestId), serializedOutput, event, mpcResponseKey));
|
|
238
|
+
}
|
|
211
239
|
}
|
|
212
240
|
//# sourceMappingURL=signet-request-response-reader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,uBAAuB;AACvB,yEAAyE;AACzE,2EAA2E;AAC3E,uEAAuE;AACvE,mEAAmE;AACnE,2EAA2E;AAC3E,iCAAiC;AAKjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,iBAAiB,GAGlB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,uBAAuB;AACvB,yEAAyE;AACzE,2EAA2E;AAC3E,uEAAuE;AACvE,mEAAmE;AACnE,2EAA2E;AAC3E,iCAAiC;AAKjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,iBAAiB,GAGlB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EACL,mCAAmC,GAEpC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,cAAc,GAGf,MAAM,sBAAsB,CAAC;AAgE9B;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACrB,MAAM,CAAoC;IAE3D,wEAAwE;IACvD,YAAY,GAAG,IAAI,GAAG,EAGpC,CAAC;IAEJ;;OAEG;IACH,YAAY,MAAyC;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACK,KAAK,CAAC,aAAa,CACzB,eAAuB,EACvB,IAAY;QAEZ,MAAM,KAAK,GACT,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,cAAc,eAAe,qBAAqB,CAClF,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,C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BAAuB,CAAC,GAAG,CAC1C,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CACpC,CAAC;YACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,0CAA0C,KAAK,gBAAgB,SAAS,GAAG;oBACzE,+BAA+B,UAAU,gCAAgC,CAC5E,CAAC;YACJ,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,oCAAoC,CACxC,SAAuB,EACvB,gBAA4B,EAC5B,cAA8B;QAE9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3B,mCAAmC,CACjC,cAAc,CAAC,SAAS,CAAC,EACzB,gBAAgB,EAChB,KAAK,EACL,cAAc,CACf,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sig-net/midnight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sig-net/midnight-integration",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@midnight-ntwrk/compact-runtime": "0.18.0-rc.1",
|
|
41
41
|
"@midnight-ntwrk/midnight-js-types": "5.0.0-beta.4",
|
|
42
42
|
"@noble/curves": "^2.2.0",
|
|
43
|
-
"@sig-net/midnight-serde": "^0.
|
|
43
|
+
"@sig-net/midnight-serde": "^0.14.0",
|
|
44
44
|
"ethers": "^6.17.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
package/src/Signet.compact
CHANGED
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
// (via SignetSigner interface) to notify the MPC of a SignBidirectionalEvent.
|
|
30
30
|
// - SignatureRespondedEvent: Counterpart to SignBidirectionalEvent containing MPC generated signature requested by a SignBidirectionalEvent.
|
|
31
31
|
// Posted by MPC back to Signet singleton for clients to extract to build a signed transaction.
|
|
32
|
-
// - RespondBidirectionalEvent: Attestation of a transaction executed on a foreign blockchain: the
|
|
33
|
-
// digest of the request id and serialised output
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// off chain. Posted by MPC back to Signet singleton for clients to extract,
|
|
32
|
+
// - RespondBidirectionalEvent: Attestation of a transaction executed on a foreign blockchain: the MPC's ECDSA
|
|
33
|
+
// signature over the attestation digest of the request id and serialised output
|
|
34
|
+
// (see calculateSignetAttestationDigest), signed with the MPC's RESPONSE key for
|
|
35
|
+
// the requesting contract: the key derived from the client contract's address +
|
|
36
|
+
// the fixed path "midnight response key". Both the digest and the output itself
|
|
37
|
+
// travel off chain. Posted by MPC back to Signet singleton for clients to extract,
|
|
38
38
|
// verify (see verifyRespondBidirectionalEvent) and deliver back to the client
|
|
39
39
|
// contract.
|
|
40
40
|
//
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
// verifies the posted SignatureRespondedEvent and broadcasts txn to destination chain.
|
|
51
51
|
// 4. MPC observes txn execution on destination chain, posts a RespondBidirectionalEvent
|
|
52
52
|
// attestation to the central Signet contract, and the client polls it by RequestId.
|
|
53
|
+
// The client recovers the execution output itself off chain (for EVM: the mined
|
|
54
|
+
// call's return data via debug_traceTransaction, also served by the fakenet
|
|
55
|
+
// responder's /responses/{requestId} helper API) and hands output plus attestation
|
|
56
|
+
// to its verify circuit. See "Output recovery" in this package's README.
|
|
53
57
|
//
|
|
54
58
|
// Read more:
|
|
55
59
|
// - For full integration examples (such as an ERC20 cross chain vault example) see
|
|
@@ -254,30 +258,30 @@ module Signet {
|
|
|
254
258
|
signature: Signature;
|
|
255
259
|
}
|
|
256
260
|
|
|
257
|
-
//
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
//
|
|
261
|
+
// RespondBidirectionalEvent is the final step of the Sig Network Sign Bidirectional flow.
|
|
262
|
+
// It holds an MPC ECDSA signature of an attestation digest verifying foreign chain execution output.
|
|
263
|
+
//
|
|
264
|
+
// The attestation digest is a keccak256 hash of the request id concatenated with the serialised foreign
|
|
265
|
+
// transaction execution output:
|
|
266
|
+
// attestationDigest = keccak256(requestId + serialisedOutput)
|
|
267
|
+
//
|
|
268
|
+
// The signature is the ECDSA secp256k1 signature over the attestation digest by the MPC with the
|
|
269
|
+
// client contract's MPC response key:
|
|
270
|
+
// signature = signSECP256k1(mpcResponseKey, attestationDigest)
|
|
271
|
+
//
|
|
272
|
+
// Where the MPC response key is a per-client-contract key derived using the same derivation function
|
|
273
|
+
// as request signing keys, with the path set to the fixed "midnight response key":
|
|
274
|
+
// mpcResponseKey = f(mpcRootKey[keyVersion], sender, "midnight response key")
|
|
275
|
+
//
|
|
276
|
+
// Storage & Verification:
|
|
277
|
+
// The execution output is of variable size, so it travels off chain, and the digest
|
|
278
|
+
// over it is recomputed rather than stored. The client fetches the output, recomputes
|
|
279
|
+
// the attestation digest and verifies the signature in-circuit via
|
|
280
|
+
// verifyRespondBidirectionalEvent against its derived MPC response key. The signature
|
|
281
|
+
// is the ONLY thing that distinguishes a genuine post from garbage: the Signet
|
|
282
|
+
// singleton is an unauthenticated log and stores every post unverified.
|
|
271
283
|
export struct RespondBidirectionalEvent {
|
|
272
|
-
// The
|
|
273
|
-
// concatenated with the serialised output (see calculateSignetAttestationDigest).
|
|
274
|
-
// A checkpoint for off-chain readers: match a fetched output against the
|
|
275
|
-
// attestation (and check the signature) without any other inputs.
|
|
276
|
-
// verifyRespondBidirectionalEvent binds it to the actual output bytes in-circuit.
|
|
277
|
-
attestationDigest: Bytes<32>;
|
|
278
|
-
|
|
279
|
-
// The MPC's ECDSA signature over attestationDigest above. The verify
|
|
280
|
-
// circuit's r is this signature's bigR.x mod the curve order.
|
|
284
|
+
// The MPC's ECDSA signature over the attestation digest.
|
|
281
285
|
signature: Signature;
|
|
282
286
|
}
|
|
283
287
|
|
|
@@ -288,20 +292,13 @@ module Signet {
|
|
|
288
292
|
requestId: RequestId;
|
|
289
293
|
};
|
|
290
294
|
|
|
291
|
-
//
|
|
292
|
-
// keccak256
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
// [RequestId, Bytes<N>] pair is the raw concatenated bytes.
|
|
299
|
-
// secp256k1EcdsaVerify interprets the digest as a BIG-ENDIAN integer reduced mod
|
|
300
|
-
// the curve order (RFC 6979 convention). ONE implementation for everyone: client
|
|
301
|
-
// contracts call this in-circuit. The compiler cannot export a size-generic circuit
|
|
302
|
-
// top-level, so off-chain code uses the TS twin (calculateSignetAttestationDigest
|
|
303
|
-
// in ecdsa-attestation.ts), pinned byte-for-byte against the fixed-width
|
|
304
|
-
// instantiations circuits.compact exports as test oracles.
|
|
295
|
+
// Calculates the 32-byte attestation digest for a remote execution output:
|
|
296
|
+
// attestationDigest = keccak256(requestId + serializedOutput)
|
|
297
|
+
//
|
|
298
|
+
// Inputs are concatenated raw with no padding or length prefixes. The output digest is
|
|
299
|
+
// interpreted as a big-endian integer during ECDSA signature verification.
|
|
300
|
+
//
|
|
301
|
+
// Note: Off-chain code should use the matching TypeScript twin in `ecdsa-attestation.ts`.
|
|
305
302
|
export pure circuit calculateSignetAttestationDigest<#serializedOutputLength>(
|
|
306
303
|
requestId: RequestId,
|
|
307
304
|
serializedOutput: Bytes<serializedOutputLength>,
|
|
@@ -320,23 +317,21 @@ module Signet {
|
|
|
320
317
|
v[7], v[6], v[5], v[4], v[3], v[2], v[1], v[0]];
|
|
321
318
|
}
|
|
322
319
|
|
|
323
|
-
//
|
|
324
|
-
// a secp256k1 public key: the event's digest checkpoint must equal the recomputed
|
|
325
|
-
// attestation digest of (requestId, serializedOutput), and the event's ECDSA
|
|
326
|
-
// signature must sign that digest. This is the check client contracts run before
|
|
327
|
-
// accepting a response (the Signet singleton stores posts unverified). Pass the
|
|
328
|
-
// contract's MPC RESPONSE key (derived off-chain from the contract's address + the
|
|
329
|
-
// fixed path "midnight response key", typically hash-pinned in the contract's
|
|
330
|
-
// ledger at deploy time). The caller supplies serializedOutput at its exact
|
|
331
|
-
// unpadded width, per calculateSignetAttestationDigest.
|
|
320
|
+
// Verifies a RespondBidirectionalEvent against its execution output and MPC response key.
|
|
332
321
|
//
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
//
|
|
322
|
+
// Verification steps:
|
|
323
|
+
// 1. Recompute digest: digest = keccak256(requestId + serializedOutput)
|
|
324
|
+
// 2. Verify signature: secp256k1EcdsaVerify(digest, signature, mpcResponseKey) == true
|
|
336
325
|
//
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
//
|
|
326
|
+
// The caller supplies serializedOutput at its exact unpadded width, per
|
|
327
|
+
// calculateSignetAttestationDigest, and hands over the event record as stored: the
|
|
328
|
+
// big-endian-to-little-endian re-encoding of the signature scalars happens here, in one
|
|
329
|
+
// place for every integrator. ECDSA's r is bigR.x reduced mod the curve order; bigR.x is
|
|
330
|
+
// taken as-is, as it is already below the order for all but a ~2^-128 fraction of
|
|
331
|
+
// signatures, and one that is not simply fails to verify.
|
|
332
|
+
//
|
|
333
|
+
// Note: Client contracts must run this check before consuming outputs, as the Signet
|
|
334
|
+
// singleton stores responses unverified.
|
|
340
335
|
export pure circuit verifyRespondBidirectionalEvent<#serializedOutputLength>(
|
|
341
336
|
requestId: RequestId,
|
|
342
337
|
serializedOutput: Bytes<serializedOutputLength>,
|
|
@@ -347,10 +342,8 @@ module Signet {
|
|
|
347
342
|
requestId,
|
|
348
343
|
serializedOutput,
|
|
349
344
|
);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
const checkpointMatches = digest == respondBidirectionalEvent.attestationDigest;
|
|
353
|
-
const signatureValid = secp256k1EcdsaVerify(
|
|
345
|
+
|
|
346
|
+
return secp256k1EcdsaVerify(
|
|
354
347
|
digest,
|
|
355
348
|
Secp256k1EcdsaSignature {
|
|
356
349
|
r: reverseBytes32(respondBidirectionalEvent.signature.bigR.x) as Secp256k1Scalar,
|
|
@@ -358,7 +351,6 @@ module Signet {
|
|
|
358
351
|
},
|
|
359
352
|
mpcResponseKey
|
|
360
353
|
);
|
|
361
|
-
return checkpointMatches && signatureValid;
|
|
362
354
|
}
|
|
363
355
|
|
|
364
356
|
// Hash a secp256k1 public key exactly as client contracts pin it at deploy time
|