@sig-net/midnight 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +9 -9
  2. package/dist/abi-serde.d.ts +89 -0
  3. package/dist/abi-serde.d.ts.map +1 -0
  4. package/dist/abi-serde.js +393 -0
  5. package/dist/abi-serde.js.map +1 -0
  6. package/dist/constants.d.ts +23 -14
  7. package/dist/constants.d.ts.map +1 -1
  8. package/dist/constants.js +28 -20
  9. package/dist/constants.js.map +1 -1
  10. package/dist/ecdsa-attestation.d.ts +38 -18
  11. package/dist/ecdsa-attestation.d.ts.map +1 -1
  12. package/dist/ecdsa-attestation.js +52 -25
  13. package/dist/ecdsa-attestation.js.map +1 -1
  14. package/dist/epsilon-derivation.js +1 -1
  15. package/dist/epsilon-derivation.js.map +1 -1
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/managed/compiler/contract-info.json +180 -122
  21. package/dist/managed/compiler/contract-manifest.json +8 -8
  22. package/dist/managed/contract/index.d.ts +38 -28
  23. package/dist/managed/contract/index.js +302 -149
  24. package/dist/managed/contract/index.js.map +1 -1
  25. package/dist/signature-requests-state-reader.d.ts +13 -13
  26. package/dist/signature-requests-state-reader.js +22 -22
  27. package/dist/signature-requests-state-reader.js.map +1 -1
  28. package/dist/signature-response-verification.d.ts +1 -1
  29. package/dist/signature-response-verification.js +3 -3
  30. package/dist/signature-response-verification.js.map +1 -1
  31. package/dist/signet-contract-state-reader.d.ts +33 -36
  32. package/dist/signet-contract-state-reader.d.ts.map +1 -1
  33. package/dist/signet-contract-state-reader.js +26 -28
  34. package/dist/signet-contract-state-reader.js.map +1 -1
  35. package/dist/signet-evtype2tx-requests.d.ts +21 -21
  36. package/dist/signet-evtype2tx-requests.js +16 -16
  37. package/dist/signet-evtype2tx-requests.js.map +1 -1
  38. package/dist/signet-request-response-reader.d.ts +23 -23
  39. package/dist/signet-request-response-reader.d.ts.map +1 -1
  40. package/dist/signet-request-response-reader.js +28 -28
  41. package/dist/signet-request-response-reader.js.map +1 -1
  42. package/dist/signet-requests.d.ts +27 -27
  43. package/dist/signet-requests.d.ts.map +1 -1
  44. package/dist/signet-requests.js +28 -29
  45. package/dist/signet-requests.js.map +1 -1
  46. package/package.json +3 -2
  47. package/src/Signet.compact +78 -63
  48. package/src/circuits.compact +45 -2
@@ -4,5 +4,5 @@
4
4
  "sourceRoot": "../../../",
5
5
  "sources": ["src/circuits.compact", "src/./Signet.compact", "compiler/zkir-v3-library.compact"],
6
6
  "names": [],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;MCoNE,MAAA,6CAWC;;OAAA;MA4ED,MAAA,uBAMC;;OAAA;MA2BD,MAAA,+BAaC;;OAAA;MAKD,MAAA,aAEC;;OAAA;MA8DD,MAAA,iBAEC;;OAAA;MAID,MAAA,cASC;;OAAA;MAID,MAAA,WAEC;;OAAA;MAMD,MAAA,gBAmBC;;OAAA;MAID,MAAA,aAKC;;OAAA;;;;GD7bF;EAxBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwBC;EEID,AAAA,yBAA8B;UACtB,iBAAI;UACJ,gCACQ;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;0CACA;;;;gDACP;;;;EAqBT,AAAA,wBACiB,WACA,OACA;UAET,oCAA2C;UAC3C,2BAAS;UAAT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oD;UACpD,gBAA8B;;;;;;;;;;;;;;;;;;;;;;+DAH9B,WAAoB;+DACpB,kBAA2B;+DAC3B,2BAAoD;+DACpD,gBAA8B;GAQ/B;;;;;;"
8
8
  }
@@ -10,16 +10,16 @@ import { type RawContractState } from "./signature-state-reading.ts";
10
10
  * fields (1 each). A stored event cell therefore holds
11
11
  * `REQUEST_FIXED_VALUE_ATOMS + maxCalldataWords
12
12
  * + maxAccessListEntries·(2 + maxStorageKeysPerEntry)`
13
- * entries (each calldata word is one Bytes<32> atom; each access-list entry is
14
- * address + storageKeyCount + its keys).
13
+ * entries (each calldata word is one Bytes<32> atom, and each access-list
14
+ * entry is address + storageKeyCount + its keys).
15
15
  */
16
16
  export declare const REQUEST_FIXED_VALUE_ATOMS = 22;
17
17
  /**
18
18
  * The decoded signet ledger fields of a requesting contract: its request
19
- * index and its contract-local request counter (Compact `Counter`, the
20
- * source of each request's `requestNonce` — nothing off-chain depends on it,
21
- * it is decoded here only because both fields travel together in tests and
22
- * diagnostics).
19
+ * index and its contract-local request counter (Compact `Counter`), the
20
+ * source of each request's `requestNonce`. Nothing off-chain depends on the
21
+ * counter: it is decoded here only because both fields travel together in
22
+ * tests and diagnostics.
23
23
  */
24
24
  export interface SignetRequestsLedger {
25
25
  /** The request counter (`Counter`). */
@@ -29,11 +29,11 @@ export interface SignetRequestsLedger {
29
29
  }
30
30
  /**
31
31
  * MPC-style read: parse the signet ledger fields out of raw contract state
32
- * by field position alone — no compiled contract, no generated `ledger()`,
33
- * only the caller-supplied field positions and the canonical descriptors
32
+ * by field position alone, with no compiled contract and no generated
33
+ * `ledger()`, only the caller-supplied field positions and the canonical descriptors
34
34
  * from signet-requests.ts. A contract chooses its own layout, so the caller
35
35
  * must know where the fields sit (the caller contract in this repo uses
36
- * index 0 / counter 1; a notification names the index position of the
36
+ * index 0 / counter 1, and a notification names the index position of the
37
37
  * contract it points at).
38
38
  *
39
39
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -47,20 +47,20 @@ export interface SignetRequestsLedger {
47
47
  export declare function readSignetRequestsLedgerFromState(raw: RawContractState, requestsIndexField: number, nonceField: number): SignetRequestsLedger;
48
48
  /**
49
49
  * Look up ONE request by id in a contract's request index at an arbitrary
50
- * ledger field — the single-record sibling of
50
+ * ledger field, the single-record sibling of
51
51
  * {@link readSignetRequestsLedgerFromState}, and what the discovery path
52
52
  * uses: a notification names both the requester contract AND which field
53
53
  * holds its index.
54
54
  *
55
55
  * This is the mandatory membership check of the discovery flow (see
56
56
  * signet-request-resolver.ts): `undefined` means the id is NOT a member of the
57
- * index at `fieldIndex` — the notification is forged, stale, points at the
58
- * wrong field, or the request is not yet indexed — and the caller MUST drop it.
57
+ * index at `fieldIndex` (the notification is forged, stale, points at the
58
+ * wrong field, or the request is not yet indexed) and the caller MUST drop it.
59
59
  * Every non-membership case (field out of range, field is not a Map, id absent,
60
60
  * a cell that fails to decode) returns `undefined` rather than throwing, so a
61
61
  * malformed or adversarial notification can never crash the reader.
62
62
  *
63
- * Only the matched record is decoded (not the whole index), and it is decoded
63
+ * Only the matched record is decoded, and it is decoded
64
64
  * by the same {@link decodeSignBidirectionalEvent} the full reader uses, so
65
65
  * the result is `toEqual` to `readSignetRequestsLedgerFromState(raw,
66
66
  * fieldIndex, …).requestsIndex.get(requestId)`.
@@ -1,13 +1,13 @@
1
1
  // MPC-style raw state reader for the signature-REQUESTS side: decode the signet
2
2
  // request ledger fields out of a contract's raw state WITHOUT the compiled
3
- // contract. This is how the MPC monitor consumes signet contracts — it has only
3
+ // contract. This is how the MPC monitor consumes signet contracts: it has only
4
4
  // a contract address, queries raw state from the indexer
5
5
  // (queryContractState(address).data), and decodes by ledger field POSITION.
6
6
  // A contract is free to place its request index at any field: the caller
7
7
  // supplies the position, which the discovery path learns from the
8
8
  // notification's requestsIndexField.
9
- // The compiled contract's generated ledger() does exactly this walk internally;
10
- // the record descriptors themselves are the parameterized twins in
9
+ // The compiled contract's generated ledger() does exactly this walk internally.
10
+ // The record descriptors themselves are the parameterised twins in
11
11
  // signet-requests.ts. The generic tree walk and shared base descriptors live
12
12
  // in signature-state-reading.ts.
13
13
  import { calculateRequestId, signBidirectionalEventDescriptor, } from "./signet-evtype2tx-requests.js";
@@ -23,26 +23,26 @@ import { requestIdType, signetFieldNode, u64, } from "./signature-state-reading.
23
23
  * fields (1 each). A stored event cell therefore holds
24
24
  * `REQUEST_FIXED_VALUE_ATOMS + maxCalldataWords
25
25
  * + maxAccessListEntries·(2 + maxStorageKeysPerEntry)`
26
- * entries (each calldata word is one Bytes<32> atom; each access-list entry is
27
- * address + storageKeyCount + its keys).
26
+ * entries (each calldata word is one Bytes<32> atom, and each access-list
27
+ * entry is address + storageKeyCount + its keys).
28
28
  */
29
29
  export const REQUEST_FIXED_VALUE_ATOMS = 22;
30
30
  /**
31
31
  * Recover a record's capacity instantiation (maxCalldataWords,
32
32
  * maxAccessListEntries, maxStorageKeysPerEntry) from its aligned-value atom
33
33
  * count and decode it. One atom count does not determine the capacities
34
- * uniquely, so candidates are enumerated — access-list-free first (today's
35
- * producers — the caller contract <1, 0, 0>, the erc20-vault example
36
- * <2, 0, 0> — all are) — and validated by the decode itself: the descriptors'
37
- * Bytes length checks and the enum range check reject wrong splits, and a
38
- * decode that leaves atoms unconsumed is rejected here.
34
+ * uniquely, so candidates are enumerated, access-list-free first (today's
35
+ * producers, the caller contract <1, 0, 0> and the erc20-vault example
36
+ * <2, 0, 0>, are all access-list-free), and validated by the decode itself:
37
+ * the descriptors' Bytes length checks and the enum range check reject wrong
38
+ * splits, and a decode that leaves atoms unconsumed is rejected here.
39
39
  *
40
40
  * The schema byte widths (`#LenOutputDeserialization`,
41
41
  * `#LenRespondSerialization`) are read from the LAST TWO atoms' actual byte
42
42
  * lengths. That works because the state layer stores atoms with trailing
43
43
  * zeros trimmed and schemas are exact-length by protocol convention (JSON
44
44
  * schema strings sized to fit, never NUL-padded, never ending in a zero
45
- * byte) — so stored length == declared length. A contract that padded its
45
+ * byte), so stored length == declared length. A contract that padded its
46
46
  * schema capacity with trailing zeros would decode to the trimmed width and
47
47
  * fail the request-id recompute, which is the authoritative check anyway.
48
48
  *
@@ -55,7 +55,7 @@ export const REQUEST_FIXED_VALUE_ATOMS = 22;
55
55
  function decodeSignBidirectionalEvent(atoms, expectedRequestId) {
56
56
  const variable = atoms.length - REQUEST_FIXED_VALUE_ATOMS;
57
57
  if (variable < 0) {
58
- throw new Error(`request record has ${atoms.length} value entries — fewer than the ` +
58
+ throw new Error(`request record has ${atoms.length} value entries: fewer than the ` +
59
59
  `${REQUEST_FIXED_VALUE_ATOMS} its fixed fields need`);
60
60
  }
61
61
  const lenOutputDeserialization = atoms[atoms.length - 2].length;
@@ -71,9 +71,9 @@ function decodeSignBidirectionalEvent(atoms, expectedRequestId) {
71
71
  return undefined;
72
72
  }
73
73
  };
74
- // Several splits can decode cleanly — an access-list entry's 20-byte address atom
75
- // re-pads into a 32-byte calldata word just as well — so only the id the record is
76
- // filed under separates them. This disambiguates; it does not authenticate (the MPC
74
+ // Several splits can decode cleanly (an access-list entry's 20-byte address atom
75
+ // re-pads into a 32-byte calldata word just as well), so only the id the record is
76
+ // filed under separates them. This disambiguates but does not authenticate (the MPC
77
77
  // recomputes against the sender-bound id before signing).
78
78
  //
79
79
  // First match wins, so the common access-list-free case stays at one decode.
@@ -106,11 +106,11 @@ function decodeSignBidirectionalEvent(atoms, expectedRequestId) {
106
106
  }
107
107
  /**
108
108
  * MPC-style read: parse the signet ledger fields out of raw contract state
109
- * by field position alone — no compiled contract, no generated `ledger()`,
110
- * only the caller-supplied field positions and the canonical descriptors
109
+ * by field position alone, with no compiled contract and no generated
110
+ * `ledger()`, only the caller-supplied field positions and the canonical descriptors
111
111
  * from signet-requests.ts. A contract chooses its own layout, so the caller
112
112
  * must know where the fields sit (the caller contract in this repo uses
113
- * index 0 / counter 1; a notification names the index position of the
113
+ * index 0 / counter 1, and a notification names the index position of the
114
114
  * contract it points at).
115
115
  *
116
116
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -144,20 +144,20 @@ export function readSignetRequestsLedgerFromState(raw, requestsIndexField, nonce
144
144
  }
145
145
  /**
146
146
  * Look up ONE request by id in a contract's request index at an arbitrary
147
- * ledger field — the single-record sibling of
147
+ * ledger field, the single-record sibling of
148
148
  * {@link readSignetRequestsLedgerFromState}, and what the discovery path
149
149
  * uses: a notification names both the requester contract AND which field
150
150
  * holds its index.
151
151
  *
152
152
  * This is the mandatory membership check of the discovery flow (see
153
153
  * signet-request-resolver.ts): `undefined` means the id is NOT a member of the
154
- * index at `fieldIndex` — the notification is forged, stale, points at the
155
- * wrong field, or the request is not yet indexed — and the caller MUST drop it.
154
+ * index at `fieldIndex` (the notification is forged, stale, points at the
155
+ * wrong field, or the request is not yet indexed) and the caller MUST drop it.
156
156
  * Every non-membership case (field out of range, field is not a Map, id absent,
157
157
  * a cell that fails to decode) returns `undefined` rather than throwing, so a
158
158
  * malformed or adversarial notification can never crash the reader.
159
159
  *
160
- * Only the matched record is decoded (not the whole index), and it is decoded
160
+ * Only the matched record is decoded, and it is decoded
161
161
  * by the same {@link decodeSignBidirectionalEvent} the full reader uses, so
162
162
  * the result is `toEqual` to `readSignetRequestsLedgerFromState(raw,
163
163
  * fieldIndex, …).requestsIndex.get(requestId)`.
@@ -1 +1 @@
1
- {"version":3,"file":"signature-requests-state-reader.js","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,yDAAyD;AACzD,4EAA4E;AAC5E,yEAAyE;AACzE,kEAAkE;AAClE,qCAAqC;AACrC,gFAAgF;AAChF,mEAAmE;AACnE,6EAA6E;AAC7E,iCAAiC;AAIjC,OAAO,EACL,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,YAAY,GAIb,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,aAAa,EACb,eAAe,EACf,GAAG,GA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DAAgD;IACpE,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACzB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,CAAC,yCAAyC;IAC7D,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QAC7B,gEAAgE;QAChE,IAAI,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACxE,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC;YACH,OAAO,4BAA4B,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC,CAAC,gDAAgD;QACpE,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,CAAC,2BAA2B;AAC/C,CAAC"}
1
+ {"version":3,"file":"signature-requests-state-reader.js","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,yDAAyD;AACzD,4EAA4E;AAC5E,yEAAyE;AACzE,kEAAkE;AAClE,qCAAqC;AACrC,gFAAgF;AAChF,mEAAmE;AACnE,6EAA6E;AAC7E,iCAAiC;AAIjC,OAAO,EACL,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,YAAY,GAIb,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,aAAa,EACb,eAAe,EACf,GAAG,GAEJ,MAAM,8BAA8B,CAAC;A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AM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACzB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,CAAC,yCAAyC;IAC7D,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QAC7B,gEAAgE;QAChE,IAAI,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACxE,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC;YACH,OAAO,4BAA4B,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC,CAAC,gDAAgD;QACpE,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,CAAC,2BAA2B;AAC/C,CAAC"}
@@ -14,7 +14,7 @@ import type { SignatureRespondedEvent } from "./signet-contract-state-reader.ts"
14
14
  export declare function recoverSignatureResponseSigner(request: SignBidirectionalEvent, response: SignatureRespondedEvent): string;
15
15
  /**
16
16
  * Verify a posted response against its request: does the signature recover
17
- * to `expectedSigner`? Never throws — a response that is malformed or signed
17
+ * to `expectedSigner`? Never throws: a response that is malformed or signed
18
18
  * by anyone else is simply not valid, which is the expected state of affairs
19
19
  * on an unauthenticated log.
20
20
  *
@@ -2,8 +2,8 @@
2
2
  // signet contract's signature response log is UNAUTHENTICATED (see "Signet
3
3
  // Layout" in Signet.compact), so a poller must verify every posted response
4
4
  // before trusting it: rebuild the unsigned EVM transaction from the on-ledger
5
- // request record — assembled exactly as the MPC assembles it (sig-net/mpc
6
- // response server, managed/erc20-vault/signet/calldata-builder.ts) — and
5
+ // request record, assembled exactly as the MPC assembles it (sig-net/mpc
6
+ // response server, managed/erc20-vault/signet/calldata-builder.ts), and
7
7
  // check that the posted signature record recovers to the requester's derived
8
8
  // EVM address over that transaction's signing hash.
9
9
  import { getAddress, recoverAddress } from "ethers";
@@ -24,7 +24,7 @@ export function recoverSignatureResponseSigner(request, response) {
24
24
  }
25
25
  /**
26
26
  * Verify a posted response against its request: does the signature recover
27
- * to `expectedSigner`? Never throws — a response that is malformed or signed
27
+ * to `expectedSigner`? Never throws: a response that is malformed or signed
28
28
  * by anyone else is simply not valid, which is the expected state of affairs
29
29
  * on an unauthenticated log.
30
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"signature-response-verification.js","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,oDAAoD;AAEpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEpD,OAAO,EACL,8CAA8C,EAC9C,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA+B,EAC/B,QAAiC;IAEjC,OAAO,cAAc,CACnB,8CAA8C,CAAC,OAAO,CAAC,CAAC,YAAY,EACpE,kCAAkC,CAAC,QAAQ,CAAC,CAC7C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAA+B,EAC/B,QAAiC,EACjC,cAAsB;IAEtB,IAAI,CAAC;QACH,OAAO,CACL,8BAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC;YACjD,UAAU,CAAC,cAAc,CAAC,CAC3B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"signature-response-verification.js","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,yEAAyE;AACzE,wEAAwE;AACxE,6EAA6E;AAC7E,oDAAoD;AAEpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEpD,OAAO,EACL,8CAA8C,EAC9C,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA+B,EAC/B,QAAiC;IAEjC,OAAO,cAAc,CACnB,8CAA8C,CAAC,OAAO,CAAC,CAAC,YAAY,EACpE,kCAAkC,CAAC,QAAQ,CAAC,CAC7C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAA+B,EAC/B,QAAiC,EACjC,cAAsB;IAEtB,IAAI,CAAC;QACH,OAAO,CACL,8BAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC;YACjD,UAAU,CAAC,cAAc,CAAC,CAC3B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -15,7 +15,7 @@ export declare const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
15
15
  export declare const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
16
16
  /**
17
17
  * A curve point in affine coordinates (Compact `AffinePoint`), SEC1
18
- * big-endian — the same shape the sig-net EVM and Solana signer contracts
18
+ * big-endian, the same shape the sig-net EVM and Solana signer contracts
19
19
  * expose.
20
20
  */
21
21
  export interface AffinePoint {
@@ -30,7 +30,7 @@ export interface AffinePoint {
30
30
  * `Signature { big_r, s, recovery_id }` and the EVM/Solana signer
31
31
  * contracts): `bigR` the full nonce point so consumers never decompress,
32
32
  * `s` big-endian, `recoveryId` the parity of R.y. Stored UNVERIFIED like
33
- * everything else on the singleton; convert with
33
+ * everything else on the singleton. Convert with
34
34
  * `ecdsaSignatureToMpcSignature` / `mpcSignatureToEcdsaSignature`.
35
35
  */
36
36
  export interface MpcSignature {
@@ -43,9 +43,9 @@ export interface MpcSignature {
43
43
  }
44
44
  /**
45
45
  * The MPC's signature over the requested EVM transaction (Compact
46
- * `SignatureRespondedEvent`) — decode to an ethers signature with
46
+ * `SignatureRespondedEvent`): decode to an ethers signature with
47
47
  * `signatureRespondedEventToSignature`. The request id it answers lives in
48
- * the map key, not here.
48
+ * the map key.
49
49
  */
50
50
  export interface SignatureRespondedEvent {
51
51
  /** The requested signature over the transaction the request describes. */
@@ -57,27 +57,25 @@ export interface SignatureRespondedEvent {
57
57
  */
58
58
  export declare const signatureRespondedEventType: CompactType<SignatureRespondedEvent>;
59
59
  /**
60
- * The MPC's respond-bidirectional response for a request's remote EVM
61
- * execution (Compact `RespondBidirectionalEvent`): the serialized execution
62
- * output plus the ECDSA signature over the attestation digest of
63
- * `(requestId, serializedOutput)`. `outputLen` is carried but NOT signed over, so
64
- * anything relying on it must pin it separately. Stored UNVERIFIED by the signet
65
- * contract — clients verify it themselves (in-circuit via
66
- * `verifyRespondBidirectionalEvent`, or off-chain via the compiled
67
- * `pureCircuits.verifyRespondBidirectionalEvent`).
60
+ * The MPC's respond-bidirectional attestation of a request's remote EVM
61
+ * execution (Compact `RespondBidirectionalEvent`): the attestation digest
62
+ * `keccak256(requestId || serializedOutput)` plus the ECDSA signature over
63
+ * it. The output itself travels off chain: readers fetch it, recompute the
64
+ * digest (`calculateSignetAttestationDigest`) and match it against
65
+ * {@link attestationDigest}. Stored UNVERIFIED by the signet contract:
66
+ * clients verify the signature themselves against their MPC response key
67
+ * (in-circuit via `verifyRespondBidirectionalEvent`).
68
68
  */
69
69
  export interface RespondBidirectionalEvent {
70
- /** ABI-encoded return data (canonical serialized_output), zero-padded to 128 bytes. */
71
- serializedOutput: Uint8Array;
72
- /** Meaningful byte count of {@link serializedOutput}. */
73
- outputLen: bigint;
70
+ /** The signed attestation digest: `keccak256(requestId || serializedOutput)`. */
71
+ attestationDigest: Uint8Array;
74
72
  /** ECDSA signature over the attestation digest. */
75
73
  signature: MpcSignature;
76
74
  }
77
75
  /**
78
76
  * Composite key of one posted entry in the signet contract's maps (Compact
79
77
  * `SignetMapKey`): the request id it belongs to plus the post's 0-based
80
- * count. Field order — count first, then request id — mirrors the Compact
78
+ * count. Field order (count first, then request id) mirrors the Compact
81
79
  * struct.
82
80
  */
83
81
  export interface SignetMapKey {
@@ -87,15 +85,14 @@ export interface SignetMapKey {
87
85
  requestId: RequestId;
88
86
  }
89
87
  /**
90
- * Hand-composed descriptor for {@link SignetMapKey} — the map key of every
88
+ * Hand-composed descriptor for {@link SignetMapKey}, the map key of every
91
89
  * posted-entry map in the signet contract. Field order (count, then
92
90
  * requestId) must match the Compact struct.
93
91
  */
94
92
  export declare const signetMapKeyType: CompactType<SignetMapKey>;
95
93
  /**
96
94
  * Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
97
- * order (serializedOutput, outputLen, signature) must match the Compact
98
- * struct.
95
+ * order (attestationDigest, signature) must match the Compact struct.
99
96
  */
100
97
  export declare const respondBidirectionalEventType: CompactType<RespondBidirectionalEvent>;
101
98
  /**
@@ -104,7 +101,7 @@ export declare const respondBidirectionalEventType: CompactType<RespondBidirecti
104
101
  * Decode the payload with {@link decodeSignBidirectionalNotification}.
105
102
  */
106
103
  export interface SignBidirectionalNotificationRecord {
107
- /** Payload layout tag (Compact `Uint<8>`); 1 = the V1 layout. */
104
+ /** Payload layout tag (Compact `Uint<8>`): 1 = the V1 layout. */
108
105
  version: bigint;
109
106
  /** The packed payload bytes, exactly as the registering circuit built them. */
110
107
  payload: Uint8Array;
@@ -116,20 +113,20 @@ export interface SignBidirectionalNotificationRecord {
116
113
  export declare const signBidirectionalNotificationType: CompactType<SignBidirectionalNotificationRecord>;
117
114
  /**
118
115
  * A decoded V1 notification from the signet contract's registry: the flat
119
- * pointer a client registered to tell the MPC a request was stored — and
116
+ * pointer a client registered to tell the MPC a request was stored, and
120
117
  * WHERE to read the authenticated copy. The request id is NOT in the payload:
121
118
  * it lives in the registry map key the record was stored under. Never trusted
122
119
  * on its own: the resolver authenticates by reading the request back from
123
120
  * {@link callerAddress}'s own ledger (see signet-request-resolver.ts).
124
121
  */
125
122
  export interface SignBidirectionalNotification {
126
- /** Payload layout tag; this decoder only produces version 1. */
123
+ /** Payload layout tag: this decoder only produces version 1. */
127
124
  version: number;
128
125
  /**
129
126
  * Address of the contract whose request map holds the request, rendered
130
- * as lowercase hex, no `0x` prefix — directly usable as a
127
+ * as lowercase hex, no `0x` prefix: directly usable as a
131
128
  * `queryContractState` argument. The MPC reads the request from THIS
132
- * contract's authenticated state; the field itself confers no authority.
129
+ * contract's authenticated state. The field itself confers no authority.
133
130
  */
134
131
  callerAddress: string;
135
132
  /**
@@ -141,9 +138,9 @@ export interface SignBidirectionalNotification {
141
138
  }
142
139
  /**
143
140
  * Unpack a stored {@link SignBidirectionalNotificationRecord}'s payload by
144
- * the fixed V1 offsets — the decode twin of the compiled
141
+ * the fixed V1 offsets: the decode twin of the compiled
145
142
  * `constructSignBidirectionalEventNotificationV1` circuit (byte plumbing
146
- * only; the pack↔decode lockstep is pinned by the state-reader unit test that
143
+ * only: the pack↔decode lockstep is pinned by the state-reader unit test that
147
144
  * round-trips through the real circuit). V1 layout:
148
145
  * callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95).
149
146
  *
@@ -158,8 +155,8 @@ export declare function decodeSignBidirectionalNotification(record: SignBidirect
158
155
  /**
159
156
  * Plain-JS notification registry parsed out of the ledger: hex request id
160
157
  * (from the `SignetMapKey` the notification was stored under) to the raw
161
- * stored record. Re-notifies append under higher counts; this index keeps
162
- * the FIRST post (count 0) per request id — the record the original submit
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
163
160
  * registered. Decode each record with
164
161
  * {@link decodeSignBidirectionalNotification}.
165
162
  */
@@ -182,7 +179,7 @@ export type SignatureResponseIndex = Map<string, SignatureRespondedEvent>;
182
179
  */
183
180
  export type RespondBidirectionalIndex = Map<string, RespondBidirectionalEvent>;
184
181
  /**
185
- * Build the flattened JS map key for a `(requestId, count)` pair — the
182
+ * Build the flattened JS map key for a `(requestId, count)` pair: the
186
183
  * composite Compact {@link SignetMapKey} as a string so it works as a JS
187
184
  * `Map` key.
188
185
  *
@@ -194,9 +191,9 @@ export declare function signetMapEntryKey(id: RequestIdHex, count: bigint): stri
194
191
  /**
195
192
  * Read ONLY the notification registry (ledger field
196
193
  * {@link SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD}) out of raw signet
197
- * contract state — the poll-loop primitive of {@link SignetRequestFeed},
194
+ * contract state: the poll-loop primitive of {@link SignetRequestFeed},
198
195
  * which cycles frequently and has no use for the response fields. One record
199
- * per request id (the count-0 post; see
196
+ * per request id (the count-0 post, see
200
197
  * {@link SignBidirectionalNotificationIndex}).
201
198
  *
202
199
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -207,7 +204,7 @@ export declare function signetMapEntryKey(id: RequestIdHex, count: bigint): stri
207
204
  export declare function readSignBidirectionalNotificationIndexFromState(raw: RawContractState): SignBidirectionalNotificationIndex;
208
205
  /**
209
206
  * The decoded ledger fields of the signet contract: the three
210
- * (counter map, entry map) pairs — notifications (fields 0/1), signature
207
+ * (counter map, entry map) pairs, namely notifications (fields 0/1), signature
211
208
  * responses (fields 2/3), respond-bidirectional responses (fields 4/5).
212
209
  * Together they give a poller everything the contract ever records about a
213
210
  * request. All entries are UNAUTHENTICATED: verify before trusting.
@@ -231,9 +228,9 @@ export interface SignetContractLedger {
231
228
  }
232
229
  /**
233
230
  * MPC-/client-style read: parse the signet contract's ledger fields out of
234
- * raw contract state by field position alone — no compiled contract, no
235
- * generated `ledger()`, only the declaration-order layout and the canonical
236
- * descriptors above.
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.
237
234
  *
238
235
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
239
236
  * from the indexer or `ctx.currentQueryContext.state` from the simulator.
@@ -1 +1 @@
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;AAgBjD;;;;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;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M,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzE;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,+CAA+C,CAC7D,GAAG,EAAE,gBAAgB,GACpB,kCAAkC,CAyBpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,4CAA4C,EAAE,kBAAkB,CAAC;IACjE;;;OAGG;IACH,qCAAqC,EAAE,kCAAkC,CAAC;IAC1E,6DAA6D;IAC7D,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,mFAAmF;IACnF,UAAU,EAAE,sBAAsB,CAAC;IACnC,yEAAyE;IACzE,8BAA8B,EAAE,kBAAkB,CAAC;IACnD,0FAA0F;IAC1F,uBAAuB,EAAE,yBAAyB,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,CA2BtB"}
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,C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AAsB,CAAC;IACnC,yEAAyE;IACzE,8BAA8B,EAAE,kBAAkB,CAAC;IACnD,0FAA0F;IAC1F,uBAAuB,EAAE,yBAAyB,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,CA2BtB"}
@@ -11,7 +11,7 @@
11
11
  // field 4: respondBidirectionalCounterMap (Map<RequestId, Counter>)
12
12
  // field 5: respondBidirectionalMap (Map<SignetMapKey, RespondBidirectionalEvent>)
13
13
  // Every store is an unauthenticated append-only log keyed by
14
- // (requestId, count); verification is the reader's job. The generic
14
+ // (requestId, count): verification is the reader's job. The generic
15
15
  // state-tree walk (RawContractState, signetFieldNode) and the shared base
16
16
  // descriptors live in signature-state-reading.ts.
17
17
  import { CompactTypeBytes, CompactTypeUnsignedInteger, } from "@midnight-ntwrk/compact-runtime";
@@ -32,10 +32,8 @@ export const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
32
32
  // ---- Type descriptors (must mirror Signet.compact field-for-field) ----
33
33
  // As in the requests reader, fromValue consumes the aligned value
34
34
  // sequentially, so field order and width here must match the Compact structs
35
- // exactly — a mismatch is silent data corruption, not an error.
36
- /** Descriptor for the response's serialized output (`Bytes<128>`). */
37
- const bytes128 = new CompactTypeBytes(128);
38
- /** Descriptor for a 32-byte scalar / coordinate (`Bytes<32>`). */
35
+ // exactly: a mismatch is silent data corruption, not an error.
36
+ /** Descriptor for a 32-byte scalar / coordinate / hash (`Bytes<32>`). */
39
37
  const bytes32 = new CompactTypeBytes(32);
40
38
  /** Descriptor for a Compact `Uint<8>` (1-byte unsigned integer). */
41
39
  const u8 = new CompactTypeUnsignedInteger(255n, 1);
@@ -55,7 +53,7 @@ const mpcSignatureType = {
55
53
  /**
56
54
  * Decode one signature from an aligned value, consuming it leaf by leaf.
57
55
  *
58
- * @param value - Mutable aligned value cursor; pass a copy.
56
+ * @param value - Mutable aligned value cursor: pass a copy.
59
57
  * @returns The decoded signature.
60
58
  */
61
59
  fromValue(value) {
@@ -91,7 +89,7 @@ export const signatureRespondedEventType = {
91
89
  /**
92
90
  * Decode one signature response from an aligned value.
93
91
  *
94
- * @param value - Mutable aligned value cursor; pass a copy.
92
+ * @param value - Mutable aligned value cursor: pass a copy.
95
93
  * @returns The decoded record.
96
94
  */
97
95
  fromValue(value) {
@@ -108,7 +106,7 @@ export const signatureRespondedEventType = {
108
106
  },
109
107
  };
110
108
  /**
111
- * Hand-composed descriptor for {@link SignetMapKey} — the map key of every
109
+ * Hand-composed descriptor for {@link SignetMapKey}, the map key of every
112
110
  * posted-entry map in the signet contract. Field order (count, then
113
111
  * requestId) must match the Compact struct.
114
112
  */
@@ -120,7 +118,7 @@ export const signetMapKeyType = {
120
118
  /**
121
119
  * Decode one key from an aligned value, consuming it field by field.
122
120
  *
123
- * @param value - Mutable aligned value cursor; pass a copy.
121
+ * @param value - Mutable aligned value cursor: pass a copy.
124
122
  * @returns The decoded composite key.
125
123
  */
126
124
  fromValue(value) {
@@ -141,28 +139,25 @@ export const signetMapKeyType = {
141
139
  };
142
140
  /**
143
141
  * Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
144
- * order (serializedOutput, outputLen, signature) must match the Compact
145
- * struct.
142
+ * order (attestationDigest, signature) must match the Compact struct.
146
143
  */
147
144
  export const respondBidirectionalEventType = {
148
145
  /** @returns Compound alignment of the struct's fields in declaration order. */
149
146
  alignment() {
150
- return bytes128
147
+ return bytes32
151
148
  .alignment()
152
- .concat(u8.alignment())
153
149
  .concat(mpcSignatureType.alignment());
154
150
  },
155
151
  /**
156
152
  * Decode one response record from an aligned value, consuming it field
157
153
  * by field.
158
154
  *
159
- * @param value - Mutable aligned value cursor; pass a copy.
155
+ * @param value - Mutable aligned value cursor: pass a copy.
160
156
  * @returns The decoded record.
161
157
  */
162
158
  fromValue(value) {
163
159
  return {
164
- serializedOutput: bytes128.fromValue(value),
165
- outputLen: u8.fromValue(value),
160
+ attestationDigest: bytes32.fromValue(value),
166
161
  signature: mpcSignatureType.fromValue(value),
167
162
  };
168
163
  },
@@ -173,9 +168,8 @@ export const respondBidirectionalEventType = {
173
168
  * @returns The aligned value, fields concatenated in declaration order.
174
169
  */
175
170
  toValue(record) {
176
- return bytes128
177
- .toValue(record.serializedOutput)
178
- .concat(u8.toValue(record.outputLen))
171
+ return bytes32
172
+ .toValue(record.attestationDigest)
179
173
  .concat(mpcSignatureType.toValue(record.signature));
180
174
  },
181
175
  };
@@ -194,7 +188,7 @@ export const signBidirectionalNotificationType = {
194
188
  * Decode one notification record from an aligned value, consuming it
195
189
  * field by field.
196
190
  *
197
- * @param value - Mutable aligned value cursor; pass a copy.
191
+ * @param value - Mutable aligned value cursor: pass a copy.
198
192
  * @returns The decoded record.
199
193
  */
200
194
  fromValue(value) {
@@ -223,9 +217,9 @@ const NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET = 32;
223
217
  const SUPPORTED_NOTIFICATION_VERSION = 1n;
224
218
  /**
225
219
  * Unpack a stored {@link SignBidirectionalNotificationRecord}'s payload by
226
- * the fixed V1 offsets — the decode twin of the compiled
220
+ * the fixed V1 offsets: the decode twin of the compiled
227
221
  * `constructSignBidirectionalEventNotificationV1` circuit (byte plumbing
228
- * only; the pack↔decode lockstep is pinned by the state-reader unit test that
222
+ * only: the pack↔decode lockstep is pinned by the state-reader unit test that
229
223
  * round-trips through the real circuit). V1 layout:
230
224
  * callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95).
231
225
  *
@@ -243,6 +237,10 @@ export function decodeSignBidirectionalNotification(record) {
243
237
  }
244
238
  const callerAddress = bytesToHex(record.payload.slice(NOTIFICATION_CALLER_ADDRESS_OFFSET, NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET));
245
239
  const requestsIndexField = record.payload[NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET];
240
+ if (requestsIndexField === undefined) {
241
+ throw new Error(`SignBidirectionalEventNotification payload is ${record.payload.length} bytes: ` +
242
+ `too short for the V1 requestsIndexField at offset ${NOTIFICATION_REQUESTS_INDEX_FIELD_OFFSET}`);
243
+ }
246
244
  return {
247
245
  version: Number(record.version),
248
246
  callerAddress,
@@ -250,7 +248,7 @@ export function decodeSignBidirectionalNotification(record) {
250
248
  };
251
249
  }
252
250
  /**
253
- * Build the flattened JS map key for a `(requestId, count)` pair — the
251
+ * Build the flattened JS map key for a `(requestId, count)` pair: the
254
252
  * composite Compact {@link SignetMapKey} as a string so it works as a JS
255
253
  * `Map` key.
256
254
  *
@@ -298,9 +296,9 @@ function readSignetKeyedMap(raw, field, valueType) {
298
296
  /**
299
297
  * Read ONLY the notification registry (ledger field
300
298
  * {@link SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD}) out of raw signet
301
- * contract state — the poll-loop primitive of {@link SignetRequestFeed},
299
+ * contract state: the poll-loop primitive of {@link SignetRequestFeed},
302
300
  * which cycles frequently and has no use for the response fields. One record
303
- * per request id (the count-0 post; see
301
+ * per request id (the count-0 post, see
304
302
  * {@link SignBidirectionalNotificationIndex}).
305
303
  *
306
304
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -333,9 +331,9 @@ export function readSignBidirectionalNotificationIndexFromState(raw) {
333
331
  }
334
332
  /**
335
333
  * MPC-/client-style read: parse the signet contract's ledger fields out of
336
- * raw contract state by field position alone — no compiled contract, no
337
- * generated `ledger()`, only the declaration-order layout and the canonical
338
- * descriptors above.
334
+ * raw contract state by field position alone, with no compiled contract and
335
+ * no generated `ledger()`, only the declaration-order layout and the
336
+ * canonical descriptors above.
339
337
  *
340
338
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
341
339
  * from the indexer or `ctx.currentQueryContext.state` from the simulator.