@sig-net/midnight 0.10.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 (52) hide show
  1. package/README.md +17 -17
  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 +81 -9
  11. package/dist/ecdsa-attestation.d.ts.map +1 -1
  12. package/dist/ecdsa-attestation.js +137 -18
  13. package/dist/ecdsa-attestation.js.map +1 -1
  14. package/dist/epsilon-derivation.d.ts +8 -8
  15. package/dist/epsilon-derivation.d.ts.map +1 -1
  16. package/dist/epsilon-derivation.js +16 -18
  17. package/dist/epsilon-derivation.js.map +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/managed/compiler/contract-info.json +180 -104
  23. package/dist/managed/compiler/contract-manifest.json +8 -8
  24. package/dist/managed/contract/index.d.ts +38 -24
  25. package/dist/managed/contract/index.js +363 -154
  26. package/dist/managed/contract/index.js.map +1 -1
  27. package/dist/signature-requests-state-reader.d.ts +15 -15
  28. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  29. package/dist/signature-requests-state-reader.js +51 -34
  30. package/dist/signature-requests-state-reader.js.map +1 -1
  31. package/dist/signature-response-verification.d.ts +2 -2
  32. package/dist/signature-response-verification.js +8 -8
  33. package/dist/signature-response-verification.js.map +1 -1
  34. package/dist/signet-contract-state-reader.d.ts +74 -58
  35. package/dist/signet-contract-state-reader.d.ts.map +1 -1
  36. package/dist/signet-contract-state-reader.js +76 -58
  37. package/dist/signet-contract-state-reader.js.map +1 -1
  38. package/dist/signet-evtype2tx-requests.d.ts +62 -59
  39. package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
  40. package/dist/signet-evtype2tx-requests.js +58 -90
  41. package/dist/signet-evtype2tx-requests.js.map +1 -1
  42. package/dist/signet-request-response-reader.d.ts +26 -26
  43. package/dist/signet-request-response-reader.d.ts.map +1 -1
  44. package/dist/signet-request-response-reader.js +37 -37
  45. package/dist/signet-request-response-reader.js.map +1 -1
  46. package/dist/signet-requests.d.ts +30 -30
  47. package/dist/signet-requests.d.ts.map +1 -1
  48. package/dist/signet-requests.js +29 -30
  49. package/dist/signet-requests.js.map +1 -1
  50. package/package.json +3 -2
  51. package/src/Signet.compact +137 -88
  52. 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;;;;;;;;;;MCkNE,MAAA,6CAWC;;OAAA;MA0DD,MAAA,uBAUC;;OAAA;MAQD,MAAA,+BAiBC;;OAAA;MAKD,MAAA,aAEC;;OAAA;MA2DD,MAAA,iBAEC;;OAAA;MAID,MAAA,cASC;;OAAA;MAID,MAAA,WAEC;;OAAA;MAMD,MAAA,gBAmBC;;OAAA;MAID,MAAA,aAKC;;OAAA;;;;GD3ZF;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;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mDAG5B,WAAS;mDACT,kBAAgB;mDAChB,2BAAyB;mDACzB,gBAAc;GAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;ECmJC,AAAA,6CAWC;;;;UARC,eAA8B;UAC9B,oBAA2B;;;;;;;;;;;;;;;2EAD3B,eAA8B;2EAC9B,oBAA2B;GAO5B;EA8ID,AAAA,aAEC;;;;UAFiC,IAAkB;2CAAlB,IAAkB;GAEnD;EA6DD,AAAA,iBAEC;;;;UAFqC,MAAe;;;;;;;;+CAAf,MAAe;GAEpD;EAID,AAAA,cASC;;;;UATkC,OAAgB;;;;;;;;4CAAhB,OAAgB;GASlD;EAID,AAAA,WAEC;;;;UAF+B,OAAc;;;;;;;;yCAAd,OAAc;GAE7C;EAMD,AAAA,gBAmBC;;;;UAnBoC,MAAe;;;;;;;;8CAAf,MAAe;GAmBnD;EAID,AAAA,aAKC;;;;UALiC,MAAe;;;;;;;;2CAAf,MAAe;GAKhD;EDncH,AAAA,iCAKC;;;;UAJC,WAAoB;UACpB,kBAA0B;;;;;;;;;;;;;;;+DAD1B,WAAoB;+DACpB,kBAA0B;GAG3B;EAED,AAAA,kCAKC;;;;UAJC,WAAoB;UACpB,kBAA2B;;;;;;;;;;;;;;;gEAD3B,WAAoB;gEACpB,kBAA2B;GAG5B;EAED,AAAA,mCAKC;;;;UAJC,WAAoB;UACpB,kBAA4B;;;;;;;;;;;;;;;iEAD5B,WAAoB;iEACpB,kBAA4B;GAG7B;EAED,AAAA,iCAYC;;;;UAXC,WAAoB;UACpB,kBAA2B;UAC3B,2BAAoD;UACpD,gBAA8B;;;;;;;;;;;;;;;;;;;;;;+DAH9B,WAAoB;+DACpB,kBAA2B;+DAC3B,2BAAoD;+DACpD,gBAA8B;GAQ/B;;;;;;"
8
8
  }
@@ -4,22 +4,22 @@ import { type RawContractState } from "./signature-state-reading.ts";
4
4
  * Aligned-value entry count of an event record EXCLUDING the capacity-scaled
5
5
  * vectors: sender (1) + requestNonce (1) + keyVersion (1) + path (1) +
6
6
  * algo (1) + dest (1) + params (1) + txParamType (1, enums are one atom
7
- * whatever their byte width) + the EVMType2TxParams fixed fields
8
- * (to..value = 7, accessListEntryCount = 1) + the calldata Maybe's
7
+ * whatever their byte width) + the EvmType2TxParams fixed fields
8
+ * (chainId..value = 7, accessListEntryCount = 1) + the calldata Maybe's
9
9
  * is_some (1), selector (1) and noWords (1) + caip2Id (1) + the two schema
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 +1 @@
1
- {"version":3,"file":"signature-requests-state-reader.d.ts","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AA4E5C;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,EACrB,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAwBtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,gBAAgB,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,YAAY,GACtB,sBAAsB,GAAG,SAAS,CA2BpC"}
1
+ {"version":3,"file":"signature-requests-state-reader.d.ts","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AA6F5C;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,EACrB,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAqBtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,gBAAgB,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,YAAY,GACtB,sBAAsB,GAAG,SAAS,CA2BpC"}
@@ -1,59 +1,61 @@
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
- import { signBidirectionalEventDescriptor } from "./signet-evtype2tx-requests.js";
13
+ import { calculateRequestId, signBidirectionalEventDescriptor, } from "./signet-evtype2tx-requests.js";
14
14
  import { requestIdHex, } from "./signet-requests.js";
15
15
  import { requestIdType, signetFieldNode, u64, } from "./signature-state-reading.js";
16
16
  /**
17
17
  * Aligned-value entry count of an event record EXCLUDING the capacity-scaled
18
18
  * vectors: sender (1) + requestNonce (1) + keyVersion (1) + path (1) +
19
19
  * algo (1) + dest (1) + params (1) + txParamType (1, enums are one atom
20
- * whatever their byte width) + the EVMType2TxParams fixed fields
21
- * (to..value = 7, accessListEntryCount = 1) + the calldata Maybe's
20
+ * whatever their byte width) + the EvmType2TxParams fixed fields
21
+ * (chainId..value = 7, accessListEntryCount = 1) + the calldata Maybe's
22
22
  * is_some (1), selector (1) and noWords (1) + caip2Id (1) + the two schema
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
  *
49
49
  * @param atoms - The record cell's aligned value (a fresh copy per attempt).
50
+ * @param expectedRequestId - The id the record is stored under, used to pick
51
+ * between splits when more than one decodes cleanly.
50
52
  * @returns The decoded record.
51
53
  * @throws Error if no capacity split decodes the value cleanly.
52
54
  */
53
- function decodeSignBidirectionalEvent(atoms) {
55
+ function decodeSignBidirectionalEvent(atoms, expectedRequestId) {
54
56
  const variable = atoms.length - REQUEST_FIXED_VALUE_ATOMS;
55
57
  if (variable < 0) {
56
- 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 ` +
57
59
  `${REQUEST_FIXED_VALUE_ATOMS} its fixed fields need`);
58
60
  }
59
61
  const lenOutputDeserialization = atoms[atoms.length - 2].length;
@@ -69,31 +71,46 @@ function decodeSignBidirectionalEvent(atoms) {
69
71
  return undefined;
70
72
  }
71
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 but does not authenticate (the MPC
77
+ // recomputes against the sender-bound id before signing).
78
+ //
79
+ // First match wins, so the common access-list-free case stays at one decode.
80
+ // `fallback` preserves the pre-recompute behaviour when no split matches the id.
81
+ let fallback;
82
+ const take = (record) => {
83
+ if (record === undefined)
84
+ return false;
85
+ fallback ??= record;
86
+ return requestIdHex(calculateRequestId(record)) === expectedRequestId;
87
+ };
72
88
  // No access list: variable atoms are calldata words alone (one atom each).
73
- {
74
- const record = attempt(variable, 0, 0);
75
- if (record !== undefined)
76
- return record;
77
- }
89
+ const accessListFree = attempt(variable, 0, 0);
90
+ if (take(accessListFree))
91
+ return accessListFree;
78
92
  // With an access list: E entries of (2 + K) atoms, the rest words.
79
93
  for (let entries = 1; entries * 2 <= variable; entries++) {
80
94
  for (let keys = 0; entries * (2 + keys) <= variable; keys++) {
81
95
  const words = variable - entries * (2 + keys);
82
96
  const record = attempt(words, entries, keys);
83
- if (record !== undefined)
97
+ if (take(record))
84
98
  return record;
85
99
  }
86
100
  }
87
- throw new Error(`request record with ${atoms.length} value entries matches no ` +
88
- `(calldata words, access-list entries, storage keys) capacity split`);
101
+ if (fallback === undefined) {
102
+ throw new Error(`request record with ${atoms.length} value entries matches no ` +
103
+ `(calldata words, access-list entries, storage keys) capacity split`);
104
+ }
105
+ return fallback;
89
106
  }
90
107
  /**
91
108
  * MPC-style read: parse the signet ledger fields out of raw contract state
92
- * by field position alone — no compiled contract, no generated `ledger()`,
93
- * 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
94
111
  * from signet-requests.ts. A contract chooses its own layout, so the caller
95
112
  * must know where the fields sit (the caller contract in this repo uses
96
- * 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
97
114
  * contract it points at).
98
115
  *
99
116
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -112,11 +129,11 @@ export function readSignetRequestsLedgerFromState(raw, requestsIndexField, nonce
112
129
  const requestsIndex = new Map();
113
130
  for (const key of map.keys()) {
114
131
  // fromValue consumes its input, so hand each descriptor a copy.
115
- const requestId = requestIdType.fromValue([...key.value]);
132
+ const requestId = requestIdHex(requestIdType.fromValue([...key.value]));
116
133
  const cell = map.get(key)?.asCell();
117
134
  if (cell === undefined)
118
135
  continue;
119
- requestsIndex.set(requestIdHex(requestId), decodeSignBidirectionalEvent(cell.value));
136
+ requestsIndex.set(requestId, decodeSignBidirectionalEvent(cell.value, requestId));
120
137
  }
121
138
  const nonceCell = signetFieldNode(raw, nonceField).asCell();
122
139
  if (nonceCell === undefined) {
@@ -127,20 +144,20 @@ export function readSignetRequestsLedgerFromState(raw, requestsIndexField, nonce
127
144
  }
128
145
  /**
129
146
  * Look up ONE request by id in a contract's request index at an arbitrary
130
- * ledger field — the single-record sibling of
147
+ * ledger field, the single-record sibling of
131
148
  * {@link readSignetRequestsLedgerFromState}, and what the discovery path
132
149
  * uses: a notification names both the requester contract AND which field
133
150
  * holds its index.
134
151
  *
135
152
  * This is the mandatory membership check of the discovery flow (see
136
153
  * signet-request-resolver.ts): `undefined` means the id is NOT a member of the
137
- * index at `fieldIndex` — the notification is forged, stale, points at the
138
- * 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.
139
156
  * Every non-membership case (field out of range, field is not a Map, id absent,
140
157
  * a cell that fails to decode) returns `undefined` rather than throwing, so a
141
158
  * malformed or adversarial notification can never crash the reader.
142
159
  *
143
- * 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
144
161
  * by the same {@link decodeSignBidirectionalEvent} the full reader uses, so
145
162
  * the result is `toEqual` to `readSignetRequestsLedgerFromState(raw,
146
163
  * fieldIndex, …).requestsIndex.get(requestId)`.
@@ -172,7 +189,7 @@ export function lookupSignetRequestAt(raw, fieldIndex, requestId) {
172
189
  return undefined;
173
190
  }
174
191
  try {
175
- return decodeSignBidirectionalEvent(cell.value);
192
+ return decodeSignBidirectionalEvent(cell.value, requestId);
176
193
  }
177
194
  catch {
178
195
  return undefined; // a cell that is not a decodable request record
@@ -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,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EACL,YAAY,GAIb,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,aAAa,EACb,eAAe,EACf,GAAG,GAEJ,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,4BAA4B,CACnC,KAAmB;IAEnB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,yBAAyB,CAAC;IAC1D,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,sBAAsB,KAAK,C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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;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAS,4BAA4B,CACnC,KAAmB,EACnB,iBAA+B;IAE/B,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,yBAAyB,CAAC;IAC1D,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,sBAAsB,KAAK,CAAC,MAAM,iCAAiC;YACjE,GAAG,yBAAyB,wBAAwB,CACvD,CAAC;IACJ,CAAC;IACD,MAAM,wBAAwB,GAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAgB,CAAC,MAAM,CAAC;IAChF,MAAM,uBAAuB,GAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAgB,CAAC,MAAM,CAAC;IAC/E,MAAM,OAAO,GAAG,CACd,QAAgB,EAChB,UAAkB,EAClB,OAAe,EACqB,EAAE;QACtC,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAiB,CAAC;QAC1C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,gCAAgC,CAC7C,QAAQ,EACR,UAAU,EACV,OAAO,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./signet-contract-state-reader.ts"
9
9
  * @returns The checksummed recovered signer address.
10
10
  * @throws Error if the response is not a decodable signature or the request
11
11
  * record is malformed (see
12
- * {@link signBidirectionalEventToUnsignedEVMTransaction}).
12
+ * {@link signBidirectionalEventToUnsignedEvmTransaction}).
13
13
  */
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,12 +2,12 @@
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
7
- // check that the posted `{ bigR, s, recoveryId }` signature recovers to the
8
- // requester's derived EVM address over that transaction's signing hash.
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
+ // check that the posted signature record recovers to the requester's derived
8
+ // EVM address over that transaction's signing hash.
9
9
  import { getAddress, recoverAddress } from "ethers";
10
- import { signBidirectionalEventToUnsignedEVMTransaction, signatureRespondedEventToSignature, } from "./signet-evtype2tx-requests.js";
10
+ import { signBidirectionalEventToUnsignedEvmTransaction, signatureRespondedEventToSignature, } from "./signet-evtype2tx-requests.js";
11
11
  /**
12
12
  * Recover the EVM address that produced a response signature, over the
13
13
  * signing hash of the transaction the request describes.
@@ -17,14 +17,14 @@ import { signBidirectionalEventToUnsignedEVMTransaction, signatureRespondedEvent
17
17
  * @returns The checksummed recovered signer address.
18
18
  * @throws Error if the response is not a decodable signature or the request
19
19
  * record is malformed (see
20
- * {@link signBidirectionalEventToUnsignedEVMTransaction}).
20
+ * {@link signBidirectionalEventToUnsignedEvmTransaction}).
21
21
  */
22
22
  export function recoverSignatureResponseSigner(request, response) {
23
- return recoverAddress(signBidirectionalEventToUnsignedEVMTransaction(request).unsignedHash, signatureRespondedEventToSignature(response));
23
+ return recoverAddress(signBidirectionalEventToUnsignedEvmTransaction(request).unsignedHash, signatureRespondedEventToSignature(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,4EAA4E;AAC5E,wEAAwE;AAExE,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"}
@@ -5,60 +5,77 @@ import { type RawContractState } from "./signature-state-reading.ts";
5
5
  export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD = 0;
6
6
  /** Signet contract layout: the notification map is ledger field 1. */
7
7
  export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD = 1;
8
- /** Signet contract layout: the signature response counter map is ledger field 2. */
9
- export declare const SIGNATURE_RESPONSE_COUNTER_MAP_FIELD = 2;
10
- /** Signet contract layout: the signature response map is ledger field 3. */
11
- export declare const SIGNATURE_RESPONSE_MAP_FIELD = 3;
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
12
  /** Signet contract layout: the respond-bidirectional counter map is ledger field 4. */
13
13
  export declare const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
14
14
  /** Signet contract layout: the respond-bidirectional map is ledger field 5. */
15
15
  export declare const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
16
16
  /**
17
- * The MPC's secp256k1 signature over the requested EVM transaction (Compact
18
- * `SignatureRespondedEvent` — the canonical MPC `Signature { big_r, s,
19
- * recovery_id }` with `big_r` decomposed into affine coordinates, big-endian
20
- * scalar bytes). The request id it answers lives in the map key, not here.
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.
21
20
  */
22
- export interface SignatureRespondedEvent {
23
- /** Signature R.x, 32 big-endian bytes. */
24
- bigRx: Uint8Array;
25
- /** Signature R.y, 32 big-endian bytes. */
26
- bigRy: Uint8Array;
27
- /** Signature s, 32 big-endian bytes. */
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. */
28
40
  s: Uint8Array;
29
- /** Parity of R.y for public-key recovery (0 or 1). */
41
+ /** Recovery id (parity of R.y): 0 or 1. */
30
42
  recoveryId: bigint;
31
43
  }
32
44
  /**
33
- * Hand-composed descriptor for {@link SignatureRespondedEvent}. Field
34
- * order (bigRx, bigRy, s, recoveryId) must match the Compact struct.
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.
35
57
  */
36
58
  export declare const signatureRespondedEventType: CompactType<SignatureRespondedEvent>;
37
59
  /**
38
- * The MPC's respond-bidirectional response for a request's remote EVM
39
- * execution (Compact `RespondBidirectionalEvent`): the serialized execution
40
- * output plus the ECDSA signature over the attestation digest of
41
- * `(requestId, serializedOutput, outputLen)`. Stored UNVERIFIED by the signet
42
- * contract — clients verify it themselves (in-circuit via
43
- * `verifyRespondBidirectionalEvent`, or off-chain via the compiled
44
- * `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`).
45
68
  */
46
69
  export interface RespondBidirectionalEvent {
47
- /** ABI-encoded return data (canonical serialized_output), zero-padded to 128 bytes. */
48
- serializedOutput: Uint8Array;
49
- /** Meaningful byte count of {@link serializedOutput}. */
50
- outputLen: bigint;
51
- /** Signature scalar r (= R.x mod n), 32 LITTLE-endian bytes (the `Secp256k1Scalar as Bytes<32>` cast). */
52
- r: Uint8Array;
53
- /** Signature scalar s, 32 LITTLE-endian bytes. */
54
- s: Uint8Array;
55
- /** Recovery id (parity of R.y), for off-chain public-key recovery. */
56
- recoveryId: bigint;
70
+ /** The signed attestation digest: `keccak256(requestId || serializedOutput)`. */
71
+ attestationDigest: Uint8Array;
72
+ /** ECDSA signature over the attestation digest. */
73
+ signature: MpcSignature;
57
74
  }
58
75
  /**
59
76
  * Composite key of one posted entry in the signet contract's maps (Compact
60
77
  * `SignetMapKey`): the request id it belongs to plus the post's 0-based
61
- * count. Field order — count first, then request id — mirrors the Compact
78
+ * count. Field order (count first, then request id) mirrors the Compact
62
79
  * struct.
63
80
  */
64
81
  export interface SignetMapKey {
@@ -68,15 +85,14 @@ export interface SignetMapKey {
68
85
  requestId: RequestId;
69
86
  }
70
87
  /**
71
- * Hand-composed descriptor for {@link SignetMapKey} — the map key of every
88
+ * Hand-composed descriptor for {@link SignetMapKey}, the map key of every
72
89
  * posted-entry map in the signet contract. Field order (count, then
73
90
  * requestId) must match the Compact struct.
74
91
  */
75
92
  export declare const signetMapKeyType: CompactType<SignetMapKey>;
76
93
  /**
77
94
  * Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
78
- * order (serializedOutput, outputLen, r, s, recoveryId) must match the
79
- * Compact struct.
95
+ * order (attestationDigest, signature) must match the Compact struct.
80
96
  */
81
97
  export declare const respondBidirectionalEventType: CompactType<RespondBidirectionalEvent>;
82
98
  /**
@@ -85,7 +101,7 @@ export declare const respondBidirectionalEventType: CompactType<RespondBidirecti
85
101
  * Decode the payload with {@link decodeSignBidirectionalNotification}.
86
102
  */
87
103
  export interface SignBidirectionalNotificationRecord {
88
- /** Payload layout tag (Compact `Uint<8>`); 1 = the V1 layout. */
104
+ /** Payload layout tag (Compact `Uint<8>`): 1 = the V1 layout. */
89
105
  version: bigint;
90
106
  /** The packed payload bytes, exactly as the registering circuit built them. */
91
107
  payload: Uint8Array;
@@ -97,20 +113,20 @@ export interface SignBidirectionalNotificationRecord {
97
113
  export declare const signBidirectionalNotificationType: CompactType<SignBidirectionalNotificationRecord>;
98
114
  /**
99
115
  * A decoded V1 notification from the signet contract's registry: the flat
100
- * 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
101
117
  * WHERE to read the authenticated copy. The request id is NOT in the payload:
102
118
  * it lives in the registry map key the record was stored under. Never trusted
103
119
  * on its own: the resolver authenticates by reading the request back from
104
120
  * {@link callerAddress}'s own ledger (see signet-request-resolver.ts).
105
121
  */
106
122
  export interface SignBidirectionalNotification {
107
- /** Payload layout tag; this decoder only produces version 1. */
123
+ /** Payload layout tag: this decoder only produces version 1. */
108
124
  version: number;
109
125
  /**
110
126
  * Address of the contract whose request map holds the request, rendered
111
- * as lowercase hex, no `0x` prefix — directly usable as a
127
+ * as lowercase hex, no `0x` prefix: directly usable as a
112
128
  * `queryContractState` argument. The MPC reads the request from THIS
113
- * contract's authenticated state; the field itself confers no authority.
129
+ * contract's authenticated state. The field itself confers no authority.
114
130
  */
115
131
  callerAddress: string;
116
132
  /**
@@ -122,9 +138,9 @@ export interface SignBidirectionalNotification {
122
138
  }
123
139
  /**
124
140
  * Unpack a stored {@link SignBidirectionalNotificationRecord}'s payload by
125
- * the fixed V1 offsets — the decode twin of the compiled
141
+ * the fixed V1 offsets: the decode twin of the compiled
126
142
  * `constructSignBidirectionalEventNotificationV1` circuit (byte plumbing
127
- * 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
128
144
  * round-trips through the real circuit). V1 layout:
129
145
  * callerAddress (32) ++ requestsIndexField (1) ++ zero padding (95).
130
146
  *
@@ -139,8 +155,8 @@ export declare function decodeSignBidirectionalNotification(record: SignBidirect
139
155
  /**
140
156
  * Plain-JS notification registry parsed out of the ledger: hex request id
141
157
  * (from the `SignetMapKey` the notification was stored under) to the raw
142
- * stored record. Re-notifies append under higher counts; this index keeps
143
- * 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
144
160
  * registered. Decode each record with
145
161
  * {@link decodeSignBidirectionalNotification}.
146
162
  */
@@ -163,7 +179,7 @@ export type SignatureResponseIndex = Map<string, SignatureRespondedEvent>;
163
179
  */
164
180
  export type RespondBidirectionalIndex = Map<string, RespondBidirectionalEvent>;
165
181
  /**
166
- * 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
167
183
  * composite Compact {@link SignetMapKey} as a string so it works as a JS
168
184
  * `Map` key.
169
185
  *
@@ -175,9 +191,9 @@ export declare function signetMapEntryKey(id: RequestIdHex, count: bigint): stri
175
191
  /**
176
192
  * Read ONLY the notification registry (ledger field
177
193
  * {@link SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD}) out of raw signet
178
- * contract state — the poll-loop primitive of {@link SignetRequestFeed},
194
+ * contract state: the poll-loop primitive of {@link SignetRequestFeed},
179
195
  * which cycles frequently and has no use for the response fields. One record
180
- * per request id (the count-0 post; see
196
+ * per request id (the count-0 post, see
181
197
  * {@link SignBidirectionalNotificationIndex}).
182
198
  *
183
199
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
@@ -188,7 +204,7 @@ export declare function signetMapEntryKey(id: RequestIdHex, count: bigint): stri
188
204
  export declare function readSignBidirectionalNotificationIndexFromState(raw: RawContractState): SignBidirectionalNotificationIndex;
189
205
  /**
190
206
  * The decoded ledger fields of the signet contract: the three
191
- * (counter map, entry map) pairs — notifications (fields 0/1), signature
207
+ * (counter map, entry map) pairs, namely notifications (fields 0/1), signature
192
208
  * responses (fields 2/3), respond-bidirectional responses (fields 4/5).
193
209
  * Together they give a poller everything the contract ever records about a
194
210
  * request. All entries are UNAUTHENTICATED: verify before trusting.
@@ -201,10 +217,10 @@ export interface SignetContractLedger {
201
217
  * (count-0 post).
202
218
  */
203
219
  signBidirectionalEventNotificationMap: SignBidirectionalNotificationIndex;
204
- /** Signature response post counts per request id (ledger field 2). */
205
- signatureResponseCounterMap: SignetCounterIndex;
206
- /** The signature response log (ledger field 3), keyed by {@link signetMapEntryKey}. */
207
- signatureResponseMap: SignatureResponseIndex;
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;
208
224
  /** Respond-bidirectional post counts per request id (ledger field 4). */
209
225
  respondBidirectionalCounterMap: SignetCounterIndex;
210
226
  /** The respond-bidirectional log (ledger field 5), keyed by {@link signetMapEntryKey}. */
@@ -212,9 +228,9 @@ export interface SignetContractLedger {
212
228
  }
213
229
  /**
214
230
  * MPC-/client-style read: parse the signet contract's ledger fields out of
215
- * raw contract state by field position alone — no compiled contract, no
216
- * generated `ledger()`, only the declaration-order layout and the canonical
217
- * 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.
218
234
  *
219
235
  * @param raw - Raw contract state, e.g. `queryContractState(address).data`
220
236
  * from the indexer or `ctx.currentQueryContext.state` from the simulator.