@sig-net/midnight 0.26.0-rc.4 → 0.26.0-rc.7

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.
@@ -8,10 +8,10 @@
8
8
  // Distributed MPC network to execute arbitrary transactions on foreign
9
9
  // blockchains.
10
10
  // - Signet singleton: a single contract on the Midnight blockchain through which clients notify
11
- // the MPC of signature requests, and through which the MPC posts back
12
- // signatures and signed attestations of foreign executions. Each post is
13
- // emitted as a contract event (the execution outputs themselves travel off
14
- // chain).
11
+ // the MPC of signature requests.
12
+ // - Signet responder: the contract through which the MPC posts back signatures and signed
13
+ // attestations of foreign executions, each emitted as a contract event
14
+ // (the execution outputs themselves travel off chain).
15
15
  //
16
16
  // Usage:
17
17
  // // Import this module at the start of a contract (resolved through node_modules via COMPACT_PATH):
@@ -30,7 +30,7 @@
30
30
  // (executed, failed or unviable).
31
31
  //
32
32
  // The V1 suffix marks the wire and hash-domain artefacts of protocol version 1 (the structs the
33
- // ledger stores and the singleton emits, and the circuits that hash, verify or construct them).
33
+ // ledger stores and the signet contracts emit, and the circuits that hash, verify or construct them).
34
34
  // Vocabulary shared across versions (RequestId, OutputKind, Signature, the enums, the transaction
35
35
  // parameter structs, which TxParamType tags) and the version-tagged notification carry no suffix.
36
36
  //
@@ -42,13 +42,13 @@
42
42
  // 2. MPC polls the Signet singleton contract's events for SignBidirectionalEventNotifications and
43
43
  // uses each one to look the declared SignBidirectionalEvent signature request up in the named
44
44
  // client's own ledger. It generates the signature and posts a SignatureRespondedEvent (the requested
45
- // signature) through the Signet singleton, which emits it as a contract event.
46
- // 3. Client polls the Signet singleton contract's SignatureRespondedEvent events, identifying the response
45
+ // signature) through the Signet responder, which emits it as a contract event.
46
+ // 3. Client polls the Signet responder contract's SignatureRespondedEvent events, identifying the response
47
47
  // associated with their request by RequestId. Clients validate the signature is correct by checking with
48
48
  // the requested signing key. Then it broadcasts the signed txn to the target chain.
49
49
  // 4. MPC observes the txn's outcome in a final block on the target chain (executed, failed,
50
50
  // or unviable when another request's transaction took its nonce) and posts a
51
- // RespondBidirectionalEvent attestation through the Signet singleton, which emits it as a
51
+ // RespondBidirectionalEvent attestation through the Signet responder, which emits it as a
52
52
  // contract event beside the request id.
53
53
  // The client polls its request's posts and takes the first one that verifies over the request id,
54
54
  // block height, output kind and output. The client obtains the execution output off chain (for EVM: the mined
@@ -322,10 +322,10 @@ module Signet {
322
322
  }
323
323
 
324
324
  // Counterpart to SignBidirectionalEvent: the MPC generated signature a request asked for.
325
- // Posted by the MPC through the Signet singleton for clients to extract and build a
325
+ // Posted by the MPC through the Signet responder for clients to extract and build a
326
326
  // signed transaction from.
327
327
  export struct SignatureRespondedEventV1 {
328
- // The request this signature answers. Routing data: the singleton emits it
328
+ // The request this signature answers. Routing data: the responder emits it
329
329
  // unverified, and a reader proves the signature against the request's own key.
330
330
  requestId: RequestId;
331
331
  // The requested signature over the transaction the request describes.
@@ -349,7 +349,7 @@ module Signet {
349
349
  // (verifyRespondBidirectionalAttestationV1), and the output checks against the
350
350
  // event's length and hash (verifyAttestedOutputV1). The signature
351
351
  // is the ONLY thing that distinguishes a genuine post from garbage: the
352
- // singleton emits every post unverified.
352
+ // responder emits every post unverified.
353
353
  export struct RespondBidirectionalEventV1 {
354
354
  // The request this attestation answers. Signed into the digest: a verified
355
355
  // post settles exactly the request it names, so a client consumes this id
@@ -434,7 +434,10 @@ module Signet {
434
434
  // reduces to 0 mod the curve order aborts the circuit rather than returning
435
435
  // false, so sift candidate posts off chain first
436
436
  // (verifyRespondBidirectionalAttestation). The identity point as
437
- // mpcResponseKey always returns false.
437
+ // mpcResponseKey returns false when the circuit is executed, but that
438
+ // execution cannot be proved: the curve operations still run in the proved
439
+ // circuit and fail on it. A contract must therefore refuse the identity
440
+ // point when it stores its response key.
438
441
  export pure circuit verifyRespondBidirectionalAttestationV1(
439
442
  respondBidirectionalEvent: RespondBidirectionalEventV1,
440
443
  mpcResponseKey: Secp256k1Point
@@ -481,7 +484,7 @@ module Signet {
481
484
  // against the event's length and hash) and the event's signature verifies
482
485
  // (verifyRespondBidirectionalAttestationV1, whose byte-order and abort
483
486
  // contract applies here too). Client contracts run this before consuming
484
- // outputs, as the singleton emits responses unverified. The caller supplies
487
+ // outputs, as the responder emits responses unverified. The caller supplies
485
488
  // serializedOutput at its exact unpadded width.
486
489
  export pure circuit verifyRespondBidirectionalEventV1<#serializedOutputLength>(
487
490
  serializedOutput: Bytes<serializedOutputLength>,