@sig-net/midnight 0.0.9 → 0.11.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 +254 -112
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/ecdsa-attestation.d.ts +53 -1
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +96 -4
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.d.ts +8 -8
- package/dist/epsilon-derivation.d.ts.map +1 -1
- package/dist/epsilon-derivation.js +15 -17
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +3 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +76 -24
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +18 -10
- package/dist/managed/contract/index.js +218 -103
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +2 -2
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +32 -15
- 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 +5 -5
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +49 -30
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +55 -35
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +65 -43
- package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
- package/dist/signet-evtype2tx-requests.js +77 -78
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +3 -3
- package/dist/signet-request-response-reader.js +9 -9
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +4 -4
- package/dist/signet-requests.js +3 -3
- package/dist/signet-requests.js.map +1 -1
- package/package.json +1 -1
- package/src/Signet.compact +122 -72
- package/src/circuits.compact +10 -27
|
@@ -4,12 +4,12 @@ import type { SignatureRespondedEvent } from "./signet-contract-state-reader.ts"
|
|
|
4
4
|
import { type Maybe, type RequestId, type SignBidirectionalEvent } from "./signet-requests.ts";
|
|
5
5
|
/**
|
|
6
6
|
* ABI calldata as a 4-byte selector + 32-byte word slots (Compact:
|
|
7
|
-
* `
|
|
7
|
+
* `EvmCalldata<#maxWords>`). Every stored byte is ABI-READY: the calldata the
|
|
8
8
|
* MPC signs is `selector || words[0..noWords]` VERBATIM (see
|
|
9
9
|
* {@link assembleCalldata}), so words are big-endian broadcast-form ABI words,
|
|
10
10
|
* built in-circuit by Signet.compact's `evmAddressAbiWord` / `numericAbiWord`.
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface EvmCalldata {
|
|
13
13
|
/** The literal first 4 calldata bytes (as broadcast). */
|
|
14
14
|
selector: Uint8Array;
|
|
15
15
|
/** How many leading {@link words} are real (Compact `noWords: Uint<16>`). */
|
|
@@ -22,9 +22,9 @@ export interface EVMCalldata {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* One EIP-2930 access-list entry (Compact:
|
|
25
|
-
* `
|
|
25
|
+
* `EvmAccessListEntry<#maxStorageKeys>`).
|
|
26
26
|
*/
|
|
27
|
-
export interface
|
|
27
|
+
export interface EvmAccessListEntry {
|
|
28
28
|
/** The pre-declared contract address, 20 display-order bytes. */
|
|
29
29
|
address: Uint8Array;
|
|
30
30
|
/** How many leading {@link storageKeys} are real. */
|
|
@@ -34,53 +34,53 @@ export interface EVMAccessListEntry {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* The EVM transaction to be signed, decomposed into typed fields (Compact:
|
|
37
|
-
* `
|
|
37
|
+
* `EvmType2TxParams<#maxCalldataWords, #maxAccessListEntries,
|
|
38
38
|
* #maxStorageKeysPerEntry>`; EIP-1559 — https://eips.ethereum.org/EIPS/eip-1559).
|
|
39
39
|
* Compact `Bytes<N>` fields arrive as N-byte `Uint8Array`s, `Uint<N>` as
|
|
40
40
|
* `bigint`. Vector capacities are each contract's compile-time throttle;
|
|
41
41
|
* the runtime counts say how many leading slots are real.
|
|
42
42
|
*/
|
|
43
|
-
export interface
|
|
44
|
-
/** Call target (e.g. the ERC20 contract), 20 bytes. */
|
|
45
|
-
to: Uint8Array;
|
|
43
|
+
export interface EvmType2TxParams {
|
|
46
44
|
/** EVM chain id (also expressed in the record's `caip2Id`). */
|
|
47
45
|
chainId: bigint;
|
|
48
46
|
/** Account nonce of the MPC-derived sender address. */
|
|
49
47
|
nonce: bigint;
|
|
50
|
-
/** Gas ceiling for the call. */
|
|
51
|
-
gasLimit: bigint;
|
|
52
|
-
/** Max total fee per gas, wei. */
|
|
53
|
-
maxFeePerGas: bigint;
|
|
54
48
|
/** Max priority fee per gas, wei. */
|
|
55
49
|
maxPriorityFeePerGas: bigint;
|
|
50
|
+
/** Max total fee per gas, wei. */
|
|
51
|
+
maxFeePerGas: bigint;
|
|
52
|
+
/** Gas ceiling for the call. */
|
|
53
|
+
gasLimit: bigint;
|
|
54
|
+
/** Call target (e.g. the ERC20 contract), 20 bytes. */
|
|
55
|
+
to: Uint8Array;
|
|
56
56
|
/** ETH sent with the call, wei. */
|
|
57
57
|
value: bigint;
|
|
58
|
+
/** Call data; `is_some: false` means a plain ETH transfer (`0x` data). */
|
|
59
|
+
calldata: Maybe<EvmCalldata>;
|
|
58
60
|
/** How many leading {@link accessList} entries are real. */
|
|
59
61
|
accessListEntryCount: bigint;
|
|
60
62
|
/** EIP-2930 access list slots (capacity = contract's throttle). */
|
|
61
|
-
accessList:
|
|
62
|
-
/** Call data; `is_some: false` means a plain ETH transfer (`0x` data). */
|
|
63
|
-
calldata: Maybe<EVMCalldata>;
|
|
63
|
+
accessList: EvmAccessListEntry[];
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Descriptor of {@link
|
|
67
|
-
* of instantiating Compact's `
|
|
66
|
+
* Descriptor of {@link EvmCalldata} at one word capacity — the TS analogue
|
|
67
|
+
* of instantiating Compact's `EvmCalldata<#maxWords>`.
|
|
68
68
|
*
|
|
69
69
|
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
70
70
|
* @returns The calldata descriptor.
|
|
71
71
|
*/
|
|
72
|
-
export declare function evmCalldataDescriptor(maxWords: number): CompactType<
|
|
72
|
+
export declare function evmCalldataDescriptor(maxWords: number): CompactType<EvmCalldata>;
|
|
73
73
|
/**
|
|
74
|
-
* Descriptor of {@link
|
|
75
|
-
* (Compact: `
|
|
74
|
+
* Descriptor of {@link EvmAccessListEntry} at one storage-key capacity
|
|
75
|
+
* (Compact: `EvmAccessListEntry<#maxStorageKeys>`).
|
|
76
76
|
*
|
|
77
77
|
* @param maxStorageKeys - Storage-key capacity per entry.
|
|
78
78
|
* @returns The entry descriptor.
|
|
79
79
|
*/
|
|
80
|
-
export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): CompactType<
|
|
80
|
+
export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): CompactType<EvmAccessListEntry>;
|
|
81
81
|
/**
|
|
82
|
-
* Descriptor of {@link
|
|
83
|
-
* the TS analogue of Compact's `
|
|
82
|
+
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation —
|
|
83
|
+
* the TS analogue of Compact's `EvmType2TxParams<#maxCalldataWords,
|
|
84
84
|
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
85
85
|
*
|
|
86
86
|
* @param maxCalldataWords - Calldata word capacity.
|
|
@@ -88,7 +88,7 @@ export declare function evmAccessListEntryDescriptor(maxStorageKeys: number): Co
|
|
|
88
88
|
* @param maxStorageKeysPerEntry - Storage-key capacity per entry.
|
|
89
89
|
* @returns The tx-params descriptor.
|
|
90
90
|
*/
|
|
91
|
-
export declare function evmType2TxParamsDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number): CompactType<
|
|
91
|
+
export declare function evmType2TxParamsDescriptor(maxCalldataWords: number, maxAccessListEntries: number, maxStorageKeysPerEntry: number): CompactType<EvmType2TxParams>;
|
|
92
92
|
/**
|
|
93
93
|
* Descriptor of {@link SignBidirectionalEvent} at one EVM Type-2 capacity
|
|
94
94
|
* instantiation — the generic record descriptor
|
|
@@ -126,7 +126,8 @@ export declare function calculateRequestId(request: SignBidirectionalEvent): Req
|
|
|
126
126
|
* builders, tests).
|
|
127
127
|
*
|
|
128
128
|
* @param value - The word's numeric value (e.g. an amount).
|
|
129
|
-
* @returns The ABI-ready 32-byte word to store in an {@link
|
|
129
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
130
|
+
* @throws Error if the value is negative or does not fit 32 bytes.
|
|
130
131
|
*/
|
|
131
132
|
export declare function numericAbiWord(value: bigint): Uint8Array;
|
|
132
133
|
/**
|
|
@@ -135,10 +136,19 @@ export declare function numericAbiWord(value: bigint): Uint8Array;
|
|
|
135
136
|
* `evmAddressAbiWord` circuit (lockstep-tested against the compiled circuit).
|
|
136
137
|
*
|
|
137
138
|
* @param address - The 20-byte address in display order.
|
|
138
|
-
* @returns The ABI-ready 32-byte word to store in an {@link
|
|
139
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
139
140
|
* @throws Error if the address is not exactly 20 bytes.
|
|
140
141
|
*/
|
|
141
142
|
export declare function evmAddressAbiWord(address: Uint8Array): Uint8Array;
|
|
143
|
+
/**
|
|
144
|
+
* The ABI word for a Boolean: 31 zero bytes, then 0x01 (true) or 0x00
|
|
145
|
+
* (false). TS mirror of Signet.compact's `boolAbiWord` circuit
|
|
146
|
+
* (lockstep-tested against the compiled circuit).
|
|
147
|
+
*
|
|
148
|
+
* @param value - The word's Boolean value.
|
|
149
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
150
|
+
*/
|
|
151
|
+
export declare function boolAbiWord(value: boolean): Uint8Array;
|
|
142
152
|
/**
|
|
143
153
|
* Read a numeric ABI word back into a bigint: the big-endian reading of bytes
|
|
144
154
|
* 16..31. TS mirror of Signet.compact's `abiWordToUint128` circuit, including
|
|
@@ -150,18 +160,28 @@ export declare function evmAddressAbiWord(address: Uint8Array): Uint8Array;
|
|
|
150
160
|
* @throws Error if the word is not 32 bytes or its leading half is nonzero.
|
|
151
161
|
*/
|
|
152
162
|
export declare function abiWordToUint128(word: Uint8Array): bigint;
|
|
163
|
+
/**
|
|
164
|
+
* Read a Boolean ABI word back into a boolean. TS mirror of Signet.compact's
|
|
165
|
+
* `abiWordToBool` circuit, including its canonicality check: the first 31
|
|
166
|
+
* bytes must be zero and the last byte 0 or 1.
|
|
167
|
+
*
|
|
168
|
+
* @param word - The ABI-ready 32-byte word.
|
|
169
|
+
* @returns The word's Boolean value.
|
|
170
|
+
* @throws Error if the word is not 32 bytes or is not a canonical Boolean.
|
|
171
|
+
*/
|
|
172
|
+
export declare function abiWordToBool(word: Uint8Array): boolean;
|
|
153
173
|
/**
|
|
154
174
|
* Assemble the raw calldata a request's words describe:
|
|
155
175
|
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
156
|
-
* ABI-ready (see {@link
|
|
176
|
+
* ABI-ready (see {@link EvmCalldata}), so no byte of the stored record is
|
|
157
177
|
* reordered or reinterpreted on the way into the transaction; slots past
|
|
158
178
|
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
159
|
-
* of the signer-side assembly documented on `
|
|
179
|
+
* of the signer-side assembly documented on `EvmCalldata` in Signet.compact.
|
|
160
180
|
*
|
|
161
181
|
* @param calldata - The request's calldata field.
|
|
162
182
|
* @returns Hex calldata for the transaction (`"0x"` when absent).
|
|
163
183
|
*/
|
|
164
|
-
export declare function assembleCalldata(calldata: Maybe<
|
|
184
|
+
export declare function assembleCalldata(calldata: Maybe<EvmCalldata>): string;
|
|
165
185
|
/**
|
|
166
186
|
* Rebuild the unsigned EIP-1559 transaction a request record describes,
|
|
167
187
|
* byte-identical to the one the MPC assembles and signs: calldata from the
|
|
@@ -177,25 +197,27 @@ export declare function assembleCalldata(calldata: Maybe<EVMCalldata>): string;
|
|
|
177
197
|
* MPC signs).
|
|
178
198
|
* @throws Error if a calldata word carries an unknown kind.
|
|
179
199
|
*/
|
|
180
|
-
export declare function
|
|
200
|
+
export declare function signBidirectionalEventToUnsignedEvmTransaction(request: SignBidirectionalEvent): Transaction;
|
|
181
201
|
/**
|
|
182
202
|
* Decode a response signature record (as posted to the signet contract's
|
|
183
|
-
* signature response log
|
|
184
|
-
*
|
|
185
|
-
*
|
|
203
|
+
* signature response log) into an ethers {@link Signature}. Goes through
|
|
204
|
+
* {@link mpcSignatureToEcdsaSignature} rather than reading the record's
|
|
205
|
+
* fields directly, so this and in-circuit claims decode a post identically:
|
|
206
|
+
* ethers' `r` is the ECDSA scalar (`bigR.x` reduced mod the curve order),
|
|
207
|
+
* not the raw coordinate, and a malformed record is rejected the same way
|
|
208
|
+
* in both paths.
|
|
186
209
|
*
|
|
187
210
|
* @param response - The posted signature record.
|
|
188
211
|
* @returns The ethers signature.
|
|
189
|
-
* @throws Error if the
|
|
212
|
+
* @throws Error if the record is malformed (see {@link mpcSignatureToEcdsaSignature}).
|
|
190
213
|
*/
|
|
191
214
|
export declare function signatureRespondedEventToSignature(response: SignatureRespondedEvent): Signature;
|
|
192
215
|
/**
|
|
193
216
|
* Encode an ECDSA signature as the response record posted to the signet
|
|
194
|
-
* contract — the inverse of {@link signatureRespondedEventToSignature},
|
|
195
|
-
*
|
|
196
|
-
* carries
|
|
197
|
-
*
|
|
198
|
-
* point on the curve (y² = x³ + 7 over the secp256k1 base field).
|
|
217
|
+
* contract — the inverse of {@link signatureRespondedEventToSignature}, for
|
|
218
|
+
* MPC-side posters (the fakenet signer, tests). An `r || s || v` signature
|
|
219
|
+
* carries only R.x and the parity of R.y, so the full R point the record
|
|
220
|
+
* stores is recovered on-curve (see {@link ecdsaSignatureToMpcSignature}).
|
|
199
221
|
*
|
|
200
222
|
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
201
223
|
* {@link Signature}) so signatures from ANY ethers instance qualify — posters
|
|
@@ -204,13 +226,13 @@ export declare function signatureRespondedEventToSignature(response: SignatureRe
|
|
|
204
226
|
*
|
|
205
227
|
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
206
228
|
* @returns The response record, ready to post.
|
|
207
|
-
* @throws Error if `r` is not the x coordinate of a
|
|
229
|
+
* @throws Error if `r` is not the x coordinate of a secp256k1 point.
|
|
208
230
|
*/
|
|
209
231
|
export declare function signatureToSignatureRespondedEvent(signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
|
|
210
232
|
/**
|
|
211
233
|
* Assemble the broadcast-ready signed EIP-1559 transaction for a request from
|
|
212
234
|
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
213
|
-
* signed (see {@link
|
|
235
|
+
* signed (see {@link signBidirectionalEventToUnsignedEvmTransaction}) and
|
|
214
236
|
* attach the signature. Does NOT check that the signature recovers to the
|
|
215
237
|
* requester's derived address — the response log is unauthenticated, so
|
|
216
238
|
* verify first with `verifySignatureRespondedEvent`.
|
|
@@ -221,8 +243,8 @@ export declare function signatureToSignatureRespondedEvent(signature: Pick<Signa
|
|
|
221
243
|
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
222
244
|
* sender.
|
|
223
245
|
* @throws Error if the request record is malformed (see
|
|
224
|
-
* {@link
|
|
246
|
+
* {@link signBidirectionalEventToUnsignedEvmTransaction}) or the response
|
|
225
247
|
* is not a decodable signature.
|
|
226
248
|
*/
|
|
227
|
-
export declare function
|
|
249
|
+
export declare function signBidirectionalEventToSignedEvmTransaction(request: SignBidirectionalEvent, response: SignatureRespondedEvent): Transaction;
|
|
228
250
|
//# sourceMappingURL=signet-evtype2tx-requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-evtype2tx-requests.d.ts","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAYA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"signet-evtype2tx-requests.d.ts","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAYA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAc,SAAS,EAAW,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAMjF,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,EAAE,UAAU,CAAC;IACrB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,OAAO,EAAE,UAAU,CAAC;IACpB,qDAAqD;IACrD,eAAe,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,EAAE,EAAE,UAAU,CAAC;IACf,mCAAmC;IACnC,KAAK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,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAQvD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAUrE;AAsBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8CAA8C,CAC5D,OAAO,EAAE,sBAAsB,GAC9B,WAAW,CAcb;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,SAAS,CAOX;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC,GAChD,uBAAuB,CAQzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,uBAAuB,GAChC,WAAW,CAIb"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The EVM Type-2 (EIP-1559) instantiation of the signet request protocol:
|
|
2
|
-
// TypeScript twins of the `
|
|
2
|
+
// TypeScript twins of the `EvmType2TxParams` decomposition structs in
|
|
3
3
|
// `Signet.compact`, their runtime descriptors, the ABI-word helpers, and the
|
|
4
4
|
// request -> transaction assembly the signer runs. Everything chain-agnostic
|
|
5
5
|
// (the request record itself, ids, the descriptor toolkit) lives in
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
// The no-translation invariant lives here: words are stored ABI-ready and
|
|
10
10
|
// {@link assembleCalldata} concatenates `selector || words` VERBATIM, so the
|
|
11
11
|
// transaction the MPC signs carries the contract-stored bytes untouched.
|
|
12
|
-
import { CompactTypeBytes, CompactTypeUnsignedInteger, CompactTypeVector,
|
|
13
|
-
import { getAddress,
|
|
12
|
+
import { CompactTypeBytes, CompactTypeUnsignedInteger, CompactTypeVector, keccak256, } from "@midnight-ntwrk/compact-runtime";
|
|
13
|
+
import { getAddress, Signature, toBeHex, Transaction } from "ethers";
|
|
14
|
+
import { bigintToBytes32BE, ecdsaSignatureToMpcSignature, mpcSignatureToEcdsaSignature, } from "./ecdsa-attestation.js";
|
|
14
15
|
import { bytesToHex, compactMaybeDescriptor, compactStructDescriptor, signBidirectionalEventDescriptorWith, } from "./signet-requests.js";
|
|
15
16
|
// ---- Runtime descriptors (see the deviation note in signet-requests.ts) ----
|
|
16
17
|
// Base-type literals match what the compiler emits for the EVM structs'
|
|
@@ -23,8 +24,8 @@ const UINT_16 = new CompactTypeUnsignedInteger(2n ** 16n - 1n, 2);
|
|
|
23
24
|
const UINT_64 = new CompactTypeUnsignedInteger(2n ** 64n - 1n, 8);
|
|
24
25
|
const UINT_128 = new CompactTypeUnsignedInteger(2n ** 128n - 1n, 16);
|
|
25
26
|
/**
|
|
26
|
-
* Descriptor of {@link
|
|
27
|
-
* of instantiating Compact's `
|
|
27
|
+
* Descriptor of {@link EvmCalldata} at one word capacity — the TS analogue
|
|
28
|
+
* of instantiating Compact's `EvmCalldata<#maxWords>`.
|
|
28
29
|
*
|
|
29
30
|
* @param maxWords - The contract's calldata word capacity (the vault uses 2).
|
|
30
31
|
* @returns The calldata descriptor.
|
|
@@ -37,8 +38,8 @@ export function evmCalldataDescriptor(maxWords) {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
|
-
* Descriptor of {@link
|
|
41
|
-
* (Compact: `
|
|
41
|
+
* Descriptor of {@link EvmAccessListEntry} at one storage-key capacity
|
|
42
|
+
* (Compact: `EvmAccessListEntry<#maxStorageKeys>`).
|
|
42
43
|
*
|
|
43
44
|
* @param maxStorageKeys - Storage-key capacity per entry.
|
|
44
45
|
* @returns The entry descriptor.
|
|
@@ -51,8 +52,8 @@ export function evmAccessListEntryDescriptor(maxStorageKeys) {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
|
-
* Descriptor of {@link
|
|
55
|
-
* the TS analogue of Compact's `
|
|
55
|
+
* Descriptor of {@link EvmType2TxParams} at one capacity instantiation —
|
|
56
|
+
* the TS analogue of Compact's `EvmType2TxParams<#maxCalldataWords,
|
|
56
57
|
* #maxAccessListEntries, #maxStorageKeysPerEntry>`.
|
|
57
58
|
*
|
|
58
59
|
* @param maxCalldataWords - Calldata word capacity.
|
|
@@ -61,17 +62,18 @@ export function evmAccessListEntryDescriptor(maxStorageKeys) {
|
|
|
61
62
|
* @returns The tx-params descriptor.
|
|
62
63
|
*/
|
|
63
64
|
export function evmType2TxParamsDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry) {
|
|
65
|
+
// Key order IS the encoding order: keep it identical to the Compact struct's.
|
|
64
66
|
return compactStructDescriptor({
|
|
65
|
-
to: BYTES_20,
|
|
66
67
|
chainId: UINT_64,
|
|
67
68
|
nonce: UINT_64,
|
|
68
|
-
gasLimit: UINT_64,
|
|
69
|
-
maxFeePerGas: UINT_128,
|
|
70
69
|
maxPriorityFeePerGas: UINT_128,
|
|
70
|
+
maxFeePerGas: UINT_128,
|
|
71
|
+
gasLimit: UINT_64,
|
|
72
|
+
to: BYTES_20,
|
|
71
73
|
value: UINT_128,
|
|
74
|
+
calldata: compactMaybeDescriptor(evmCalldataDescriptor(maxCalldataWords)),
|
|
72
75
|
accessListEntryCount: UINT_8,
|
|
73
76
|
accessList: new CompactTypeVector(maxAccessListEntries, evmAccessListEntryDescriptor(maxStorageKeysPerEntry)),
|
|
74
|
-
calldata: compactMaybeDescriptor(evmCalldataDescriptor(maxCalldataWords)),
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
@@ -109,7 +111,7 @@ export function calculateRequestId(request) {
|
|
|
109
111
|
const maxCalldataWords = txParams.calldata.value.words.length;
|
|
110
112
|
const maxAccessListEntries = txParams.accessList.length;
|
|
111
113
|
const maxStorageKeysPerEntry = maxAccessListEntries === 0 ? 0 : txParams.accessList[0].storageKeys.length;
|
|
112
|
-
return
|
|
114
|
+
return keccak256(signBidirectionalEventDescriptor(maxCalldataWords, maxAccessListEntries, maxStorageKeysPerEntry, request.outputDeserializationSchema.length, request.respondSerializationSchema.length), request);
|
|
113
115
|
}
|
|
114
116
|
// ---- ABI words / calldata / transaction assembly ---------------------------
|
|
115
117
|
/**
|
|
@@ -120,7 +122,8 @@ export function calculateRequestId(request) {
|
|
|
120
122
|
* builders, tests).
|
|
121
123
|
*
|
|
122
124
|
* @param value - The word's numeric value (e.g. an amount).
|
|
123
|
-
* @returns The ABI-ready 32-byte word to store in an {@link
|
|
125
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
126
|
+
* @throws Error if the value is negative or does not fit 32 bytes.
|
|
124
127
|
*/
|
|
125
128
|
export function numericAbiWord(value) {
|
|
126
129
|
return bigintToBytes32BE(value);
|
|
@@ -131,7 +134,7 @@ export function numericAbiWord(value) {
|
|
|
131
134
|
* `evmAddressAbiWord` circuit (lockstep-tested against the compiled circuit).
|
|
132
135
|
*
|
|
133
136
|
* @param address - The 20-byte address in display order.
|
|
134
|
-
* @returns The ABI-ready 32-byte word to store in an {@link
|
|
137
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
135
138
|
* @throws Error if the address is not exactly 20 bytes.
|
|
136
139
|
*/
|
|
137
140
|
export function evmAddressAbiWord(address) {
|
|
@@ -142,6 +145,19 @@ export function evmAddressAbiWord(address) {
|
|
|
142
145
|
word.set(address, 12);
|
|
143
146
|
return word;
|
|
144
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* The ABI word for a Boolean: 31 zero bytes, then 0x01 (true) or 0x00
|
|
150
|
+
* (false). TS mirror of Signet.compact's `boolAbiWord` circuit
|
|
151
|
+
* (lockstep-tested against the compiled circuit).
|
|
152
|
+
*
|
|
153
|
+
* @param value - The word's Boolean value.
|
|
154
|
+
* @returns The ABI-ready 32-byte word to store in an {@link EvmCalldata} word.
|
|
155
|
+
*/
|
|
156
|
+
export function boolAbiWord(value) {
|
|
157
|
+
const word = new Uint8Array(32);
|
|
158
|
+
word[31] = value ? 1 : 0;
|
|
159
|
+
return word;
|
|
160
|
+
}
|
|
145
161
|
/**
|
|
146
162
|
* Read a numeric ABI word back into a bigint: the big-endian reading of bytes
|
|
147
163
|
* 16..31. TS mirror of Signet.compact's `abiWordToUint128` circuit, including
|
|
@@ -165,13 +181,31 @@ export function abiWordToUint128(word) {
|
|
|
165
181
|
}
|
|
166
182
|
return value;
|
|
167
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Read a Boolean ABI word back into a boolean. TS mirror of Signet.compact's
|
|
186
|
+
* `abiWordToBool` circuit, including its canonicality check: the first 31
|
|
187
|
+
* bytes must be zero and the last byte 0 or 1.
|
|
188
|
+
*
|
|
189
|
+
* @param word - The ABI-ready 32-byte word.
|
|
190
|
+
* @returns The word's Boolean value.
|
|
191
|
+
* @throws Error if the word is not 32 bytes or is not a canonical Boolean.
|
|
192
|
+
*/
|
|
193
|
+
export function abiWordToBool(word) {
|
|
194
|
+
if (word.length !== 32) {
|
|
195
|
+
throw new Error(`ABI word must be 32 bytes, got ${word.length}`);
|
|
196
|
+
}
|
|
197
|
+
if (word.slice(0, 31).some((byte) => byte !== 0) || word[31] > 1) {
|
|
198
|
+
throw new Error("ABI word is not a canonical Boolean");
|
|
199
|
+
}
|
|
200
|
+
return word[31] === 1;
|
|
201
|
+
}
|
|
168
202
|
/**
|
|
169
203
|
* Assemble the raw calldata a request's words describe:
|
|
170
204
|
* `data = selector || words[0..noWords]`, VERBATIM. Words are stored
|
|
171
|
-
* ABI-ready (see {@link
|
|
205
|
+
* ABI-ready (see {@link EvmCalldata}), so no byte of the stored record is
|
|
172
206
|
* reordered or reinterpreted on the way into the transaction; slots past
|
|
173
207
|
* `noWords` are unused capacity and are dropped. This is THE implementation
|
|
174
|
-
* of the signer-side assembly documented on `
|
|
208
|
+
* of the signer-side assembly documented on `EvmCalldata` in Signet.compact.
|
|
175
209
|
*
|
|
176
210
|
* @param calldata - The request's calldata field.
|
|
177
211
|
* @returns Hex calldata for the transaction (`"0x"` when absent).
|
|
@@ -219,7 +253,7 @@ function decodeAccessList(txParams) {
|
|
|
219
253
|
* MPC signs).
|
|
220
254
|
* @throws Error if a calldata word carries an unknown kind.
|
|
221
255
|
*/
|
|
222
|
-
export function
|
|
256
|
+
export function signBidirectionalEventToUnsignedEvmTransaction(request) {
|
|
223
257
|
const { txParams } = request;
|
|
224
258
|
return Transaction.from({
|
|
225
259
|
type: 2,
|
|
@@ -236,57 +270,31 @@ export function signBidirectionalEventToUnsignedEVMTransaction(request) {
|
|
|
236
270
|
}
|
|
237
271
|
/**
|
|
238
272
|
* Decode a response signature record (as posted to the signet contract's
|
|
239
|
-
* signature response log
|
|
240
|
-
*
|
|
241
|
-
*
|
|
273
|
+
* signature response log) into an ethers {@link Signature}. Goes through
|
|
274
|
+
* {@link mpcSignatureToEcdsaSignature} rather than reading the record's
|
|
275
|
+
* fields directly, so this and in-circuit claims decode a post identically:
|
|
276
|
+
* ethers' `r` is the ECDSA scalar (`bigR.x` reduced mod the curve order),
|
|
277
|
+
* not the raw coordinate, and a malformed record is rejected the same way
|
|
278
|
+
* in both paths.
|
|
242
279
|
*
|
|
243
280
|
* @param response - The posted signature record.
|
|
244
281
|
* @returns The ethers signature.
|
|
245
|
-
* @throws Error if the
|
|
282
|
+
* @throws Error if the record is malformed (see {@link mpcSignatureToEcdsaSignature}).
|
|
246
283
|
*/
|
|
247
284
|
export function signatureRespondedEventToSignature(response) {
|
|
248
|
-
const recoveryId =
|
|
249
|
-
if (recoveryId !== 0 && recoveryId !== 1) {
|
|
250
|
-
throw new Error(`expected a recovery id of 0 or 1, got ${recoveryId}`);
|
|
251
|
-
}
|
|
285
|
+
const { r, s, recoveryId } = mpcSignatureToEcdsaSignature(response.signature);
|
|
252
286
|
return Signature.from({
|
|
253
|
-
r:
|
|
254
|
-
s:
|
|
287
|
+
r: toBeHex(r, 32),
|
|
288
|
+
s: toBeHex(s, 32),
|
|
255
289
|
v: recoveryId + 27,
|
|
256
290
|
});
|
|
257
291
|
}
|
|
258
|
-
/** secp256k1 base field prime (2^256 - 2^32 - 977). */
|
|
259
|
-
const SECP256K1_P = 2n ** 256n - 2n ** 32n - 977n;
|
|
260
|
-
/** Modular exponentiation by squaring. */
|
|
261
|
-
function modPow(base, exponent, modulus) {
|
|
262
|
-
let result = 1n;
|
|
263
|
-
let b = base % modulus;
|
|
264
|
-
let e = exponent;
|
|
265
|
-
while (e > 0n) {
|
|
266
|
-
if (e & 1n)
|
|
267
|
-
result = (result * b) % modulus;
|
|
268
|
-
b = (b * b) % modulus;
|
|
269
|
-
e >>= 1n;
|
|
270
|
-
}
|
|
271
|
-
return result;
|
|
272
|
-
}
|
|
273
|
-
/** Encode a bigint as exactly 32 BIG-endian bytes (secp256k1 scalar form). */
|
|
274
|
-
function bigintToBytes32BE(value) {
|
|
275
|
-
const out = new Uint8Array(32);
|
|
276
|
-
let v = value;
|
|
277
|
-
for (let i = 31; i >= 0; i--) {
|
|
278
|
-
out[i] = Number(v & 0xffn);
|
|
279
|
-
v >>= 8n;
|
|
280
|
-
}
|
|
281
|
-
return out;
|
|
282
|
-
}
|
|
283
292
|
/**
|
|
284
293
|
* Encode an ECDSA signature as the response record posted to the signet
|
|
285
|
-
* contract — the inverse of {@link signatureRespondedEventToSignature},
|
|
286
|
-
*
|
|
287
|
-
* carries
|
|
288
|
-
*
|
|
289
|
-
* point on the curve (y² = x³ + 7 over the secp256k1 base field).
|
|
294
|
+
* contract — the inverse of {@link signatureRespondedEventToSignature}, for
|
|
295
|
+
* MPC-side posters (the fakenet signer, tests). An `r || s || v` signature
|
|
296
|
+
* carries only R.x and the parity of R.y, so the full R point the record
|
|
297
|
+
* stores is recovered on-curve (see {@link ecdsaSignatureToMpcSignature}).
|
|
290
298
|
*
|
|
291
299
|
* The parameter is structural (the r/s/yParity subset of an ethers
|
|
292
300
|
* {@link Signature}) so signatures from ANY ethers instance qualify — posters
|
|
@@ -295,30 +303,21 @@ function bigintToBytes32BE(value) {
|
|
|
295
303
|
*
|
|
296
304
|
* @param signature - The signature to encode (`r`/`s` as 0x hex, `yParity` 0 or 1).
|
|
297
305
|
* @returns The response record, ready to post.
|
|
298
|
-
* @throws Error if `r` is not the x coordinate of a
|
|
306
|
+
* @throws Error if `r` is not the x coordinate of a secp256k1 point.
|
|
299
307
|
*/
|
|
300
308
|
export function signatureToSignatureRespondedEvent(signature) {
|
|
301
|
-
const x = BigInt(signature.r);
|
|
302
|
-
const ySquared = (modPow(x, 3n, SECP256K1_P) + 7n) % SECP256K1_P;
|
|
303
|
-
// P ≡ 3 (mod 4), so a square root (when one exists) is c^((P+1)/4).
|
|
304
|
-
let y = modPow(ySquared, (SECP256K1_P + 1n) / 4n, SECP256K1_P);
|
|
305
|
-
if ((y * y) % SECP256K1_P !== ySquared) {
|
|
306
|
-
throw new Error("signature r is not the x coordinate of a secp256k1 point");
|
|
307
|
-
}
|
|
308
|
-
if ((y & 1n) !== BigInt(signature.yParity)) {
|
|
309
|
-
y = SECP256K1_P - y;
|
|
310
|
-
}
|
|
311
309
|
return {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
signature: ecdsaSignatureToMpcSignature({
|
|
311
|
+
r: BigInt(signature.r),
|
|
312
|
+
s: BigInt(signature.s),
|
|
313
|
+
recoveryId: signature.yParity,
|
|
314
|
+
}),
|
|
316
315
|
};
|
|
317
316
|
}
|
|
318
317
|
/**
|
|
319
318
|
* Assemble the broadcast-ready signed EIP-1559 transaction for a request from
|
|
320
319
|
* its MPC signature response: rebuild the exact unsigned transaction the MPC
|
|
321
|
-
* signed (see {@link
|
|
320
|
+
* signed (see {@link signBidirectionalEventToUnsignedEvmTransaction}) and
|
|
322
321
|
* attach the signature. Does NOT check that the signature recovers to the
|
|
323
322
|
* requester's derived address — the response log is unauthenticated, so
|
|
324
323
|
* verify first with `verifySignatureRespondedEvent`.
|
|
@@ -329,11 +328,11 @@ export function signatureToSignatureRespondedEvent(signature) {
|
|
|
329
328
|
* `eth_sendRawTransaction`, `hash` its on-chain hash, `from` the recovered
|
|
330
329
|
* sender.
|
|
331
330
|
* @throws Error if the request record is malformed (see
|
|
332
|
-
* {@link
|
|
331
|
+
* {@link signBidirectionalEventToUnsignedEvmTransaction}) or the response
|
|
333
332
|
* is not a decodable signature.
|
|
334
333
|
*/
|
|
335
|
-
export function
|
|
336
|
-
const transaction =
|
|
334
|
+
export function signBidirectionalEventToSignedEvmTransaction(request, response) {
|
|
335
|
+
const transaction = signBidirectionalEventToUnsignedEvmTransaction(request);
|
|
337
336
|
transaction.signature = signatureRespondedEventToSignature(response);
|
|
338
337
|
return transaction;
|
|
339
338
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-evtype2tx-requests.js","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,8EAA8E;AAC9E,QAAQ;AACR,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AAEzE,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"signet-evtype2tx-requests.js","sourceRoot":"","sources":["../src/signet-evtype2tx-requests.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,oEAAoE;AACpE,8EAA8E;AAC9E,QAAQ;AACR,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AAEzE,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,SAAS,GAEV,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,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QACrB,UAAU,EAAE,gBAAgB,CAAC,QAAQ,CAAC;QACtC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAiC;IAEjC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,4BAA4B,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC,IAAI,CAAC;QACpB,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;QACjB,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;QACjB,CAAC,EAAE,UAAU,GAAG,EAAE;KACnB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kCAAkC,CAChD,SAAiD;IAEjD,OAAO;QACL,SAAS,EAAE,4BAA4B,CAAC;YACtC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YACtB,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YACtB,UAAU,EAAE,SAAS,CAAC,OAAO;SAC9B,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4CAA4C,CAC1D,OAA+B,EAC/B,QAAiC;IAEjC,MAAM,WAAW,GAAG,8CAA8C,CAAC,OAAO,CAAC,CAAC;IAC5E,WAAW,CAAC,SAAS,GAAG,kCAAkC,CAAC,QAAQ,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -107,7 +107,7 @@ export declare class SignetRequestResponseReader {
|
|
|
107
107
|
getSignatureResponses(requestId: RequestIdHex): Promise<SignatureRespondedEvent[]>;
|
|
108
108
|
/**
|
|
109
109
|
* Fetch and verify the responses posted for `requestId`: each post's
|
|
110
|
-
*
|
|
110
|
+
* signature must recover to `expectedSigner`
|
|
111
111
|
* (compared case-insensitively) over the signing hash of the transaction
|
|
112
112
|
* the request record describes. The first valid post wins; every post gets
|
|
113
113
|
* a verdict so callers can report the noise.
|
|
@@ -132,7 +132,7 @@ export declare class SignetRequestResponseReader {
|
|
|
132
132
|
* @throws Error when the requester contract has no state or holds no
|
|
133
133
|
* request under `requestId`.
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
getUnsignedEvmTransaction(requestId: RequestIdHex): Promise<Transaction>;
|
|
136
136
|
/**
|
|
137
137
|
* Assemble the broadcast-ready signed EIP-1559 transaction for `requestId`:
|
|
138
138
|
* rebuild the request's transaction and attach the first VERIFIED response
|
|
@@ -149,7 +149,7 @@ export declare class SignetRequestResponseReader {
|
|
|
149
149
|
* @throws Error when either contract has no state, the request is not on the
|
|
150
150
|
* requester's ledger, or the responses ledger is inconsistent.
|
|
151
151
|
*/
|
|
152
|
-
|
|
152
|
+
getSignedEvmTransaction(requestId: RequestIdHex, expectedSigner: string): Promise<Transaction | undefined>;
|
|
153
153
|
/**
|
|
154
154
|
* Fetch every respond-bidirectional response posted for `requestId`, in
|
|
155
155
|
* post (count) order. UNVERIFIED — the signet contract stores posts without
|