@sig-net/midnight 0.10.0 → 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.
Files changed (38) hide show
  1. package/README.md +8 -8
  2. package/dist/constants.d.ts +1 -1
  3. package/dist/constants.js +1 -1
  4. package/dist/ecdsa-attestation.d.ts +53 -1
  5. package/dist/ecdsa-attestation.d.ts.map +1 -1
  6. package/dist/ecdsa-attestation.js +96 -4
  7. package/dist/ecdsa-attestation.js.map +1 -1
  8. package/dist/epsilon-derivation.d.ts +8 -8
  9. package/dist/epsilon-derivation.d.ts.map +1 -1
  10. package/dist/epsilon-derivation.js +15 -17
  11. package/dist/epsilon-derivation.js.map +1 -1
  12. package/dist/managed/compiler/contract-info.json +42 -24
  13. package/dist/managed/compiler/contract-manifest.json +8 -8
  14. package/dist/managed/contract/index.d.ts +14 -10
  15. package/dist/managed/contract/index.js +142 -86
  16. package/dist/managed/contract/index.js.map +1 -1
  17. package/dist/signature-requests-state-reader.d.ts +2 -2
  18. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  19. package/dist/signature-requests-state-reader.js +32 -15
  20. package/dist/signature-requests-state-reader.js.map +1 -1
  21. package/dist/signature-response-verification.d.ts +1 -1
  22. package/dist/signature-response-verification.js +5 -5
  23. package/dist/signature-response-verification.js.map +1 -1
  24. package/dist/signet-contract-state-reader.d.ts +49 -30
  25. package/dist/signet-contract-state-reader.d.ts.map +1 -1
  26. package/dist/signet-contract-state-reader.js +55 -35
  27. package/dist/signet-contract-state-reader.js.map +1 -1
  28. package/dist/signet-evtype2tx-requests.d.ts +47 -44
  29. package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
  30. package/dist/signet-evtype2tx-requests.js +47 -79
  31. package/dist/signet-evtype2tx-requests.js.map +1 -1
  32. package/dist/signet-request-response-reader.d.ts +3 -3
  33. package/dist/signet-request-response-reader.js +9 -9
  34. package/dist/signet-request-response-reader.js.map +1 -1
  35. package/dist/signet-requests.d.ts +4 -4
  36. package/dist/signet-requests.js +1 -1
  37. package/package.json +1 -1
  38. package/src/Signet.compact +85 -51
package/README.md CHANGED
@@ -88,7 +88,7 @@ Set up your contract for integration with the Sig Network MPC's sign bidirection
88
88
  // Configured and sized here for an EVM Type 2 transaction with
89
89
  // <1 calldata word, 0 access-list entries, 0 storage keys> and
90
90
  // 34-byte serialisation schemas.
91
- export ledger signBidirectionalEventMap: SignBidirectionalEventMap<EVMType2TxParams<1, 0, 0>, 34, 34>;
91
+ export ledger signBidirectionalEventMap: SignBidirectionalEventMap<EvmType2TxParams<1, 0, 0>, 34, 34>;
92
92
 
93
93
  // Required: The Signet singleton signer interface, set at deploy.
94
94
  // Used to notify the MPC of events you add to your signBidirectionalEventMap.
@@ -176,8 +176,8 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
176
176
 
177
177
  ```compact
178
178
  // Construct SignBidirectionalEvent signature request and calculate its RequestId
179
- const request = constructSignBidirectionalEvent<EVMType2TxParams<1, 0, 0>, 34, 34>(/* ... */);
180
- const requestId = disclose(calculateRequestId<EVMType2TxParams<1, 0, 0>, 34, 34>(request));
179
+ const request = constructSignBidirectionalEvent<EvmType2TxParams<1, 0, 0>, 34, 34>(/* ... */);
180
+ const requestId = disclose(calculateRequestId<EvmType2TxParams<1, 0, 0>, 34, 34>(request));
181
181
 
182
182
  // Store the signature request in your signBidirectionalEventMap for MPC to discover
183
183
  signetRequestNonce.increment(1);
@@ -185,7 +185,7 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
185
185
 
186
186
  // Notify the MPC of the SignBidirectionalEvent and the location of your signBidirectionalEventMap.
187
187
  // The location is 0 here based on the position of the declaration in Setup step 2.
188
- signetSigner.signBidirectionalEvent(
188
+ signetSigner.signBidirectional(
189
189
  requestId,
190
190
  constructSignBidirectionalEventNotificationV1(kernel.self(), 0 as Uint<8>),
191
191
  );
@@ -205,7 +205,7 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
205
205
  ```ts
206
206
  import { JsonRpcProvider } from "ethers";
207
207
 
208
- const signedTx = await reader.getSignedEVMTransaction(requestId, expectedSigner);
208
+ const signedTx = await reader.getSignedEvmTransaction(requestId, expectedSigner);
209
209
  await new JsonRpcProvider(foreignChainRpcUrl).broadcastTransaction(signedTx.serialized);
210
210
  ```
211
211
 
@@ -228,7 +228,7 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
228
228
 
229
229
  ## EVM Type 2 transactions and ABI calldata words
230
230
 
231
- An `EVMType2TxParams` request decomposes the EVM transaction into typed fields your contract can enforce field by field in-circuit. Its optional `calldata` is an `EVMCalldata<maxWords>`: the 4-byte function selector plus a list of 32-byte ABI words, per the [Solidity ABI spec](https://docs.soliditylang.org/en/latest/abi-spec.html). Slots past `noWords` are unused capacity and never reach the transaction.
231
+ An `EvmType2TxParams` request decomposes the EVM transaction into typed fields your contract can enforce field by field in-circuit. Its optional `calldata` is an `EvmCalldata<maxWords>`: the 4-byte function selector plus a list of 32-byte ABI words, per the [Solidity ABI spec](https://docs.soliditylang.org/en/latest/abi-spec.html). Slots past `noWords` are unused capacity and never reach the transaction.
232
232
 
233
233
  Every word must be stored in canonical ABI form (big-endian). The MPC signs a transaction whose calldata is exactly `selector || words[0..noWords]`, byte for byte, so a word stored in any other form becomes a signed transaction calling the foreign contract with garbage arguments. Compact's integer casts are little-endian, so do not hand-roll the byte order: build every word with the module's helper circuits, and read words back with the matching readers.
234
234
 
@@ -243,7 +243,7 @@ Every word must be stored in canonical ABI form (big-endian). The MPC signs a tr
243
243
  `transfer(address,uint256)`, selector `0xa9059cbb`, takes an address word and a numeric word:
244
244
 
245
245
  ```compact
246
- const calldata = EVMCalldata<2> {
246
+ const calldata = EvmCalldata<2> {
247
247
  selector: Bytes[0xa9, 0x05, 0x9c, 0xbb],
248
248
  noWords: 2 as Uint<16>,
249
249
  words: [
@@ -258,7 +258,7 @@ const calldata = EVMCalldata<2> {
258
258
  `setApprovalForAll(address,bool)`, selector `0xa22cb465`:
259
259
 
260
260
  ```compact
261
- const calldata = EVMCalldata<2> {
261
+ const calldata = EvmCalldata<2> {
262
262
  selector: Bytes[0xa2, 0x2c, 0xb4, 0x65],
263
263
  noWords: 2 as Uint<16>,
264
264
  words: [
@@ -2,7 +2,7 @@
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>`) — the literal first 4 calldata bytes. */
5
+ /** Width of `EvmCalldata.selector` (`Bytes<4>`) — the literal first 4 calldata bytes. */
6
6
  export declare const SELECTOR_BYTES = 4;
7
7
  /** Width of `RespondBidirectionalEvent.serializedOutput` (`Bytes<128>`). */
8
8
  export declare const SERIALIZED_OUTPUT_BYTES = 128;
package/dist/constants.js CHANGED
@@ -11,7 +11,7 @@
11
11
  export const CAIP2_ID_BYTES = 32;
12
12
  /** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
13
13
  export const MPC_PARAMS_BYTES = 64;
14
- /** Width of `EVMCalldata.selector` (`Bytes<4>`) — the literal first 4 calldata bytes. */
14
+ /** Width of `EvmCalldata.selector` (`Bytes<4>`) — the literal first 4 calldata bytes. */
15
15
  export const SELECTOR_BYTES = 4;
16
16
  /** Width of `RespondBidirectionalEvent.serializedOutput` (`Bytes<128>`). */
17
17
  export const SERIALIZED_OUTPUT_BYTES = 128;
@@ -1,4 +1,5 @@
1
1
  import type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
2
+ import type { MpcSignature } from "./signet-contract-state-reader.ts";
2
3
  export type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
3
4
  /** secp256k1 curve (group) order n. */
4
5
  export declare const SECP256K1_ORDER: bigint;
@@ -23,11 +24,30 @@ export declare function bytesToBigint(bytes: Uint8Array): bigint;
23
24
  * @returns The 32-byte little-endian encoding.
24
25
  */
25
26
  export declare function bigintToBytes32(n: bigint): Uint8Array;
27
+ /**
28
+ * Convert big-endian bytes to a bigint (SEC1 coordinate order, the byte
29
+ * order the respond events' stored signature uses).
30
+ *
31
+ * @param bytes - Big-endian byte array.
32
+ * @returns The decoded non-negative integer.
33
+ */
34
+ export declare function bytesToBigintBE(bytes: Uint8Array): bigint;
35
+ /**
36
+ * Convert a bigint to exactly 32 BIG-endian bytes (SEC1 scalar/coordinate
37
+ * order, also the ABI word encoding) — the big-endian counterpart of
38
+ * {@link bigintToBytes32} and the inverse of {@link bytesToBigintBE}.
39
+ *
40
+ * @param value - The non-negative integer to encode.
41
+ * @returns The 32-byte big-endian encoding.
42
+ * @throws Error if the value is negative or does not fit 32 bytes.
43
+ */
44
+ export declare function bigintToBytes32BE(value: bigint): Uint8Array;
26
45
  /**
27
46
  * An ECDSA signature over the attestation digest, in the MPC's canonical
28
47
  * `Signature { big_r, s, recovery_id }` spirit with `r` already reduced to
29
48
  * the scalar `big_r.x mod n` — the form Compact's `Secp256k1EcdsaSignature`
30
- * takes.
49
+ * takes. Build the stored form for posting in a respond event with
50
+ * {@link ecdsaSignatureToMpcSignature}.
31
51
  */
32
52
  export interface EcdsaSignature {
33
53
  /** Signature scalar r (= R.x mod n). */
@@ -49,6 +69,38 @@ export interface EcdsaSignature {
49
69
  * @returns The signature with its recovery id.
50
70
  */
51
71
  export declare function signAttestationDigest(digest: Uint8Array, secretKey: Uint8Array): EcdsaSignature;
72
+ /**
73
+ * Build the stored-form signature both respond events carry from a
74
+ * scalar-form one: R is reconstructed by decompressing the curve point with
75
+ * x = `r` and the parity `recoveryId` names — undoing the compression an
76
+ * `r || s || v` signature performs. For MPC-side posters (the fakenet
77
+ * signer, tests). The negligible caveat: an R.x that overflowed the curve
78
+ * order cannot be told apart from its reduced twin, so reconstruction picks
79
+ * the x equal to `r` itself.
80
+ *
81
+ * @param signature - The scalar-form signature (the signer's output shape).
82
+ * @returns The stored-form signature: R as a full point, big-endian bytes.
83
+ * @throws Error if the recovery id is not 0 or 1, or `r` is not the x
84
+ * coordinate of a secp256k1 point.
85
+ */
86
+ export declare function ecdsaSignatureToMpcSignature(signature: EcdsaSignature): MpcSignature;
87
+ /**
88
+ * Read a stored-form signature back into scalar form — the inverse of
89
+ * {@link ecdsaSignatureToMpcSignature}, for off-chain consumers building a
90
+ * transaction from the response. In-circuit verification does not need this:
91
+ * `verifyRespondBidirectionalEvent` takes the stored record as-is. `r` comes
92
+ * out as `bigR.x` reduced mod the curve order. Rejects records that do not
93
+ * even hold the shape, since posts are unauthenticated and a malformed
94
+ * record is garbage, not a signature. `bigR.y` is NOT checked against the
95
+ * curve or the recovery id: signature verification is the authority, not
96
+ * this decoder.
97
+ *
98
+ * @param signature - The stored-form signature as posted.
99
+ * @returns The scalar-form signature.
100
+ * @throws Error if a component has the wrong byte length or the recovery id
101
+ * is not 0 or 1.
102
+ */
103
+ export declare function mpcSignatureToEcdsaSignature(signature: MpcSignature): EcdsaSignature;
52
104
  /**
53
105
  * Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
54
106
  * optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape —
@@ -1 +1 @@
1
- {"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,uCAAuC;AACvC,eAAO,MAAM,eAAe,QAA2B,CAAC;AAExD,uEAAuE;AACvE,eAAO,MAAM,SAAS,iFAAiF,CAAC;AAExG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAQrD;AAWD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IA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CAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,2DAA2D;IAC3D,CAAC,EAAE,MAAM,CAAC;IACV,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,UAAU,GACpB,cAAc,CAiBhB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,cAAc,GAAG,YAAY,CAmBpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,YAAY,GAAG,cAAc,CAapF;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAcrE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,cAAc,CAO1E"}
@@ -1,8 +1,8 @@
1
1
  // secp256k1 ECDSA helpers: the TS side of the respond-bidirectional
2
2
  // attestation flow in Signet.compact — SIGNING (which needs the secret
3
3
  // scalar, so it cannot be a circuit), key parsing/formatting, and the
4
- // byte-order conversions between noble's bigints and the ledger-stored
5
- // little-endian scalar bytes. Everything provable stays in Compact: the
4
+ // byte-order conversions between noble's bigints and the little-endian
5
+ // scalar bytes Compact's casts read. Everything provable stays in Compact: the
6
6
  // attestation digest is the COMPILED `pureCircuits.signetAttestationDigest`,
7
7
  // verification is `pureCircuits.verifyRespondBidirectionalEvent` (the same
8
8
  // check client contracts run in-circuit), and the deploy-time key pin is
@@ -48,14 +48,41 @@ export function bigintToBytes32(n) {
48
48
  }
49
49
  return buf;
50
50
  }
51
- /** Convert big-endian bytes to a bigint (SEC1 coordinate order). */
52
- function bytesToBigintBE(bytes) {
51
+ /**
52
+ * Convert big-endian bytes to a bigint (SEC1 coordinate order, the byte
53
+ * order the respond events' stored signature uses).
54
+ *
55
+ * @param bytes - Big-endian byte array.
56
+ * @returns The decoded non-negative integer.
57
+ */
58
+ export function bytesToBigintBE(bytes) {
53
59
  let value = 0n;
54
60
  for (const byte of bytes) {
55
61
  value = (value << 8n) | BigInt(byte);
56
62
  }
57
63
  return value;
58
64
  }
65
+ /**
66
+ * Convert a bigint to exactly 32 BIG-endian bytes (SEC1 scalar/coordinate
67
+ * order, also the ABI word encoding) — the big-endian counterpart of
68
+ * {@link bigintToBytes32} and the inverse of {@link bytesToBigintBE}.
69
+ *
70
+ * @param value - The non-negative integer to encode.
71
+ * @returns The 32-byte big-endian encoding.
72
+ * @throws Error if the value is negative or does not fit 32 bytes.
73
+ */
74
+ export function bigintToBytes32BE(value) {
75
+ if (value < 0n || value >= 1n << 256n) {
76
+ throw new Error(`value does not fit 32 big-endian bytes: ${value}`);
77
+ }
78
+ const out = new Uint8Array(32);
79
+ let v = value;
80
+ for (let i = 31; i >= 0; i--) {
81
+ out[i] = Number(v & 0xffn);
82
+ v >>= 8n;
83
+ }
84
+ return out;
85
+ }
59
86
  /**
60
87
  * ECDSA-sign a 32-byte digest with a secp256k1 secret key, exactly as the
61
88
  * MPC signs the attestation digest: RFC 6979 deterministic, low-s, the digest
@@ -85,6 +112,71 @@ export function signAttestationDigest(digest, secretKey) {
85
112
  /* v8 ignore next: unreachable for a signature this function just produced */
86
113
  throw new Error("signature does not recover to its own public key");
87
114
  }
115
+ /**
116
+ * Build the stored-form signature both respond events carry from a
117
+ * scalar-form one: R is reconstructed by decompressing the curve point with
118
+ * x = `r` and the parity `recoveryId` names — undoing the compression an
119
+ * `r || s || v` signature performs. For MPC-side posters (the fakenet
120
+ * signer, tests). The negligible caveat: an R.x that overflowed the curve
121
+ * order cannot be told apart from its reduced twin, so reconstruction picks
122
+ * the x equal to `r` itself.
123
+ *
124
+ * @param signature - The scalar-form signature (the signer's output shape).
125
+ * @returns The stored-form signature: R as a full point, big-endian bytes.
126
+ * @throws Error if the recovery id is not 0 or 1, or `r` is not the x
127
+ * coordinate of a secp256k1 point.
128
+ */
129
+ export function ecdsaSignatureToMpcSignature(signature) {
130
+ if (signature.recoveryId !== 0 && signature.recoveryId !== 1) {
131
+ throw new Error(`expected a recovery id of 0 or 1, got ${signature.recoveryId}`);
132
+ }
133
+ // SEC1 compressed form: parity prefix (02 even, 03 odd) || x big-endian.
134
+ const parityPrefix = signature.recoveryId === 0 ? "02" : "03";
135
+ const xHex = signature.r.toString(16).padStart(64, "0");
136
+ let point;
137
+ try {
138
+ point = secp256k1.Point.fromHex(`${parityPrefix}${xHex}`);
139
+ }
140
+ catch (error) {
141
+ throw new Error(`signature r is not the x coordinate of a secp256k1 point (${String(error)})`);
142
+ }
143
+ const uncompressed = point.toBytes(false); // 0x04 || x || y
144
+ return {
145
+ bigR: { x: uncompressed.slice(1, 33), y: uncompressed.slice(33, 65) },
146
+ s: bigintToBytes32BE(signature.s),
147
+ recoveryId: BigInt(signature.recoveryId),
148
+ };
149
+ }
150
+ /**
151
+ * Read a stored-form signature back into scalar form — the inverse of
152
+ * {@link ecdsaSignatureToMpcSignature}, for off-chain consumers building a
153
+ * transaction from the response. In-circuit verification does not need this:
154
+ * `verifyRespondBidirectionalEvent` takes the stored record as-is. `r` comes
155
+ * out as `bigR.x` reduced mod the curve order. Rejects records that do not
156
+ * even hold the shape, since posts are unauthenticated and a malformed
157
+ * record is garbage, not a signature. `bigR.y` is NOT checked against the
158
+ * curve or the recovery id: signature verification is the authority, not
159
+ * this decoder.
160
+ *
161
+ * @param signature - The stored-form signature as posted.
162
+ * @returns The scalar-form signature.
163
+ * @throws Error if a component has the wrong byte length or the recovery id
164
+ * is not 0 or 1.
165
+ */
166
+ export function mpcSignatureToEcdsaSignature(signature) {
167
+ const { bigR, s, recoveryId } = signature;
168
+ if (bigR.x.length !== 32 || bigR.y.length !== 32 || s.length !== 32) {
169
+ throw new Error("expected 32-byte bigR.x/bigR.y/s in a stored signature");
170
+ }
171
+ if (recoveryId !== 0n && recoveryId !== 1n) {
172
+ throw new Error(`expected a recovery id of 0 or 1, got ${recoveryId}`);
173
+ }
174
+ return {
175
+ r: bytesToBigintBE(bigR.x) % SECP256K1_ORDER,
176
+ s: bytesToBigintBE(s),
177
+ recoveryId: Number(recoveryId),
178
+ };
179
+ }
88
180
  /**
89
181
  * Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
90
182
  * optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape —
@@ -1 +1 @@
1
- {"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,wEAAwE;AACxE,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,EAAE;AACF,yEAAyE;AACzE,8BAA8B;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAOvD,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAExD,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,8EAA8E,CAAC;AAExG;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS;IACvC,M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E,CAAC,CAAC;QAC7C,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAqB;IAC5D,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACvE,OAAO,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAqB;IACxD,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9D,OAAO;QACL,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7C,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { type Secp256k1Point } from "./ecdsa-attestation.ts";
2
2
  /**
3
- * Domain prefix of the sig-net v1.0.0 epsilon derivation scheme, as used by
4
- * the live response server. The full derivation string is
5
- * `<prefix>,<chainId>,<requester>,<path>` (comma-separated).
3
+ * Domain prefix of the sig-net v2.0.0 epsilon derivation scheme. The full
4
+ * derivation string is `<prefix>:<chainId>:<requester>:<path>` (colon-separated),
5
+ * matching `caip2_derivation_path` in the MPC's `crypto/src/kdf.rs`.
6
6
  */
7
- export declare const EPSILON_DERIVATION_PREFIX = "sig.network v1.0.0 epsilon derivation";
7
+ export declare const EPSILON_DERIVATION_PREFIX = "sig.network v2.0.0 epsilon derivation";
8
8
  /**
9
9
  * CAIP-2 chain id under which the MPC derives keys for requests originating
10
10
  * from Midnight contracts.
@@ -29,8 +29,8 @@ export declare const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
29
29
  export declare const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response key";
30
30
  /**
31
31
  * Derive the EVM address the MPC network signs from for a given Midnight
32
- * contract and derivation path, using the sig-net v1.0.0 epsilon scheme:
33
- * `epsilon = keccak256("<prefix>,<chainId>,<contractAddress>,<path>")` and
32
+ * contract and derivation path, using the sig-net v2.0.0 epsilon scheme:
33
+ * `epsilon = keccak256("<prefix>:<chainId>:<contractAddress>:<path>")` and
34
34
  * `derivedPubKey = mpcRootPubKey + epsilon * G` on secp256k1.
35
35
  *
36
36
  * The MPC treats `path` as an opaque string: the vault's own account uses the
@@ -48,8 +48,8 @@ export declare const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response ke
48
48
  */
49
49
  export declare function deriveEvmAddress(mpcSecp256k1PubkeyHex: string, contractAddress: string, path: string, chainId?: string): string;
50
50
  /**
51
- * The epsilon scalar of the sig-net v1.0.0 derivation scheme:
52
- * `keccak256("<prefix>,<chainId>,<requester>,<path>")` reduced mod the
51
+ * The epsilon scalar of the sig-net v2.0.0 derivation scheme:
52
+ * `keccak256("<prefix>:<chainId>:<requester>:<path>")` reduced mod the
53
53
  * secp256k1 curve order. Child keys are `root + epsilon` (secret side) and
54
54
  * `rootPubKey + epsilon * G` (public side).
55
55
  *
@@ -1 +1 @@
1
- {"version":3,"file":"epsilon-derivation.d.ts","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,yBAAyB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,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAKR;AA6BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,qBAAqB,EAAE,MAAM,EAC7B,qBAAqB,EAAE,MAAM,GAC5B,cAAc,CAQhB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,UAAU,EAC5B,qBAAqB,EAAE,MAAM,GAC5B,UAAU,CAwBZ"}
@@ -1,23 +1,21 @@
1
1
  // Epsilon key derivation: contract address + path -> derived EVM account.
2
2
  //
3
3
  // This belongs in github.com/sig-net/signet.js — kept here until upstreamed.
4
- // It is NOT imported from signet.js because signet.js's `deriveChildPublicKey`
5
- // implements the v2.0.0 COLON-separated epsilon format
6
- // (`sig.network v2.0.0 epsilon derivation:<chainId>:<requester>:<path>`),
7
- // which is incompatible with the live sig-net response server's v1.0.0
8
- // COMMA-separated format (see solana-signet-program
9
- // clients/response-server/src/modules/CryptoUtils.ts). The two schemes hash
10
- // different strings and therefore derive different accounts; this module
11
- // matches the server.
4
+ //
5
+ // v2.0.0 (COLON-separated) is the only scheme the MPC answers. The v1.0.0
6
+ // COMMA-separated form is `key_version 0` in the MPC's KDF and is not served;
7
+ // the Compact contracts also assert `keyVersion >= 1`, which selects v2. The
8
+ // two schemes hash different strings and derive different accounts, so a
9
+ // v1 signer silently gets the wrong address rather than an error.
12
10
  import { secp256k1 } from "@noble/curves/secp256k1.js";
13
11
  import { computeAddress, keccak256, SigningKey, toUtf8Bytes } from "ethers";
14
12
  import { SECP256K1_ORDER } from "./ecdsa-attestation.js";
15
13
  /**
16
- * Domain prefix of the sig-net v1.0.0 epsilon derivation scheme, as used by
17
- * the live response server. The full derivation string is
18
- * `<prefix>,<chainId>,<requester>,<path>` (comma-separated).
14
+ * Domain prefix of the sig-net v2.0.0 epsilon derivation scheme. The full
15
+ * derivation string is `<prefix>:<chainId>:<requester>:<path>` (colon-separated),
16
+ * matching `caip2_derivation_path` in the MPC's `crypto/src/kdf.rs`.
19
17
  */
20
- export const EPSILON_DERIVATION_PREFIX = "sig.network v1.0.0 epsilon derivation";
18
+ export const EPSILON_DERIVATION_PREFIX = "sig.network v2.0.0 epsilon derivation";
21
19
  /**
22
20
  * CAIP-2 chain id under which the MPC derives keys for requests originating
23
21
  * from Midnight contracts.
@@ -42,8 +40,8 @@ export const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
42
40
  export const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response key";
43
41
  /**
44
42
  * Derive the EVM address the MPC network signs from for a given Midnight
45
- * contract and derivation path, using the sig-net v1.0.0 epsilon scheme:
46
- * `epsilon = keccak256("<prefix>,<chainId>,<contractAddress>,<path>")` and
43
+ * contract and derivation path, using the sig-net v2.0.0 epsilon scheme:
44
+ * `epsilon = keccak256("<prefix>:<chainId>:<contractAddress>:<path>")` and
47
45
  * `derivedPubKey = mpcRootPubKey + epsilon * G` on secp256k1.
48
46
  *
49
47
  * The MPC treats `path` as an opaque string: the vault's own account uses the
@@ -64,8 +62,8 @@ export function deriveEvmAddress(mpcSecp256k1PubkeyHex, contractAddress, path, c
64
62
  return computeAddress(`0x${derivedPoint.toHex(false)}`);
65
63
  }
66
64
  /**
67
- * The epsilon scalar of the sig-net v1.0.0 derivation scheme:
68
- * `keccak256("<prefix>,<chainId>,<requester>,<path>")` reduced mod the
65
+ * The epsilon scalar of the sig-net v2.0.0 derivation scheme:
66
+ * `keccak256("<prefix>:<chainId>:<requester>:<path>")` reduced mod the
69
67
  * secp256k1 curve order. Child keys are `root + epsilon` (secret side) and
70
68
  * `rootPubKey + epsilon * G` (public side).
71
69
  *
@@ -76,7 +74,7 @@ export function deriveEvmAddress(mpcSecp256k1PubkeyHex, contractAddress, path, c
76
74
  * @returns The epsilon scalar, in `[0, n)`.
77
75
  */
78
76
  export function deriveEpsilon(requester, path, chainId = MIDNIGHT_TESTNET_CHAIN_ID) {
79
- const fullPath = `${EPSILON_DERIVATION_PREFIX},${chainId},${requester},${path}`;
77
+ const fullPath = `${EPSILON_DERIVATION_PREFIX}:${chainId}:${requester}:${path}`;
80
78
  // Reduce mod n before using: noble throws on scalars >= n, whereas the
81
79
  // server's scalar arithmetic reduces implicitly.
82
80
  return BigInt(keccak256(toUtf8Bytes(fullPath))) % SECP256K1_ORDER;
@@ -1 +1 @@
1
- {"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,uDAAuD;AACvD,0EAA0E;AAC1E,uEAAuE;AACvE,oDAAoD;AACpD,4EAA4E;AAC5E,yEAAyE;AACzE,sBAAsB;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAuB,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uCAAuC,CAAC;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,qBAA6B,EAC7B,eAAuB,EACvB,IAAY,EACZ,UAAkB,yBAAyB;IAE3C,MAAM,YAAY,GAAG,gBAAgB,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7F,OAAO,cAAc,CAAC,KAAK,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,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;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAA4B,EAC5B,qBAA6B;IAE7B,IAAI,gBAAgB,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,6CAA6C,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,MAAM,OAAO,GAAG,aAAa,CAC3B,yBAAyB,CAAC,qBAAqB,CAAC,EAChD,mCAAmC,EACnC,yBAAyB,CAC1B,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,eAAe,CAAC;IACjD,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QAC/B,KAAK,KAAK,EAAE,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -75,13 +75,6 @@
75
75
  "type-name": "Bytes",
76
76
  "length": 128
77
77
  }
78
- },
79
- {
80
- "name": "outputLen",
81
- "type": {
82
- "type-name": "Uint",
83
- "maxval": 255
84
- }
85
78
  }
86
79
  ],
87
80
  "result-type": {
@@ -126,24 +119,49 @@
126
119
  }
127
120
  },
128
121
  {
129
- "name": "r",
130
- "type": {
131
- "type-name": "Bytes",
132
- "length": 32
133
- }
134
- },
135
- {
136
- "name": "s",
137
- "type": {
138
- "type-name": "Bytes",
139
- "length": 32
140
- }
141
- },
142
- {
143
- "name": "recoveryId",
122
+ "name": "signature",
144
123
  "type": {
145
- "type-name": "Uint",
146
- "maxval": 255
124
+ "type-name": "Struct",
125
+ "name": "Signature",
126
+ "elements": [
127
+ {
128
+ "name": "bigR",
129
+ "type": {
130
+ "type-name": "Struct",
131
+ "name": "AffinePoint",
132
+ "elements": [
133
+ {
134
+ "name": "x",
135
+ "type": {
136
+ "type-name": "Bytes",
137
+ "length": 32
138
+ }
139
+ },
140
+ {
141
+ "name": "y",
142
+ "type": {
143
+ "type-name": "Bytes",
144
+ "length": 32
145
+ }
146
+ }
147
+ ]
148
+ }
149
+ },
150
+ {
151
+ "name": "s",
152
+ "type": {
153
+ "type-name": "Bytes",
154
+ "length": 32
155
+ }
156
+ },
157
+ {
158
+ "name": "recoveryId",
159
+ "type": {
160
+ "type-name": "Uint",
161
+ "maxval": 255
162
+ }
163
+ }
164
+ ]
147
165
  }
148
166
  }
149
167
  ]
@@ -7,26 +7,26 @@
7
7
  "type": "directory",
8
8
  "contract-info.json": {
9
9
  "type": "file",
10
- "size": 6108,
11
- "hash": "936ac5ce6f9907eaa010e61295bf2c42cd10410458791ac8b431829876e5bf61"
10
+ "size": 6935,
11
+ "hash": "fd5062d1dd4a2e8f0a6295dd28e33631aac7829d6ae4c5f07acdc1be2c57d218"
12
12
  }
13
13
  },
14
14
  "contract": {
15
15
  "type": "directory",
16
16
  "index.d.ts": {
17
17
  "type": "file",
18
- "size": 5153,
19
- "hash": "8e0669479f86b45d1b561c351ca2952932c3407cb993be10a27a54db732863b3"
18
+ "size": 5683,
19
+ "hash": "b974f22abb20ac4d35a8b532dfee9becdcc17f2f7d4b4ab3eea480b584de087e"
20
20
  },
21
21
  "index.js": {
22
22
  "type": "file",
23
- "size": 41463,
24
- "hash": "0166a441ee087c3376b035286cdc2b94b4bf20f1df977c862a420a84b7912eaf"
23
+ "size": 43240,
24
+ "hash": "88f3c259fe0a38d3b6a88fc497a36c28b2908e9ac4acde7f478537c4da9e1de5"
25
25
  },
26
26
  "index.js.map": {
27
27
  "type": "file",
28
- "size": 3469,
29
- "hash": "468d63e7361fae52cee908332606da3d854de3b5c4e73c49c1f049501ddb1ac2"
28
+ "size": 3820,
29
+ "hash": "0201ceb0f1f99727aec454888c558105ef8e1f4fde7a4ae8ea87245876269303"
30
30
  }
31
31
  }
32
32
  }
@@ -16,14 +16,16 @@ export type PureCircuits = {
16
16
  payload: Uint8Array
17
17
  };
18
18
  signetAttestationDigest(requestId_0: Uint8Array,
19
- serializedOutput_0: Uint8Array,
20
- outputLen_0: bigint): Uint8Array;
19
+ serializedOutput_0: Uint8Array): Uint8Array;
21
20
  verifyRespondBidirectionalEvent(requestId_0: Uint8Array,
22
21
  respondBidirectionalEvent_0: { serializedOutput: Uint8Array,
23
22
  outputLen: bigint,
24
- r: Uint8Array,
25
- s: Uint8Array,
26
- recoveryId: bigint
23
+ signature: { bigR: { x: Uint8Array,
24
+ y: Uint8Array
25
+ },
26
+ s: Uint8Array,
27
+ recoveryId: bigint
28
+ }
27
29
  },
28
30
  mpcResponseKey_0: __compactRuntime.Secp256k1Point): boolean;
29
31
  signetKeyHash(pk_0: __compactRuntime.Secp256k1Point): Uint8Array;
@@ -43,15 +45,17 @@ export type Circuits<PS> = {
43
45
  }>>;
44
46
  signetAttestationDigest(context: __compactRuntime.CircuitContext<PS>,
45
47
  requestId_0: Uint8Array,
46
- serializedOutput_0: Uint8Array,
47
- outputLen_0: bigint): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
48
+ serializedOutput_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, Uint8Array>>;
48
49
  verifyRespondBidirectionalEvent(context: __compactRuntime.CircuitContext<PS>,
49
50
  requestId_0: Uint8Array,
50
51
  respondBidirectionalEvent_0: { serializedOutput: Uint8Array,
51
52
  outputLen: bigint,
52
- r: Uint8Array,
53
- s: Uint8Array,
54
- recoveryId: bigint
53
+ signature: { bigR: { x: Uint8Array,
54
+ y: Uint8Array
55
+ },
56
+ s: Uint8Array,
57
+ recoveryId: bigint
58
+ }
55
59
  },
56
60
  mpcResponseKey_0: __compactRuntime.Secp256k1Point): Promise<__compactRuntime.CircuitResults<PS, boolean>>;
57
61
  signetKeyHash(context: __compactRuntime.CircuitContext<PS>,