@sig-net/midnight-contract 0.10.0 → 0.12.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.
Files changed (23) hide show
  1. package/README.md +4 -4
  2. package/dist/managed/compiler/contract-info.json +175 -103
  3. package/dist/managed/compiler/contract-manifest.json +34 -34
  4. package/dist/managed/contract/index.d.ts +97 -80
  5. package/dist/managed/contract/index.js +161 -132
  6. package/dist/managed/contract/index.js.map +1 -1
  7. package/dist/managed/keys/{postRespondBidirectional.prover → respondBidirectional.prover} +0 -0
  8. package/dist/managed/keys/respondBidirectional.verifier +0 -0
  9. package/dist/managed/zkir/respondBidirectional.bzkir +0 -0
  10. package/dist/managed/zkir/{postRespondBidirectional.zkir → respondBidirectional.zkir} +17 -21
  11. package/dist/witnesses.js +3 -3
  12. package/dist/witnesses.js.map +1 -1
  13. package/package.json +3 -3
  14. package/dist/managed/keys/postRespondBidirectional.verifier +0 -0
  15. package/dist/managed/zkir/postRespondBidirectional.bzkir +0 -0
  16. /package/dist/managed/keys/{postSignatureResponse.prover → respond.prover} +0 -0
  17. /package/dist/managed/keys/{postSignatureResponse.verifier → respond.verifier} +0 -0
  18. /package/dist/managed/keys/{signBidirectionalEvent.prover → signBidirectional.prover} +0 -0
  19. /package/dist/managed/keys/{signBidirectionalEvent.verifier → signBidirectional.verifier} +0 -0
  20. /package/dist/managed/zkir/{postSignatureResponse.bzkir → respond.bzkir} +0 -0
  21. /package/dist/managed/zkir/{postSignatureResponse.zkir → respond.zkir} +0 -0
  22. /package/dist/managed/zkir/{signBidirectionalEvent.bzkir → signBidirectional.bzkir} +0 -0
  23. /package/dist/managed/zkir/{signBidirectionalEvent.zkir → signBidirectional.zkir} +0 -0
package/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  The central [Sig Network](https://sig.network) signet contract on the [Midnight blockchain](https://midnight.network): the singleton that exposes the MPC's [sign bidirectional flow](https://docs.sig.network/architecture/sign-bidirectional) to other Midnight contracts. The MPC posts back to it and clients poll it:
4
4
 
5
- - **Signature responses**: an unauthenticated counted log; callers verify the signatures off-chain or in their own circuits.
6
- - **Remote execution responses**: Schnorr attestations by the MPC's Jubjub key, verified in-circuit at post time.
5
+ - **Signature responses**: an unauthenticated counted log. Callers verify the signatures off-chain or in their own circuits.
6
+ - **Remote execution responses**: secp256k1 ECDSA attestations by the MPC's per-client response key, stored unverified like the signature responses. The client contract verifies them in its own circuit.
7
7
  - **Request-notification registry**: how the MPC discovers new signature requests.
8
8
 
9
9
  ## What is in it
@@ -11,7 +11,7 @@ The central [Sig Network](https://sig.network) signet contract on the [Midnight
11
11
  - The curated export surface (package root): the generated contract module (`Contract`, the `ledger` state decoder, `pureCircuits`), the handwritten witnesses, and the platform-agnostic contract surface (circuit ids and the provider type).
12
12
  - The `./managed/*` subpath export: the compiled contract assets (compiler output, `zkir/`, prover/verifier `keys/`) so runtimes can fetch them as files. The published package always carries the proving keys.
13
13
 
14
- Consumers import the package root; the `./managed/*` paths exist only for runtimes that load zk assets.
14
+ Consumers import the package root. The `./managed/*` paths exist only for runtimes that load zk assets.
15
15
 
16
16
  ## Install
17
17
 
@@ -24,4 +24,4 @@ npm install @sig-net/midnight-contract
24
24
  - [`@sig-net/midnight-contract-deploy`](https://www.npmjs.com/package/@sig-net/midnight-contract-deploy): deploys this contract (constructor argument: the MPC attestation key).
25
25
  - [`@sig-net/midnight`](https://www.npmjs.com/package/@sig-net/midnight): the client-agnostic protocol library for reading this contract's state and verifying responses.
26
26
 
27
- Developed in [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration); example applications live in [sig-net/midnight-examples](https://github.com/sig-net/midnight-examples).
27
+ Developed in [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration). Example applications live in [sig-net/midnight-examples](https://github.com/sig-net/midnight-examples).
@@ -4,7 +4,7 @@
4
4
  "runtime-version": "0.18.0-rc.1",
5
5
  "circuits": [
6
6
  {
7
- "name": "signBidirectionalEvent",
7
+ "name": "signBidirectional",
8
8
  "pure": false,
9
9
  "proof": true,
10
10
  "arguments": [
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  {
72
- "name": "postSignatureResponse",
72
+ "name": "respond",
73
73
  "pure": false,
74
74
  "proof": true,
75
75
  "arguments": [
@@ -91,31 +91,49 @@
91
91
  "name": "SignatureRespondedEvent",
92
92
  "elements": [
93
93
  {
94
- "name": "bigRx",
94
+ "name": "signature",
95
95
  "type": {
96
- "type-name": "Bytes",
97
- "length": 32
98
- }
99
- },
100
- {
101
- "name": "bigRy",
102
- "type": {
103
- "type-name": "Bytes",
104
- "length": 32
105
- }
106
- },
107
- {
108
- "name": "s",
109
- "type": {
110
- "type-name": "Bytes",
111
- "length": 32
112
- }
113
- },
114
- {
115
- "name": "recoveryId",
116
- "type": {
117
- "type-name": "Uint",
118
- "maxval": 255
96
+ "type-name": "Struct",
97
+ "name": "Signature",
98
+ "elements": [
99
+ {
100
+ "name": "bigR",
101
+ "type": {
102
+ "type-name": "Struct",
103
+ "name": "AffinePoint",
104
+ "elements": [
105
+ {
106
+ "name": "x",
107
+ "type": {
108
+ "type-name": "Bytes",
109
+ "length": 32
110
+ }
111
+ },
112
+ {
113
+ "name": "y",
114
+ "type": {
115
+ "type-name": "Bytes",
116
+ "length": 32
117
+ }
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ {
123
+ "name": "s",
124
+ "type": {
125
+ "type-name": "Bytes",
126
+ "length": 32
127
+ }
128
+ },
129
+ {
130
+ "name": "recoveryId",
131
+ "type": {
132
+ "type-name": "Uint",
133
+ "maxval": 255
134
+ }
135
+ }
136
+ ]
119
137
  }
120
138
  }
121
139
  ]
@@ -129,7 +147,7 @@
129
147
  }
130
148
  },
131
149
  {
132
- "name": "postRespondBidirectional",
150
+ "name": "respondBidirectional",
133
151
  "pure": false,
134
152
  "proof": true,
135
153
  "arguments": [
@@ -151,38 +169,56 @@
151
169
  "name": "RespondBidirectionalEvent",
152
170
  "elements": [
153
171
  {
154
- "name": "serializedOutput",
155
- "type": {
156
- "type-name": "Bytes",
157
- "length": 128
158
- }
159
- },
160
- {
161
- "name": "outputLen",
162
- "type": {
163
- "type-name": "Uint",
164
- "maxval": 255
165
- }
166
- },
167
- {
168
- "name": "r",
169
- "type": {
170
- "type-name": "Bytes",
171
- "length": 32
172
- }
173
- },
174
- {
175
- "name": "s",
172
+ "name": "attestationDigest",
176
173
  "type": {
177
174
  "type-name": "Bytes",
178
175
  "length": 32
179
176
  }
180
177
  },
181
178
  {
182
- "name": "recoveryId",
179
+ "name": "signature",
183
180
  "type": {
184
- "type-name": "Uint",
185
- "maxval": 255
181
+ "type-name": "Struct",
182
+ "name": "Signature",
183
+ "elements": [
184
+ {
185
+ "name": "bigR",
186
+ "type": {
187
+ "type-name": "Struct",
188
+ "name": "AffinePoint",
189
+ "elements": [
190
+ {
191
+ "name": "x",
192
+ "type": {
193
+ "type-name": "Bytes",
194
+ "length": 32
195
+ }
196
+ },
197
+ {
198
+ "name": "y",
199
+ "type": {
200
+ "type-name": "Bytes",
201
+ "length": 32
202
+ }
203
+ }
204
+ ]
205
+ }
206
+ },
207
+ {
208
+ "name": "s",
209
+ "type": {
210
+ "type-name": "Bytes",
211
+ "length": 32
212
+ }
213
+ },
214
+ {
215
+ "name": "recoveryId",
216
+ "type": {
217
+ "type-name": "Uint",
218
+ "maxval": 255
219
+ }
220
+ }
221
+ ]
186
222
  }
187
223
  }
188
224
  ]
@@ -269,7 +305,7 @@
269
305
  }
270
306
  },
271
307
  {
272
- "name": "signatureResponseCounterMap",
308
+ "name": "respondCounterMap",
273
309
  "index": 2,
274
310
  "exported": true,
275
311
  "storage": "Map",
@@ -286,7 +322,7 @@
286
322
  }
287
323
  },
288
324
  {
289
- "name": "signatureResponseMap",
325
+ "name": "respondMap",
290
326
  "index": 3,
291
327
  "exported": true,
292
328
  "storage": "Map",
@@ -319,31 +355,49 @@
319
355
  "name": "SignatureRespondedEvent",
320
356
  "elements": [
321
357
  {
322
- "name": "bigRx",
323
- "type": {
324
- "type-name": "Bytes",
325
- "length": 32
326
- }
327
- },
328
- {
329
- "name": "bigRy",
330
- "type": {
331
- "type-name": "Bytes",
332
- "length": 32
333
- }
334
- },
335
- {
336
- "name": "s",
358
+ "name": "signature",
337
359
  "type": {
338
- "type-name": "Bytes",
339
- "length": 32
340
- }
341
- },
342
- {
343
- "name": "recoveryId",
344
- "type": {
345
- "type-name": "Uint",
346
- "maxval": 255
360
+ "type-name": "Struct",
361
+ "name": "Signature",
362
+ "elements": [
363
+ {
364
+ "name": "bigR",
365
+ "type": {
366
+ "type-name": "Struct",
367
+ "name": "AffinePoint",
368
+ "elements": [
369
+ {
370
+ "name": "x",
371
+ "type": {
372
+ "type-name": "Bytes",
373
+ "length": 32
374
+ }
375
+ },
376
+ {
377
+ "name": "y",
378
+ "type": {
379
+ "type-name": "Bytes",
380
+ "length": 32
381
+ }
382
+ }
383
+ ]
384
+ }
385
+ },
386
+ {
387
+ "name": "s",
388
+ "type": {
389
+ "type-name": "Bytes",
390
+ "length": 32
391
+ }
392
+ },
393
+ {
394
+ "name": "recoveryId",
395
+ "type": {
396
+ "type-name": "Uint",
397
+ "maxval": 255
398
+ }
399
+ }
400
+ ]
347
401
  }
348
402
  }
349
403
  ]
@@ -400,38 +454,56 @@
400
454
  "name": "RespondBidirectionalEvent",
401
455
  "elements": [
402
456
  {
403
- "name": "serializedOutput",
404
- "type": {
405
- "type-name": "Bytes",
406
- "length": 128
407
- }
408
- },
409
- {
410
- "name": "outputLen",
411
- "type": {
412
- "type-name": "Uint",
413
- "maxval": 255
414
- }
415
- },
416
- {
417
- "name": "r",
418
- "type": {
419
- "type-name": "Bytes",
420
- "length": 32
421
- }
422
- },
423
- {
424
- "name": "s",
457
+ "name": "attestationDigest",
425
458
  "type": {
426
459
  "type-name": "Bytes",
427
460
  "length": 32
428
461
  }
429
462
  },
430
463
  {
431
- "name": "recoveryId",
464
+ "name": "signature",
432
465
  "type": {
433
- "type-name": "Uint",
434
- "maxval": 255
466
+ "type-name": "Struct",
467
+ "name": "Signature",
468
+ "elements": [
469
+ {
470
+ "name": "bigR",
471
+ "type": {
472
+ "type-name": "Struct",
473
+ "name": "AffinePoint",
474
+ "elements": [
475
+ {
476
+ "name": "x",
477
+ "type": {
478
+ "type-name": "Bytes",
479
+ "length": 32
480
+ }
481
+ },
482
+ {
483
+ "name": "y",
484
+ "type": {
485
+ "type-name": "Bytes",
486
+ "length": 32
487
+ }
488
+ }
489
+ ]
490
+ }
491
+ },
492
+ {
493
+ "name": "s",
494
+ "type": {
495
+ "type-name": "Bytes",
496
+ "length": 32
497
+ }
498
+ },
499
+ {
500
+ "name": "recoveryId",
501
+ "type": {
502
+ "type-name": "Uint",
503
+ "maxval": 255
504
+ }
505
+ }
506
+ ]
435
507
  }
436
508
  }
437
509
  ]
@@ -7,56 +7,56 @@
7
7
  "type": "directory",
8
8
  "contract-info.json": {
9
9
  "type": "file",
10
- "size": 9940,
11
- "hash": "2bb608fe05b4a143193c286a8bf7cda7777350e82ae30e9bca5b9088c7f1d3bf"
10
+ "size": 12893,
11
+ "hash": "bcd4df22f8bbe7a284ad20c429a14e9d029b54a60968f9c70e5e9886b08364da"
12
12
  }
13
13
  },
14
14
  "contract": {
15
15
  "type": "directory",
16
16
  "index.d.ts": {
17
17
  "type": "file",
18
- "size": 8450,
19
- "hash": "f02bccd41dc7a6c929faad7f3a0d68875481ea19f1869ca04d69f25f1fe723a8"
18
+ "size": 9777,
19
+ "hash": "aa8b30fda4740c37e47fd67708a59237953adab19cb041302bf990c4d6003629"
20
20
  },
21
21
  "index.js": {
22
22
  "type": "file",
23
- "size": 104652,
24
- "hash": "94e9c8454716f4b2cc6ada9e75e735693d9afbfcf956f83e319c5b745bad4a2a"
23
+ "size": 105081,
24
+ "hash": "8b4d82dd9e62be11b63855b7b3b44443760c37c27bad00a019bf3b77be0a3cdd"
25
25
  },
26
26
  "index.js.map": {
27
27
  "type": "file",
28
- "size": 3057,
29
- "hash": "93b50f8d99b21457b6ad34e2bc0c8afa366d10135668d46bd065315a10e7a450"
28
+ "size": 3081,
29
+ "hash": "9efd70a7168561b45fbba922e09b8fc9b852f3c531e737d5c9544a7b345a0f39"
30
30
  }
31
31
  },
32
32
  "zkir": {
33
33
  "type": "directory",
34
- "postRespondBidirectional.bzkir": {
35
- "type": "file",
36
- "size": 1910,
37
- "hash": "0b70b24b36fc6ea5886a95b39d112f495a0eed34b18bde47d93f1c5110f75e99"
38
- },
39
- "postRespondBidirectional.zkir": {
40
- "type": "file",
41
- "size": 4646,
42
- "hash": "327dd3e13f92edd2fa6ec08e7dc0588dcfb0b40ce3f4f7c548465c14673ff2f5"
43
- },
44
- "postSignatureResponse.bzkir": {
34
+ "respond.bzkir": {
45
35
  "type": "file",
46
36
  "size": 1479,
47
37
  "hash": "f87e8441cc3489b1f7559f2d65445f2ea17fb3016ff15c3f58c4027f12a5fd7a"
48
38
  },
49
- "postSignatureResponse.zkir": {
39
+ "respond.zkir": {
50
40
  "type": "file",
51
41
  "size": 3813,
52
42
  "hash": "1f6e6a3c95d8fa3952c58e70588fc3661c9dd6115a1b01f530eb16f925bf4d2b"
53
43
  },
54
- "signBidirectionalEvent.bzkir": {
44
+ "respondBidirectional.bzkir": {
45
+ "type": "file",
46
+ "size": 1718,
47
+ "hash": "93498ebcb78bf7c92a7215916538bf733a6d4c9b7173d20023f87b8ad3989b30"
48
+ },
49
+ "respondBidirectional.zkir": {
50
+ "type": "file",
51
+ "size": 4253,
52
+ "hash": "2e5669b61cd6842da5e037cc0d20f0408deb6b97d391dc0175342856540bc0ea"
53
+ },
54
+ "signBidirectional.bzkir": {
55
55
  "type": "file",
56
56
  "size": 1248,
57
57
  "hash": "df11c0f58df1650875608110fb3844bf6ba733fa1dc466f0faf7d52099ec47c5"
58
58
  },
59
- "signBidirectionalEvent.zkir": {
59
+ "signBidirectional.zkir": {
60
60
  "type": "file",
61
61
  "size": 3674,
62
62
  "hash": "72f63054869b9bb5ee895a3326ec10ff911e83523cf614a476d2b478b9152e11"
@@ -64,32 +64,32 @@
64
64
  },
65
65
  "keys": {
66
66
  "type": "directory",
67
- "postRespondBidirectional.prover": {
67
+ "respond.prover": {
68
68
  "type": "file",
69
- "size": 889414,
70
- "hash": "72beb2cfe9f8ec3266bcf96e495defbf427575f86d310602314177accb354aab"
69
+ "size": 446615,
70
+ "hash": "f43e6a128a257f06e6a19ea6ddceff5f94db81645460301c6d184ab4437c8169"
71
71
  },
72
- "postRespondBidirectional.verifier": {
72
+ "respond.verifier": {
73
73
  "type": "file",
74
74
  "size": 1353,
75
- "hash": "fa5fd5e2c04bf3553e601fb43482df5e0de872f2469216f6ac1b9f2b7e1248ee"
75
+ "hash": "22938eaebc029fd624db271e92857b132977c0373bf2f9ce823e21d011973e0d"
76
76
  },
77
- "postSignatureResponse.prover": {
77
+ "respondBidirectional.prover": {
78
78
  "type": "file",
79
- "size": 446615,
80
- "hash": "f43e6a128a257f06e6a19ea6ddceff5f94db81645460301c6d184ab4437c8169"
79
+ "size": 889222,
80
+ "hash": "b742e066a2dfb13212cffa0dfb46ad2cac913cde7d75453001aad9f64c054302"
81
81
  },
82
- "postSignatureResponse.verifier": {
82
+ "respondBidirectional.verifier": {
83
83
  "type": "file",
84
84
  "size": 1353,
85
- "hash": "22938eaebc029fd624db271e92857b132977c0373bf2f9ce823e21d011973e0d"
85
+ "hash": "aa9b1666e95c9d66f4a8333f8cc72697afe7fd6359a850984e88743a6f667798"
86
86
  },
87
- "signBidirectionalEvent.prover": {
87
+ "signBidirectional.prover": {
88
88
  "type": "file",
89
89
  "size": 888752,
90
90
  "hash": "3c3fb54421ac16821198a626fc2551d4f3201ebdc67995c61f0bcd8351f2e5de"
91
91
  },
92
- "signBidirectionalEvent.verifier": {
92
+ "signBidirectional.verifier": {
93
93
  "type": "file",
94
94
  "size": 1353,
95
95
  "hash": "3e603e64ac930b8e4e1412e0afb5b3769e3d9db62c3a0bace1fe367eb7dc868e"