@sig-net/midnight 0.23.0 → 0.24.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 +10 -7
- package/dist/compact-descriptors.d.ts +8 -6
- package/dist/compact-descriptors.d.ts.map +1 -1
- package/dist/compact-descriptors.js +26 -8
- package/dist/compact-descriptors.js.map +1 -1
- package/dist/constants.d.ts +2 -21
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -24
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +41 -11
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +45 -12
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +290 -6
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +69 -5
- package/dist/managed/contract/index.js +436 -154
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +6 -13
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +9 -15
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signet-contract-events.d.ts +39 -9
- package/dist/signet-contract-events.d.ts.map +1 -1
- package/dist/signet-contract-events.js +79 -29
- package/dist/signet-contract-events.js.map +1 -1
- package/dist/signet-evtype2tx-record-decoding.js +4 -4
- package/dist/signet-evtype2tx-record-decoding.js.map +1 -1
- package/dist/signet-request-id.d.ts +2 -1
- package/dist/signet-request-id.d.ts.map +1 -1
- package/dist/signet-request-id.js +13 -3
- package/dist/signet-request-id.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +5 -6
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +43 -10
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +24 -5
- package/dist/signet-requests.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +3 -8
- package/dist/testing.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +107 -39
- package/src/circuits.compact +37 -9
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ The protocol and integration documentation lives in the [sig-net/midnight-integr
|
|
|
35
35
|
|
|
36
36
|
- [Sign Bidirectional Flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-protocol-flow): the 5-step protocol this package speaks, with diagram, failure handling and output recovery.
|
|
37
37
|
- [Derived keys](https://github.com/sig-net/midnight-integration/blob/main/README.md#derived-keys): the request signing key and the response key, and how the MPC derives them.
|
|
38
|
-
- [Handling Failure](https://github.com/sig-net/midnight-integration/blob/main/README.md#handling-failure): the
|
|
38
|
+
- [Handling Failure](https://github.com/sig-net/midnight-integration/blob/main/README.md#handling-failure): the empty output and failure output kind the MPC attests for a failed foreign transaction, and how a contract routes on the verified kind.
|
|
39
39
|
- [Integrator Guide](https://github.com/sig-net/midnight-integration/blob/main/README.md#integrator-guide): the once-off setup and the per-request runtime steps, built on this package's exports.
|
|
40
40
|
- [EVM Type 2 transactions and ABI calldata words](https://github.com/sig-net/midnight-integration/blob/main/README.md#evm-type-2-transactions-and-abi-calldata-words): building calldata words in-circuit and deserialising respond payloads.
|
|
41
41
|
|
|
@@ -55,7 +55,7 @@ What your contract imports with `import "@sig-net/midnight/src/Signet"`:
|
|
|
55
55
|
| Build and store a signature request (runtime step 1) | `constructSignBidirectionalEvent` and `calculateRequestId`, over the request structs `EvmType2TxParams`, `EvmCalldata` and `EvmAccessListEntry`. |
|
|
56
56
|
| Notify the MPC of the request (runtime step 1) | `constructSignBidirectionalEventNotificationV1`: packs your contract's address and the request map's ledger-tree path. |
|
|
57
57
|
| Build and read calldata words in-circuit | The builders `evmAddressAbiWord`, `numericAbiWord` and `boolAbiWord`, and the readers `abiWordToUint128` and `abiWordToBool` (see [EVM Type 2 transactions and ABI calldata words](https://github.com/sig-net/midnight-integration/blob/main/README.md#evm-type-2-transactions-and-abi-calldata-words)). |
|
|
58
|
-
| Verify the execution attestation (runtime step 5) | `verifyRespondBidirectionalEvent`: recomputes the attestation digest from the output bytes and checks the MPC's signature against your pinned response key. |
|
|
58
|
+
| Verify the execution attestation (runtime step 5) | `verifyRespondBidirectionalEvent`: recomputes the attestation digest from the output bytes and the posted request id, output kind and block height, and checks the MPC's signature against your pinned response key. |
|
|
59
59
|
|
|
60
60
|
### TypeScript library
|
|
61
61
|
|
|
@@ -69,11 +69,11 @@ What clients import from `@sig-net/midnight`:
|
|
|
69
69
|
| Derive the response key your deploy pins | `deriveMidnightResponseKey`: the key `initialise` stores (setup step 4), derived from your contract's address. |
|
|
70
70
|
| Look up published counterparty values | `MidnightNetwork`, `getMpcRootPublicKey` and `getSignetContractAddress`: the fixed per-network values (see the notes in [Runtime](https://github.com/sig-net/midnight-integration/blob/main/README.md#runtime)). |
|
|
71
71
|
| Accept an MPC public key in any published spelling | `parseSecp256k1PublicKey` (to a Compact `Secp256k1Point`) and `normaliseSecp256k1PublicKey` (to the canonical `0x04…` uncompressed SEC1 hex): both take SEC1 hex, compressed or uncompressed with an optional `0x`, and NEAR's `secp256k1:<base58>`. |
|
|
72
|
-
| Read a text field of a request record | `asciiUnpadded`: the inverse of `asciiPadded`, for the zero-padded text fields (`
|
|
72
|
+
| Read a text field of a request record | `asciiUnpadded`: the inverse of `asciiPadded`, for the zero-padded text fields (`executionDest`, the two schemas). |
|
|
73
73
|
| Compute a request id off chain | `calculateRequestId`: the TS twin of the on-chain circuit, plus `requestIdHex` and `parseRequestIdHex` for the hex form. |
|
|
74
74
|
| Compose expected calldata words off chain (UIs, expected-record builders, tests) | The builders `numericAbiWord`, `evmAddressAbiWord` and `boolAbiWord`, and the readers `abiWordToUint128` and `abiWordToBool`: TS twins of the circuits under identical names. |
|
|
75
75
|
| Convert a foreign execution output into respond bytes | `deserializeEvmOutput` (raw EVM return data to named values) and `serializeRespondOutput` (named values to the packed respond payload the MPC attests): together they rebuild the `serializedOutput` of steps 4 and 5. |
|
|
76
|
-
| Recognise a failed remote execution | `
|
|
76
|
+
| Recognise a failed remote execution | `OutputKind` on the verified `RespondBidirectionalEvent`: `failed` or `unviable` beside an empty output (see [Handling Failure](https://github.com/sig-net/midnight-integration/blob/main/README.md#handling-failure)). |
|
|
77
77
|
| Read the attested output bytes from the MPC's output cache | `MpcOutputCacheReader`: one reader per network and Signet singleton pair, over the public bucket an MPC configured with output storage writes each request's exact attested bytes to before posting, defaulting to the bucket `getMpcOutputCacheUrl` publishes for the network. `fetchSerializedOutput` yields the bytes step 5 verifies, `undefined` while the object is not written yet. |
|
|
78
78
|
| Verify attestations without the reader | `verifyRespondBidirectionalSignature`: the check the reader runs internally, exposed for custom pipelines. |
|
|
79
79
|
| Mint attestations in your contract's unit tests | The `@sig-net/midnight/testing` entry point, see [Testing entry point](#testing-entry-point). |
|
|
@@ -103,15 +103,18 @@ import {
|
|
|
103
103
|
signAttestationDigest,
|
|
104
104
|
} from "@sig-net/midnight/testing"; // tests only
|
|
105
105
|
|
|
106
|
-
// A real RespondBidirectionalEvent for (requestId,
|
|
107
|
-
// It verifies, in-circuit and off chain, against
|
|
106
|
+
// A real RespondBidirectionalEvent for (requestId, blockHeight, outputKind,
|
|
107
|
+
// output), signed by secretKey. It verifies, in-circuit and off chain, against
|
|
108
|
+
// secp256k1PublicKeyOf(secretKey).
|
|
108
109
|
const event = {
|
|
109
110
|
signature: ecdsaSignatureToMpcSignature(
|
|
110
111
|
signAttestationDigest(
|
|
111
|
-
calculateSignetAttestationDigest(requestId, serializedOutput),
|
|
112
|
+
calculateSignetAttestationDigest(requestId, blockHeight, outputKind, serializedOutput),
|
|
112
113
|
secretKey,
|
|
113
114
|
),
|
|
114
115
|
),
|
|
116
|
+
outputKind,
|
|
117
|
+
blockHeight,
|
|
115
118
|
};
|
|
116
119
|
```
|
|
117
120
|
|
|
@@ -87,13 +87,15 @@ export declare function decodeExactly<T>(type: CompactType<T>, atoms: readonly U
|
|
|
87
87
|
*/
|
|
88
88
|
export declare function declaredWidths(cell: AlignedValue, what: string): number[];
|
|
89
89
|
/**
|
|
90
|
-
* Descriptor of the Compact tuple
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
90
|
+
* Descriptor of the Compact tuple
|
|
91
|
+
* `[RequestId, Uint<64>, OutputKind, Uint<64>, Bytes<serializedOutputLength>]`
|
|
92
|
+
* the attestation digest hashes (request id, block height, output kind,
|
|
93
|
+
* output length, output), composed the way the compiler composes a tuple:
|
|
94
|
+
* the elements' alignments and values concatenated in order. The output
|
|
95
|
+
* width enters the descriptor, so it is built per call.
|
|
94
96
|
*
|
|
95
97
|
* @param serializedOutputLength - Declared width of the output element, in bytes.
|
|
96
|
-
* @returns The
|
|
98
|
+
* @returns The tuple descriptor for {@link calculateSignetAttestationDigest}.
|
|
97
99
|
*/
|
|
98
|
-
export declare function attestationPreimageDescriptor(serializedOutputLength: number): CompactType<[Uint8Array, bigint, Uint8Array]>;
|
|
100
|
+
export declare function attestationPreimageDescriptor(serializedOutputLength: number): CompactType<[Uint8Array, bigint, number, bigint, Uint8Array]>;
|
|
99
101
|
//# sourceMappingURL=compact-descriptors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact-descriptors.d.ts","sourceRoot":"","sources":["../src/compact-descriptors.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"compact-descriptors.d.ts","sourceRoot":"","sources":["../src/compact-descriptors.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAKzC,0CAA0C;A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AAM,GACX,CAAC,CASH;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBzE;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,sBAAsB,EAAE,MAAM,GAC7B,WAAW,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAyB/D"}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
// (that package describes the `serialize<T, N>` wire format, a different
|
|
26
26
|
// layer). Package-internal: consumers use the reader/request functions built
|
|
27
27
|
// on top, never these directly.
|
|
28
|
-
import { CompactTypeBoolean, CompactTypeBytes, CompactTypeUnsignedInteger, } from "@midnight-ntwrk/compact-runtime";
|
|
28
|
+
import { CompactTypeBoolean, CompactTypeBytes, CompactTypeEnum, CompactTypeUnsignedInteger, } from "@midnight-ntwrk/compact-runtime";
|
|
29
29
|
// Runtime descriptors of the Compact base types, at the same literals the
|
|
30
30
|
// compiler emits.
|
|
31
31
|
/** Descriptor of a Compact `Bytes<4>`. */
|
|
@@ -140,26 +140,44 @@ export function declaredWidths(cell, what) {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
* Descriptor of
|
|
144
|
-
* the
|
|
145
|
-
*
|
|
146
|
-
|
|
143
|
+
* Descriptor of Signet.compact's three-variant `OutputKind` enum, at the
|
|
144
|
+
* literal the compiler emits (highest variant index 2, one byte). Adding a
|
|
145
|
+
* variant to the Compact enum means raising the index here in lockstep.
|
|
146
|
+
*/
|
|
147
|
+
const OUTPUT_KIND = new CompactTypeEnum(2, 1);
|
|
148
|
+
/**
|
|
149
|
+
* Descriptor of the Compact tuple
|
|
150
|
+
* `[RequestId, Uint<64>, OutputKind, Uint<64>, Bytes<serializedOutputLength>]`
|
|
151
|
+
* the attestation digest hashes (request id, block height, output kind,
|
|
152
|
+
* output length, output), composed the way the compiler composes a tuple:
|
|
153
|
+
* the elements' alignments and values concatenated in order. The output
|
|
154
|
+
* width enters the descriptor, so it is built per call.
|
|
147
155
|
*
|
|
148
156
|
* @param serializedOutputLength - Declared width of the output element, in bytes.
|
|
149
|
-
* @returns The
|
|
157
|
+
* @returns The tuple descriptor for {@link calculateSignetAttestationDigest}.
|
|
150
158
|
*/
|
|
151
159
|
export function attestationPreimageDescriptor(serializedOutputLength) {
|
|
152
160
|
const output = new CompactTypeBytes(serializedOutputLength);
|
|
153
161
|
return {
|
|
154
|
-
alignment: () => [
|
|
155
|
-
|
|
162
|
+
alignment: () => [
|
|
163
|
+
...BYTES_32.alignment(),
|
|
164
|
+
...UINT_64.alignment(),
|
|
165
|
+
...OUTPUT_KIND.alignment(),
|
|
166
|
+
...UINT_64.alignment(),
|
|
167
|
+
...output.alignment(),
|
|
168
|
+
],
|
|
169
|
+
toValue: ([requestId, blockHeight, outputKind, outputLength, serializedOutput]) => [
|
|
156
170
|
...BYTES_32.toValue(requestId),
|
|
171
|
+
...UINT_64.toValue(blockHeight),
|
|
172
|
+
...OUTPUT_KIND.toValue(outputKind),
|
|
157
173
|
...UINT_64.toValue(outputLength),
|
|
158
174
|
...output.toValue(serializedOutput),
|
|
159
175
|
],
|
|
160
176
|
fromValue: (value) => [
|
|
161
177
|
BYTES_32.fromValue(value),
|
|
162
178
|
UINT_64.fromValue(value),
|
|
179
|
+
OUTPUT_KIND.fromValue(value),
|
|
180
|
+
UINT_64.fromValue(value),
|
|
163
181
|
output.fromValue(value),
|
|
164
182
|
],
|
|
165
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact-descriptors.js","sourceRoot":"","sources":["../src/compact-descriptors.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,0CAA0C;AAC1C,mFAAmF;AACnF,gFAAgF;AAChF,oFAAoF;AACpF,eAAe;AACf,uFAAuF;AACvF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AAO,CAAC,WAAW,CAAC;YAC/B,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC;YAClC,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;YAChC,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;SACpC;QACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;YACpB,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;YACzB,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;YACxB,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC;YAC5B,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;YACxB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;SACxB;KACF,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
/** Width of `SignBidirectionalEvent.
|
|
2
|
-
export declare const
|
|
1
|
+
/** Width of `SignBidirectionalEvent.executionDest` (`Bytes<32>`): a zero-padded CAIP-2 id. */
|
|
2
|
+
export declare const EXECUTION_DEST_BYTES = 32;
|
|
3
3
|
/** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
|
|
4
4
|
export declare const MPC_PARAMS_BYTES = 64;
|
|
5
5
|
/** Width of `EvmCalldata.selector` (`Bytes<4>`): the literal first 4 calldata bytes. */
|
|
6
6
|
export declare const SELECTOR_BYTES = 4;
|
|
7
|
-
/**
|
|
8
|
-
* The complete serialised output the MPC attests for a FAILED remote
|
|
9
|
-
* execution (reverted or replaced transaction): the 4-byte error marker
|
|
10
|
-
* `0xdeadbeef` followed by one `0x01` byte, mirroring the canonical MPC's
|
|
11
|
-
* failure payload (sig-net/mpc, node/src/respond_bidirectional.rs). A
|
|
12
|
-
* respond schema whose packed width is exactly 5 bytes could produce a
|
|
13
|
-
* legitimate output equal to this sentinel: such clients must route
|
|
14
|
-
* settlement by digest-candidate matching, never by inspecting output
|
|
15
|
-
* bytes. See {@link isMpcFailureOutput}.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MPC_FAILURE_OUTPUT: Uint8Array<ArrayBuffer>;
|
|
18
|
-
/**
|
|
19
|
-
* Whether an attested serialised output IS the MPC's fixed failure payload:
|
|
20
|
-
* exact byte equality with the 5-byte {@link MPC_FAILURE_OUTPUT}.
|
|
21
|
-
*
|
|
22
|
-
* @param serializedOutput - The attested serialised output.
|
|
23
|
-
* @returns `true` when the output equals the MPC failure payload exactly.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isMpcFailureOutput(serializedOutput: Uint8Array): boolean;
|
|
26
7
|
/**
|
|
27
8
|
* Default MPC key version (`keyVersion` field value). The canonical MPC
|
|
28
9
|
* (and `constructSignBidirectionalEvent`) requires `keyVersion >= 1`.
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AASA,8FAA8F;AAC9F,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wFAAwF;AACxF,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUpE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMvD;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,mFAAmF;IACnF,UAAU,eAAe;IACzB,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,iFAAiF;IACjF,OAAO,YAAY;IACnB,+EAA+E;IAC/E,OAAO,YAAY;IACnB,6CAA6C;IAC7C,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;AAgBnF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAMtE;AAYD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAM3E;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAMvE"}
|
package/dist/constants.js
CHANGED
|
@@ -6,34 +6,12 @@
|
|
|
6
6
|
//
|
|
7
7
|
// The routing constants belong in github.com/sig-net/signet.js, kept here
|
|
8
8
|
// until upstreamed.
|
|
9
|
-
/** Width of `SignBidirectionalEvent.
|
|
10
|
-
export const
|
|
9
|
+
/** Width of `SignBidirectionalEvent.executionDest` (`Bytes<32>`): a zero-padded CAIP-2 id. */
|
|
10
|
+
export const EXECUTION_DEST_BYTES = 32;
|
|
11
11
|
/** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
|
|
12
12
|
export const MPC_PARAMS_BYTES = 64;
|
|
13
13
|
/** Width of `EvmCalldata.selector` (`Bytes<4>`): the literal first 4 calldata bytes. */
|
|
14
14
|
export const SELECTOR_BYTES = 4;
|
|
15
|
-
/**
|
|
16
|
-
* The complete serialised output the MPC attests for a FAILED remote
|
|
17
|
-
* execution (reverted or replaced transaction): the 4-byte error marker
|
|
18
|
-
* `0xdeadbeef` followed by one `0x01` byte, mirroring the canonical MPC's
|
|
19
|
-
* failure payload (sig-net/mpc, node/src/respond_bidirectional.rs). A
|
|
20
|
-
* respond schema whose packed width is exactly 5 bytes could produce a
|
|
21
|
-
* legitimate output equal to this sentinel: such clients must route
|
|
22
|
-
* settlement by digest-candidate matching, never by inspecting output
|
|
23
|
-
* bytes. See {@link isMpcFailureOutput}.
|
|
24
|
-
*/
|
|
25
|
-
export const MPC_FAILURE_OUTPUT = new Uint8Array([0xde, 0xad, 0xbe, 0xef, 0x01]);
|
|
26
|
-
/**
|
|
27
|
-
* Whether an attested serialised output IS the MPC's fixed failure payload:
|
|
28
|
-
* exact byte equality with the 5-byte {@link MPC_FAILURE_OUTPUT}.
|
|
29
|
-
*
|
|
30
|
-
* @param serializedOutput - The attested serialised output.
|
|
31
|
-
* @returns `true` when the output equals the MPC failure payload exactly.
|
|
32
|
-
*/
|
|
33
|
-
export function isMpcFailureOutput(serializedOutput) {
|
|
34
|
-
return (serializedOutput.length === MPC_FAILURE_OUTPUT.length &&
|
|
35
|
-
MPC_FAILURE_OUTPUT.every((byte, index) => serializedOutput[index] === byte));
|
|
36
|
-
}
|
|
37
15
|
/**
|
|
38
16
|
* Default MPC key version (`keyVersion` field value). The canonical MPC
|
|
39
17
|
* (and `constructSignBidirectionalEvent`) requires `keyVersion >= 1`.
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,oBAAoB;AAEpB
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,oBAAoB;AAEpB,8FAA8F;AAC9F,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAE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AC,EACxB,2EAA2E;IAC7E,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA0B;IAC7D,MAAM,QAAQ,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8CAA8C,SAAS,eAAe,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
2
2
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
3
3
|
import { Signature } from "ethers";
|
|
4
|
+
import type { OutputKind } from "./managed/contract/index.js";
|
|
4
5
|
import type { MpcSignature, RespondBidirectionalEvent, SignatureRespondedEvent } from "./signet-contract-events.ts";
|
|
5
6
|
import type { RequestId } from "./signet-requests.ts";
|
|
6
7
|
export type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
@@ -70,11 +71,12 @@ export declare function signatureRespondedEventToSignature(response: SignatureRe
|
|
|
70
71
|
* it is exported through the `./testing` entry point with the other
|
|
71
72
|
* posting-side helpers.
|
|
72
73
|
*
|
|
74
|
+
* @param requestId - The 32-byte request id the signature answers.
|
|
73
75
|
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
74
76
|
* @returns The response record, ready to post.
|
|
75
77
|
* @throws {Error} If `r` is not the x coordinate of a secp256k1 point.
|
|
76
78
|
*/
|
|
77
|
-
export declare function signatureToSignatureRespondedEvent(signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
|
|
79
|
+
export declare function signatureToSignatureRespondedEvent(requestId: RequestId, signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
|
|
78
80
|
/** A point in noble's own representation, for curve arithmetic. */
|
|
79
81
|
type NobleSecp256k1Point = ReturnType<typeof secp256k1.Point.fromHex>;
|
|
80
82
|
/**
|
|
@@ -132,15 +134,42 @@ export declare function normaliseSecp256k1PublicKey(value: string): string;
|
|
|
132
134
|
export declare function secp256k1PublicKeyOf(secretKey: Uint8Array): Secp256k1Point;
|
|
133
135
|
/**
|
|
134
136
|
* The attestation digest of a respond-bidirectional response:
|
|
135
|
-
* `upgradeFromTransient(transientHash([requestId, outputLength, serializedOutput]))`,
|
|
136
|
-
* 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS
|
|
137
|
-
* the size-generic Compact circuit of the same name.
|
|
137
|
+
* `upgradeFromTransient(transientHash([requestId, blockHeight, outputKind, outputLength, serializedOutput]))`,
|
|
138
|
+
* the 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS
|
|
139
|
+
* twin of the size-generic Compact circuit of the same name.
|
|
138
140
|
*
|
|
139
141
|
* @param requestId - The 32-byte request id the response answers.
|
|
142
|
+
* @param blockHeight - Height of the finalised destination block holding the
|
|
143
|
+
* attested transaction, in the destination chain's own numbering.
|
|
144
|
+
* @param outputKind - The MPC's verdict on the execution.
|
|
140
145
|
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
141
146
|
* @returns The 32-byte attestation digest.
|
|
142
147
|
*/
|
|
143
|
-
export declare function calculateSignetAttestationDigest(requestId: RequestId, serializedOutput: Uint8Array): Uint8Array;
|
|
148
|
+
export declare function calculateSignetAttestationDigest(requestId: RequestId, blockHeight: bigint, outputKind: OutputKind, serializedOutput: Uint8Array): Uint8Array;
|
|
149
|
+
/** What a respond-bidirectional attestation commits to: the digest's inputs. */
|
|
150
|
+
export interface RespondBidirectionalAttestation {
|
|
151
|
+
/** The 32-byte request id the response answers. */
|
|
152
|
+
requestId: RequestId;
|
|
153
|
+
/** Height of the finalised destination block holding the attested transaction. */
|
|
154
|
+
blockHeight: bigint;
|
|
155
|
+
/** The MPC's verdict on the execution. */
|
|
156
|
+
outputKind: OutputKind;
|
|
157
|
+
/** The serialised execution output, exact unpadded bytes (empty for a failure). */
|
|
158
|
+
serializedOutput: Uint8Array;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Mint the record the MPC posts for an outcome: the attestation digest over
|
|
162
|
+
* `attestation`, ECDSA-signed with `secretKey`, in the ledger shape the
|
|
163
|
+
* singleton emits (big-endian signature bytes). Responder-side and
|
|
164
|
+
* test-fixture side (the fakenet posts through this), so it is exported
|
|
165
|
+
* through the `./testing` entry point.
|
|
166
|
+
*
|
|
167
|
+
* @param attestation - What the attestation commits to.
|
|
168
|
+
* @param secretKey - The 32-byte secp256k1 response secret key of the requesting contract.
|
|
169
|
+
* @returns The record, ready to post or to serve as a fixture.
|
|
170
|
+
* @throws {Error} If no recovery id reproduces the signer's own public key.
|
|
171
|
+
*/
|
|
172
|
+
export declare function attestRespondBidirectional(attestation: RespondBidirectionalAttestation, secretKey: Uint8Array): RespondBidirectionalEvent;
|
|
144
173
|
/**
|
|
145
174
|
* Produce the circuit-input form of a posted respond-bidirectional
|
|
146
175
|
* attestation: `signature.bigR.x` and `signature.s` byte-reversed into
|
|
@@ -159,19 +188,20 @@ export declare function respondBidirectionalEventToCircuitInput(event: RespondBi
|
|
|
159
188
|
/**
|
|
160
189
|
* Off-chain twin of the in-circuit `verifyRespondBidirectionalEvent`: checks
|
|
161
190
|
* a posted respond-bidirectional attestation against the execution output
|
|
162
|
-
* and the contract's pinned MPC response key
|
|
163
|
-
*
|
|
164
|
-
* in-circuit (once
|
|
191
|
+
* and the contract's pinned MPC response key, over the request id, block
|
|
192
|
+
* height and output kind the post declares. Clients run it to sift candidate posts
|
|
193
|
+
* before calling a contract: a post this accepts verifies in-circuit (once
|
|
194
|
+
* flipped to circuit-input form, see
|
|
165
195
|
* {@link respondBidirectionalEventToCircuitInput}). Takes the record as read
|
|
166
196
|
* off the ledger (big-endian). Malformed records return `false` rather than
|
|
167
197
|
* throwing.
|
|
168
198
|
*
|
|
169
|
-
* @param requestId - The 32-byte request id the response answers.
|
|
170
199
|
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
171
200
|
* @param event - The posted record to check, as read off the ledger.
|
|
172
201
|
* @param mpcResponseKey - The response key the requesting contract pinned
|
|
173
202
|
* (see {@link deriveMidnightResponseKey}).
|
|
174
|
-
* @returns Whether the post is a genuine attestation of that output
|
|
203
|
+
* @returns Whether the post is a genuine attestation of that output for the
|
|
204
|
+
* request it names.
|
|
175
205
|
*/
|
|
176
|
-
export declare function verifyRespondBidirectionalSignature(
|
|
206
|
+
export declare function verifyRespondBidirectionalSignature(serializedOutput: Uint8Array, event: RespondBidirectionalEvent, mpcResponseKey: Secp256k1Point): boolean;
|
|
177
207
|
//# sourceMappingURL=ecdsa-attestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAgB,SAAS,EAAW,MAAM,QAAQ,CAAC;AAI1D,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,uCAAuC;AACvC,eAAO,MAAM,eAAe,QAA2B,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,2DAA2D;IAC3D,CAAC,EAAE,MAAM,CAAC;IACV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CAAC;IACrB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAC;IACvB,mFAAmF;IACnF,gBAAgB,EAAE,UAAU,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,+BAA+B,EAC5C,SAAS,EAAE,UAAU,GACpB,yBAAyB,CAgB3B;AAgBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,yBAAyB,GAC/B,yBAAyB,CAS3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,UAAU,EAC5B,KAAK,EAAE,yBAAyB,EAChC,cAAc,EAAE,cAAc,GAC7B,OAAO,CA8BT"}
|
|
@@ -126,12 +126,14 @@ export function signatureRespondedEventToSignature(response) {
|
|
|
126
126
|
* it is exported through the `./testing` entry point with the other
|
|
127
127
|
* posting-side helpers.
|
|
128
128
|
*
|
|
129
|
+
* @param requestId - The 32-byte request id the signature answers.
|
|
129
130
|
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
130
131
|
* @returns The response record, ready to post.
|
|
131
132
|
* @throws {Error} If `r` is not the x coordinate of a secp256k1 point.
|
|
132
133
|
*/
|
|
133
|
-
export function signatureToSignatureRespondedEvent(signature) {
|
|
134
|
+
export function signatureToSignatureRespondedEvent(requestId, signature) {
|
|
134
135
|
return {
|
|
136
|
+
requestId,
|
|
135
137
|
signature: ecdsaSignatureToMpcSignature({
|
|
136
138
|
r: BigInt(signature.r),
|
|
137
139
|
s: BigInt(signature.s),
|
|
@@ -268,21 +270,50 @@ export function secp256k1PublicKeyOf(secretKey) {
|
|
|
268
270
|
}
|
|
269
271
|
/**
|
|
270
272
|
* The attestation digest of a respond-bidirectional response:
|
|
271
|
-
* `upgradeFromTransient(transientHash([requestId, outputLength, serializedOutput]))`,
|
|
272
|
-
* 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS
|
|
273
|
-
* the size-generic Compact circuit of the same name.
|
|
273
|
+
* `upgradeFromTransient(transientHash([requestId, blockHeight, outputKind, outputLength, serializedOutput]))`,
|
|
274
|
+
* the 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS
|
|
275
|
+
* twin of the size-generic Compact circuit of the same name.
|
|
274
276
|
*
|
|
275
277
|
* @param requestId - The 32-byte request id the response answers.
|
|
278
|
+
* @param blockHeight - Height of the finalised destination block holding the
|
|
279
|
+
* attested transaction, in the destination chain's own numbering.
|
|
280
|
+
* @param outputKind - The MPC's verdict on the execution.
|
|
276
281
|
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
277
282
|
* @returns The 32-byte attestation digest.
|
|
278
283
|
*/
|
|
279
|
-
export function calculateSignetAttestationDigest(requestId, serializedOutput) {
|
|
284
|
+
export function calculateSignetAttestationDigest(requestId, blockHeight, outputKind, serializedOutput) {
|
|
280
285
|
return upgradeFromTransient(transientHash(attestationPreimageDescriptor(serializedOutput.length), [
|
|
281
286
|
requestId,
|
|
287
|
+
blockHeight,
|
|
288
|
+
outputKind,
|
|
282
289
|
BigInt(serializedOutput.length),
|
|
283
290
|
serializedOutput,
|
|
284
291
|
]));
|
|
285
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Mint the record the MPC posts for an outcome: the attestation digest over
|
|
295
|
+
* `attestation`, ECDSA-signed with `secretKey`, in the ledger shape the
|
|
296
|
+
* singleton emits (big-endian signature bytes). Responder-side and
|
|
297
|
+
* test-fixture side (the fakenet posts through this), so it is exported
|
|
298
|
+
* through the `./testing` entry point.
|
|
299
|
+
*
|
|
300
|
+
* @param attestation - What the attestation commits to.
|
|
301
|
+
* @param secretKey - The 32-byte secp256k1 response secret key of the requesting contract.
|
|
302
|
+
* @returns The record, ready to post or to serve as a fixture.
|
|
303
|
+
* @throws {Error} If no recovery id reproduces the signer's own public key.
|
|
304
|
+
*/
|
|
305
|
+
export function attestRespondBidirectional(attestation, secretKey) {
|
|
306
|
+
const { requestId, blockHeight, outputKind, serializedOutput } = attestation;
|
|
307
|
+
const digest = calculateSignetAttestationDigest(requestId, blockHeight, outputKind, serializedOutput);
|
|
308
|
+
return {
|
|
309
|
+
requestId,
|
|
310
|
+
blockHeight,
|
|
311
|
+
outputKind,
|
|
312
|
+
serializedOutputLength: BigInt(serializedOutput.length),
|
|
313
|
+
digest,
|
|
314
|
+
signature: ecdsaSignatureToMpcSignature(signAttestationDigest(digest, secretKey)),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
286
317
|
/**
|
|
287
318
|
* Reverse a 32-byte value between big- and little-endian byte order.
|
|
288
319
|
*
|
|
@@ -312,6 +343,7 @@ function reverseBytes32(bytes) {
|
|
|
312
343
|
*/
|
|
313
344
|
export function respondBidirectionalEventToCircuitInput(event) {
|
|
314
345
|
return {
|
|
346
|
+
...event,
|
|
315
347
|
signature: {
|
|
316
348
|
...event.signature,
|
|
317
349
|
bigR: { ...event.signature.bigR, x: reverseBytes32(event.signature.bigR.x) },
|
|
@@ -322,21 +354,22 @@ export function respondBidirectionalEventToCircuitInput(event) {
|
|
|
322
354
|
/**
|
|
323
355
|
* Off-chain twin of the in-circuit `verifyRespondBidirectionalEvent`: checks
|
|
324
356
|
* a posted respond-bidirectional attestation against the execution output
|
|
325
|
-
* and the contract's pinned MPC response key
|
|
326
|
-
*
|
|
327
|
-
* in-circuit (once
|
|
357
|
+
* and the contract's pinned MPC response key, over the request id, block
|
|
358
|
+
* height and output kind the post declares. Clients run it to sift candidate posts
|
|
359
|
+
* before calling a contract: a post this accepts verifies in-circuit (once
|
|
360
|
+
* flipped to circuit-input form, see
|
|
328
361
|
* {@link respondBidirectionalEventToCircuitInput}). Takes the record as read
|
|
329
362
|
* off the ledger (big-endian). Malformed records return `false` rather than
|
|
330
363
|
* throwing.
|
|
331
364
|
*
|
|
332
|
-
* @param requestId - The 32-byte request id the response answers.
|
|
333
365
|
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
334
366
|
* @param event - The posted record to check, as read off the ledger.
|
|
335
367
|
* @param mpcResponseKey - The response key the requesting contract pinned
|
|
336
368
|
* (see {@link deriveMidnightResponseKey}).
|
|
337
|
-
* @returns Whether the post is a genuine attestation of that output
|
|
369
|
+
* @returns Whether the post is a genuine attestation of that output for the
|
|
370
|
+
* request it names.
|
|
338
371
|
*/
|
|
339
|
-
export function verifyRespondBidirectionalSignature(
|
|
372
|
+
export function verifyRespondBidirectionalSignature(serializedOutput, event, mpcResponseKey) {
|
|
340
373
|
let signature;
|
|
341
374
|
try {
|
|
342
375
|
signature = mpcSignatureToEcdsaSignature(event.signature);
|
|
@@ -344,7 +377,7 @@ export function verifyRespondBidirectionalSignature(requestId, serializedOutput,
|
|
|
344
377
|
catch {
|
|
345
378
|
return false;
|
|
346
379
|
}
|
|
347
|
-
const digest = calculateSignetAttestationDigest(requestId, serializedOutput);
|
|
380
|
+
const digest = calculateSignetAttestationDigest(event.requestId, event.blockHeight, event.outputKind, serializedOutput);
|
|
348
381
|
// Compact form the verifier takes: r || s big-endian, and the key as
|
|
349
382
|
// uncompressed SEC1 (0x04 || x || y).
|
|
350
383
|
const compactSignature = new Uint8Array(64);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,sEAAsE;AACtE,+CAA+C;AAC/C,kEAAkE;AAClE,2EAA2E;AAC3E,oEAAoE;AACpE,8BAA8B;AAC9B,oEAAoE;AACpE,4DAA4D;AAC5D,oCAAoC;AACpC,EAAE;AACF,wEAAwE;AACxE,8BAA8B;AAE9B,OAAO,EAEL,aAAa,EACb,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,SAAS,EAA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AAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ export { decodeEvmType2SignBidirectionalEvent } from "./signet-evtype2tx-record-
|
|
|
11
11
|
export { abiWordToBool, abiWordToUint128, assembleCalldata, boolAbiWord, type EvmAccessListEntry, evmAddressAbiWord, type EvmCalldata, type EvmType2TxParams, numericAbiWord, signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.ts";
|
|
12
12
|
export { calculateRequestId } from "./signet-request-id.ts";
|
|
13
13
|
export * from "./signet-request-response-reader.ts";
|
|
14
|
-
export { type ContractAddress, contractAddressFromHex, type Maybe, MPCDestination, MPCSignatureAlgorithm, parseRequestIdHex, PATH_BYTES, type RequestId, requestIdBytes, type RequestIdHex, requestIdHex, type SignBidirectionalEvent, type SignBidirectionalEventIndex, type SignBidirectionalEventLedgerMap, toSignBidirectionalEventIndex, TxParamType, } from "./signet-requests.ts";
|
|
14
|
+
export { type ContractAddress, contractAddressFromHex, type Maybe, MPCDestination, MPCSignatureAlgorithm, parseRequestIdHex, PATH_BYTES, type RequestId, requestIdBytes, type RequestIdHex, requestIdHex, type RequestIdPreimage, type SignBidirectionalEvent, type SignBidirectionalEventIndex, type SignBidirectionalEventLedgerMap, toSignBidirectionalEventIndex, TxParamType, } from "./signet-requests.ts";
|
|
15
15
|
export { formatSecp256k1PublicKey, normaliseSecp256k1PublicKey, parseSecp256k1PublicKey, respondBidirectionalEventToCircuitInput, SECP256K1_ORDER, type Secp256k1Point, signatureRespondedEventToSignature, verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.ts";
|
|
16
16
|
/**
|
|
17
|
-
* Compiled pure circuits of Signet.compact
|
|
18
|
-
* Off-chain code MUST use these instead of re-porting
|
|
19
|
-
* they are the same compiled logic the contracts prove.
|
|
17
|
+
* Compiled pure circuits of Signet.compact and its `OutputKind` enum (run
|
|
18
|
+
* `yarn compile` first). Off-chain code MUST use these instead of re-porting
|
|
19
|
+
* the algorithms: they are the same compiled logic the contracts prove.
|
|
20
20
|
*/
|
|
21
|
-
export { type PureCircuits, pureCircuits } from "./managed/contract/index.js";
|
|
21
|
+
export { OutputKind, type PureCircuits, pureCircuits } from "./managed/contract/index.js";
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAI1B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,+BAA+B,EAC/B,yBAAyB,EACzB,4CAA4C,EAC5C,sCAAsC,EACtC,yBAAyB,EACzB,iBAAiB,EACjB,mCAAmC,EACnC,KAAK,iCAAiC,GACvC,MAAM,yBAAyB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,KAAK,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACvF,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,oCAAoC,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,cAAc,EACd,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,OAAO,EAC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gBAAgB,EAChB,WAAW,EACX,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,cAAc,EACd,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,KAAK,eAAe,EACpB,sBAAsB,EACtB,KAAK,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,KAAK,SAAS,EACd,cAAc,EACd,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,6BAA6B,EAC7B,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,uCAAuC,EACvC,eAAe,EACf,KAAK,cAAc,EACnB,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,9 +26,9 @@ export { contractAddressFromHex, MPCDestination, MPCSignatureAlgorithm, parseReq
|
|
|
26
26
|
// (parseSecp256k1PublicKeyToNoblePoint) are package-internal.
|
|
27
27
|
export { formatSecp256k1PublicKey, normaliseSecp256k1PublicKey, parseSecp256k1PublicKey, respondBidirectionalEventToCircuitInput, SECP256K1_ORDER, signatureRespondedEventToSignature, verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.js";
|
|
28
28
|
/**
|
|
29
|
-
* Compiled pure circuits of Signet.compact
|
|
30
|
-
* Off-chain code MUST use these instead of re-porting
|
|
31
|
-
* they are the same compiled logic the contracts prove.
|
|
29
|
+
* Compiled pure circuits of Signet.compact and its `OutputKind` enum (run
|
|
30
|
+
* `yarn compile` first). Off-chain code MUST use these instead of re-porting
|
|
31
|
+
* the algorithms: they are the same compiled logic the contracts prove.
|
|
32
32
|
*/
|
|
33
|
-
export { pureCircuits } from "./managed/contract/index.js";
|
|
33
|
+
export { OutputKind, pureCircuits } from "./managed/contract/index.js";
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,sEAAsE;AACtE,wEAAwE;AAExE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,uEAAuE;AACvE,4EAA4E;AAC5E,4EAA4E;AAC5E,cAAc,gBAAgB,CAAC;AAC/B,2EAA2E;AAC3E,yEAAyE;AACzE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,+BAA+B,EAC/B,yBAAyB,EACzB,4CAA4C,EAC5C,sCAAsC,EACtC,yBAAyB,EACzB,iBAAiB,EACjB,mCAAmC,GAEpC,MAAM,yBAAyB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAyB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACvF,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,oCAAoC,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAEX,iBAAiB,EAGjB,cAAc,EACd,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EA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