@aztec/stdlib 0.0.1-commit.ff7989d6c → 0.0.1-commit.fff30aa
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/abi.d.ts +57 -85
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +55 -6
- 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/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- 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 +9 -4
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +16 -21
- 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/interfaces.d.ts +6 -3
- package/dest/block/l2_block_stream/interfaces.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 +5 -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/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- 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 +64 -27
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- 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/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/configs.d.ts +62 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -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 +68 -26
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +7 -3
- 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/block_proposal.d.ts +2 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +14 -24
- 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 +9 -1
- package/dest/tests/mocks.d.ts +5 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +20 -15
- 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 +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/simulated_tx.d.ts +63 -77
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +7 -4
- 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 +29 -6
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +23 -19
- 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/abi.ts +78 -2
- 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/selector.ts +1 -1
- 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 +26 -25
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +16 -7
- package/src/block/l2_block_stream/interfaces.ts +6 -2
- 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 +6 -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/gas/gas_settings.ts +65 -12
- 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-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +24 -5
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/configs.ts +25 -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 +19 -3
- 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/block_proposal.ts +1 -1
- package/src/p2p/checkpoint_proposal.ts +24 -38
- 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 +10 -1
- package/src/tests/mocks.ts +26 -11
- 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 +11 -2
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/simulated_tx.ts +14 -3
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +28 -16
- 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/ha-signing/config.d.ts +0 -101
- package/dest/ha-signing/config.d.ts.map +0 -1
- package/dest/ha-signing/config.js +0 -92
- package/dest/ha-signing/index.d.ts +0 -3
- package/dest/ha-signing/index.d.ts.map +0 -1
- package/dest/ha-signing/index.js +0 -2
- package/dest/ha-signing/types.d.ts +0 -85
- package/dest/ha-signing/types.d.ts.map +0 -1
- package/dest/ha-signing/types.js +0 -32
- 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/ha-signing/config.ts +0 -149
- package/src/ha-signing/index.ts +0 -18
- package/src/ha-signing/types.ts +0 -112
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -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
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { range } from '@aztec/foundation/array';
|
|
2
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
|
|
4
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
import type { TxEffect } from '../tx/tx_effect.js';
|
|
6
5
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -19,7 +18,6 @@ export class MessageContext {
|
|
|
19
18
|
public txHash: TxHash,
|
|
20
19
|
public uniqueNoteHashesInTx: Fr[],
|
|
21
20
|
public firstNullifierInTx: Fr,
|
|
22
|
-
public recipient: AztecAddress,
|
|
23
21
|
) {}
|
|
24
22
|
|
|
25
23
|
toFields(): Fr[] {
|
|
@@ -27,7 +25,6 @@ export class MessageContext {
|
|
|
27
25
|
this.txHash.hash,
|
|
28
26
|
...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
29
27
|
this.firstNullifierInTx,
|
|
30
|
-
this.recipient.toField(),
|
|
31
28
|
];
|
|
32
29
|
}
|
|
33
30
|
|
|
@@ -37,13 +34,22 @@ export class MessageContext {
|
|
|
37
34
|
tx_hash: this.txHash.hash,
|
|
38
35
|
unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
|
|
39
36
|
first_nullifier_in_tx: this.firstNullifierInTx,
|
|
40
|
-
recipient: this.recipient,
|
|
41
37
|
};
|
|
42
38
|
/* eslint-enable camelcase */
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
static
|
|
46
|
-
|
|
41
|
+
static toEmptyFields(): Fr[] {
|
|
42
|
+
const serializationLen =
|
|
43
|
+
1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
|
|
44
|
+
return range(serializationLen).map(_ => Fr.zero());
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static toSerializedOption(response: MessageContext | null): Fr[] {
|
|
48
|
+
if (response) {
|
|
49
|
+
return [new Fr(1), ...response.toFields()];
|
|
50
|
+
} else {
|
|
51
|
+
return [new Fr(0), ...MessageContext.toEmptyFields()];
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -55,6 +61,10 @@ export class MessageContext {
|
|
|
55
61
|
* @dev Copied over from pending_tagged_log.ts.
|
|
56
62
|
*/
|
|
57
63
|
function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
|
|
64
|
+
if (values.length > maxLength) {
|
|
65
|
+
throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
const lengthDiff = maxLength - values.length;
|
|
59
69
|
const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
|
|
60
70
|
const storage = values.concat(zeroPaddingArray);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
|
|
4
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
4
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
6
5
|
import { MessageContext } from './message_context.js';
|
|
7
6
|
|
|
@@ -17,9 +16,8 @@ export class PendingTaggedLog {
|
|
|
17
16
|
txHash: TxHash,
|
|
18
17
|
uniqueNoteHashesInTx: Fr[],
|
|
19
18
|
firstNullifierInTx: Fr,
|
|
20
|
-
recipient: AztecAddress,
|
|
21
19
|
) {
|
|
22
|
-
this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx
|
|
20
|
+
this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
toFields(): Fr[] {
|
package/src/logs/pre_tag.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { schemas } from '@aztec/foundation/schemas';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
} from './
|
|
6
|
+
type ExtendedDirectionalAppTaggingSecret,
|
|
7
|
+
ExtendedDirectionalAppTaggingSecretSchema,
|
|
8
|
+
} from './extended_directional_app_tagging_secret.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents a preimage of a private log tag (see `Tag` in `pxe/src/tagging`).
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
* around this.
|
|
16
16
|
*/
|
|
17
17
|
export type PreTag = {
|
|
18
|
-
|
|
18
|
+
extendedSecret: ExtendedDirectionalAppTaggingSecret;
|
|
19
19
|
index: number;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const PreTagSchema = z.object({
|
|
23
|
-
|
|
23
|
+
extendedSecret: ExtendedDirectionalAppTaggingSecretSchema,
|
|
24
24
|
index: schemas.Integer,
|
|
25
25
|
});
|
package/src/logs/private_log.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class PrivateLog {
|
|
|
73
73
|
|
|
74
74
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
75
75
|
const reader = BufferReader.asReader(buffer);
|
|
76
|
-
return new PrivateLog(reader.
|
|
76
|
+
return new PrivateLog(reader.readTuple(PRIVATE_LOG_SIZE_IN_FIELDS, Fr), reader.readNumber());
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
static random(tag = Fr.random()) {
|
package/src/logs/public_log.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH,
|
|
3
|
+
MAX_PUBLIC_LOG_SIZE_IN_FIELDS,
|
|
4
|
+
PUBLIC_LOG_HEADER_LENGTH,
|
|
5
|
+
} from '@aztec/constants';
|
|
2
6
|
import type { FieldsOf } from '@aztec/foundation/array';
|
|
3
7
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
8
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
@@ -76,6 +80,9 @@ export class FlatPublicLogs {
|
|
|
76
80
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
77
81
|
const reader = BufferReader.asReader(buffer);
|
|
78
82
|
const length = reader.readNumber();
|
|
83
|
+
if (length > FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH) {
|
|
84
|
+
throw new Error(`FlatPublicLogs length ${length} exceeds maximum ${FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH}`);
|
|
85
|
+
}
|
|
79
86
|
return this.fromUnpaddedPayload(reader.readArray(length, Fr));
|
|
80
87
|
}
|
|
81
88
|
|
|
@@ -120,8 +127,8 @@ export class FlatPublicLogs {
|
|
|
120
127
|
|
|
121
128
|
export class PublicLog {
|
|
122
129
|
constructor(
|
|
123
|
-
public contractAddress: AztecAddress,
|
|
124
|
-
public fields: Fr[],
|
|
130
|
+
public readonly contractAddress: AztecAddress,
|
|
131
|
+
public readonly fields: Fr[],
|
|
125
132
|
) {}
|
|
126
133
|
|
|
127
134
|
static from(fields: FieldsOf<PublicLog>) {
|
|
@@ -146,7 +153,9 @@ export class PublicLog {
|
|
|
146
153
|
return this.fields.length + PUBLIC_LOG_HEADER_LENGTH;
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
/** Returns the serialized log (field as in noir field and not a struct field). */
|
|
149
157
|
getEmittedFields() {
|
|
158
|
+
// We slice from 0 to return a shallow copy.
|
|
150
159
|
return this.fields.slice(0);
|
|
151
160
|
}
|
|
152
161
|
|
|
@@ -169,6 +178,9 @@ export class PublicLog {
|
|
|
169
178
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
170
179
|
const reader = BufferReader.asReader(buffer);
|
|
171
180
|
const fieldsLength = reader.readNumber();
|
|
181
|
+
if (fieldsLength > MAX_PUBLIC_LOG_SIZE_IN_FIELDS) {
|
|
182
|
+
throw new Error(`PublicLog fields length ${fieldsLength} exceeds maximum ${MAX_PUBLIC_LOG_SIZE_IN_FIELDS}`);
|
|
183
|
+
}
|
|
172
184
|
return new PublicLog(reader.readObject(AztecAddress), reader.readArray(fieldsLength, Fr));
|
|
173
185
|
}
|
|
174
186
|
|