@aztec/stdlib 6.0.0-nightly.20260604 → 6.0.0-nightly.20260721
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 +6 -2
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +13 -1
- package/dest/avm/avm.js +1 -1
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/avm/index.d.ts +1 -6
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -5
- package/dest/aztec-address/index.d.ts +35 -5
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +32 -8
- package/dest/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +46 -23
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -1
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +81 -11
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +149 -152
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +6 -12
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +8 -32
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +17 -18
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +70 -58
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +47 -7
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +296 -37
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/checkpoint/checkpoint.js +2 -2
- 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/simulation_overrides.d.ts +61 -0
- package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
- package/dest/checkpoint/simulation_overrides.js +98 -0
- package/dest/checkpoint/validate.d.ts +11 -3
- package/dest/checkpoint/validate.d.ts.map +1 -1
- package/dest/checkpoint/validate.js +9 -6
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/network-consensus-config.d.ts +72 -0
- package/dest/config/network-consensus-config.d.ts.map +1 -0
- package/dest/config/network-consensus-config.js +223 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +22 -3
- package/dest/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_class.d.ts +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -2
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/index.d.ts +1 -2
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -1
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/interfaces/node-info.d.ts +11 -1
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +7 -1
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/deserialization/index.d.ts +35 -3
- package/dest/deserialization/index.d.ts.map +1 -1
- package/dest/deserialization/index.js +32 -1
- package/dest/file-store/factory.d.ts +1 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +7 -0
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/file-store/index.js +1 -0
- package/dest/file-store/memory.d.ts +24 -0
- package/dest/file-store/memory.d.ts.map +1 -0
- package/dest/file-store/memory.js +80 -0
- package/dest/gas/gas_settings.d.ts +7 -13
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +9 -16
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/gas/tx_gas_limits.d.ts +72 -0
- package/dest/gas/tx_gas_limits.d.ts.map +1 -0
- package/dest/gas/tx_gas_limits.js +85 -0
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/interfaces/archiver.d.ts +7 -9
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +24 -17
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +1 -1
- package/dest/interfaces/aztec-node-debug.d.ts +40 -2
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.js +29 -1
- package/dest/interfaces/aztec-node.d.ts +69 -28
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +56 -20
- package/dest/interfaces/block-builder.d.ts +3 -1
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.d.ts +8 -47
- package/dest/interfaces/chain_tips.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.js +1 -6
- package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
- package/dest/interfaces/checkpoint_parameter.js +3 -3
- package/dest/interfaces/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +27 -6
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +5 -1
- package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
- package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
- package/dest/interfaces/get_tx_by_hash_options.js +4 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +38 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +14 -2
- package/dest/interfaces/private_kernel_prover.d.ts +71 -12
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +2 -3
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-node.d.ts +12 -8
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +24 -17
- package/dest/interfaces/proving-job.d.ts +4 -4
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +2 -2
- package/dest/interfaces/server.d.ts +1 -3
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +0 -2
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +15 -4
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/hints/index.d.ts +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +0 -1
- package/dest/kernel/hints/read_request.js +1 -1
- package/dest/kernel/index.d.ts +6 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +5 -1
- package/dest/kernel/log_hash.d.ts +1 -1
- package/dest/kernel/log_hash.d.ts.map +1 -1
- package/dest/kernel/log_hash.js +2 -2
- package/dest/kernel/note_hash.js +1 -1
- package/dest/kernel/nullifier.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +10 -7
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +4 -1
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +2 -1
- package/dest/kernel/private_log_data.d.ts +1 -1
- package/dest/kernel/private_log_data.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +1 -1
- package/dest/kernel/utils/index.d.ts +1 -2
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +0 -1
- package/dest/keys/derivation.d.ts +41 -5
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +53 -23
- package/dest/logs/app_tagging_secret.d.ts +30 -7
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +44 -28
- package/dest/logs/app_tagging_secret_kind.js +1 -1
- package/dest/logs/contract_class_log.d.ts +1 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +0 -4
- package/dest/logs/message_context.d.ts +5 -15
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +1 -66
- package/dest/logs/pending_tagged_log.d.ts +6 -8
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +1 -31
- package/dest/logs/shared_secret_derivation.d.ts +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +10 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- package/dest/p2p/checkpoint_proposal.d.ts +2 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.d.ts +2 -1
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- 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/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.d.ts +8 -3
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +20 -10
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -27
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +10 -45
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -2
- package/dest/timetable/budgets.d.ts +57 -0
- package/dest/timetable/budgets.d.ts.map +1 -0
- package/dest/timetable/budgets.js +56 -0
- package/dest/timetable/build_proposer_timetable.d.ts +21 -0
- package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
- package/dest/timetable/build_proposer_timetable.js +17 -0
- package/dest/timetable/consensus_timetable.d.ts +70 -0
- package/dest/timetable/consensus_timetable.d.ts.map +1 -0
- package/dest/timetable/consensus_timetable.js +89 -0
- package/dest/timetable/index.d.ts +5 -84
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +4 -209
- package/dest/timetable/proposer_timetable.d.ts +106 -0
- package/dest/timetable/proposer_timetable.d.ts.map +1 -0
- package/dest/timetable/proposer_timetable.js +132 -0
- package/dest/trees/nullifier_membership_witness.d.ts +5 -8
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +0 -9
- package/dest/trees/public_data_witness.d.ts +7 -17
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +0 -27
- package/dest/tx/execution_payload.d.ts +1 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/execution_payload.js +1 -1
- package/dest/tx/fee_provider.d.ts +2 -2
- package/dest/tx/fee_provider.d.ts.map +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -12
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +2 -2
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/tx.d.ts +9 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +15 -0
- package/dest/tx/validator/error_texts.d.ts +2 -2
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- package/dest/world-state/world_state_revision.d.ts +1 -18
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +0 -20
- package/package.json +8 -8
- package/src/abi/buffer.ts +13 -1
- package/src/avm/avm.ts +1 -1
- package/src/avm/index.ts +0 -5
- package/src/aztec-address/index.ts +36 -6
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +67 -13
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +96 -10
- package/src/block/l2_block_stream/l2_block_stream.ts +216 -175
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +12 -41
- package/src/block/l2_block_stream/l2_tips_store_base.ts +84 -93
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/test/l2_tips_store_test_suite.ts +270 -28
- package/src/block/validate_block_result.ts +48 -2
- package/src/checkpoint/checkpoint.ts +2 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/simulation_overrides.ts +171 -0
- package/src/checkpoint/validate.ts +16 -6
- package/src/config/index.ts +1 -0
- package/src/config/network-consensus-config.ts +291 -0
- package/src/config/sequencer-config.ts +36 -5
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_class.ts +3 -2
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/index.ts +0 -1
- package/src/contract/interfaces/contract_data_source.ts +2 -4
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/interfaces/node-info.ts +11 -0
- package/src/contract/partial_address.ts +8 -2
- package/src/database-version/version_manager.ts +96 -6
- package/src/deserialization/index.ts +35 -2
- package/src/file-store/factory.ts +7 -0
- package/src/file-store/index.ts +1 -0
- package/src/file-store/memory.ts +94 -0
- package/src/gas/README.md +92 -0
- package/src/gas/gas_settings.ts +11 -21
- package/src/gas/index.ts +1 -0
- package/src/gas/tx_gas_limits.ts +123 -0
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/interfaces/archiver.ts +8 -9
- package/src/interfaces/aztec-node-admin.ts +1 -1
- package/src/interfaces/aztec-node-debug.ts +54 -2
- package/src/interfaces/aztec-node.ts +121 -43
- package/src/interfaces/block-builder.ts +2 -0
- package/src/interfaces/chain_tips.ts +8 -16
- package/src/interfaces/checkpoint_parameter.ts +3 -3
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/configs.ts +27 -6
- package/src/interfaces/get_tx_by_hash_options.ts +14 -0
- package/src/interfaces/merkle_tree_operations.ts +8 -2
- package/src/interfaces/p2p.ts +29 -9
- package/src/interfaces/private_kernel_prover.ts +104 -13
- package/src/interfaces/prover-client.ts +1 -3
- package/src/interfaces/prover-node.ts +32 -17
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server.ts +0 -2
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/validator.ts +11 -0
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/hints/index.ts +0 -1
- package/src/kernel/hints/read_request.ts +1 -1
- package/src/kernel/index.ts +5 -1
- package/src/kernel/log_hash.ts +5 -2
- package/src/kernel/note_hash.ts +1 -1
- package/src/kernel/nullifier.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -7
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
- package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
- package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
- package/src/kernel/private_kernel_prover_output.ts +4 -0
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/kernel/private_kernel_simulated_output.ts +0 -7
- package/src/kernel/private_log_data.ts +4 -1
- package/src/kernel/utils/index.ts +0 -1
- package/src/keys/derivation.ts +71 -21
- package/src/logs/app_tagging_secret.ts +56 -24
- package/src/logs/app_tagging_secret_kind.ts +1 -1
- package/src/logs/contract_class_log.ts +0 -9
- package/src/logs/message_context.ts +7 -65
- package/src/logs/pending_tagged_log.ts +6 -33
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/index.ts +0 -1
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/rollup/checkpoint_header.ts +16 -2
- package/src/stats/stats.ts +6 -2
- package/src/tests/factories.ts +13 -51
- package/src/tests/mocks.ts +7 -2
- package/src/timetable/README.md +609 -0
- package/src/timetable/budgets.ts +87 -0
- package/src/timetable/build_proposer_timetable.ts +42 -0
- package/src/timetable/consensus_timetable.ts +126 -0
- package/src/timetable/index.ts +4 -304
- package/src/timetable/proposer_timetable.ts +190 -0
- package/src/timetable/timetable-example.svg +108 -0
- package/src/trees/nullifier_membership_witness.ts +0 -11
- package/src/trees/public_data_witness.ts +0 -31
- package/src/tx/execution_payload.ts +2 -1
- package/src/tx/fee_provider.ts +1 -1
- package/src/tx/global_variable_builder.ts +1 -17
- package/src/tx/global_variables.ts +2 -2
- package/src/tx/index.ts +0 -1
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/tx/profiling.ts +2 -0
- package/src/tx/tx.ts +17 -0
- package/src/tx/validator/error_texts.ts +2 -1
- package/src/world-state/world_state_revision.ts +0 -33
- package/dest/avm/contract_storage_read.d.ts +0 -58
- package/dest/avm/contract_storage_read.d.ts.map +0 -1
- package/dest/avm/contract_storage_read.js +0 -65
- package/dest/avm/contract_storage_update_request.d.ts +0 -65
- package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
- package/dest/avm/contract_storage_update_request.js +0 -80
- package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
- package/dest/avm/public_call_stack_item_compressed.js +0 -70
- package/dest/avm/public_data_update_request.d.ts +0 -62
- package/dest/avm/public_data_update_request.d.ts.map +0 -1
- package/dest/avm/public_data_update_request.js +0 -67
- package/dest/avm/public_inner_call_request.d.ts +0 -50
- package/dest/avm/public_inner_call_request.d.ts.map +0 -1
- package/dest/avm/public_inner_call_request.js +0 -74
- package/dest/contract/deployment_info.d.ts +0 -24
- package/dest/contract/deployment_info.d.ts.map +0 -1
- package/dest/contract/deployment_info.js +0 -3
- package/dest/interfaces/epoch-prover.d.ts +0 -57
- package/dest/interfaces/epoch-prover.d.ts.map +0 -1
- package/dest/interfaces/epoch-prover.js +0 -1
- package/dest/interfaces/prover-coordination.d.ts +0 -15
- package/dest/interfaces/prover-coordination.d.ts.map +0 -1
- package/dest/interfaces/prover-coordination.js +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- package/dest/kernel/utils/optional_number.d.ts +0 -31
- package/dest/kernel/utils/optional_number.d.ts.map +0 -1
- package/dest/kernel/utils/optional_number.js +0 -42
- package/dest/p2p/interface.d.ts +0 -5
- package/dest/p2p/interface.d.ts.map +0 -1
- package/dest/p2p/interface.js +0 -1
- package/dest/tx/validator/empty_validator.d.ts +0 -5
- package/dest/tx/validator/empty_validator.d.ts.map +0 -1
- package/dest/tx/validator/empty_validator.js +0 -7
- package/src/avm/contract_storage_read.ts +0 -77
- package/src/avm/contract_storage_update_request.ts +0 -93
- package/src/avm/public_call_stack_item_compressed.ts +0 -113
- package/src/avm/public_data_update_request.ts +0 -106
- package/src/avm/public_inner_call_request.ts +0 -85
- package/src/contract/deployment_info.ts +0 -25
- package/src/interfaces/epoch-prover.ts +0 -72
- package/src/interfaces/prover-coordination.ts +0 -17
- package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/kernel/utils/optional_number.ts +0 -50
- package/src/p2p/interface.ts +0 -4
- package/src/tx/validator/empty_validator.ts +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const TX_ERROR_INSUFFICIENT_FEE_PER_GAS = "Insufficient fee per gas";
|
|
2
2
|
export declare const TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE = "Insufficient fee payer balance";
|
|
3
3
|
export declare const TX_ERROR_INSUFFICIENT_GAS_LIMIT = "Gas limit is below the minimum fixed cost";
|
|
4
|
-
export declare const TX_ERROR_GAS_LIMIT_TOO_HIGH = "Gas limit is higher than the amount of gas
|
|
4
|
+
export declare const TX_ERROR_GAS_LIMIT_TOO_HIGH = "Gas limit is higher than the maximum amount of gas this network allows per tx";
|
|
5
5
|
export declare const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = "Setup function not on allow list";
|
|
6
6
|
export declare const TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT = "Setup function targets unknown contract";
|
|
7
7
|
export declare const TX_ERROR_SETUP_ONLY_SELF_WRONG_SENDER = "Setup only_self function called with incorrect msg_sender";
|
|
@@ -30,4 +30,4 @@ export declare const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = "Failed to parse
|
|
|
30
30
|
export declare const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = "Incorrect contract class id";
|
|
31
31
|
export declare const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = "Failed to parse contract class registration log";
|
|
32
32
|
export declare const TX_ERROR_DURING_VALIDATION = "Unexpected error during validation";
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfdGV4dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90eC92YWxpZGF0b3IvZXJyb3JfdGV4dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sdUNBQXVDLG1DQUFtQyxDQUFDO0FBQ3hGLGVBQU8sTUFBTSwrQkFBK0IsOENBQThDLENBQUM7QUFDM0YsZUFBTyxNQUFNLDJCQUEyQixrRkFDeUMsQ0FBQztBQUdsRixlQUFPLE1BQU0sbUNBQW1DLHFDQUFxQyxDQUFDO0FBQ3RGLGVBQU8sTUFBTSx3Q0FBd0MsNENBQTRDLENBQUM7QUFDbEcsZUFBTyxNQUFNLHFDQUFxQyw4REFBOEQsQ0FBQztBQUNqSCxlQUFPLE1BQU0sOEJBQThCLCtDQUErQyxDQUFDO0FBQzNGLGVBQU8sTUFBTSxvQ0FBb0MscURBQXFELENBQUM7QUFHdkcsZUFBTyxNQUFNLGtDQUFrQyw4QkFBOEIsQ0FBQztBQUM5RSxlQUFPLE1BQU0sMkJBQTJCLHVCQUF1QixDQUFDO0FBR2hFLGVBQU8sTUFBTSxxQ0FBcUMsaUNBQWlDLENBQUM7QUFDcEYsZUFBTyxNQUFNLDhCQUE4QiwwQkFBMEIsQ0FBQztBQUN0RSxlQUFPLE1BQU0saUNBQWlDLDZCQUE2QixDQUFDO0FBQzVFLGVBQU8sTUFBTSwrQkFBK0IsMENBQTBDLENBQUM7QUFDdkYsZUFBTyxNQUFNLDBDQUEwQyxzQ0FBc0MsQ0FBQztBQUc5RixlQUFPLE1BQU0sc0JBQXNCLGtCQUFrQixDQUFDO0FBR3RELGVBQU8sTUFBTSwyQkFBMkIsdUNBQXVDLENBQUM7QUFDaEYsZUFBTyxNQUFNLGdDQUFnQyw4Q0FBOEMsQ0FBQztBQUM1RixlQUFPLE1BQU0saUNBQWlDLHVEQUF1RCxDQUFDO0FBQ3RHLGVBQU8sTUFBTSxpQ0FBaUMsNkNBQTZDLENBQUM7QUFDNUYsZUFBTyxNQUFNLGtDQUFrQyx5Q0FBeUMsQ0FBQztBQUN6RixlQUFPLE1BQU0sNEJBQTRCLG1DQUFtQyxDQUFDO0FBQzdFLGVBQU8sTUFBTSxtQ0FBbUMsMkNBQTJDLENBQUM7QUFDNUYsZUFBTyxNQUFNLHVCQUF1QixzQkFBc0IsQ0FBQztBQUczRCxlQUFPLE1BQU0seUJBQXlCLHNDQUFzQyxDQUFDO0FBRzdFLGVBQU8sTUFBTSxxQkFBcUIsMkJBQTJCLENBQUM7QUFHOUQsZUFBTyxNQUFNLG1DQUFtQyxtREFBbUQsQ0FBQztBQUNwRyxlQUFPLE1BQU0sd0NBQXdDLHFEQUFxRCxDQUFDO0FBRzNHLGVBQU8sTUFBTSxvQ0FBb0MsZ0NBQWdDLENBQUM7QUFDbEYsZUFBTyxNQUFNLHFDQUFxQyxvREFBb0QsQ0FBQztBQUd2RyxlQUFPLE1BQU0sMEJBQTBCLHVDQUF1QyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,kFACyC,CAAC;AAGlF,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AACtF,eAAO,MAAM,wCAAwC,4CAA4C,CAAC;AAClG,eAAO,MAAM,qCAAqC,8DAA8D,CAAC;AACjH,eAAO,MAAM,8BAA8B,+CAA+C,CAAC;AAC3F,eAAO,MAAM,oCAAoC,qDAAqD,CAAC;AAGvG,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,qCAAqC,iCAAiC,CAAC;AACpF,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AACtE,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,+BAA+B,0CAA0C,CAAC;AACvF,eAAO,MAAM,0CAA0C,sCAAsC,CAAC;AAG9F,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAGtD,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,gCAAgC,8CAA8C,CAAC;AAC5F,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAC5F,eAAO,MAAM,kCAAkC,yCAAyC,CAAC;AACzF,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAC5F,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAG3D,eAAO,MAAM,yBAAyB,sCAAsC,CAAC;AAG7E,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,mCAAmC,mDAAmD,CAAC;AACpG,eAAO,MAAM,wCAAwC,qDAAqD,CAAC;AAG3G,eAAO,MAAM,oCAAoC,gCAAgC,CAAC;AAClF,eAAO,MAAM,qCAAqC,oDAAoD,CAAC;AAGvG,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const TX_ERROR_INSUFFICIENT_FEE_PER_GAS = 'Insufficient fee per gas';
|
|
3
3
|
export const TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE = 'Insufficient fee payer balance';
|
|
4
4
|
export const TX_ERROR_INSUFFICIENT_GAS_LIMIT = 'Gas limit is below the minimum fixed cost';
|
|
5
|
-
export const TX_ERROR_GAS_LIMIT_TOO_HIGH = 'Gas limit is higher than the amount of gas
|
|
5
|
+
export const TX_ERROR_GAS_LIMIT_TOO_HIGH = 'Gas limit is higher than the maximum amount of gas this network allows per tx';
|
|
6
6
|
// Phases
|
|
7
7
|
export const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = 'Setup function not on allow list';
|
|
8
8
|
export const TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT = 'Setup function targets unknown contract';
|
|
@@ -23,21 +23,4 @@ export declare class WorldStateRevision {
|
|
|
23
23
|
includeUncommitted: boolean;
|
|
24
24
|
}>>;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
readonly handle: any;
|
|
28
|
-
constructor(forkId: number, blockNumber: number, includeUncommitted: boolean, handle: any);
|
|
29
|
-
toWorldStateRevision(): WorldStateRevision;
|
|
30
|
-
static fromWorldStateRevision(revision: WorldStateRevision, handle: any): WorldStateRevisionWithHandle;
|
|
31
|
-
static get schema(): z.ZodPipe<z.ZodObject<{
|
|
32
|
-
forkId: z.ZodNumber;
|
|
33
|
-
blockNumber: z.ZodNumber;
|
|
34
|
-
includeUncommitted: z.ZodBoolean;
|
|
35
|
-
handle: z.ZodAny;
|
|
36
|
-
}, z.core.$strip>, z.ZodTransform<WorldStateRevisionWithHandle, {
|
|
37
|
-
forkId: number;
|
|
38
|
-
blockNumber: number;
|
|
39
|
-
includeUncommitted: boolean;
|
|
40
|
-
handle: any;
|
|
41
|
-
}>>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ybGRfc3RhdGVfcmV2aXNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS93b3JsZF9zdGF0ZV9yZXZpc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLHFCQUFhLGtCQUFrQjthQVVYLE1BQU0sRUFBRSxNQUFNO2FBQ2QsV0FBVyxFQUFFLE1BQU07YUFDbkIsa0JBQWtCLEVBQUUsT0FBTztJQVg3Qzs7Ozs7T0FLRztJQUNILGdCQUF1QixNQUFNLGNBQWM7SUFFM0MsWUFDa0IsTUFBTSxFQUFFLE1BQU0sRUFDZCxXQUFXLEVBQUUsTUFBTSxFQUNuQixrQkFBa0IsRUFBRSxPQUFPLEVBQ3pDO0lBRUcsUUFBUSxXQUVkO0lBRUQsTUFBTSxDQUFDLEtBQUssdUJBRVg7SUFFRCxNQUFNLEtBQUssTUFBTTs7Ozs7Ozs7UUFXaEI7Q0FDRjtBQUVELHFCQUFhLDRCQUE2QixTQUFRLGtCQUFrQjthQUtoRCxNQUFNLEVBQUUsR0FBRztJQUo3QixZQUNFLE1BQU0sRUFBRSxNQUFNLEVBQ2QsV0FBVyxFQUFFLE1BQU0sRUFDbkIsa0JBQWtCLEVBQUUsT0FBTyxFQUNYLE1BQU0sRUFBRSxHQUFHLEVBRzVCO0lBRU0sb0JBQW9CLHVCQUUxQjtJQUVELE1BQU0sQ0FBQyxzQkFBc0IsQ0FBQyxRQUFRLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxFQUFFLEdBQUcsZ0NBRXRFO0lBRUQsV0FBb0IsTUFBTTs7Ozs7Ozs7OztRQVl6QjtDQUNGIn0=
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ybGRfc3RhdGVfcmV2aXNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93b3JsZC1zdGF0ZS93b3JsZF9zdGF0ZV9yZXZpc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLHFCQUFhLGtCQUFrQjthQVVYLE1BQU0sRUFBRSxNQUFNO2FBQ2QsV0FBVyxFQUFFLE1BQU07YUFDbkIsa0JBQWtCLEVBQUUsT0FBTztJQVg3Qzs7Ozs7T0FLRztJQUNILGdCQUF1QixNQUFNLGNBQWM7SUFFM0MsWUFDa0IsTUFBTSxFQUFFLE1BQU0sRUFDZCxXQUFXLEVBQUUsTUFBTSxFQUNuQixrQkFBa0IsRUFBRSxPQUFPLEVBQ3pDO0lBRUcsUUFBUSxXQUVkO0lBRUQsTUFBTSxDQUFDLEtBQUssdUJBRVg7SUFFRCxNQUFNLEtBQUssTUFBTTs7Ozs7Ozs7UUFXaEI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world_state_revision.d.ts","sourceRoot":"","sources":["../../src/world-state/world_state_revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qBAAa,kBAAkB;aAUX,MAAM,EAAE,MAAM;aACd,WAAW,EAAE,MAAM;aACnB,kBAAkB,EAAE,OAAO;IAX7C;;;;;OAKG;IACH,gBAAuB,MAAM,cAAc;IAE3C,YACkB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,OAAO,EACzC;IAEG,QAAQ,WAEd;IAED,MAAM,CAAC,KAAK,uBAEX;IAED,MAAM,KAAK,MAAM;;;;;;;;QAWhB;CACF
|
|
1
|
+
{"version":3,"file":"world_state_revision.d.ts","sourceRoot":"","sources":["../../src/world-state/world_state_revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qBAAa,kBAAkB;aAUX,MAAM,EAAE,MAAM;aACd,WAAW,EAAE,MAAM;aACnB,kBAAkB,EAAE,OAAO;IAX7C;;;;;OAKG;IACH,gBAAuB,MAAM,cAAc;IAE3C,YACkB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,OAAO,EACzC;IAEG,QAAQ,WAEd;IAED,MAAM,CAAC,KAAK,uBAEX;IAED,MAAM,KAAK,MAAM;;;;;;;;QAWhB;CACF"}
|
|
@@ -28,23 +28,3 @@ export class WorldStateRevision {
|
|
|
28
28
|
}).transform(({ forkId, blockNumber, includeUncommitted })=>new WorldStateRevision(forkId, blockNumber, includeUncommitted));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
export class WorldStateRevisionWithHandle extends WorldStateRevision {
|
|
32
|
-
handle;
|
|
33
|
-
constructor(forkId, blockNumber, includeUncommitted, handle){
|
|
34
|
-
super(forkId, blockNumber, includeUncommitted), this.handle = handle;
|
|
35
|
-
}
|
|
36
|
-
toWorldStateRevision() {
|
|
37
|
-
return new WorldStateRevision(this.forkId, this.blockNumber, this.includeUncommitted);
|
|
38
|
-
}
|
|
39
|
-
static fromWorldStateRevision(revision, handle) {
|
|
40
|
-
return new WorldStateRevisionWithHandle(revision.forkId, revision.blockNumber, revision.includeUncommitted, handle);
|
|
41
|
-
}
|
|
42
|
-
static get schema() {
|
|
43
|
-
return z.object({
|
|
44
|
-
forkId: z.number(),
|
|
45
|
-
blockNumber: z.number(),
|
|
46
|
-
includeUncommitted: z.boolean(),
|
|
47
|
-
handle: z.any()
|
|
48
|
-
}).transform(({ forkId, blockNumber, includeUncommitted, handle })=>new WorldStateRevisionWithHandle(forkId, blockNumber, includeUncommitted, handle));
|
|
49
|
-
}
|
|
50
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "6.0.0-nightly.
|
|
3
|
+
"version": "6.0.0-nightly.20260721",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "6.0.0-nightly.
|
|
96
|
-
"@aztec/blob-lib": "6.0.0-nightly.
|
|
97
|
-
"@aztec/constants": "6.0.0-nightly.
|
|
98
|
-
"@aztec/ethereum": "6.0.0-nightly.
|
|
99
|
-
"@aztec/foundation": "6.0.0-nightly.
|
|
100
|
-
"@aztec/l1-artifacts": "6.0.0-nightly.
|
|
101
|
-
"@aztec/noir-noirc_abi": "6.0.0-nightly.
|
|
95
|
+
"@aztec/bb.js": "6.0.0-nightly.20260721",
|
|
96
|
+
"@aztec/blob-lib": "6.0.0-nightly.20260721",
|
|
97
|
+
"@aztec/constants": "6.0.0-nightly.20260721",
|
|
98
|
+
"@aztec/ethereum": "6.0.0-nightly.20260721",
|
|
99
|
+
"@aztec/foundation": "6.0.0-nightly.20260721",
|
|
100
|
+
"@aztec/l1-artifacts": "6.0.0-nightly.20260721",
|
|
101
|
+
"@aztec/noir-noirc_abi": "6.0.0-nightly.20260721",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.15.1",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/buffer.ts
CHANGED
|
@@ -38,11 +38,23 @@ export function bufferAsFields(input: Buffer, targetLength: number): Fr[] {
|
|
|
38
38
|
* bytecode commitment computations to diverge from what the circuit produced.
|
|
39
39
|
*
|
|
40
40
|
* @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
|
|
41
|
+
* @param maxByteLength - Optional upper bound on the declared byte length. When the field array comes
|
|
42
|
+
* from untrusted input (e.g. a gossiped contract-class log), pass the payload capacity so an
|
|
43
|
+
* attacker-declared length cannot force a large `Buffer.alloc` before the value is otherwise
|
|
44
|
+
* rejected. Throws if the declared length exceeds it, before allocating.
|
|
41
45
|
* @returns A buffer of exactly `byteLength` bytes.
|
|
42
46
|
*/
|
|
43
|
-
export function bufferFromFields(fields: Fr[]): Buffer {
|
|
47
|
+
export function bufferFromFields(fields: Fr[], maxByteLength?: number): Buffer {
|
|
48
|
+
// A valid bufferAsFields output always has at least the leading byte-length field, so an empty
|
|
49
|
+
// input encodes no data. Guard so `length` (the destructured head) is never undefined.
|
|
50
|
+
if (fields.length === 0) {
|
|
51
|
+
return Buffer.alloc(0);
|
|
52
|
+
}
|
|
44
53
|
const [length, ...payload] = fields;
|
|
45
54
|
const byteLength = length.toNumber();
|
|
55
|
+
if (maxByteLength !== undefined && byteLength > maxByteLength) {
|
|
56
|
+
throw new Error(`Declared byte length ${byteLength} exceeds maximum ${maxByteLength}`);
|
|
57
|
+
}
|
|
46
58
|
const raw = Buffer.concat(payload.map(f => f.toBuffer().subarray(1)));
|
|
47
59
|
if (raw.length >= byteLength) {
|
|
48
60
|
return raw.subarray(0, byteLength);
|
package/src/avm/avm.ts
CHANGED
|
@@ -1152,7 +1152,7 @@ export class CallStackMetadata {
|
|
|
1152
1152
|
|
|
1153
1153
|
const { stack, leaf } = failingCall;
|
|
1154
1154
|
const aztecCallStack = stack.map(call => ({
|
|
1155
|
-
contractAddress: AztecAddress.
|
|
1155
|
+
contractAddress: AztecAddress.fromFieldUnsafe(call.contractAddress),
|
|
1156
1156
|
functionSelector: call.calldata.length > 0 ? FunctionSelector.fromFieldOrUndefined(call.calldata[0]) : undefined,
|
|
1157
1157
|
}));
|
|
1158
1158
|
|
package/src/avm/index.ts
CHANGED
|
@@ -3,10 +3,5 @@ export * from './avm_accumulated_data.js';
|
|
|
3
3
|
export * from './avm_circuit_public_inputs.js';
|
|
4
4
|
export * from './revert_code.js';
|
|
5
5
|
export * from './public_data_write.js';
|
|
6
|
-
export * from './public_data_update_request.js';
|
|
7
|
-
export * from './contract_storage_update_request.js';
|
|
8
|
-
export * from './contract_storage_read.js';
|
|
9
|
-
export * from './public_inner_call_request.js';
|
|
10
|
-
export * from './public_call_stack_item_compressed.js';
|
|
11
6
|
export * from './avm_proving_request.js';
|
|
12
7
|
export * from './message_pack.js';
|
|
@@ -43,34 +43,64 @@ export class AztecAddress {
|
|
|
43
43
|
static ZERO = new AztecAddress(Buffer.alloc(32, 0));
|
|
44
44
|
|
|
45
45
|
/** Null msg sender address. Not part of the protocol contracts tree. */
|
|
46
|
-
static NULL_MSG_SENDER = AztecAddress.
|
|
46
|
+
static NULL_MSG_SENDER = AztecAddress.fromBigIntUnsafe(NULL_MSG_SENDER_CONTRACT_ADDRESS);
|
|
47
47
|
|
|
48
48
|
static zero(): AztecAddress {
|
|
49
49
|
return AztecAddress.ZERO;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Builds an `AztecAddress` from a field **without checking it is a valid address** (the x-coordinate of a point on
|
|
54
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
55
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
56
|
+
*/
|
|
57
|
+
static fromFieldUnsafe(fr: Fr) {
|
|
53
58
|
return new AztecAddress(fr);
|
|
54
59
|
}
|
|
55
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Deserializes an `AztecAddress` from a buffer. It does **not** check the value is a valid Grumpkin-curve address
|
|
63
|
+
* (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized data. Use
|
|
64
|
+
* {@link AztecAddress.random} for valid test addresses.
|
|
65
|
+
*/
|
|
56
66
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
57
67
|
return new AztecAddress(fromBuffer(buffer, Fr));
|
|
58
68
|
}
|
|
59
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Deserializes an `AztecAddress` from a field reader. It does **not** check the value is a valid Grumpkin-curve
|
|
72
|
+
* address (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized
|
|
73
|
+
* data. Use {@link AztecAddress.random} for valid test addresses.
|
|
74
|
+
*/
|
|
60
75
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
61
76
|
const reader = FieldReader.asReader(fields);
|
|
62
77
|
return new AztecAddress(reader.readField());
|
|
63
78
|
}
|
|
64
79
|
|
|
65
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Builds an `AztecAddress` from a bigint **without checking it is a valid address** (the x-coordinate of a point on
|
|
82
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
83
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
84
|
+
*/
|
|
85
|
+
static fromBigIntUnsafe(value: bigint) {
|
|
66
86
|
return new AztecAddress(new Fr(value));
|
|
67
87
|
}
|
|
68
88
|
|
|
69
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Builds an `AztecAddress` from a number **without checking it is a valid address** (the x-coordinate of a point on
|
|
91
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
92
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
93
|
+
*/
|
|
94
|
+
static fromNumberUnsafe(value: number) {
|
|
70
95
|
return new AztecAddress(new Fr(value));
|
|
71
96
|
}
|
|
72
97
|
|
|
73
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Builds an `AztecAddress` from a hex string **without checking it is a valid address** (the x-coordinate of a
|
|
100
|
+
* point on the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to
|
|
101
|
+
* validate an untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
102
|
+
*/
|
|
103
|
+
static fromStringUnsafe(buf: string) {
|
|
74
104
|
return new AztecAddress(hexToBuffer(buf));
|
|
75
105
|
}
|
|
76
106
|
|
|
@@ -89,7 +119,7 @@ export class AztecAddress {
|
|
|
89
119
|
if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
|
|
90
120
|
return new AztecAddress(obj);
|
|
91
121
|
}
|
|
92
|
-
return AztecAddress.
|
|
122
|
+
return AztecAddress.fromStringUnsafe(obj);
|
|
93
123
|
}
|
|
94
124
|
|
|
95
125
|
/**
|
|
@@ -60,9 +60,14 @@ export function getAttestationInfoFromPayload(
|
|
|
60
60
|
return { address: attestation.address, status: 'provided-as-address' as const };
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Try to recover address from signature
|
|
63
|
+
// Try to recover address from signature. Recover with default opts (no allowYParityAsV): a slot
|
|
64
|
+
// whose recovery byte is in yParity form (v ∈ {0, 1}) is judged invalid here, matching L1 proving
|
|
65
|
+
// (ValidatorSelectionLib.verifyAttestations → ECDSA.recover only accepts v ∈ {27, 28}). A malicious
|
|
66
|
+
// proposer that lands such a slot cannot have it silently treated as valid off-chain; it is routed to
|
|
67
|
+
// invalid-attestation and invalidated. The gossip receipt path (recoverCoordinationSigner) stays
|
|
68
|
+
// lenient with allowYParityAsV; A-1351 normalizes on pool ingress and before the L1 bundle.
|
|
64
69
|
try {
|
|
65
|
-
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature
|
|
70
|
+
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
|
|
66
71
|
return { address: recoveredAddress, status: 'recovered-from-signature' as const };
|
|
67
72
|
} catch {
|
|
68
73
|
// Signature present but recovery failed
|
|
@@ -63,8 +63,18 @@ export type CheckpointQuery =
|
|
|
63
63
|
| { slot: SlotNumber }
|
|
64
64
|
| { tag: 'checkpointed' | 'proven' | 'finalized' };
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Query a range of confirmed checkpoints by start/limit, by slot anchor, or by epoch.
|
|
68
|
+
*
|
|
69
|
+
* The `fromSlot` variant walks the slot index: it returns up to `limit` checkpoints anchored at
|
|
70
|
+
* `fromSlot`, ordered nearest-first. With `reverse` it takes the checkpoints at or before the slot
|
|
71
|
+
* (descending); otherwise the checkpoints at or after it (ascending). Use `limit: 1, reverse: true`
|
|
72
|
+
* to find the latest checkpoint at or before a slot in a single range scan.
|
|
73
|
+
*/
|
|
74
|
+
export type CheckpointsQuery =
|
|
75
|
+
| { from: CheckpointNumber; limit: number }
|
|
76
|
+
| { fromSlot: SlotNumber; limit: number; reverse?: boolean }
|
|
77
|
+
| { epoch: EpochNumber };
|
|
68
78
|
|
|
69
79
|
/**
|
|
70
80
|
* Lookup a proposed (archiver-internal, not-yet-L1-confirmed) checkpoint.
|
|
@@ -81,6 +91,7 @@ export const CheckpointQuerySchema: z.ZodType<CheckpointQuery, unknown> = z.unio
|
|
|
81
91
|
|
|
82
92
|
export const CheckpointsQuerySchema: z.ZodType<CheckpointsQuery, unknown> = z.union([
|
|
83
93
|
z.object({ from: CheckpointNumberSchema, limit: z.number().int().min(1) }).strict(),
|
|
94
|
+
z.object({ fromSlot: SlotNumberSchema, limit: z.number().int().min(1), reverse: z.boolean().optional() }).strict(),
|
|
84
95
|
z.object({ epoch: EpochNumberSchema }).strict(),
|
|
85
96
|
]);
|
|
86
97
|
|
|
@@ -241,7 +252,10 @@ export interface L2BlockSource {
|
|
|
241
252
|
|
|
242
253
|
/**
|
|
243
254
|
* Looks up a proposed (archiver-internal, not-yet-L1-confirmed) checkpoint.
|
|
244
|
-
* Returns the latest proposed entry when called with no args or `{ tag: 'proposed' }
|
|
255
|
+
* Returns the latest proposed entry when called with no args or `{ tag: 'proposed' }`; since a
|
|
256
|
+
* proposed entry can only be stored with a checkpoint number beyond the confirmed frontier (and is
|
|
257
|
+
* deleted on confirmation), the latest entry is always the leading one. Callers derive the proposed
|
|
258
|
+
* tip from the payload (checkpoint number, and last block `startBlock + blockCount - 1`).
|
|
245
259
|
* With `{ number }` or `{ slot }`, returns the matching entry or undefined.
|
|
246
260
|
* Never falls back to confirmed checkpoints.
|
|
247
261
|
*/
|
|
@@ -321,36 +335,37 @@ export type ArchiverEmitter = TypedEventEmitter<{
|
|
|
321
335
|
[L2BlockSourceEvents.DescendentOfInvalidAttestationsCheckpointDetected]: (
|
|
322
336
|
args: DescendentOfInvalidAttestationsCheckpointEvent,
|
|
323
337
|
) => void;
|
|
338
|
+
[L2BlockSourceEvents.L2BlockSourceUpdated]: (args: L2BlockSourceUpdatedEvent) => void;
|
|
324
339
|
}>;
|
|
325
340
|
export interface L2BlockSourceEventEmitter extends L2BlockSource {
|
|
326
341
|
events: ArchiverEmitter;
|
|
327
342
|
}
|
|
328
343
|
|
|
329
344
|
/**
|
|
330
|
-
* Identifier for L2 block tags. Internal counterpart to {@link BlockTag} that
|
|
331
|
-
*
|
|
332
|
-
* archiver side) and omits `latest` (which is an alias for `proposed` accepted only at
|
|
333
|
-
* the public RPC surface).
|
|
345
|
+
* Identifier for L2 block tags. Internal counterpart to {@link BlockTag} that omits `latest`
|
|
346
|
+
* (which is an alias for `proposed` accepted only at the public RPC surface).
|
|
334
347
|
*
|
|
335
348
|
* - proposed: Latest block proposed on L2.
|
|
336
|
-
* - proposedCheckpoint: Latest block in the most recent proposed checkpoint (archiver-internal).
|
|
337
349
|
* - checkpointed: Latest block whose enclosing checkpoint has been published on L1.
|
|
338
350
|
* - proven: Latest block whose enclosing checkpoint has been proven on L1.
|
|
339
351
|
* - finalized: Latest block whose proving L1 transaction has reached L1 finality.
|
|
340
|
-
*
|
|
341
|
-
* TODO(palla): Remove `proposedCheckpoint` and unify with `proposed`.
|
|
342
352
|
*/
|
|
343
|
-
export type L2BlockTag = 'proposed' | '
|
|
353
|
+
export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
344
354
|
|
|
345
355
|
/** Tips of the L2 chain. */
|
|
346
356
|
export type L2Tips = {
|
|
347
357
|
proposed: L2BlockId;
|
|
348
358
|
checkpointed: L2TipId;
|
|
349
|
-
proposedCheckpoint: L2TipId;
|
|
350
359
|
proven: L2TipId;
|
|
351
360
|
finalized: L2TipId;
|
|
352
361
|
};
|
|
353
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Tips of the L2 chain as tracked by a local provider (world-state, l2-tips-store). Identical to
|
|
365
|
+
* {@link L2Tips}; the alias is retained for call sites that document a local-only provenance.
|
|
366
|
+
*/
|
|
367
|
+
export type LocalL2Tips = L2Tips;
|
|
368
|
+
|
|
354
369
|
export const GENESIS_CHECKPOINT_HEADER_HASH = CheckpointHeader.empty().hash();
|
|
355
370
|
|
|
356
371
|
/** Identifies a block by number and hash. */
|
|
@@ -373,6 +388,28 @@ export function makeL2CheckpointId(number: CheckpointNumber, hash: string): Chec
|
|
|
373
388
|
return { number, hash };
|
|
374
389
|
}
|
|
375
390
|
|
|
391
|
+
function l2BlockIdEquals(a: L2BlockId, b: L2BlockId): boolean {
|
|
392
|
+
return a.number === b.number && a.hash === b.hash;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function l2TipIdEquals(a: L2TipId, b: L2TipId): boolean {
|
|
396
|
+
return (
|
|
397
|
+
l2BlockIdEquals(a.block, b.block) &&
|
|
398
|
+
a.checkpoint.number === b.checkpoint.number &&
|
|
399
|
+
a.checkpoint.hash === b.checkpoint.hash
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** Returns whether two {@link L2Tips} snapshots agree on every tier (proposed, checkpointed, proven, finalized). */
|
|
404
|
+
export function l2TipsEqual(a: L2Tips, b: L2Tips): boolean {
|
|
405
|
+
return (
|
|
406
|
+
l2BlockIdEquals(a.proposed, b.proposed) &&
|
|
407
|
+
l2TipIdEquals(a.checkpointed, b.checkpointed) &&
|
|
408
|
+
l2TipIdEquals(a.proven, b.proven) &&
|
|
409
|
+
l2TipIdEquals(a.finalized, b.finalized)
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
|
|
376
413
|
const L2BlockIdSchema = z.object({
|
|
377
414
|
number: BlockNumberSchema,
|
|
378
415
|
hash: z.string(),
|
|
@@ -391,7 +428,6 @@ const L2TipIdSchema = z.object({
|
|
|
391
428
|
export const L2TipsSchema = z.object({
|
|
392
429
|
proposed: L2BlockIdSchema,
|
|
393
430
|
checkpointed: L2TipIdSchema,
|
|
394
|
-
proposedCheckpoint: L2TipIdSchema,
|
|
395
431
|
proven: L2TipIdSchema,
|
|
396
432
|
finalized: L2TipIdSchema,
|
|
397
433
|
});
|
|
@@ -404,8 +440,26 @@ export enum L2BlockSourceEvents {
|
|
|
404
440
|
InvalidAttestationsCheckpointDetected = 'invalidCheckpointDetected',
|
|
405
441
|
CheckpointEquivocationDetected = 'checkpointEquivocationDetected',
|
|
406
442
|
DescendentOfInvalidAttestationsCheckpointDetected = 'descendentOfInvalidAttestationsCheckpointDetected',
|
|
443
|
+
L2BlockSourceUpdated = 'l2BlockSourceUpdated',
|
|
407
444
|
}
|
|
408
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Aggregate event emitted once per committed archiver sync pass that mutated local state. Carries the chain tips
|
|
448
|
+
* before and after the pass, and the blocks added during it. Consumers compare `fromTips` and `toTips` to learn what
|
|
449
|
+
* moved; there is no separate `changed` section.
|
|
450
|
+
*
|
|
451
|
+
* This is an optimization signal that lets a block stream reconcile immediately on an archiver update rather than
|
|
452
|
+
* waiting for its next poll. Polling remains the correctness fallback, so a missed event only affects latency.
|
|
453
|
+
* `blocksAdded` are hydrated blocks already in hand from the sync pass, so a triggered sync that is caught up to
|
|
454
|
+
* `fromTips` can reuse them (and `toTips`) instead of re-reading the store.
|
|
455
|
+
*/
|
|
456
|
+
export type L2BlockSourceUpdatedEvent = {
|
|
457
|
+
type: 'l2BlockSourceUpdated';
|
|
458
|
+
fromTips: L2Tips;
|
|
459
|
+
toTips: L2Tips;
|
|
460
|
+
blocksAdded: readonly L2Block[];
|
|
461
|
+
};
|
|
462
|
+
|
|
409
463
|
export type L2BlockProvenEvent = {
|
|
410
464
|
type: 'l2BlockProven';
|
|
411
465
|
blockNumber: BlockNumber;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
3
|
+
|
|
4
|
+
import type { BlockData } from '../block_data.js';
|
|
5
|
+
import type { L2Block } from '../l2_block.js';
|
|
6
|
+
import {
|
|
7
|
+
type ArchiverEmitter,
|
|
8
|
+
type BlockQuery,
|
|
9
|
+
type BlocksQuery,
|
|
10
|
+
type L2BlockSource,
|
|
11
|
+
type L2BlockSourceEventEmitter,
|
|
12
|
+
L2BlockSourceEvents,
|
|
13
|
+
type L2BlockSourceUpdatedEvent,
|
|
14
|
+
type L2Tips,
|
|
15
|
+
} from '../l2_block_source.js';
|
|
16
|
+
import { type L2BlockStreamEventHandler, type L2BlockStreamLocalDataProvider, localTipsMatch } from './interfaces.js';
|
|
17
|
+
import { L2BlockStream, type L2BlockStreamOptions, type L2BlockStreamSource } from './l2_block_stream.js';
|
|
18
|
+
|
|
19
|
+
/** Derives the metadata-only {@link BlockData} view of a hydrated {@link L2Block}. */
|
|
20
|
+
async function l2BlockToBlockData(block: L2Block): Promise<BlockData> {
|
|
21
|
+
return {
|
|
22
|
+
header: block.header,
|
|
23
|
+
archive: block.archive,
|
|
24
|
+
blockHash: await block.hash(),
|
|
25
|
+
checkpointNumber: block.checkpointNumber,
|
|
26
|
+
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Returns the event emitter of a source that exposes one, or undefined for plain (e.g. RPC-backed) sources. */
|
|
31
|
+
function getEmitter(source: L2BlockSource | L2BlockSourceEventEmitter): ArchiverEmitter | undefined {
|
|
32
|
+
return 'events' in source ? source.events : undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Fast-path context for a single sync pass: blocks to serve by number, plus the tips to report as the source's. */
|
|
36
|
+
type ActiveUpdate = { byNumber: Map<number, L2Block>; toTips: L2Tips };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Wraps a block source so a single sync pass can be served from blocks delivered by an aggregate update event,
|
|
40
|
+
* avoiding round-trips to archiver storage. The fast path is only armed (via {@link activate}) for a pass that is
|
|
41
|
+
* confirmed caught up to the event's pre-pass tips: in that case the event's `blocksAdded` contiguously cover the
|
|
42
|
+
* pass's download range and `toTips` is the exact post-pass tip, so `getL2Tips` can report it without querying the
|
|
43
|
+
* source. When the fast path is not armed, every read delegates to the source, so a stale or partial cache never
|
|
44
|
+
* changes the sync outcome.
|
|
45
|
+
*/
|
|
46
|
+
class HotBlockSourceAdapter implements L2BlockStreamSource {
|
|
47
|
+
/** Set for the duration of one fast-path pass; undefined when reads must delegate to the source. */
|
|
48
|
+
private active: ActiveUpdate | undefined;
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
private readonly source: L2BlockStreamSource,
|
|
52
|
+
private readonly log: Logger,
|
|
53
|
+
) {}
|
|
54
|
+
|
|
55
|
+
/** Arms the fast path for the current pass: serve these blocks and report `toTips` as the source tips. */
|
|
56
|
+
public activate(blocks: readonly L2Block[], toTips: L2Tips): void {
|
|
57
|
+
const byNumber = new Map<number, L2Block>();
|
|
58
|
+
for (const block of blocks) {
|
|
59
|
+
byNumber.set(block.number, block);
|
|
60
|
+
}
|
|
61
|
+
this.active = { byNumber, toTips };
|
|
62
|
+
this.log.trace(`Armed hot-block fast path`, { blocks: byNumber.size, toTips });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Disarms the fast path so subsequent reads delegate to the source again. */
|
|
66
|
+
public deactivate(): void {
|
|
67
|
+
this.active = undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public getL2Tips(): Promise<L2Tips> {
|
|
71
|
+
return this.active ? Promise.resolve(this.active.toTips) : this.source.getL2Tips();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public getBlocks(query: BlocksQuery): Promise<L2Block[]> {
|
|
75
|
+
const served = this.active ? this.tryServeBlocksFromCache(query) : undefined;
|
|
76
|
+
return served ? Promise.resolve(served) : this.source.getBlocks(query);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public getBlockData(query: BlockQuery): Promise<BlockData | undefined> {
|
|
80
|
+
if (this.active && 'number' in query) {
|
|
81
|
+
const block = this.active.byNumber.get(query.number);
|
|
82
|
+
if (block) {
|
|
83
|
+
return l2BlockToBlockData(block);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return this.source.getBlockData(query);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Serves a block range from the cache only when it is fully covered by contiguous cached blocks. */
|
|
90
|
+
private tryServeBlocksFromCache(query: BlocksQuery): L2Block[] | undefined {
|
|
91
|
+
// Only the by-range form is cacheable, and only for the full (not checkpointed-only) chain: the cache may hold
|
|
92
|
+
// uncheckpointed blocks that an onlyCheckpointed query must not receive.
|
|
93
|
+
if (!this.active || !('from' in query) || query.onlyCheckpointed) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
const from = query.from;
|
|
97
|
+
const to = from + query.limit - 1;
|
|
98
|
+
const blocks: L2Block[] = [];
|
|
99
|
+
for (let n = from; n <= to; n++) {
|
|
100
|
+
const block = this.active.byNumber.get(n);
|
|
101
|
+
if (!block) {
|
|
102
|
+
// A gap inside the requested range: bail out and let the source serve the whole range.
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
blocks.push(block);
|
|
106
|
+
}
|
|
107
|
+
return blocks;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Event-driven wrapper around {@link L2BlockStream}. Subscribes to the source's aggregate `l2BlockSourceUpdated`
|
|
113
|
+
* event (when the source exposes one) to trigger an immediate reconciliation, while keeping the periodic poll as
|
|
114
|
+
* the correctness fallback. Subsystems keep consuming the same {@link L2BlockStreamEvent}s; the archiver aggregate
|
|
115
|
+
* event is handled entirely here.
|
|
116
|
+
*
|
|
117
|
+
* The event is passed through to the sync pass via {@link RunningPromise.trigger}. If, at the time the pass runs,
|
|
118
|
+
* the stream's local tips match the event's `fromTips` (it is caught up to where the event began), the event's
|
|
119
|
+
* hydrated blocks are served back through a hot-block cache and the event's `toTips` is reported as the source tips
|
|
120
|
+
* — so the triggered sync re-reads neither block bodies nor tips from the archiver. Otherwise the pass delegates
|
|
121
|
+
* entirely to the source, and the periodic poll guarantees eventual catch-up.
|
|
122
|
+
*/
|
|
123
|
+
export class EventDrivenL2BlockStream {
|
|
124
|
+
private readonly adapter: HotBlockSourceAdapter;
|
|
125
|
+
private readonly blockStream: L2BlockStream;
|
|
126
|
+
private readonly runningPromise: RunningPromise<L2BlockSourceUpdatedEvent>;
|
|
127
|
+
private readonly emitter: ArchiverEmitter | undefined;
|
|
128
|
+
private started = false;
|
|
129
|
+
|
|
130
|
+
private readonly onSourceUpdated = (event: L2BlockSourceUpdatedEvent) => {
|
|
131
|
+
// Fire-and-forget: trigger coalesces with any in-flight or periodic pass (see RunningPromise.trigger), so a
|
|
132
|
+
// burst of events does not run passes concurrently. Errors are swallowed by the inner stream's own handler.
|
|
133
|
+
void this.runningPromise
|
|
134
|
+
.trigger(event)
|
|
135
|
+
.catch(err => this.log.error(`Error in event-triggered block stream sync`, err));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
constructor(
|
|
139
|
+
source: L2BlockSource | L2BlockSourceEventEmitter,
|
|
140
|
+
private readonly localData: L2BlockStreamLocalDataProvider,
|
|
141
|
+
handler: L2BlockStreamEventHandler,
|
|
142
|
+
private readonly log = createLogger('types:event_driven_block_stream'),
|
|
143
|
+
opts: L2BlockStreamOptions = {},
|
|
144
|
+
) {
|
|
145
|
+
this.adapter = new HotBlockSourceAdapter(source, log);
|
|
146
|
+
// The inner stream's own RunningPromise is never started; this wrapper owns the polling loop and drives the
|
|
147
|
+
// stream through `sync()` (which runs `work()` directly when the inner loop is stopped).
|
|
148
|
+
this.blockStream = new L2BlockStream(this.adapter, localData, handler, log, opts);
|
|
149
|
+
this.runningPromise = new RunningPromise<L2BlockSourceUpdatedEvent>(
|
|
150
|
+
this.runPass.bind(this),
|
|
151
|
+
log,
|
|
152
|
+
opts.pollIntervalMS ?? 1000,
|
|
153
|
+
);
|
|
154
|
+
this.emitter = getEmitter(source);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public start(): void {
|
|
158
|
+
if (this.started) {
|
|
159
|
+
this.log.warn(`Attempted to start an already-started event-driven block stream`);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.started = true;
|
|
163
|
+
this.emitter?.on(L2BlockSourceEvents.L2BlockSourceUpdated, this.onSourceUpdated);
|
|
164
|
+
this.runningPromise.start();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public async stop(): Promise<void> {
|
|
168
|
+
this.started = false;
|
|
169
|
+
this.emitter?.off(L2BlockSourceEvents.L2BlockSourceUpdated, this.onSourceUpdated);
|
|
170
|
+
await this.runningPromise.stop();
|
|
171
|
+
await this.blockStream.stop();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public isRunning(): boolean {
|
|
175
|
+
return this.runningPromise.isRunning();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Runs a synchronization pass now, bypassing the poll interval, and resolves once that pass completes. Concurrent
|
|
180
|
+
* callers and periodic ticks coalesce onto a single pass; a caller that coalesces onto an already in-flight pass
|
|
181
|
+
* can resolve against a pass that began just before it, so this guarantees freshness only up to that coalescing
|
|
182
|
+
* window. The periodic poll and per-pass reorg handling make the gap a latency effect, never a correctness one.
|
|
183
|
+
*/
|
|
184
|
+
public sync(): Promise<void> {
|
|
185
|
+
return this.runningPromise.trigger();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Runs a single pass over the underlying block stream. When triggered by an aggregate event and the stream is
|
|
190
|
+
* caught up to the event's pre-pass tips, the event's blocks and tips serve the pass directly; the fast path is
|
|
191
|
+
* always disarmed afterwards so a subsequent poll-driven pass reads from the source.
|
|
192
|
+
*/
|
|
193
|
+
private async runPass(event?: L2BlockSourceUpdatedEvent): Promise<void> {
|
|
194
|
+
if (event) {
|
|
195
|
+
const localTips = await this.localData.getL2Tips();
|
|
196
|
+
if (localTipsMatch(localTips, event.fromTips)) {
|
|
197
|
+
this.adapter.activate(event.blocksAdded, event.toTips);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
await this.blockStream.sync();
|
|
203
|
+
} finally {
|
|
204
|
+
this.adapter.deactivate();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|