@sig-net/midnight 0.14.0 → 0.16.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 (57) hide show
  1. package/README.md +133 -48
  2. package/dist/constants.d.ts +55 -0
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +85 -5
  5. package/dist/constants.js.map +1 -1
  6. package/dist/ecdsa-attestation.d.ts +6 -5
  7. package/dist/ecdsa-attestation.d.ts.map +1 -1
  8. package/dist/ecdsa-attestation.js +5 -4
  9. package/dist/ecdsa-attestation.js.map +1 -1
  10. package/dist/index.d.ts +1 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -4
  13. package/dist/index.js.map +1 -1
  14. package/dist/managed/compiler/contract-info.json +12 -1
  15. package/dist/managed/compiler/contract-manifest.json +8 -8
  16. package/dist/managed/contract/index.d.ts +8 -6
  17. package/dist/managed/contract/index.js +76 -60
  18. package/dist/managed/contract/index.js.map +1 -1
  19. package/dist/signature-requests-state-reader.d.ts +29 -10
  20. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  21. package/dist/signature-requests-state-reader.js +67 -21
  22. package/dist/signature-requests-state-reader.js.map +1 -1
  23. package/dist/signature-response-verification.d.ts +1 -1
  24. package/dist/signature-response-verification.d.ts.map +1 -1
  25. package/dist/signature-response-verification.js +3 -3
  26. package/dist/signature-response-verification.js.map +1 -1
  27. package/dist/signature-state-reading.d.ts +17 -25
  28. package/dist/signature-state-reading.d.ts.map +1 -1
  29. package/dist/signature-state-reading.js +39 -59
  30. package/dist/signature-state-reading.js.map +1 -1
  31. package/dist/signet-contract-events.d.ts +262 -0
  32. package/dist/signet-contract-events.d.ts.map +1 -0
  33. package/dist/signet-contract-events.js +266 -0
  34. package/dist/signet-contract-events.js.map +1 -0
  35. package/dist/signet-evtype2tx-requests.d.ts +4 -4
  36. package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
  37. package/dist/signet-evtype2tx-requests.js +3 -3
  38. package/dist/signet-request-feed.d.ts +59 -34
  39. package/dist/signet-request-feed.d.ts.map +1 -1
  40. package/dist/signet-request-feed.js +95 -62
  41. package/dist/signet-request-feed.js.map +1 -1
  42. package/dist/signet-request-response-reader.d.ts +70 -62
  43. package/dist/signet-request-response-reader.d.ts.map +1 -1
  44. package/dist/signet-request-response-reader.js +88 -102
  45. package/dist/signet-request-response-reader.js.map +1 -1
  46. package/dist/signet-requests.js +2 -2
  47. package/dist/signet-requests.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/Signet.compact +90 -43
  50. package/dist/signet-contract-state-reader.d.ts +0 -241
  51. package/dist/signet-contract-state-reader.d.ts.map +0 -1
  52. package/dist/signet-contract-state-reader.js +0 -345
  53. package/dist/signet-contract-state-reader.js.map +0 -1
  54. package/dist/signet-request-resolver.d.ts +0 -60
  55. package/dist/signet-request-resolver.d.ts.map +0 -1
  56. package/dist/signet-request-resolver.js +0 -78
  57. package/dist/signet-request-resolver.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"signet-requests.js","sourceRoot":"","sources":["../src/signet-requests.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,sEAAsE;AACtE,EAAE;AACF,iEAAiE;AACjE,2EAA2E;AAC3E,8EAA8E;AAC9E,gDAAgD;AAChD,EAAE;AACF,6EAA6E;AAC7E,mFAAmF;AACnF,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,wEAAwE;AACxE,yDAAyD;AAEzD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,0BAA0B,GAE3B,MAAM,iCAAiC,CAAC;AAsBzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,sFAAsF;IACtF,QAAQ,EAAE,CAAC;IACX;;;;OAIG;IACH,QAAQ,EAAE,CAAC;CACH,CAAC;A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AAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sig-net/midnight",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sig-net/midnight-integration",
@@ -40,7 +40,7 @@
40
40
  "@midnight-ntwrk/compact-runtime": "0.18.0-rc.1",
41
41
  "@midnight-ntwrk/midnight-js-types": "5.0.0-beta.4",
42
42
  "@noble/curves": "^2.2.0",
43
- "@sig-net/midnight-serde": "^0.14.0",
43
+ "@sig-net/midnight-serde": "^0.16.0",
44
44
  "ethers": "^6.17.0"
45
45
  },
46
46
  "devDependencies": {
@@ -6,9 +6,10 @@
6
6
  // Terms:
7
7
  // - client contract(s): contracts on the Midnight blockchain that integrate with the Signet Distributed MPC
8
8
  // to execute arbitrary transactions on foreign blockchains.
9
- // - Signet singleton: a single contract on the Midnight blockchain holding the Signet registry for transaction
10
- // signature requests and responses, as well as signed attestations of transactions executed
11
- // on foreign blockchains (the execution outputs themselves travel off chain).
9
+ // - Signet singleton: a single contract on the Midnight blockchain through which clients notify the MPC of
10
+ // signature requests, and through which the MPC posts back signatures and signed attestations
11
+ // of foreign executions. Each post is emitted as a contract event (the execution
12
+ // outputs themselves travel off chain).
12
13
  //
13
14
  // Usage:
14
15
  // // Import this module at the start of a contract (resolved through node_modules via COMPACT_PATH):
@@ -28,28 +29,34 @@
28
29
  // - SignBidirectionalEventNotification: Notification delivered by client contracts via cross contract call to Signet singleton
29
30
  // (via SignetSigner interface) to notify the MPC of a SignBidirectionalEvent.
30
31
  // - SignatureRespondedEvent: Counterpart to SignBidirectionalEvent containing MPC generated signature requested by a SignBidirectionalEvent.
31
- // Posted by MPC back to Signet singleton for clients to extract to build a signed transaction.
32
+ // Posted by the MPC through the Signet singleton, which emits it as a contract
33
+ // event. Clients extract it to build a signed transaction.
32
34
  // - RespondBidirectionalEvent: Attestation of a transaction executed on a foreign blockchain: the MPC's ECDSA
33
35
  // signature over the attestation digest of the request id and serialised output
34
36
  // (see calculateSignetAttestationDigest), signed with the MPC's RESPONSE key for
35
37
  // the requesting contract: the key derived from the client contract's address +
36
38
  // the fixed path "midnight response key". Both the digest and the output itself
37
- // travel off chain. Posted by MPC back to Signet singleton for clients to extract,
38
- // verify (see verifyRespondBidirectionalEvent) and deliver back to the client
39
- // contract.
39
+ // travel off chain. Posted by the MPC through the Signet singleton, which
40
+ // emits it as a contract event. Clients extract it, verify it (see
41
+ // verifyRespondBidirectionalEvent) and deliver it back to the client contract.
40
42
  //
41
43
  // These key types are best understood within the sign bidirectional flow that they enable:
42
- // 1. Client contract stores a SignBidirectionalEvent in a SignBidirectionalEventMap its own ledger
43
- // (against the calculated RequestId) and requests a signature from the MPC by registering a
44
- // SignBidirectionalEventNotification in the Signet singleton contract's registry
45
- // (via cross contract call against the SignetSigner interface).
46
- // 2. MPC polls the Signet singleton contract's registry for the SignBidirectionalEventNotification,
47
- // using it to read the SignBidirectionalEvent signature request from the client's ledger. It generates the
48
- // signature and and posts a SignatureRespondedEvent (the requested signature) to the Signet singleton contract.
49
- // 3. Client polls the Signet singleton contract SignatureRespondedEventMap for the signature by RequestId,
50
- // verifies the posted SignatureRespondedEvent and broadcasts txn to destination chain.
51
- // 4. MPC observes txn execution on destination chain, posts a RespondBidirectionalEvent
52
- // attestation to the central Signet contract, and the client polls it by RequestId.
44
+ // 1. Client contract stores a SignBidirectionalEvent in a SignBidirectionalEventMap in its own ledger
45
+ // (against the calculated RequestId) and requests a signature from the MPC via a cross contract call
46
+ // against the SignetSigner interface. The Signet singleton emits the
47
+ // SignBidirectionalEventNotification as a contract event.
48
+ // 2. MPC polls the Signet singleton contract's events for SignBidirectionalEventNotifications and uses
49
+ // each one to read the SignBidirectionalEvent signature requests from the named client's own ledger.
50
+ // It generates the signature and posts a SignatureRespondedEvent (the requested signature) through
51
+ // the Signet singleton, which emits it as a contract event.
52
+ // 3. Client polls the Signet singleton contract's SignatureRespondedEvent events. Each event carries
53
+ // the request id it answers beside the signature. The id is unauthenticated routing data: the client
54
+ // reads its own request's posts by id, verifies each candidate, and takes the first one whose
55
+ // signature recovers to its derived key. Then it broadcasts the signed txn to the destination chain.
56
+ // 4. MPC observes txn execution on destination chain and posts a RespondBidirectionalEvent attestation
57
+ // through the central Signet contract, which emits it as a contract event beside the request id.
58
+ // The client polls its request's posts and takes the first one that verifies over the request id
59
+ // and output.
53
60
  // The client recovers the execution output itself off chain (for EVM: the mined
54
61
  // call's return data via debug_traceTransaction, also served by the fakenet
55
62
  // responder's /responses/{requestId} helper API) and hands output plus attestation
@@ -58,7 +65,8 @@
58
65
  // Read more:
59
66
  // - For full integration examples (such as an ERC20 cross chain vault example) see
60
67
  // the Midnight Examples repository at: https://github.com/sig-net/midnight-examples.
61
- // - Signet docs (chain signatures, key derivation): https://docs.sig.network
68
+ // - The sign bidirectional flow and key derivation: this package's README
69
+ // ("Sign bidirectional flow", "Derived keys").
62
70
  // - Compact language reference (modules, types):
63
71
  // https://docs.midnight.network/compact/reference/compact-reference
64
72
 
@@ -79,11 +87,15 @@ module Signet {
79
87
 
80
88
  // MPC Key Derivation Parameters.
81
89
  // Every key the MPC signs with is scoped by the requesting contract:
82
- // derivedSigningKey = f(mpcRootKey[keyVersion], sender, path)
83
- // The path is 32 opaque bytes of the client contract's choosing (e.g a fixed literal
84
- // for a contract-owned account or a hash of a caller's secret for per-user
85
- // accounts): no format is enforced. The sender is always part of the
86
- // derivation, so no contract can reach another contract's derived keys.
90
+ // derivedSigningKey = f(mpcRootKey[keyVersion], caip2ChainId, sender, hex::encode(path))
91
+ // where caip2ChainId is the CAIP-2 id of the ORIGINATING chain (the Midnight
92
+ // variant for requests made from Midnight contracts), not this record's target
93
+ // caip2Id. The path is 32 opaque bytes of the client contract's choosing (e.g a
94
+ // fixed literal for a contract-owned account or a hash of a caller's secret for
95
+ // per-user accounts): no format is enforced, any 32 bytes are valid. CRITICAL:
96
+ // the MPC renders the path as hex::encode(path) before deriving (lowercase hex
97
+ // of the full 32 bytes, no trimming, no 0x prefix). The sender is always part
98
+ // of the derivation, so no contract can reach another contract's derived keys.
87
99
  keyVersion: Uint<8>; // MPC root-key version to derive from. Set to 1.
88
100
  path: Bytes<32>; // Key derivation path: 32 opaque bytes, client contract's choice.
89
101
 
@@ -203,28 +215,68 @@ module Signet {
203
215
  // Versioned notification of the SignBidirectionalEvent
204
216
  // (construct with constructSignBidirectionalEventNotificationV1).
205
217
  notification: SignBidirectionalEventNotification
206
- ): SignetMapKey;
218
+ ): [];
207
219
  }
208
220
 
209
221
  // Notification delivered by client contracts via cross contract call to Signet singleton
210
222
  // (via SignetSigner interface) to notify the MPC of a SignBidirectionalEvent.
211
223
  export struct SignBidirectionalEventNotification {
212
- version: Uint<8>; // payload layout tag; 1 = the V1 layout:
213
- // callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95)
214
- payload: Bytes<128>;
224
+ // Notification payload layout version.
225
+ // Curent Layout Version: 1 (see constructSignBidirectionalEventNotificationV1)
226
+ version: Uint<8>;
227
+ // Payload containing serialised notification payload.
228
+ payload: Bytes<128>;
215
229
  }
216
230
 
217
- // Construction helper for the V1 SignBidirectionalEventNotification
231
+ // Construction helper for the V1 SignBidirectionalEventNotification.
232
+ //
233
+ // The payload is a pointer for the MPC. It names the contract that holds the
234
+ // SignBidirectionalEventMap (callerAddress) and the position of that map in the
235
+ // contract's raw on-chain state (requestsPathDepth + requestsPath). The MPC
236
+ // follows the path through the raw state tree to read the authenticated
237
+ // request, without the caller's compiled contract.
238
+ //
239
+ // Why a path: compactc packs a contract's public ledger fields into a tree of
240
+ // state values whose array nodes hold at most 15 entries (the compiler's
241
+ // maximum-ledger-segment-length). A contract with 15 or fewer ledger fields
242
+ // keeps each field directly in the root array, so field N sits at path [N]
243
+ // (depth 1). Past 15 fields the compiler splits the declaration list into
244
+ // segments of at most 15, remainder segment first, and the root array holds
245
+ // the segments. Each split adds one level to the tree and one entry to every
246
+ // field's path. Example: 20 fields split into segments of 5 and 15, so
247
+ // fields 0..4 sit at [0, 0]..[0, 4] and fields 5..19 sit at
248
+ // [1, 0]..[1, 14] (depth 2).
249
+ //
250
+ // How to determine the values: read the path from your contract's compiled
251
+ // artifacts, do not derive it by hand. The compiler records each field's
252
+ // resolved path as its "index" in managed/<contract>/compiler/contract-info.json
253
+ // (a bare number N means path [N]). The generated
254
+ // managed/<contract>/contract/index.js accessors walk the same indices, for
255
+ // example state.asArray()[1].asArray()[14] for a map recorded at [1, 14].
256
+ // Set requestsPathDepth to the number of path entries and requestsPath to
257
+ // the path itself, zero padded to 4 entries: [1, 14] becomes depth 2 and
258
+ // path [1, 14, 0, 0].
218
259
  export pure circuit constructSignBidirectionalEventNotificationV1(
219
260
  // Address of the client contract that stores and notifies of this SignBidirectionalEvent.
220
261
  // Set with kernel.self(). MUST match sender in associated SignBidirectionalEvent.
221
262
  callerAddress: ContractAddress,
222
- requestsIndexField: Uint<8>
263
+ // Number of meaningful entries in requestsPath: 1 for a flat (15 or fewer
264
+ // field) contract, one more per chunk level after that (max 4).
265
+ requestsPathDepth: Uint<8>,
266
+ // Resolved ledger-tree path of the caller's SignBidirectionalEventMap, from
267
+ // its contract-info.json "index". Entries at and beyond requestsPathDepth
268
+ // are zero.
269
+ requestsPath: Vector<4, Uint<8>>
223
270
  ): SignBidirectionalEventNotification {
224
271
  return SignBidirectionalEventNotification {
225
272
  version: 1,
226
- // 128 = 32 + 1 + 95
227
- payload: Bytes[...callerAddress.bytes, requestsIndexField, ...default<Bytes<95>>]
273
+ // 128 = 32 + 1 + 4 + 91
274
+ payload: Bytes[
275
+ ...callerAddress.bytes,
276
+ requestsPathDepth,
277
+ requestsPath[0], requestsPath[1], requestsPath[2], requestsPath[3],
278
+ ...default<Bytes<91>>
279
+ ]
228
280
  };
229
281
  }
230
282
 
@@ -270,8 +322,10 @@ module Signet {
270
322
  // signature = signSECP256k1(mpcResponseKey, attestationDigest)
271
323
  //
272
324
  // Where the MPC response key is a per-client-contract key derived using the same derivation function
273
- // as request signing keys, with the path set to the fixed "midnight response key":
274
- // mpcResponseKey = f(mpcRootKey[keyVersion], sender, "midnight response key")
325
+ // as request signing keys, with the path set to the fixed "midnight response key" (a protocol
326
+ // string that enters the derivation verbatim, unlike a request's 32 path bytes which are
327
+ // hex-encoded first):
328
+ // mpcResponseKey = f(mpcRootKey[keyVersion], caip2ChainId, sender, "midnight response key")
275
329
  //
276
330
  // Storage & Verification:
277
331
  // The execution output is of variable size, so it travels off chain, and the digest
@@ -279,19 +333,12 @@ module Signet {
279
333
  // the attestation digest and verifies the signature in-circuit via
280
334
  // verifyRespondBidirectionalEvent against its derived MPC response key. The signature
281
335
  // is the ONLY thing that distinguishes a genuine post from garbage: the Signet
282
- // singleton is an unauthenticated log and stores every post unverified.
336
+ // singleton is an unauthenticated log and emits every post unverified.
283
337
  export struct RespondBidirectionalEvent {
284
338
  // The MPC's ECDSA signature over the attestation digest.
285
339
  signature: Signature;
286
340
  }
287
341
 
288
- // SignetMapKey used to locate SignBidirectionalEventNotifications, SignatureRespondedEvent and
289
- // RespondBidirectionalEvents in Signet singleton contract storage.
290
- export struct SignetMapKey {
291
- count: Uint<64>;
292
- requestId: RequestId;
293
- };
294
-
295
342
  // Calculates the 32-byte attestation digest for a remote execution output:
296
343
  // attestationDigest = keccak256(requestId + serializedOutput)
297
344
  //
@@ -331,7 +378,7 @@ module Signet {
331
378
  // signatures, and one that is not simply fails to verify.
332
379
  //
333
380
  // Note: Client contracts must run this check before consuming outputs, as the Signet
334
- // singleton stores responses unverified.
381
+ // singleton emits responses unverified.
335
382
  export pure circuit verifyRespondBidirectionalEvent<#serializedOutputLength>(
336
383
  requestId: RequestId,
337
384
  serializedOutput: Bytes<serializedOutputLength>,
@@ -1,241 +0,0 @@
1
- import { type CompactType } from "@midnight-ntwrk/compact-runtime";
2
- import { type RequestId, type RequestIdHex } from "./signet-requests.ts";
3
- import { type RawContractState } from "./signature-state-reading.ts";
4
- /** Signet contract layout: the notification counter map is ledger field 0. */
5
- export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD = 0;
6
- /** Signet contract layout: the notification map is ledger field 1. */
7
- export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD = 1;
8
- /** Signet contract layout: the `respond` counter map is ledger field 2. */
9
- export declare const RESPOND_COUNTER_MAP_FIELD = 2;
10
- /** Signet contract layout: the `respond` post log is ledger field 3. */
11
- export declare const RESPOND_MAP_FIELD = 3;
12
- /** Signet contract layout: the respond-bidirectional counter map is ledger field 4. */
13
- export declare const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
14
- /** Signet contract layout: the respond-bidirectional map is ledger field 5. */
15
- export declare const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
16
- /**
17
- * A curve point in affine coordinates (Compact `AffinePoint`), SEC1
18
- * big-endian, the same shape the sig-net EVM and Solana signer contracts
19
- * expose.
20
- */
21
- export interface AffinePoint {
22
- /** The x coordinate, 32 big-endian bytes. */
23
- x: Uint8Array;
24
- /** The y coordinate, 32 big-endian bytes. */
25
- y: Uint8Array;
26
- }
27
- /**
28
- * The MPC's canonical ECDSA signature as both respond events store it
29
- * (Compact `Signature`, matching the MPC's own
30
- * `Signature { big_r, s, recovery_id }` and the EVM/Solana signer
31
- * contracts): `bigR` the full nonce point so consumers never decompress,
32
- * `s` big-endian, `recoveryId` the parity of R.y. Stored UNVERIFIED like
33
- * everything else on the singleton. Convert with
34
- * `ecdsaSignatureToMpcSignature` / `mpcSignatureToEcdsaSignature`.
35
- */
36
- export interface MpcSignature {
37
- /** The signature's nonce point R. */
38
- bigR: AffinePoint;
39
- /** Signature scalar s, 32 big-endian bytes. */
40
- s: Uint8Array;
41
- /** Recovery id (parity of R.y): 0 or 1. */
42
- recoveryId: bigint;
43
- }
44
- /**
45
- * The MPC's signature over the requested EVM transaction (Compact
46
- * `SignatureRespondedEvent`): decode to an ethers signature with
47
- * `signatureRespondedEventToSignature`. The request id it answers lives in
48
- * the map key.
49
- */
50
- export interface SignatureRespondedEvent {
51
- /** The requested signature over the transaction the request describes. */
52
- signature: MpcSignature;
53
- }
54
- /**
55
- * Hand-composed descriptor for {@link SignatureRespondedEvent}: the single
56
- * {@link MpcSignature} field, matching the Compact struct.
57
- */
58
- export declare const signatureRespondedEventType: CompactType<SignatureRespondedEvent>;
59
- /**
60
- * The MPC's respond-bidirectional attestation of a request's remote EVM
61
- * execution (Compact `RespondBidirectionalEvent`): the ECDSA signature over
62
- * the attestation digest `keccak256(requestId || serializedOutput)`. Both the
63
- * digest and the output travel off chain: readers fetch the output, recompute
64
- * the digest (`calculateSignetAttestationDigest`) and verify the signature
65
- * over it. Stored UNVERIFIED by the signet contract, so that signature check
66
- * against the expected MPC response key is the only thing separating a
67
- * genuine post from garbage (in-circuit via
68
- * `verifyRespondBidirectionalEvent`, off chain via
69
- * {@link verifyRespondBidirectionalSignature}).
70
- */
71
- export interface RespondBidirectionalEvent {
72
- /** ECDSA signature over the attestation digest. */
73
- signature: MpcSignature;
74
- }
75
- /**
76
- * Composite key of one posted entry in the signet contract's maps (Compact
77
- * `SignetMapKey`): the request id it belongs to plus the post's 0-based
78
- * count. Field order (count first, then request id) mirrors the Compact
79
- * struct.
80
- */
81
- export interface SignetMapKey {
82
- /** 0-based position of this post among the entries for {@link requestId}. */
83
- count: bigint;
84
- /** 32-byte id of the request this entry belongs to. */
85
- requestId: RequestId;
86
- }
87
- /**
88
- * Hand-composed descriptor for {@link SignetMapKey}, the map key of every
89
- * posted-entry map in the signet contract. Field order (count, then
90
- * requestId) must match the Compact struct.
91
- */
92
- export declare const signetMapKeyType: CompactType<SignetMapKey>;
93
- /**
94
- * Hand-composed descriptor for {@link RespondBidirectionalEvent}: the single
95
- * {@link MpcSignature} field, matching the Compact struct.
96
- */
97
- export declare const respondBidirectionalEventType: CompactType<RespondBidirectionalEvent>;
98
- /**
99
- * Raw twin of the Compact `SignBidirectionalEventNotification` struct as
100
- * stored on-ledger: the version tag plus the still-packed 128-byte payload.
101
- * Decode the payload with {@link decodeSignBidirectionalNotification}.
102
- */
103
- export interface SignBidirectionalNotificationRecord {
104
- /** Payload layout tag (Compact `Uint<8>`): 1 = the V1 layout. */
105
- version: bigint;
106
- /** The packed payload bytes, exactly as the registering circuit built them. */
107
- payload: Uint8Array;
108
- }
109
- /**
110
- * Hand-composed descriptor for {@link SignBidirectionalNotificationRecord}.
111
- * Field order (version, payload) must match the Compact struct.
112
- */
113
- export declare const signBidirectionalNotificationType: CompactType<SignBidirectionalNotificationRecord>;
114
- /**
115
- * A decoded V1 notification from the signet contract's registry: the flat
116
- * pointer a client registered to tell the MPC a request was stored, and
117
- * WHERE to read the authenticated copy. The request id is NOT in the payload:
118
- * it lives in the registry map key the record was stored under. Never trusted
119
- * on its own: the resolver authenticates by reading the request back from
120
- * {@link callerAddress}'s own ledger (see signet-request-resolver.ts).
121
- */
122
- export interface SignBidirectionalNotification {
123
- /** Payload layout tag: this decoder only produces version 1. */
124
- version: number;
125
- /**
126
- * Address of the contract whose request map holds the request, rendered
127
- * as lowercase hex, no `0x` prefix: directly usable as a
128
- * `queryContractState` argument. The MPC reads the request from THIS
129
- * contract's authenticated state. The field itself confers no authority.
130
- */
131
- callerAddress: string;
132
- /**
133
- * Ledger field position of the `SignBidirectionalEventMap` in
134
- * {@link callerAddress} (the caller contract in this repo declares it at
135
- * field 4, but the notification carries it so the reader never assumes).
136
- */
137
- requestsIndexField: number;
138
- }
139
- /**
140
- * Unpack a stored {@link SignBidirectionalNotificationRecord}'s payload by
141
- * the fixed V1 offsets: the decode twin of the compiled
142
- * `constructSignBidirectionalEventNotificationV1` circuit (byte plumbing
143
- * only: the pack↔decode lockstep is pinned by the state-reader unit test that
144
- * round-trips through the real circuit). V1 layout:
145
- * callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95).
146
- *
147
- * Fails closed on an unrecognised `version`: a future payload layout adds a
148
- * branch here rather than silently misinterpreting bytes under the V1 offsets.
149
- *
150
- * @param record - The raw on-ledger record.
151
- * @returns The decoded flat notification.
152
- * @throws Error if the record's `version` is not one this decoder understands.
153
- */
154
- export declare function decodeSignBidirectionalNotification(record: SignBidirectionalNotificationRecord): SignBidirectionalNotification;
155
- /**
156
- * Plain-JS notification registry parsed out of the ledger: hex request id
157
- * (from the `SignetMapKey` the notification was stored under) to the raw
158
- * stored record. Re-notifies append under higher counts. This index keeps
159
- * the FIRST post (count 0) per request id, the record the original submit
160
- * registered. Decode each record with
161
- * {@link decodeSignBidirectionalNotification}.
162
- */
163
- export type SignBidirectionalNotificationIndex = Map<RequestIdHex, SignBidirectionalNotificationRecord>;
164
- /**
165
- * Plain-JS counter map parsed out of the ledger: hex request id (see
166
- * {@link requestIdHex}) to the number of entries posted for that request.
167
- * Entries in the corresponding map exist for counts `0 .. value - 1`.
168
- */
169
- export type SignetCounterIndex = Map<RequestIdHex, bigint>;
170
- /**
171
- * Plain-JS signature response log parsed out of the ledger, keyed by
172
- * {@link signetMapEntryKey} (`"<hexRequestId>:<count>"`) so the composite
173
- * Compact key survives as a usable JS `Map` key.
174
- */
175
- export type SignatureResponseIndex = Map<string, SignatureRespondedEvent>;
176
- /**
177
- * Plain-JS respond-bidirectional log parsed out of the ledger, keyed by
178
- * {@link signetMapEntryKey} (`"<hexRequestId>:<count>"`).
179
- */
180
- export type RespondBidirectionalIndex = Map<string, RespondBidirectionalEvent>;
181
- /**
182
- * Build the flattened JS map key for a `(requestId, count)` pair: the
183
- * composite Compact {@link SignetMapKey} as a string so it works as a JS
184
- * `Map` key.
185
- *
186
- * @param id - The request id the entry belongs to, in canonical hex form.
187
- * @param count - 0-based post count within that request.
188
- * @returns `"<hexRequestId>:<count>"`.
189
- */
190
- export declare function signetMapEntryKey(id: RequestIdHex, count: bigint): string;
191
- /**
192
- * Read ONLY the notification registry (ledger field
193
- * {@link SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD}) out of raw signet
194
- * contract state: the poll-loop primitive of {@link SignetRequestFeed},
195
- * which cycles frequently and has no use for the response fields. One record
196
- * per request id (the count-0 post, see
197
- * {@link SignBidirectionalNotificationIndex}).
198
- *
199
- * @param raw - Raw contract state, e.g. `queryContractState(address).data`
200
- * from the indexer or `ctx.currentQueryContext.state` from the simulator.
201
- * @returns The registry, keyed by the hex request id of each entry's map key.
202
- * @throws Error if the field is missing or is not a Map.
203
- */
204
- export declare function readSignBidirectionalNotificationIndexFromState(raw: RawContractState): SignBidirectionalNotificationIndex;
205
- /**
206
- * The decoded ledger fields of the signet contract: the three
207
- * (counter map, entry map) pairs, namely notifications (fields 0/1), signature
208
- * responses (fields 2/3), respond-bidirectional responses (fields 4/5).
209
- * Together they give a poller everything the contract ever records about a
210
- * request. All entries are UNAUTHENTICATED: verify before trusting.
211
- */
212
- export interface SignetContractLedger {
213
- /** Notification post counts per request id (ledger field 0). */
214
- signBidirectionalEventNotificationCounterMap: SignetCounterIndex;
215
- /**
216
- * The notification registry (ledger field 1), one record per request id
217
- * (count-0 post).
218
- */
219
- signBidirectionalEventNotificationMap: SignBidirectionalNotificationIndex;
220
- /** `respond` post counts per request id (ledger field 2). */
221
- respondCounterMap: SignetCounterIndex;
222
- /** The `respond` post log (ledger field 3), keyed by {@link signetMapEntryKey}. */
223
- respondMap: SignatureResponseIndex;
224
- /** Respond-bidirectional post counts per request id (ledger field 4). */
225
- respondBidirectionalCounterMap: SignetCounterIndex;
226
- /** The respond-bidirectional log (ledger field 5), keyed by {@link signetMapEntryKey}. */
227
- respondBidirectionalMap: RespondBidirectionalIndex;
228
- }
229
- /**
230
- * MPC-/client-style read: parse the signet contract's ledger fields out of
231
- * raw contract state by field position alone, with no compiled contract and
232
- * no generated `ledger()`, only the declaration-order layout and the
233
- * canonical descriptors above.
234
- *
235
- * @param raw - Raw contract state, e.g. `queryContractState(address).data`
236
- * from the indexer or `ctx.currentQueryContext.state` from the simulator.
237
- * @returns The decoded {@link SignetContractLedger}.
238
- * @throws Error if a field is missing or has the wrong state-value shape.
239
- */
240
- export declare function readSignetContractLedgerFromState(raw: RawContractState): SignetContractLedger;
241
- //# sourceMappingURL=signet-contract-state-reader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,uFAAuF;AACvF,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAajD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;IACd,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,CAAC,EAAE,UAAU,CAAC;IACd,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AA2CD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,uBAAuB,CAuB5E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,yBAAyB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