@sig-net/midnight 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -48
- package/dist/constants.d.ts +55 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +85 -5
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +6 -5
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +5 -4
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +12 -1
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +8 -6
- package/dist/managed/contract/index.js +76 -60
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +29 -10
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +67 -21
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.d.ts.map +1 -1
- package/dist/signature-response-verification.js +3 -3
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signature-state-reading.d.ts +17 -25
- package/dist/signature-state-reading.d.ts.map +1 -1
- package/dist/signature-state-reading.js +39 -59
- package/dist/signature-state-reading.js.map +1 -1
- package/dist/signet-contract-events.d.ts +262 -0
- package/dist/signet-contract-events.d.ts.map +1 -0
- package/dist/signet-contract-events.js +266 -0
- package/dist/signet-contract-events.js.map +1 -0
- package/dist/signet-evtype2tx-requests.d.ts +4 -4
- package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
- package/dist/signet-evtype2tx-requests.js +3 -3
- package/dist/signet-request-feed.d.ts +59 -34
- package/dist/signet-request-feed.d.ts.map +1 -1
- package/dist/signet-request-feed.js +95 -62
- package/dist/signet-request-feed.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +70 -62
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +88 -102
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.js +2 -2
- package/dist/signet-requests.js.map +1 -1
- package/package.json +2 -2
- package/src/Signet.compact +90 -43
- package/dist/signet-contract-state-reader.d.ts +0 -241
- package/dist/signet-contract-state-reader.d.ts.map +0 -1
- package/dist/signet-contract-state-reader.js +0 -345
- package/dist/signet-contract-state-reader.js.map +0 -1
- package/dist/signet-request-resolver.d.ts +0 -60
- package/dist/signet-request-resolver.d.ts.map +0 -1
- package/dist/signet-request-resolver.js +0 -78
- package/dist/signet-request-resolver.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PublicDataProvider } from "@midnight-ntwrk/midnight-js-types";
|
|
2
2
|
import type { Transaction } from "ethers";
|
|
3
|
-
import { type SignatureRespondedEvent, type RespondBidirectionalEvent } from "./signet-contract-
|
|
3
|
+
import { type SignetEventSource, type SignatureRespondedEvent, type RespondBidirectionalEvent } from "./signet-contract-events.ts";
|
|
4
4
|
import { type Secp256k1Point } from "./ecdsa-attestation.ts";
|
|
5
5
|
import type { RawContractState } from "./signature-state-reading.ts";
|
|
6
6
|
import { type SignBidirectionalEvent, type RequestIdHex } from "./signet-requests.ts";
|
|
@@ -27,21 +27,27 @@ export interface SignetRequestResponseReaderConfig {
|
|
|
27
27
|
/** Address of the signet-compliant requester contract (e.g. the vault). */
|
|
28
28
|
readonly requesterContractAddress: string;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* same
|
|
32
|
-
*
|
|
33
|
-
* the reader cannot
|
|
30
|
+
* Resolved ledger-tree path of the requester contract's request index: the
|
|
31
|
+
* same path the contract packs as `requestsPath` in its notifications
|
|
32
|
+
* (`[4]` for a flat contract's field 4, longer once chunking applies). A
|
|
33
|
+
* contract is free to declare the index at any field, so the reader cannot
|
|
34
|
+
* assume one.
|
|
34
35
|
*/
|
|
35
|
-
readonly
|
|
36
|
+
readonly requesterRequestsPath: readonly number[];
|
|
36
37
|
/** Address of the central signet contract. */
|
|
37
38
|
readonly signetContractAddress: string;
|
|
38
39
|
/** Source of raw contract state, e.g. midnight-js's `indexerPublicDataProvider`. */
|
|
39
40
|
readonly publicDataProvider: SignetPublicStateSource;
|
|
41
|
+
/**
|
|
42
|
+
* Source of the signet contract's emitted events. Adapt a full provider
|
|
43
|
+
* with `signetEventSourceFromPublicDataProvider`.
|
|
44
|
+
*/
|
|
45
|
+
readonly eventSource: SignetEventSource;
|
|
40
46
|
}
|
|
41
|
-
/** The verdict on one
|
|
47
|
+
/** The verdict on one emitted response, in emission order. */
|
|
42
48
|
export interface SignatureResponseVerdict {
|
|
43
|
-
/** 0-based position of the post
|
|
44
|
-
|
|
49
|
+
/** 0-based position of the post among the request's signature-response events. */
|
|
50
|
+
index: bigint;
|
|
45
51
|
/** The posted signature record, verbatim. */
|
|
46
52
|
response: SignatureRespondedEvent;
|
|
47
53
|
/** Recovered signer address, absent when the signature did not decode. */
|
|
@@ -52,13 +58,13 @@ export interface SignatureResponseVerdict {
|
|
|
52
58
|
/** Result of {@link SignetRequestResponseReader['getVerifiedSignatureRespondedEvent']}. */
|
|
53
59
|
export interface VerifiedSignatureResponseResult {
|
|
54
60
|
/**
|
|
55
|
-
* The first valid response (lowest
|
|
61
|
+
* The first valid response (lowest index), or `undefined` when no valid
|
|
56
62
|
* response has been posted yet: poll again.
|
|
57
63
|
*/
|
|
58
64
|
verified?: SignatureRespondedEvent;
|
|
59
65
|
/**
|
|
60
|
-
* One verdict per post,
|
|
61
|
-
* callers decide how to surface rejected posts.
|
|
66
|
+
* One verdict per post, emission order. Pure data: the reader never logs,
|
|
67
|
+
* so callers decide how to surface rejected posts.
|
|
62
68
|
*/
|
|
63
69
|
verdicts: SignatureResponseVerdict[];
|
|
64
70
|
}
|
|
@@ -66,65 +72,71 @@ export interface VerifiedSignatureResponseResult {
|
|
|
66
72
|
* Reader over one requester contract / signet contract pair.
|
|
67
73
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
68
74
|
* are immutable, the ledger key is their hash), so repeated verification
|
|
69
|
-
* calls cost one
|
|
75
|
+
* calls cost one event query each.
|
|
70
76
|
*/
|
|
71
77
|
export declare class SignetRequestResponseReader {
|
|
72
78
|
private readonly config;
|
|
73
79
|
private readonly requestCache;
|
|
74
80
|
/**
|
|
75
|
-
* @param config - The contract pair and
|
|
81
|
+
* @param config - The contract pair, state source and event source to read
|
|
82
|
+
* through.
|
|
76
83
|
*/
|
|
77
84
|
constructor(config: SignetRequestResponseReaderConfig);
|
|
78
|
-
/**
|
|
79
|
-
* Query one contract's raw state, throwing a uniform error when absent.
|
|
80
|
-
*
|
|
81
|
-
* @param contractAddress - The contract to query.
|
|
82
|
-
* @param role - Human name of the contract for the error message.
|
|
83
|
-
* @returns The raw ledger state tree.
|
|
84
|
-
* @throws Error when the address holds no contract state.
|
|
85
|
-
*/
|
|
86
|
-
private queryRawState;
|
|
87
85
|
/**
|
|
88
86
|
* Fetch the request record for `requestId` from the requester contract's
|
|
89
|
-
* request index (at the configured `
|
|
87
|
+
* request index (at the configured `requesterRequestsPath`). Cached
|
|
90
88
|
* after the first fetch.
|
|
91
89
|
*
|
|
92
90
|
* @param requestId - The request id to look up.
|
|
93
91
|
* @returns The stored request record.
|
|
94
92
|
* @throws Error when the requester contract has no state or holds no
|
|
95
|
-
* request under `requestId` at the configured index
|
|
93
|
+
* request under `requestId` at the configured index path.
|
|
96
94
|
*/
|
|
97
95
|
getSignatureRequest(requestId: RequestIdHex): Promise<SignBidirectionalEvent>;
|
|
98
96
|
/**
|
|
99
|
-
* Fetch every
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* Fetch every event of `name` the signet contract has emitted, decode each
|
|
98
|
+
* with `decode`, and keep the posts whose declared request id is
|
|
99
|
+
* `requestId`, in emission order. The declared id is routing data only:
|
|
100
|
+
* the verified getters run the actual authenticity checks.
|
|
101
|
+
*
|
|
102
|
+
* @param name - The signet event name to keep.
|
|
103
|
+
* @param decode - The payload decoder for that event kind.
|
|
104
|
+
* @param requestId - The request id the kept posts must declare.
|
|
105
|
+
* @returns The kept posts' records, oldest first.
|
|
106
|
+
*/
|
|
107
|
+
private getRespondPostsNamed;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch every signature response posted under `requestId`, in emission
|
|
110
|
+
* order. UNVERIFIED: the declared id is routing data on an unauthenticated
|
|
111
|
+
* event log, so any post may still be garbage (see
|
|
112
|
+
* {@link getVerifiedSignatureRespondedEvent}, where verification
|
|
113
|
+
* establishes authenticity).
|
|
102
114
|
*
|
|
103
|
-
* @param requestId - The request id
|
|
104
|
-
* @returns The posted
|
|
105
|
-
* @throws Error when the responses contract has no state, or its counter
|
|
106
|
-
* disagrees with the log (inconsistent ledger).
|
|
115
|
+
* @param requestId - The request id the posts must declare.
|
|
116
|
+
* @returns The request's posted records, oldest first, empty when none yet.
|
|
107
117
|
*/
|
|
108
|
-
|
|
118
|
+
getSignatureRespondedEvents(requestId: RequestIdHex): Promise<SignatureRespondedEvent[]>;
|
|
109
119
|
/**
|
|
110
|
-
* Fetch
|
|
111
|
-
* signature must recover to
|
|
112
|
-
* (compared case-insensitively) over the signing hash of
|
|
113
|
-
* the request record describes. The first valid post wins,
|
|
114
|
-
* gets a verdict so callers can report the noise.
|
|
120
|
+
* Fetch the signature responses posted under `requestId` and verify each
|
|
121
|
+
* against the request: a post's signature must recover to
|
|
122
|
+
* `expectedSigner` (compared case-insensitively) over the signing hash of
|
|
123
|
+
* the transaction the request record describes. The first valid post wins,
|
|
124
|
+
* and every candidate gets a verdict so callers can report the noise. The
|
|
125
|
+
* declared id only routes: this verification is what separates the genuine
|
|
126
|
+
* response from garbage posted under the same id.
|
|
115
127
|
*
|
|
116
128
|
* @param requestId - The request id to fetch a verified response for.
|
|
117
129
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
118
130
|
* response must be signed by: the requester's MPC-derived address.
|
|
119
131
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
120
|
-
* @throws Error when
|
|
121
|
-
*
|
|
132
|
+
* @throws Error when the requester contract has no state or the request is
|
|
133
|
+
* not on its ledger.
|
|
122
134
|
*/
|
|
123
135
|
getVerifiedSignatureRespondedEvent(requestId: RequestIdHex, expectedSigner: string): Promise<VerifiedSignatureResponseResult>;
|
|
124
136
|
/**
|
|
125
137
|
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
126
138
|
* transaction the MPC signs, assembled from the request record's decomposed
|
|
127
|
-
* fields. No
|
|
139
|
+
* fields. No event query: this needs only the request record
|
|
128
140
|
* (fetched via {@link getSignatureRequest}, cached).
|
|
129
141
|
*
|
|
130
142
|
* @param requestId - The request id whose transaction to rebuild.
|
|
@@ -138,7 +150,7 @@ export declare class SignetRequestResponseReader {
|
|
|
138
150
|
* Assemble the broadcast-ready signed EIP-1559 transaction for `requestId`:
|
|
139
151
|
* rebuild the request's transaction and attach the first VERIFIED response
|
|
140
152
|
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}:
|
|
141
|
-
* the
|
|
153
|
+
* the event log is unauthenticated, so an `expectedSigner` is required
|
|
142
154
|
* and unverified posts are never attached).
|
|
143
155
|
*
|
|
144
156
|
* @param requestId - The request id to produce a signed transaction for.
|
|
@@ -147,47 +159,43 @@ export declare class SignetRequestResponseReader {
|
|
|
147
159
|
* @returns The signed ethers transaction (`serialized` is the payload for
|
|
148
160
|
* `eth_sendRawTransaction`), or `undefined` when no valid response has
|
|
149
161
|
* been posted yet: poll again.
|
|
150
|
-
* @throws Error when
|
|
151
|
-
*
|
|
162
|
+
* @throws Error when the requester contract has no state or the request is
|
|
163
|
+
* not on its ledger.
|
|
152
164
|
*/
|
|
153
165
|
getSignedEvmTransaction(requestId: RequestIdHex, expectedSigner: string): Promise<Transaction | undefined>;
|
|
154
166
|
/**
|
|
155
|
-
* Fetch every respond-bidirectional response posted
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
167
|
+
* Fetch every respond-bidirectional response posted under `requestId`, in
|
|
168
|
+
* emission order. UNVERIFIED: the declared id is routing data on an
|
|
169
|
+
* unauthenticated event log, so verifying a post against the MPC response
|
|
170
|
+
* key you expect is still the only way to pick the genuine one: in-circuit
|
|
171
|
+
* at claim time, or off chain with
|
|
172
|
+
* {@link verifyRespondBidirectionalSignature} over the output you fetched.
|
|
173
|
+
* An empty array simply means none posted yet: poll again.
|
|
162
174
|
*
|
|
163
|
-
* @param requestId - The request id
|
|
164
|
-
* @returns The posted records,
|
|
165
|
-
* @throws Error when the signet contract has no state, or its counter
|
|
166
|
-
* disagrees with the log (inconsistent ledger).
|
|
175
|
+
* @param requestId - The request id the posts must declare.
|
|
176
|
+
* @returns The request's posted records, oldest first, empty when none yet.
|
|
167
177
|
*/
|
|
168
178
|
getRespondBidirectionalEvents(requestId: RequestIdHex): Promise<RespondBidirectionalEvent[]>;
|
|
169
179
|
/**
|
|
170
|
-
* Fetch the respond-bidirectional posts
|
|
171
|
-
* first (
|
|
180
|
+
* Fetch the respond-bidirectional posts declared under `requestId` and
|
|
181
|
+
* return the first (oldest) one whose signature verifies over
|
|
172
182
|
* `serializedOutput` against `mpcResponseKey`: the off-chain twin of the
|
|
173
183
|
* check the client contract runs in-circuit, and the only way to pick a
|
|
174
|
-
* genuine post out of an unauthenticated log
|
|
175
|
-
* but a signature.
|
|
184
|
+
* genuine post out of an unauthenticated event log.
|
|
176
185
|
*
|
|
177
186
|
* The output must be the exact unpadded bytes the attestation commits to
|
|
178
187
|
* (the packed respond payload, recomputed from the execution output the
|
|
179
188
|
* client fetched), so a post that verifies here is the post that proves at
|
|
180
189
|
* claim time.
|
|
181
190
|
*
|
|
182
|
-
* @param requestId - The request id
|
|
191
|
+
* @param requestId - The request id the posts must declare and the
|
|
192
|
+
* attestation must commit to.
|
|
183
193
|
* @param serializedOutput - The serialised execution output the attestation
|
|
184
194
|
* must commit to, exact unpadded bytes.
|
|
185
195
|
* @param mpcResponseKey - The MPC response key the requesting contract
|
|
186
196
|
* pinned at deploy (see `deriveMidnightResponseKey`).
|
|
187
197
|
* @returns The first verifying post, or `undefined` when none has been
|
|
188
198
|
* posted yet (poll again) or none attests this output.
|
|
189
|
-
* @throws Error when the signet contract has no state, or its counter
|
|
190
|
-
* disagrees with the log (inconsistent ledger).
|
|
191
199
|
*/
|
|
192
200
|
getVerifiedRespondBidirectionalEvent(requestId: RequestIdHex, serializedOutput: Uint8Array, mpcResponseKey: Secp256k1Point): Promise<RespondBidirectionalEvent | undefined>;
|
|
193
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,kBAAkB,CAChB,eAAe,EAAE,UAAU,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,GACvE,OAA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AC;IAQrC;;;;;;;;;;;;;;;OAeG;IACG,kCAAkC,CACtC,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,+BAA+B,CAAC;IAiC3C;;;;;;;;;;;OAWG;IACG,yBAAyB,CAC7B,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,WAAW,CAAC;IAMvB;;;;;;;;;;;;;;;OAeG;IACG,uBAAuB,CAC3B,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAcnC;;;;;;;;;;;OAWG;IACG,6BAA6B,CACjC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAQvC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,oCAAoC,CACxC,SAAS,EAAE,YAAY,EACvB,gBAAgB,EAAE,UAAU,EAC5B,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;CAWlD"}
|
|
@@ -1,138 +1,140 @@
|
|
|
1
1
|
// One-stop client-side reader for the signet request/response flow: fetch a
|
|
2
|
-
// request record from the requester contract's ledger,
|
|
3
|
-
// the signet contract
|
|
4
|
-
// against the request.
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
2
|
+
// request record from the requester contract's ledger, read the request's
|
|
3
|
+
// responses out of the contract events the signet contract emits, and verify
|
|
4
|
+
// each candidate against the request.
|
|
5
|
+
// A response is a Misc contract event that carries the request id it answers
|
|
6
|
+
// beside a signature. The id is UNAUTHENTICATED routing data: it scopes a
|
|
7
|
+
// read to one request's posts, and VERIFICATION establishes authenticity. A
|
|
8
|
+
// signature response answers a request exactly when it recovers to that
|
|
9
|
+
// request's derived signer over the request's transaction, and a
|
|
10
|
+
// respond-bidirectional post answers exactly when it verifies over
|
|
11
|
+
// (requestId, output) against the request's MPC response key. This class
|
|
12
|
+
// packages that flow so every consumer (CLI poller, integration tests, a
|
|
13
|
+
// future UI) shares one implementation. Single-shot by design: each call
|
|
14
|
+
// queries once, and the caller owns any poll loop.
|
|
11
15
|
import { lookupSignetRequestAt } from "./signature-requests-state-reader.js";
|
|
12
|
-
import {
|
|
16
|
+
import { decodeRespondBidirectionalEventPayload, decodeSignatureRespondedEventPayload, SignetEventName, } from "./signet-contract-events.js";
|
|
13
17
|
import { recoverSignatureResponseSigner } from "./signature-response-verification.js";
|
|
14
18
|
import { verifyRespondBidirectionalSignature, } from "./ecdsa-attestation.js";
|
|
15
19
|
import { signBidirectionalEventToSignedEvmTransaction, signBidirectionalEventToUnsignedEvmTransaction, } from "./signet-evtype2tx-requests.js";
|
|
16
|
-
import { requestIdBytes, } from "./signet-requests.js";
|
|
20
|
+
import { requestIdBytes, requestIdHex, } from "./signet-requests.js";
|
|
17
21
|
/**
|
|
18
22
|
* Reader over one requester contract / signet contract pair.
|
|
19
23
|
* Construct once per pair and reuse: fetched request records are cached (they
|
|
20
24
|
* are immutable, the ledger key is their hash), so repeated verification
|
|
21
|
-
* calls cost one
|
|
25
|
+
* calls cost one event query each.
|
|
22
26
|
*/
|
|
23
27
|
export class SignetRequestResponseReader {
|
|
24
28
|
config;
|
|
25
29
|
// Request records never change once stored, so cache them across calls.
|
|
26
30
|
requestCache = new Map();
|
|
27
31
|
/**
|
|
28
|
-
* @param config - The contract pair and
|
|
32
|
+
* @param config - The contract pair, state source and event source to read
|
|
33
|
+
* through.
|
|
29
34
|
*/
|
|
30
35
|
constructor(config) {
|
|
31
36
|
this.config = config;
|
|
32
37
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Query one contract's raw state, throwing a uniform error when absent.
|
|
35
|
-
*
|
|
36
|
-
* @param contractAddress - The contract to query.
|
|
37
|
-
* @param role - Human name of the contract for the error message.
|
|
38
|
-
* @returns The raw ledger state tree.
|
|
39
|
-
* @throws Error when the address holds no contract state.
|
|
40
|
-
*/
|
|
41
|
-
async queryRawState(contractAddress, role) {
|
|
42
|
-
const state = await this.config.publicDataProvider.queryContractState(contractAddress);
|
|
43
|
-
if (!state?.data) {
|
|
44
|
-
throw new Error(`no state data found for ${role} contract '${contractAddress}' (is it deployed?)`);
|
|
45
|
-
}
|
|
46
|
-
return state.data;
|
|
47
|
-
}
|
|
48
38
|
/**
|
|
49
39
|
* Fetch the request record for `requestId` from the requester contract's
|
|
50
|
-
* request index (at the configured `
|
|
40
|
+
* request index (at the configured `requesterRequestsPath`). Cached
|
|
51
41
|
* after the first fetch.
|
|
52
42
|
*
|
|
53
43
|
* @param requestId - The request id to look up.
|
|
54
44
|
* @returns The stored request record.
|
|
55
45
|
* @throws Error when the requester contract has no state or holds no
|
|
56
|
-
* request under `requestId` at the configured index
|
|
46
|
+
* request under `requestId` at the configured index path.
|
|
57
47
|
*/
|
|
58
48
|
async getSignatureRequest(requestId) {
|
|
59
49
|
const cached = this.requestCache.get(requestId);
|
|
60
50
|
if (cached !== undefined) {
|
|
61
51
|
return cached;
|
|
62
52
|
}
|
|
63
|
-
const
|
|
64
|
-
|
|
53
|
+
const state = await this.config.publicDataProvider.queryContractState(this.config.requesterContractAddress);
|
|
54
|
+
if (!state?.data) {
|
|
55
|
+
throw new Error(`no state data found for requester contract '${this.config.requesterContractAddress}' (is it deployed?)`);
|
|
56
|
+
}
|
|
57
|
+
const request = lookupSignetRequestAt(state.data, this.config.requesterRequestsPath, requestId);
|
|
65
58
|
if (request === undefined) {
|
|
66
59
|
throw new Error(`request ${requestId} is not on the requester contract's ledger ` +
|
|
67
|
-
`(request index at
|
|
60
|
+
`(request index at path ${JSON.stringify(this.config.requesterRequestsPath)}): was it submitted?`);
|
|
68
61
|
}
|
|
69
62
|
this.requestCache.set(requestId, request);
|
|
70
63
|
return request;
|
|
71
64
|
}
|
|
72
65
|
/**
|
|
73
|
-
* Fetch every
|
|
74
|
-
*
|
|
75
|
-
*
|
|
66
|
+
* Fetch every event of `name` the signet contract has emitted, decode each
|
|
67
|
+
* with `decode`, and keep the posts whose declared request id is
|
|
68
|
+
* `requestId`, in emission order. The declared id is routing data only:
|
|
69
|
+
* the verified getters run the actual authenticity checks.
|
|
76
70
|
*
|
|
77
|
-
* @param
|
|
78
|
-
* @
|
|
79
|
-
* @
|
|
80
|
-
*
|
|
71
|
+
* @param name - The signet event name to keep.
|
|
72
|
+
* @param decode - The payload decoder for that event kind.
|
|
73
|
+
* @param requestId - The request id the kept posts must declare.
|
|
74
|
+
* @returns The kept posts' records, oldest first.
|
|
81
75
|
*/
|
|
82
|
-
async
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
async getRespondPostsNamed(name, decode, requestId) {
|
|
77
|
+
const events = await this.config.eventSource.querySignetEvents(this.config.signetContractAddress);
|
|
78
|
+
return events
|
|
79
|
+
.filter((event) => event.name === name)
|
|
80
|
+
.map((event) => decode(event.payload))
|
|
81
|
+
.filter((post) => requestIdHex(post.requestId) === requestId)
|
|
82
|
+
.map((post) => post.event);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Fetch every signature response posted under `requestId`, in emission
|
|
86
|
+
* order. UNVERIFIED: the declared id is routing data on an unauthenticated
|
|
87
|
+
* event log, so any post may still be garbage (see
|
|
88
|
+
* {@link getVerifiedSignatureRespondedEvent}, where verification
|
|
89
|
+
* establishes authenticity).
|
|
90
|
+
*
|
|
91
|
+
* @param requestId - The request id the posts must declare.
|
|
92
|
+
* @returns The request's posted records, oldest first, empty when none yet.
|
|
93
|
+
*/
|
|
94
|
+
async getSignatureRespondedEvents(requestId) {
|
|
95
|
+
return this.getRespondPostsNamed(SignetEventName.SignatureRespondedEvent, decodeSignatureRespondedEventPayload, requestId);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Fetch
|
|
99
|
-
* signature must recover to
|
|
100
|
-
* (compared case-insensitively) over the signing hash of
|
|
101
|
-
* the request record describes. The first valid post wins,
|
|
102
|
-
* gets a verdict so callers can report the noise.
|
|
98
|
+
* Fetch the signature responses posted under `requestId` and verify each
|
|
99
|
+
* against the request: a post's signature must recover to
|
|
100
|
+
* `expectedSigner` (compared case-insensitively) over the signing hash of
|
|
101
|
+
* the transaction the request record describes. The first valid post wins,
|
|
102
|
+
* and every candidate gets a verdict so callers can report the noise. The
|
|
103
|
+
* declared id only routes: this verification is what separates the genuine
|
|
104
|
+
* response from garbage posted under the same id.
|
|
103
105
|
*
|
|
104
106
|
* @param requestId - The request id to fetch a verified response for.
|
|
105
107
|
* @param expectedSigner - The EVM address (0x hex, any case) the genuine
|
|
106
108
|
* response must be signed by: the requester's MPC-derived address.
|
|
107
109
|
* @returns The first valid response (if any) plus per-post verdicts.
|
|
108
|
-
* @throws Error when
|
|
109
|
-
*
|
|
110
|
+
* @throws Error when the requester contract has no state or the request is
|
|
111
|
+
* not on its ledger.
|
|
110
112
|
*/
|
|
111
113
|
async getVerifiedSignatureRespondedEvent(requestId, expectedSigner) {
|
|
112
114
|
const request = await this.getSignatureRequest(requestId);
|
|
113
|
-
const responses = await this.
|
|
114
|
-
const verdicts = responses.map((response,
|
|
115
|
-
const
|
|
115
|
+
const responses = await this.getSignatureRespondedEvents(requestId);
|
|
116
|
+
const verdicts = responses.map((response, position) => {
|
|
117
|
+
const index = BigInt(position);
|
|
116
118
|
let signer;
|
|
117
119
|
try {
|
|
118
120
|
signer = recoverSignatureResponseSigner(request, response);
|
|
119
121
|
}
|
|
120
122
|
catch (error) {
|
|
121
123
|
return {
|
|
122
|
-
|
|
124
|
+
index,
|
|
123
125
|
response,
|
|
124
126
|
rejectedReason: `not a decodable signature (${String(error)})`,
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
129
|
if (signer.toLowerCase() !== expectedSigner.toLowerCase()) {
|
|
128
130
|
return {
|
|
129
|
-
|
|
131
|
+
index,
|
|
130
132
|
response,
|
|
131
133
|
signer,
|
|
132
134
|
rejectedReason: `signed by ${signer}, expected ${expectedSigner}`,
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
|
-
return {
|
|
137
|
+
return { index, response, signer };
|
|
136
138
|
});
|
|
137
139
|
return {
|
|
138
140
|
verified: verdicts.find((v) => v.rejectedReason === undefined)?.response,
|
|
@@ -142,7 +144,7 @@ export class SignetRequestResponseReader {
|
|
|
142
144
|
/**
|
|
143
145
|
* Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
|
|
144
146
|
* transaction the MPC signs, assembled from the request record's decomposed
|
|
145
|
-
* fields. No
|
|
147
|
+
* fields. No event query: this needs only the request record
|
|
146
148
|
* (fetched via {@link getSignatureRequest}, cached).
|
|
147
149
|
*
|
|
148
150
|
* @param requestId - The request id whose transaction to rebuild.
|
|
@@ -158,7 +160,7 @@ export class SignetRequestResponseReader {
|
|
|
158
160
|
* Assemble the broadcast-ready signed EIP-1559 transaction for `requestId`:
|
|
159
161
|
* rebuild the request's transaction and attach the first VERIFIED response
|
|
160
162
|
* signed by `expectedSigner` (see {@link getVerifiedSignatureRespondedEvent}:
|
|
161
|
-
* the
|
|
163
|
+
* the event log is unauthenticated, so an `expectedSigner` is required
|
|
162
164
|
* and unverified posts are never attached).
|
|
163
165
|
*
|
|
164
166
|
* @param requestId - The request id to produce a signed transaction for.
|
|
@@ -167,8 +169,8 @@ export class SignetRequestResponseReader {
|
|
|
167
169
|
* @returns The signed ethers transaction (`serialized` is the payload for
|
|
168
170
|
* `eth_sendRawTransaction`), or `undefined` when no valid response has
|
|
169
171
|
* been posted yet: poll again.
|
|
170
|
-
* @throws Error when
|
|
171
|
-
*
|
|
172
|
+
* @throws Error when the requester contract has no state or the request is
|
|
173
|
+
* not on its ledger.
|
|
172
174
|
*/
|
|
173
175
|
async getSignedEvmTransaction(requestId, expectedSigner) {
|
|
174
176
|
const { verified } = await this.getVerifiedSignatureRespondedEvent(requestId, expectedSigner);
|
|
@@ -181,56 +183,40 @@ export class SignetRequestResponseReader {
|
|
|
181
183
|
return signBidirectionalEventToSignedEvmTransaction(request, verified);
|
|
182
184
|
}
|
|
183
185
|
/**
|
|
184
|
-
* Fetch every respond-bidirectional response posted
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
186
|
+
* Fetch every respond-bidirectional response posted under `requestId`, in
|
|
187
|
+
* emission order. UNVERIFIED: the declared id is routing data on an
|
|
188
|
+
* unauthenticated event log, so verifying a post against the MPC response
|
|
189
|
+
* key you expect is still the only way to pick the genuine one: in-circuit
|
|
190
|
+
* at claim time, or off chain with
|
|
191
|
+
* {@link verifyRespondBidirectionalSignature} over the output you fetched.
|
|
192
|
+
* An empty array simply means none posted yet: poll again.
|
|
191
193
|
*
|
|
192
|
-
* @param requestId - The request id
|
|
193
|
-
* @returns The posted records,
|
|
194
|
-
* @throws Error when the signet contract has no state, or its counter
|
|
195
|
-
* disagrees with the log (inconsistent ledger).
|
|
194
|
+
* @param requestId - The request id the posts must declare.
|
|
195
|
+
* @returns The request's posted records, oldest first, empty when none yet.
|
|
196
196
|
*/
|
|
197
197
|
async getRespondBidirectionalEvents(requestId) {
|
|
198
|
-
|
|
199
|
-
const { respondBidirectionalCounterMap, respondBidirectionalMap } = readSignetContractLedgerFromState(raw);
|
|
200
|
-
const totalPosts = respondBidirectionalCounterMap.get(requestId) ?? 0n;
|
|
201
|
-
const responses = [];
|
|
202
|
-
for (let count = 0n; count < totalPosts; count++) {
|
|
203
|
-
const response = respondBidirectionalMap.get(signetMapEntryKey(requestId, count));
|
|
204
|
-
if (response === undefined) {
|
|
205
|
-
throw new Error(`respond-bidirectional log has no entry ${count} for request ${requestId} ` +
|
|
206
|
-
`despite its counter reading ${totalPosts}: ledger state is inconsistent`);
|
|
207
|
-
}
|
|
208
|
-
responses.push(response);
|
|
209
|
-
}
|
|
210
|
-
return responses;
|
|
198
|
+
return this.getRespondPostsNamed(SignetEventName.RespondBidirectionalEvent, decodeRespondBidirectionalEventPayload, requestId);
|
|
211
199
|
}
|
|
212
200
|
/**
|
|
213
|
-
* Fetch the respond-bidirectional posts
|
|
214
|
-
* first (
|
|
201
|
+
* Fetch the respond-bidirectional posts declared under `requestId` and
|
|
202
|
+
* return the first (oldest) one whose signature verifies over
|
|
215
203
|
* `serializedOutput` against `mpcResponseKey`: the off-chain twin of the
|
|
216
204
|
* check the client contract runs in-circuit, and the only way to pick a
|
|
217
|
-
* genuine post out of an unauthenticated log
|
|
218
|
-
* but a signature.
|
|
205
|
+
* genuine post out of an unauthenticated event log.
|
|
219
206
|
*
|
|
220
207
|
* The output must be the exact unpadded bytes the attestation commits to
|
|
221
208
|
* (the packed respond payload, recomputed from the execution output the
|
|
222
209
|
* client fetched), so a post that verifies here is the post that proves at
|
|
223
210
|
* claim time.
|
|
224
211
|
*
|
|
225
|
-
* @param requestId - The request id
|
|
212
|
+
* @param requestId - The request id the posts must declare and the
|
|
213
|
+
* attestation must commit to.
|
|
226
214
|
* @param serializedOutput - The serialised execution output the attestation
|
|
227
215
|
* must commit to, exact unpadded bytes.
|
|
228
216
|
* @param mpcResponseKey - The MPC response key the requesting contract
|
|
229
217
|
* pinned at deploy (see `deriveMidnightResponseKey`).
|
|
230
218
|
* @returns The first verifying post, or `undefined` when none has been
|
|
231
219
|
* posted yet (poll again) or none attests this output.
|
|
232
|
-
* @throws Error when the signet contract has no state, or its counter
|
|
233
|
-
* disagrees with the log (inconsistent ledger).
|
|
234
220
|
*/
|
|
235
221
|
async getVerifiedRespondBidirectionalEvent(requestId, serializedOutput, mpcResponseKey) {
|
|
236
222
|
const events = await this.getRespondBidirectionalEvents(requestId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"signet-request-response-reader.js","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,sCAAsC;AACtC,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,iEAAiE;AACjE,mEAAmE;AACnE,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,mDAAmD;AAKnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,sCAAsC,EACtC,oCAAoC,EACpC,eAAe,GAKhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EACL,mCAAmC,GAEpC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,4CAA4C,EAC5C,8CAA8C,GAC/C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,cAAc,EACd,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAsE9B;;;;;GAKG;AACH,MAAM,OAAO,2BAA2B;IACrB,MAAM,CAAoC;IAE3D,wEAAwE;IACvD,YAAY,GAAG,IAAI,GAAG,EAGpC,CAAC;IAEJ;;;OAGG;IACH,YAAY,MAAyC;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,mBAAmB,CACvB,SAAuB;QAEvB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,CACnE,IAAI,CAAC,MAAM,CAAC,wBAAwB,CACrC,CAAC;QACF,IAAI,CAAC,KAAK,EAAE,IAAI,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AC7B,SAAuB;QAEvB,OAAO,8CAA8C,CACnD,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAC1C,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,uBAAuB,CAC3B,SAAuB,EACvB,cAAsB;QAEtB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,kCAAkC,CAChE,SAAS,EACT,cAAc,CACf,CAAC;QACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,4EAA4E;QAC5E,wCAAwC;QACxC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO,4CAA4C,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,6BAA6B,CACjC,SAAuB;QAEvB,OAAO,IAAI,CAAC,oBAAoB,CAC9B,eAAe,CAAC,yBAAyB,EACzC,sCAAsC,EACtC,SAAS,CACV,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,oCAAoC,CACxC,SAAuB,EACvB,gBAA4B,EAC5B,cAA8B;QAE9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3B,mCAAmC,CACjC,cAAc,CAAC,SAAS,CAAC,EACzB,gBAAgB,EAChB,KAAK,EACL,cAAc,CACf,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/signet-requests.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
// the assertion, so any structural drift between the generated managed types
|
|
17
17
|
// and these twins fails that package's `yarn build` / `yarn test`.
|
|
18
18
|
//
|
|
19
|
-
// Read more:
|
|
20
|
-
//
|
|
19
|
+
// Read more: the module header in Signet.compact (key derivation, event
|
|
20
|
+
// flow) and this package's README ("Sign bidirectional flow").
|
|
21
21
|
import { CompactTypeBoolean, CompactTypeBytes, CompactTypeEnum, CompactTypeUnsignedInteger, } from "@midnight-ntwrk/compact-runtime";
|
|
22
22
|
/**
|
|
23
23
|
* Which transaction-param decomposition a request carries (Compact:
|