@aztec/stdlib 4.0.0-devnet.2-patch.4 → 4.0.0-devnet.3-patch.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/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +6 -45
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +17 -70
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +37 -6
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/function_selector.js +1 -1
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/avm/avm_accumulated_data.js +2 -2
- package/dest/avm/avm_circuit_public_inputs.js +2 -2
- package/dest/avm/avm_proving_request.d.ts +166 -166
- package/dest/avm/revert_code.d.ts +16 -1
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -5
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +16 -8
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -4
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/sequencer-config.d.ts +2 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +11 -0
- package/dest/epoch-helpers/index.d.ts +9 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +13 -2
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +4 -1
- package/dest/hash/hash.d.ts +19 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +29 -0
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +67 -27
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +12 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +5 -2
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +13 -6
- package/dest/interfaces/configs.d.ts +67 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +7 -2
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +3 -8
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/validator.d.ts +67 -25
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +6 -2
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/claimed_length_array.js +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/padded_side_effects.js +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kernel/private_to_avm_accumulated_data.js +2 -2
- package/dest/kernel/private_to_public_accumulated_data.js +2 -2
- package/dest/kernel/private_to_rollup_accumulated_data.js +1 -1
- package/dest/logs/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +35 -20
- package/dest/logs/index.d.ts +4 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +3 -1
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/pre_tag.d.ts +16 -11
- package/dest/logs/pre_tag.d.ts.map +1 -1
- package/dest/logs/pre_tag.js +2 -2
- package/dest/logs/private_log.js +1 -1
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +9 -2
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +8 -3
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +11 -2
- package/dest/logs/tag.js +1 -1
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/checkpoint_proposal.d.ts +1 -6
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +13 -23
- package/dest/p2p/client_type.d.ts +2 -5
- package/dest/p2p/client_type.d.ts.map +1 -1
- package/dest/p2p/client_type.js +0 -7
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/p2p/topic_type.d.ts +3 -4
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +7 -24
- package/dest/parity/parity_base_private_inputs.js +1 -1
- package/dest/proofs/chonk_proof.d.ts +1 -1
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +7 -1
- package/dest/rollup/base_rollup_hints.js +2 -2
- package/dest/rollup/block_root_rollup_private_inputs.js +5 -5
- package/dest/rollup/checkpoint_rollup_public_inputs.js +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +3 -3
- package/dest/rollup/root_rollup_public_inputs.js +1 -1
- package/dest/rollup/tree_snapshot_diff_hints.js +2 -2
- package/dest/slashing/tally.d.ts +7 -2
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +30 -2
- package/dest/tests/factories.d.ts +3 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +8 -0
- package/dest/tests/mocks.d.ts +5 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +18 -13
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +17 -5
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +15 -5
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/public_simulation_output.d.ts +4 -2
- package/dest/tx/public_simulation_output.d.ts.map +1 -1
- package/dest/tx/public_simulation_output.js +7 -3
- package/dest/tx/simulated_tx.d.ts +5 -2
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +4 -1
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +22 -3
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +15 -4
- package/dest/tx/validator/error_texts.d.ts +9 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +10 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/dest/vks/vk_data.js +1 -1
- package/package.json +10 -10
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +36 -82
- package/src/abi/encoder.ts +49 -6
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/function_selector.ts +1 -1
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/abi/utils.ts +25 -0
- package/src/avm/avm_accumulated_data.ts +6 -6
- package/src/avm/avm_circuit_public_inputs.ts +4 -4
- package/src/avm/revert_code.ts +15 -0
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +16 -7
- package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
- package/src/checkpoint/checkpoint.ts +12 -3
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/sequencer-config.ts +16 -1
- package/src/epoch-helpers/index.ts +22 -0
- package/src/gas/README.md +123 -0
- package/src/gas/gas_fees.ts +7 -1
- package/src/hash/hash.ts +34 -0
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +3 -2
- package/src/interfaces/aztec-node.ts +24 -5
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/configs.ts +29 -8
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/p2p.ts +2 -13
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/validator.ts +18 -2
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/claimed_length_array.ts +2 -2
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/kernel/hints/private_kernel_reset_hints.ts +5 -2
- package/src/kernel/hints/read_request_hints.ts +3 -3
- package/src/kernel/padded_side_effects.ts +3 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_to_avm_accumulated_data.ts +4 -4
- package/src/kernel/private_to_public_accumulated_data.ts +10 -10
- package/src/kernel/private_to_rollup_accumulated_data.ts +5 -5
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +41 -22
- package/src/logs/index.ts +3 -1
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/pre_tag.ts +5 -5
- package/src/logs/private_log.ts +1 -1
- package/src/logs/public_log.ts +15 -3
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +14 -3
- package/src/logs/tag.ts +1 -1
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/note/note_dao.ts +1 -4
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/checkpoint_proposal.ts +23 -37
- package/src/p2p/client_type.ts +0 -6
- package/src/p2p/index.ts +0 -1
- package/src/p2p/peer_error.ts +7 -0
- package/src/p2p/topic_type.ts +8 -15
- package/src/parity/parity_base_private_inputs.ts +1 -1
- package/src/proofs/chonk_proof.ts +9 -1
- package/src/rollup/base_rollup_hints.ts +2 -2
- package/src/rollup/block_root_rollup_private_inputs.ts +8 -8
- package/src/rollup/checkpoint_rollup_public_inputs.ts +2 -2
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +4 -4
- package/src/rollup/root_rollup_public_inputs.ts +2 -2
- package/src/rollup/tree_snapshot_diff_hints.ts +5 -5
- package/src/slashing/tally.ts +34 -1
- package/src/tests/factories.ts +9 -0
- package/src/tests/mocks.ts +25 -10
- package/src/tx/block_header.ts +6 -0
- package/src/tx/capsule.ts +10 -2
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +14 -5
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/simulated_tx.ts +8 -1
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +17 -2
- package/src/tx/validator/error_texts.ts +12 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/src/vks/vk_data.ts +1 -1
- package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
- package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -23,6 +23,8 @@ export type ActualProverConfig = {
|
|
|
23
23
|
* When true, jobs are explicitly cancelled with the broker, which prevents reuse.
|
|
24
24
|
*/
|
|
25
25
|
cancelJobsOnStop: boolean;
|
|
26
|
+
/** Max concurrent jobs the orchestrator serializes and enqueues to the broker. */
|
|
27
|
+
enqueueConcurrency: number;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -53,6 +55,7 @@ export const ProverConfigSchema = zodFor<ProverConfig>()(
|
|
|
53
55
|
proofStore: z.string().optional(),
|
|
54
56
|
failedProofStore: z.string().optional(),
|
|
55
57
|
cancelJobsOnStop: z.boolean(),
|
|
58
|
+
enqueueConcurrency: z.number(),
|
|
56
59
|
}),
|
|
57
60
|
);
|
|
58
61
|
|
|
@@ -107,6 +110,11 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
|
|
|
107
110
|
'When true, jobs are explicitly cancelled with the broker, which prevents reuse.',
|
|
108
111
|
...booleanConfigHelper(false),
|
|
109
112
|
},
|
|
113
|
+
enqueueConcurrency: {
|
|
114
|
+
env: 'PROVER_ENQUEUE_CONCURRENCY',
|
|
115
|
+
description: 'Max concurrent jobs the orchestrator serializes and enqueues to the broker.',
|
|
116
|
+
...numberConfigHelper(50),
|
|
117
|
+
},
|
|
110
118
|
};
|
|
111
119
|
|
|
112
120
|
function parseProverId(str?: string) {
|
|
@@ -59,10 +59,22 @@ export type ValidatorClientConfig = ValidatorHASignerConfig & {
|
|
|
59
59
|
|
|
60
60
|
/** Agree to attest to equivocated checkpoint proposals (for testing purposes only) */
|
|
61
61
|
attestToEquivocatedProposals?: boolean;
|
|
62
|
+
|
|
63
|
+
/** Maximum L2 gas per block for validation. Proposals exceeding this limit are rejected. */
|
|
64
|
+
validateMaxL2BlockGas?: number;
|
|
65
|
+
|
|
66
|
+
/** Maximum DA gas per block for validation. Proposals exceeding this limit are rejected. */
|
|
67
|
+
validateMaxDABlockGas?: number;
|
|
68
|
+
|
|
69
|
+
/** Maximum transactions per block for validation. Proposals exceeding this limit are rejected. */
|
|
70
|
+
validateMaxTxsPerBlock?: number;
|
|
71
|
+
|
|
72
|
+
/** Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected. */
|
|
73
|
+
validateMaxTxsPerCheckpoint?: number;
|
|
62
74
|
};
|
|
63
75
|
|
|
64
76
|
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
65
|
-
Pick<SequencerConfig, '
|
|
77
|
+
Pick<SequencerConfig, 'txPublicSetupAllowListExtend' | 'broadcastInvalidBlockProposal'> &
|
|
66
78
|
Pick<
|
|
67
79
|
SlasherConfig,
|
|
68
80
|
'slashBroadcastedInvalidBlockPenalty' | 'slashDuplicateProposalPenalty' | 'slashDuplicateAttestationPenalty'
|
|
@@ -86,12 +98,16 @@ export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'v
|
|
|
86
98
|
skipCheckpointProposalValidation: z.boolean().optional(),
|
|
87
99
|
skipPushProposedBlocksToArchiver: z.boolean().optional(),
|
|
88
100
|
attestToEquivocatedProposals: z.boolean().optional(),
|
|
101
|
+
validateMaxL2BlockGas: z.number().optional(),
|
|
102
|
+
validateMaxDABlockGas: z.number().optional(),
|
|
103
|
+
validateMaxTxsPerBlock: z.number().optional(),
|
|
104
|
+
validateMaxTxsPerCheckpoint: z.number().optional(),
|
|
89
105
|
}),
|
|
90
106
|
);
|
|
91
107
|
|
|
92
108
|
export const ValidatorClientFullConfigSchema = zodFor<Omit<ValidatorClientFullConfig, 'validatorPrivateKeys'>>()(
|
|
93
109
|
ValidatorClientConfigSchema.extend({
|
|
94
|
-
|
|
110
|
+
txPublicSetupAllowListExtend: z.array(AllowedElementSchema).optional(),
|
|
95
111
|
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
96
112
|
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
97
113
|
slashDuplicateProposalPenalty: schemas.BigInt,
|
|
@@ -3,6 +3,7 @@ import type { PromiseWithResolvers } from '@aztec/foundation/promise';
|
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
+
import type { BlockHash } from '../block/block_hash.js';
|
|
6
7
|
import type { SnapshotDataKeys } from '../snapshots/types.js';
|
|
7
8
|
import type { MerkleTreeReadOperations, MerkleTreeWriteOperations } from './merkle_tree_operations.js';
|
|
8
9
|
|
|
@@ -80,12 +81,12 @@ export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMe
|
|
|
80
81
|
resumeSync(): void;
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
|
-
* Forces an immediate sync to an optionally provided minimum block number
|
|
84
|
+
* Forces an immediate sync to an optionally provided minimum block number.
|
|
84
85
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
85
|
-
* @param
|
|
86
|
+
* @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash. On mismatch, triggers a resync (reorg detection).
|
|
86
87
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
87
88
|
*/
|
|
88
|
-
syncImmediate(minBlockNumber?: BlockNumber,
|
|
89
|
+
syncImmediate(minBlockNumber?: BlockNumber, blockHash?: BlockHash): Promise<BlockNumber>;
|
|
89
90
|
|
|
90
91
|
/** Deletes the db */
|
|
91
92
|
clear(): Promise<void>;
|
|
@@ -25,7 +25,7 @@ export class ClaimedLengthArray<T extends Serializable, N extends number> {
|
|
|
25
25
|
arrayLength: N,
|
|
26
26
|
): ClaimedLengthArray<T, N> {
|
|
27
27
|
const reader = BufferReader.asReader(buffer);
|
|
28
|
-
const array = reader.readArray(arrayLength, deserializer)
|
|
28
|
+
const array = reader.readArray(arrayLength, deserializer) as Tuple<T, N>;
|
|
29
29
|
const claimedLength = reader.readNumber();
|
|
30
30
|
return new ClaimedLengthArray(array, claimedLength);
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ export class ClaimedLengthArray<T extends Serializable, N extends number> {
|
|
|
42
42
|
arrayLength: N,
|
|
43
43
|
): ClaimedLengthArray<T, N> {
|
|
44
44
|
const reader = FieldReader.asReader(fields);
|
|
45
|
-
const array = reader.
|
|
45
|
+
const array = reader.readTuple(arrayLength, deserializer);
|
|
46
46
|
const claimedLength = reader.readU32();
|
|
47
47
|
return new ClaimedLengthArray(array, claimedLength);
|
|
48
48
|
}
|
|
@@ -11,7 +11,6 @@ import type { ScopedNoteHash } from '../note_hash.js';
|
|
|
11
11
|
import { NoteHashReadRequestHintsBuilder } from './note_hash_read_request_hints.js';
|
|
12
12
|
import type { ScopedReadRequest } from './read_request.js';
|
|
13
13
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
14
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
15
14
|
|
|
16
15
|
export function isValidNoteHashReadRequest(readRequest: ScopedReadRequest, noteHash: ScopedNoteHash) {
|
|
17
16
|
return (
|
|
@@ -24,7 +23,6 @@ export function isValidNoteHashReadRequest(readRequest: ScopedReadRequest, noteH
|
|
|
24
23
|
export function getNoteHashReadRequestResetActions(
|
|
25
24
|
noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
|
|
26
25
|
noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
27
|
-
futureNoteHashes: ScopedNoteHash[],
|
|
28
26
|
): ReadRequestResetActions<typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX> {
|
|
29
27
|
const resetActions = ReadRequestResetActions.empty(MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
|
|
30
28
|
|
|
@@ -36,24 +34,23 @@ export function getNoteHashReadRequestResetActions(
|
|
|
36
34
|
noteHashMap.set(value, arr);
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
const futureNoteHashMap = new ScopedValueCache(futureNoteHashes);
|
|
40
|
-
|
|
41
37
|
for (let i = 0; i < noteHashReadRequests.claimedLength; ++i) {
|
|
42
38
|
const readRequest = noteHashReadRequests.array[i];
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
?.find(n => isValidNoteHashReadRequest(readRequest, n.noteHash));
|
|
47
|
-
|
|
48
|
-
if (pendingNoteHash !== undefined) {
|
|
49
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
50
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
51
|
-
} else if (
|
|
52
|
-
!futureNoteHashMap
|
|
53
|
-
.get(readRequest)
|
|
54
|
-
.find(futureNoteHash => isValidNoteHashReadRequest(readRequest, futureNoteHash))
|
|
55
|
-
) {
|
|
40
|
+
if (readRequest.contractAddress.isZero()) {
|
|
41
|
+
// Settled read: empty contract address means resolve against the note hash tree.
|
|
56
42
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
43
|
+
} else {
|
|
44
|
+
// Pending read: non-empty contract address means match against a pending note hash.
|
|
45
|
+
const pendingNoteHash = noteHashMap
|
|
46
|
+
.get(readRequest.value.toBigInt())
|
|
47
|
+
?.find(n => isValidNoteHashReadRequest(readRequest, n.noteHash));
|
|
48
|
+
|
|
49
|
+
if (pendingNoteHash) {
|
|
50
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
51
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNoteHash.index));
|
|
52
|
+
}
|
|
53
|
+
// Otherwise, the read request may be resolved by a future note hash. Leave as NOOP.
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
|
|
@@ -115,11 +112,10 @@ export async function buildNoteHashReadRequestHints<PENDING extends number, SETT
|
|
|
115
112
|
},
|
|
116
113
|
noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
|
|
117
114
|
noteHashes: ClaimedLengthArray<ScopedNoteHash, typeof MAX_NOTE_HASHES_PER_TX>,
|
|
118
|
-
futureNoteHashes: ScopedNoteHash[],
|
|
119
115
|
maxPending: PENDING = MAX_NOTE_HASH_READ_REQUESTS_PER_TX as PENDING,
|
|
120
116
|
maxSettled: SETTLED = MAX_NOTE_HASH_READ_REQUESTS_PER_TX as SETTLED,
|
|
121
117
|
) {
|
|
122
|
-
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes
|
|
118
|
+
const resetActions = getNoteHashReadRequestResetActions(noteHashReadRequests, noteHashes);
|
|
123
119
|
return await buildNoteHashReadRequestHintsFromResetActions(
|
|
124
120
|
oracle,
|
|
125
121
|
noteHashReadRequests,
|
|
@@ -12,7 +12,6 @@ import type { ScopedNullifier } from '../nullifier.js';
|
|
|
12
12
|
import { NullifierReadRequestHintsBuilder } from './nullifier_read_request_hints.js';
|
|
13
13
|
import { ScopedReadRequest } from './read_request.js';
|
|
14
14
|
import { PendingReadHint, ReadRequestActionEnum, ReadRequestResetActions } from './read_request_hints.js';
|
|
15
|
-
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
16
15
|
|
|
17
16
|
export function isValidNullifierReadRequest(readRequest: ScopedReadRequest, nullifier: ScopedNullifier) {
|
|
18
17
|
return (
|
|
@@ -30,7 +29,6 @@ interface NullifierMembershipWitnessWithPreimage {
|
|
|
30
29
|
export function getNullifierReadRequestResetActions(
|
|
31
30
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
32
31
|
nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
33
|
-
futureNullifiers: ScopedNullifier[],
|
|
34
32
|
): ReadRequestResetActions<typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX> {
|
|
35
33
|
const resetActions = ReadRequestResetActions.empty(MAX_NULLIFIER_READ_REQUESTS_PER_TX);
|
|
36
34
|
|
|
@@ -42,23 +40,23 @@ export function getNullifierReadRequestResetActions(
|
|
|
42
40
|
nullifierMap.set(value, arr);
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
const futureNullifiersMap = new ScopedValueCache(futureNullifiers);
|
|
46
|
-
|
|
47
43
|
for (let i = 0; i < nullifierReadRequests.claimedLength; ++i) {
|
|
48
44
|
const readRequest = nullifierReadRequests.array[i];
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (pendingNullifier !== undefined) {
|
|
54
|
-
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
55
|
-
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
56
|
-
} else if (
|
|
57
|
-
!futureNullifiersMap
|
|
58
|
-
.get(readRequest)
|
|
59
|
-
.some(futureNullifier => isValidNullifierReadRequest(readRequest, futureNullifier))
|
|
60
|
-
) {
|
|
45
|
+
|
|
46
|
+
if (readRequest.contractAddress.isZero()) {
|
|
47
|
+
// Settled read: empty contract address means resolve against the nullifier tree.
|
|
61
48
|
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_SETTLED;
|
|
49
|
+
} else {
|
|
50
|
+
// Pending read: non-empty contract address means match against a pending nullifier.
|
|
51
|
+
const pendingNullifier = nullifierMap
|
|
52
|
+
.get(readRequest.value.toBigInt())
|
|
53
|
+
?.find(({ nullifier }) => isValidNullifierReadRequest(readRequest, nullifier));
|
|
54
|
+
|
|
55
|
+
if (pendingNullifier) {
|
|
56
|
+
resetActions.actions[i] = ReadRequestActionEnum.READ_AS_PENDING;
|
|
57
|
+
resetActions.pendingReadHints.push(new PendingReadHint(i, pendingNullifier.index));
|
|
58
|
+
}
|
|
59
|
+
// Otherwise, the read request may be resolved by a future nullifier. Leave as NOOP.
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
|
@@ -111,11 +109,10 @@ export async function buildNullifierReadRequestHints<PENDING extends number, SET
|
|
|
111
109
|
},
|
|
112
110
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
113
111
|
nullifiers: ClaimedLengthArray<ScopedNullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
114
|
-
futureNullifiers: ScopedNullifier[],
|
|
115
112
|
maxPending: PENDING = MAX_NULLIFIER_READ_REQUESTS_PER_TX as PENDING,
|
|
116
113
|
maxSettled: SETTLED = MAX_NULLIFIER_READ_REQUESTS_PER_TX as SETTLED,
|
|
117
114
|
) {
|
|
118
|
-
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers
|
|
115
|
+
const resetActions = getNullifierReadRequestResetActions(nullifierReadRequests, nullifiers);
|
|
119
116
|
return await buildNullifierReadRequestHintsFromResetActions(
|
|
120
117
|
oracle,
|
|
121
118
|
nullifierReadRequests,
|
|
@@ -4,6 +4,7 @@ import type { Tuple } from '@aztec/foundation/serialize';
|
|
|
4
4
|
import type { ClaimedLengthArray } from '../claimed_length_array.js';
|
|
5
5
|
import type { ScopedNoteHash } from '../note_hash.js';
|
|
6
6
|
import type { ScopedNullifier } from '../nullifier.js';
|
|
7
|
+
import type { PrivateLogData, ScopedPrivateLogData } from '../private_log_data.js';
|
|
7
8
|
import { isValidNoteHashReadRequest } from './build_note_hash_read_request_hints.js';
|
|
8
9
|
import { isValidNullifierReadRequest } from './build_nullifier_read_request_hints.js';
|
|
9
10
|
import type { ScopedReadRequest } from './read_request.js';
|
|
@@ -15,11 +16,13 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
15
16
|
nullifiers: ClaimedLengthArray<ScopedNullifier, NULLIFIERS_LEN>,
|
|
16
17
|
futureNoteHashReads: ScopedReadRequest[],
|
|
17
18
|
futureNullifierReads: ScopedReadRequest[],
|
|
19
|
+
futureLogs: PrivateLogData[],
|
|
18
20
|
noteHashNullifierCounterMap: Map<number, number>,
|
|
19
21
|
splitCounter: number,
|
|
20
22
|
): { numTransientData: number; hints: Tuple<TransientDataSquashingHint, NULLIFIERS_LEN> } {
|
|
21
23
|
const futureNoteHashReadsMap = new ScopedValueCache(futureNoteHashReads);
|
|
22
24
|
const futureNullifierReadsMap = new ScopedValueCache(futureNullifierReads);
|
|
25
|
+
const futureLogNoteHashCounters = new Set(futureLogs.filter(l => l.noteHashCounter > 0).map(l => l.noteHashCounter));
|
|
23
26
|
|
|
24
27
|
const nullifierIndexMap: Map<number, number> = new Map();
|
|
25
28
|
nullifiers.getActiveItems().forEach((n, i) => nullifierIndexMap.set(n.counter, i));
|
|
@@ -28,10 +31,12 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
28
31
|
for (let noteHashIndex = 0; noteHashIndex < noteHashes.claimedLength; noteHashIndex++) {
|
|
29
32
|
const noteHash = noteHashes.array[noteHashIndex];
|
|
30
33
|
const noteHashNullifierCounter = noteHashNullifierCounterMap.get(noteHash.counter);
|
|
31
|
-
// The note hash might not be linked to a nullifier or it might be read in the future
|
|
34
|
+
// The note hash might not be linked to a nullifier, or it might be read in the future, or a future log might be
|
|
35
|
+
// linked to it.
|
|
32
36
|
if (
|
|
33
37
|
!noteHashNullifierCounter ||
|
|
34
|
-
futureNoteHashReadsMap.get(noteHash).find(read => isValidNoteHashReadRequest(read, noteHash))
|
|
38
|
+
futureNoteHashReadsMap.get(noteHash).find(read => isValidNoteHashReadRequest(read, noteHash)) ||
|
|
39
|
+
futureLogNoteHashCounters.has(noteHash.counter)
|
|
35
40
|
) {
|
|
36
41
|
continue;
|
|
37
42
|
}
|
|
@@ -77,3 +82,13 @@ export function buildTransientDataHints<NOTE_HASHES_LEN extends number, NULLIFIE
|
|
|
77
82
|
hints: padArrayEnd(hints, noActionHint, nullifiers.array.length as NULLIFIERS_LEN),
|
|
78
83
|
};
|
|
79
84
|
}
|
|
85
|
+
|
|
86
|
+
/** Counts private logs that are linked to squashed note hashes and would be removed along with them. */
|
|
87
|
+
export function countSquashedLogs<NOTE_HASHES_LEN extends number, LOGS_LEN extends number>(
|
|
88
|
+
noteHashes: ClaimedLengthArray<ScopedNoteHash, NOTE_HASHES_LEN>,
|
|
89
|
+
privateLogs: ClaimedLengthArray<ScopedPrivateLogData, LOGS_LEN>,
|
|
90
|
+
squashingHints: TransientDataSquashingHint[],
|
|
91
|
+
): number {
|
|
92
|
+
const squashedNoteHashCounters = new Set(squashingHints.map(h => noteHashes.array[h.noteHashIndex].counter));
|
|
93
|
+
return privateLogs.getActiveItems().filter(l => squashedNoteHashCounters.has(l.inner.noteHashCounter)).length;
|
|
94
|
+
}
|
|
@@ -105,8 +105,11 @@ export class PrivateKernelResetHints<
|
|
|
105
105
|
fromBuffer: buf =>
|
|
106
106
|
nullifierReadRequestHintsFromBuffer(buf, numNullifierReadRequestPending, numNullifierReadRequestSettled),
|
|
107
107
|
}),
|
|
108
|
-
reader.readArray(numKeyValidationHints, KeyValidationHint),
|
|
109
|
-
reader.readArray(numTransientDataSquashingHints, TransientDataSquashingHint)
|
|
108
|
+
reader.readArray(numKeyValidationHints, KeyValidationHint) as Tuple<KeyValidationHint, KEY_VALIDATION_HINTS_LEN>,
|
|
109
|
+
reader.readArray(numTransientDataSquashingHints, TransientDataSquashingHint) as Tuple<
|
|
110
|
+
TransientDataSquashingHint,
|
|
111
|
+
TRANSIENT_DATA_HINTS_LEN
|
|
112
|
+
>,
|
|
110
113
|
);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -158,11 +158,11 @@ export class ReadRequestResetHints<
|
|
|
158
158
|
> {
|
|
159
159
|
const reader = BufferReader.asReader(buffer);
|
|
160
160
|
return new ReadRequestResetHints(
|
|
161
|
-
reader.readArray(readRequestLen, ReadRequestAction),
|
|
162
|
-
reader.readArray(numPendingReads, PendingReadHint),
|
|
161
|
+
reader.readArray(readRequestLen, ReadRequestAction) as Tuple<ReadRequestAction, READ_REQUEST_LEN>,
|
|
162
|
+
reader.readArray(numPendingReads, PendingReadHint) as Tuple<PendingReadHint, PENDING_READ_HINTS_LEN>,
|
|
163
163
|
reader.readArray(numSettledReads, {
|
|
164
164
|
fromBuffer: r => SettledReadHint.fromBuffer(r, treeHeight, leafPreimageFromBuffer),
|
|
165
|
-
}),
|
|
165
|
+
}) as Tuple<SettledReadHint<TREE_HEIGHT, LEAF_PREIMAGE>, SETTLED_READ_HINTS_LEN>,
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -19,9 +19,9 @@ export class PaddedSideEffects {
|
|
|
19
19
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
20
20
|
const reader = BufferReader.asReader(buffer);
|
|
21
21
|
return new PaddedSideEffects(
|
|
22
|
-
reader.
|
|
23
|
-
reader.
|
|
24
|
-
reader.
|
|
22
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
23
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
24
|
+
reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -234,6 +234,15 @@ export class PrivateKernelTailCircuitPublicInputs {
|
|
|
234
234
|
return noteHashes.filter(n => !n.isZero());
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
getNonEmptyL2ToL1Msgs() {
|
|
238
|
+
const l2ToL1Msgs = this.forPublic
|
|
239
|
+
? this.forPublic.nonRevertibleAccumulatedData.l2ToL1Msgs.concat(
|
|
240
|
+
this.forPublic.revertibleAccumulatedData.l2ToL1Msgs,
|
|
241
|
+
)
|
|
242
|
+
: this.forRollup!.end.l2ToL1Msgs;
|
|
243
|
+
return l2ToL1Msgs.filter(m => !m.isEmpty());
|
|
244
|
+
}
|
|
245
|
+
|
|
237
246
|
getNonEmptyNullifiers() {
|
|
238
247
|
const nullifiers = this.forPublic
|
|
239
248
|
? this.forPublic.nonRevertibleAccumulatedData.nullifiers.concat(
|
|
@@ -73,7 +73,7 @@ export class PrivateToAvmAccumulatedData {
|
|
|
73
73
|
return new this(
|
|
74
74
|
reader.readFieldArray(MAX_NOTE_HASHES_PER_TX),
|
|
75
75
|
reader.readFieldArray(MAX_NULLIFIERS_PER_TX),
|
|
76
|
-
reader.
|
|
76
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -94,9 +94,9 @@ export class PrivateToAvmAccumulatedData {
|
|
|
94
94
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
95
95
|
const reader = BufferReader.asReader(buffer);
|
|
96
96
|
return new PrivateToAvmAccumulatedData(
|
|
97
|
-
reader.
|
|
98
|
-
reader.
|
|
99
|
-
reader.
|
|
97
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
98
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
99
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -62,10 +62,10 @@ export class PrivateToPublicAccumulatedData {
|
|
|
62
62
|
return new this(
|
|
63
63
|
reader.readFieldArray(MAX_NOTE_HASHES_PER_TX),
|
|
64
64
|
reader.readFieldArray(MAX_NULLIFIERS_PER_TX),
|
|
65
|
-
reader.
|
|
66
|
-
reader.
|
|
67
|
-
reader.
|
|
68
|
-
reader.
|
|
65
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
66
|
+
reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
67
|
+
reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
|
|
68
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -76,12 +76,12 @@ export class PrivateToPublicAccumulatedData {
|
|
|
76
76
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
77
77
|
const reader = BufferReader.asReader(buffer);
|
|
78
78
|
return new PrivateToPublicAccumulatedData(
|
|
79
|
-
reader.
|
|
80
|
-
reader.
|
|
81
|
-
reader.
|
|
82
|
-
reader.
|
|
83
|
-
reader.
|
|
84
|
-
reader.
|
|
79
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
80
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
81
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
82
|
+
reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
83
|
+
reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
|
|
84
|
+
reader.readTuple(MAX_ENQUEUED_CALLS_PER_TX, PublicCallRequest),
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -95,11 +95,11 @@ export class PrivateToRollupAccumulatedData {
|
|
|
95
95
|
static fromBuffer(buffer: Buffer | BufferReader): PrivateToRollupAccumulatedData {
|
|
96
96
|
const reader = BufferReader.asReader(buffer);
|
|
97
97
|
return new PrivateToRollupAccumulatedData(
|
|
98
|
-
reader.
|
|
99
|
-
reader.
|
|
100
|
-
reader.
|
|
101
|
-
reader.
|
|
102
|
-
reader.
|
|
98
|
+
reader.readTuple(MAX_NOTE_HASHES_PER_TX, Fr),
|
|
99
|
+
reader.readTuple(MAX_NULLIFIERS_PER_TX, Fr),
|
|
100
|
+
reader.readTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
|
|
101
|
+
reader.readTuple(MAX_PRIVATE_LOGS_PER_TX, PrivateLog),
|
|
102
|
+
reader.readTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedLogHash),
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
2
|
+
import type { DebugLog } from './debug_log.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Store for debug logs emitted by public functions during transaction execution.
|
|
6
|
+
*
|
|
7
|
+
* Uses the Null Object pattern: production code uses NullDebugLogStore (no-op), while test mode uses
|
|
8
|
+
* InMemoryDebugLogStore (stores and serves logs).
|
|
9
|
+
*/
|
|
10
|
+
export interface DebugLogStore {
|
|
11
|
+
/** Store debug logs for a processed transaction. */
|
|
12
|
+
storeLogs(txHash: string, logs: DebugLog[]): void;
|
|
13
|
+
/** Decorate a TxReceipt with any stored debug logs for the given tx. */
|
|
14
|
+
decorateReceiptWithLogs(txHash: string, receipt: TxReceipt): void;
|
|
15
|
+
/** Whether debug log collection is enabled. */
|
|
16
|
+
readonly isEnabled: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** No-op implementation for production mode. */
|
|
20
|
+
export class NullDebugLogStore implements DebugLogStore {
|
|
21
|
+
storeLogs(_txHash: string, _logs: DebugLog[]): void {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
decorateReceiptWithLogs(_txHash: string, _receipt: TxReceipt): void {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
get isEnabled(): boolean {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** In-memory implementation for test mode that stores and serves debug logs. */
|
|
33
|
+
export class InMemoryDebugLogStore implements DebugLogStore {
|
|
34
|
+
private map = new Map<string, DebugLog[]>();
|
|
35
|
+
|
|
36
|
+
storeLogs(txHash: string, logs: DebugLog[]): void {
|
|
37
|
+
if (logs.length > 0) {
|
|
38
|
+
this.map.set(txHash, logs);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
decorateReceiptWithLogs(txHash: string, receipt: TxReceipt): void {
|
|
43
|
+
if (receipt.isMined()) {
|
|
44
|
+
const debugLogs = this.map.get(txHash);
|
|
45
|
+
if (debugLogs) {
|
|
46
|
+
receipt.debugLogs = debugLogs;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get isEnabled(): boolean {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts}
RENAMED
|
@@ -5,26 +5,32 @@ import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
|
5
5
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
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
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Extended directional application tagging secret used for log tagging.
|
|
14
14
|
*
|
|
15
|
-
* "
|
|
16
|
-
*
|
|
15
|
+
* "Extended" because it bundles the directional app tagging secret with the app (contract) address. This bundling was
|
|
16
|
+
* done because where this type is used we commonly need access to both the secret and the address.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* "Directional" because the derived secret is bound to the recipient address: A→B differs from B→A even with the same
|
|
19
|
+
* participants and app.
|
|
20
|
+
*
|
|
21
|
+
* Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides in
|
|
22
|
+
* `pxe/src/tagging`. We need to use this type in `PreTag` that in turn is used by other types in stdlib hence there
|
|
23
|
+
* doesn't seem to be a good way around this.
|
|
21
24
|
*/
|
|
22
|
-
export class
|
|
23
|
-
|
|
25
|
+
export class ExtendedDirectionalAppTaggingSecret {
|
|
26
|
+
constructor(
|
|
27
|
+
public readonly secret: Fr,
|
|
28
|
+
public readonly app: AztecAddress,
|
|
29
|
+
) {}
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
32
|
* Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
|
|
27
|
-
* secret.
|
|
33
|
+
* secret. Returns undefined if `externalAddress` is an invalid address.
|
|
28
34
|
*
|
|
29
35
|
* @param localAddress - The complete address of entity A in the shared tagging secret derivation scheme
|
|
30
36
|
* @param localIvsk - The incoming viewing secret key of entity A
|
|
@@ -39,41 +45,54 @@ export class DirectionalAppTaggingSecret {
|
|
|
39
45
|
externalAddress: AztecAddress,
|
|
40
46
|
app: AztecAddress,
|
|
41
47
|
recipient: AztecAddress,
|
|
42
|
-
): Promise<
|
|
48
|
+
): Promise<ExtendedDirectionalAppTaggingSecret | undefined> {
|
|
43
49
|
const taggingSecretPoint = await computeSharedTaggingSecret(localAddress, localIvsk, externalAddress);
|
|
50
|
+
if (!taggingSecretPoint) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
const appTaggingSecret = await poseidon2Hash([taggingSecretPoint.x, taggingSecretPoint.y, app]);
|
|
45
55
|
const directionalAppTaggingSecret = await poseidon2Hash([appTaggingSecret, recipient]);
|
|
46
56
|
|
|
47
|
-
return new
|
|
57
|
+
return new ExtendedDirectionalAppTaggingSecret(directionalAppTaggingSecret, app);
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
toString(): string {
|
|
51
|
-
return this.
|
|
61
|
+
return `${this.secret.toString()}:${this.app.toString()}`;
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
static fromString(str: string):
|
|
55
|
-
|
|
64
|
+
static fromString(str: string): ExtendedDirectionalAppTaggingSecret {
|
|
65
|
+
const [secretStr, appStr] = str.split(':');
|
|
66
|
+
return new ExtendedDirectionalAppTaggingSecret(Fr.fromString(secretStr), AztecAddress.fromString(appStr));
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
|
|
59
|
-
// Returns shared tagging secret computed with Diffie-Hellman key exchange
|
|
70
|
+
// Returns shared tagging secret computed with Diffie-Hellman key exchange, or undefined if `externalAddress` is an
|
|
71
|
+
// invalid address.
|
|
60
72
|
async function computeSharedTaggingSecret(
|
|
61
73
|
localAddress: CompleteAddress,
|
|
62
74
|
localIvsk: Fq,
|
|
63
75
|
externalAddress: AztecAddress,
|
|
64
|
-
): Promise<Point> {
|
|
65
|
-
const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
|
|
66
|
-
// TODO: #8970 - Computation of address point from x coordinate might fail
|
|
67
|
-
const externalAddressPoint = await externalAddress.toAddressPoint();
|
|
76
|
+
): Promise<Point | undefined> {
|
|
68
77
|
// Given A (local complete address) -> B (external address) and h == preaddress
|
|
69
78
|
// Compute shared secret as S = (h_A + local_ivsk_A) * Addr_Point_B
|
|
70
79
|
|
|
80
|
+
const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
|
|
81
|
+
|
|
82
|
+
// An invalid address has no corresponding address point
|
|
83
|
+
if (!(await externalAddress.isValid())) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const externalAddressPoint = await externalAddress.toAddressPoint();
|
|
88
|
+
|
|
71
89
|
// Beware! h_a + local_ivsk_a (also known as the address secret) can lead to an address point with a negative
|
|
72
90
|
// y-coordinate, since there's two possible candidates computeAddressSecret takes care of selecting the one that
|
|
73
91
|
// leads to a positive y-coordinate, which is the only valid address point
|
|
74
92
|
return Grumpkin.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
|
|
75
93
|
}
|
|
76
94
|
|
|
77
|
-
export const
|
|
78
|
-
|
|
95
|
+
export const ExtendedDirectionalAppTaggingSecretSchema = z.object({
|
|
96
|
+
secret: Fr.schema,
|
|
97
|
+
app: AztecAddress.schema,
|
|
79
98
|
});
|
package/src/logs/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './extended_directional_app_tagging_secret.js';
|
|
2
2
|
export * from './pre_tag.js';
|
|
3
|
+
export * from './tagging_index_range.js';
|
|
3
4
|
export * from './contract_class_log.js';
|
|
4
5
|
export * from './public_log.js';
|
|
5
6
|
export * from './private_log.js';
|
|
@@ -12,5 +13,6 @@ export * from './shared_secret_derivation.js';
|
|
|
12
13
|
export * from './tx_scoped_l2_log.js';
|
|
13
14
|
export * from './message_context.js';
|
|
14
15
|
export * from './debug_log.js';
|
|
16
|
+
export * from './debug_log_store.js';
|
|
15
17
|
export * from './tag.js';
|
|
16
18
|
export * from './siloed_tag.js';
|
package/src/logs/log_filter.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
|
|
3
5
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -20,6 +22,8 @@ export type LogFilter = {
|
|
|
20
22
|
afterLog?: LogId;
|
|
21
23
|
/** The contract address to filter logs by. */
|
|
22
24
|
contractAddress?: AztecAddress;
|
|
25
|
+
/** The tag (first field of the log) to filter logs by. */
|
|
26
|
+
tag?: Fr;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
export const LogFilterSchema: ZodFor<LogFilter> = z.object({
|
|
@@ -28,4 +32,5 @@ export const LogFilterSchema: ZodFor<LogFilter> = z.object({
|
|
|
28
32
|
toBlock: schemas.Integer.optional(),
|
|
29
33
|
afterLog: LogId.schema.optional(),
|
|
30
34
|
contractAddress: schemas.AztecAddress.optional(),
|
|
35
|
+
tag: schemas.Fr.optional(),
|
|
31
36
|
});
|