@aztec/stdlib 5.0.0-rc.2 → 5.0.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/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 +34 -3
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +16 -2
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +21 -35
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +5 -30
- 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 +47 -7
- 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/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- 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/hash/hash.d.ts +1 -2
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -7
- package/dest/interfaces/archiver.d.ts +8 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -1
- 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/private_kernel_prover.d.ts +9 -11
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +87 -74
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +13 -4
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- 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/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/index.d.ts +2 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/keys/derivation.d.ts +41 -6
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +49 -26
- package/dest/logs/app_tagging_secret.d.ts +16 -8
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +24 -27
- 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 +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/messaging/l1_to_l2_message.d.ts +23 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +36 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +9 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- 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/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +4 -3
- package/dest/tx/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/world-state/genesis_data.d.ts +9 -1
- package/dest/world-state/genesis_data.d.ts.map +1 -1
- package/dest/world-state/genesis_data.js +1 -0
- package/package.json +8 -8
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +54 -2
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +35 -1
- package/src/block/l2_block_stream/l2_block_stream.ts +35 -62
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/validate_block_result.ts +48 -2
- package/src/config/network-consensus-config.ts +2 -13
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/partial_address.ts +8 -2
- 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/hash/hash.ts +0 -8
- package/src/interfaces/archiver.ts +8 -0
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/private_kernel_prover.ts +10 -12
- package/src/interfaces/proving-job.ts +15 -3
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/index.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/keys/derivation.ts +69 -24
- package/src/logs/app_tagging_secret.ts +34 -27
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/messaging/l1_to_l2_message.ts +51 -13
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +3 -6
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/world-state/genesis_data.ts +10 -0
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- 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/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/logs/message_context.ts +0 -18
- package/src/logs/pending_tagged_log.ts +0 -12
|
@@ -9,6 +9,7 @@ import { AztecAddress } from '../aztec-address/index.js';
|
|
|
9
9
|
import type { CompleteAddress } from '../contract/complete_address.js';
|
|
10
10
|
import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
|
|
11
11
|
import { AppTaggingSecretKind } from './app_tagging_secret_kind.js';
|
|
12
|
+
import { appSiloEcdhSharedSecretPoint } from './shared_secret_derivation.js';
|
|
12
13
|
|
|
13
14
|
const AppTaggingSecretKindSchema = z.union([
|
|
14
15
|
z.literal(AppTaggingSecretKind.UNCONSTRAINED),
|
|
@@ -32,32 +33,47 @@ export class AppTaggingSecret {
|
|
|
32
33
|
/**
|
|
33
34
|
* Derives an app-siloed, recipient-directional tagging secret from a shared tagging secret point.
|
|
34
35
|
*
|
|
36
|
+
* App-silos the point via {@link appSiloEcdhSharedSecretPoint}, then directs the result to `recipient`:
|
|
37
|
+
* `h([s_app, recipient])`. The directional step stops a symmetric shared secret (ECDH against an address, or an
|
|
38
|
+
* arbitrary registered point) from colliding bidirectionally, so two parties never share a tag sequence.
|
|
39
|
+
*
|
|
35
40
|
* The point is obtained either via {@link computeSharedTaggingSecret} (an ECDH key exchange against a sender) or
|
|
36
|
-
* registered directly as a pre-shared secret.
|
|
37
|
-
* pair.
|
|
41
|
+
* registered directly as a pre-shared secret.
|
|
38
42
|
*
|
|
39
43
|
* @param taggingSecretPoint - The shared tagging secret point (ECDH output, or a directly registered pre-shared secret)
|
|
40
44
|
* @param app - Contract address to silo the secret to
|
|
41
45
|
* @param recipient - Recipient of the log. Defines the "direction of the secret".
|
|
42
46
|
* @returns The secret that can be used along with an index to compute a tag to be included in a log.
|
|
43
47
|
*/
|
|
44
|
-
static async
|
|
48
|
+
static async computeDirectional(
|
|
45
49
|
taggingSecretPoint: Point,
|
|
46
50
|
app: AztecAddress,
|
|
47
51
|
recipient: AztecAddress,
|
|
48
52
|
): Promise<AppTaggingSecret> {
|
|
49
|
-
const
|
|
50
|
-
const directionalAppTaggingSecret = await poseidon2Hash([
|
|
53
|
+
const appSiloedSecret = await appSiloEcdhSharedSecretPoint(taggingSecretPoint, app);
|
|
54
|
+
const directionalAppTaggingSecret = await poseidon2Hash([appSiloedSecret, recipient]);
|
|
51
55
|
|
|
52
56
|
return new AppTaggingSecret(directionalAppTaggingSecret, app);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
/**
|
|
56
|
-
* Derives the
|
|
57
|
-
*
|
|
58
|
-
|
|
60
|
+
* Derives the bare app-siloed tagging secret from a shared secret point via {@link appSiloEcdhSharedSecretPoint},
|
|
61
|
+
* under the given delivery-mode kind.
|
|
62
|
+
*/
|
|
63
|
+
static async computeAppSiloed(
|
|
64
|
+
taggingSecretPoint: Point,
|
|
65
|
+
app: AztecAddress,
|
|
66
|
+
kind: AppTaggingSecretKind,
|
|
67
|
+
): Promise<AppTaggingSecret> {
|
|
68
|
+
return new AppTaggingSecret(await appSiloEcdhSharedSecretPoint(taggingSecretPoint, app), app, kind);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Derives the tagging secret for `(externalAddress, recipient, app)` by performing an ECDH key exchange against
|
|
73
|
+
* `externalAddress` to obtain the shared point, then siloing and directing it via {@link computeDirectional}.
|
|
74
|
+
* Returns undefined if `externalAddress` is not a valid address.
|
|
59
75
|
*/
|
|
60
|
-
static async
|
|
76
|
+
static async computeViaEcdh(
|
|
61
77
|
localAddress: CompleteAddress,
|
|
62
78
|
localIvsk: Fq,
|
|
63
79
|
externalAddress: AztecAddress,
|
|
@@ -69,33 +85,24 @@ export class AppTaggingSecret {
|
|
|
69
85
|
return undefined;
|
|
70
86
|
}
|
|
71
87
|
|
|
72
|
-
return AppTaggingSecret.
|
|
88
|
+
return AppTaggingSecret.computeDirectional(taggingSecretPoint, app, recipient);
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
toString(): string {
|
|
76
|
-
// TODO(F-680): Migrate stored tagging keys and remove the legacy unconstrained format.
|
|
77
|
-
if (this.kind === AppTaggingSecretKind.UNCONSTRAINED) {
|
|
78
|
-
return `${this.secret.toString()}:${this.app.toString()}`;
|
|
79
|
-
}
|
|
80
92
|
return `${this.kind}:${this.secret.toString()}:${this.app.toString()}`;
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
static fromString(str: string): AppTaggingSecret {
|
|
84
96
|
const parts = str.split(':');
|
|
85
|
-
if (parts.length
|
|
86
|
-
|
|
87
|
-
const [secretStr, appStr] = parts;
|
|
88
|
-
return new AppTaggingSecret(Fr.fromString(secretStr), AztecAddress.fromStringUnsafe(appStr));
|
|
89
|
-
}
|
|
90
|
-
if (parts.length === 3) {
|
|
91
|
-
const [kindStr, secretStr, appStr] = parts;
|
|
92
|
-
return new AppTaggingSecret(
|
|
93
|
-
Fr.fromString(secretStr),
|
|
94
|
-
AztecAddress.fromStringUnsafe(appStr),
|
|
95
|
-
appTaggingSecretKindFromString(kindStr),
|
|
96
|
-
);
|
|
97
|
+
if (parts.length !== 3) {
|
|
98
|
+
throw new Error(`Invalid AppTaggingSecret string: ${str}`);
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
const [kindStr, secretStr, appStr] = parts;
|
|
101
|
+
return new AppTaggingSecret(
|
|
102
|
+
Fr.fromString(secretStr),
|
|
103
|
+
AztecAddress.fromStringUnsafe(appStr),
|
|
104
|
+
appTaggingSecretKindFromString(kindStr),
|
|
105
|
+
);
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
package/src/logs/index.ts
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';
|
|
@@ -2,16 +2,28 @@ 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
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
|
6
6
|
|
|
7
7
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
8
8
|
import type { PublicKey } from '../keys/public_key.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Derives
|
|
11
|
+
* Derives the raw ECDH shared secret point `S = secretKey * publicKey`.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
|
|
13
|
+
* @throws If the publicKey is zero.
|
|
14
|
+
*/
|
|
15
|
+
export function deriveEcdhSharedSecretPoint(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point> {
|
|
16
|
+
if (publicKey.isZero()) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`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.`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return Grumpkin.mul(publicKey, secretKey);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Derives an app-siloed ECDH shared secret from keys: ECDHs `S = secretKey * publicKey` via
|
|
26
|
+
* {@link deriveEcdhSharedSecretPoint}, then app-silos it via {@link appSiloEcdhSharedSecretPoint}.
|
|
15
27
|
*
|
|
16
28
|
* @param secretKey - The secret key used to derive shared secret.
|
|
17
29
|
* @param publicKey - The public key used to derive shared secret.
|
|
@@ -19,19 +31,23 @@ import type { PublicKey } from '../keys/public_key.js';
|
|
|
19
31
|
* @returns The app-siloed shared secret as a Field.
|
|
20
32
|
* @throws If the publicKey is zero.
|
|
21
33
|
*/
|
|
22
|
-
export async function
|
|
34
|
+
export async function appSiloEcdhSharedSecret(
|
|
23
35
|
secretKey: GrumpkinScalar,
|
|
24
36
|
publicKey: PublicKey,
|
|
25
37
|
contractAddress: AztecAddress,
|
|
26
38
|
): Promise<Fr> {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
const rawSharedSecret = await deriveEcdhSharedSecretPoint(secretKey, publicKey);
|
|
40
|
+
return appSiloEcdhSharedSecretPoint(rawSharedSecret, contractAddress);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* App-silos a shared secret point: `s_app = h(DOM_SEP__APP_SILOED_ECDH_SHARED_SECRET, S.x, S.y, app)`.
|
|
45
|
+
*
|
|
46
|
+
* Mirrors `compute_app_siloed_shared_secret` in aztec-nr.
|
|
47
|
+
*
|
|
48
|
+
* @param point - The raw shared secret point `S`.
|
|
49
|
+
* @param app - The contract address to silo to.
|
|
50
|
+
*/
|
|
51
|
+
export function appSiloEcdhSharedSecretPoint(point: Point, app: AztecAddress): Promise<Fr> {
|
|
52
|
+
return poseidon2HashWithSeparator([point.x, point.y, app], DomainSeparator.APP_SILOED_ECDH_SHARED_SECRET);
|
|
37
53
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { DomainSeparator, type L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
2
3
|
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -7,7 +8,7 @@ import { SiblingPath } from '@aztec/foundation/trees';
|
|
|
7
8
|
|
|
8
9
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
9
10
|
import type { BlockParameter } from '../block/block_parameter.js';
|
|
10
|
-
import {
|
|
11
|
+
import { siloNullifier } from '../hash/hash.js';
|
|
11
12
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
12
13
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
13
14
|
import { L1Actor } from './l1_actor.js';
|
|
@@ -74,28 +75,65 @@ export class L1ToL2Message {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The unsiloed nullifier a message consumer derives, together with the contract address needed to silo it.
|
|
80
|
+
*/
|
|
81
|
+
export interface UnsiloedMessageNullifier {
|
|
82
|
+
contractAddress: AztecAddress;
|
|
83
|
+
nullifier: Fr;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Computes the unsiloed nullifier that the fee juice contract (and any consumer following the same scheme) derives when
|
|
88
|
+
* consuming an L1 to L2 message.
|
|
89
|
+
*
|
|
90
|
+
* This is not a general-purpose utility: other contracts may derive the secret hash and hence the nullifier
|
|
91
|
+
* differently. The result is unsiloed — callers silo it (with the consuming contract's address) before looking it up
|
|
92
|
+
* in the nullifier tree.
|
|
93
|
+
*/
|
|
94
|
+
export function computeFeeJuiceMessageNullifier(messageHash: Fr, secret: Fr): Promise<Fr> {
|
|
95
|
+
return poseidon2HashWithSeparator([messageHash, secret], DomainSeparator.MESSAGE_NULLIFIER);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Fetches the membership witness of an L1 to L2 message. When `unsiloedNullifier` is provided, the message is
|
|
100
|
+
* additionally required to be un-nullified.
|
|
101
|
+
*/
|
|
102
|
+
export async function getL1ToL2MessageWitness(
|
|
79
103
|
node: AztecNode,
|
|
80
|
-
contractAddress: AztecAddress,
|
|
81
104
|
messageHash: Fr,
|
|
82
|
-
|
|
105
|
+
unsiloedNullifier?: UnsiloedMessageNullifier,
|
|
83
106
|
referenceBlock: BlockParameter = 'latest',
|
|
84
107
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
// Both requests are dispatched before awaiting so they run concurrently.
|
|
109
|
+
const l1ToL2ResponsePromise = node.getL1ToL2MessageMembershipWitness(referenceBlock, messageHash);
|
|
110
|
+
const nullifierResponsePromise = unsiloedNullifier
|
|
111
|
+
? siloNullifier(unsiloedNullifier.contractAddress, unsiloedNullifier.nullifier).then(siloed =>
|
|
112
|
+
node.findLeavesIndexes(referenceBlock, MerkleTreeId.NULLIFIER_TREE, [siloed]),
|
|
113
|
+
)
|
|
114
|
+
: undefined;
|
|
91
115
|
|
|
116
|
+
const l1ToL2Response = await l1ToL2ResponsePromise;
|
|
92
117
|
if (!l1ToL2Response) {
|
|
93
118
|
throw new Error(`No L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
94
119
|
}
|
|
95
120
|
|
|
96
|
-
|
|
121
|
+
const nullifierResponse = await nullifierResponsePromise;
|
|
122
|
+
if (nullifierResponse?.[0] !== undefined) {
|
|
97
123
|
throw new Error(`No non-nullified L1 to L2 message found for message hash ${messageHash.toString()}`);
|
|
98
124
|
}
|
|
99
125
|
|
|
100
126
|
return l1ToL2Response;
|
|
101
127
|
}
|
|
128
|
+
|
|
129
|
+
// This functionality is not on the node because we do not want to pass the node the secret, and give the node the ability to derive a valid nullifer for an L1 to L2 message.
|
|
130
|
+
export async function getNonNullifiedL1ToL2MessageWitness(
|
|
131
|
+
node: AztecNode,
|
|
132
|
+
contractAddress: AztecAddress,
|
|
133
|
+
messageHash: Fr,
|
|
134
|
+
secret: Fr,
|
|
135
|
+
referenceBlock: BlockParameter = 'latest',
|
|
136
|
+
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
|
|
137
|
+
const nullifier = await computeFeeJuiceMessageNullifier(messageHash, secret);
|
|
138
|
+
return getL1ToL2MessageWitness(node, messageHash, { contractAddress, nullifier }, referenceBlock);
|
|
139
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeSignature } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
1
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
|
|
3
4
|
import { CommitteeAttestation } from '../block/index.js';
|
|
@@ -18,9 +19,15 @@ export function orderAttestations(
|
|
|
18
19
|
for (const attestation of attestations) {
|
|
19
20
|
const sender = attestation.getSender();
|
|
20
21
|
if (sender) {
|
|
22
|
+
// Canonicalize the recovery byte to v ∈ {27, 28} before it reaches the L1 bundle. A committee
|
|
23
|
+
// member (or a peer mutating the byte in flight) can emit an equivalent signature in yParity form
|
|
24
|
+
// (v = 0/1); left as-is it makes `packAttestations` (empty iff v === 0) and `getSigners` (empty iff
|
|
25
|
+
// r,s,v all zero) disagree, reverting `propose()` with SignersSizeMismatch, and a v = 1 byte would
|
|
26
|
+
// later revert epoch proving in ECDSA.recover. `sender` recovered, so the signature is non-empty
|
|
27
|
+
// and low-s, and normalizeSignature preserves the recovered address.
|
|
21
28
|
attestationMap.set(
|
|
22
29
|
sender.toString(),
|
|
23
|
-
CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature),
|
|
30
|
+
CommitteeAttestation.fromAddressAndSignature(sender, normalizeSignature(attestation.signature)),
|
|
24
31
|
);
|
|
25
32
|
}
|
|
26
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CheckpointProposalHash, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { type BaseBuffer32, Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { normalizeSignature } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
3
4
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -97,6 +98,17 @@ export class CheckpointAttestation extends Gossipable {
|
|
|
97
98
|
return this.cachedProposer ?? undefined;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Returns a copy with the attester signature canonicalized to v ∈ {27, 28}. Callers store attestations
|
|
103
|
+
* received from gossip verbatim; normalizing on ingress keeps a signature emitted in yParity form
|
|
104
|
+
* (v = 0/1) — whether by a malicious committee member or a peer mutating the byte in flight — from
|
|
105
|
+
* reaching the L1 bundle in a non-canonical form. Must only be called once the signature has recovered
|
|
106
|
+
* a sender (so it is non-empty and low-s); `normalizeSignature` throws on an all-zero signature.
|
|
107
|
+
*/
|
|
108
|
+
withNormalizedSignature(): CheckpointAttestation {
|
|
109
|
+
return new CheckpointAttestation(this.payload, normalizeSignature(this.signature), this.proposerSignature);
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
getPayload(): Buffer {
|
|
101
113
|
return this.payload.getPayloadToSign();
|
|
102
114
|
}
|
|
@@ -112,6 +112,15 @@ export function getHashedSignaturePayloadTypedData(signable: Signable): Buffer32
|
|
|
112
112
|
return Buffer32.fromString(hashTypedData(getCoordinationSignatureTypedData(signable)));
|
|
113
113
|
}
|
|
114
114
|
|
|
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
|
+
*/
|
|
115
124
|
export function recoverCoordinationSigner(signable: Signable, signature: Signature): EthAddress | undefined {
|
|
116
125
|
const digest = getHashedSignaturePayloadTypedData(signable);
|
|
117
126
|
return tryRecoverAddress(digest, signature, { allowYParityAsV: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS } from '@aztec/constants';
|
|
2
2
|
|
|
3
3
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
4
4
|
import type { ProofDataForFixedVk } from '../proofs/proof_data.js';
|
|
5
5
|
|
|
6
|
-
export type AvmProofData = ProofDataForFixedVk<AvmCircuitPublicInputs, typeof
|
|
6
|
+
export type AvmProofData = ProofDataForFixedVk<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>;
|
package/src/stats/stats.ts
CHANGED
|
@@ -90,8 +90,8 @@ export type ClientCircuitName =
|
|
|
90
90
|
| 'private-kernel-inner-2'
|
|
91
91
|
| 'private-kernel-inner-3'
|
|
92
92
|
| 'private-kernel-reset'
|
|
93
|
-
| 'private-kernel-tail'
|
|
94
|
-
| 'private-kernel-tail-to-public'
|
|
93
|
+
| 'private-kernel-reset-tail'
|
|
94
|
+
| 'private-kernel-reset-tail-to-public'
|
|
95
95
|
| 'hiding-kernel-to-rollup'
|
|
96
96
|
| 'hiding-kernel-to-public'
|
|
97
97
|
| 'app-circuit';
|
package/src/tests/factories.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@aztec/blob-lib/testing';
|
|
7
7
|
import {
|
|
8
8
|
ARCHIVE_HEIGHT,
|
|
9
|
-
|
|
9
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS,
|
|
10
10
|
CHONK_PROOF_LENGTH,
|
|
11
11
|
CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
|
|
12
12
|
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
@@ -692,6 +692,7 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn
|
|
|
692
692
|
anchorBlockHeader: makeBlockHeader(seed + 0xd00),
|
|
693
693
|
txContext: makeTxContext(seed + 0x1400),
|
|
694
694
|
isFeePayer: false,
|
|
695
|
+
txRequestSalt: fr(seed + 0x1500),
|
|
695
696
|
});
|
|
696
697
|
}
|
|
697
698
|
|
|
@@ -1162,11 +1163,7 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
|
|
|
1162
1163
|
makePublicChonkVerifierPublicInputs,
|
|
1163
1164
|
RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
1164
1165
|
);
|
|
1165
|
-
const avmProofData = makeProofDataForFixedVk(
|
|
1166
|
-
seed + 0x100,
|
|
1167
|
-
makeAvmCircuitPublicInputs,
|
|
1168
|
-
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
1169
|
-
);
|
|
1166
|
+
const avmProofData = makeProofDataForFixedVk(seed + 0x100, makeAvmCircuitPublicInputs, AVM_V2_PROOF_LENGTH_IN_FIELDS);
|
|
1170
1167
|
const hints = makePublicBaseRollupHints(seed + 0x200);
|
|
1171
1168
|
|
|
1172
1169
|
return PublicTxBaseRollupPrivateInputs.from({
|
|
@@ -23,6 +23,14 @@ export class PrivateTxConstantData {
|
|
|
23
23
|
* protocol to execute and prove the transaction.
|
|
24
24
|
*/
|
|
25
25
|
public txContext: TxContext,
|
|
26
|
+
/**
|
|
27
|
+
* Salt of the transaction request (`TxRequest.salt`).
|
|
28
|
+
*
|
|
29
|
+
* Bound to the user's `tx_request` by the Init circuit and kept constant by every subsequent kernel so that each
|
|
30
|
+
* app circuit's `txRequestSalt` public input can be checked against it. It is intentionally not carried into
|
|
31
|
+
* `TxConstantData`: it is dropped by the Tail circuits rather than being exposed by the final (hiding) kernel.
|
|
32
|
+
*/
|
|
33
|
+
public txRequestSalt: Fr,
|
|
26
34
|
/**
|
|
27
35
|
* Root of the vk tree for the protocol circuits.
|
|
28
36
|
*/
|
|
@@ -38,7 +46,13 @@ export class PrivateTxConstantData {
|
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
static getFields(fields: FieldsOf<PrivateTxConstantData>) {
|
|
41
|
-
return [
|
|
49
|
+
return [
|
|
50
|
+
fields.anchorBlockHeader,
|
|
51
|
+
fields.txContext,
|
|
52
|
+
fields.txRequestSalt,
|
|
53
|
+
fields.vkTreeRoot,
|
|
54
|
+
fields.protocolContracts,
|
|
55
|
+
] as const;
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
static fromFields(fields: Fr[] | FieldReader): PrivateTxConstantData {
|
|
@@ -47,6 +61,7 @@ export class PrivateTxConstantData {
|
|
|
47
61
|
reader.readObject(BlockHeader),
|
|
48
62
|
reader.readObject(TxContext),
|
|
49
63
|
reader.readField(),
|
|
64
|
+
reader.readField(),
|
|
50
65
|
reader.readObject(ProtocolContracts),
|
|
51
66
|
);
|
|
52
67
|
}
|
|
@@ -67,6 +82,7 @@ export class PrivateTxConstantData {
|
|
|
67
82
|
reader.readObject(BlockHeader),
|
|
68
83
|
reader.readObject(TxContext),
|
|
69
84
|
Fr.fromBuffer(reader),
|
|
85
|
+
Fr.fromBuffer(reader),
|
|
70
86
|
reader.readObject(ProtocolContracts),
|
|
71
87
|
);
|
|
72
88
|
}
|
|
@@ -76,13 +92,20 @@ export class PrivateTxConstantData {
|
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
static empty() {
|
|
79
|
-
return new PrivateTxConstantData(
|
|
95
|
+
return new PrivateTxConstantData(
|
|
96
|
+
BlockHeader.empty(),
|
|
97
|
+
TxContext.empty(),
|
|
98
|
+
Fr.ZERO,
|
|
99
|
+
Fr.ZERO,
|
|
100
|
+
ProtocolContracts.empty(),
|
|
101
|
+
);
|
|
80
102
|
}
|
|
81
103
|
|
|
82
104
|
getSize() {
|
|
83
105
|
return (
|
|
84
106
|
this.anchorBlockHeader.getSize() +
|
|
85
107
|
this.txContext.getSize() +
|
|
108
|
+
this.txRequestSalt.size +
|
|
86
109
|
this.vkTreeRoot.size +
|
|
87
110
|
this.protocolContracts.getSize()
|
|
88
111
|
);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
|
|
1
3
|
import type { PublicDataTreeLeaf } from '../trees/index.js';
|
|
2
4
|
|
|
3
5
|
/** Data used to initialize the genesis block, including prefilled public state and an optional timestamp. */
|
|
4
6
|
export type GenesisData = {
|
|
5
7
|
/** Public data tree leaves to pre-populate in the genesis state (e.g. fee juice balances). */
|
|
6
8
|
prefilledPublicData: PublicDataTreeLeaf[];
|
|
9
|
+
/**
|
|
10
|
+
* Nullifiers to pre-insert into the genesis nullifier tree. Optional; defaults to an empty list, which leaves the
|
|
11
|
+
* nullifier tree at its canonical empty-genesis state so that production genesis roots are unchanged. When non-empty,
|
|
12
|
+
* the leaves must be unique and strictly increasing in field value (the native world state enforces this before
|
|
13
|
+
* construction). Test networks pass a non-empty list to seed e.g. standard-contract registration nullifiers.
|
|
14
|
+
*/
|
|
15
|
+
prefilledNullifiers?: Fr[];
|
|
7
16
|
/** Timestamp for the genesis block header. Defaults to 0 (canonical empty genesis) in production. */
|
|
8
17
|
genesisTimestamp: bigint;
|
|
9
18
|
};
|
|
@@ -11,6 +20,7 @@ export type GenesisData = {
|
|
|
11
20
|
/** An empty genesis data with no prefilled state and a zero timestamp. */
|
|
12
21
|
export const EMPTY_GENESIS_DATA: GenesisData = {
|
|
13
22
|
prefilledPublicData: [],
|
|
23
|
+
prefilledNullifiers: [],
|
|
14
24
|
genesisTimestamp: 0n,
|
|
15
25
|
};
|
|
16
26
|
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
2
|
-
import type { UInt64 } from '../types/shared.js';
|
|
3
|
-
import { PaddedSideEffectAmounts } from './padded_side_effects.js';
|
|
4
|
-
import { PrivateKernelData } from './private_kernel_data.js';
|
|
5
|
-
/**
|
|
6
|
-
* Input to the private kernel circuit - tail call.
|
|
7
|
-
*/
|
|
8
|
-
export declare class PrivateKernelTailCircuitPrivateInputs {
|
|
9
|
-
/**
|
|
10
|
-
* The previous kernel data
|
|
11
|
-
*/
|
|
12
|
-
previousKernel: PrivateKernelData;
|
|
13
|
-
/**
|
|
14
|
-
* The number of the padded side effects.
|
|
15
|
-
*/
|
|
16
|
-
paddedSideEffectAmounts: PaddedSideEffectAmounts;
|
|
17
|
-
/**
|
|
18
|
-
* The timestamp by which the transaction must be included in a block.
|
|
19
|
-
*/
|
|
20
|
-
expirationTimestampUpperBound: UInt64;
|
|
21
|
-
constructor(
|
|
22
|
-
/**
|
|
23
|
-
* The previous kernel data
|
|
24
|
-
*/
|
|
25
|
-
previousKernel: PrivateKernelData,
|
|
26
|
-
/**
|
|
27
|
-
* The number of the padded side effects.
|
|
28
|
-
*/
|
|
29
|
-
paddedSideEffectAmounts: PaddedSideEffectAmounts,
|
|
30
|
-
/**
|
|
31
|
-
* The timestamp by which the transaction must be included in a block.
|
|
32
|
-
*/
|
|
33
|
-
expirationTimestampUpperBound: UInt64);
|
|
34
|
-
isForPublic(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Serialize this as a buffer.
|
|
37
|
-
* @returns The buffer.
|
|
38
|
-
*/
|
|
39
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
40
|
-
/**
|
|
41
|
-
* Deserializes from a buffer or reader.
|
|
42
|
-
* @param buffer - Buffer or reader to read from.
|
|
43
|
-
* @returns The deserialized instance.
|
|
44
|
-
*/
|
|
45
|
-
static fromBuffer(buffer: Buffer | BufferReader): PrivateKernelTailCircuitPrivateInputs;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfdGFpbF9jaXJjdWl0X3ByaXZhdGVfaW5wdXRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMva2VybmVsL3ByaXZhdGVfa2VybmVsX3RhaWxfY2lyY3VpdF9wcml2YXRlX2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUF1QyxNQUFNLDZCQUE2QixDQUFDO0FBRWhHLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2pELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ25FLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRTdEOztHQUVHO0FBQ0gscUJBQWEscUNBQXFDO0lBRTlDOztPQUVHO0lBQ0ksY0FBYyxFQUFFLGlCQUFpQjtJQUN4Qzs7T0FFRztJQUNJLHVCQUF1QixFQUFFLHVCQUF1QjtJQUN2RDs7T0FFRztJQUNJLDZCQUE2QixFQUFFLE1BQU07SUFaOUM7SUFDRTs7T0FFRztJQUNJLGNBQWMsRUFBRSxpQkFBaUI7SUFDeEM7O09BRUc7SUFDSSx1QkFBdUIsRUFBRSx1QkFBdUI7SUFDdkQ7O09BRUc7SUFDSSw2QkFBNkIsRUFBRSxNQUFNLEVBQzFDO0lBRUosV0FBVyxZQUtWO0lBRUQ7OztPQUdHO0lBQ0gsUUFBUSw0QkFNUDtJQUVEOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsWUFBWSxHQUFHLHFDQUFxQyxDQU90RjtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_tail_circuit_private_inputs.d.ts","sourceRoot":"","sources":["../../src/kernel/private_kernel_tail_circuit_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,6BAA6B,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;GAEG;AACH,qBAAa,qCAAqC;IAE9C;;OAEG;IACI,cAAc,EAAE,iBAAiB;IACxC;;OAEG;IACI,uBAAuB,EAAE,uBAAuB;IACvD;;OAEG;IACI,6BAA6B,EAAE,MAAM;IAZ9C;IACE;;OAEG;IACI,cAAc,EAAE,iBAAiB;IACxC;;OAEG;IACI,uBAAuB,EAAE,uBAAuB;IACvD;;OAEG;IACI,6BAA6B,EAAE,MAAM,EAC1C;IAEJ,WAAW,YAKV;IAED;;;OAGG;IACH,QAAQ,4BAMP;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,qCAAqC,CAOtF;CACF"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { BufferReader, bigintToUInt64BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
|
-
import { PaddedSideEffectAmounts } from './padded_side_effects.js';
|
|
3
|
-
import { PrivateKernelData } from './private_kernel_data.js';
|
|
4
|
-
/**
|
|
5
|
-
* Input to the private kernel circuit - tail call.
|
|
6
|
-
*/ export class PrivateKernelTailCircuitPrivateInputs {
|
|
7
|
-
previousKernel;
|
|
8
|
-
paddedSideEffectAmounts;
|
|
9
|
-
expirationTimestampUpperBound;
|
|
10
|
-
constructor(/**
|
|
11
|
-
* The previous kernel data
|
|
12
|
-
*/ previousKernel, /**
|
|
13
|
-
* The number of the padded side effects.
|
|
14
|
-
*/ paddedSideEffectAmounts, /**
|
|
15
|
-
* The timestamp by which the transaction must be included in a block.
|
|
16
|
-
*/ expirationTimestampUpperBound){
|
|
17
|
-
this.previousKernel = previousKernel;
|
|
18
|
-
this.paddedSideEffectAmounts = paddedSideEffectAmounts;
|
|
19
|
-
this.expirationTimestampUpperBound = expirationTimestampUpperBound;
|
|
20
|
-
}
|
|
21
|
-
isForPublic() {
|
|
22
|
-
return this.previousKernel.publicInputs.end.publicCallRequests.claimedLength > 0 || !this.previousKernel.publicInputs.publicTeardownCallRequest.isEmpty();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Serialize this as a buffer.
|
|
26
|
-
* @returns The buffer.
|
|
27
|
-
*/ toBuffer() {
|
|
28
|
-
return serializeToBuffer(this.previousKernel, this.paddedSideEffectAmounts, bigintToUInt64BE(this.expirationTimestampUpperBound));
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Deserializes from a buffer or reader.
|
|
32
|
-
* @param buffer - Buffer or reader to read from.
|
|
33
|
-
* @returns The deserialized instance.
|
|
34
|
-
*/ static fromBuffer(buffer) {
|
|
35
|
-
const reader = BufferReader.asReader(buffer);
|
|
36
|
-
return new PrivateKernelTailCircuitPrivateInputs(reader.readObject(PrivateKernelData), reader.readObject(PaddedSideEffectAmounts), reader.readUInt64());
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { TxHash } from '../tx/tx_hash.js';
|
|
3
|
-
/**
|
|
4
|
-
* Additional information needed to process a message.
|
|
5
|
-
*
|
|
6
|
-
* All messages exist in the context of a transaction, and information about that transaction is typically required
|
|
7
|
-
* in order to perform validation, store results, etc. For example, messages containing notes require knowledge of note
|
|
8
|
-
* hashes and the first nullifier in order to find the note's nonce.
|
|
9
|
-
*
|
|
10
|
-
* A TS version of `message_context.nr`.
|
|
11
|
-
*/
|
|
12
|
-
export type MessageContext = {
|
|
13
|
-
txHash: TxHash;
|
|
14
|
-
uniqueNoteHashesInTx: Fr[];
|
|
15
|
-
firstNullifierInTx: Fr;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9jb250ZXh0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9tZXNzYWdlX2NvbnRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFL0M7Ozs7Ozs7O0dBUUc7QUFDSCxNQUFNLE1BQU0sY0FBYyxHQUFHO0lBQzNCLE1BQU0sRUFBRSxNQUFNLENBQUM7SUFDZixvQkFBb0IsRUFBRSxFQUFFLEVBQUUsQ0FBQztJQUMzQixrQkFBa0IsRUFBRSxFQUFFLENBQUM7Q0FDeEIsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message_context.d.ts","sourceRoot":"","sources":["../../src/logs/message_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,EAAE,EAAE,CAAC;IAC3B,kBAAkB,EAAE,EAAE,CAAC;CACxB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Additional information needed to process a message.
|
|
3
|
-
*
|
|
4
|
-
* All messages exist in the context of a transaction, and information about that transaction is typically required
|
|
5
|
-
* in order to perform validation, store results, etc. For example, messages containing notes require knowledge of note
|
|
6
|
-
* hashes and the first nullifier in order to find the note's nonce.
|
|
7
|
-
*
|
|
8
|
-
* A TS version of `message_context.nr`.
|
|
9
|
-
*/ export { };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { MessageContext } from './message_context.js';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a pending tagged log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle
|
|
5
|
-
* inserts found private logs. A TS version of `pending_tagged_log.nr`.
|
|
6
|
-
*/
|
|
7
|
-
export type PendingTaggedLog = {
|
|
8
|
-
log: Fr[];
|
|
9
|
-
context: MessageContext;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGVuZGluZ190YWdnZWRfbG9nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbG9ncy9wZW5kaW5nX3RhZ2dlZF9sb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFM0Q7OztHQUdHO0FBQ0gsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQzdCLEdBQUcsRUFBRSxFQUFFLEVBQUUsQ0FBQztJQUNWLE9BQU8sRUFBRSxjQUFjLENBQUM7Q0FDekIsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pending_tagged_log.d.ts","sourceRoot":"","sources":["../../src/logs/pending_tagged_log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,EAAE,EAAE,CAAC;IACV,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC"}
|