@aztec/stdlib 5.0.0-nightly.20260706 → 5.0.0-nightly.20260708
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/dest/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +13 -2
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +5 -0
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +37 -1
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/config/network-consensus-config.d.ts +1 -1
- package/dest/config/network-consensus-config.d.ts.map +1 -1
- package/dest/config/network-consensus-config.js +2 -10
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/interfaces/aztec-node-admin.d.ts +5 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +4 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/validator.d.ts +7 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/keys/derivation.d.ts +1 -2
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +0 -7
- package/dest/logs/app_tagging_secret.d.ts +6 -1
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +6 -0
- package/dest/logs/index.d.ts +1 -3
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -2
- package/dest/logs/shared_secret_derivation.d.ts +9 -3
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +13 -6
- package/dest/p2p/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/package.json +8 -8
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +13 -2
- package/src/block/proposal/attestations_and_signers.ts +43 -1
- package/src/block/validate_block_result.ts +48 -2
- package/src/config/network-consensus-config.ts +2 -13
- package/src/database-version/version_manager.ts +96 -6
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/world_state.ts +14 -0
- package/src/keys/derivation.ts +0 -5
- package/src/logs/app_tagging_secret.ts +12 -0
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +17 -8
- package/src/p2p/signature_utils.ts +9 -0
- package/dest/logs/message_context.d.ts +0 -17
- package/dest/logs/message_context.d.ts.map +0 -1
- package/dest/logs/message_context.js +0 -9
- package/dest/logs/pending_tagged_log.d.ts +0 -11
- package/dest/logs/pending_tagged_log.d.ts.map +0 -1
- package/dest/logs/pending_tagged_log.js +0 -4
- package/src/logs/message_context.ts +0 -18
- package/src/logs/pending_tagged_log.ts +0 -12
|
@@ -32,6 +32,11 @@ export declare class AppTaggingSecret {
|
|
|
32
32
|
* @returns The secret that can be used along with an index to compute a tag to be included in a log.
|
|
33
33
|
*/
|
|
34
34
|
static computeDirectional(taggingSecretPoint: Point, app: AztecAddress, recipient: AztecAddress): Promise<AppTaggingSecret>;
|
|
35
|
+
/**
|
|
36
|
+
* Derives the bare app-siloed tagging secret from a shared secret point via {@link appSiloEcdhSharedSecretPoint},
|
|
37
|
+
* under the given delivery-mode kind.
|
|
38
|
+
*/
|
|
39
|
+
static computeAppSiloed(taggingSecretPoint: Point, app: AztecAddress, kind: AppTaggingSecretKind): Promise<AppTaggingSecret>;
|
|
35
40
|
/**
|
|
36
41
|
* Derives the tagging secret for `(externalAddress, recipient, app)` by performing an ECDH key exchange against
|
|
37
42
|
* `externalAddress` to obtain the shared point, then siloing and directing it via {@link computeDirectional}.
|
|
@@ -61,4 +66,4 @@ export declare const AppTaggingSecretSchema: z.ZodPipe<z.ZodObject<{
|
|
|
61
66
|
* Returns undefined if `externalAddress` is an invalid address.
|
|
62
67
|
*/
|
|
63
68
|
export declare function computeSharedTaggingSecret(localAddress: CompleteAddress, localIvsk: Fq, externalAddress: AztecAddress): Promise<Point | undefined>;
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
69
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwX3RhZ2dpbmdfc2VjcmV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9hcHBfdGFnZ2luZ19zZWNyZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLEtBQUssRUFBRSxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRS9ELE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFeEIsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXZFLE9BQU8sRUFBRSxvQkFB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E,YAAY,EACjB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAK3B;IAED;;;OAGG;IACH,OAAa,gBAAgB,CAC3B,kBAAkB,EAAE,KAAK,EACzB,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;IAED;;;;OAIG;IACH,OAAa,cAAc,CACzB,YAAY,EAAE,eAAe,EAC7B,SAAS,EAAE,EAAE,EACb,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAOvC;IAED,QAAQ,IAAI,MAAM,CAMjB;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAgB/C;CACF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAExE;AAED,eAAO,MAAM,sBAAsB;;;;;;;;GAM6C,CAAC;AAajF;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,eAAe,EAC7B,SAAS,EAAE,EAAE,EACb,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAe5B"}
|
|
@@ -48,6 +48,12 @@ const AppTaggingSecretKindSchema = z.union([
|
|
|
48
48
|
return new AppTaggingSecret(directionalAppTaggingSecret, app);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
+
* Derives the bare app-siloed tagging secret from a shared secret point via {@link appSiloEcdhSharedSecretPoint},
|
|
52
|
+
* under the given delivery-mode kind.
|
|
53
|
+
*/ static async computeAppSiloed(taggingSecretPoint, app, kind) {
|
|
54
|
+
return new AppTaggingSecret(await appSiloEcdhSharedSecretPoint(taggingSecretPoint, app), app, kind);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
51
57
|
* Derives the tagging secret for `(externalAddress, recipient, app)` by performing an ECDH key exchange against
|
|
52
58
|
* `externalAddress` to obtain the shared point, then siloing and directing it via {@link computeDirectional}.
|
|
53
59
|
* Returns undefined if `externalAddress` is not a valid address.
|
package/dest/logs/index.d.ts
CHANGED
|
@@ -5,15 +5,13 @@ export * from './tagging_index_range.js';
|
|
|
5
5
|
export * from './contract_class_log.js';
|
|
6
6
|
export * from './public_log.js';
|
|
7
7
|
export * from './private_log.js';
|
|
8
|
-
export * from './pending_tagged_log.js';
|
|
9
8
|
export * from './log_result.js';
|
|
10
9
|
export * from './log_cursor.js';
|
|
11
10
|
export * from './logs_query.js';
|
|
12
11
|
export * from './query_all_logs_by_tags.js';
|
|
13
12
|
export * from './shared_secret_derivation.js';
|
|
14
|
-
export * from './message_context.js';
|
|
15
13
|
export * from './debug_log.js';
|
|
16
14
|
export * from './debug_log_store.js';
|
|
17
15
|
export * from './tag.js';
|
|
18
16
|
export * from './siloed_tag.js';
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxpQkFBaUIsQ0FBQyJ9
|
package/dest/logs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/dest/logs/index.js
CHANGED
|
@@ -5,13 +5,11 @@ export * from './tagging_index_range.js';
|
|
|
5
5
|
export * from './contract_class_log.js';
|
|
6
6
|
export * from './public_log.js';
|
|
7
7
|
export * from './private_log.js';
|
|
8
|
-
export * from './pending_tagged_log.js';
|
|
9
8
|
export * from './log_result.js';
|
|
10
9
|
export * from './log_cursor.js';
|
|
11
10
|
export * from './logs_query.js';
|
|
12
11
|
export * from './query_all_logs_by_tags.js';
|
|
13
12
|
export * from './shared_secret_derivation.js';
|
|
14
|
-
export * from './message_context.js';
|
|
15
13
|
export * from './debug_log.js';
|
|
16
14
|
export * from './debug_log_store.js';
|
|
17
15
|
export * from './tag.js';
|
|
@@ -3,8 +3,14 @@ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
|
3
3
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
4
|
import type { PublicKey } from '../keys/public_key.js';
|
|
5
5
|
/**
|
|
6
|
-
* Derives
|
|
7
|
-
*
|
|
6
|
+
* Derives the raw ECDH shared secret point `S = secretKey * publicKey`.
|
|
7
|
+
*
|
|
8
|
+
* @throws If the publicKey is zero.
|
|
9
|
+
*/
|
|
10
|
+
export declare function deriveEcdhSharedSecretPoint(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point>;
|
|
11
|
+
/**
|
|
12
|
+
* Derives an app-siloed ECDH shared secret from keys: ECDHs `S = secretKey * publicKey` via
|
|
13
|
+
* {@link deriveEcdhSharedSecretPoint}, then app-silos it via {@link appSiloEcdhSharedSecretPoint}.
|
|
8
14
|
*
|
|
9
15
|
* @param secretKey - The secret key used to derive shared secret.
|
|
10
16
|
* @param publicKey - The public key used to derive shared secret.
|
|
@@ -22,4 +28,4 @@ export declare function appSiloEcdhSharedSecret(secretKey: GrumpkinScalar, publi
|
|
|
22
28
|
* @param app - The contract address to silo to.
|
|
23
29
|
*/
|
|
24
30
|
export declare function appSiloEcdhSharedSecretPoint(point: Point, app: AztecAddress): Promise<Fr>;
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkX3NlY3JldF9kZXJpdmF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9zaGF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M,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"shared_secret_derivation.d.ts","sourceRoot":"","sources":["../../src/logs/shared_secret_derivation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAO3G;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,EAAE,CAAC,CAGb;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC,CAEzF"}
|
|
@@ -2,8 +2,18 @@ import { DomainSeparator } from '@aztec/constants';
|
|
|
2
2
|
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
4
|
/**
|
|
5
|
-
* Derives
|
|
6
|
-
*
|
|
5
|
+
* Derives the raw ECDH shared secret point `S = secretKey * publicKey`.
|
|
6
|
+
*
|
|
7
|
+
* @throws If the publicKey is zero.
|
|
8
|
+
*/ export function deriveEcdhSharedSecretPoint(secretKey, publicKey) {
|
|
9
|
+
if (publicKey.isZero()) {
|
|
10
|
+
throw new Error(`Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`);
|
|
11
|
+
}
|
|
12
|
+
return Grumpkin.mul(publicKey, secretKey);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Derives an app-siloed ECDH shared secret from keys: ECDHs `S = secretKey * publicKey` via
|
|
16
|
+
* {@link deriveEcdhSharedSecretPoint}, then app-silos it via {@link appSiloEcdhSharedSecretPoint}.
|
|
7
17
|
*
|
|
8
18
|
* @param secretKey - The secret key used to derive shared secret.
|
|
9
19
|
* @param publicKey - The public key used to derive shared secret.
|
|
@@ -11,10 +21,7 @@ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
|
11
21
|
* @returns The app-siloed shared secret as a Field.
|
|
12
22
|
* @throws If the publicKey is zero.
|
|
13
23
|
*/ export async function appSiloEcdhSharedSecret(secretKey, publicKey, contractAddress) {
|
|
14
|
-
|
|
15
|
-
throw new Error(`Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`);
|
|
16
|
-
}
|
|
17
|
-
const rawSharedSecret = await Grumpkin.mul(publicKey, secretKey);
|
|
24
|
+
const rawSharedSecret = await deriveEcdhSharedSecretPoint(secretKey, publicKey);
|
|
18
25
|
return appSiloEcdhSharedSecretPoint(rawSharedSecret, contractAddress);
|
|
19
26
|
}
|
|
20
27
|
/**
|
|
@@ -28,6 +28,15 @@ export declare function hasValidSignatureContext(signable: Signable, expected: C
|
|
|
28
28
|
export declare function getCoordinationSignatureTypedDataForPayloadHash(payloadHash: Buffer32, type: CoordinationSignatureType, context: CoordinationSignatureContext): TypedDataDefinition;
|
|
29
29
|
export declare function getCoordinationSignatureTypedData(signable: Signable): TypedDataDefinition;
|
|
30
30
|
export declare function getHashedSignaturePayloadTypedData(signable: Signable): Buffer32;
|
|
31
|
+
/**
|
|
32
|
+
* Recovers the sender of a gossiped coordination message. Deliberately lenient (allowYParityAsV): a
|
|
33
|
+
* signature whose recovery byte is in yParity form (v ∈ {0, 1}) still resolves to its sender, so the P2P
|
|
34
|
+
* layer can attribute and accept it and then canonicalize on ingress (CheckpointAttestation.
|
|
35
|
+
* withNormalizedSignature, A-1351) before it reaches the L1 bundle. This is intentionally looser than
|
|
36
|
+
* on-chain checkpoint validation (getAttestationInfoFromPayload), which recovers strictly to mirror L1's
|
|
37
|
+
* ECDSA.recover — do not unify the two. These proposal/attestation signatures are P2P-only and never reach
|
|
38
|
+
* L1 verbatim, so leniency here cannot leak a non-canonical byte onto L1.
|
|
39
|
+
*/
|
|
31
40
|
export declare function recoverCoordinationSigner(signable: Signable, signature: Signature): EthAddress | undefined;
|
|
32
41
|
export declare function getHashedSignaturePayload(s: Signable): Buffer32;
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmF0dXJlX3V0aWxzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcDJwL3NpZ25hdHVyZV91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFHcEQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQzNELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBcUIsTUFBTSw2QkFBNkIsQ0FBQztBQUVuRixPQUFPLEVBQUUsS0FBSyxtQkFBbUIsRUFBaUIsTUFB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AAED,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAE/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAG1G;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAE/D"}
|
|
@@ -112,7 +112,15 @@ export function getCoordinationSignatureTypedData(signable) {
|
|
|
112
112
|
export function getHashedSignaturePayloadTypedData(signable) {
|
|
113
113
|
return Buffer32.fromString(hashTypedData(getCoordinationSignatureTypedData(signable)));
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Recovers the sender of a gossiped coordination message. Deliberately lenient (allowYParityAsV): a
|
|
117
|
+
* signature whose recovery byte is in yParity form (v ∈ {0, 1}) still resolves to its sender, so the P2P
|
|
118
|
+
* layer can attribute and accept it and then canonicalize on ingress (CheckpointAttestation.
|
|
119
|
+
* withNormalizedSignature, A-1351) before it reaches the L1 bundle. This is intentionally looser than
|
|
120
|
+
* on-chain checkpoint validation (getAttestationInfoFromPayload), which recovers strictly to mirror L1's
|
|
121
|
+
* ECDSA.recover — do not unify the two. These proposal/attestation signatures are P2P-only and never reach
|
|
122
|
+
* L1 verbatim, so leniency here cannot leak a non-canonical byte onto L1.
|
|
123
|
+
*/ export function recoverCoordinationSigner(signable, signature) {
|
|
116
124
|
const digest = getHashedSignaturePayloadTypedData(signable);
|
|
117
125
|
return tryRecoverAddress(digest, signature, {
|
|
118
126
|
allowYParityAsV: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "5.0.0-nightly.
|
|
3
|
+
"version": "5.0.0-nightly.20260708",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "5.0.0-nightly.
|
|
96
|
-
"@aztec/blob-lib": "5.0.0-nightly.
|
|
97
|
-
"@aztec/constants": "5.0.0-nightly.
|
|
98
|
-
"@aztec/ethereum": "5.0.0-nightly.
|
|
99
|
-
"@aztec/foundation": "5.0.0-nightly.
|
|
100
|
-
"@aztec/l1-artifacts": "5.0.0-nightly.
|
|
101
|
-
"@aztec/noir-noirc_abi": "5.0.0-nightly.
|
|
95
|
+
"@aztec/bb.js": "5.0.0-nightly.20260708",
|
|
96
|
+
"@aztec/blob-lib": "5.0.0-nightly.20260708",
|
|
97
|
+
"@aztec/constants": "5.0.0-nightly.20260708",
|
|
98
|
+
"@aztec/ethereum": "5.0.0-nightly.20260708",
|
|
99
|
+
"@aztec/foundation": "5.0.0-nightly.20260708",
|
|
100
|
+
"@aztec/l1-artifacts": "5.0.0-nightly.20260708",
|
|
101
|
+
"@aztec/noir-noirc_abi": "5.0.0-nightly.20260708",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.15.1",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -60,9 +60,14 @@ export function getAttestationInfoFromPayload(
|
|
|
60
60
|
return { address: attestation.address, status: 'provided-as-address' as const };
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Try to recover address from signature
|
|
63
|
+
// Try to recover address from signature. Recover with default opts (no allowYParityAsV): a slot
|
|
64
|
+
// whose recovery byte is in yParity form (v ∈ {0, 1}) is judged invalid here, matching L1 proving
|
|
65
|
+
// (ValidatorSelectionLib.verifyAttestations → ECDSA.recover only accepts v ∈ {27, 28}). A malicious
|
|
66
|
+
// proposer that lands such a slot cannot have it silently treated as valid off-chain; it is routed to
|
|
67
|
+
// invalid-attestation and invalidated. The gossip receipt path (recoverCoordinationSigner) stays
|
|
68
|
+
// lenient with allowYParityAsV; A-1351 normalizes on pool ingress and before the L1 bundle.
|
|
64
69
|
try {
|
|
65
|
-
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature
|
|
70
|
+
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
|
|
66
71
|
return { address: recoveredAddress, status: 'recovered-from-signature' as const };
|
|
67
72
|
} catch {
|
|
68
73
|
// Signature present but recovery failed
|
|
@@ -63,8 +63,18 @@ export type CheckpointQuery =
|
|
|
63
63
|
| { slot: SlotNumber }
|
|
64
64
|
| { tag: 'checkpointed' | 'proven' | 'finalized' };
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Query a range of confirmed checkpoints by start/limit, by slot anchor, or by epoch.
|
|
68
|
+
*
|
|
69
|
+
* The `fromSlot` variant walks the slot index: it returns up to `limit` checkpoints anchored at
|
|
70
|
+
* `fromSlot`, ordered nearest-first. With `reverse` it takes the checkpoints at or before the slot
|
|
71
|
+
* (descending); otherwise the checkpoints at or after it (ascending). Use `limit: 1, reverse: true`
|
|
72
|
+
* to find the latest checkpoint at or before a slot in a single range scan.
|
|
73
|
+
*/
|
|
74
|
+
export type CheckpointsQuery =
|
|
75
|
+
| { from: CheckpointNumber; limit: number }
|
|
76
|
+
| { fromSlot: SlotNumber; limit: number; reverse?: boolean }
|
|
77
|
+
| { epoch: EpochNumber };
|
|
68
78
|
|
|
69
79
|
/**
|
|
70
80
|
* Lookup a proposed (archiver-internal, not-yet-L1-confirmed) checkpoint.
|
|
@@ -81,6 +91,7 @@ export const CheckpointQuerySchema: z.ZodType<CheckpointQuery, unknown> = z.unio
|
|
|
81
91
|
|
|
82
92
|
export const CheckpointsQuerySchema: z.ZodType<CheckpointsQuery, unknown> = z.union([
|
|
83
93
|
z.object({ from: CheckpointNumberSchema, limit: z.number().int().min(1) }).strict(),
|
|
94
|
+
z.object({ fromSlot: SlotNumberSchema, limit: z.number().int().min(1), reverse: z.boolean().optional() }).strict(),
|
|
84
95
|
z.object({ epoch: EpochNumberSchema }).strict(),
|
|
85
96
|
]);
|
|
86
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViemCommitteeAttestations } from '@aztec/ethereum/contracts';
|
|
2
|
-
import { hexToBuffer } from '@aztec/foundation/string';
|
|
2
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
3
3
|
|
|
4
4
|
import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -157,3 +157,45 @@ export class MaliciousCommitteeAttestationsAndSigners extends CommitteeAttestati
|
|
|
157
157
|
return this.signers;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Malicious extension of CommitteeAttestationsAndSigners that rewrites every non-proposer signature slot's
|
|
163
|
+
* recovery byte to yParity form (v ∈ {0, 1}) in the packed output, after the honest `packAttestations` has
|
|
164
|
+
* already canonicalized it to v ∈ {27, 28}. Models a malicious selected proposer that hand-crafts
|
|
165
|
+
* `propose()` calldata L1 accepts but no honest node can byte-replay: each rewritten signature still
|
|
166
|
+
* recovers to the same member (r, s and the recovery parity are preserved), the bitmap bits stay set, and
|
|
167
|
+
* `getSigners()` stays consistent, so `propose()` does not revert `SignersSizeMismatch` -- yet the
|
|
168
|
+
* checkpoint can never be proven (`ECDSA.recover` rejects v ∉ {27, 28}). The proposer's own slot is left
|
|
169
|
+
* canonical so L1 `verifyProposer` (which recovers that slot) still accepts the checkpoint. For testing only.
|
|
170
|
+
*/
|
|
171
|
+
export class MaliciousYParityCommitteeAttestationsAndSigners extends CommitteeAttestationsAndSigners {
|
|
172
|
+
constructor(
|
|
173
|
+
attestations: CommitteeAttestation[],
|
|
174
|
+
/** Committee index of the proposer's own slot, left canonical so `propose()` passes `verifyProposer`. */
|
|
175
|
+
private proposerIndex: number,
|
|
176
|
+
signatureContext: CoordinationSignatureContext,
|
|
177
|
+
) {
|
|
178
|
+
super(attestations, signatureContext);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
override getPackedAttestations(): ViemCommitteeAttestations {
|
|
182
|
+
const packed = super.getPackedAttestations();
|
|
183
|
+
const data = hexToBuffer(packed.signaturesOrAddresses);
|
|
184
|
+
|
|
185
|
+
// Walk the packed byte-vector and rewrite every non-proposer signed slot's v-byte to yParity form. A
|
|
186
|
+
// signed slot occupies 65 bytes (v, r, s); an empty slot occupies 20 bytes (address only).
|
|
187
|
+
let offset = 0;
|
|
188
|
+
for (let i = 0; i < this.attestations.length; i++) {
|
|
189
|
+
const isSigned = !this.attestations[i].signature.isEmpty();
|
|
190
|
+
if (isSigned && i !== this.proposerIndex) {
|
|
191
|
+
// `packAttestations` canonicalized v to 27/28; rewrite back to the equivalent yParity byte (0/1),
|
|
192
|
+
// preserving the recovery parity so the signature still recovers to the same member.
|
|
193
|
+
const v = data[offset];
|
|
194
|
+
data[offset] = v >= 27 ? v - 27 : v;
|
|
195
|
+
}
|
|
196
|
+
offset += isSigned ? 65 : 20;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return { signatureIndices: packed.signatureIndices, signaturesOrAddresses: bufferToHex(data) };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ViemCommitteeAttestations } from '@aztec/ethereum/contracts';
|
|
1
2
|
import { EpochNumber, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
4
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
4
5
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
5
7
|
|
|
6
8
|
import { z } from 'zod';
|
|
7
9
|
|
|
@@ -30,6 +32,14 @@ export type ValidateCheckpointNegativeResult =
|
|
|
30
32
|
attestors: EthAddress[];
|
|
31
33
|
/** Committee attestations for this checkpoint as they were posted to L1 */
|
|
32
34
|
attestations: CommitteeAttestation[];
|
|
35
|
+
/**
|
|
36
|
+
* The exact packed `CommitteeAttestations` tuple as posted to L1 calldata, carried verbatim so the
|
|
37
|
+
* invalidation evidence is byte-faithful to the stored `attestationsHash`. A repack via
|
|
38
|
+
* `packAttestations` is not a round-trip inverse of `fromPacked`, so it would diverge from the hash
|
|
39
|
+
* and revert `invalidateBadAttestation`/`invalidateInsufficientAttestations`. Always populated on the
|
|
40
|
+
* calldata validation path, the only production source of invalidation evidence.
|
|
41
|
+
*/
|
|
42
|
+
verbatimAttestations: ViemCommitteeAttestations;
|
|
33
43
|
/** Reason for the checkpoint being invalid: not enough attestations were posted */
|
|
34
44
|
reason: 'insufficient-attestations';
|
|
35
45
|
}
|
|
@@ -47,6 +57,12 @@ export type ValidateCheckpointNegativeResult =
|
|
|
47
57
|
attestors: EthAddress[];
|
|
48
58
|
/** Committee attestations for this checkpoint as they were posted to L1 */
|
|
49
59
|
attestations: CommitteeAttestation[];
|
|
60
|
+
/**
|
|
61
|
+
* The exact packed `CommitteeAttestations` tuple as posted to L1 calldata, carried verbatim so the
|
|
62
|
+
* invalidation evidence is byte-faithful to the stored `attestationsHash`. See the same field on the
|
|
63
|
+
* insufficient-attestations variant for why a repack cannot be used.
|
|
64
|
+
*/
|
|
65
|
+
verbatimAttestations: ViemCommitteeAttestations;
|
|
50
66
|
/** Reason for the checkpoint being invalid: an invalid attestation was posted */
|
|
51
67
|
reason: 'invalid-attestation';
|
|
52
68
|
/** Index in the attestations array of the invalid attestation posted */
|
|
@@ -56,6 +72,12 @@ export type ValidateCheckpointNegativeResult =
|
|
|
56
72
|
/** Result type for validating checkpoint attestations */
|
|
57
73
|
export type ValidateCheckpointResult = { valid: true } | ValidateCheckpointNegativeResult;
|
|
58
74
|
|
|
75
|
+
/** Zod schema for the raw packed `CommitteeAttestations` viem tuple (two 0x-prefixed hex strings). */
|
|
76
|
+
const ViemCommitteeAttestationsSchema: ZodFor<ViemCommitteeAttestations> = z.object({
|
|
77
|
+
signatureIndices: schemas.HexStringWith0x,
|
|
78
|
+
signaturesOrAddresses: schemas.HexStringWith0x,
|
|
79
|
+
});
|
|
80
|
+
|
|
59
81
|
export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> = z.union([
|
|
60
82
|
z.object({ valid: z.literal(true) }),
|
|
61
83
|
z.object({
|
|
@@ -66,6 +88,7 @@ export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> =
|
|
|
66
88
|
seed: schemas.BigInt,
|
|
67
89
|
attestors: z.array(schemas.EthAddress),
|
|
68
90
|
attestations: z.array(CommitteeAttestation.schema),
|
|
91
|
+
verbatimAttestations: ViemCommitteeAttestationsSchema,
|
|
69
92
|
reason: z.literal('insufficient-attestations'),
|
|
70
93
|
}),
|
|
71
94
|
z.object({
|
|
@@ -76,6 +99,7 @@ export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> =
|
|
|
76
99
|
seed: schemas.BigInt,
|
|
77
100
|
attestors: z.array(schemas.EthAddress),
|
|
78
101
|
attestations: z.array(CommitteeAttestation.schema),
|
|
102
|
+
verbatimAttestations: ViemCommitteeAttestationsSchema,
|
|
79
103
|
reason: z.literal('invalid-attestation'),
|
|
80
104
|
invalidIndex: z.number(),
|
|
81
105
|
}),
|
|
@@ -87,6 +111,8 @@ export function serializeValidateCheckpointResult(result: ValidateCheckpointResu
|
|
|
87
111
|
}
|
|
88
112
|
|
|
89
113
|
const checkpointBuffer = serializeCheckpointInfo(result.checkpoint);
|
|
114
|
+
const signatureIndices = hexToBuffer(result.verbatimAttestations.signatureIndices);
|
|
115
|
+
const signaturesOrAddresses = hexToBuffer(result.verbatimAttestations.signaturesOrAddresses);
|
|
90
116
|
return serializeToBuffer(
|
|
91
117
|
result.valid,
|
|
92
118
|
result.reason,
|
|
@@ -101,6 +127,10 @@ export function serializeValidateCheckpointResult(result: ValidateCheckpointResu
|
|
|
101
127
|
result.attestations.length,
|
|
102
128
|
result.attestations,
|
|
103
129
|
result.reason === 'invalid-attestation' ? result.invalidIndex : 0,
|
|
130
|
+
signatureIndices.length,
|
|
131
|
+
signatureIndices,
|
|
132
|
+
signaturesOrAddresses.length,
|
|
133
|
+
signaturesOrAddresses,
|
|
104
134
|
);
|
|
105
135
|
}
|
|
106
136
|
|
|
@@ -118,10 +148,26 @@ export function deserializeValidateCheckpointResult(bufferOrReader: Buffer | Buf
|
|
|
118
148
|
const attestors = reader.readVector(EthAddress, MAX_COMMITTEE_SIZE);
|
|
119
149
|
const attestations = reader.readVector(CommitteeAttestation, MAX_COMMITTEE_SIZE);
|
|
120
150
|
const invalidIndex = reader.readNumber();
|
|
151
|
+
const verbatimAttestations: ViemCommitteeAttestations = {
|
|
152
|
+
signatureIndices: bufferToHex(reader.readBuffer()),
|
|
153
|
+
signaturesOrAddresses: bufferToHex(reader.readBuffer()),
|
|
154
|
+
};
|
|
155
|
+
|
|
121
156
|
if (reason === 'insufficient-attestations') {
|
|
122
|
-
return { valid, reason, checkpoint, committee, epoch, seed, attestors, attestations };
|
|
157
|
+
return { valid, reason, checkpoint, committee, epoch, seed, attestors, attestations, verbatimAttestations };
|
|
123
158
|
} else if (reason === 'invalid-attestation') {
|
|
124
|
-
return {
|
|
159
|
+
return {
|
|
160
|
+
valid,
|
|
161
|
+
reason,
|
|
162
|
+
checkpoint,
|
|
163
|
+
committee,
|
|
164
|
+
epoch,
|
|
165
|
+
seed,
|
|
166
|
+
attestors,
|
|
167
|
+
invalidIndex,
|
|
168
|
+
attestations,
|
|
169
|
+
verbatimAttestations,
|
|
170
|
+
};
|
|
125
171
|
} else {
|
|
126
172
|
const _: never = reason;
|
|
127
173
|
throw new Error(`Unknown reason: ${reason}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type L1ContractsConfig, l1ContractsConfigMappings } from '@aztec/ethereum/config';
|
|
1
|
+
import { type L1ContractsConfig, l1ContractsConfigMappings, validateSlotDurations } from '@aztec/ethereum/config';
|
|
2
2
|
import { type EnvVar, pickConfigMappings } from '@aztec/foundation/config';
|
|
3
3
|
|
|
4
4
|
import type { SequencerConfig } from '../interfaces/configs.js';
|
|
@@ -156,21 +156,10 @@ export function validateNetworkConsensusConfig(config: NetworkConsensusConfig):
|
|
|
156
156
|
return errors;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
errors.push(`ethereumSlotDuration must be positive (got ${config.ethereumSlotDuration})`);
|
|
161
|
-
}
|
|
159
|
+
errors.push(...validateSlotDurations(config));
|
|
162
160
|
if (config.blockDurationMs <= 0) {
|
|
163
161
|
errors.push(`blockDurationMs must be positive (got ${config.blockDurationMs})`);
|
|
164
162
|
}
|
|
165
|
-
if (config.aztecSlotDuration <= 0) {
|
|
166
|
-
errors.push(`aztecSlotDuration must be positive (got ${config.aztecSlotDuration})`);
|
|
167
|
-
}
|
|
168
|
-
if (config.ethereumSlotDuration > 0 && config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
169
|
-
errors.push(
|
|
170
|
-
`aztecSlotDuration (${config.aztecSlotDuration}s) must be a multiple of ethereumSlotDuration ` +
|
|
171
|
-
`(${config.ethereumSlotDuration}s)`,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
163
|
if (config.blockDurationMs / 1000 > config.aztecSlotDuration) {
|
|
175
164
|
errors.push(
|
|
176
165
|
`blockDurationMs (${config.blockDurationMs}ms) exceeds aztecSlotDuration (${config.aztecSlotDuration}s)`,
|