@sig-net/midnight 0.27.0-rc.2 → 0.27.0-rc.4

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 (70) hide show
  1. package/README.md +5 -4
  2. package/dist/abi-serde.d.ts +27 -0
  3. package/dist/abi-serde.d.ts.map +1 -1
  4. package/dist/abi-serde.js +101 -0
  5. package/dist/abi-serde.js.map +1 -1
  6. package/dist/compact-descriptors.d.ts +6 -5
  7. package/dist/compact-descriptors.d.ts.map +1 -1
  8. package/dist/compact-descriptors.js +4 -4
  9. package/dist/compact-descriptors.js.map +1 -1
  10. package/dist/constants.d.ts +2 -5
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +17 -36
  13. package/dist/constants.js.map +1 -1
  14. package/dist/ecdsa-attestation.d.ts +2 -1
  15. package/dist/ecdsa-attestation.d.ts.map +1 -1
  16. package/dist/ecdsa-attestation.js +4 -1
  17. package/dist/ecdsa-attestation.js.map +1 -1
  18. package/dist/epsilon-derivation.d.ts +8 -8
  19. package/dist/epsilon-derivation.js +7 -7
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/managed/compiler/contract-info.json +444 -0
  25. package/dist/managed/compiler/contract-manifest.json +8 -8
  26. package/dist/managed/contract/index.d.ts +102 -0
  27. package/dist/managed/contract/index.js +359 -231
  28. package/dist/managed/contract/index.js.map +1 -1
  29. package/dist/mpc-output-cache.d.ts +2 -3
  30. package/dist/mpc-output-cache.d.ts.map +1 -1
  31. package/dist/mpc-output-cache.js +1 -2
  32. package/dist/mpc-output-cache.js.map +1 -1
  33. package/dist/signature-requests-state-reader.d.ts +16 -10
  34. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  35. package/dist/signature-requests-state-reader.js +31 -13
  36. package/dist/signature-requests-state-reader.js.map +1 -1
  37. package/dist/signature-response-verification.d.ts +64 -16
  38. package/dist/signature-response-verification.d.ts.map +1 -1
  39. package/dist/signature-response-verification.js +104 -35
  40. package/dist/signature-response-verification.js.map +1 -1
  41. package/dist/signet-contract-events.d.ts +1 -1
  42. package/dist/signet-contract-events.js +1 -1
  43. package/dist/signet-contract-events.js.map +1 -1
  44. package/dist/signet-evtype2tx-requests.d.ts +1 -1
  45. package/dist/signet-evtype2tx-requests.js +1 -1
  46. package/dist/signet-request-id.js +3 -3
  47. package/dist/signet-request-id.js.map +1 -1
  48. package/dist/signet-request-response-reader.d.ts +137 -57
  49. package/dist/signet-request-response-reader.d.ts.map +1 -1
  50. package/dist/signet-request-response-reader.js +307 -123
  51. package/dist/signet-request-response-reader.js.map +1 -1
  52. package/dist/signet-requests.d.ts +9 -5
  53. package/dist/signet-requests.d.ts.map +1 -1
  54. package/dist/signet-requests.js +6 -2
  55. package/dist/signet-requests.js.map +1 -1
  56. package/dist/signet-tron-record-decoding.d.ts +2 -0
  57. package/dist/signet-tron-record-decoding.d.ts.map +1 -1
  58. package/dist/signet-tron-record-decoding.js +2 -0
  59. package/dist/signet-tron-record-decoding.js.map +1 -1
  60. package/dist/signet-tron-requests.d.ts +7 -3
  61. package/dist/signet-tron-requests.d.ts.map +1 -1
  62. package/dist/signet-tron-requests.js +6 -2
  63. package/dist/signet-tron-requests.js.map +1 -1
  64. package/dist/tron-transactions.d.ts +25 -2
  65. package/dist/tron-transactions.d.ts.map +1 -1
  66. package/dist/tron-transactions.js +33 -3
  67. package/dist/tron-transactions.js.map +1 -1
  68. package/package.json +2 -2
  69. package/src/Signet.compact +12 -10
  70. package/src/circuits.compact +12 -0
@@ -3,42 +3,98 @@
3
3
  // out of the contract events the signet responder emits, and verify each
4
4
  // candidate against the request. The request id a response declares is
5
5
  // UNAUTHENTICATED routing data: VERIFICATION establishes authenticity.
6
- // Single-shot: each call queries once, and the caller owns any poll loop.
6
+ // The caller owns the poll loop, and the reader makes each poll incremental:
7
+ // per request it keeps the distinct responses read so far, each one's
8
+ // verification outcome, and the event cursor its next scan resumes from.
7
9
  import { ContractState } from "@midnight-ntwrk/compact-runtime";
8
- import { verifyAttestedOutput, verifyRespondBidirectionalAttestation, } from "./ecdsa-attestation.js";
10
+ import { getAddress, hexlify } from "ethers";
11
+ import { bytesToHex } from "./byte-codecs.js";
12
+ import { formatSecp256k1PublicKey, verifyAttestedOutput, verifyRespondBidirectionalAttestation, } from "./ecdsa-attestation.js";
9
13
  import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
10
- import { recoverSignatureResponseSigner, recoverTronSignatureResponseSigner, } from "./signature-response-verification.js";
14
+ import { evmSignatureCheck, isExpectedSigner, recoverSignatureAddress, tronSignatureCheck, } from "./signature-response-verification.js";
11
15
  import { decodeSignetEventNamed, SignetEventName, signetEventRecordsOf, } from "./signet-contract-events.js";
12
16
  import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
13
- import { isEvmType2SignBidirectionalEvent, isTronSignBidirectionalEvent, } from "./signet-requests.js";
14
- import { buildSignedTronTransaction, buildTronRawTransaction, tronAddressFromBase58, } from "./tron-transactions.js";
15
- function recoverAndMatchSigner(request, response, expectedSigner) {
16
- if (isTronSignBidirectionalEvent(request)) {
17
- const signer = recoverTronSignatureResponseSigner(request, response, expectedSigner);
18
- return { signer, matches: signer === expectedSigner };
17
+ import { isEvmRequest, isTronRequest, } from "./signet-requests.js";
18
+ import { buildSignedTronTransaction, buildTronRawTransaction, deriveSignBidirectionalEventSignerTronAddress, tronAddressFromEvm, tronAddressToBase58, } from "./tron-transactions.js";
19
+ function signerCheck(recoveryKey, signature, spellSigner) {
20
+ return {
21
+ recoveryKey,
22
+ signature,
23
+ expectedSigner: spellSigner(signature.expectedAddress),
24
+ spellSigner,
25
+ };
26
+ }
27
+ /**
28
+ * Recover the signer of a posted signature response over the request's
29
+ * transaction: the one cryptographic step of judging a post.
30
+ *
31
+ * @param check - The check the post is judged by.
32
+ * @param response - The posted response.
33
+ * @returns The recovered signer, or why the signature does not decode.
34
+ */
35
+ function recoverSigner(check, response) {
36
+ let address;
37
+ try {
38
+ address = recoverSignatureAddress(check.signature.signingHash, response);
39
+ }
40
+ catch (error) {
41
+ return { undecodable: String(error) };
19
42
  }
20
- const signer = recoverSignatureResponseSigner(request, response);
21
- return { signer, matches: signer.toLowerCase() === expectedSigner.toLowerCase() };
43
+ return { signer: check.spellSigner(address), address };
22
44
  }
23
45
  /**
24
- * The first (oldest) of a request's respond-bidirectional posts whose
25
- * signature verifies against `mpcResponseKey`, provided it attests
26
- * `serializedOutput`. Every genuine post for a request attests the same final
27
- * outcome, so the output is hashed once, against that post alone.
46
+ * Whether a recovery names the check's expected signer.
28
47
  *
29
- * @param serializedOutput - The serialised execution output, exact unpadded bytes.
30
- * @param mpcResponseKey - The MPC response key the requesting contract pinned.
31
- * @param posts - The request's posts, in emission order.
32
- * @returns The first verifying post, or `undefined` when none verifies or it
33
- * attests another output.
48
+ * @param check - The check the post is judged by.
49
+ * @param recovery - The post's recovery outcome.
50
+ * @returns Whether the post is signed by the expected signer.
34
51
  */
35
- function firstVerifiedRespondBidirectionalEvent(serializedOutput, mpcResponseKey, posts) {
36
- const attested = posts.find((post) => verifyRespondBidirectionalAttestation(post, mpcResponseKey));
37
- if (attested === undefined ||
38
- !verifyAttestedOutput(serializedOutput, attested.serializedOutputLength, attested.outputHash)) {
39
- return undefined;
52
+ function isSignedBy(check, recovery) {
53
+ return "address" in recovery && isExpectedSigner(check.signature, recovery.address);
54
+ }
55
+ /**
56
+ * Word a post's recovery outcome as its verdict against the check's expected signer.
57
+ *
58
+ * @param position - 0-based position of the post among the responses judged.
59
+ * @param response - The posted response.
60
+ * @param recovery - The post's recovery outcome.
61
+ * @param check - The check the post is judged by.
62
+ * @returns The verdict.
63
+ */
64
+ function signatureResponseVerdict(position, response, recovery, check) {
65
+ const index = BigInt(position);
66
+ if ("undecodable" in recovery) {
67
+ return {
68
+ index,
69
+ response,
70
+ rejectedReason: `not a decodable signature (${recovery.undecodable})`,
71
+ };
40
72
  }
41
- return attested;
73
+ const { signer } = recovery;
74
+ if (!isSignedBy(check, recovery)) {
75
+ return {
76
+ index,
77
+ response,
78
+ signer,
79
+ rejectedReason: `signed by ${signer}, expected ${check.expectedSigner}`,
80
+ };
81
+ }
82
+ return { index, response, signer };
83
+ }
84
+ /**
85
+ * Collect per-post verdicts into a result: the first valid post wins.
86
+ *
87
+ * @param verdicts - One verdict per post, emission order.
88
+ * @returns The first valid response (if any) plus the verdicts.
89
+ */
90
+ function verifiedSignatureResponseResult(verdicts) {
91
+ return {
92
+ verified: verdicts.find((verdict) => verdict.rejectedReason === undefined)?.response,
93
+ verdicts,
94
+ };
95
+ }
96
+ function judgeSignatureRespondedEvents(requestId, check, events) {
97
+ return verifiedSignatureResponseResult(signetEventRecordsOf(events, SignetEventName.SignatureRespondedEvent, requestId).map((response, position) => signatureResponseVerdict(position, response, recoverSigner(check, response), check)));
42
98
  }
43
99
  /**
44
100
  * `SignetRequestResponseReader.getVerifiedRespondBidirectionalEvent` over
@@ -57,17 +113,35 @@ function firstVerifiedRespondBidirectionalEvent(serializedOutput, mpcResponseKey
57
113
  * @returns The first verifying post, or `undefined` when none attests this output.
58
114
  */
59
115
  export function findVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey, events) {
60
- return firstVerifiedRespondBidirectionalEvent(serializedOutput, mpcResponseKey, signetEventRecordsOf(events, SignetEventName.RespondBidirectionalEvent, requestId));
116
+ // Every genuine post for a request attests the same final outcome, so the
117
+ // output is hashed once, against the first attested post alone.
118
+ const attested = signetEventRecordsOf(events, SignetEventName.RespondBidirectionalEvent, requestId).find((post) => verifyRespondBidirectionalAttestation(post, mpcResponseKey));
119
+ if (attested === undefined ||
120
+ !verifyAttestedOutput(serializedOutput, attested.serializedOutputLength, attested.outputHash)) {
121
+ return undefined;
122
+ }
123
+ return attested;
124
+ }
125
+ function recoveryOf(check, candidate) {
126
+ let recovery = candidate.recoveries.get(check.recoveryKey);
127
+ if (recovery === undefined) {
128
+ recovery = recoverSigner(check, candidate.response);
129
+ candidate.recoveries.set(check.recoveryKey, recovery);
130
+ }
131
+ return recovery;
61
132
  }
62
133
  /**
63
134
  * Reader over one requester contract / responder contract pair. Construct once
64
- * per pair and reuse: fetched request records are cached, so repeated
65
- * verification calls cost one event query each.
135
+ * per pair and reuse across polls: per request it caches the request record,
136
+ * the distinct responses read so far with each one's verification outcome,
137
+ * and the event cursor, so a poll handles only events it has not seen yet
138
+ * and no response is verified twice.
66
139
  */
67
140
  export class SignetRequestResponseReader {
68
141
  config;
69
142
  // Request records never change once stored, so cache them across calls.
70
143
  requestCache = new Map();
144
+ responseScans = new Map();
71
145
  /**
72
146
  * @param config - The contract pair, state source and event source to read
73
147
  * through.
@@ -101,7 +175,7 @@ export class SignetRequestResponseReader {
101
175
  catch (cause) {
102
176
  throw new Error(`the "${read.contractState.era}" state of requester contract '${this.config.requesterContractAddress}' does not decode as a ledger-9 contract state`, { cause });
103
177
  }
104
- const request = lookupSignetRequestAt(state.data, this.config.requesterRequestsPath, requestId);
178
+ const request = lookupSignetRequestAt(state.data, this.config.requesterContractAddress, this.config.requesterRequestsPath, requestId);
105
179
  if (request === undefined) {
106
180
  throw new Error(`request ${requestId} is not on the requester contract's ledger ` +
107
181
  `(request index at path ${JSON.stringify(this.config.requesterRequestsPath)}): was it submitted?`);
@@ -110,150 +184,228 @@ export class SignetRequestResponseReader {
110
184
  return request;
111
185
  }
112
186
  /**
187
+ * Fetch a request record that must carry the evmType2 decomposition.
188
+ *
113
189
  * @param requestId - The request id to look up
114
190
  * @returns The stored evmType2 request record
115
191
  * @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
116
192
  */
117
193
  async getEvmType2SignatureRequest(requestId) {
118
194
  const request = await this.getSignatureRequest(requestId);
119
- if (!isEvmType2SignBidirectionalEvent(request)) {
195
+ if (!isEvmRequest(request)) {
120
196
  throw new Error(`request ${requestId} is not evmType2 (txParamType ${String(request.txParamType)})`);
121
197
  }
122
198
  return request;
123
199
  }
124
200
  /**
201
+ * Fetch a request record that must carry the Tron decomposition.
202
+ *
125
203
  * @param requestId - The request id to look up
126
204
  * @returns The stored Tron request record
127
205
  * @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
128
206
  */
129
207
  async getTronSignatureRequest(requestId) {
130
208
  const request = await this.getSignatureRequest(requestId);
131
- if (!isTronSignBidirectionalEvent(request)) {
209
+ if (!isTronRequest(request)) {
132
210
  throw new Error(`request ${requestId} is not tron (txParamType ${String(request.txParamType)})`);
133
211
  }
134
212
  return request;
135
213
  }
214
+ async evmSignerCheck(requestId, expectedSigner) {
215
+ const request = await this.getEvmType2SignatureRequest(requestId);
216
+ return signerCheck("", evmSignatureCheck(request, expectedSigner), (address) => getAddress(hexlify(address)));
217
+ }
218
+ async tronSignerCheck(requestId, mpcRootPublicKey) {
219
+ const request = await this.getTronSignatureRequest(requestId);
220
+ return signerCheck(mpcRootPublicKey, tronSignatureCheck(request, mpcRootPublicKey), (address) => tronAddressToBase58(tronAddressFromEvm(address)));
221
+ }
136
222
  /**
137
- * Fetch the responder contract's posts of event `name` that declare
138
- * `requestId`, in emission order, skipping posts whose payload does not
139
- * decode. The declared id is routing data only.
223
+ * The responses read so far for `requestId`, without touching the event
224
+ * source.
225
+ *
226
+ * @param requestId - The request id.
227
+ * @returns The request's scan state, empty before its first scan.
228
+ */
229
+ responseScanOf(requestId) {
230
+ let scan = this.responseScans.get(requestId);
231
+ if (scan === undefined) {
232
+ scan = { keptPosts: new Set(), signatureResponses: [], respondBidirectionalEvents: [] };
233
+ this.responseScans.set(requestId, scan);
234
+ }
235
+ return scan;
236
+ }
237
+ /**
238
+ * Read the responder contract's events from the block where the previous
239
+ * scan of `requestId` stopped, skip the ones it already saw, and keep the
240
+ * posts of either response kind that declare it, skipping posts whose
241
+ * payload does not decode and repeats of a post already kept. The declared id is routing data only.
140
242
  *
141
- * @param name - The signet event name to keep.
142
243
  * @param requestId - The request id the kept posts must declare.
143
- * @returns The kept posts' records, oldest first.
244
+ * @returns The request's scan state, read up to the indexer's tip.
144
245
  */
145
- async getRecordsNamed(name, requestId) {
146
- const records = [];
147
- const events = this.config.eventSource.streamSignetEvents(this.config.responderContractAddress, this.config.responderEventsFromBlock === undefined
148
- ? undefined
149
- : { fromBlock: this.config.responderEventsFromBlock });
246
+ async scanResponses(requestId) {
247
+ const scan = this.responseScanOf(requestId);
248
+ const fromBlock = scan.lastEvent?.blockHeight ?? this.config.responderEventsFromBlock;
249
+ const events = this.config.eventSource.streamSignetEvents(this.config.responderContractAddress, fromBlock === undefined ? undefined : { fromBlock });
150
250
  for await (const event of events) {
251
+ if (scan.lastEvent !== undefined && event.id <= scan.lastEvent.id)
252
+ continue;
253
+ scan.lastEvent = { id: event.id, blockHeight: event.blockHeight };
254
+ const post = `${event.name}:${bytesToHex(event.payload)}`;
255
+ if (scan.keptPosts.has(post))
256
+ continue;
151
257
  try {
152
- const decoded = decodeSignetEventNamed(event, name);
153
- if (decoded?.requestId === requestId)
154
- records.push(decoded.record);
258
+ const signatureResponse = decodeSignetEventNamed(event, SignetEventName.SignatureRespondedEvent);
259
+ if (signatureResponse?.requestId === requestId) {
260
+ scan.keptPosts.add(post);
261
+ scan.signatureResponses.push({
262
+ response: signatureResponse.record,
263
+ recoveries: new Map(),
264
+ });
265
+ }
266
+ const respondBidirectional = decodeSignetEventNamed(event, SignetEventName.RespondBidirectionalEvent);
267
+ if (respondBidirectional?.requestId === requestId) {
268
+ scan.keptPosts.add(post);
269
+ scan.respondBidirectionalEvents.push({
270
+ post: respondBidirectional.record,
271
+ attestedBy: new Map(),
272
+ });
273
+ }
155
274
  }
156
275
  catch {
157
276
  // A post that does not decode answers no request, so it must not
158
277
  // fail the read of every request.
159
278
  }
160
279
  }
161
- return records;
280
+ return scan;
162
281
  }
163
282
  /**
164
- * Fetch every decodable signature response posted under `requestId`, in
165
- * emission order. UNVERIFIED: any post may still be garbage, sift with
166
- * {@link getVerifiedSignatureRespondedEvent} first.
283
+ * Fetch every distinct decodable signature response posted under
284
+ * `requestId`, in emission order. UNVERIFIED: any post may still be
285
+ * garbage, sift with {@link getVerifiedSignatureRespondedEvent} first.
167
286
  *
168
287
  * @param requestId - The request id the posts must declare.
169
288
  * @returns The request's posted records, oldest first, empty when none yet.
170
289
  */
171
290
  async getSignatureRespondedEvents(requestId) {
172
- return this.getRecordsNamed(SignetEventName.SignatureRespondedEvent, requestId);
291
+ const scan = await this.scanResponses(requestId);
292
+ return scan.signatureResponses.map((candidate) => candidate.response);
293
+ }
294
+ /**
295
+ * The first of a request's signature responses read so far that passes
296
+ * `check`, recovering the signer of each post at most once across calls
297
+ * and stopping at the first match.
298
+ *
299
+ * @param check - The check the posts are judged by.
300
+ * @param candidates - The request's responses read so far, emission order.
301
+ * @returns The first valid response, or `undefined` when none is valid.
302
+ */
303
+ firstResponseSignedBy(check, candidates) {
304
+ for (const candidate of candidates) {
305
+ if (isSignedBy(check, recoveryOf(check, candidate)))
306
+ return candidate.response;
307
+ }
308
+ return undefined;
309
+ }
310
+ async firstVerifiedSignatureRespondedEvent(requestId, check) {
311
+ return (this.firstResponseSignedBy(check, this.responseScanOf(requestId).signatureResponses) ??
312
+ this.firstResponseSignedBy(check, (await this.scanResponses(requestId)).signatureResponses));
313
+ }
314
+ async signatureResponseVerdicts(requestId, check) {
315
+ const { signatureResponses } = await this.scanResponses(requestId);
316
+ return verifiedSignatureResponseResult(signatureResponses.map((candidate, position) => signatureResponseVerdict(position, candidate.response, recoveryOf(check, candidate), check)));
173
317
  }
174
318
  /**
175
- * Fetch the signature responses posted under `requestId` and verify each
176
- * against the request: a valid post's signature recovers to
177
- * `expectedSigner` (an EVM address compared case-insensitively) over the
178
- * signing hash of the request's transaction. The first valid post wins, and every
179
- * candidate gets a verdict.
319
+ * Fetch the first signature response posted under `requestId` that
320
+ * verifies against the evmType2 request: its signature recovers to
321
+ * `expectedSigner` over the signing hash of the request's transaction.
322
+ * The fast path of a poll loop: a valid response already read is returned
323
+ * without touching the event source, a scan handles only the events it has
324
+ * not seen yet, and verification stops at the first valid post.
325
+ * {@link getSignatureResponseVerdicts} says why the other posts were
326
+ * rejected.
180
327
  *
181
328
  * @param requestId - The request id to fetch a verified response for.
182
- * @param expectedSigner - The EVM address (0x hex, any case) or base58 Tron
183
- * address the genuine response must be signed by: the requester's
184
- * MPC-derived address.
185
- * @returns The first valid response (if any) plus per-post verdicts.
186
- * @throws {Error} When the requester contract has no state or the request is
187
- * not on its ledger.
329
+ * @param expectedSigner - The EVM address (0x hex, any case) the genuine
330
+ * response must be signed by: the requester's MPC-derived address.
331
+ * @returns The first valid response, or `undefined` when no valid response
332
+ * has been posted yet: poll again.
333
+ * @throws {Error} When the requester contract has no state, the request is
334
+ * not on its ledger, the request is not an evmType2 record, or
335
+ * `expectedSigner` is not an EVM address.
188
336
  */
189
337
  async getVerifiedSignatureRespondedEvent(requestId, expectedSigner) {
190
- return this.verifySignatureResponses(requestId, expectedSigner, await this.getSignatureRespondedEvents(requestId));
338
+ return this.firstVerifiedSignatureRespondedEvent(requestId, await this.evmSignerCheck(requestId, expectedSigner));
191
339
  }
192
340
  /**
193
- * {@link getVerifiedSignatureRespondedEvent} over decoded events already in
341
+ * The Tron twin of {@link getVerifiedSignatureRespondedEvent}: the first response signed by the owner of the request's transaction.
342
+ *
343
+ * @param requestId - The Tron request id to fetch a verified response for
344
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
345
+ * @returns The first valid response, or `undefined` when no valid response has been posted yet
346
+ * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
347
+ */
348
+ async getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey) {
349
+ return this.firstVerifiedSignatureRespondedEvent(requestId, await this.tronSignerCheck(requestId, mpcRootPublicKey));
350
+ }
351
+ /**
352
+ * The diagnostic sibling of {@link getVerifiedSignatureRespondedEvent}:
353
+ * fetch every distinct signature response posted under the evmType2
354
+ * `requestId` and give each a verdict against the request. The signer of
355
+ * a post is recovered at most once across calls.
356
+ *
357
+ * @param requestId - The request id to judge the responses of.
358
+ * @param expectedSigner - The EVM address (0x hex, any case) the genuine
359
+ * response must be signed by: the requester's MPC-derived address.
360
+ * @returns The first valid response (if any) plus per-post verdicts.
361
+ * @throws {Error} When the requester contract has no state, the request is
362
+ * not on its ledger, the request is not an evmType2 record, or
363
+ * `expectedSigner` is not an EVM address.
364
+ */
365
+ async getSignatureResponseVerdicts(requestId, expectedSigner) {
366
+ return this.signatureResponseVerdicts(requestId, await this.evmSignerCheck(requestId, expectedSigner));
367
+ }
368
+ /**
369
+ * The Tron twin of {@link getSignatureResponseVerdicts}: every response of the request with its verdict.
370
+ *
371
+ * @param requestId - The Tron request id to judge the responses of
372
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
373
+ * @returns The first valid response (if any) plus per-post verdicts, signers in base58
374
+ * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
375
+ */
376
+ async getTronSignatureResponseVerdicts(requestId, mpcRootPublicKey) {
377
+ return this.signatureResponseVerdicts(requestId, await this.tronSignerCheck(requestId, mpcRootPublicKey));
378
+ }
379
+ /**
380
+ * {@link getSignatureResponseVerdicts} over decoded events already in
194
381
  * hand: the one ledger read for the request (cached), and no walk of the
195
382
  * responder contract's event history. For a consumer that streamed and decoded
196
383
  * the history once and verifies many requests against it.
197
384
  *
198
- * @param requestId - The request id to verify responses for.
199
- * @param expectedSigner - The EVM address (0x hex, any case) or base58 Tron
200
- * address the genuine response must be signed by: the requester's
201
- * MPC-derived address.
385
+ * @param requestId - The evmType2 request id to verify responses for.
386
+ * @param expectedSigner - The EVM address (0x hex, any case) the genuine
387
+ * response must be signed by: the requester's MPC-derived address.
202
388
  * @param events - Decoded signet events of any kinds and request ids, in
203
389
  * emission order. Only signature responses declaring `requestId` are judged.
204
390
  * @returns The first valid response (if any) plus per-post verdicts.
205
- * @throws {Error} When the requester contract has no state or the request is
206
- * not on its ledger.
391
+ * @throws {Error} When the requester contract has no state, the request is
392
+ * not on its ledger, the request is not an evmType2 record, or
393
+ * `expectedSigner` is not an EVM address.
207
394
  */
208
395
  async verifySignatureRespondedEvents(requestId, expectedSigner, events) {
209
- return this.verifySignatureResponses(requestId, expectedSigner, signetEventRecordsOf(events, SignetEventName.SignatureRespondedEvent, requestId));
396
+ return judgeSignatureRespondedEvents(requestId, await this.evmSignerCheck(requestId, expectedSigner), events);
210
397
  }
211
398
  /**
212
- * Judge each of a request's posted signature responses against the request:
213
- * the verdict step {@link getVerifiedSignatureRespondedEvent} and
214
- * {@link verifySignatureRespondedEvents} share.
399
+ * The Tron twin of {@link verifySignatureRespondedEvents}: judge the request's responses among decoded events already in hand.
215
400
  *
216
- * @param requestId - The request id the responses were posted under.
217
- * @param expectedSigner - The EVM or base58 Tron address the genuine response
218
- * must be signed by.
219
- * @param responses - The request's posted responses, in emission order.
220
- * @returns The first valid response (if any) plus per-post verdicts.
221
- * @throws {Error} When the requester contract has no state or the request is
222
- * not on its ledger.
401
+ * @param requestId - The Tron request id to verify responses for
402
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`
403
+ * @param events - Decoded signet events of any kinds and request ids, in emission order
404
+ * @returns The first valid response (if any) plus per-post verdicts, signers in base58
405
+ * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
223
406
  */
224
- async verifySignatureResponses(requestId, expectedSigner, responses) {
225
- const request = await this.getSignatureRequest(requestId);
226
- if (isTronSignBidirectionalEvent(request)) {
227
- tronAddressFromBase58(expectedSigner);
228
- }
229
- const verdicts = responses.map((response, position) => {
230
- const index = BigInt(position);
231
- let signer;
232
- let matches;
233
- try {
234
- ({ signer, matches } = recoverAndMatchSigner(request, response, expectedSigner));
235
- }
236
- catch (error) {
237
- return {
238
- index,
239
- response,
240
- rejectedReason: `not a decodable signature (${String(error)})`,
241
- };
242
- }
243
- if (!matches) {
244
- return {
245
- index,
246
- response,
247
- signer,
248
- rejectedReason: `signed by ${signer}, expected ${expectedSigner}`,
249
- };
250
- }
251
- return { index, response, signer };
252
- });
253
- return {
254
- verified: verdicts.find((v) => v.rejectedReason === undefined)?.response,
255
- verdicts,
256
- };
407
+ async verifyTronSignatureRespondedEvents(requestId, mpcRootPublicKey, events) {
408
+ return judgeSignatureRespondedEvents(requestId, await this.tronSignerCheck(requestId, mpcRootPublicKey), events);
257
409
  }
258
410
  /**
259
411
  * Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
@@ -287,28 +439,30 @@ export class SignetRequestResponseReader {
287
439
  */
288
440
  async getSignedEvmTransaction(requestId, expectedSigner) {
289
441
  const request = await this.getEvmType2SignatureRequest(requestId);
290
- const { verified } = await this.getVerifiedSignatureRespondedEvent(requestId, expectedSigner);
442
+ const verified = await this.getVerifiedSignatureRespondedEvent(requestId, expectedSigner);
291
443
  if (verified === undefined) {
292
444
  return undefined;
293
445
  }
294
446
  return signBidirectionalEventToSignedEvmTransaction(request, verified);
295
447
  }
296
448
  /**
449
+ * Assemble the broadcast-ready signed Tron transaction for a request, attaching the first verified response.
450
+ *
297
451
  * @param requestId - The request id to produce a signed transaction for
298
- * @param expectedOwner - The requester's MPC-derived Tron address in base58 (see `deriveTronAddress`)
452
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion` (e.g. `getMpcRootPublicKey(network)`); the owner is derived from it and the record's `sender` and `path`
299
453
  * @returns The signed protobuf `Transaction` bytes, or `undefined` when no valid response has been posted yet
300
- * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or `expectedOwner` is not a base58 Tron address
454
+ * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
301
455
  */
302
- async getSignedTronTransaction(requestId, expectedOwner) {
456
+ async getSignedTronTransaction(requestId, mpcRootPublicKey) {
303
457
  const request = await this.getTronSignatureRequest(requestId);
304
- const { verified } = await this.getVerifiedSignatureRespondedEvent(requestId, expectedOwner);
458
+ const verified = await this.getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey);
305
459
  if (verified === undefined) {
306
460
  return undefined;
307
461
  }
308
- return buildSignedTronTransaction(buildTronRawTransaction(request.txParams, tronAddressFromBase58(expectedOwner)), verified.signature);
462
+ return buildSignedTronTransaction(buildTronRawTransaction(request.txParams, deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).bytes), verified.signature);
309
463
  }
310
464
  /**
311
- * Fetch every decodable respond-bidirectional response posted under
465
+ * Fetch every distinct decodable respond-bidirectional response posted under
312
466
  * `requestId`, in emission order. UNVERIFIED: any post may still be
313
467
  * garbage, sift with {@link getVerifiedRespondBidirectionalEvent} (or
314
468
  * in-circuit at claim time) first.
@@ -317,7 +471,30 @@ export class SignetRequestResponseReader {
317
471
  * @returns The request's posted records, oldest first, empty when none yet.
318
472
  */
319
473
  async getRespondBidirectionalEvents(requestId) {
320
- return this.getRecordsNamed(SignetEventName.RespondBidirectionalEvent, requestId);
474
+ const scan = await this.scanResponses(requestId);
475
+ return scan.respondBidirectionalEvents.map((candidate) => candidate.post);
476
+ }
477
+ /**
478
+ * The first of a request's respond-bidirectional posts read so far whose
479
+ * signature verifies against `mpcResponseKey`, checking each post against
480
+ * a key at most once across calls and stopping at the first match.
481
+ *
482
+ * @param candidates - The request's posts read so far, emission order.
483
+ * @param mpcResponseKey - The MPC response key the requesting contract pinned.
484
+ * @returns The first attested post, or `undefined` when none verifies.
485
+ */
486
+ firstPostAttestedBy(candidates, mpcResponseKey) {
487
+ const key = formatSecp256k1PublicKey(mpcResponseKey);
488
+ for (const candidate of candidates) {
489
+ let attested = candidate.attestedBy.get(key);
490
+ if (attested === undefined) {
491
+ attested = verifyRespondBidirectionalAttestation(candidate.post, mpcResponseKey);
492
+ candidate.attestedBy.set(key, attested);
493
+ }
494
+ if (attested)
495
+ return candidate.post;
496
+ }
497
+ return undefined;
321
498
  }
322
499
  /**
323
500
  * Fetch the respond-bidirectional posts declared under `requestId` and
@@ -326,7 +503,9 @@ export class SignetRequestResponseReader {
326
503
  * `serializedOutput`: the off-chain twin of the check the client contract
327
504
  * runs in-circuit. The output must be the exact unpadded bytes the
328
505
  * attestation commits to, so a post that verifies here is the post that
329
- * proves at claim time.
506
+ * proves at claim time. An attested post already read is judged without
507
+ * touching the event source, and a scan handles only the events it has
508
+ * not seen yet.
330
509
  *
331
510
  * @param requestId - The request id the posts must declare and the
332
511
  * attestation must commit to.
@@ -338,7 +517,12 @@ export class SignetRequestResponseReader {
338
517
  * posted yet (poll again) or none attests this output.
339
518
  */
340
519
  async getVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey) {
341
- return firstVerifiedRespondBidirectionalEvent(serializedOutput, mpcResponseKey, await this.getRespondBidirectionalEvents(requestId));
520
+ const attested = this.firstPostAttestedBy(this.responseScanOf(requestId).respondBidirectionalEvents, mpcResponseKey) ??
521
+ this.firstPostAttestedBy((await this.scanResponses(requestId)).respondBidirectionalEvents, mpcResponseKey);
522
+ return attested !== undefined &&
523
+ verifyAttestedOutput(serializedOutput, attested.serializedOutputLength, attested.outputHash)
524
+ ? attested
525
+ : undefined;
342
526
  }
343
527
  }
344
528
  //# sourceMappingURL=signet-request-response-reader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOhE,OAAO,EAEL,oBAAoB,EACpB,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,8BAA8B,EAC9B,kCAAkC,GACn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,CACxC,SAAuB,EACvB,gBAA4B,EAC5B,cAA8B;QAE9B,OAAO,sCAAsC,CAC3C,gBAAgB,EAChB,cAAc,EACd,MAAM,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CACpD,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,uEAAuE;AACvE,uEAAuE;AACvE,6EAA6E;AAC7E,sEAAsE;AACtE,yEAAyE;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKhE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAoB,MAAM,QAAQ,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,wBAAwB,EAExB,oBAAoB,EACpB,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EAEvB,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,sBAAsB,EAItB,eAAe,EACf,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,YAAY,EACZ,aAAa,GAGd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,6CAA6C,EAC7C,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAoGhC,SAAS,WAAW,CAClB,WAAmB,EACnB,SAAyB,EACzB,WAA4C;IAE5C,OAAO;QACL,WAAW;QACX,SAAS;QACT,cAAc,EAAE,WAAW,CAAC,SAAS,CAAC,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