@sig-net/midnight 0.10.0 → 0.11.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 +8 -8
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/ecdsa-attestation.d.ts +53 -1
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +96 -4
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.d.ts +8 -8
- package/dist/epsilon-derivation.d.ts.map +1 -1
- package/dist/epsilon-derivation.js +15 -17
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +42 -24
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +14 -10
- package/dist/managed/contract/index.js +142 -86
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +2 -2
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +32 -15
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.js +5 -5
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +49 -30
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +55 -35
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +47 -44
- package/dist/signet-evtype2tx-requests.d.ts.map +1 -1
- package/dist/signet-evtype2tx-requests.js +47 -79
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +3 -3
- package/dist/signet-request-response-reader.js +9 -9
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +4 -4
- package/dist/signet-requests.js +1 -1
- package/package.json +1 -1
- package/src/Signet.compact +85 -51
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
// the record descriptors themselves are the parameterized twins in
|
|
11
11
|
// signet-requests.ts. The generic tree walk and shared base descriptors live
|
|
12
12
|
// in signature-state-reading.ts.
|
|
13
|
-
import { signBidirectionalEventDescriptor } from "./signet-evtype2tx-requests.js";
|
|
13
|
+
import { calculateRequestId, signBidirectionalEventDescriptor, } from "./signet-evtype2tx-requests.js";
|
|
14
14
|
import { requestIdHex, } from "./signet-requests.js";
|
|
15
15
|
import { requestIdType, signetFieldNode, u64, } from "./signature-state-reading.js";
|
|
16
16
|
/**
|
|
17
17
|
* Aligned-value entry count of an event record EXCLUDING the capacity-scaled
|
|
18
18
|
* vectors: sender (1) + requestNonce (1) + keyVersion (1) + path (1) +
|
|
19
19
|
* algo (1) + dest (1) + params (1) + txParamType (1, enums are one atom
|
|
20
|
-
* whatever their byte width) + the
|
|
21
|
-
* (
|
|
20
|
+
* whatever their byte width) + the EvmType2TxParams fixed fields
|
|
21
|
+
* (chainId..value = 7, accessListEntryCount = 1) + the calldata Maybe's
|
|
22
22
|
* is_some (1), selector (1) and noWords (1) + caip2Id (1) + the two schema
|
|
23
23
|
* fields (1 each). A stored event cell therefore holds
|
|
24
24
|
* `REQUEST_FIXED_VALUE_ATOMS + maxCalldataWords
|
|
@@ -47,10 +47,12 @@ export const REQUEST_FIXED_VALUE_ATOMS = 22;
|
|
|
47
47
|
* fail the request-id recompute, which is the authoritative check anyway.
|
|
48
48
|
*
|
|
49
49
|
* @param atoms - The record cell's aligned value (a fresh copy per attempt).
|
|
50
|
+
* @param expectedRequestId - The id the record is stored under, used to pick
|
|
51
|
+
* between splits when more than one decodes cleanly.
|
|
50
52
|
* @returns The decoded record.
|
|
51
53
|
* @throws Error if no capacity split decodes the value cleanly.
|
|
52
54
|
*/
|
|
53
|
-
function decodeSignBidirectionalEvent(atoms) {
|
|
55
|
+
function decodeSignBidirectionalEvent(atoms, expectedRequestId) {
|
|
54
56
|
const variable = atoms.length - REQUEST_FIXED_VALUE_ATOMS;
|
|
55
57
|
if (variable < 0) {
|
|
56
58
|
throw new Error(`request record has ${atoms.length} value entries — fewer than the ` +
|
|
@@ -69,23 +71,38 @@ function decodeSignBidirectionalEvent(atoms) {
|
|
|
69
71
|
return undefined;
|
|
70
72
|
}
|
|
71
73
|
};
|
|
74
|
+
// Several splits can decode cleanly — an access-list entry's 20-byte address atom
|
|
75
|
+
// re-pads into a 32-byte calldata word just as well — so only the id the record is
|
|
76
|
+
// filed under separates them. This disambiguates; it does not authenticate (the MPC
|
|
77
|
+
// recomputes against the sender-bound id before signing).
|
|
78
|
+
//
|
|
79
|
+
// First match wins, so the common access-list-free case stays at one decode.
|
|
80
|
+
// `fallback` preserves the pre-recompute behaviour when no split matches the id.
|
|
81
|
+
let fallback;
|
|
82
|
+
const take = (record) => {
|
|
83
|
+
if (record === undefined)
|
|
84
|
+
return false;
|
|
85
|
+
fallback ??= record;
|
|
86
|
+
return requestIdHex(calculateRequestId(record)) === expectedRequestId;
|
|
87
|
+
};
|
|
72
88
|
// No access list: variable atoms are calldata words alone (one atom each).
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return record;
|
|
77
|
-
}
|
|
89
|
+
const accessListFree = attempt(variable, 0, 0);
|
|
90
|
+
if (take(accessListFree))
|
|
91
|
+
return accessListFree;
|
|
78
92
|
// With an access list: E entries of (2 + K) atoms, the rest words.
|
|
79
93
|
for (let entries = 1; entries * 2 <= variable; entries++) {
|
|
80
94
|
for (let keys = 0; entries * (2 + keys) <= variable; keys++) {
|
|
81
95
|
const words = variable - entries * (2 + keys);
|
|
82
96
|
const record = attempt(words, entries, keys);
|
|
83
|
-
if (record
|
|
97
|
+
if (take(record))
|
|
84
98
|
return record;
|
|
85
99
|
}
|
|
86
100
|
}
|
|
87
|
-
|
|
88
|
-
`
|
|
101
|
+
if (fallback === undefined) {
|
|
102
|
+
throw new Error(`request record with ${atoms.length} value entries matches no ` +
|
|
103
|
+
`(calldata words, access-list entries, storage keys) capacity split`);
|
|
104
|
+
}
|
|
105
|
+
return fallback;
|
|
89
106
|
}
|
|
90
107
|
/**
|
|
91
108
|
* MPC-style read: parse the signet ledger fields out of raw contract state
|
|
@@ -112,11 +129,11 @@ export function readSignetRequestsLedgerFromState(raw, requestsIndexField, nonce
|
|
|
112
129
|
const requestsIndex = new Map();
|
|
113
130
|
for (const key of map.keys()) {
|
|
114
131
|
// fromValue consumes its input, so hand each descriptor a copy.
|
|
115
|
-
const requestId = requestIdType.fromValue([...key.value]);
|
|
132
|
+
const requestId = requestIdHex(requestIdType.fromValue([...key.value]));
|
|
116
133
|
const cell = map.get(key)?.asCell();
|
|
117
134
|
if (cell === undefined)
|
|
118
135
|
continue;
|
|
119
|
-
requestsIndex.set(
|
|
136
|
+
requestsIndex.set(requestId, decodeSignBidirectionalEvent(cell.value, requestId));
|
|
120
137
|
}
|
|
121
138
|
const nonceCell = signetFieldNode(raw, nonceField).asCell();
|
|
122
139
|
if (nonceCell === undefined) {
|
|
@@ -172,7 +189,7 @@ export function lookupSignetRequestAt(raw, fieldIndex, requestId) {
|
|
|
172
189
|
return undefined;
|
|
173
190
|
}
|
|
174
191
|
try {
|
|
175
|
-
return decodeSignBidirectionalEvent(cell.value);
|
|
192
|
+
return decodeSignBidirectionalEvent(cell.value, requestId);
|
|
176
193
|
}
|
|
177
194
|
catch {
|
|
178
195
|
return undefined; // a cell that is not a decodable request record
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature-requests-state-reader.js","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,yDAAyD;AACzD,4EAA4E;AAC5E,yEAAyE;AACzE,kEAAkE;AAClE,qCAAqC;AACrC,gFAAgF;AAChF,mEAAmE;AACnE,6EAA6E;AAC7E,iCAAiC;AAIjC,OAAO,
|
|
1
|
+
{"version":3,"file":"signature-requests-state-reader.js","sourceRoot":"","sources":["../src/signature-requests-state-reader.ts"],"names":[],"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K,CAAC,CAAC,CAAC;IAElD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAqB,EACrB,UAAkB,EAClB,SAAuB;IAEvB,IAAI,IAAI,CAAC;IACT,IAAI,CAAC;QACH,IAAI,GAAG,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,gDAAgD;IACpE,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACzB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,CAAC,yCAAyC;IAC7D,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QAC7B,gEAAgE;QAChE,IAAI,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACxE,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC;YACH,OAAO,4BAA4B,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC,CAAC,gDAAgD;QACpE,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,CAAC,2BAA2B;AAC/C,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { SignatureRespondedEvent } from "./signet-contract-state-reader.ts"
|
|
|
9
9
|
* @returns The checksummed recovered signer address.
|
|
10
10
|
* @throws Error if the response is not a decodable signature or the request
|
|
11
11
|
* record is malformed (see
|
|
12
|
-
* {@link
|
|
12
|
+
* {@link signBidirectionalEventToUnsignedEvmTransaction}).
|
|
13
13
|
*/
|
|
14
14
|
export declare function recoverSignatureResponseSigner(request: SignBidirectionalEvent, response: SignatureRespondedEvent): string;
|
|
15
15
|
/**
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
// before trusting it: rebuild the unsigned EVM transaction from the on-ledger
|
|
5
5
|
// request record — assembled exactly as the MPC assembles it (sig-net/mpc
|
|
6
6
|
// response server, managed/erc20-vault/signet/calldata-builder.ts) — and
|
|
7
|
-
// check that the posted
|
|
8
|
-
//
|
|
7
|
+
// check that the posted signature record recovers to the requester's derived
|
|
8
|
+
// EVM address over that transaction's signing hash.
|
|
9
9
|
import { getAddress, recoverAddress } from "ethers";
|
|
10
|
-
import {
|
|
10
|
+
import { signBidirectionalEventToUnsignedEvmTransaction, signatureRespondedEventToSignature, } from "./signet-evtype2tx-requests.js";
|
|
11
11
|
/**
|
|
12
12
|
* Recover the EVM address that produced a response signature, over the
|
|
13
13
|
* signing hash of the transaction the request describes.
|
|
@@ -17,10 +17,10 @@ import { signBidirectionalEventToUnsignedEVMTransaction, signatureRespondedEvent
|
|
|
17
17
|
* @returns The checksummed recovered signer address.
|
|
18
18
|
* @throws Error if the response is not a decodable signature or the request
|
|
19
19
|
* record is malformed (see
|
|
20
|
-
* {@link
|
|
20
|
+
* {@link signBidirectionalEventToUnsignedEvmTransaction}).
|
|
21
21
|
*/
|
|
22
22
|
export function recoverSignatureResponseSigner(request, response) {
|
|
23
|
-
return recoverAddress(
|
|
23
|
+
return recoverAddress(signBidirectionalEventToUnsignedEvmTransaction(request).unsignedHash, signatureRespondedEventToSignature(response));
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Verify a posted response against its request: does the signature recover
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature-response-verification.js","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"signature-response-verification.js","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,oDAAoD;AAEpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEpD,OAAO,EACL,8CAA8C,EAC9C,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA+B,EAC/B,QAAiC;IAEjC,OAAO,cAAc,CACnB,8CAA8C,CAAC,OAAO,CAAC,CAAC,YAAY,EACpE,kCAAkC,CAAC,QAAQ,CAAC,CAC7C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAA+B,EAC/B,QAAiC,EACjC,cAAsB;IAEtB,IAAI,CAAC;QACH,OAAO,CACL,8BAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC;YACjD,UAAU,CAAC,cAAc,CAAC,CAC3B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -5,40 +5,63 @@ import { type RawContractState } from "./signature-state-reading.ts";
|
|
|
5
5
|
export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD = 0;
|
|
6
6
|
/** Signet contract layout: the notification map is ledger field 1. */
|
|
7
7
|
export declare const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD = 1;
|
|
8
|
-
/** Signet contract layout: the
|
|
9
|
-
export declare const
|
|
10
|
-
/** Signet contract layout: the
|
|
11
|
-
export declare const
|
|
8
|
+
/** Signet contract layout: the `respond` counter map is ledger field 2. */
|
|
9
|
+
export declare const RESPOND_COUNTER_MAP_FIELD = 2;
|
|
10
|
+
/** Signet contract layout: the `respond` post log is ledger field 3. */
|
|
11
|
+
export declare const RESPOND_MAP_FIELD = 3;
|
|
12
12
|
/** Signet contract layout: the respond-bidirectional counter map is ledger field 4. */
|
|
13
13
|
export declare const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
|
|
14
14
|
/** Signet contract layout: the respond-bidirectional map is ledger field 5. */
|
|
15
15
|
export declare const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* scalar bytes). The request id it answers lives in the map key, not here.
|
|
17
|
+
* A curve point in affine coordinates (Compact `AffinePoint`), SEC1
|
|
18
|
+
* big-endian — the same shape the sig-net EVM and Solana signer contracts
|
|
19
|
+
* expose.
|
|
21
20
|
*/
|
|
22
|
-
export interface
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
export interface AffinePoint {
|
|
22
|
+
/** The x coordinate, 32 big-endian bytes. */
|
|
23
|
+
x: Uint8Array;
|
|
24
|
+
/** The y coordinate, 32 big-endian bytes. */
|
|
25
|
+
y: Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The MPC's canonical ECDSA signature as both respond events store it
|
|
29
|
+
* (Compact `Signature`, matching the MPC's own
|
|
30
|
+
* `Signature { big_r, s, recovery_id }` and the EVM/Solana signer
|
|
31
|
+
* contracts): `bigR` the full nonce point so consumers never decompress,
|
|
32
|
+
* `s` big-endian, `recoveryId` the parity of R.y. Stored UNVERIFIED like
|
|
33
|
+
* everything else on the singleton; convert with
|
|
34
|
+
* `ecdsaSignatureToMpcSignature` / `mpcSignatureToEcdsaSignature`.
|
|
35
|
+
*/
|
|
36
|
+
export interface MpcSignature {
|
|
37
|
+
/** The signature's nonce point R. */
|
|
38
|
+
bigR: AffinePoint;
|
|
39
|
+
/** Signature scalar s, 32 big-endian bytes. */
|
|
28
40
|
s: Uint8Array;
|
|
29
|
-
/**
|
|
41
|
+
/** Recovery id (parity of R.y): 0 or 1. */
|
|
30
42
|
recoveryId: bigint;
|
|
31
43
|
}
|
|
32
44
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
45
|
+
* The MPC's signature over the requested EVM transaction (Compact
|
|
46
|
+
* `SignatureRespondedEvent`) — decode to an ethers signature with
|
|
47
|
+
* `signatureRespondedEventToSignature`. The request id it answers lives in
|
|
48
|
+
* the map key, not here.
|
|
49
|
+
*/
|
|
50
|
+
export interface SignatureRespondedEvent {
|
|
51
|
+
/** The requested signature over the transaction the request describes. */
|
|
52
|
+
signature: MpcSignature;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Hand-composed descriptor for {@link SignatureRespondedEvent}: the single
|
|
56
|
+
* {@link MpcSignature} field, matching the Compact struct.
|
|
35
57
|
*/
|
|
36
58
|
export declare const signatureRespondedEventType: CompactType<SignatureRespondedEvent>;
|
|
37
59
|
/**
|
|
38
60
|
* The MPC's respond-bidirectional response for a request's remote EVM
|
|
39
61
|
* execution (Compact `RespondBidirectionalEvent`): the serialized execution
|
|
40
62
|
* output plus the ECDSA signature over the attestation digest of
|
|
41
|
-
* `(requestId, serializedOutput
|
|
63
|
+
* `(requestId, serializedOutput)`. `outputLen` is carried but NOT signed over, so
|
|
64
|
+
* anything relying on it must pin it separately. Stored UNVERIFIED by the signet
|
|
42
65
|
* contract — clients verify it themselves (in-circuit via
|
|
43
66
|
* `verifyRespondBidirectionalEvent`, or off-chain via the compiled
|
|
44
67
|
* `pureCircuits.verifyRespondBidirectionalEvent`).
|
|
@@ -48,12 +71,8 @@ export interface RespondBidirectionalEvent {
|
|
|
48
71
|
serializedOutput: Uint8Array;
|
|
49
72
|
/** Meaningful byte count of {@link serializedOutput}. */
|
|
50
73
|
outputLen: bigint;
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/** Signature scalar s, 32 LITTLE-endian bytes. */
|
|
54
|
-
s: Uint8Array;
|
|
55
|
-
/** Recovery id (parity of R.y), for off-chain public-key recovery. */
|
|
56
|
-
recoveryId: bigint;
|
|
74
|
+
/** ECDSA signature over the attestation digest. */
|
|
75
|
+
signature: MpcSignature;
|
|
57
76
|
}
|
|
58
77
|
/**
|
|
59
78
|
* Composite key of one posted entry in the signet contract's maps (Compact
|
|
@@ -75,8 +94,8 @@ export interface SignetMapKey {
|
|
|
75
94
|
export declare const signetMapKeyType: CompactType<SignetMapKey>;
|
|
76
95
|
/**
|
|
77
96
|
* Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
|
|
78
|
-
* order (serializedOutput, outputLen,
|
|
79
|
-
*
|
|
97
|
+
* order (serializedOutput, outputLen, signature) must match the Compact
|
|
98
|
+
* struct.
|
|
80
99
|
*/
|
|
81
100
|
export declare const respondBidirectionalEventType: CompactType<RespondBidirectionalEvent>;
|
|
82
101
|
/**
|
|
@@ -201,10 +220,10 @@ export interface SignetContractLedger {
|
|
|
201
220
|
* (count-0 post).
|
|
202
221
|
*/
|
|
203
222
|
signBidirectionalEventNotificationMap: SignBidirectionalNotificationIndex;
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
/** The
|
|
207
|
-
|
|
223
|
+
/** `respond` post counts per request id (ledger field 2). */
|
|
224
|
+
respondCounterMap: SignetCounterIndex;
|
|
225
|
+
/** The `respond` post log (ledger field 3), keyed by {@link signetMapEntryKey}. */
|
|
226
|
+
respondMap: SignatureResponseIndex;
|
|
208
227
|
/** Respond-bidirectional post counts per request id (ledger field 4). */
|
|
209
228
|
respondBidirectionalCounterMap: SignetCounterIndex;
|
|
210
229
|
/** The respond-bidirectional log (ledger field 5), keyed by {@link signetMapEntryKey}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.d.ts","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,eAAO,MAAM,uDAAuD,IAAI,CAAC;AAEzE,sEAAsE;AACtE,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,uFAAuF;AACvF,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAgBjD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;IACd,6CAA6C;IAC7C,CAAC,EAAE,UAAU,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IAC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AmC,CACjD,MAAM,EAAE,mCAAmC,GAC1C,6BAA6B,CAoB/B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG,GAAG,CAClD,YAAY,EACZ,mCAAmC,CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzE;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,+CAA+C,CAC7D,GAAG,EAAE,gBAAgB,GACpB,kCAAkC,CAyBpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,4CAA4C,EAAE,kBAAkB,CAAC;IACjE;;;OAGG;IACH,qCAAqC,EAAE,kCAAkC,CAAC;IAC1E,6DAA6D;IAC7D,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,mFAAmF;IACnF,UAAU,EAAE,sBAAsB,CAAC;IACnC,yEAAyE;IACzE,8BAA8B,EAAE,kBAAkB,CAAC;IACnD,0FAA0F;IAC1F,uBAAuB,EAAE,yBAAyB,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,gBAAgB,GACpB,oBAAoB,CA2BtB"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// declaration-order layout:
|
|
7
7
|
// field 0: signBidirectionalEventNotificationCounterMap (Map<RequestId, Counter>)
|
|
8
8
|
// field 1: signBidirectionalEventNotificationMap (Map<SignetMapKey, Notification>)
|
|
9
|
-
// field 2:
|
|
10
|
-
// field 3:
|
|
9
|
+
// field 2: respondCounterMap (Map<RequestId, Counter>)
|
|
10
|
+
// field 3: respondMap (Map<SignetMapKey, SignatureRespondedEvent>)
|
|
11
11
|
// field 4: respondBidirectionalCounterMap (Map<RequestId, Counter>)
|
|
12
12
|
// field 5: respondBidirectionalMap (Map<SignetMapKey, RespondBidirectionalEvent>)
|
|
13
13
|
// Every store is an unauthenticated append-only log keyed by
|
|
@@ -21,10 +21,10 @@ import { requestIdType, signetFieldNode, u64, } from "./signature-state-reading.
|
|
|
21
21
|
export const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD = 0;
|
|
22
22
|
/** Signet contract layout: the notification map is ledger field 1. */
|
|
23
23
|
export const SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_MAP_FIELD = 1;
|
|
24
|
-
/** Signet contract layout: the
|
|
25
|
-
export const
|
|
26
|
-
/** Signet contract layout: the
|
|
27
|
-
export const
|
|
24
|
+
/** Signet contract layout: the `respond` counter map is ledger field 2. */
|
|
25
|
+
export const RESPOND_COUNTER_MAP_FIELD = 2;
|
|
26
|
+
/** Signet contract layout: the `respond` post log is ledger field 3. */
|
|
27
|
+
export const RESPOND_MAP_FIELD = 3;
|
|
28
28
|
/** Signet contract layout: the respond-bidirectional counter map is ledger field 4. */
|
|
29
29
|
export const RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD = 4;
|
|
30
30
|
/** Signet contract layout: the respond-bidirectional map is ledger field 5. */
|
|
@@ -33,18 +33,18 @@ export const RESPOND_BIDIRECTIONAL_MAP_FIELD = 5;
|
|
|
33
33
|
// As in the requests reader, fromValue consumes the aligned value
|
|
34
34
|
// sequentially, so field order and width here must match the Compact structs
|
|
35
35
|
// exactly — a mismatch is silent data corruption, not an error.
|
|
36
|
-
/** Descriptor for a 32-byte scalar / hash (`Bytes<32>`). */
|
|
37
|
-
const bytes32 = new CompactTypeBytes(32);
|
|
38
36
|
/** Descriptor for the response's serialized output (`Bytes<128>`). */
|
|
39
37
|
const bytes128 = new CompactTypeBytes(128);
|
|
38
|
+
/** Descriptor for a 32-byte scalar / coordinate (`Bytes<32>`). */
|
|
39
|
+
const bytes32 = new CompactTypeBytes(32);
|
|
40
40
|
/** Descriptor for a Compact `Uint<8>` (1-byte unsigned integer). */
|
|
41
41
|
const u8 = new CompactTypeUnsignedInteger(255n, 1);
|
|
42
42
|
/**
|
|
43
|
-
* Hand-composed descriptor for {@link
|
|
44
|
-
*
|
|
43
|
+
* Hand-composed descriptor for {@link MpcSignature}. Leaf order
|
|
44
|
+
* (bigR.x, bigR.y, s, recoveryId) must match the nested Compact structs.
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
/** @returns Compound alignment of the struct's
|
|
46
|
+
const mpcSignatureType = {
|
|
47
|
+
/** @returns Compound alignment of the struct's leaves in declaration order. */
|
|
48
48
|
alignment() {
|
|
49
49
|
return bytes32
|
|
50
50
|
.alignment()
|
|
@@ -53,34 +53,60 @@ export const signatureRespondedEventType = {
|
|
|
53
53
|
.concat(u8.alignment());
|
|
54
54
|
},
|
|
55
55
|
/**
|
|
56
|
-
* Decode one signature
|
|
57
|
-
* by field.
|
|
56
|
+
* Decode one signature from an aligned value, consuming it leaf by leaf.
|
|
58
57
|
*
|
|
59
58
|
* @param value - Mutable aligned value cursor; pass a copy.
|
|
60
|
-
* @returns The decoded
|
|
59
|
+
* @returns The decoded signature.
|
|
61
60
|
*/
|
|
62
61
|
fromValue(value) {
|
|
63
62
|
return {
|
|
64
|
-
|
|
65
|
-
bigRy: bytes32.fromValue(value),
|
|
63
|
+
bigR: { x: bytes32.fromValue(value), y: bytes32.fromValue(value) },
|
|
66
64
|
s: bytes32.fromValue(value),
|
|
67
65
|
recoveryId: u8.fromValue(value),
|
|
68
66
|
};
|
|
69
67
|
},
|
|
70
68
|
/**
|
|
71
|
-
* Encode a signature
|
|
69
|
+
* Encode a signature into its aligned on-ledger representation.
|
|
72
70
|
*
|
|
73
|
-
* @param record - The
|
|
74
|
-
* @returns The aligned value,
|
|
71
|
+
* @param record - The signature to encode.
|
|
72
|
+
* @returns The aligned value, leaves concatenated in declaration order.
|
|
75
73
|
*/
|
|
76
74
|
toValue(record) {
|
|
77
75
|
return bytes32
|
|
78
|
-
.toValue(record.
|
|
79
|
-
.concat(bytes32.toValue(record.
|
|
76
|
+
.toValue(record.bigR.x)
|
|
77
|
+
.concat(bytes32.toValue(record.bigR.y))
|
|
80
78
|
.concat(bytes32.toValue(record.s))
|
|
81
79
|
.concat(u8.toValue(record.recoveryId));
|
|
82
80
|
},
|
|
83
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* Hand-composed descriptor for {@link SignatureRespondedEvent}: the single
|
|
84
|
+
* {@link MpcSignature} field, matching the Compact struct.
|
|
85
|
+
*/
|
|
86
|
+
export const signatureRespondedEventType = {
|
|
87
|
+
/** @returns Alignment of the struct's single signature field. */
|
|
88
|
+
alignment() {
|
|
89
|
+
return mpcSignatureType.alignment();
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Decode one signature response from an aligned value.
|
|
93
|
+
*
|
|
94
|
+
* @param value - Mutable aligned value cursor; pass a copy.
|
|
95
|
+
* @returns The decoded record.
|
|
96
|
+
*/
|
|
97
|
+
fromValue(value) {
|
|
98
|
+
return { signature: mpcSignatureType.fromValue(value) };
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Encode a signature response into its aligned on-ledger representation.
|
|
102
|
+
*
|
|
103
|
+
* @param record - The record to encode.
|
|
104
|
+
* @returns The aligned value.
|
|
105
|
+
*/
|
|
106
|
+
toValue(record) {
|
|
107
|
+
return mpcSignatureType.toValue(record.signature);
|
|
108
|
+
},
|
|
109
|
+
};
|
|
84
110
|
/**
|
|
85
111
|
* Hand-composed descriptor for {@link SignetMapKey} — the map key of every
|
|
86
112
|
* posted-entry map in the signet contract. Field order (count, then
|
|
@@ -115,8 +141,8 @@ export const signetMapKeyType = {
|
|
|
115
141
|
};
|
|
116
142
|
/**
|
|
117
143
|
* Hand-composed descriptor for {@link RespondBidirectionalEvent}. Field
|
|
118
|
-
* order (serializedOutput, outputLen,
|
|
119
|
-
*
|
|
144
|
+
* order (serializedOutput, outputLen, signature) must match the Compact
|
|
145
|
+
* struct.
|
|
120
146
|
*/
|
|
121
147
|
export const respondBidirectionalEventType = {
|
|
122
148
|
/** @returns Compound alignment of the struct's fields in declaration order. */
|
|
@@ -124,9 +150,7 @@ export const respondBidirectionalEventType = {
|
|
|
124
150
|
return bytes128
|
|
125
151
|
.alignment()
|
|
126
152
|
.concat(u8.alignment())
|
|
127
|
-
.concat(
|
|
128
|
-
.concat(bytes32.alignment())
|
|
129
|
-
.concat(u8.alignment());
|
|
153
|
+
.concat(mpcSignatureType.alignment());
|
|
130
154
|
},
|
|
131
155
|
/**
|
|
132
156
|
* Decode one response record from an aligned value, consuming it field
|
|
@@ -139,9 +163,7 @@ export const respondBidirectionalEventType = {
|
|
|
139
163
|
return {
|
|
140
164
|
serializedOutput: bytes128.fromValue(value),
|
|
141
165
|
outputLen: u8.fromValue(value),
|
|
142
|
-
|
|
143
|
-
s: bytes32.fromValue(value),
|
|
144
|
-
recoveryId: u8.fromValue(value),
|
|
166
|
+
signature: mpcSignatureType.fromValue(value),
|
|
145
167
|
};
|
|
146
168
|
},
|
|
147
169
|
/**
|
|
@@ -154,9 +176,7 @@ export const respondBidirectionalEventType = {
|
|
|
154
176
|
return bytes128
|
|
155
177
|
.toValue(record.serializedOutput)
|
|
156
178
|
.concat(u8.toValue(record.outputLen))
|
|
157
|
-
.concat(
|
|
158
|
-
.concat(bytes32.toValue(record.s))
|
|
159
|
-
.concat(u8.toValue(record.recoveryId));
|
|
179
|
+
.concat(mpcSignatureType.toValue(record.signature));
|
|
160
180
|
},
|
|
161
181
|
};
|
|
162
182
|
/** Descriptor for the notification's packed V1 payload (`Bytes<128>`). */
|
|
@@ -326,8 +346,8 @@ export function readSignetContractLedgerFromState(raw) {
|
|
|
326
346
|
return {
|
|
327
347
|
signBidirectionalEventNotificationCounterMap: readCounterMap(raw, SIGN_BIDIRECTIONAL_EVENT_NOTIFICATION_COUNTER_MAP_FIELD),
|
|
328
348
|
signBidirectionalEventNotificationMap: readSignBidirectionalNotificationIndexFromState(raw),
|
|
329
|
-
|
|
330
|
-
|
|
349
|
+
respondCounterMap: readCounterMap(raw, RESPOND_COUNTER_MAP_FIELD),
|
|
350
|
+
respondMap: readSignetKeyedMap(raw, RESPOND_MAP_FIELD, signatureRespondedEventType),
|
|
331
351
|
respondBidirectionalCounterMap: readCounterMap(raw, RESPOND_BIDIRECTIONAL_COUNTER_MAP_FIELD),
|
|
332
352
|
respondBidirectionalMap: readSignetKeyedMap(raw, RESPOND_BIDIRECTIONAL_MAP_FIELD, respondBidirectionalEventType),
|
|
333
353
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,4BAA4B;AAC5B,oFAAoF;AACpF,qFAAqF;AACrF,
|
|
1
|
+
{"version":3,"file":"signet-contract-state-reader.js","sourceRoot":"","sources":["../src/signet-contract-state-reader.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,4BAA4B;AAC5B,oFAAoF;AACpF,qFAAqF;AACrF,yDAAyD;AACzD,qEAAqE;AACrE,sEAAsE;AACtE,oFAAoF;AACpF,6DAA6D;AAC7D,oEAAoE;AACpE,0EAA0E;AAC1E,kDAAkD;AAElD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAE3B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAE9B,OA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