@sig-net/midnight 0.27.0-rc.3 → 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.
- package/README.md +4 -3
- package/dist/compact-descriptors.d.ts +6 -5
- package/dist/compact-descriptors.d.ts.map +1 -1
- package/dist/compact-descriptors.js +4 -4
- package/dist/compact-descriptors.js.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -2
- package/dist/ecdsa-attestation.d.ts +2 -1
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +4 -1
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.d.ts +8 -8
- package/dist/epsilon-derivation.js +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-manifest.json +4 -4
- package/dist/managed/contract/index.js +61 -53
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +16 -10
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +31 -13
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +52 -7
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +63 -13
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-events.d.ts +1 -1
- package/dist/signet-request-id.js +3 -3
- package/dist/signet-request-id.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +112 -34
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +279 -96
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +9 -5
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +6 -2
- package/dist/signet-requests.js.map +1 -1
- package/dist/signet-tron-record-decoding.d.ts +2 -0
- package/dist/signet-tron-record-decoding.d.ts.map +1 -1
- package/dist/signet-tron-record-decoding.js +2 -0
- package/dist/signet-tron-record-decoding.js.map +1 -1
- package/dist/signet-tron-requests.d.ts +7 -3
- package/dist/signet-tron-requests.d.ts.map +1 -1
- package/dist/signet-tron-requests.js +6 -2
- package/dist/signet-tron-requests.js.map +1 -1
- package/dist/tron-transactions.d.ts +17 -1
- package/dist/tron-transactions.d.ts.map +1 -1
- package/dist/tron-transactions.js +16 -0
- package/dist/tron-transactions.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +12 -10
|
@@ -3,64 +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
|
-
//
|
|
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 { getAddress } from "ethers";
|
|
9
|
-
import {
|
|
10
|
+
import { getAddress, hexlify } from "ethers";
|
|
11
|
+
import { bytesToHex } from "./byte-codecs.js";
|
|
12
|
+
import { formatSecp256k1PublicKey, verifyAttestedOutput, verifyRespondBidirectionalAttestation, } from "./ecdsa-attestation.js";
|
|
10
13
|
import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
|
|
11
|
-
import {
|
|
14
|
+
import { evmSignatureCheck, isExpectedSigner, recoverSignatureAddress, tronSignatureCheck, } from "./signature-response-verification.js";
|
|
12
15
|
import { decodeSignetEventNamed, SignetEventName, signetEventRecordsOf, } from "./signet-contract-events.js";
|
|
13
16
|
import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
|
|
14
|
-
import {
|
|
15
|
-
import { buildSignedTronTransaction, buildTronRawTransaction, deriveSignBidirectionalEventSignerTronAddress, } from "./tron-transactions.js";
|
|
16
|
-
function
|
|
17
|
-
const verdicts = responses.map((response, position) => {
|
|
18
|
-
const index = BigInt(position);
|
|
19
|
-
let signer;
|
|
20
|
-
try {
|
|
21
|
-
signer = recover(response);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
return {
|
|
25
|
-
index,
|
|
26
|
-
response,
|
|
27
|
-
rejectedReason: `not a decodable signature (${String(error)})`,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
if (!verify(response)) {
|
|
31
|
-
return {
|
|
32
|
-
index,
|
|
33
|
-
response,
|
|
34
|
-
signer,
|
|
35
|
-
rejectedReason: `signed by ${signer}, expected ${expectedSigner}`,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return { index, response, signer };
|
|
39
|
-
});
|
|
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) {
|
|
40
20
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
recoveryKey,
|
|
22
|
+
signature,
|
|
23
|
+
expectedSigner: spellSigner(signature.expectedAddress),
|
|
24
|
+
spellSigner,
|
|
43
25
|
};
|
|
44
26
|
}
|
|
45
27
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* `serializedOutput`. Every genuine post for a request attests the same final
|
|
49
|
-
* outcome, so the output is hashed once, against that post alone.
|
|
28
|
+
* Recover the signer of a posted signature response over the request's
|
|
29
|
+
* transaction: the one cryptographic step of judging a post.
|
|
50
30
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @
|
|
54
|
-
* @returns The first verifying post, or `undefined` when none verifies or it
|
|
55
|
-
* attests another output.
|
|
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.
|
|
56
34
|
*/
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return undefined;
|
|
35
|
+
function recoverSigner(check, response) {
|
|
36
|
+
let address;
|
|
37
|
+
try {
|
|
38
|
+
address = recoverSignatureAddress(check.signature.signingHash, response);
|
|
62
39
|
}
|
|
63
|
-
|
|
40
|
+
catch (error) {
|
|
41
|
+
return { undecodable: String(error) };
|
|
42
|
+
}
|
|
43
|
+
return { signer: check.spellSigner(address), address };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether a recovery names the check's expected signer.
|
|
47
|
+
*
|
|
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.
|
|
51
|
+
*/
|
|
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
|
+
};
|
|
72
|
+
}
|
|
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)));
|
|
64
98
|
}
|
|
65
99
|
/**
|
|
66
100
|
* `SignetRequestResponseReader.getVerifiedRespondBidirectionalEvent` over
|
|
@@ -79,17 +113,35 @@ function firstVerifiedRespondBidirectionalEvent(serializedOutput, mpcResponseKey
|
|
|
79
113
|
* @returns The first verifying post, or `undefined` when none attests this output.
|
|
80
114
|
*/
|
|
81
115
|
export function findVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey, events) {
|
|
82
|
-
|
|
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;
|
|
83
132
|
}
|
|
84
133
|
/**
|
|
85
134
|
* Reader over one requester contract / responder contract pair. Construct once
|
|
86
|
-
* per pair and reuse:
|
|
87
|
-
*
|
|
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.
|
|
88
139
|
*/
|
|
89
140
|
export class SignetRequestResponseReader {
|
|
90
141
|
config;
|
|
91
142
|
// Request records never change once stored, so cache them across calls.
|
|
92
143
|
requestCache = new Map();
|
|
144
|
+
responseScans = new Map();
|
|
93
145
|
/**
|
|
94
146
|
* @param config - The contract pair, state source and event source to read
|
|
95
147
|
* through.
|
|
@@ -123,7 +175,7 @@ export class SignetRequestResponseReader {
|
|
|
123
175
|
catch (cause) {
|
|
124
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 });
|
|
125
177
|
}
|
|
126
|
-
const request = lookupSignetRequestAt(state.data, this.config.requesterRequestsPath, requestId);
|
|
178
|
+
const request = lookupSignetRequestAt(state.data, this.config.requesterContractAddress, this.config.requesterRequestsPath, requestId);
|
|
127
179
|
if (request === undefined) {
|
|
128
180
|
throw new Error(`request ${requestId} is not on the requester contract's ledger ` +
|
|
129
181
|
`(request index at path ${JSON.stringify(this.config.requesterRequestsPath)}): was it submitted?`);
|
|
@@ -132,95 +184,200 @@ export class SignetRequestResponseReader {
|
|
|
132
184
|
return request;
|
|
133
185
|
}
|
|
134
186
|
/**
|
|
187
|
+
* Fetch a request record that must carry the evmType2 decomposition.
|
|
188
|
+
*
|
|
135
189
|
* @param requestId - The request id to look up
|
|
136
190
|
* @returns The stored evmType2 request record
|
|
137
191
|
* @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
|
|
138
192
|
*/
|
|
139
193
|
async getEvmType2SignatureRequest(requestId) {
|
|
140
194
|
const request = await this.getSignatureRequest(requestId);
|
|
141
|
-
if (!
|
|
195
|
+
if (!isEvmRequest(request)) {
|
|
142
196
|
throw new Error(`request ${requestId} is not evmType2 (txParamType ${String(request.txParamType)})`);
|
|
143
197
|
}
|
|
144
198
|
return request;
|
|
145
199
|
}
|
|
146
200
|
/**
|
|
201
|
+
* Fetch a request record that must carry the Tron decomposition.
|
|
202
|
+
*
|
|
147
203
|
* @param requestId - The request id to look up
|
|
148
204
|
* @returns The stored Tron request record
|
|
149
205
|
* @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
|
|
150
206
|
*/
|
|
151
207
|
async getTronSignatureRequest(requestId) {
|
|
152
208
|
const request = await this.getSignatureRequest(requestId);
|
|
153
|
-
if (!
|
|
209
|
+
if (!isTronRequest(request)) {
|
|
154
210
|
throw new Error(`request ${requestId} is not tron (txParamType ${String(request.txParamType)})`);
|
|
155
211
|
}
|
|
156
212
|
return request;
|
|
157
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
|
+
}
|
|
222
|
+
/**
|
|
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
|
+
}
|
|
158
237
|
/**
|
|
159
|
-
*
|
|
160
|
-
* `requestId
|
|
161
|
-
*
|
|
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.
|
|
162
242
|
*
|
|
163
|
-
* @param name - The signet event name to keep.
|
|
164
243
|
* @param requestId - The request id the kept posts must declare.
|
|
165
|
-
* @returns The
|
|
244
|
+
* @returns The request's scan state, read up to the indexer's tip.
|
|
166
245
|
*/
|
|
167
|
-
async
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
: { 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 });
|
|
172
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;
|
|
173
257
|
try {
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
|
|
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
|
+
}
|
|
177
274
|
}
|
|
178
275
|
catch {
|
|
179
276
|
// A post that does not decode answers no request, so it must not
|
|
180
277
|
// fail the read of every request.
|
|
181
278
|
}
|
|
182
279
|
}
|
|
183
|
-
return
|
|
280
|
+
return scan;
|
|
184
281
|
}
|
|
185
282
|
/**
|
|
186
|
-
* Fetch every decodable signature response posted under
|
|
187
|
-
* emission order. UNVERIFIED: any post may still be
|
|
188
|
-
* {@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.
|
|
189
286
|
*
|
|
190
287
|
* @param requestId - The request id the posts must declare.
|
|
191
288
|
* @returns The request's posted records, oldest first, empty when none yet.
|
|
192
289
|
*/
|
|
193
290
|
async getSignatureRespondedEvents(requestId) {
|
|
194
|
-
|
|
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)));
|
|
195
317
|
}
|
|
196
318
|
/**
|
|
197
|
-
* Fetch the signature
|
|
198
|
-
* against the evmType2 request:
|
|
199
|
-
* `expectedSigner` over the signing hash of the request's transaction.
|
|
200
|
-
*
|
|
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.
|
|
201
327
|
*
|
|
202
328
|
* @param requestId - The request id to fetch a verified response for.
|
|
203
329
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
204
330
|
* response must be signed by: the requester's MPC-derived address.
|
|
205
|
-
* @returns The first valid response
|
|
331
|
+
* @returns The first valid response, or `undefined` when no valid response
|
|
332
|
+
* has been posted yet: poll again.
|
|
206
333
|
* @throws {Error} When the requester contract has no state, the request is
|
|
207
334
|
* not on its ledger, the request is not an evmType2 record, or
|
|
208
335
|
* `expectedSigner` is not an EVM address.
|
|
209
336
|
*/
|
|
210
337
|
async getVerifiedSignatureRespondedEvent(requestId, expectedSigner) {
|
|
211
|
-
return this.
|
|
338
|
+
return this.firstVerifiedSignatureRespondedEvent(requestId, await this.evmSignerCheck(requestId, expectedSigner));
|
|
212
339
|
}
|
|
213
340
|
/**
|
|
341
|
+
* The Tron twin of {@link getVerifiedSignatureRespondedEvent}: the first response signed by the owner of the request's transaction.
|
|
342
|
+
*
|
|
214
343
|
* @param requestId - The Tron request id to fetch a verified response for
|
|
215
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`
|
|
216
|
-
* @returns The first valid response
|
|
345
|
+
* @returns The first valid response, or `undefined` when no valid response has been posted yet
|
|
217
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
|
|
218
347
|
*/
|
|
219
348
|
async getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey) {
|
|
220
|
-
return this.
|
|
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));
|
|
221
367
|
}
|
|
222
368
|
/**
|
|
223
|
-
* {@link
|
|
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
|
|
224
381
|
* hand: the one ledger read for the request (cached), and no walk of the
|
|
225
382
|
* responder contract's event history. For a consumer that streamed and decoded
|
|
226
383
|
* the history once and verifies many requests against it.
|
|
@@ -236,9 +393,11 @@ export class SignetRequestResponseReader {
|
|
|
236
393
|
* `expectedSigner` is not an EVM address.
|
|
237
394
|
*/
|
|
238
395
|
async verifySignatureRespondedEvents(requestId, expectedSigner, events) {
|
|
239
|
-
return this.
|
|
396
|
+
return judgeSignatureRespondedEvents(requestId, await this.evmSignerCheck(requestId, expectedSigner), events);
|
|
240
397
|
}
|
|
241
398
|
/**
|
|
399
|
+
* The Tron twin of {@link verifySignatureRespondedEvents}: judge the request's responses among decoded events already in hand.
|
|
400
|
+
*
|
|
242
401
|
* @param requestId - The Tron request id to verify responses for
|
|
243
402
|
* @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`
|
|
244
403
|
* @param events - Decoded signet events of any kinds and request ids, in emission order
|
|
@@ -246,15 +405,7 @@ export class SignetRequestResponseReader {
|
|
|
246
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
|
|
247
406
|
*/
|
|
248
407
|
async verifyTronSignatureRespondedEvents(requestId, mpcRootPublicKey, events) {
|
|
249
|
-
return this.
|
|
250
|
-
}
|
|
251
|
-
async verifyEvmSignatureResponses(requestId, expectedSigner, responses) {
|
|
252
|
-
const request = await this.getEvmType2SignatureRequest(requestId);
|
|
253
|
-
return judgeSignatureResponses(responses, getAddress(expectedSigner), (response) => recoverEvmSignatureResponseSigner(request, response), (response) => verifyEvmSignatureRespondedEvent(request, response, expectedSigner));
|
|
254
|
-
}
|
|
255
|
-
async verifyTronSignatureResponses(requestId, mpcRootPublicKey, responses) {
|
|
256
|
-
const request = await this.getTronSignatureRequest(requestId);
|
|
257
|
-
return judgeSignatureResponses(responses, deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).base58, (response) => recoverTronSignatureResponseSigner(request, response, mpcRootPublicKey), (response) => verifyTronSignatureRespondedEvent(request, response, mpcRootPublicKey));
|
|
408
|
+
return judgeSignatureRespondedEvents(requestId, await this.tronSignerCheck(requestId, mpcRootPublicKey), events);
|
|
258
409
|
}
|
|
259
410
|
/**
|
|
260
411
|
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
@@ -288,13 +439,15 @@ export class SignetRequestResponseReader {
|
|
|
288
439
|
*/
|
|
289
440
|
async getSignedEvmTransaction(requestId, expectedSigner) {
|
|
290
441
|
const request = await this.getEvmType2SignatureRequest(requestId);
|
|
291
|
-
const
|
|
442
|
+
const verified = await this.getVerifiedSignatureRespondedEvent(requestId, expectedSigner);
|
|
292
443
|
if (verified === undefined) {
|
|
293
444
|
return undefined;
|
|
294
445
|
}
|
|
295
446
|
return signBidirectionalEventToSignedEvmTransaction(request, verified);
|
|
296
447
|
}
|
|
297
448
|
/**
|
|
449
|
+
* Assemble the broadcast-ready signed Tron transaction for a request, attaching the first verified response.
|
|
450
|
+
*
|
|
298
451
|
* @param requestId - The request id to produce a signed transaction for
|
|
299
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`
|
|
300
453
|
* @returns The signed protobuf `Transaction` bytes, or `undefined` when no valid response has been posted yet
|
|
@@ -302,14 +455,14 @@ export class SignetRequestResponseReader {
|
|
|
302
455
|
*/
|
|
303
456
|
async getSignedTronTransaction(requestId, mpcRootPublicKey) {
|
|
304
457
|
const request = await this.getTronSignatureRequest(requestId);
|
|
305
|
-
const
|
|
458
|
+
const verified = await this.getVerifiedTronSignatureRespondedEvent(requestId, mpcRootPublicKey);
|
|
306
459
|
if (verified === undefined) {
|
|
307
460
|
return undefined;
|
|
308
461
|
}
|
|
309
462
|
return buildSignedTronTransaction(buildTronRawTransaction(request.txParams, deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).bytes), verified.signature);
|
|
310
463
|
}
|
|
311
464
|
/**
|
|
312
|
-
* Fetch every decodable respond-bidirectional response posted under
|
|
465
|
+
* Fetch every distinct decodable respond-bidirectional response posted under
|
|
313
466
|
* `requestId`, in emission order. UNVERIFIED: any post may still be
|
|
314
467
|
* garbage, sift with {@link getVerifiedRespondBidirectionalEvent} (or
|
|
315
468
|
* in-circuit at claim time) first.
|
|
@@ -318,7 +471,30 @@ export class SignetRequestResponseReader {
|
|
|
318
471
|
* @returns The request's posted records, oldest first, empty when none yet.
|
|
319
472
|
*/
|
|
320
473
|
async getRespondBidirectionalEvents(requestId) {
|
|
321
|
-
|
|
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;
|
|
322
498
|
}
|
|
323
499
|
/**
|
|
324
500
|
* Fetch the respond-bidirectional posts declared under `requestId` and
|
|
@@ -327,7 +503,9 @@ export class SignetRequestResponseReader {
|
|
|
327
503
|
* `serializedOutput`: the off-chain twin of the check the client contract
|
|
328
504
|
* runs in-circuit. The output must be the exact unpadded bytes the
|
|
329
505
|
* attestation commits to, so a post that verifies here is the post that
|
|
330
|
-
* 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.
|
|
331
509
|
*
|
|
332
510
|
* @param requestId - The request id the posts must declare and the
|
|
333
511
|
* attestation must commit to.
|
|
@@ -339,7 +517,12 @@ export class SignetRequestResponseReader {
|
|
|
339
517
|
* posted yet (poll again) or none attests this output.
|
|
340
518
|
*/
|
|
341
519
|
async getVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey) {
|
|
342
|
-
|
|
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;
|
|
343
526
|
}
|
|
344
527
|
}
|
|
345
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;AAKhE,OAAO,EAAE,UAAU,EAAoB,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAEL,oBAAoB,EACpB,qCAAqC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,sBAAsB,EAGtB,eAAe,EAEf,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,gCAAgC,EAChC,4BAA4B,GAG7B,MAAM,sBAAsB,CAAC;AAE9B,O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EAChB,6CAA6C,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,KAAK,CAC/E,EACD,QAAQ,CAAC,SAAS,CACnB,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,6BAA6B,CACjC,SAAuB;QAEvB,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,oCAAoC,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,MAA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AAI,QAAQ;gBAAE,OAAO,SAAS,CAAC,IAAI,CAAC;QACtC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,oCAAoC,CACxC,SAAuB,EACvB,gBAA4B,EAC5B,cAA8B;QAE9B,MAAM,QAAQ,GACZ,IAAI,CAAC,mBAAmB,CACtB,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,0BAA0B,EACzD,cAAc,CACf;YACD,IAAI,CAAC,mBAAmB,CACtB,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B,EAChE,cAAc,CACf,CAAC;QACJ,OAAO,QAAQ,KAAK,SAAS;YAC3B,oBAAoB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB,EAAE,QAAQ,CAAC,UAAU,CAAC;YAC5F,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -68,7 +68,7 @@ export declare const MPCDestination: {
|
|
|
68
68
|
* schemas and the reserved MPC parameters stay out.
|
|
69
69
|
*/
|
|
70
70
|
export interface RequestIdPreimage {
|
|
71
|
-
/** MPC
|
|
71
|
+
/** MPC signing key version (1). */
|
|
72
72
|
keyVersion: bigint;
|
|
73
73
|
/** Address of the client contract that stores this event (`kernel.self()`). */
|
|
74
74
|
sender: ContractAddress;
|
|
@@ -93,7 +93,7 @@ export interface RequestIdPreimage {
|
|
|
93
93
|
* contract-declared byte widths in their array lengths.
|
|
94
94
|
*/
|
|
95
95
|
export interface SignBidirectionalEvent<TxParams = EvmType2TxParams> {
|
|
96
|
-
/** MPC
|
|
96
|
+
/** MPC signing key version (1). */
|
|
97
97
|
keyVersion: bigint;
|
|
98
98
|
/** Address of the client contract that stores this event (`kernel.self()`). */
|
|
99
99
|
sender: ContractAddress;
|
|
@@ -116,18 +116,22 @@ export interface SignBidirectionalEvent<TxParams = EvmType2TxParams> {
|
|
|
116
116
|
/** Reserved and ignored by the MPC, contract-declared width (zero in the V1 helper). */
|
|
117
117
|
respondSerializationSchema: Uint8Array;
|
|
118
118
|
}
|
|
119
|
-
/** */
|
|
119
|
+
/** A request record of any decomposition this SDK reads: evmType2 or Tron. */
|
|
120
120
|
export type AnySignBidirectionalEvent = SignBidirectionalEvent | SignBidirectionalEvent<TronTxParams>;
|
|
121
121
|
/**
|
|
122
|
+
* Type guard: narrow a request record to the evmType2 decomposition by its tag.
|
|
123
|
+
*
|
|
122
124
|
* @param request - The request record
|
|
123
125
|
* @returns `true` iff the record is tagged {@link TxParamType.evmType2}
|
|
124
126
|
*/
|
|
125
|
-
export declare function
|
|
127
|
+
export declare function isEvmRequest(request: AnySignBidirectionalEvent): request is SignBidirectionalEvent;
|
|
126
128
|
/**
|
|
129
|
+
* Type guard: narrow a request record to the Tron decomposition by its tag.
|
|
130
|
+
*
|
|
127
131
|
* @param request - The request record
|
|
128
132
|
* @returns `true` iff the record is tagged {@link TxParamType.tron}
|
|
129
133
|
*/
|
|
130
|
-
export declare function
|
|
134
|
+
export declare function isTronRequest(request: AnySignBidirectionalEvent): request is SignBidirectionalEvent<TronTxParams>;
|
|
131
135
|
/**
|
|
132
136
|
* Descriptor of {@link RequestIdPreimage}: what {@link calculateRequestId}
|
|
133
137
|
* hashes, in Compact declaration order.
|