@sig-net/midnight-contract 0.0.1 → 0.0.2

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.
@@ -150,234 +150,6 @@
150
150
  { "op": "declare_pub_input", "var": 31 },
151
151
  { "op": "pi_skip", "guard": 9, "count": 1 },
152
152
  { "op": "declare_pub_input", "var": 33 },
153
- { "op": "pi_skip", "guard": 9, "count": 1 },
154
- { "op": "div_mod_power_of_two", "var": 1, "bits": 8 },
155
- { "op": "div_mod_power_of_two", "var": 42, "bits": 8 },
156
- { "op": "div_mod_power_of_two", "var": 44, "bits": 8 },
157
- { "op": "div_mod_power_of_two", "var": 46, "bits": 8 },
158
- { "op": "div_mod_power_of_two", "var": 48, "bits": 8 },
159
- { "op": "div_mod_power_of_two", "var": 50, "bits": 8 },
160
- { "op": "div_mod_power_of_two", "var": 52, "bits": 8 },
161
- { "op": "div_mod_power_of_two", "var": 54, "bits": 8 },
162
- { "op": "div_mod_power_of_two", "var": 56, "bits": 8 },
163
- { "op": "div_mod_power_of_two", "var": 58, "bits": 8 },
164
- { "op": "div_mod_power_of_two", "var": 60, "bits": 8 },
165
- { "op": "div_mod_power_of_two", "var": 62, "bits": 8 },
166
- { "op": "div_mod_power_of_two", "var": 64, "bits": 8 },
167
- { "op": "div_mod_power_of_two", "var": 66, "bits": 8 },
168
- { "op": "div_mod_power_of_two", "var": 68, "bits": 8 },
169
- { "op": "div_mod_power_of_two", "var": 70, "bits": 8 },
170
- { "op": "div_mod_power_of_two", "var": 72, "bits": 8 },
171
- { "op": "div_mod_power_of_two", "var": 74, "bits": 8 },
172
- { "op": "div_mod_power_of_two", "var": 76, "bits": 8 },
173
- { "op": "div_mod_power_of_two", "var": 78, "bits": 8 },
174
- { "op": "div_mod_power_of_two", "var": 80, "bits": 8 },
175
- { "op": "div_mod_power_of_two", "var": 82, "bits": 8 },
176
- { "op": "div_mod_power_of_two", "var": 84, "bits": 8 },
177
- { "op": "div_mod_power_of_two", "var": 86, "bits": 8 },
178
- { "op": "div_mod_power_of_two", "var": 88, "bits": 8 },
179
- { "op": "div_mod_power_of_two", "var": 90, "bits": 8 },
180
- { "op": "div_mod_power_of_two", "var": 92, "bits": 8 },
181
- { "op": "div_mod_power_of_two", "var": 94, "bits": 8 },
182
- { "op": "div_mod_power_of_two", "var": 96, "bits": 8 },
183
- { "op": "div_mod_power_of_two", "var": 98, "bits": 8 },
184
- { "op": "constrain_bits", "var": 36, "bits": 64 },
185
- { "op": "div_mod_power_of_two", "var": 36, "bits": 8 },
186
- { "op": "div_mod_power_of_two", "var": 102, "bits": 8 },
187
- { "op": "div_mod_power_of_two", "var": 104, "bits": 8 },
188
- { "op": "div_mod_power_of_two", "var": 106, "bits": 8 },
189
- { "op": "div_mod_power_of_two", "var": 108, "bits": 8 },
190
- { "op": "div_mod_power_of_two", "var": 110, "bits": 8 },
191
- { "op": "div_mod_power_of_two", "var": 112, "bits": 8 },
192
- { "op": "reconstitute_field", "divisor": 114, "modulus": 115, "bits": 8 },
193
- { "op": "reconstitute_field", "divisor": 116, "modulus": 113, "bits": 8 },
194
- { "op": "reconstitute_field", "divisor": 117, "modulus": 111, "bits": 8 },
195
- { "op": "reconstitute_field", "divisor": 118, "modulus": 109, "bits": 8 },
196
- { "op": "reconstitute_field", "divisor": 119, "modulus": 107, "bits": 8 },
197
- { "op": "reconstitute_field", "divisor": 120, "modulus": 105, "bits": 8 },
198
- { "op": "reconstitute_field", "divisor": 121, "modulus": 103, "bits": 8 },
199
- { "op": "reconstitute_field", "divisor": 122, "modulus": 0, "bits": 8 },
200
- { "op": "reconstitute_field", "divisor": 100, "modulus": 101, "bits": 8 },
201
- { "op": "reconstitute_field", "divisor": 124, "modulus": 99, "bits": 8 },
202
- { "op": "reconstitute_field", "divisor": 125, "modulus": 97, "bits": 8 },
203
- { "op": "reconstitute_field", "divisor": 126, "modulus": 95, "bits": 8 },
204
- { "op": "reconstitute_field", "divisor": 127, "modulus": 93, "bits": 8 },
205
- { "op": "reconstitute_field", "divisor": 128, "modulus": 91, "bits": 8 },
206
- { "op": "reconstitute_field", "divisor": 129, "modulus": 89, "bits": 8 },
207
- { "op": "reconstitute_field", "divisor": 130, "modulus": 87, "bits": 8 },
208
- { "op": "reconstitute_field", "divisor": 131, "modulus": 85, "bits": 8 },
209
- { "op": "reconstitute_field", "divisor": 132, "modulus": 83, "bits": 8 },
210
- { "op": "reconstitute_field", "divisor": 133, "modulus": 81, "bits": 8 },
211
- { "op": "reconstitute_field", "divisor": 134, "modulus": 79, "bits": 8 },
212
- { "op": "reconstitute_field", "divisor": 135, "modulus": 77, "bits": 8 },
213
- { "op": "reconstitute_field", "divisor": 136, "modulus": 75, "bits": 8 },
214
- { "op": "reconstitute_field", "divisor": 137, "modulus": 73, "bits": 8 },
215
- { "op": "reconstitute_field", "divisor": 138, "modulus": 71, "bits": 8 },
216
- { "op": "reconstitute_field", "divisor": 139, "modulus": 69, "bits": 8 },
217
- { "op": "reconstitute_field", "divisor": 140, "modulus": 67, "bits": 8 },
218
- { "op": "reconstitute_field", "divisor": 141, "modulus": 65, "bits": 8 },
219
- { "op": "reconstitute_field", "divisor": 142, "modulus": 63, "bits": 8 },
220
- { "op": "reconstitute_field", "divisor": 143, "modulus": 61, "bits": 8 },
221
- { "op": "reconstitute_field", "divisor": 144, "modulus": 59, "bits": 8 },
222
- { "op": "reconstitute_field", "divisor": 145, "modulus": 57, "bits": 8 },
223
- { "op": "reconstitute_field", "divisor": 146, "modulus": 55, "bits": 8 },
224
- { "op": "reconstitute_field", "divisor": 147, "modulus": 53, "bits": 8 },
225
- { "op": "reconstitute_field", "divisor": 148, "modulus": 51, "bits": 8 },
226
- { "op": "reconstitute_field", "divisor": 149, "modulus": 49, "bits": 8 },
227
- { "op": "reconstitute_field", "divisor": 150, "modulus": 47, "bits": 8 },
228
- { "op": "reconstitute_field", "divisor": 151, "modulus": 45, "bits": 8 },
229
- { "op": "reconstitute_field", "divisor": 152, "modulus": 43, "bits": 8 },
230
- { "op": "div_mod_power_of_two", "var": 123, "bits": 8 },
231
- { "op": "div_mod_power_of_two", "var": 154, "bits": 8 },
232
- { "op": "div_mod_power_of_two", "var": 156, "bits": 8 },
233
- { "op": "div_mod_power_of_two", "var": 158, "bits": 8 },
234
- { "op": "div_mod_power_of_two", "var": 160, "bits": 8 },
235
- { "op": "div_mod_power_of_two", "var": 162, "bits": 8 },
236
- { "op": "div_mod_power_of_two", "var": 164, "bits": 8 },
237
- { "op": "div_mod_power_of_two", "var": 166, "bits": 8 },
238
- { "op": "div_mod_power_of_two", "var": 168, "bits": 8 },
239
- { "op": "div_mod_power_of_two", "var": 170, "bits": 8 },
240
- { "op": "div_mod_power_of_two", "var": 172, "bits": 8 },
241
- { "op": "div_mod_power_of_two", "var": 174, "bits": 8 },
242
- { "op": "div_mod_power_of_two", "var": 176, "bits": 8 },
243
- { "op": "div_mod_power_of_two", "var": 178, "bits": 8 },
244
- { "op": "div_mod_power_of_two", "var": 180, "bits": 8 },
245
- { "op": "div_mod_power_of_two", "var": 182, "bits": 8 },
246
- { "op": "div_mod_power_of_two", "var": 184, "bits": 8 },
247
- { "op": "div_mod_power_of_two", "var": 186, "bits": 8 },
248
- { "op": "div_mod_power_of_two", "var": 188, "bits": 8 },
249
- { "op": "div_mod_power_of_two", "var": 190, "bits": 8 },
250
- { "op": "div_mod_power_of_two", "var": 192, "bits": 8 },
251
- { "op": "div_mod_power_of_two", "var": 194, "bits": 8 },
252
- { "op": "div_mod_power_of_two", "var": 196, "bits": 8 },
253
- { "op": "div_mod_power_of_two", "var": 198, "bits": 8 },
254
- { "op": "div_mod_power_of_two", "var": 200, "bits": 8 },
255
- { "op": "div_mod_power_of_two", "var": 202, "bits": 8 },
256
- { "op": "div_mod_power_of_two", "var": 204, "bits": 8 },
257
- { "op": "div_mod_power_of_two", "var": 206, "bits": 8 },
258
- { "op": "div_mod_power_of_two", "var": 208, "bits": 8 },
259
- { "op": "div_mod_power_of_two", "var": 210, "bits": 8 },
260
- { "op": "div_mod_power_of_two", "var": 153, "bits": 8 },
261
- { "op": "div_mod_power_of_two", "var": 214, "bits": 8 },
262
- { "op": "div_mod_power_of_two", "var": 216, "bits": 8 },
263
- { "op": "div_mod_power_of_two", "var": 218, "bits": 8 },
264
- { "op": "div_mod_power_of_two", "var": 220, "bits": 8 },
265
- { "op": "div_mod_power_of_two", "var": 222, "bits": 8 },
266
- { "op": "div_mod_power_of_two", "var": 224, "bits": 8 },
267
- { "op": "div_mod_power_of_two", "var": 226, "bits": 8 },
268
- { "op": "div_mod_power_of_two", "var": 228, "bits": 8 },
269
- { "op": "div_mod_power_of_two", "var": 230, "bits": 8 },
270
- { "op": "div_mod_power_of_two", "var": 232, "bits": 8 },
271
- { "op": "div_mod_power_of_two", "var": 234, "bits": 8 },
272
- { "op": "div_mod_power_of_two", "var": 236, "bits": 8 },
273
- { "op": "div_mod_power_of_two", "var": 238, "bits": 8 },
274
- { "op": "div_mod_power_of_two", "var": 240, "bits": 8 },
275
- { "op": "div_mod_power_of_two", "var": 242, "bits": 8 },
276
- { "op": "div_mod_power_of_two", "var": 244, "bits": 8 },
277
- { "op": "div_mod_power_of_two", "var": 246, "bits": 8 },
278
- { "op": "div_mod_power_of_two", "var": 248, "bits": 8 },
279
- { "op": "div_mod_power_of_two", "var": 250, "bits": 8 },
280
- { "op": "div_mod_power_of_two", "var": 252, "bits": 8 },
281
- { "op": "div_mod_power_of_two", "var": 254, "bits": 8 },
282
- { "op": "div_mod_power_of_two", "var": 256, "bits": 8 },
283
- { "op": "div_mod_power_of_two", "var": 258, "bits": 8 },
284
- { "op": "div_mod_power_of_two", "var": 260, "bits": 8 },
285
- { "op": "div_mod_power_of_two", "var": 262, "bits": 8 },
286
- { "op": "div_mod_power_of_two", "var": 264, "bits": 8 },
287
- { "op": "div_mod_power_of_two", "var": 266, "bits": 8 },
288
- { "op": "div_mod_power_of_two", "var": 268, "bits": 8 },
289
- { "op": "div_mod_power_of_two", "var": 270, "bits": 8 },
290
- { "op": "copy", "var": 212 },
291
- { "op": "reconstitute_field", "divisor": 213, "modulus": 211, "bits": 8 },
292
- { "op": "reconstitute_field", "divisor": 275, "modulus": 209, "bits": 8 },
293
- { "op": "reconstitute_field", "divisor": 276, "modulus": 207, "bits": 8 },
294
- { "op": "reconstitute_field", "divisor": 277, "modulus": 205, "bits": 8 },
295
- { "op": "reconstitute_field", "divisor": 278, "modulus": 203, "bits": 8 },
296
- { "op": "reconstitute_field", "divisor": 279, "modulus": 201, "bits": 8 },
297
- { "op": "reconstitute_field", "divisor": 280, "modulus": 199, "bits": 8 },
298
- { "op": "reconstitute_field", "divisor": 281, "modulus": 197, "bits": 8 },
299
- { "op": "reconstitute_field", "divisor": 282, "modulus": 195, "bits": 8 },
300
- { "op": "reconstitute_field", "divisor": 283, "modulus": 193, "bits": 8 },
301
- { "op": "reconstitute_field", "divisor": 284, "modulus": 191, "bits": 8 },
302
- { "op": "reconstitute_field", "divisor": 285, "modulus": 189, "bits": 8 },
303
- { "op": "reconstitute_field", "divisor": 286, "modulus": 187, "bits": 8 },
304
- { "op": "reconstitute_field", "divisor": 287, "modulus": 185, "bits": 8 },
305
- { "op": "reconstitute_field", "divisor": 288, "modulus": 183, "bits": 8 },
306
- { "op": "reconstitute_field", "divisor": 289, "modulus": 181, "bits": 8 },
307
- { "op": "reconstitute_field", "divisor": 290, "modulus": 179, "bits": 8 },
308
- { "op": "reconstitute_field", "divisor": 291, "modulus": 177, "bits": 8 },
309
- { "op": "reconstitute_field", "divisor": 292, "modulus": 175, "bits": 8 },
310
- { "op": "reconstitute_field", "divisor": 293, "modulus": 173, "bits": 8 },
311
- { "op": "reconstitute_field", "divisor": 294, "modulus": 171, "bits": 8 },
312
- { "op": "reconstitute_field", "divisor": 295, "modulus": 169, "bits": 8 },
313
- { "op": "reconstitute_field", "divisor": 296, "modulus": 167, "bits": 8 },
314
- { "op": "reconstitute_field", "divisor": 297, "modulus": 165, "bits": 8 },
315
- { "op": "reconstitute_field", "divisor": 298, "modulus": 163, "bits": 8 },
316
- { "op": "reconstitute_field", "divisor": 299, "modulus": 161, "bits": 8 },
317
- { "op": "reconstitute_field", "divisor": 300, "modulus": 159, "bits": 8 },
318
- { "op": "reconstitute_field", "divisor": 301, "modulus": 157, "bits": 8 },
319
- { "op": "reconstitute_field", "divisor": 302, "modulus": 155, "bits": 8 },
320
- { "op": "reconstitute_field", "divisor": 303, "modulus": 272, "bits": 8 },
321
- { "op": "reconstitute_field", "divisor": 273, "modulus": 271, "bits": 8 },
322
- { "op": "reconstitute_field", "divisor": 305, "modulus": 269, "bits": 8 },
323
- { "op": "reconstitute_field", "divisor": 306, "modulus": 267, "bits": 8 },
324
- { "op": "reconstitute_field", "divisor": 307, "modulus": 265, "bits": 8 },
325
- { "op": "reconstitute_field", "divisor": 308, "modulus": 263, "bits": 8 },
326
- { "op": "reconstitute_field", "divisor": 309, "modulus": 261, "bits": 8 },
327
- { "op": "reconstitute_field", "divisor": 310, "modulus": 259, "bits": 8 },
328
- { "op": "reconstitute_field", "divisor": 311, "modulus": 257, "bits": 8 },
329
- { "op": "reconstitute_field", "divisor": 312, "modulus": 255, "bits": 8 },
330
- { "op": "reconstitute_field", "divisor": 313, "modulus": 253, "bits": 8 },
331
- { "op": "reconstitute_field", "divisor": 314, "modulus": 251, "bits": 8 },
332
- { "op": "reconstitute_field", "divisor": 315, "modulus": 249, "bits": 8 },
333
- { "op": "reconstitute_field", "divisor": 316, "modulus": 247, "bits": 8 },
334
- { "op": "reconstitute_field", "divisor": 317, "modulus": 245, "bits": 8 },
335
- { "op": "reconstitute_field", "divisor": 318, "modulus": 243, "bits": 8 },
336
- { "op": "reconstitute_field", "divisor": 319, "modulus": 241, "bits": 8 },
337
- { "op": "reconstitute_field", "divisor": 320, "modulus": 239, "bits": 8 },
338
- { "op": "reconstitute_field", "divisor": 321, "modulus": 237, "bits": 8 },
339
- { "op": "reconstitute_field", "divisor": 322, "modulus": 235, "bits": 8 },
340
- { "op": "reconstitute_field", "divisor": 323, "modulus": 233, "bits": 8 },
341
- { "op": "reconstitute_field", "divisor": 324, "modulus": 231, "bits": 8 },
342
- { "op": "reconstitute_field", "divisor": 325, "modulus": 229, "bits": 8 },
343
- { "op": "reconstitute_field", "divisor": 326, "modulus": 227, "bits": 8 },
344
- { "op": "reconstitute_field", "divisor": 327, "modulus": 225, "bits": 8 },
345
- { "op": "reconstitute_field", "divisor": 328, "modulus": 223, "bits": 8 },
346
- { "op": "reconstitute_field", "divisor": 329, "modulus": 221, "bits": 8 },
347
- { "op": "reconstitute_field", "divisor": 330, "modulus": 219, "bits": 8 },
348
- { "op": "reconstitute_field", "divisor": 331, "modulus": 217, "bits": 8 },
349
- { "op": "reconstitute_field", "divisor": 332, "modulus": 215, "bits": 8 },
350
- { "op": "reconstitute_field", "divisor": 333, "modulus": 12, "bits": 8 },
351
- { "op": "load_imm", "imm": "5369676E6174757265526573706F6E6465644576656E74" },
352
- { "op": "load_imm", "imm": "33" },
353
- { "op": "load_imm", "imm": "0A" },
354
- { "op": "load_imm", "imm": "2001" },
355
- { "op": "declare_pub_input", "var": 13 },
356
- { "op": "declare_pub_input", "var": 336 },
357
- { "op": "declare_pub_input", "var": 9 },
358
- { "op": "declare_pub_input", "var": 9 },
359
- { "op": "declare_pub_input", "var": 41 },
360
- { "op": "declare_pub_input", "var": 9 },
361
- { "op": "declare_pub_input", "var": 9 },
362
- { "op": "declare_pub_input", "var": 9 },
363
- { "op": "declare_pub_input", "var": 9 },
364
- { "op": "declare_pub_input", "var": 337 },
365
- { "op": "declare_pub_input", "var": 9 },
366
- { "op": "declare_pub_input", "var": 9 },
367
- { "op": "declare_pub_input", "var": 338 },
368
- { "op": "declare_pub_input", "var": 12 },
369
- { "op": "declare_pub_input", "var": 12 },
370
- { "op": "declare_pub_input", "var": 12 },
371
- { "op": "declare_pub_input", "var": 12 },
372
- { "op": "declare_pub_input", "var": 12 },
373
- { "op": "declare_pub_input", "var": 12 },
374
- { "op": "declare_pub_input", "var": 274 },
375
- { "op": "declare_pub_input", "var": 304 },
376
- { "op": "declare_pub_input", "var": 334 },
377
- { "op": "declare_pub_input", "var": 335 },
378
- { "op": "pi_skip", "guard": 9, "count": 23 },
379
- { "op": "load_imm", "imm": "09" },
380
- { "op": "declare_pub_input", "var": 339 },
381
153
  { "op": "pi_skip", "guard": 9, "count": 1 }
382
154
  ]
383
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sig-net/midnight-contract",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "The central signet Compact contract on Midnight: the MPC posts signature responses (unauthenticated counted log, verified off-chain) and remote execution responses (Schnorr attestations, verified in-circuit at post time) here; clients poll it. src/index.ts is the curated export surface.",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "compile": "COMPACT_PATH=../../node_modules compact compile --skip-zk src/signet-contract.compact src/managed",
20
20
  "compile:zk": "COMPACT_PATH=../../node_modules compact compile src/signet-contract.compact src/managed",
21
- "build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.build.json && mkdir -p dist/managed/keys && cp -R src/managed/contract src/managed/compiler src/managed/zkir dist/managed/ && cp src/managed/keys/*.verifier dist/managed/keys/",
21
+ "build": "rm -rf dist && ls src/managed/keys/*.prover >/dev/null 2>&1 || { echo 'signet-contract build: no prover keys in src/managed/keys — run `yarn compile:zk` first (compile uses --skip-zk)' >&2; exit 1; } && tsc -p tsconfig.json && tsc -p tsconfig.build.json && mkdir -p dist/managed && cp -R src/managed/contract src/managed/compiler src/managed/zkir src/managed/keys dist/managed/",
22
22
  "prepack": "yarn build",
23
23
  "test": "vitest run"
24
24
  },
@@ -39,7 +39,7 @@
39
39
  "@midnight-ntwrk/midnight-js": "5.0.0-beta.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@sig-net/midnight": "^0.0.1",
42
+ "@sig-net/midnight": "^0.0.2",
43
43
  "@types/node": "^26.1.0",
44
44
  "typescript": "^6.0.3",
45
45
  "vitest": "^4.1.9"
@@ -7,10 +7,11 @@ import CompactStandardLibrary;
7
7
  // in Signet.compact and https://docs.sig.network/ for the protocol.
8
8
  import "@sig-net/midnight/src/Signet";
9
9
 
10
- // The CENTRAL signet contract: the MPC delivers all its responses here, and
11
- // clients poll it — there is deliberately no push/websocket channel. Ledger
12
- // layout per "Signet Contract Ledger Layout" in Signet.compact, so pollers
13
- // need only this contract's address.
10
+ // The CENTRAL signet contract: clients register their signature-request
11
+ // notifications here, the MPC delivers all its responses here, and both sides
12
+ // poll it — there is deliberately no push/websocket channel. Ledger layout per
13
+ // "Signet Contract Ledger Layout" in Signet.compact, so pollers need only this
14
+ // contract's address.
14
15
  export ledger signatureResponseCounterIndex: SignatureResponseCounterIndex;
15
16
 
16
17
  export ledger signatureResponseIndex: SignatureResponseIndex;
@@ -21,26 +22,38 @@ export ledger respondBidirectionalIndex: RespondBidirectionalIndex;
21
22
  // accepts only responses signed by this key.
22
23
  export sealed ledger mpcPubKeyHash: Bytes<32>;
23
24
 
25
+ // The notification registry (field 4): clients register "a request was stored
26
+ // in MY ledger at THIS index field" pointers here; the MPC polls by
27
+ // enumerating the map. Append-only, idempotent overwrite, no removal.
28
+ export ledger signBidirectionalNotificationIndex: SignBidirectionalNotificationIndex;
29
+
24
30
  constructor(mpcPk: JubjubPoint) {
25
31
  mpcPubKeyHash = disclose(persistentHash<JubjubPoint>(mpcPk));
26
32
  }
27
33
 
28
- // emitSignBidirectionalEvent should be called by clients after (or within) a
29
- // transaction that writes a SignBidirectionalRequest to their canonical
30
- // SignBidirectionalRequestIndex state map.
31
- export circuit emitSignBidirectionalEvent(signBidirectionalEvent: SignBidirectionalEvent): [] {
32
- emit(Misc {
33
- name: pad(32, "SignBidirectionalEvent"),
34
- payload: serialize<SignBidirectionalEvent, 256>(disclose(signBidirectionalEvent)),
35
- });
34
+ // notifyBidirectionalSignatureRequest should be called (cross-contract) by
35
+ // clients after (or within) a transaction that writes a
36
+ // SignBidirectionalRequest to their canonical SignBidirectionalRequestIndex
37
+ // state map. Registers the notification in the registry the MPC polls; a
38
+ // repeat call for the same request id overwrites idempotently. Unauthenticated
39
+ // by design: the notification is a pointer, and the MPC trusts only what it
40
+ // reads back from the named caller's own ledger.
41
+ export circuit notifyBidirectionalSignatureRequest(
42
+ requestId: RequestId,
43
+ notification: SignBidirectionalNotification
44
+ ): [] {
45
+ signBidirectionalNotificationIndex.insert(
46
+ disclose(requestId),
47
+ disclose(notification),
48
+ );
36
49
  }
37
50
 
38
- // postSignatureResponse appends a signature response for requestId and
39
- // emits a SignatureRespondedEvent so the requesting client learns a post
40
- // landed. Unauthenticated by NECESSITY (secp256k1 ECDSA cannot be verified
51
+ // postSignatureResponse appends a signature response for requestId.
52
+ // Unauthenticated by NECESSITY (secp256k1 ECDSA cannot be verified
41
53
  // in-circuit): anyone may post, and nothing is ever overwritten — each post
42
- // lands under the next (requestId, count) key. Callers verify the posted
43
- // signatures off-chain to pick out the genuine one.
54
+ // lands under the next (requestId, count) key. Callers poll the log by
55
+ // request id and verify the posted signatures off-chain to pick out the
56
+ // genuine one.
44
57
  export circuit postSignatureResponse(requestId: RequestId, signatureResponse: SignatureResponse): [] {
45
58
  // Everything stored here is public by construction.
46
59
  const disclosedRequestId = disclose(requestId);
@@ -51,8 +64,7 @@ export circuit postSignatureResponse(requestId: RequestId, signatureResponse: Si
51
64
  }
52
65
 
53
66
  // Posts so far == this post's 0-based count. Read ONCE into a local so
54
- // the stored key, the counter update, and the emitted event cannot
55
- // disagree.
67
+ // the stored key and the counter update cannot disagree.
56
68
  const count = signatureResponseCounterIndex.lookup(disclosedRequestId).read();
57
69
  signatureResponseCounterIndex.lookup(disclosedRequestId).increment(1);
58
70
 
@@ -64,16 +76,6 @@ export circuit postSignatureResponse(requestId: RequestId, signatureResponse: Si
64
76
  },
65
77
  disclose(signatureResponse),
66
78
  );
67
-
68
- // Notify the requesting client which post just landed. A ping only —
69
- // clients read the post back from the log and verify it off-chain.
70
- emit(Misc {
71
- name: pad(32, "SignatureRespondedEvent"),
72
- payload: serialize<SignatureRespondedEvent, 256>(SignatureRespondedEvent {
73
- requestId: disclosedRequestId as Bytes<32>,
74
- count: count,
75
- }),
76
- });
77
79
  }
78
80
 
79
81
  // postRespondBidirectional records the MPC's attestation of requestId's
@@ -116,20 +118,11 @@ export circuit postRespondBidirectional(
116
118
  // First valid write wins. A re-post is a no-op, never an overwrite —
117
119
  // Schnorr is randomized, so even the MPC re-signing the same output
118
120
  // yields bytewise-different records; asserting equality would misfire.
119
- // The no-op also emits nothing: the event fires at most once per request,
120
- // exactly when the one authenticated slot is filled.
121
+ // The no-op leaves the single authenticated slot untouched. Clients poll
122
+ // the index by request id; no off-chain verification follows — the
123
+ // in-circuit checks above already authenticated the stored record.
121
124
  if (respondBidirectionalIndex.member(disclosedRequestId)) {
122
125
  return [];
123
126
  }
124
127
  respondBidirectionalIndex.insert(disclosedRequestId, disclosedResponse);
125
-
126
- // Notify the requesting client the attestation landed. A ping only —
127
- // clients read the record back from the index; no off-chain verification
128
- // follows, the in-circuit checks above already authenticated it.
129
- emit(Misc {
130
- name: pad(32, "RespondBidirectionalEvent"),
131
- payload: serialize<RespondBidirectionalEvent, 256>(RespondBidirectionalEvent {
132
- requestId: disclosedRequestId as Bytes<32>,
133
- }),
134
- });
135
128
  }