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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +4 -3
  2. package/dist/compact-descriptors.d.ts +6 -5
  3. package/dist/compact-descriptors.d.ts.map +1 -1
  4. package/dist/compact-descriptors.js +4 -4
  5. package/dist/compact-descriptors.js.map +1 -1
  6. package/dist/constants.d.ts +2 -2
  7. package/dist/constants.js +2 -2
  8. package/dist/ecdsa-attestation.d.ts +2 -1
  9. package/dist/ecdsa-attestation.d.ts.map +1 -1
  10. package/dist/ecdsa-attestation.js +4 -1
  11. package/dist/ecdsa-attestation.js.map +1 -1
  12. package/dist/epsilon-derivation.d.ts +8 -8
  13. package/dist/epsilon-derivation.js +7 -7
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/managed/compiler/contract-manifest.json +4 -4
  19. package/dist/managed/contract/index.js +61 -53
  20. package/dist/managed/contract/index.js.map +1 -1
  21. package/dist/signature-requests-state-reader.d.ts +16 -10
  22. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  23. package/dist/signature-requests-state-reader.js +31 -13
  24. package/dist/signature-requests-state-reader.js.map +1 -1
  25. package/dist/signature-response-verification.d.ts +52 -7
  26. package/dist/signature-response-verification.d.ts.map +1 -1
  27. package/dist/signature-response-verification.js +63 -13
  28. package/dist/signature-response-verification.js.map +1 -1
  29. package/dist/signet-contract-events.d.ts +1 -1
  30. package/dist/signet-request-id.js +3 -3
  31. package/dist/signet-request-id.js.map +1 -1
  32. package/dist/signet-request-response-reader.d.ts +112 -34
  33. package/dist/signet-request-response-reader.d.ts.map +1 -1
  34. package/dist/signet-request-response-reader.js +279 -96
  35. package/dist/signet-request-response-reader.js.map +1 -1
  36. package/dist/signet-requests.d.ts +9 -5
  37. package/dist/signet-requests.d.ts.map +1 -1
  38. package/dist/signet-requests.js +6 -2
  39. package/dist/signet-requests.js.map +1 -1
  40. package/dist/signet-tron-record-decoding.d.ts +2 -0
  41. package/dist/signet-tron-record-decoding.d.ts.map +1 -1
  42. package/dist/signet-tron-record-decoding.js +2 -0
  43. package/dist/signet-tron-record-decoding.js.map +1 -1
  44. package/dist/signet-tron-requests.d.ts +7 -3
  45. package/dist/signet-tron-requests.d.ts.map +1 -1
  46. package/dist/signet-tron-requests.js +6 -2
  47. package/dist/signet-tron-requests.js.map +1 -1
  48. package/dist/tron-transactions.d.ts +17 -1
  49. package/dist/tron-transactions.d.ts.map +1 -1
  50. package/dist/tron-transactions.js +16 -0
  51. package/dist/tron-transactions.js.map +1 -1
  52. package/package.json +2 -2
  53. package/src/Signet.compact +12 -10
@@ -1,6 +1,47 @@
1
1
  import type { SignatureRespondedEvent } from "./signet-contract-events.ts";
2
- import { type SignBidirectionalEvent } from "./signet-requests.ts";
3
- import type { TronTxParams } from "./signet-tron-requests.ts";
2
+ import { type AnySignBidirectionalEvent } from "./signet-requests.ts";
3
+ /** What a signature response is checked against: the digest the MPC signs and the address that must have signed it. */
4
+ export interface SignatureCheck {
5
+ /** The signing digest of the request's transaction. */
6
+ readonly signingHash: string | Uint8Array;
7
+ /** The 20-byte EVM form of the address that must have signed. */
8
+ readonly expectedAddress: Uint8Array;
9
+ }
10
+ /**
11
+ * Build the check of an evmType2 request's responses.
12
+ *
13
+ * @param request - The on-ledger evmType2 request record the responses answer
14
+ * @param expectedSigner - The EVM address (0x hex, any case, checksum not enforced) that must have signed
15
+ * @returns The check
16
+ * @throws {Error} If the request is not an evmType2 record, the record does not assemble, or `expectedSigner` is not an EVM address
17
+ */
18
+ export declare function evmSignatureCheck(request: AnySignBidirectionalEvent, expectedSigner: string): SignatureCheck;
19
+ /**
20
+ * Build the check of a Tron request's responses.
21
+ *
22
+ * @param request - The on-ledger Tron request record the responses answer
23
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the transaction owner is derived from it and the record's `sender` and `path`
24
+ * @returns The check
25
+ * @throws {Error} If the request is not a Tron record, the record does not assemble or the key does not parse
26
+ */
27
+ export declare function tronSignatureCheck(request: AnySignBidirectionalEvent, mpcRootPublicKey: string): SignatureCheck;
28
+ /**
29
+ * Recover the 20-byte address that produced a response signature over a digest.
30
+ *
31
+ * @param signingHash - The digest the signature is over
32
+ * @param response - The posted signature record
33
+ * @returns The recovered 20-byte address
34
+ * @throws {Error} If the response is not a decodable signature
35
+ */
36
+ export declare function recoverSignatureAddress(signingHash: string | Uint8Array, response: SignatureRespondedEvent): Uint8Array;
37
+ /**
38
+ * Compare a recovered address with a check's expected address, byte for byte.
39
+ *
40
+ * @param check - The check the response is judged by
41
+ * @param recovered - The recovered 20-byte address
42
+ * @returns `true` iff the addresses are equal
43
+ */
44
+ export declare function isExpectedSigner(check: SignatureCheck, recovered: Uint8Array): boolean;
4
45
  /**
5
46
  * Recover the address that produced a response signature, over the signing
6
47
  * digest of the evmType2 transaction the request describes.
@@ -13,15 +54,17 @@ import type { TronTxParams } from "./signet-tron-requests.ts";
13
54
  * or the request record is malformed (see
14
55
  * {@link signBidirectionalEventToUnsignedEvmTransaction}).
15
56
  */
16
- export declare function recoverEvmSignatureResponseSigner(request: SignBidirectionalEvent, response: SignatureRespondedEvent): string;
57
+ export declare function recoverEvmSignatureResponseSigner(request: AnySignBidirectionalEvent, response: SignatureRespondedEvent): string;
17
58
  /**
59
+ * Recover the address that produced a response signature, over the id of the Tron transaction the request describes.
60
+ *
18
61
  * @param request - The on-ledger Tron request record the response answers
19
62
  * @param response - The posted signature record answering it
20
63
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the transaction owner is derived from it and the record's `sender` and `path`
21
64
  * @returns The recovered signer as a base58 Tron address
22
65
  * @throws {Error} If the request is not a Tron record, the record does not assemble, the key does not parse or the response is not a decodable signature
23
66
  */
24
- export declare function recoverTronSignatureResponseSigner(request: SignBidirectionalEvent<TronTxParams>, response: SignatureRespondedEvent, mpcRootPublicKey: string): string;
67
+ export declare function recoverTronSignatureResponseSigner(request: AnySignBidirectionalEvent, response: SignatureRespondedEvent, mpcRootPublicKey: string): string;
25
68
  /**
26
69
  * Verify a posted response against its evmType2 request: does the signature
27
70
  * recover to `expectedSigner`? A malformed or wrongly-signed response is
@@ -29,18 +72,20 @@ export declare function recoverTronSignatureResponseSigner(request: SignBidirect
29
72
  *
30
73
  * @param request - The on-ledger evmType2 request record the response answers.
31
74
  * @param response - The posted signature record answering it.
32
- * @param expectedSigner - The EVM address (any case, 0x hex) that must have signed.
75
+ * @param expectedSigner - The EVM address (0x hex, any case, checksum not enforced) that must have signed.
33
76
  * @returns `true` iff the response is a valid signature by `expectedSigner`.
34
77
  * @throws {Error} If the request is not an evmType2 record, the record does
35
78
  * not assemble, or `expectedSigner` is not an EVM address.
36
79
  */
37
- export declare function verifyEvmSignatureRespondedEvent(request: SignBidirectionalEvent, response: SignatureRespondedEvent, expectedSigner: string): boolean;
80
+ export declare function verifyEvmSignatureRespondedEvent(request: AnySignBidirectionalEvent, response: SignatureRespondedEvent, expectedSigner: string): boolean;
38
81
  /**
82
+ * Verify a posted response against its Tron request: does the signature recover to the transaction's owner?
83
+ *
39
84
  * @param request - The on-ledger Tron request record the response answers
40
85
  * @param response - The posted signature record answering it
41
86
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
42
87
  * @returns `true` iff the response is a valid signature by the derived owner
43
88
  * @throws {Error} If the request is not a Tron record, the record does not assemble or the key does not parse
44
89
  */
45
- export declare function verifyTronSignatureRespondedEvent(request: SignBidirectionalEvent<TronTxParams>, response: SignatureRespondedEvent, mpcRootPublicKey: string): boolean;
90
+ export declare function verifyTronSignatureRespondedEvent(request: AnySignBidirectionalEvent, response: SignatureRespondedEvent, mpcRootPublicKey: string): boolean;
46
91
  //# sourceMappingURL=signature-response-verification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature-response-verification.d.ts","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,EAAE,KAAK,sBAAsB,EAAe,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAmD9D;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,uBAAuB,GAChC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,EAC7C,QAAQ,EAAE,uBAAuB,EACjC,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAKR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,uBAAuB,EACjC,cAAc,EAAE,MAAM,GACrB,OAAO,CAGT;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,EAC7C,QAAQ,EAAE,uBAAuB,EACjC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAGT"}
1
+ {"version":3,"file":"signature-response-verification.d.ts","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,EAAE,KAAK,yBAAyB,EAA+B,MAAM,sBAAsB,CAAC;AAkCnG,uHAAuH;AACvH,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1C,iEAAiE;IACjE,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,yBAAyB,EAClC,cAAc,EAAE,MAAM,GACrB,cAAc,CAKhB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,EAClC,gBAAgB,EAAE,MAAM,GACvB,cAAc,CAGhB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,GAAG,UAAU,EAChC,QAAQ,EAAE,uBAAuB,GAChC,UAAU,CAEZ;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAMtF;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,yBAAyB,EAClC,QAAQ,EAAE,uBAAuB,GAChC,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,yBAAyB,EAClC,QAAQ,EAAE,uBAAuB,EACjC,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAGR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,yBAAyB,EAClC,QAAQ,EAAE,uBAAuB,EACjC,cAAc,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,yBAAyB,EAClC,QAAQ,EAAE,uBAAuB,EACjC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAET"}
@@ -5,16 +5,16 @@
5
5
  import { getAddress, getBytes, recoverAddress } from "ethers";
6
6
  import { signatureRespondedEventToSignature } from "./ecdsa-attestation.js";
7
7
  import { signBidirectionalEventToUnsignedEvmTransaction } from "./signet-evtype2tx-requests.js";
8
- import { TxParamType } from "./signet-requests.js";
8
+ import { isEvmRequest, isTronRequest } from "./signet-requests.js";
9
9
  import { buildTronRawTransaction, deriveSignBidirectionalEventSignerTronAddress, tronAddressFromEvm, tronAddressToBase58, tronTransactionId, } from "./tron-transactions.js";
10
10
  function evmSigningHash(request) {
11
- if (request.txParamType !== TxParamType.evmType2) {
11
+ if (!isEvmRequest(request)) {
12
12
  throw new Error(`expected an evmType2 request record, got txParamType ${String(request.txParamType)}`);
13
13
  }
14
14
  return signBidirectionalEventToUnsignedEvmTransaction(request).unsignedHash;
15
15
  }
16
16
  function tronSigningHash(request, mpcRootPublicKey) {
17
- if (request.txParamType !== TxParamType.tron) {
17
+ if (!isTronRequest(request)) {
18
18
  throw new Error(`expected a Tron request record, got txParamType ${String(request.txParamType)}`);
19
19
  }
20
20
  const owner = deriveSignBidirectionalEventSignerTronAddress(mpcRootPublicKey, request).bytes;
@@ -23,16 +23,64 @@ function tronSigningHash(request, mpcRootPublicKey) {
23
23
  owner,
24
24
  };
25
25
  }
26
- function signatureRecoversTo(signingHash, response, expectedAddress) {
26
+ /**
27
+ * Build the check of an evmType2 request's responses.
28
+ *
29
+ * @param request - The on-ledger evmType2 request record the responses answer
30
+ * @param expectedSigner - The EVM address (0x hex, any case, checksum not enforced) that must have signed
31
+ * @returns The check
32
+ * @throws {Error} If the request is not an evmType2 record, the record does not assemble, or `expectedSigner` is not an EVM address
33
+ */
34
+ export function evmSignatureCheck(request, expectedSigner) {
35
+ return {
36
+ signingHash: evmSigningHash(request),
37
+ expectedAddress: getBytes(getAddress(expectedSigner.toLowerCase())),
38
+ };
39
+ }
40
+ /**
41
+ * Build the check of a Tron request's responses.
42
+ *
43
+ * @param request - The on-ledger Tron request record the responses answer
44
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the transaction owner is derived from it and the record's `sender` and `path`
45
+ * @returns The check
46
+ * @throws {Error} If the request is not a Tron record, the record does not assemble or the key does not parse
47
+ */
48
+ export function tronSignatureCheck(request, mpcRootPublicKey) {
49
+ const { signingHash, owner } = tronSigningHash(request, mpcRootPublicKey);
50
+ return { signingHash, expectedAddress: owner.slice(1) };
51
+ }
52
+ /**
53
+ * Recover the 20-byte address that produced a response signature over a digest.
54
+ *
55
+ * @param signingHash - The digest the signature is over
56
+ * @param response - The posted signature record
57
+ * @returns The recovered 20-byte address
58
+ * @throws {Error} If the response is not a decodable signature
59
+ */
60
+ export function recoverSignatureAddress(signingHash, response) {
61
+ return getBytes(recoverAddress(signingHash, signatureRespondedEventToSignature(response)));
62
+ }
63
+ /**
64
+ * Compare a recovered address with a check's expected address, byte for byte.
65
+ *
66
+ * @param check - The check the response is judged by
67
+ * @param recovered - The recovered 20-byte address
68
+ * @returns `true` iff the addresses are equal
69
+ */
70
+ export function isExpectedSigner(check, recovered) {
71
+ const expected = check.expectedAddress;
72
+ return (recovered.length === expected.length &&
73
+ recovered.every((byte, index) => byte === expected[index]));
74
+ }
75
+ function signatureRecoversTo(check, response) {
27
76
  let recovered;
28
77
  try {
29
- recovered = getBytes(recoverAddress(signingHash, signatureRespondedEventToSignature(response)));
78
+ recovered = recoverSignatureAddress(check.signingHash, response);
30
79
  }
31
80
  catch {
32
81
  return false;
33
82
  }
34
- return (recovered.length === expectedAddress.length &&
35
- recovered.every((byte, index) => byte === expectedAddress[index]));
83
+ return isExpectedSigner(check, recovered);
36
84
  }
37
85
  /**
38
86
  * Recover the address that produced a response signature, over the signing
@@ -50,6 +98,8 @@ export function recoverEvmSignatureResponseSigner(request, response) {
50
98
  return recoverAddress(evmSigningHash(request), signatureRespondedEventToSignature(response));
51
99
  }
52
100
  /**
101
+ * Recover the address that produced a response signature, over the id of the Tron transaction the request describes.
102
+ *
53
103
  * @param request - The on-ledger Tron request record the response answers
54
104
  * @param response - The posted signature record answering it
55
105
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the transaction owner is derived from it and the record's `sender` and `path`
@@ -58,7 +108,7 @@ export function recoverEvmSignatureResponseSigner(request, response) {
58
108
  */
59
109
  export function recoverTronSignatureResponseSigner(request, response, mpcRootPublicKey) {
60
110
  const { signingHash } = tronSigningHash(request, mpcRootPublicKey);
61
- return tronAddressToBase58(tronAddressFromEvm(recoverAddress(signingHash, signatureRespondedEventToSignature(response))));
111
+ return tronAddressToBase58(tronAddressFromEvm(recoverSignatureAddress(signingHash, response)));
62
112
  }
63
113
  /**
64
114
  * Verify a posted response against its evmType2 request: does the signature
@@ -67,16 +117,17 @@ export function recoverTronSignatureResponseSigner(request, response, mpcRootPub
67
117
  *
68
118
  * @param request - The on-ledger evmType2 request record the response answers.
69
119
  * @param response - The posted signature record answering it.
70
- * @param expectedSigner - The EVM address (any case, 0x hex) that must have signed.
120
+ * @param expectedSigner - The EVM address (0x hex, any case, checksum not enforced) that must have signed.
71
121
  * @returns `true` iff the response is a valid signature by `expectedSigner`.
72
122
  * @throws {Error} If the request is not an evmType2 record, the record does
73
123
  * not assemble, or `expectedSigner` is not an EVM address.
74
124
  */
75
125
  export function verifyEvmSignatureRespondedEvent(request, response, expectedSigner) {
76
- const signingHash = evmSigningHash(request);
77
- return signatureRecoversTo(signingHash, response, getBytes(getAddress(expectedSigner)));
126
+ return signatureRecoversTo(evmSignatureCheck(request, expectedSigner), response);
78
127
  }
79
128
  /**
129
+ * Verify a posted response against its Tron request: does the signature recover to the transaction's owner?
130
+ *
80
131
  * @param request - The on-ledger Tron request record the response answers
81
132
  * @param response - The posted signature record answering it
82
133
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
@@ -84,7 +135,6 @@ export function verifyEvmSignatureRespondedEvent(request, response, expectedSign
84
135
  * @throws {Error} If the request is not a Tron record, the record does not assemble or the key does not parse
85
136
  */
86
137
  export function verifyTronSignatureRespondedEvent(request, response, mpcRootPublicKey) {
87
- const { signingHash, owner } = tronSigningHash(request, mpcRootPublicKey);
88
- return signatureRecoversTo(signingHash, response, owner.slice(1));
138
+ return signatureRecoversTo(tronSignatureCheck(request, mpcRootPublicKey), response);
89
139
  }
90
140
  //# sourceMappingURL=signature-response-verification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature-response-verification.js","sourceRoot":"","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,WAAW,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC1E,OAAO,mBAAmB,CAAC,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"signature-response-verification.js","sourceRoot":"","sources":["../src/signature-response-verification.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+DAA+D;AAC/D,kFAAkF;AAClF,eAAe;AAEf,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,8CAA8C,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAkC,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EACL,uBAAuB,EACvB,6CAA6C,EAC7C,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,SAAS,cAAc,CAAC,OAAkC;IACxD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,wDAAwD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,8CAA8C,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC;AAC9E,CAAC;AAED,SAAS,eAAe,CACtB,OAAkC,EAClC,gBAAwB;IAExB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,mDAAmD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CACjF,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,6CAA6C,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC;IAC7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AAG,uBAAuB,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAkC,EAClC,QAAiC;IAEjC,OAAO,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,kCAAkC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kCAAkC,CAChD,OAAkC,EAClC,QAAiC,EACjC,gBAAwB;IAExB,MAAM,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACnE,OAAO,mBAAmB,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gCAAgC,CAC9C,OAAkC,EAClC,QAAiC,EACjC,cAAsB;IAEtB,OAAO,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,QAAQ,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAkC,EAClC,QAAiC,EACjC,gBAAwB;IAExB,OAAO,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC;AACtF,CAAC"}
@@ -219,7 +219,7 @@ export interface RespondBidirectionalEvent {
219
219
  outputHash: Uint8Array;
220
220
  /**
221
221
  * The attestation digest the signature is over, 32 bytes. A verifier
222
- * recomputes it from the fields above.
222
+ * recomputes it from the fields above and refuses a post whose copy differs.
223
223
  */
224
224
  digest: Uint8Array;
225
225
  /** ECDSA signature over the attestation digest. */
@@ -7,7 +7,7 @@ import { transientHash, upgradeFromTransient } from "@midnight-ntwrk/compact-run
7
7
  import { compactTupleDescriptor, HASH_DOMAIN } from "./compact-descriptors.js";
8
8
  import { HashDomain } from "./managed/contract/index.js";
9
9
  import { calculateEvmType2TxParamsDigest } from "./signet-evtype2tx-requests.js";
10
- import { isEvmType2SignBidirectionalEvent, isTronSignBidirectionalEvent, requestIdPreimageDescriptor, TxParamType, } from "./signet-requests.js";
10
+ import { isEvmRequest, isTronRequest, requestIdPreimageDescriptor, TxParamType, } from "./signet-requests.js";
11
11
  import { calculateTronTxParamsDigest } from "./signet-tron-requests.js";
12
12
  const REQUEST_ID_HASH_PREIMAGE = compactTupleDescriptor([
13
13
  HASH_DOMAIN,
@@ -28,10 +28,10 @@ const REQUEST_ID_HASH_PREIMAGE = compactTupleDescriptor([
28
28
  export function calculateRequestId(request) {
29
29
  const { txParamType } = request;
30
30
  let txParamsDigest;
31
- if (isEvmType2SignBidirectionalEvent(request)) {
31
+ if (isEvmRequest(request)) {
32
32
  txParamsDigest = calculateEvmType2TxParamsDigest(request.txParams);
33
33
  }
34
- else if (isTronSignBidirectionalEvent(request)) {
34
+ else if (isTronRequest(request)) {
35
35
  txParamsDigest = calculateTronTxParamsDigest(request.txParams);
36
36
  }
37
37
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"signet-request-id.js","sourceRoot":"","sources":["../src/signet-request-id.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,8EAA8E;AAC9E,mGAAmG;AACnG,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,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AAE,OAAO,CAAC,UAAU;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW;QACX,cAAc;QACd,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC;IACF,OAAO,oBAAoB,CACzB,aAAa,CAAC,wBAAwB,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAC1E,CAAC;AACJ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { PublicDataProvider, SerializedContractState } from "@midnight-ntwrk/midnight-js-types";
2
2
  import { type Transaction } from "ethers";
3
3
  import { type Secp256k1Point } from "./ecdsa-attestation.ts";
4
- import { type DecodedSignetEvent, type RespondBidirectionalEvent, type SignatureRespondedEvent, type SignetEventSource } from "./signet-contract-events.ts";
4
+ import { type DecodedSignetEvent, type IndexedSignetMiscEvent, type RespondBidirectionalEvent, type SignatureRespondedEvent, type SignetEventSource } from "./signet-contract-events.ts";
5
5
  import { type AnySignBidirectionalEvent, type RequestIdHex, type SignBidirectionalEvent } from "./signet-requests.ts";
6
6
  import type { TronTxParams } from "./signet-tron-requests.ts";
7
7
  /**
@@ -40,22 +40,26 @@ export interface SignetRequestResponseReaderConfig {
40
40
  /** Source of raw contract state, e.g. midnight-js's `indexerPublicDataProvider`. */
41
41
  readonly publicDataProvider: SignetPublicStateSource;
42
42
  /**
43
- * Source of the responder contract's emitted events. Read a live indexer
44
- * with `signetEventSourceFromIndexer`.
43
+ * Source of the responder contract's emitted events, each carrying the
44
+ * indexer's event cursor the reader resumes its scans from. Read a live
45
+ * indexer with `signetEventSourceFromIndexer`.
45
46
  */
46
- readonly eventSource: SignetEventSource;
47
+ readonly eventSource: SignetEventSource<IndexedSignetMiscEvent>;
47
48
  /**
48
- * Inclusive lowest Midnight block the reader scans for responses. Omit to
49
- * scan the whole history. Responses are emitted after their request, so
50
- * the tip taken BEFORE submitting the first request is safe for a fresh
51
- * client. It must not exceed the block of the oldest request whose
52
- * responses are still wanted: a value too high hides them without error.
49
+ * Inclusive lowest Midnight block a request's FIRST scan for responses
50
+ * starts at: later scans of that request resume from its own cursor. Omit
51
+ * to start at the beginning of the history. Set it to the block just
52
+ * before the oldest request whose responses are still pending: responses
53
+ * are emitted after their request, so the tip taken BEFORE submitting the
54
+ * first request is safe for a fresh client. A value above that block hides
55
+ * the request's responses without error, and a value far below it makes
56
+ * every first scan walk history that cannot hold a response.
53
57
  */
54
58
  readonly responderEventsFromBlock?: number;
55
59
  }
56
60
  /** The verdict on one emitted response, in emission order. */
57
61
  export interface SignatureResponseVerdict {
58
- /** 0-based position of the post among the request's signature-response events. */
62
+ /** 0-based position of the post among the signature responses judged. */
59
63
  index: bigint;
60
64
  /** The posted signature record, verbatim. */
61
65
  response: SignatureRespondedEvent;
@@ -64,7 +68,7 @@ export interface SignatureResponseVerdict {
64
68
  /** Why the post was rejected, absent when the post is valid. */
65
69
  rejectedReason?: string;
66
70
  }
67
- /** Result of {@link SignetRequestResponseReader['getVerifiedSignatureRespondedEvent']}. */
71
+ /** Result of {@link SignetRequestResponseReader['getSignatureResponseVerdicts']}. */
68
72
  export interface VerifiedSignatureResponseResult {
69
73
  /**
70
74
  * The first valid response (lowest index), or `undefined` when no valid
@@ -93,12 +97,15 @@ export interface VerifiedSignatureResponseResult {
93
97
  export declare function findVerifiedRespondBidirectionalEvent(requestId: RequestIdHex, serializedOutput: Uint8Array, mpcResponseKey: Secp256k1Point, events: readonly DecodedSignetEvent[]): RespondBidirectionalEvent | undefined;
94
98
  /**
95
99
  * Reader over one requester contract / responder contract pair. Construct once
96
- * per pair and reuse: fetched request records are cached, so repeated
97
- * verification calls cost one event query each.
100
+ * per pair and reuse across polls: per request it caches the request record,
101
+ * the distinct responses read so far with each one's verification outcome,
102
+ * and the event cursor, so a poll handles only events it has not seen yet
103
+ * and no response is verified twice.
98
104
  */
99
105
  export declare class SignetRequestResponseReader {
100
106
  private readonly config;
101
107
  private readonly requestCache;
108
+ private readonly responseScans;
102
109
  /**
103
110
  * @param config - The contract pair, state source and event source to read
104
111
  * through.
@@ -116,60 +123,117 @@ export declare class SignetRequestResponseReader {
116
123
  */
117
124
  getSignatureRequest(requestId: RequestIdHex): Promise<AnySignBidirectionalEvent>;
118
125
  /**
126
+ * Fetch a request record that must carry the evmType2 decomposition.
127
+ *
119
128
  * @param requestId - The request id to look up
120
129
  * @returns The stored evmType2 request record
121
130
  * @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
122
131
  */
123
132
  getEvmType2SignatureRequest(requestId: RequestIdHex): Promise<SignBidirectionalEvent>;
124
133
  /**
134
+ * Fetch a request record that must carry the Tron decomposition.
135
+ *
125
136
  * @param requestId - The request id to look up
126
137
  * @returns The stored Tron request record
127
138
  * @throws {Error} When the request cannot be fetched (see {@link getSignatureRequest}) or carries another decomposition
128
139
  */
129
140
  getTronSignatureRequest(requestId: RequestIdHex): Promise<SignBidirectionalEvent<TronTxParams>>;
141
+ private evmSignerCheck;
142
+ private tronSignerCheck;
143
+ /**
144
+ * The responses read so far for `requestId`, without touching the event
145
+ * source.
146
+ *
147
+ * @param requestId - The request id.
148
+ * @returns The request's scan state, empty before its first scan.
149
+ */
150
+ private responseScanOf;
130
151
  /**
131
- * Fetch the responder contract's posts of event `name` that declare
132
- * `requestId`, in emission order, skipping posts whose payload does not
133
- * decode. The declared id is routing data only.
152
+ * Read the responder contract's events from the block where the previous
153
+ * scan of `requestId` stopped, skip the ones it already saw, and keep the
154
+ * posts of either response kind that declare it, skipping posts whose
155
+ * payload does not decode and repeats of a post already kept. The declared id is routing data only.
134
156
  *
135
- * @param name - The signet event name to keep.
136
157
  * @param requestId - The request id the kept posts must declare.
137
- * @returns The kept posts' records, oldest first.
158
+ * @returns The request's scan state, read up to the indexer's tip.
138
159
  */
139
- private getRecordsNamed;
160
+ private scanResponses;
140
161
  /**
141
- * Fetch every decodable signature response posted under `requestId`, in
142
- * emission order. UNVERIFIED: any post may still be garbage, sift with
143
- * {@link getVerifiedSignatureRespondedEvent} first.
162
+ * Fetch every distinct decodable signature response posted under
163
+ * `requestId`, in emission order. UNVERIFIED: any post may still be
164
+ * garbage, sift with {@link getVerifiedSignatureRespondedEvent} first.
144
165
  *
145
166
  * @param requestId - The request id the posts must declare.
146
167
  * @returns The request's posted records, oldest first, empty when none yet.
147
168
  */
148
169
  getSignatureRespondedEvents(requestId: RequestIdHex): Promise<SignatureRespondedEvent[]>;
149
170
  /**
150
- * Fetch the signature responses posted under `requestId` and verify each
151
- * against the evmType2 request: a valid post's signature recovers to
152
- * `expectedSigner` over the signing hash of the request's transaction. The
153
- * first valid post wins, and every candidate gets a verdict.
171
+ * The first of a request's signature responses read so far that passes
172
+ * `check`, recovering the signer of each post at most once across calls
173
+ * and stopping at the first match.
174
+ *
175
+ * @param check - The check the posts are judged by.
176
+ * @param candidates - The request's responses read so far, emission order.
177
+ * @returns The first valid response, or `undefined` when none is valid.
178
+ */
179
+ private firstResponseSignedBy;
180
+ private firstVerifiedSignatureRespondedEvent;
181
+ private signatureResponseVerdicts;
182
+ /**
183
+ * Fetch the first signature response posted under `requestId` that
184
+ * verifies against the evmType2 request: its signature recovers to
185
+ * `expectedSigner` over the signing hash of the request's transaction.
186
+ * The fast path of a poll loop: a valid response already read is returned
187
+ * without touching the event source, a scan handles only the events it has
188
+ * not seen yet, and verification stops at the first valid post.
189
+ * {@link getSignatureResponseVerdicts} says why the other posts were
190
+ * rejected.
154
191
  *
155
192
  * @param requestId - The request id to fetch a verified response for.
156
193
  * @param expectedSigner - The EVM address (0x hex, any case) the genuine
157
194
  * response must be signed by: the requester's MPC-derived address.
158
- * @returns The first valid response (if any) plus per-post verdicts.
195
+ * @returns The first valid response, or `undefined` when no valid response
196
+ * has been posted yet: poll again.
159
197
  * @throws {Error} When the requester contract has no state, the request is
160
198
  * not on its ledger, the request is not an evmType2 record, or
161
199
  * `expectedSigner` is not an EVM address.
162
200
  */
163
- getVerifiedSignatureRespondedEvent(requestId: RequestIdHex, expectedSigner: string): Promise<VerifiedSignatureResponseResult>;
201
+ getVerifiedSignatureRespondedEvent(requestId: RequestIdHex, expectedSigner: string): Promise<SignatureRespondedEvent | undefined>;
164
202
  /**
203
+ * The Tron twin of {@link getVerifiedSignatureRespondedEvent}: the first response signed by the owner of the request's transaction.
204
+ *
165
205
  * @param requestId - The Tron request id to fetch a verified response for
166
206
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
207
+ * @returns The first valid response, or `undefined` when no valid response has been posted yet
208
+ * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
209
+ */
210
+ getVerifiedTronSignatureRespondedEvent(requestId: RequestIdHex, mpcRootPublicKey: string): Promise<SignatureRespondedEvent | undefined>;
211
+ /**
212
+ * The diagnostic sibling of {@link getVerifiedSignatureRespondedEvent}:
213
+ * fetch every distinct signature response posted under the evmType2
214
+ * `requestId` and give each a verdict against the request. The signer of
215
+ * a post is recovered at most once across calls.
216
+ *
217
+ * @param requestId - The request id to judge the responses of.
218
+ * @param expectedSigner - The EVM address (0x hex, any case) the genuine
219
+ * response must be signed by: the requester's MPC-derived address.
220
+ * @returns The first valid response (if any) plus per-post verdicts.
221
+ * @throws {Error} When the requester contract has no state, the request is
222
+ * not on its ledger, the request is not an evmType2 record, or
223
+ * `expectedSigner` is not an EVM address.
224
+ */
225
+ getSignatureResponseVerdicts(requestId: RequestIdHex, expectedSigner: string): Promise<VerifiedSignatureResponseResult>;
226
+ /**
227
+ * The Tron twin of {@link getSignatureResponseVerdicts}: every response of the request with its verdict.
228
+ *
229
+ * @param requestId - The Tron request id to judge the responses of
230
+ * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`; the expected owner is derived from it and the record's `sender` and `path`
167
231
  * @returns The first valid response (if any) plus per-post verdicts, signers in base58
168
232
  * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
169
233
  */
170
- getVerifiedTronSignatureRespondedEvent(requestId: RequestIdHex, mpcRootPublicKey: string): Promise<VerifiedSignatureResponseResult>;
234
+ getTronSignatureResponseVerdicts(requestId: RequestIdHex, mpcRootPublicKey: string): Promise<VerifiedSignatureResponseResult>;
171
235
  /**
172
- * {@link getVerifiedSignatureRespondedEvent} over decoded events already in
236
+ * {@link getSignatureResponseVerdicts} over decoded events already in
173
237
  * hand: the one ledger read for the request (cached), and no walk of the
174
238
  * responder contract's event history. For a consumer that streamed and decoded
175
239
  * the history once and verifies many requests against it.
@@ -186,6 +250,8 @@ export declare class SignetRequestResponseReader {
186
250
  */
187
251
  verifySignatureRespondedEvents(requestId: RequestIdHex, expectedSigner: string, events: readonly DecodedSignetEvent[]): Promise<VerifiedSignatureResponseResult>;
188
252
  /**
253
+ * The Tron twin of {@link verifySignatureRespondedEvents}: judge the request's responses among decoded events already in hand.
254
+ *
189
255
  * @param requestId - The Tron request id to verify responses for
190
256
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion`
191
257
  * @param events - Decoded signet events of any kinds and request ids, in emission order
@@ -193,8 +259,6 @@ export declare class SignetRequestResponseReader {
193
259
  * @throws {Error} When the requester contract has no state, the request is not on its ledger, the request is not a Tron record, or the key does not parse
194
260
  */
195
261
  verifyTronSignatureRespondedEvents(requestId: RequestIdHex, mpcRootPublicKey: string, events: readonly DecodedSignetEvent[]): Promise<VerifiedSignatureResponseResult>;
196
- private verifyEvmSignatureResponses;
197
- private verifyTronSignatureResponses;
198
262
  /**
199
263
  * Rebuild the unsigned EIP-1559 transaction for `requestId`: the exact
200
264
  * transaction the MPC signs, from the request record alone (fetched via
@@ -224,6 +288,8 @@ export declare class SignetRequestResponseReader {
224
288
  */
225
289
  getSignedEvmTransaction(requestId: RequestIdHex, expectedSigner: string): Promise<Transaction | undefined>;
226
290
  /**
291
+ * Assemble the broadcast-ready signed Tron transaction for a request, attaching the first verified response.
292
+ *
227
293
  * @param requestId - The request id to produce a signed transaction for
228
294
  * @param mpcRootPublicKey - The MPC root public key of the record's `keyVersion` (e.g. `getMpcRootPublicKey(network)`); the owner is derived from it and the record's `sender` and `path`
229
295
  * @returns The signed protobuf `Transaction` bytes, or `undefined` when no valid response has been posted yet
@@ -231,7 +297,7 @@ export declare class SignetRequestResponseReader {
231
297
  */
232
298
  getSignedTronTransaction(requestId: RequestIdHex, mpcRootPublicKey: string): Promise<Uint8Array | undefined>;
233
299
  /**
234
- * Fetch every decodable respond-bidirectional response posted under
300
+ * Fetch every distinct decodable respond-bidirectional response posted under
235
301
  * `requestId`, in emission order. UNVERIFIED: any post may still be
236
302
  * garbage, sift with {@link getVerifiedRespondBidirectionalEvent} (or
237
303
  * in-circuit at claim time) first.
@@ -240,6 +306,16 @@ export declare class SignetRequestResponseReader {
240
306
  * @returns The request's posted records, oldest first, empty when none yet.
241
307
  */
242
308
  getRespondBidirectionalEvents(requestId: RequestIdHex): Promise<RespondBidirectionalEvent[]>;
309
+ /**
310
+ * The first of a request's respond-bidirectional posts read so far whose
311
+ * signature verifies against `mpcResponseKey`, checking each post against
312
+ * a key at most once across calls and stopping at the first match.
313
+ *
314
+ * @param candidates - The request's posts read so far, emission order.
315
+ * @param mpcResponseKey - The MPC response key the requesting contract pinned.
316
+ * @returns The first attested post, or `undefined` when none verifies.
317
+ */
318
+ private firstPostAttestedBy;
243
319
  /**
244
320
  * Fetch the respond-bidirectional posts declared under `requestId` and
245
321
  * return the first (oldest) one whose signature verifies against
@@ -247,7 +323,9 @@ export declare class SignetRequestResponseReader {
247
323
  * `serializedOutput`: the off-chain twin of the check the client contract
248
324
  * runs in-circuit. The output must be the exact unpadded bytes the
249
325
  * attestation commits to, so a post that verifies here is the post that
250
- * proves at claim time.
326
+ * proves at claim time. An attested post already read is judged without
327
+ * touching the event source, and a scan handles only the events it has
328
+ * not seen yet.
251
329
  *
252
330
  * @param requestId - The request id the posts must declare and the
253
331
  * attestation must commit to.
@@ -1 +1 @@
1
- {"version":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"}
1
+ {"version":3,"file":"signet-request-response-reader.d.ts","sourceRoot":"","sources":["../src/signet-request-response-reader.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG/D,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAG5B,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,KAAK,yBAAyB,EAG9B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAS9D;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,kBAAkB,CAChB,eAAe,EAAE,UAAU,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,GACvE,OAAO,CAAC;QAAE,QAAQ,CAAC,aAAa,EAAE,uBAAuB,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACxE;AAED,yEAAyE;AACzE,MAAM,WAAW,iCAAiC;IAChD,2EAA2E;IAC3E,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,oFAAoF;IACpF,QAAQ,CAAC,kBAAkB,EAAE,uBAAuB,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAChE;;;;;;;;;OAS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