@sig-net/midnight 0.15.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 +113 -49
- 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-manifest.json +2 -2
- package/dist/managed/contract/index.js +31 -31
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +23 -5
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +50 -5
- 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.js +2 -2
- 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 +62 -55
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +85 -99
- 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 +43 -36
- package/dist/signet-contract-state-reader.d.ts +0 -247
- package/dist/signet-contract-state-reader.d.ts.map +0 -1
- package/dist/signet-contract-state-reader.js +0 -363
- 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
package/README.md
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
# @sig-net/midnight
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The [Sig Network](https://sig.network) [Distributed MPC](https://github.com/sig-net/mpc) integration for the [Midnight blockchain](https://midnight.network) lets contracts on Midnight execute arbitrary transactions on foreign blockchains, and respond to the results of those transactions.
|
|
4
|
+
|
|
5
|
+
`@sig-net/midnight` is the client-agnostic protocol library for that integration. It carries everything a Midnight contract or off-chain client needs to speak the signet protocol (the MPC's [sign bidirectional flow](#sign-bidirectional-flow)). It does not bind to any particular contract.
|
|
4
6
|
|
|
5
7
|
> ## 🚧 Under Construction 🚧
|
|
6
8
|
>
|
|
7
9
|
> This Sig Network Midnight integration is still under construction.
|
|
8
10
|
> Use at your own risk and expect rapid iteration.
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## Package Contents
|
|
13
|
+
This package has 2 components:
|
|
14
|
+
|
|
15
|
+
- **Compact module** for contract code on chain: `.compact` sources for Compact contracts to import the protocol structs and circuits directly:
|
|
11
16
|
|
|
12
|
-
- **Shared Compact modules**: the package ships its `.compact` sources, so contracts import them directly:
|
|
13
17
|
```compact
|
|
14
18
|
import "@sig-net/midnight/src/Signet";
|
|
15
19
|
```
|
|
16
|
-
- **Compiled pure circuits** (`pureCircuits`): the executable reference implementation of the client-agnostic circuits (the deploy-time key pin, the notification packer, the ABI word builders and readers). Off-chain code calls these compiled artefacts, so it always agrees with what the contracts prove. The attestation digest and response verification are not among them: their compiled circuits are fixed-width oracles used only by this package's tests, and the sanctioned off-chain path is the TypeScript twin (`calculateSignetAttestationDigest`, and `verifyRespondBidirectionalSignature` for ordinary ECDSA verification against the expected MPC response key), which those tests pin against the oracles: byte-for-byte for the digest, verdict-for-verdict for the verification.
|
|
17
|
-
- **TypeScript twins of the wire structs** and signet request-id computation.
|
|
18
|
-
- **State readers, request feed and resolver**: poll the signet contract for pending requests and their signature / remote-execution responses.
|
|
19
|
-
- **Crypto helpers**: epsilon derivation and ECDSA attestation verification.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
- **TypeScript library** for clients off chain: readers that poll the signet contract and verify the MPC's responses, key derivation and attestation crypto, output serialisation, the published per-network addresses and contstant values, and typed twins of the on-chain structs and circuits.
|
|
22
|
+
|
|
23
|
+
The [Export highlights](#export-highlights) section lists the specific exports each task uses.
|
|
22
24
|
|
|
23
25
|
## Install
|
|
24
26
|
|
|
@@ -28,39 +30,50 @@ npm install @sig-net/midnight
|
|
|
28
30
|
|
|
29
31
|
## Sign bidirectional flow
|
|
30
32
|
|
|
31
|
-
The flow
|
|
33
|
+
The flow has 5 steps:
|
|
32
34
|
|
|
33
|
-
1. Client calls a contract on Midnight
|
|
34
|
-
2. The Sig Network MPC
|
|
35
|
-
3.
|
|
36
|
-
4. The
|
|
37
|
-
5.
|
|
35
|
+
1. Client calls a contract on Midnight. The contract requests a signature for a transaction destined for a foreign chain. The signature is made with a key derived for the requesting contract (see [Derived keys](#derived-keys)).
|
|
36
|
+
2. The Sig Network MPC serves the request: it generates the transaction signature and posts it back to Midnight to the Sig Network Singleton Contract.
|
|
37
|
+
3. The client extracts the signature (from the Sig Network Singleton) and uses it to submit the signed transaction to the foreign chain.
|
|
38
|
+
4. The MPC observes the foreign transaction and posts an attestation of the execution back to Midnight to the Sig Network Singleton Contract. The attestation is an ECDSA signature over the digest `keccak256(requestId || serializedOutput)` created using the requesting contract's MPC response key (see [Derived keys](#derived-keys)). Both the digest and the output itself travel off chain.
|
|
39
|
+
5. The client obtains the execution output off chain (it broadcast the transaction in step 3, so it can read the result, see the output recovery note below for more details). It extracts the posted attestation and submits both back to the calling Midnight contract (same contract as step 1). The contract recomputes the digest from the output bytes and verifies the MPC's signature in-circuit against its own response key (see [Derived keys](#derived-keys)). The contract can then respond to the foreign execution output. This completes the foreign transaction execution.
|
|
38
40
|
|
|
39
|
-
> **Output recovery:** how the client reads the execution output is chain-specific. For EVM chains it is the mined call's return data
|
|
41
|
+
> **Output recovery:** how the client reads the execution output is chain-specific. For EVM chains it is the mined call's return data. Extract it with `debug_traceTransaction` (callTracer, top call frame), the same RPC method the MPC observes executions with. Clients without trace access can fetch the raw output from the fakenet responder's helper API at `GET /responses/{requestId}` (served by [`ResponsesApi.ts`](https://github.com/sig-net/solana-signet-program/blob/fakenet-v0.8.0/fakenet-signer/src/server/ResponsesApi.ts), port 3040 in the local stack). The fetched bytes stay untrusted until step 5's in-circuit signature verification.
|
|
40
42
|
|
|
41
43
|
## Derived keys
|
|
42
44
|
|
|
43
|
-
Every key the MPC uses is derived for the requesting contract and a path. There are two kinds
|
|
45
|
+
Every key the MPC uses is derived for the requesting contract and a path. There are two kinds. The request signing key: derived from a path chosen by the requesting contract. The response signing key: derived from a path fixed by the protocol. Both key derivations are **scoped by the address** of the requesting contract ensuring that only a requesting contract has access to its own keys.
|
|
44
46
|
|
|
45
47
|
### Request signing key
|
|
46
48
|
|
|
47
|
-
The key the MPC
|
|
49
|
+
The key the MPC uses to sign requested foreign transactions:
|
|
48
50
|
|
|
49
|
-
`requestSigningKey = f(mpcRootKey[keyVersion], contractAddress, path)`
|
|
51
|
+
`requestSigningKey = f(mpcRootKey[keyVersion], caip2ChainId, contractAddress, hex::encode(path))`
|
|
50
52
|
|
|
51
|
-
The path is 32 opaque bytes of the contract's choosing (
|
|
53
|
+
The path is 32 opaque bytes of the contract's choosing (for example a fixed literal for a contract-owned account like "vault", or a hash of a caller's secret for per-user accounts). There are no format requirements: any 32 bytes are valid. **CRITICAL:** the MPC renders the path as `hex::encode(path)` before it derives the key: lowercase hex of the full 32 bytes, no trimming, no `0x` prefix. The contract address is always part of the derivation, so no contract can reach another contract's derived keys.
|
|
52
54
|
|
|
53
55
|
### Response key
|
|
54
56
|
|
|
55
|
-
The key the MPC
|
|
57
|
+
The key the MPC uses to sign remote execution attestations when it posts them back to Midnight:
|
|
56
58
|
|
|
57
|
-
`responseKey = f(mpcRootKey[keyVersion], contractAddress, "midnight response key")`
|
|
59
|
+
`responseKey = f(mpcRootKey[keyVersion], caip2ChainId, contractAddress, "midnight response key")`
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
This is the same derivation, but with the path fixed to the literal `"midnight response key"`. This fixed path is a protocol string that enters the derivation verbatim (no hex rendering, unlike a request's 32 path bytes). Each contract therefore has one well-known response key. A contract pins its own response key in its ledger after deploy, and verifies every response against it in-circuit (step 5 of the flow above).
|
|
62
|
+
|
|
63
|
+
> **keyVersion** is the version of the MPC root key that the derivation starts from. Current deployments use version `1`.
|
|
64
|
+
>
|
|
65
|
+
> **caip2ChainId** is the id of the chain the request originates from, in [CAIP-2](https://chainagnostic.org/CAIPs/caip-2) form. For signature requests made on Midnight it is the Midnight variant (currently `midnight:testnet`). It is not the target chain id carried in the request record's `caip2Id` field.
|
|
60
66
|
|
|
61
67
|
## Integrator guide
|
|
62
68
|
|
|
63
|
-
A signet-compliant client contract does four things:
|
|
69
|
+
A signet-compliant client contract does four things:
|
|
70
|
+
|
|
71
|
+
- it stores its requests in a public `SignBidirectionalEventMap` in its own ledger
|
|
72
|
+
- it pins its counterparties: the Signet singleton contract and its own MPC response key
|
|
73
|
+
- it submits signature requests
|
|
74
|
+
- it verifies execution responses in-circuit
|
|
75
|
+
|
|
76
|
+
The integration consists of:
|
|
64
77
|
|
|
65
78
|
- 3 once-off **setup** steps
|
|
66
79
|
- 5 per-request **runtime** steps that drive the full sign bidirectional flow
|
|
@@ -75,15 +88,15 @@ Set up your contract for integration with the Sig Network MPC's sign bidirection
|
|
|
75
88
|
import "@sig-net/midnight/src/Signet";
|
|
76
89
|
```
|
|
77
90
|
|
|
78
|
-
Then
|
|
91
|
+
Then point the compact compiler at the npm packages with its `COMPACT_PATH` environment variable at compile time:
|
|
79
92
|
|
|
80
93
|
```sh
|
|
81
94
|
COMPACT_PATH=node_modules compact compile --feature-zkir-v3 src/my-contract.compact src/managed/my-contract
|
|
82
95
|
```
|
|
83
96
|
|
|
84
|
-
Compile with the pinned toolchain (currently `compact update 0.33.0-rc.2`) and always pass `--feature-zkir-v3
|
|
97
|
+
Compile with the pinned toolchain (currently `compact update 0.33.0-rc.2`), and always pass `--feature-zkir-v3`. Compiled output without that flag is not compatible with the ledger-9 matched stack (node, indexer, proof server).
|
|
85
98
|
|
|
86
|
-
2. Declare the required Sig Network protocol state in your ledger
|
|
99
|
+
2. Declare the required Sig Network protocol state in your ledger, plus the recommended deployer identity and initialisation state. The event map can sit at ANY ledger field. Each notification that your contract emits carries the map's resolved ledger-tree path (see [The request map's ledger-tree path](#the-request-maps-ledger-tree-path)), and the MPC reads the authenticated request from there.
|
|
87
100
|
|
|
88
101
|
```compact
|
|
89
102
|
// Required: Map of SignBidirectionalEvent signature requests, configured by transaction type.
|
|
@@ -143,31 +156,41 @@ Set up your contract for integration with the Sig Network MPC's sign bidirection
|
|
|
143
156
|
|
|
144
157
|
### The request map's ledger-tree path
|
|
145
158
|
|
|
146
|
-
Each notification must tell the MPC where your `signBidirectionalEventMap` sits in your contract's compiled on-chain state
|
|
159
|
+
Each notification must tell the MPC where your `signBidirectionalEventMap` sits in your contract's compiled on-chain state. The MPC uses this location to read the authenticated request out of raw contract state. The location is a path in the state tree, passed to `constructSignBidirectionalEventNotificationV1` as two arguments:
|
|
147
160
|
|
|
148
161
|
- `requestsPathDepth`: the number of meaningful entries in the path (1 to 4).
|
|
149
162
|
- `requestsPath`: the path itself, zero padded to 4 entries.
|
|
150
163
|
|
|
151
|
-
The path shape comes from how compactc lays out state. The compiler packs a contract's public ledger fields into a tree whose array nodes hold at most 15 entries. With 15 or fewer fields, field N sits directly in the root array, at path `[N]` (depth 1). With more than 15 fields, the compiler groups the fields into segments of at most 15 (the remainder segment first) and the root array holds the segments. Each grouping adds one level to the tree and one entry to every field's path. A 20-field contract splits 5 + 15: field 4 sits at `[0, 4]` and field 19 sits at `[1, 14]` (depth 2).
|
|
164
|
+
The path shape comes from how compactc lays out state. The compiler packs a contract's public ledger fields into a tree whose array nodes hold at most 15 entries. With 15 or fewer fields, field N sits directly in the root array, at path `[N]` (depth 1). With more than 15 fields, the compiler groups the fields into segments of at most 15 (the remainder segment first), and the root array holds the segments. Each grouping adds one level to the tree and one entry to every field's path. A 20-field contract splits 5 + 15: field 4 sits at `[0, 4]` and field 19 sits at `[1, 14]` (depth 2).
|
|
152
165
|
|
|
153
|
-
Do not derive the path by hand
|
|
166
|
+
**Do not derive the path by hand**. The compiler records it in your compiled artefacts. Compile your contract, then look up your request map's `"path"` in its generated accessor in `managed/<contract>/contract/index.js`. Its accessor shows the indices that the Signet Protocol needs: for example `state.asArray()[1].asArray()[14]` for a map recorded at `[1, 14]`. That path packs as `requestsPathDepth = 2` and `requestsPath = [1, 14, 0, 0]`.
|
|
154
167
|
|
|
155
168
|
The two caller contracts in the [sig-net/midnight-integration](https://github.com/sig-net/midnight-integration) repository are worked examples of each case:
|
|
156
169
|
|
|
157
|
-
- [`test-caller-contract`](https://github.com/sig-net/midnight-integration/tree/main/packages/test-caller-contract): the flat case
|
|
158
|
-
- [`test-caller-contract-20-field`](https://github.com/sig-net/midnight-integration/tree/main/packages/test-caller-contract-20-field): the chunked case
|
|
170
|
+
- [`test-caller-contract`](https://github.com/sig-net/midnight-integration/tree/main/packages/test-caller-contract): the flat case. Its 8-field ledger stores the map at field 4, so notifications carry depth `1` and path `[4, 0, 0, 0]`.
|
|
171
|
+
- [`test-caller-contract-20-field`](https://github.com/sig-net/midnight-integration/tree/main/packages/test-caller-contract-20-field): the chunked case. Its 20 fields split 5 + 15, so the map at field 19 packs as depth `2` and path `[1, 14, 0, 0]`.
|
|
159
172
|
|
|
160
173
|
### Runtime
|
|
161
174
|
|
|
162
175
|
Each interaction with your contract that executes a transaction on a foreign chain runs these 5 steps.
|
|
163
176
|
|
|
164
|
-
Steps 1 and 5 are circuits on your contract
|
|
177
|
+
Steps 1 and 5 are circuits on your contract. Steps 2 to 4 are off-chain client code built on the utilities in `@sig-net/midnight`.
|
|
165
178
|
|
|
166
|
-
The off-chain steps share one `SignetRequestResponseReader` over your contract
|
|
179
|
+
The off-chain steps share two values. The first is one `SignetRequestResponseReader` over your contract and the Signet singleton. The second is the expected signer of the requested transaction: the key the MPC derives for your contract and the request's path (see [Derived keys](#derived-keys)).
|
|
167
180
|
|
|
168
181
|
```ts
|
|
169
182
|
import { indexerPublicDataProvider } from "@midnight-ntwrk/midnight-js-indexer-public-data-provider";
|
|
170
|
-
import {
|
|
183
|
+
import {
|
|
184
|
+
deriveEvmAddress,
|
|
185
|
+
signetEventSourceFromPublicDataProvider,
|
|
186
|
+
SignetRequestResponseReader,
|
|
187
|
+
} from "@sig-net/midnight";
|
|
188
|
+
|
|
189
|
+
// Provider to index Midnight Blockchain
|
|
190
|
+
const publicDataProvider = indexerPublicDataProvider({
|
|
191
|
+
queryURL: indexerUrl,
|
|
192
|
+
subscriptionURL: indexerWsUrl
|
|
193
|
+
});
|
|
171
194
|
|
|
172
195
|
// SignetRequestResponseReader to poll for Signed Transactions and Signed RespondBidirectionalEvents
|
|
173
196
|
const reader = new SignetRequestResponseReader({
|
|
@@ -180,17 +203,22 @@ const reader = new SignetRequestResponseReader({
|
|
|
180
203
|
// Address of the Signet singleton contract
|
|
181
204
|
signetContractAddress,
|
|
182
205
|
|
|
183
|
-
//
|
|
184
|
-
publicDataProvider
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
206
|
+
// Raw contract state reads (your contract's request map)
|
|
207
|
+
publicDataProvider,
|
|
208
|
+
|
|
209
|
+
// The MPC's responses are read from the contract events the Signet
|
|
210
|
+
// singleton emits, through the same provider
|
|
211
|
+
eventSource: signetEventSourceFromPublicDataProvider(publicDataProvider),
|
|
188
212
|
});
|
|
189
213
|
|
|
190
214
|
const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my-path");
|
|
191
215
|
```
|
|
192
216
|
|
|
193
|
-
|
|
217
|
+
> **mpcRootPublicKey** is the root public key of the MPC network. On a local stack there is no fixed value: the [integration-test setup](https://github.com/sig-net/midnight-integration/tree/main/packages/integration-tests) generates a fresh `MPC_ROOT_KEY`, prints it during setup and appends it to the repo-root `.env`. For the public networks (stagenet, preview, preprod, mainnet) the fixed values are published in this package via `getMpcRootPublicKey` (placeholders until each network's key is published).
|
|
218
|
+
>
|
|
219
|
+
> **signetContractAddress** is the address of the deployed Signet singleton contract. On a local stack the same setup deploys a fresh singleton, prints the address as `MIDNIGHT_SIGNET_CONTRACT_ADDRESS` and appends it to `.env`. For the public networks the addresses are published in this package via `getSignetContractAddress` (placeholders until each deployment lands).
|
|
220
|
+
|
|
221
|
+
1. Store a signature request and notify the MPC via a cross contract call. Build (or overwrite) every part of the transaction your contract enforces in-circuit, calldata above all (see [EVM Type 2 transactions and ABI calldata words](#evm-type-2-transactions-and-abi-calldata-words)). Never pass caller input through unchecked:
|
|
194
222
|
|
|
195
223
|
```compact
|
|
196
224
|
// Construct SignBidirectionalEvent signature request and calculate its RequestId
|
|
@@ -214,9 +242,9 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
214
242
|
);
|
|
215
243
|
```
|
|
216
244
|
|
|
217
|
-
**NOTE:** `requestId`
|
|
245
|
+
**NOTE:** Return `requestId` from this circuit call so the client can use it in the next steps. You can also compute it off-chain with the `calculateRequestId` TS twin.
|
|
218
246
|
|
|
219
|
-
2. Poll the Signet singleton for the MPC's signature response. The response log is unauthenticated (anyone can post), so use the verifying getter
|
|
247
|
+
2. Poll the Signet singleton for the MPC's signature response. The singleton emits each response as a contract event that carries the request id it answers beside the signature. The id is unauthenticated routing data: it scopes the read to your request's posts and proves nothing. The event log is unauthenticated (anyone can post under any id), so use the verifying getter. It only returns a post whose signature recovers to `expectedSigner` over the signing hash of the requested transaction:
|
|
220
248
|
|
|
221
249
|
```ts
|
|
222
250
|
const { verified } = await reader.getVerifiedSignatureRespondedEvent(requestId, expectedSigner);
|
|
@@ -232,7 +260,7 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
232
260
|
await new JsonRpcProvider(foreignChainRpcUrl).broadcastTransaction(signedTx.serialized);
|
|
233
261
|
```
|
|
234
262
|
|
|
235
|
-
4. Poll the Signet singleton for the MPC's attestation of the remote execution output
|
|
263
|
+
4. Poll the Signet singleton for the MPC's attestation of the remote execution output. The MPC posts it once it observes the transaction execute on the foreign chain, and the singleton emits it as a contract event that carries the request id beside the MPC's signature. Both the attestation digest and the serialised output travel off chain (you broadcast the transaction in step 3, so you can read its result). The event log is unauthenticated, so use the verifying getter, as in step 2. It reads your request's posts by id, recomputes the digest over the output that you present, and only returns a post whose signature verifies against the response key of your contract.
|
|
236
264
|
|
|
237
265
|
```ts
|
|
238
266
|
const respondBidirectionalEvent = await reader.getVerifiedRespondBidirectionalEvent(
|
|
@@ -243,7 +271,7 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
243
271
|
// undefined: no attestation of that output posted yet, poll again.
|
|
244
272
|
```
|
|
245
273
|
|
|
246
|
-
5. Deliver the response and the serialised output to your contract
|
|
274
|
+
5. Deliver the response and the serialised output to your contract. The contract recomputes the attestation digest, verifies the event in-circuit against the response key pinned in Setup step 3, and consumes the request. The width argument is the exact packed size of your respond serialisation schema (a single bool packs to 1 byte):
|
|
247
275
|
|
|
248
276
|
```compact
|
|
249
277
|
assert(
|
|
@@ -255,9 +283,9 @@ const expectedSigner = deriveEvmAddress(mpcRootPublicKey, myContractAddress, "my
|
|
|
255
283
|
|
|
256
284
|
## EVM Type 2 transactions and ABI calldata words
|
|
257
285
|
|
|
258
|
-
An `EvmType2TxParams` request decomposes the EVM transaction into typed fields your contract can enforce
|
|
286
|
+
An `EvmType2TxParams` request decomposes the EVM transaction into typed fields, so your contract can enforce each field in-circuit. Its optional `calldata` is an `EvmCalldata<maxWords>`: the 4-byte function selector plus a list of 32-byte ABI words, per the [Solidity ABI spec](https://docs.soliditylang.org/en/latest/abi-spec.html). Slots past `noWords` are unused capacity and never reach the transaction.
|
|
259
287
|
|
|
260
|
-
Every word must be stored in canonical ABI form (big-endian). The MPC signs a transaction whose calldata is exactly `selector || words[0..noWords]`, byte for byte
|
|
288
|
+
Every word must be stored in canonical ABI form (big-endian). The MPC signs a transaction whose calldata is exactly `selector || words[0..noWords]`, byte for byte. A word stored in any other form becomes a signed transaction that calls the foreign contract with garbage arguments. Compact's integer casts are little-endian, so do not hand-roll the byte order. Build every word with the module's helper circuits, and read words back with the matching readers.
|
|
261
289
|
|
|
262
290
|
| Solidity type | Build with | Read back with |
|
|
263
291
|
|---|---|---|
|
|
@@ -295,7 +323,9 @@ const calldata = EvmCalldata<2> {
|
|
|
295
323
|
};
|
|
296
324
|
```
|
|
297
325
|
|
|
298
|
-
The readers run the same rules in the other direction
|
|
326
|
+
The readers run the same rules in the other direction. They reject any non-canonical word outright (no silent truncation or coercion).
|
|
327
|
+
|
|
328
|
+
The builders and readers apply to CALLDATA words only. The serialised output a settle circuit verifies (the explicit `serializedOutput` argument `verifyRespondBidirectionalEvent` recomputes the attestation digest from) is NOT ABI words. It is the packed respond payload produced from the request's respond serialisation schema (a bool packs to 1 byte). The circuit reads it with a single stdlib `deserialize<T, N>` call, where `T` is a struct that mirrors the schema and `N` is the schema's packed size. For an ERC20 `transfer`'s `bool` return under a one-field bool schema:
|
|
299
329
|
|
|
300
330
|
```compact
|
|
301
331
|
struct TransferResult {
|
|
@@ -306,9 +336,43 @@ const result = deserialize<TransferResult, 1>(serializedOutput);
|
|
|
306
336
|
assert(result.success, "Remote transfer failed");
|
|
307
337
|
```
|
|
308
338
|
|
|
309
|
-
**Respond schema range trap:** the respond serialisation maps `uint256`, `address` and `field` to Compact `Field
|
|
339
|
+
**Respond schema range trap:** the respond serialisation maps `uint256`, `address` and `field` to Compact `Field`. `Field` values must lie strictly below the BLS12-381 Fr modulus (just under 2^255). An EVM `uint256` at or above Fr cannot be respond-serialised, and `serializeRespondOutput` throws at respond time (a max-uint256 allowance readback is the everyday case). When the full 256-bit range matters, declare the field as `bytes32` in the respond schema instead.
|
|
340
|
+
|
|
341
|
+
The same builders and readers exist as TypeScript twins under identical names, for composing expected words off-chain (UIs, expected-record builders, tests). This package's test suite keeps them in lockstep with the compiled circuits.
|
|
342
|
+
|
|
343
|
+
## Export highlights
|
|
344
|
+
|
|
345
|
+
The exports you reach for when integrating, by task.
|
|
346
|
+
|
|
347
|
+
### Compact module
|
|
348
|
+
|
|
349
|
+
What your contract imports with `import "@sig-net/midnight/src/Signet"`:
|
|
350
|
+
|
|
351
|
+
| Task | Exports |
|
|
352
|
+
|---|---|
|
|
353
|
+
| Declare the protocol ledger state (setup step 2) | `SignBidirectionalEventMap` (the request map the MPC reads) and `SignetSigner` (the Signet singleton's cross-contract-call interface, pinned at deploy). |
|
|
354
|
+
| Build and store a signature request (runtime step 1) | `constructSignBidirectionalEvent` and `calculateRequestId`, over the request structs `EvmType2TxParams`, `EvmCalldata` and `EvmAccessListEntry`. |
|
|
355
|
+
| Notify the MPC of the request (runtime step 1) | `constructSignBidirectionalEventNotificationV1`: packs your contract's address and the request map's ledger-tree path. |
|
|
356
|
+
| Build and read calldata words in-circuit | The builders `evmAddressAbiWord`, `numericAbiWord` and `boolAbiWord`, and the readers `abiWordToUint128` and `abiWordToBool` (see [EVM Type 2 transactions and ABI calldata words](#evm-type-2-transactions-and-abi-calldata-words)). |
|
|
357
|
+
| Verify the execution attestation (runtime step 5) | `verifyRespondBidirectionalEvent`: recomputes the attestation digest from the output bytes and checks the MPC's signature against your pinned response key. |
|
|
358
|
+
|
|
359
|
+
### TypeScript library
|
|
360
|
+
|
|
361
|
+
What clients import from `@sig-net/midnight`:
|
|
310
362
|
|
|
311
|
-
|
|
363
|
+
| Task | Exports |
|
|
364
|
+
|---|---|
|
|
365
|
+
| Poll for the MPC's responses and verify them (runtime steps 2 to 4) | `SignetRequestResponseReader`: one reader per contract and Signet singleton pair. Its getters `getVerifiedSignatureRespondedEvent`, `getSignedEvmTransaction` and `getVerifiedRespondBidirectionalEvent` map to steps 2, 3 and 4. |
|
|
366
|
+
| Derive the key the MPC signs your requests with | `deriveEvmAddress`: the expected signer address checked in step 2 (see [Derived keys](#derived-keys)). |
|
|
367
|
+
| Derive the response key your deploy pins | `deriveMidnightResponseKey`: the key `initialise` stores (setup step 3), derived from your contract's address. |
|
|
368
|
+
| Look up published counterparty values | `MidnightNetwork`, `getMpcRootPublicKey` and `getSignetContractAddress`: the fixed per-network values (see the notes in [Runtime](#runtime)). |
|
|
369
|
+
| Compute a request id off chain | `calculateRequestId`: the TS twin of the on-chain circuit, plus `requestIdHex` and `parseRequestIdHex` for the hex form. |
|
|
370
|
+
| Compose expected calldata words off chain (UIs, expected-record builders, tests) | The builders `numericAbiWord`, `evmAddressAbiWord` and `boolAbiWord`, and the readers `abiWordToUint128` and `abiWordToBool`: TS twins of the circuits under identical names (see [EVM Type 2 transactions and ABI calldata words](#evm-type-2-transactions-and-abi-calldata-words)). |
|
|
371
|
+
| Convert a foreign execution output into respond bytes | `deserializeEvmOutput` (raw EVM return data to named values) and `serializeRespondOutput` (named values to the packed respond payload the MPC attests): together they rebuild the `serializedOutput` of steps 4 and 5. |
|
|
372
|
+
| Recognise a failed remote execution | `MPC_FAILURE_OUTPUT` and `isMpcFailureOutput`: the MPC's fixed 5-byte failure payload for reverted or replaced transactions. |
|
|
373
|
+
| Verify attestations without the reader | `calculateSignetAttestationDigest` and `verifyRespondBidirectionalSignature`: the checks the reader runs internally, exposed for custom pipelines. |
|
|
374
|
+
| Discover requests MPC-side (responders, background workers) | `SignetRequestFeed`: polls the signet contract's emitted notification events, enumerates each named caller's own request map (the authenticated read), and dedupes by request id. |
|
|
375
|
+
| Call the compiled protocol circuits | `pureCircuits`: the compiled circuits of `Signet.compact`, for example the notification packer. Off-chain code calls these compiled artefacts, so it always agrees with what the contracts prove. |
|
|
312
376
|
|
|
313
377
|
## More examples
|
|
314
378
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -55,4 +55,59 @@ export declare const SIGNET_DEFAULT_KEY_VERSION = 1n;
|
|
|
55
55
|
* @throws If the encoded text does not fit in `length` bytes.
|
|
56
56
|
*/
|
|
57
57
|
export declare function asciiPadded(text: string, length: number): Uint8Array;
|
|
58
|
+
/**
|
|
59
|
+
* A named Midnight network: the single source of the network names shared
|
|
60
|
+
* across the `@sig-net/midnight*` packages. midnight-js types a network id
|
|
61
|
+
* as a bare `string` with no companion enum, so the names live here, and
|
|
62
|
+
* `@sig-net/midnight-contract-deploy`'s network-id plumbing widens this
|
|
63
|
+
* enum back to the SDK's string type for its deploy config.
|
|
64
|
+
*/
|
|
65
|
+
export declare enum MidnightNetwork {
|
|
66
|
+
/** Local standalone stack (Docker node, indexer and proof server on localhost). */
|
|
67
|
+
Undeployed = "undeployed",
|
|
68
|
+
/** Public staging network, pre-preview. */
|
|
69
|
+
Stagenet = "stagenet",
|
|
70
|
+
/** Public test network for early and breaking changes (bleeding-edge ledger). */
|
|
71
|
+
Preview = "preview",
|
|
72
|
+
/** Public test network that mirrors mainnet config: the final staging step. */
|
|
73
|
+
Preprod = "preprod",
|
|
74
|
+
/** Production network (live, real value). */
|
|
75
|
+
Mainnet = "mainnet"
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A public, long-lived Midnight network: every named network except the
|
|
79
|
+
* local standalone stack. Only these have fixed protocol counterparty
|
|
80
|
+
* values published in this package (see {@link getMpcRootPublicKey} and
|
|
81
|
+
* {@link getSignetContractAddress}); a local stack generates its own values
|
|
82
|
+
* per deployment instead.
|
|
83
|
+
*/
|
|
84
|
+
export type DeployedNetwork = Exclude<MidnightNetwork, MidnightNetwork.Undeployed>;
|
|
85
|
+
/**
|
|
86
|
+
* The MPC root public key of a deployed Midnight network, as hex: the
|
|
87
|
+
* `mpcRootPublicKey` every client key derivation starts from (see
|
|
88
|
+
* `deriveEvmAddress`). Only the {@link DeployedNetwork} networks have a
|
|
89
|
+
* fixed key. A local standalone stack has none: its setup generates a fresh
|
|
90
|
+
* `MPC_ROOT_KEY` per stack (the integration-test setup prints it and
|
|
91
|
+
* appends it to the repo-root `.env`).
|
|
92
|
+
*
|
|
93
|
+
* @param networkId - The deployed network to look up.
|
|
94
|
+
* @returns The network's MPC root public key.
|
|
95
|
+
* @throws Error when the network's key is not yet published in this package.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getMpcRootPublicKey(networkId: DeployedNetwork): string;
|
|
98
|
+
/**
|
|
99
|
+
* The address of the central signet singleton contract on a deployed
|
|
100
|
+
* Midnight network: the `signetContractAddress` a
|
|
101
|
+
* `SignetRequestResponseReader` polls. Only the {@link DeployedNetwork}
|
|
102
|
+
* networks have a fixed address. A local standalone stack has none: each
|
|
103
|
+
* stack deploys its own singleton (the integration-test setup prints the
|
|
104
|
+
* address as `MIDNIGHT_SIGNET_CONTRACT_ADDRESS` and appends it to the
|
|
105
|
+
* repo-root `.env`).
|
|
106
|
+
*
|
|
107
|
+
* @param networkId - The deployed network to look up.
|
|
108
|
+
* @returns The network's signet contract address.
|
|
109
|
+
* @throws Error when the singleton's address is not yet published in this
|
|
110
|
+
* package.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getSignetContractAddress(networkId: DeployedNetwork): string;
|
|
58
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAWA,+DAA+D;AAC/D,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wFAAwF;AACxF,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,yBAAiD,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAKxE;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAQpE;AAED;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,mFAAmF;IACnF,UAAU,eAAe;IACzB,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,iFAAiF;IACjF,OAAO,YAAY;IACnB,+EAA+E;IAC/E,OAAO,YAAY;IACnB,6CAA6C;IAC7C,OAAO,YAAY;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;AAYnF;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAMtE;AAYD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAM3E"}
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
// MPC routing constants
|
|
2
|
-
// structs
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// MPC routing constants, the padded-ASCII codec for the signet request
|
|
2
|
+
// structs, and the published per-network counterparty values (the MPC root
|
|
3
|
+
// public key and the signet contract address). Field widths mirror
|
|
4
|
+
// Signet.compact (the wire format: keep in lockstep), and the string
|
|
5
|
+
// constants are the values the MPC network routes on. Ported from the MVP's
|
|
6
|
+
// contract-cli signet/constants.ts, adapted to the refactor's zero-padded
|
|
7
|
+
// convention (Compact `pad(N, "text")`).
|
|
6
8
|
//
|
|
7
9
|
// The routing constants belong in github.com/sig-net/signet.js, kept here
|
|
8
10
|
// until upstreamed.
|
|
@@ -74,4 +76,82 @@ export function asciiPadded(text, length) {
|
|
|
74
76
|
out.set(encoded);
|
|
75
77
|
return out;
|
|
76
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* A named Midnight network: the single source of the network names shared
|
|
81
|
+
* across the `@sig-net/midnight*` packages. midnight-js types a network id
|
|
82
|
+
* as a bare `string` with no companion enum, so the names live here, and
|
|
83
|
+
* `@sig-net/midnight-contract-deploy`'s network-id plumbing widens this
|
|
84
|
+
* enum back to the SDK's string type for its deploy config.
|
|
85
|
+
*/
|
|
86
|
+
export var MidnightNetwork;
|
|
87
|
+
(function (MidnightNetwork) {
|
|
88
|
+
/** Local standalone stack (Docker node, indexer and proof server on localhost). */
|
|
89
|
+
MidnightNetwork["Undeployed"] = "undeployed";
|
|
90
|
+
/** Public staging network, pre-preview. */
|
|
91
|
+
MidnightNetwork["Stagenet"] = "stagenet";
|
|
92
|
+
/** Public test network for early and breaking changes (bleeding-edge ledger). */
|
|
93
|
+
MidnightNetwork["Preview"] = "preview";
|
|
94
|
+
/** Public test network that mirrors mainnet config: the final staging step. */
|
|
95
|
+
MidnightNetwork["Preprod"] = "preprod";
|
|
96
|
+
/** Production network (live, real value). */
|
|
97
|
+
MidnightNetwork["Mainnet"] = "mainnet";
|
|
98
|
+
})(MidnightNetwork || (MidnightNetwork = {}));
|
|
99
|
+
// TODO: fill in each network's MPC root public key once it is generated and
|
|
100
|
+
// published for that network. An empty string means "not yet published" and
|
|
101
|
+
// makes getMpcRootPublicKey throw for that network.
|
|
102
|
+
const mpcRootPublicKeys = {
|
|
103
|
+
[MidnightNetwork.Stagenet]: "",
|
|
104
|
+
[MidnightNetwork.Preview]: "",
|
|
105
|
+
[MidnightNetwork.Preprod]: "",
|
|
106
|
+
[MidnightNetwork.Mainnet]: "",
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* The MPC root public key of a deployed Midnight network, as hex: the
|
|
110
|
+
* `mpcRootPublicKey` every client key derivation starts from (see
|
|
111
|
+
* `deriveEvmAddress`). Only the {@link DeployedNetwork} networks have a
|
|
112
|
+
* fixed key. A local standalone stack has none: its setup generates a fresh
|
|
113
|
+
* `MPC_ROOT_KEY` per stack (the integration-test setup prints it and
|
|
114
|
+
* appends it to the repo-root `.env`).
|
|
115
|
+
*
|
|
116
|
+
* @param networkId - The deployed network to look up.
|
|
117
|
+
* @returns The network's MPC root public key.
|
|
118
|
+
* @throws Error when the network's key is not yet published in this package.
|
|
119
|
+
*/
|
|
120
|
+
export function getMpcRootPublicKey(networkId) {
|
|
121
|
+
const publicKey = mpcRootPublicKeys[networkId];
|
|
122
|
+
if (!publicKey) {
|
|
123
|
+
throw new Error(`no MPC root public key published for the '${networkId}' network yet`);
|
|
124
|
+
}
|
|
125
|
+
return publicKey;
|
|
126
|
+
}
|
|
127
|
+
// TODO: fill in each network's signet contract address as the signet
|
|
128
|
+
// singleton is deployed there. An empty string means "not yet deployed or
|
|
129
|
+
// published" and makes getSignetContractAddress throw for that network.
|
|
130
|
+
const signetContractAddresses = {
|
|
131
|
+
[MidnightNetwork.Stagenet]: "",
|
|
132
|
+
[MidnightNetwork.Preview]: "",
|
|
133
|
+
[MidnightNetwork.Preprod]: "",
|
|
134
|
+
[MidnightNetwork.Mainnet]: "",
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* The address of the central signet singleton contract on a deployed
|
|
138
|
+
* Midnight network: the `signetContractAddress` a
|
|
139
|
+
* `SignetRequestResponseReader` polls. Only the {@link DeployedNetwork}
|
|
140
|
+
* networks have a fixed address. A local standalone stack has none: each
|
|
141
|
+
* stack deploys its own singleton (the integration-test setup prints the
|
|
142
|
+
* address as `MIDNIGHT_SIGNET_CONTRACT_ADDRESS` and appends it to the
|
|
143
|
+
* repo-root `.env`).
|
|
144
|
+
*
|
|
145
|
+
* @param networkId - The deployed network to look up.
|
|
146
|
+
* @returns The network's signet contract address.
|
|
147
|
+
* @throws Error when the singleton's address is not yet published in this
|
|
148
|
+
* package.
|
|
149
|
+
*/
|
|
150
|
+
export function getSignetContractAddress(networkId) {
|
|
151
|
+
const contractAddress = signetContractAddresses[networkId];
|
|
152
|
+
if (!contractAddress) {
|
|
153
|
+
throw new Error(`no signet contract address published for the '${networkId}' network yet`);
|
|
154
|
+
}
|
|
155
|
+
return contractAddress;
|
|
156
|
+
}
|
|
77
157
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,qEAAqE;AACrE,4EAA4E;AAC5E,0EAA0E;AAC1E,yCAAyC;AACzC,EAAE;AACF,0EAA0E;AAC1E,oBAAoB;AAEpB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;G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IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;CAC9B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA0B;IAC5D,MAAM,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,SAAS,eAAe,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,qEAAqE;AACrE,0EAA0E;AAC1E,wEAAwE;AACxE,MAAM,uBAAuB,GAAoC;IAC/D,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE;IAC9B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;CAC9B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAA0B;IACjE,MAAM,eAAe,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC3D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,SAAS,eAAe,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
2
2
|
import type { RequestId } from "./signet-requests.ts";
|
|
3
|
-
import type { MpcSignature, RespondBidirectionalEvent } from "./signet-contract-
|
|
3
|
+
import type { MpcSignature, RespondBidirectionalEvent } from "./signet-contract-events.ts";
|
|
4
4
|
export type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
5
5
|
/** secp256k1 curve (group) order n. */
|
|
6
6
|
export declare const SECP256K1_ORDER: bigint;
|
|
@@ -153,10 +153,11 @@ export declare function calculateSignetAttestationDigest(requestId: RequestId, s
|
|
|
153
153
|
* the attestation digest of `(requestId, serializedOutput)` and verify the
|
|
154
154
|
* event's ECDSA signature over it against `mpcResponseKey`.
|
|
155
155
|
*
|
|
156
|
-
* The event
|
|
157
|
-
* tell a genuine post from garbage: the signet
|
|
158
|
-
* unauthenticated and every post is
|
|
159
|
-
*
|
|
156
|
+
* The event's declared request id is unauthenticated routing data, so this
|
|
157
|
+
* check is the ONLY way to tell a genuine post from garbage: the signet
|
|
158
|
+
* contract's event log is unauthenticated and every post is emitted
|
|
159
|
+
* unverified. Use it to sift the candidates
|
|
160
|
+
* {@link SignetRequestResponseReader.getRespondBidirectionalEvents}
|
|
160
161
|
* returns before handing one to a contract. It is the off-chain counterpart
|
|
161
162
|
* of the in-circuit `verifyRespondBidirectionalEvent` and answers the same
|
|
162
163
|
* question, so a post this accepts is the post that proves at claim time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,
|
|
1
|
+
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAIrC,YAAY,EAAE,cAAc,EAAE,MAAM,i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AAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAIZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,EAC5B,KAAK,EAAE,yBAAyB,EAChC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAyBT"}
|
|
@@ -261,10 +261,11 @@ export function calculateSignetAttestationDigest(requestId, serializedOutput) {
|
|
|
261
261
|
* the attestation digest of `(requestId, serializedOutput)` and verify the
|
|
262
262
|
* event's ECDSA signature over it against `mpcResponseKey`.
|
|
263
263
|
*
|
|
264
|
-
* The event
|
|
265
|
-
* tell a genuine post from garbage: the signet
|
|
266
|
-
* unauthenticated and every post is
|
|
267
|
-
*
|
|
264
|
+
* The event's declared request id is unauthenticated routing data, so this
|
|
265
|
+
* check is the ONLY way to tell a genuine post from garbage: the signet
|
|
266
|
+
* contract's event log is unauthenticated and every post is emitted
|
|
267
|
+
* unverified. Use it to sift the candidates
|
|
268
|
+
* {@link SignetRequestResponseReader.getRespondBidirectionalEvents}
|
|
268
269
|
* returns before handing one to a contract. It is the off-chain counterpart
|
|
269
270
|
* of the in-circuit `verifyRespondBidirectionalEvent` and answers the same
|
|
270
271
|
* question, so a post this accepts is the post that proves at claim time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,kEAAkE;AAClE,uEAAuE;AACvE,2EAA2E;AAC3E,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,4DAA4D;AAC5D,oCAAoC;AACpC,EAAE;AACF,wEAAwE;AACxE,8BAA8B;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,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C,CAAC;IAC5C,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE;YAC3D,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,9 @@ export * from "./signet-requests.ts";
|
|
|
3
3
|
export * from "./signet-evtype2tx-requests.ts";
|
|
4
4
|
export * from "./signature-state-reading.ts";
|
|
5
5
|
export * from "./signature-requests-state-reader.ts";
|
|
6
|
-
export * from "./signet-contract-
|
|
6
|
+
export * from "./signet-contract-events.ts";
|
|
7
7
|
export * from "./signature-response-verification.ts";
|
|
8
8
|
export * from "./signet-request-response-reader.ts";
|
|
9
|
-
export * from "./signet-request-resolver.ts";
|
|
10
9
|
export * from "./signet-request-feed.ts";
|
|
11
10
|
export * from "./constants.ts";
|
|
12
11
|
export * from "./epsilon-derivation.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|