@sig-net/midnight 0.26.0-rc.1 → 0.26.0-rc.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.
- package/README.md +6 -5
- package/dist/constants.d.ts +18 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -4
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +1 -1
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +3 -1
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/managed/compiler/contract-manifest.json +4 -4
- package/dist/managed/contract/index.js +49 -39
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/record-contract-address.d.ts +27 -10
- package/dist/record-contract-address.d.ts.map +1 -1
- package/dist/record-contract-address.js +54 -17
- package/dist/record-contract-address.js.map +1 -1
- package/dist/signature-response-verification.js +3 -3
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-events.d.ts +7 -13
- package/dist/signet-contract-events.d.ts.map +1 -1
- package/dist/signet-contract-events.js +15 -14
- package/dist/signet-contract-events.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +11 -8
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +7 -7
- package/dist/signet-request-response-reader.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +16 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sig-net/midnight",
|
|
3
|
-
"version": "0.26.0-rc.
|
|
3
|
+
"version": "0.26.0-rc.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sig-net/midnight-integration",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@midnight-ntwrk/compact-runtime": "0.18.0-rc.1",
|
|
50
50
|
"@midnight-ntwrk/midnight-js-types": "5.0.0-beta.6",
|
|
51
51
|
"@noble/curves": "^2.2.0",
|
|
52
|
-
"@sig-net/midnight-serde": "^0.26.0-rc.
|
|
52
|
+
"@sig-net/midnight-serde": "^0.26.0-rc.2",
|
|
53
53
|
"ethers": "^6.17.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/Signet.compact
CHANGED
|
@@ -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
|
|
12
|
-
//
|
|
13
|
-
// emitted as a contract event
|
|
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
|
|
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
|
|
46
|
-
// 3. Client polls the Signet
|
|
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
|
|
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
|
|
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
|
|
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
|
-
//
|
|
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
|
|
@@ -433,7 +433,8 @@ module Signet {
|
|
|
433
433
|
// requestId, so a client MUST consume that request and no other. An s that
|
|
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
|
-
// (verifyRespondBidirectionalAttestation).
|
|
436
|
+
// (verifyRespondBidirectionalAttestation). The identity point as
|
|
437
|
+
// mpcResponseKey always returns false.
|
|
437
438
|
export pure circuit verifyRespondBidirectionalAttestationV1(
|
|
438
439
|
respondBidirectionalEvent: RespondBidirectionalEventV1,
|
|
439
440
|
mpcResponseKey: Secp256k1Point
|
|
@@ -446,7 +447,7 @@ module Signet {
|
|
|
446
447
|
respondBidirectionalEvent.outputHash,
|
|
447
448
|
);
|
|
448
449
|
|
|
449
|
-
|
|
450
|
+
const signatureVerifies = secp256k1EcdsaVerify(
|
|
450
451
|
digest,
|
|
451
452
|
Secp256k1EcdsaSignature {
|
|
452
453
|
r: respondBidirectionalEvent.signature.bigR.x as Secp256k1Scalar,
|
|
@@ -454,6 +455,7 @@ module Signet {
|
|
|
454
455
|
},
|
|
455
456
|
mpcResponseKey
|
|
456
457
|
);
|
|
458
|
+
return mpcResponseKey != default<Secp256k1Point> && signatureVerifies;
|
|
457
459
|
}
|
|
458
460
|
|
|
459
461
|
// Whether serializedOutput is the output an attestation declares: its width
|
|
@@ -478,7 +480,7 @@ module Signet {
|
|
|
478
480
|
// against the event's length and hash) and the event's signature verifies
|
|
479
481
|
// (verifyRespondBidirectionalAttestationV1, whose byte-order and abort
|
|
480
482
|
// contract applies here too). Client contracts run this before consuming
|
|
481
|
-
// outputs, as the
|
|
483
|
+
// outputs, as the responder emits responses unverified. The caller supplies
|
|
482
484
|
// serializedOutput at its exact unpadded width.
|
|
483
485
|
export pure circuit verifyRespondBidirectionalEventV1<#serializedOutputLength>(
|
|
484
486
|
serializedOutput: Bytes<serializedOutputLength>,
|