@sig-net/midnight 0.11.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.
- package/README.md +9 -9
- package/dist/abi-serde.d.ts +89 -0
- package/dist/abi-serde.d.ts.map +1 -0
- package/dist/abi-serde.js +393 -0
- package/dist/abi-serde.js.map +1 -0
- package/dist/constants.d.ts +23 -14
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +28 -20
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +38 -18
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +52 -25
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.js +1 -1
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +180 -122
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +38 -28
- package/dist/managed/contract/index.js +302 -149
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +13 -13
- package/dist/signature-requests-state-reader.js +22 -22
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.js +3 -3
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +33 -36
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +26 -28
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +21 -21
- package/dist/signet-evtype2tx-requests.js +16 -16
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +23 -23
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +28 -28
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +27 -27
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +28 -29
- package/dist/signet-requests.js.map +1 -1
- package/package.json +3 -2
- package/src/Signet.compact +78 -63
- package/src/circuits.compact +45 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ The client-agnostic [Sig Network](https://sig.network) protocol library for the
|
|
|
13
13
|
```compact
|
|
14
14
|
import "@sig-net/midnight/src/Signet";
|
|
15
15
|
```
|
|
16
|
-
- **Compiled pure circuits** (`pureCircuits`): the executable reference implementation of the client-agnostic circuits (the attestation digest, response verification, the deploy-time key pin, the notification packer, the ABI word builders and readers). Off-chain code calls these compiled artefacts
|
|
16
|
+
- **Compiled pure circuits** (`pureCircuits`): the executable reference implementation of the client-agnostic circuits (the attestation digest, response verification, the deploy-time key pin, the notification packer, the ABI word builders and readers). Off-chain code calls these compiled artefacts, so it always agrees with what the contracts prove.
|
|
17
17
|
- **TypeScript twins of the wire structs** and signet request-id computation.
|
|
18
18
|
- **State readers, request feed and resolver**: poll the signet contract for pending requests and their signature / remote-execution responses.
|
|
19
19
|
- **Crypto helpers**: epsilon derivation and ECDSA attestation verification.
|
|
@@ -95,7 +95,7 @@ Set up your contract for integration with the Sig Network MPC's sign bidirection
|
|
|
95
95
|
sealed ledger signetSigner: SignetSigner;
|
|
96
96
|
|
|
97
97
|
// Required: This contract's MPC response key, set in step 3.
|
|
98
|
-
// Used to verify RespondBidirectionalEvents
|
|
98
|
+
// Used to verify RespondBidirectionalEvents attesting the serialised output of foreign chain execution.
|
|
99
99
|
export ledger mpcResponseKey: Secp256k1Point;
|
|
100
100
|
|
|
101
101
|
// Recommended: contract-local source of request nonces, so identical
|
|
@@ -109,7 +109,7 @@ Set up your contract for integration with the Sig Network MPC's sign bidirection
|
|
|
109
109
|
sealed ledger deployer: Bytes<32>;
|
|
110
110
|
|
|
111
111
|
// Recommended: supplies the deployer's identity secret from private state
|
|
112
|
-
// off-chain
|
|
112
|
+
// off-chain. Only its commitment (below) ever reaches the ledger.
|
|
113
113
|
witness witnessDeployerSecretKey(): Bytes<32>;
|
|
114
114
|
|
|
115
115
|
// Recommended: the deployer identity commitment scheme. Exported so deploy
|
|
@@ -172,7 +172,7 @@ const reader = new SignetRequestResponseReader({
|
|
|
172
172
|
const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my-path");
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
1. Store a signature request and notify the MPC via cross contract call. Build (or overwrite) every part of the transaction your contract enforces in-circuit, calldata above all (see [EVM Type 2 transactions and ABI calldata words](#evm-type-2-transactions-and-abi-calldata-words))
|
|
175
|
+
1. Store a signature request and notify the MPC via cross contract call. Build (or overwrite) every part of the transaction your contract enforces in-circuit, calldata above all (see [EVM Type 2 transactions and ABI calldata words](#evm-type-2-transactions-and-abi-calldata-words)), and never pass caller input through unchecked:
|
|
176
176
|
|
|
177
177
|
```compact
|
|
178
178
|
// Construct SignBidirectionalEvent signature request and calculate its RequestId
|
|
@@ -209,18 +209,18 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
209
209
|
await new JsonRpcProvider(foreignChainRpcUrl).broadcastTransaction(signedTx.serialized);
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
4. Poll the Signet singleton for the MPC's
|
|
212
|
+
4. Poll the Signet singleton for the MPC's attestation of the remote execution output (posted once the MPC observes the transaction execute on the foreign chain). The event carries only the attestation digest and the signature over it: the serialised output itself travels off chain (you broadcast the transaction in step 3, so you can read its result). Posts are stored unverified, so treat them as candidates: the authoritative check is your contract's verify circuit in step 5:
|
|
213
213
|
|
|
214
214
|
```ts
|
|
215
215
|
const [respondBidirectionalEvent] = await reader.getRespondBidirectionalEvents(requestId);
|
|
216
216
|
// Empty array: not posted yet, poll again.
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
-
5. Deliver the response to your contract, which verifies
|
|
219
|
+
5. Deliver the response and the serialised output to your contract, which recomputes the attestation digest, verifies the event in-circuit against the response key pinned in Setup step 3, and consumes the request. The width argument is the exact packed size of your respond serialisation schema (a single bool packs to 1 byte):
|
|
220
220
|
|
|
221
221
|
```compact
|
|
222
222
|
assert(
|
|
223
|
-
verifyRespondBidirectionalEvent(requestId, respondBidirectionalEvent, mpcResponseKey),
|
|
223
|
+
verifyRespondBidirectionalEvent<1>(requestId, serializedOutput, respondBidirectionalEvent, mpcResponseKey),
|
|
224
224
|
"Invalid attestation signature"
|
|
225
225
|
);
|
|
226
226
|
signBidirectionalEventMap.remove(requestId);
|
|
@@ -268,10 +268,10 @@ const calldata = EvmCalldata<2> {
|
|
|
268
268
|
};
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
The readers run the same rules in the other direction, rejecting any non-canonical word
|
|
271
|
+
The readers run the same rules in the other direction, rejecting any non-canonical word outright (no silent truncation or coercion). The serialised output a settle circuit verifies (the explicit `serializedOutput` argument `verifyRespondBidirectionalEvent` binds to the event's attestation digest) is the remote call's serialised return data, so the circuit can decode an ERC20 `transfer`'s `bool` return from the first output word:
|
|
272
272
|
|
|
273
273
|
```compact
|
|
274
|
-
const success = abiWordToBool(slice<32>(
|
|
274
|
+
const success = abiWordToBool(slice<32>(serializedOutput, 0));
|
|
275
275
|
assert(success, "Remote transfer failed");
|
|
276
276
|
```
|
|
277
277
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
/** Fixed-width schema types: the byte size follows entirely from the type. */
|
|
3
|
+
export type AbiFixedType = "bool" | "address" | "field" | `uint${number}` | `bytes${number}`;
|
|
4
|
+
export interface AbiFixedField {
|
|
5
|
+
name: string;
|
|
6
|
+
type: AbiFixedType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A dynamic string/bytes field. `maxBytes` is the fixed Compact buffer
|
|
10
|
+
* capacity (Compact types are fixed-size, so capacity is part of the type).
|
|
11
|
+
*/
|
|
12
|
+
export interface AbiDynamicField {
|
|
13
|
+
name: string;
|
|
14
|
+
type: "string" | "bytes";
|
|
15
|
+
maxBytes: number;
|
|
16
|
+
}
|
|
17
|
+
/** A dynamic array field. `maxItems` is the fixed Compact vector capacity. */
|
|
18
|
+
export interface AbiArrayField {
|
|
19
|
+
name: string;
|
|
20
|
+
type: `${AbiFixedType}[]`;
|
|
21
|
+
maxItems: number;
|
|
22
|
+
}
|
|
23
|
+
export type AbiSchemaField = AbiFixedField | AbiDynamicField | AbiArrayField;
|
|
24
|
+
/** An ABI-style schema exactly as carried on chain (JSON array of fields). */
|
|
25
|
+
export type AbiSchema = AbiSchemaField[];
|
|
26
|
+
/** Any form a respond schema arrives in: parsed, JSON text, or NUL-padded raw bytes. */
|
|
27
|
+
export type AbiSchemaInput = AbiSchema | string | Uint8Array;
|
|
28
|
+
/**
|
|
29
|
+
* A decode-side schema field: `type` is ANY type string the ABI library
|
|
30
|
+
* accepts (the canonical ABI grammar, so signed ints, tuples and unbounded
|
|
31
|
+
* arrays are all fine here). The restricted {@link AbiSchemaField} vocabulary
|
|
32
|
+
* is a respond-side concern only, and is assignable to this shape.
|
|
33
|
+
*/
|
|
34
|
+
export interface EvmSchemaField {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
}
|
|
38
|
+
/** Any form a decode schema arrives in: parsed, JSON text, or NUL-padded raw bytes. */
|
|
39
|
+
export type EvmSchemaInput = readonly EvmSchemaField[] | string | Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Decoded output values, keyed by schema field name. Numerics are bigint,
|
|
42
|
+
* bools boolean, address/bytesN/bytes/string are the forms ethers produces
|
|
43
|
+
* (hex or text strings) or Uint8Array, arrays are plain arrays.
|
|
44
|
+
* `serializeRespondOutput` accepts all of these (plus plain numbers and
|
|
45
|
+
* numeric strings, the forms indexer JSON typically yields).
|
|
46
|
+
*/
|
|
47
|
+
export type AbiDecodedValue = bigint | boolean | number | string | Uint8Array | AbiDecodedValue[];
|
|
48
|
+
export type AbiDecodedOutput = {
|
|
49
|
+
[field: string]: AbiDecodedValue;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Decode a raw EVM call result (eth_call return data / debug_trace output)
|
|
53
|
+
* into named values, driven by the request's outputDeserializationSchema.
|
|
54
|
+
*
|
|
55
|
+
* Type validation is FULLY delegated to ethers (the canonical ABI grammar,
|
|
56
|
+
* mirroring the MPC's delegation to alloy): this function only checks the
|
|
57
|
+
* schema's shape, then hands the type strings straight to the ABI coder.
|
|
58
|
+
*
|
|
59
|
+
* Returns a plain object keyed by field name (never an ethers `Result`, so it
|
|
60
|
+
* survives JSON round-trips and structural comparison), with nested ethers
|
|
61
|
+
* Results flattened to plain arrays.
|
|
62
|
+
*
|
|
63
|
+
* @param schema - The outputDeserializationSchema: parsed, JSON text, or the raw NUL-padded on-chain bytes.
|
|
64
|
+
* @param callResult - The ABI-encoded return data (hex string or bytes).
|
|
65
|
+
* @returns The decoded values keyed by schema field name.
|
|
66
|
+
*/
|
|
67
|
+
export declare function deserializeEvmOutput(schema: EvmSchemaInput, callResult: ethers.BytesLike): AbiDecodedOutput;
|
|
68
|
+
/**
|
|
69
|
+
* Encode decoded output values into the respond payload, driven by the
|
|
70
|
+
* request's respondSerializationSchema. The bytes are exactly what a consumer
|
|
71
|
+
* contract reads with `deserialize<T, N>` and what the MPC attests, so
|
|
72
|
+
* clients can recompute and verify them independently.
|
|
73
|
+
*
|
|
74
|
+
* The result is the PACKED value, unpadded and unbounded: its length follows
|
|
75
|
+
* entirely from the schema. Padding to any fixed container width is the
|
|
76
|
+
* caller's concern.
|
|
77
|
+
*
|
|
78
|
+
* Strict: values are range-checked (Uint widths, the Field modulus, the
|
|
79
|
+
* 2^160 address bound), dynamic payloads must fit their capacity (no silent
|
|
80
|
+
* truncation), and signed integer types are rejected outright.
|
|
81
|
+
*
|
|
82
|
+
* @param schema - The respondSerializationSchema: parsed, JSON text, or the raw NUL-padded on-chain bytes.
|
|
83
|
+
* @param output - Decoded values keyed by field name (from {@link deserializeEvmOutput} or any source using the same forms).
|
|
84
|
+
* @returns The packed respond bytes.
|
|
85
|
+
*/
|
|
86
|
+
export declare function serializeRespondOutput(schema: AbiSchemaInput, output: AbiDecodedOutput): Uint8Array;
|
|
87
|
+
export declare function isAbiDynamicField(field: AbiSchemaField): field is AbiDynamicField;
|
|
88
|
+
export declare function isAbiArrayField(field: AbiSchemaField): field is AbiArrayField;
|
|
89
|
+
//# sourceMappingURL=abi-serde.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi-serde.d.ts","sourceRoot":"","sources":["../src/abi-serde.ts"],"names":[],"mappings":"AAiDA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYhC,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,SAAS,GACT,OAAO,GACP,OAAO,MAAM,EAAE,GACf,QAAQ,MAAM,EAAE,CAAC;AAErB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,YAAY,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,eAAe,GAAG,aAAa,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAEzC,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uFAAuF;AACvF,MAAM,MAAM,cAAc,GAAG,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,UAAU,CAAC;AAM7E;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,UAAU,GACV,eAAe,EAAE,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GAAG;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAC;AAMpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,CAAC,SAAS,GAC3B,gBAAgB,CAWlB;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,gBAAgB,GACvB,UAAU,CAYZ;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,eAAe,CAEjF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,aAAa,CAE7E"}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// The two schema-driven conversions every signet participant performs on the
|
|
2
|
+
// respond path, named after the protocol fields that drive them:
|
|
3
|
+
//
|
|
4
|
+
// EVM call result --deserializeEvmOutput--> decoded values
|
|
5
|
+
// (outputDeserializationSchema)
|
|
6
|
+
// decoded values --serializeRespondOutput--> RespondBidirectionalEvent bytes
|
|
7
|
+
// (respondSerializationSchema)
|
|
8
|
+
//
|
|
9
|
+
// Who runs them:
|
|
10
|
+
// - fakenet (and eventually the real MPC): both, back to back, after the
|
|
11
|
+
// destination-chain transaction confirms.
|
|
12
|
+
// - signet clients: both, to independently recompute the exact respond
|
|
13
|
+
// bytes the MPC attested (read the EVM result off chain, re-encode, then
|
|
14
|
+
// hand the result to their Compact contract for claim/validation) or to
|
|
15
|
+
// display a decoded result.
|
|
16
|
+
//
|
|
17
|
+
// The respond output is UNBOUNDED: this module never pads or clamps it. The
|
|
18
|
+
// protocol attests a hash of the bytes, clients fetch the full output off
|
|
19
|
+
// chain and recompute; any fixed event-field width is the caller's concern.
|
|
20
|
+
//
|
|
21
|
+
// Schemas are the ABI-style JSON carried on chain (NUL-padded fixed-width
|
|
22
|
+
// bytes). Both functions accept the schema in any form: already-parsed
|
|
23
|
+
// fields, a JSON string, or the raw on-chain bytes.
|
|
24
|
+
//
|
|
25
|
+
// Validation is split exactly the way the MPC splits it:
|
|
26
|
+
// - decode side: the type grammar is left FULLY to the ABI library
|
|
27
|
+
// (ethers), the same way the MPC delegates to alloy's DynSolType parser.
|
|
28
|
+
// This module only checks the schema's shape (a non-empty array of
|
|
29
|
+
// uniquely, non-emptily named fields).
|
|
30
|
+
// - respond side: the restricted Compact-carrier vocabulary below is the
|
|
31
|
+
// law, strictly enforced: unknown types, missing capacities, duplicate
|
|
32
|
+
// names and malformed JSON all throw with the offending field named.
|
|
33
|
+
//
|
|
34
|
+
// The respond byte layout is Compact's builtin serialize<T, N> /
|
|
35
|
+
// deserialize<T, N> (via @sig-net/midnight-serde, pinned against compiled
|
|
36
|
+
// circuits), so a consumer contract reads the payload with ONE
|
|
37
|
+
// deserialize<T, N> call. Per-type mapping (Compact struct field on the
|
|
38
|
+
// right):
|
|
39
|
+
// bool 1 byte Boolean
|
|
40
|
+
// uint8..uint248 ceil(bits / 8) bytes LE Uint<bits>
|
|
41
|
+
// uint256, field 32 bytes LE, below Fr Field
|
|
42
|
+
// address 32 bytes LE (numeric) Field
|
|
43
|
+
// bytes1..bytes32 N raw bytes Bytes<N>
|
|
44
|
+
// string, bytes 8-byte LE length + payload zero-padded to maxBytes
|
|
45
|
+
// struct { len: Uint<64>; data: Bytes<maxBytes>; }
|
|
46
|
+
// T[] 8-byte LE count + maxItems elements at T's width
|
|
47
|
+
// struct { len: Uint<64>; items: Vector<maxItems, T>; }
|
|
48
|
+
// intN rejected: Compact has no signed integers
|
|
49
|
+
import { ethers } from "ethers";
|
|
50
|
+
import { compactSerialize, } from "@sig-net/midnight-serde";
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// 1. EVM call result -> decoded values (outputDeserializationSchema)
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Decode a raw EVM call result (eth_call return data / debug_trace output)
|
|
56
|
+
* into named values, driven by the request's outputDeserializationSchema.
|
|
57
|
+
*
|
|
58
|
+
* Type validation is FULLY delegated to ethers (the canonical ABI grammar,
|
|
59
|
+
* mirroring the MPC's delegation to alloy): this function only checks the
|
|
60
|
+
* schema's shape, then hands the type strings straight to the ABI coder.
|
|
61
|
+
*
|
|
62
|
+
* Returns a plain object keyed by field name (never an ethers `Result`, so it
|
|
63
|
+
* survives JSON round-trips and structural comparison), with nested ethers
|
|
64
|
+
* Results flattened to plain arrays.
|
|
65
|
+
*
|
|
66
|
+
* @param schema - The outputDeserializationSchema: parsed, JSON text, or the raw NUL-padded on-chain bytes.
|
|
67
|
+
* @param callResult - The ABI-encoded return data (hex string or bytes).
|
|
68
|
+
* @returns The decoded values keyed by schema field name.
|
|
69
|
+
*/
|
|
70
|
+
export function deserializeEvmOutput(schema, callResult) {
|
|
71
|
+
const fields = parseSchemaShape(schema);
|
|
72
|
+
const decoded = ethers.AbiCoder.defaultAbiCoder().decode(fields.map((field) => field.type), callResult);
|
|
73
|
+
const output = {};
|
|
74
|
+
fields.forEach((field, i) => {
|
|
75
|
+
output[field.name] = toPlainValue(decoded[i], field.name);
|
|
76
|
+
});
|
|
77
|
+
return output;
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// 2. decoded values -> respond bytes (respondSerializationSchema)
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* Encode decoded output values into the respond payload, driven by the
|
|
84
|
+
* request's respondSerializationSchema. The bytes are exactly what a consumer
|
|
85
|
+
* contract reads with `deserialize<T, N>` and what the MPC attests, so
|
|
86
|
+
* clients can recompute and verify them independently.
|
|
87
|
+
*
|
|
88
|
+
* The result is the PACKED value, unpadded and unbounded: its length follows
|
|
89
|
+
* entirely from the schema. Padding to any fixed container width is the
|
|
90
|
+
* caller's concern.
|
|
91
|
+
*
|
|
92
|
+
* Strict: values are range-checked (Uint widths, the Field modulus, the
|
|
93
|
+
* 2^160 address bound), dynamic payloads must fit their capacity (no silent
|
|
94
|
+
* truncation), and signed integer types are rejected outright.
|
|
95
|
+
*
|
|
96
|
+
* @param schema - The respondSerializationSchema: parsed, JSON text, or the raw NUL-padded on-chain bytes.
|
|
97
|
+
* @param output - Decoded values keyed by field name (from {@link deserializeEvmOutput} or any source using the same forms).
|
|
98
|
+
* @returns The packed respond bytes.
|
|
99
|
+
*/
|
|
100
|
+
export function serializeRespondOutput(schema, output) {
|
|
101
|
+
const fields = normalizeRespondSchema(schema);
|
|
102
|
+
const descriptor = respondSchemaToCompactType(fields);
|
|
103
|
+
const value = {};
|
|
104
|
+
for (const field of fields) {
|
|
105
|
+
const raw = output[field.name];
|
|
106
|
+
if (raw === undefined) {
|
|
107
|
+
throw new Error(`respond output: missing value for '${field.name}'`);
|
|
108
|
+
}
|
|
109
|
+
value[field.name] = toCompactValue(raw, field);
|
|
110
|
+
}
|
|
111
|
+
return compactSerialize(descriptor, value);
|
|
112
|
+
}
|
|
113
|
+
// ===========================================================================
|
|
114
|
+
// Helpers from here down. The two functions above are the whole public
|
|
115
|
+
// surface; everything below serves them.
|
|
116
|
+
// ===========================================================================
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// Field-kind guards
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
export function isAbiDynamicField(field) {
|
|
121
|
+
return field.type === "string" || field.type === "bytes";
|
|
122
|
+
}
|
|
123
|
+
export function isAbiArrayField(field) {
|
|
124
|
+
return field.type.endsWith("[]");
|
|
125
|
+
}
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Decode-side value flattening
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
/** Flatten ethers `Result` arrays into plain arrays, pass scalars through. */
|
|
130
|
+
function toPlainValue(value, label) {
|
|
131
|
+
if (value instanceof ethers.Result) {
|
|
132
|
+
return value.toArray().map((v, i) => toPlainValue(v, `${label}[${i}]`));
|
|
133
|
+
}
|
|
134
|
+
if (Array.isArray(value)) {
|
|
135
|
+
return value.map((v, i) => toPlainValue(v, `${label}[${i}]`));
|
|
136
|
+
}
|
|
137
|
+
if (typeof value === "bigint" ||
|
|
138
|
+
typeof value === "boolean" ||
|
|
139
|
+
typeof value === "number" ||
|
|
140
|
+
typeof value === "string" ||
|
|
141
|
+
value instanceof Uint8Array) {
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
throw new Error(`${label}: un-decodable ABI value of type ${typeof value}`);
|
|
145
|
+
}
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
// Schema parsing + validation
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
const ADDRESS_BOUND = 1n << 160n;
|
|
150
|
+
const MAX_UINT_BITS = 248;
|
|
151
|
+
/** Length-prefix width of the dynamic string/bytes/array convention (Uint<64>). */
|
|
152
|
+
const DYN_LEN_BYTES = 8;
|
|
153
|
+
/**
|
|
154
|
+
* Parse a schema in any input form and check its SHAPE only: a non-empty
|
|
155
|
+
* array of fields with non-empty, unique names and non-empty type strings.
|
|
156
|
+
* The type grammar is deliberately not checked here: the decode side leaves
|
|
157
|
+
* it fully to the ABI library, the respond side runs
|
|
158
|
+
* {@link normalizeRespondSchema} on top.
|
|
159
|
+
*/
|
|
160
|
+
function parseSchemaShape(schema) {
|
|
161
|
+
const parsed = typeof schema === "string" || schema instanceof Uint8Array
|
|
162
|
+
? JSON.parse(schemaText(schema))
|
|
163
|
+
: schema;
|
|
164
|
+
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
165
|
+
throw new Error("schema must be a non-empty JSON array of fields");
|
|
166
|
+
}
|
|
167
|
+
const seen = new Set();
|
|
168
|
+
return parsed.map((raw, i) => {
|
|
169
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
170
|
+
throw new Error(`schema field ${i} is not an object`);
|
|
171
|
+
}
|
|
172
|
+
const { name, type, maxBytes, maxItems } = raw;
|
|
173
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
174
|
+
throw new Error(`schema field ${i} needs a non-empty name`);
|
|
175
|
+
}
|
|
176
|
+
if (seen.has(name)) {
|
|
177
|
+
throw new Error(`schema: duplicate field name '${name}'`);
|
|
178
|
+
}
|
|
179
|
+
seen.add(name);
|
|
180
|
+
if (typeof type !== "string" || type.length === 0) {
|
|
181
|
+
throw new Error(`schema: '${name}' needs a type`);
|
|
182
|
+
}
|
|
183
|
+
return { name, type, maxBytes, maxItems };
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Enforce the respond-side Compact-carrier vocabulary on a shape-checked
|
|
188
|
+
* schema: every type needs a Compact carrier (no signed ints, uint widths of
|
|
189
|
+
* at most 248 bits or exactly 256, bytesN at most 32) and every dynamic field
|
|
190
|
+
* needs its fixed capacity.
|
|
191
|
+
*/
|
|
192
|
+
function normalizeRespondSchema(schema) {
|
|
193
|
+
return parseSchemaShape(schema).map(({ name, type, maxBytes, maxItems }) => {
|
|
194
|
+
if (type === "string" || type === "bytes") {
|
|
195
|
+
assertCapacity(maxBytes, `'${name}' (${type}) maxBytes`);
|
|
196
|
+
return { name, type, maxBytes };
|
|
197
|
+
}
|
|
198
|
+
if (type.endsWith("[]")) {
|
|
199
|
+
assertFixedType(type.slice(0, -2), name);
|
|
200
|
+
assertCapacity(maxItems, `'${name}' (${type}) maxItems`);
|
|
201
|
+
return { name, type: type, maxItems };
|
|
202
|
+
}
|
|
203
|
+
assertFixedType(type, name);
|
|
204
|
+
return { name, type: type };
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/** Cut a NUL-padded on-chain schema at the first NUL and decode to text. */
|
|
208
|
+
function schemaText(schema) {
|
|
209
|
+
const raw = typeof schema === "string" ? schema : new TextDecoder().decode(schema);
|
|
210
|
+
const nul = raw.indexOf("\0");
|
|
211
|
+
return nul === -1 ? raw : raw.slice(0, nul);
|
|
212
|
+
}
|
|
213
|
+
function assertCapacity(value, label) {
|
|
214
|
+
if (value === undefined) {
|
|
215
|
+
throw new Error(`schema: ${label} is required: Compact types are fixed-size`);
|
|
216
|
+
}
|
|
217
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 1) {
|
|
218
|
+
throw new Error(`schema: ${label} must be a positive integer`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function assertFixedType(type, fieldName) {
|
|
222
|
+
if (type === "bool" || type === "address" || type === "field")
|
|
223
|
+
return;
|
|
224
|
+
if (/^int\d+$/.test(type)) {
|
|
225
|
+
throw new Error(`schema: '${fieldName}' (${type}) is unsupported: Compact has no signed integers`);
|
|
226
|
+
}
|
|
227
|
+
const uintMatch = type.match(/^uint(\d+)$/);
|
|
228
|
+
if (uintMatch) {
|
|
229
|
+
const bits = Number(uintMatch[1]);
|
|
230
|
+
const compactOk = (bits >= 1 && bits <= MAX_UINT_BITS) || bits === 256;
|
|
231
|
+
if (!compactOk) {
|
|
232
|
+
throw new Error(`schema: '${fieldName}' (${type}) has no Compact carrier: ` +
|
|
233
|
+
`Uint widths stop at ${MAX_UINT_BITS} bits (uint256 maps to Field)`);
|
|
234
|
+
}
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const bytesMatch = type.match(/^bytes(\d+)$/);
|
|
238
|
+
if (bytesMatch) {
|
|
239
|
+
const n = Number(bytesMatch[1]);
|
|
240
|
+
if (n < 1 || n > 32) {
|
|
241
|
+
throw new Error(`schema: '${fieldName}' (${type}) is not a valid bytesN type`);
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
throw new Error(`schema: '${fieldName}' has unsupported type '${type}'`);
|
|
246
|
+
}
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// Schema -> CompactType descriptor + value coercion
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
function fixedCompactType(type) {
|
|
251
|
+
if (type === "bool")
|
|
252
|
+
return { kind: "boolean" };
|
|
253
|
+
if (type === "field" || type === "uint256" || type === "address") {
|
|
254
|
+
return { kind: "field" };
|
|
255
|
+
}
|
|
256
|
+
const uintMatch = type.match(/^uint(\d+)$/);
|
|
257
|
+
if (uintMatch)
|
|
258
|
+
return { kind: "uint", bits: Number(uintMatch[1]) };
|
|
259
|
+
const bytesMatch = type.match(/^bytes(\d+)$/);
|
|
260
|
+
if (bytesMatch)
|
|
261
|
+
return { kind: "bytes", length: Number(bytesMatch[1]) };
|
|
262
|
+
throw new Error(`unsupported fixed type '${type}'`);
|
|
263
|
+
}
|
|
264
|
+
function respondSchemaToCompactType(fields) {
|
|
265
|
+
return {
|
|
266
|
+
kind: "struct",
|
|
267
|
+
fields: fields.map((field) => {
|
|
268
|
+
if (isAbiDynamicField(field)) {
|
|
269
|
+
return {
|
|
270
|
+
name: field.name,
|
|
271
|
+
type: {
|
|
272
|
+
kind: "struct",
|
|
273
|
+
fields: [
|
|
274
|
+
{ name: "len", type: { kind: "uint", bits: DYN_LEN_BYTES * 8 } },
|
|
275
|
+
{ name: "data", type: { kind: "bytes", length: field.maxBytes } },
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
if (isAbiArrayField(field)) {
|
|
281
|
+
return {
|
|
282
|
+
name: field.name,
|
|
283
|
+
type: {
|
|
284
|
+
kind: "struct",
|
|
285
|
+
fields: [
|
|
286
|
+
{ name: "len", type: { kind: "uint", bits: DYN_LEN_BYTES * 8 } },
|
|
287
|
+
{
|
|
288
|
+
name: "items",
|
|
289
|
+
type: {
|
|
290
|
+
kind: "vector",
|
|
291
|
+
length: field.maxItems,
|
|
292
|
+
element: fixedCompactType(field.type.slice(0, -2)),
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return { name: field.name, type: fixedCompactType(field.type) };
|
|
300
|
+
}),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function toCompactValue(value, field) {
|
|
304
|
+
const { name } = field;
|
|
305
|
+
if (isAbiDynamicField(field)) {
|
|
306
|
+
const payload = field.type === "string"
|
|
307
|
+
? new TextEncoder().encode(asString(value, name))
|
|
308
|
+
: asBytes(value, name);
|
|
309
|
+
if (payload.length > field.maxBytes) {
|
|
310
|
+
throw new Error(`'${name}': payload is ${payload.length} bytes, maxBytes is ${field.maxBytes}`);
|
|
311
|
+
}
|
|
312
|
+
const data = new Uint8Array(field.maxBytes);
|
|
313
|
+
data.set(payload);
|
|
314
|
+
return { len: BigInt(payload.length), data };
|
|
315
|
+
}
|
|
316
|
+
if (isAbiArrayField(field)) {
|
|
317
|
+
if (!Array.isArray(value)) {
|
|
318
|
+
throw new Error(`'${name}' (${field.type}) expects an array`);
|
|
319
|
+
}
|
|
320
|
+
if (value.length > field.maxItems) {
|
|
321
|
+
throw new Error(`'${name}': ${value.length} elements, maxItems is ${field.maxItems}`);
|
|
322
|
+
}
|
|
323
|
+
const elementType = field.type.slice(0, -2);
|
|
324
|
+
const items = value.map((element, i) => fixedCompactValue(element, elementType, `${name}[${i}]`));
|
|
325
|
+
// Unused capacity encodes as zero values of the element type.
|
|
326
|
+
while (items.length < field.maxItems)
|
|
327
|
+
items.push(zeroOf(elementType));
|
|
328
|
+
return { len: BigInt(value.length), items };
|
|
329
|
+
}
|
|
330
|
+
return fixedCompactValue(value, field.type, name);
|
|
331
|
+
}
|
|
332
|
+
function fixedCompactValue(value, type, label) {
|
|
333
|
+
if (type === "bool") {
|
|
334
|
+
if (typeof value !== "boolean") {
|
|
335
|
+
throw new Error(`'${label}' (bool) expects a boolean`);
|
|
336
|
+
}
|
|
337
|
+
return value;
|
|
338
|
+
}
|
|
339
|
+
if (/^bytes\d+$/.test(type)) {
|
|
340
|
+
const raw = asBytes(value, label);
|
|
341
|
+
const expected = Number(type.slice(5));
|
|
342
|
+
if (raw.length !== expected) {
|
|
343
|
+
throw new Error(`'${label}' (${type}) expects exactly ${expected} bytes, got ${raw.length}`);
|
|
344
|
+
}
|
|
345
|
+
return raw;
|
|
346
|
+
}
|
|
347
|
+
// Numeric carriers: uintN, uint256/field and address.
|
|
348
|
+
const n = asBigint(value, label);
|
|
349
|
+
if (type === "address" && n >= ADDRESS_BOUND) {
|
|
350
|
+
throw new Error(`'${label}': value ${n} exceeds an address`);
|
|
351
|
+
}
|
|
352
|
+
// Uint width and Field modulus bounds are enforced by @sig-net/midnight-serde.
|
|
353
|
+
return n;
|
|
354
|
+
}
|
|
355
|
+
function zeroOf(type) {
|
|
356
|
+
if (type === "bool")
|
|
357
|
+
return false;
|
|
358
|
+
if (/^bytes\d+$/.test(type))
|
|
359
|
+
return new Uint8Array(Number(type.slice(5)));
|
|
360
|
+
return 0n;
|
|
361
|
+
}
|
|
362
|
+
// ---------------------------------------------------------------------------
|
|
363
|
+
// Value-form coercions
|
|
364
|
+
// ---------------------------------------------------------------------------
|
|
365
|
+
function asBigint(value, label) {
|
|
366
|
+
if (typeof value === "bigint")
|
|
367
|
+
return value;
|
|
368
|
+
if (typeof value === "number" && Number.isSafeInteger(value))
|
|
369
|
+
return BigInt(value);
|
|
370
|
+
if (typeof value === "string") {
|
|
371
|
+
try {
|
|
372
|
+
return BigInt(value);
|
|
373
|
+
}
|
|
374
|
+
catch {
|
|
375
|
+
throw new Error(`'${label}': cannot parse '${value}' as an integer`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
throw new Error(`'${label}': expected an integer-like value`);
|
|
379
|
+
}
|
|
380
|
+
function asBytes(value, label) {
|
|
381
|
+
if (value instanceof Uint8Array)
|
|
382
|
+
return value;
|
|
383
|
+
if (typeof value === "string")
|
|
384
|
+
return ethers.getBytes(value);
|
|
385
|
+
throw new Error(`'${label}': expected bytes (Uint8Array or hex string)`);
|
|
386
|
+
}
|
|
387
|
+
function asString(value, label) {
|
|
388
|
+
if (typeof value !== "string") {
|
|
389
|
+
throw new Error(`'${label}': expected a string`);
|
|
390
|
+
}
|
|
391
|
+
return value;
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=abi-serde.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi-serde.js","sourceRoot":"","sources":["../src/abi-serde.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,iEAAiE;AACjE,EAAE;AACF,6DAA6D;AAC7D,uDAAuD;AACvD,+EAA+E;AAC/E,sDAAsD;AACtD,EAAE;AACF,iBAAiB;AACjB,2EAA2E;AAC3E,8CAA8C;AAC9C,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,gCAAgC;AAChC,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,oDAAoD;AACpD,EAAE;AACF,yDAAyD;AACzD,qEAAqE;AACrE,6EAA6E;AAC7E,uEAAuE;AACvE,2CAA2C;AAC3C,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,iEAAiE;AACjE,0EAA0E;AAC1E,+DAA+D;AAC/D,wEAAwE;AACxE,UAAU;AACV,sDAAsD;AACtD,yDAAyD;AACzD,oDAAoD;AACpD,oDAAoD;AACpD,uDAAuD;AACvD,uEAAuE;AACvE,+FAA+F;AAC/F,qEAAqE;AACrE,oGAAoG;AACpG,6DAA6D;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACL,gBAAgB,GAGjB,M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,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAoB,KAAK,iBAAiB,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,mCAAmC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,OAAO,CAAC,KAAsB,EAAE,KAAa;IACpD,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,8CAA8C,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAsB,EAAE,KAAa;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,42 +2,51 @@
|
|
|
2
2
|
export declare const CAIP2_ID_BYTES = 32;
|
|
3
3
|
/** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
|
|
4
4
|
export declare const MPC_PARAMS_BYTES = 64;
|
|
5
|
-
/** Width of `EvmCalldata.selector` (`Bytes<4>`)
|
|
5
|
+
/** Width of `EvmCalldata.selector` (`Bytes<4>`): the literal first 4 calldata bytes. */
|
|
6
6
|
export declare const SELECTOR_BYTES = 4;
|
|
7
|
-
/** Width of `RespondBidirectionalEvent.serializedOutput` (`Bytes<128>`). */
|
|
8
|
-
export declare const SERIALIZED_OUTPUT_BYTES = 128;
|
|
9
7
|
/**
|
|
10
|
-
* The MPC's error sentinel:
|
|
8
|
+
* The MPC's error sentinel: a serialised output beginning with these four
|
|
11
9
|
* bytes marks a failed/absent remote execution (mirrors the sig-net MPC's
|
|
12
10
|
* MAGIC_ERROR_PREFIX).
|
|
13
11
|
*/
|
|
14
12
|
export declare const MPC_ERROR_SENTINEL: Uint8Array<ArrayBuffer>;
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
17
|
-
* execution
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* The complete serialised output the MPC attests for a FAILED remote
|
|
15
|
+
* execution (reverted or replaced transaction): the error sentinel followed
|
|
16
|
+
* by one `0x01` byte. Schema-independent by design, mirroring the canonical
|
|
17
|
+
* MPC's Borsh-format failure payload (sig-net/mpc,
|
|
18
|
+
* node/src/respond_bidirectional.rs), so every respond schema shares one
|
|
19
|
+
* fixed 5-byte failure width. Clients recompute their failure candidate from
|
|
20
|
+
* this constant alone: no receipt or schema needed.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MPC_FAILURE_OUTPUT: Uint8Array<ArrayBuffer>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether an attested serialised output reports a successful remote
|
|
25
|
+
* execution: the first byte is 1, the packed little-endian encoding of a
|
|
26
|
+
* leading boolean success flag. The output is the exact unpadded respond
|
|
27
|
+
* payload (see `serializeRespondOutput`), so its length follows from the
|
|
28
|
+
* request's respond schema.
|
|
20
29
|
*
|
|
21
|
-
* @param serializedOutput - The
|
|
30
|
+
* @param serializedOutput - The attested serialised output.
|
|
22
31
|
* @returns `true` when the remote call succeeded.
|
|
23
32
|
*/
|
|
24
33
|
export declare function executionSucceeded(serializedOutput: Uint8Array): boolean;
|
|
25
34
|
/**
|
|
26
|
-
* Whether an
|
|
27
|
-
* (see {@link MPC_ERROR_SENTINEL})
|
|
35
|
+
* Whether an attested serialised output is the MPC's error sentinel
|
|
36
|
+
* (see {@link MPC_ERROR_SENTINEL}).
|
|
28
37
|
*
|
|
29
|
-
* @param serializedOutput - The
|
|
38
|
+
* @param serializedOutput - The attested serialised output.
|
|
30
39
|
* @returns `true` when the MPC reported an execution error.
|
|
31
40
|
*/
|
|
32
41
|
export declare function isExecutionError(serializedOutput: Uint8Array): boolean;
|
|
33
42
|
/**
|
|
34
43
|
* Default MPC key version (`keyVersion` field value). Version 0 is the
|
|
35
|
-
* unsupported legacy format
|
|
44
|
+
* unsupported legacy format: the canonical MPC (and
|
|
36
45
|
* `constructSignBidirectionalEvent`) requires `keyVersion >= 1`.
|
|
37
46
|
*/
|
|
38
47
|
export declare const SIGNET_DEFAULT_KEY_VERSION = 1n;
|
|
39
48
|
/**
|
|
40
|
-
* Encode text as zero-padded ASCII bytes
|
|
49
|
+
* Encode text as zero-padded ASCII bytes, the Compact `pad(N, "text")`
|
|
41
50
|
* convention every string-ish field of the request structs uses (consumers
|
|
42
51
|
* NUL-trim on decode).
|
|
43
52
|
*
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AASA,+DAA+D;AAC/D,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wFAAwF;AACxF,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,yBAA2C,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,yBAAiD,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAEtE;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAQpE"}
|