@aztec/stdlib 6.0.0-nightly.20260605 → 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
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
GENESIS_CHECKPOINT_HEADER_HASH,
|
|
7
7
|
L2Block,
|
|
8
8
|
type L2BlockId,
|
|
9
|
+
type L2BlockTag,
|
|
9
10
|
type L2TipId,
|
|
10
11
|
} from '@aztec/stdlib/block';
|
|
11
12
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -67,18 +68,11 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
67
68
|
checkpoint: makeCheckpointIdForBlock(blockNumber),
|
|
68
69
|
});
|
|
69
70
|
|
|
70
|
-
const makeTips = (
|
|
71
|
-
proposed: number,
|
|
72
|
-
proven: number,
|
|
73
|
-
finalized: number,
|
|
74
|
-
checkpointed: number = 0,
|
|
75
|
-
proposedCheckpoint: number = 0,
|
|
76
|
-
) => ({
|
|
71
|
+
const makeTips = (proposed: number, proven: number, finalized: number, checkpointed: number = 0) => ({
|
|
77
72
|
proposed: makeTip(proposed),
|
|
78
73
|
proven: makeTipId(proven),
|
|
79
74
|
finalized: makeTipId(finalized),
|
|
80
75
|
checkpointed: makeTipId(checkpointed),
|
|
81
|
-
proposedCheckpoint: makeTipId(proposedCheckpoint),
|
|
82
76
|
});
|
|
83
77
|
|
|
84
78
|
const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
|
|
@@ -100,14 +94,18 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
100
94
|
return new PublishedCheckpoint(checkpoint, L1PublishedData.random(), []);
|
|
101
95
|
};
|
|
102
96
|
|
|
103
|
-
/** Creates a chain-checkpointed event
|
|
104
|
-
const makeCheckpointedEvent = async (
|
|
105
|
-
const lastBlock =
|
|
97
|
+
/** Creates a thin chain-checkpointed event carrying the block + checkpoint ids of the checkpoint's last block. */
|
|
98
|
+
const makeCheckpointedEvent = async (published: PublishedCheckpoint) => {
|
|
99
|
+
const lastBlock = published.checkpoint.blocks.at(-1)!;
|
|
106
100
|
const blockId: L2BlockId = {
|
|
107
101
|
number: lastBlock.number,
|
|
108
102
|
hash: (await lastBlock.hash()).toString(),
|
|
109
103
|
};
|
|
110
|
-
|
|
104
|
+
const checkpointId = {
|
|
105
|
+
number: published.checkpoint.number,
|
|
106
|
+
hash: published.checkpoint.hash().toString(),
|
|
107
|
+
};
|
|
108
|
+
return { type: 'chain-checkpointed' as const, checkpoint: checkpointId, block: blockId };
|
|
111
109
|
};
|
|
112
110
|
|
|
113
111
|
it('returns zero if no tips are stored', async () => {
|
|
@@ -129,6 +127,71 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
129
127
|
expect(await tipsStore.getL2BlockHash(3)).toEqual(blockHashes.get(3));
|
|
130
128
|
});
|
|
131
129
|
|
|
130
|
+
it('records the proposed tip number and hash from a chain-proposed event', async () => {
|
|
131
|
+
// chain-proposed is the sole writer of proposed-tip history in tips-only mode: no preceding blocks-added.
|
|
132
|
+
await tipsStore.handleBlockStreamEvent({
|
|
133
|
+
type: 'chain-proposed',
|
|
134
|
+
block: { number: BlockNumber(5), hash: new Fr(500).toString() },
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const tips = await tipsStore.getL2Tips();
|
|
138
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(5), hash: new Fr(500).toString() });
|
|
139
|
+
// The hash is recorded in the same index the walk-back reads, so it resolves as a sparse anchor.
|
|
140
|
+
expect(await tipsStore.getL2BlockHash(5)).toEqual(new Fr(500).toString());
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('serves sparse proposed anchors from chain-proposed events for the walk-back', async () => {
|
|
144
|
+
// Two tip-moving polls in tips-only mode, with no blocks in between (sparse history).
|
|
145
|
+
await tipsStore.handleBlockStreamEvent({
|
|
146
|
+
type: 'chain-proposed',
|
|
147
|
+
block: { number: BlockNumber(4), hash: new Fr(400).toString() },
|
|
148
|
+
});
|
|
149
|
+
await tipsStore.handleBlockStreamEvent({
|
|
150
|
+
type: 'chain-proposed',
|
|
151
|
+
block: { number: BlockNumber(9), hash: new Fr(900).toString() },
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Both recorded heights resolve; the heights between them were never seen and stay undefined.
|
|
155
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(new Fr(400).toString());
|
|
156
|
+
expect(await tipsStore.getL2BlockHash(9)).toEqual(new Fr(900).toString());
|
|
157
|
+
expect(await tipsStore.getL2BlockHash(6)).toBeUndefined();
|
|
158
|
+
|
|
159
|
+
const tips = await tipsStore.getL2Tips();
|
|
160
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(9), hash: new Fr(900).toString() });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('records block-hash witnesses without moving any tip cursor', async () => {
|
|
164
|
+
// Establish a proposed tip at 9 in tips-only fashion (sole writer of proposed history).
|
|
165
|
+
await tipsStore.handleBlockStreamEvent({
|
|
166
|
+
type: 'chain-proposed',
|
|
167
|
+
block: { number: BlockNumber(9), hash: new Fr(900).toString() },
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Record sparse witnesses at heights below the tip (e.g. a consumer materializing per-height state).
|
|
171
|
+
await tipsStore.recordBlockHashes([
|
|
172
|
+
{ number: BlockNumber(4), hash: new Fr(404).toString() },
|
|
173
|
+
{ number: BlockNumber(6), hash: new Fr(606).toString() },
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
// Each recorded height resolves; an unrecorded gap stays undefined.
|
|
177
|
+
expect(await tipsStore.getL2BlockHash(4)).toEqual(new Fr(404).toString());
|
|
178
|
+
expect(await tipsStore.getL2BlockHash(6)).toEqual(new Fr(606).toString());
|
|
179
|
+
expect(await tipsStore.getL2BlockHash(5)).toBeUndefined();
|
|
180
|
+
|
|
181
|
+
// No tip cursor moved: the proposed tip is still 9, and every other tier is at genesis.
|
|
182
|
+
const tips = await tipsStore.getL2Tips();
|
|
183
|
+
expect(tips.proposed).toEqual({ number: BlockNumber(9), hash: new Fr(900).toString() });
|
|
184
|
+
expect(tips.checkpointed.block).toEqual(makeTip(0));
|
|
185
|
+
expect(tips.proven.block).toEqual(makeTip(0));
|
|
186
|
+
expect(tips.finalized.block).toEqual(makeTip(0));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('skips witnesses with no hash and tolerates an empty list', async () => {
|
|
190
|
+
await tipsStore.recordBlockHashes([]);
|
|
191
|
+
await tipsStore.recordBlockHashes([{ number: BlockNumber(3), hash: '' }]);
|
|
192
|
+
expect(await tipsStore.getL2BlockHash(3)).toBeUndefined();
|
|
193
|
+
});
|
|
194
|
+
|
|
132
195
|
it('checkpoints all proposed blocks', async () => {
|
|
133
196
|
// Propose blocks 1-5
|
|
134
197
|
const blocks = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
@@ -153,7 +216,11 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
153
216
|
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
154
217
|
|
|
155
218
|
// Prove up to block 5
|
|
156
|
-
await tipsStore.handleBlockStreamEvent({
|
|
219
|
+
await tipsStore.handleBlockStreamEvent({
|
|
220
|
+
type: 'chain-proven',
|
|
221
|
+
block: makeBlockId(5),
|
|
222
|
+
checkpoint: makeCheckpointIdForBlock(5),
|
|
223
|
+
});
|
|
157
224
|
|
|
158
225
|
const tips = await tipsStore.getL2Tips();
|
|
159
226
|
expect(tips.proposed).toEqual(makeTip(5));
|
|
@@ -173,8 +240,16 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
173
240
|
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
174
241
|
|
|
175
242
|
// Prove and finalize
|
|
176
|
-
await tipsStore.handleBlockStreamEvent({
|
|
177
|
-
|
|
243
|
+
await tipsStore.handleBlockStreamEvent({
|
|
244
|
+
type: 'chain-proven',
|
|
245
|
+
block: makeBlockId(5),
|
|
246
|
+
checkpoint: makeCheckpointIdForBlock(5),
|
|
247
|
+
});
|
|
248
|
+
await tipsStore.handleBlockStreamEvent({
|
|
249
|
+
type: 'chain-finalized',
|
|
250
|
+
block: makeBlockId(5),
|
|
251
|
+
checkpoint: makeCheckpointIdForBlock(5),
|
|
252
|
+
});
|
|
178
253
|
|
|
179
254
|
const tips = await tipsStore.getL2Tips();
|
|
180
255
|
expect(tips.proposed).toEqual(makeTip(5));
|
|
@@ -229,8 +304,16 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
229
304
|
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint2));
|
|
230
305
|
|
|
231
306
|
// Prove and finalize up to block 3 (checkpoint 1)
|
|
232
|
-
await tipsStore.handleBlockStreamEvent({
|
|
233
|
-
|
|
307
|
+
await tipsStore.handleBlockStreamEvent({
|
|
308
|
+
type: 'chain-proven',
|
|
309
|
+
block: makeBlockId(3),
|
|
310
|
+
checkpoint: makeCheckpointIdForBlock(3),
|
|
311
|
+
});
|
|
312
|
+
await tipsStore.handleBlockStreamEvent({
|
|
313
|
+
type: 'chain-finalized',
|
|
314
|
+
block: makeBlockId(3),
|
|
315
|
+
checkpoint: makeCheckpointIdForBlock(3),
|
|
316
|
+
});
|
|
234
317
|
|
|
235
318
|
// Blocks before finalized should be cleared
|
|
236
319
|
expect(await tipsStore.getL2BlockHash(1)).toBeUndefined();
|
|
@@ -250,7 +333,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
250
333
|
await tipsStore.handleBlockStreamEvent({
|
|
251
334
|
type: 'chain-pruned',
|
|
252
335
|
block: makeBlockId(5),
|
|
253
|
-
|
|
336
|
+
checkpointed: makeTipId(0),
|
|
337
|
+
proven: makeTipId(0),
|
|
254
338
|
});
|
|
255
339
|
|
|
256
340
|
const tips = await tipsStore.getL2Tips();
|
|
@@ -274,7 +358,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
274
358
|
await tipsStore.handleBlockStreamEvent({
|
|
275
359
|
type: 'chain-pruned',
|
|
276
360
|
block: makeTip(0),
|
|
277
|
-
|
|
361
|
+
checkpointed: makeTipId(0),
|
|
362
|
+
proven: makeTipId(0),
|
|
278
363
|
});
|
|
279
364
|
|
|
280
365
|
tips = await tipsStore.getL2Tips();
|
|
@@ -339,7 +424,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
339
424
|
await tipsStore.handleBlockStreamEvent({
|
|
340
425
|
type: 'chain-pruned',
|
|
341
426
|
block: makeBlockId(5),
|
|
342
|
-
|
|
427
|
+
checkpointed: makeTipId(5),
|
|
428
|
+
proven: makeTipId(0),
|
|
343
429
|
});
|
|
344
430
|
|
|
345
431
|
tips = await tipsStore.getL2Tips();
|
|
@@ -403,7 +489,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
403
489
|
await tipsStore.handleBlockStreamEvent({
|
|
404
490
|
type: 'chain-pruned',
|
|
405
491
|
block: makeBlockId(3),
|
|
406
|
-
|
|
492
|
+
checkpointed: makeTipId(3),
|
|
493
|
+
proven: makeTipId(0),
|
|
407
494
|
});
|
|
408
495
|
|
|
409
496
|
tips = await tipsStore.getL2Tips();
|
|
@@ -440,7 +527,11 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
440
527
|
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
441
528
|
|
|
442
529
|
// Prove up to block 3
|
|
443
|
-
await tipsStore.handleBlockStreamEvent({
|
|
530
|
+
await tipsStore.handleBlockStreamEvent({
|
|
531
|
+
type: 'chain-proven',
|
|
532
|
+
block: makeBlockId(3),
|
|
533
|
+
checkpoint: makeCheckpointIdForBlock(3),
|
|
534
|
+
});
|
|
444
535
|
|
|
445
536
|
let tips = await tipsStore.getL2Tips();
|
|
446
537
|
expect(tips.proposed).toEqual(makeTip(3));
|
|
@@ -481,7 +572,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
481
572
|
await tipsStore.handleBlockStreamEvent({
|
|
482
573
|
type: 'chain-pruned',
|
|
483
574
|
block: makeBlockId(3),
|
|
484
|
-
|
|
575
|
+
checkpointed: makeTipId(3),
|
|
576
|
+
proven: makeTipId(3),
|
|
485
577
|
});
|
|
486
578
|
|
|
487
579
|
tips = await tipsStore.getL2Tips();
|
|
@@ -530,15 +622,165 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
530
622
|
expect(await tipsStore.getL2BlockHash(7)).not.toEqual(originalHash7);
|
|
531
623
|
});
|
|
532
624
|
|
|
533
|
-
// Regression test for #13142
|
|
534
|
-
|
|
625
|
+
// Regression test for #13142: proving an unseen block number (one with no local block->checkpoint
|
|
626
|
+
// mapping) must not blow up. With per-cursor checkpoint ids, the proven tip resolves to the
|
|
627
|
+
// checkpoint id carried by the event rather than falling back to checkpoint zero.
|
|
628
|
+
it('resolves the proven checkpoint from the carried id when setting proven on an unseen block number', async () => {
|
|
535
629
|
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: [await makeBlock(5)] });
|
|
536
|
-
|
|
630
|
+
// Block 3 has no local block->checkpoint mapping, but the event carries a real checkpoint id.
|
|
631
|
+
const carriedCheckpoint: CheckpointId = { number: CheckpointNumber(1), hash: new Fr(42).toString() };
|
|
632
|
+
await tipsStore.handleBlockStreamEvent({
|
|
633
|
+
type: 'chain-proven',
|
|
634
|
+
block: makeBlockId(3),
|
|
635
|
+
checkpoint: carriedCheckpoint,
|
|
636
|
+
});
|
|
537
637
|
|
|
538
638
|
const tips = await tipsStore.getL2Tips();
|
|
539
639
|
expect(tips.proposed).toEqual(makeTip(5));
|
|
540
640
|
expect(tips.proven.block).toEqual(makeTip(3));
|
|
541
|
-
//
|
|
542
|
-
expect(tips.proven.checkpoint
|
|
641
|
+
// Resolved from the carried id, not the (missing) local mapping.
|
|
642
|
+
expect(tips.proven.checkpoint).toEqual(carriedCheckpoint);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
// proven/finalized resolve to the carried checkpoint id even when the block has no local
|
|
646
|
+
// block->checkpoint mapping (the cursor legitimately leads the locally-checkpointed frontier).
|
|
647
|
+
it('resolves proven and finalized checkpoints from carried ids without a local mapping', async () => {
|
|
648
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: [await makeBlock(7)] });
|
|
649
|
+
const provenCheckpoint: CheckpointId = { number: CheckpointNumber(2), hash: new Fr(101).toString() };
|
|
650
|
+
const finalizedCheckpoint: CheckpointId = { number: CheckpointNumber(1), hash: new Fr(100).toString() };
|
|
651
|
+
await tipsStore.handleBlockStreamEvent({
|
|
652
|
+
type: 'chain-proven',
|
|
653
|
+
block: makeBlockId(5),
|
|
654
|
+
checkpoint: provenCheckpoint,
|
|
655
|
+
});
|
|
656
|
+
await tipsStore.handleBlockStreamEvent({
|
|
657
|
+
type: 'chain-finalized',
|
|
658
|
+
block: makeBlockId(3),
|
|
659
|
+
checkpoint: finalizedCheckpoint,
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
const tips = await tipsStore.getL2Tips();
|
|
663
|
+
expect(tips.proven.checkpoint).toEqual(provenCheckpoint);
|
|
664
|
+
expect(tips.finalized.checkpoint).toEqual(finalizedCheckpoint);
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// Genuine corruption: a cursor points at a real (non-genesis) block that has a block hash but
|
|
668
|
+
// neither a stored per-cursor checkpoint id nor a block->checkpoint mapping. getL2Tips must throw
|
|
669
|
+
// loudly rather than silently report checkpoint zero. We reach this state by reaching past the
|
|
670
|
+
// event API to place the tip directly, since the normal writers always record an id.
|
|
671
|
+
it('throws when a cursor points at a real block with neither a stored id nor a mapping', async () => {
|
|
672
|
+
// blocks-added records the block hash for block 5 (so getBlockId succeeds) but no checkpoint id.
|
|
673
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: [await makeBlock(5)] });
|
|
674
|
+
// Corrupt the proven cursor to point at block 5 without any id or mapping.
|
|
675
|
+
const internal = tipsStore as unknown as { setTip(tag: L2BlockTag, blockNumber: BlockNumber): Promise<void> };
|
|
676
|
+
await internal.setTip('proven', BlockNumber(5));
|
|
677
|
+
|
|
678
|
+
await expect(tipsStore.getL2Tips()).rejects.toThrow(/checkpoint/i);
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// Backward prune of a leading cursor: a checkpoint-bearing cursor that legitimately leads the source's
|
|
682
|
+
// confirmed checkpointed tip is clamped down to that tip, resolving to the id the prune event carries
|
|
683
|
+
// (never genesis, never a throw). This is the skipped-history shape where the cursor sits on a block
|
|
684
|
+
// ahead of the checkpointed frontier.
|
|
685
|
+
it('clamps a leading checkpoint cursor down to the source checkpointed tip carried by the prune event', async () => {
|
|
686
|
+
// Checkpoint blocks 1-5 (checkpointed = block 5 / ckpt 1), then add uncheckpointed blocks 6-10.
|
|
687
|
+
const blocks1to5 = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
688
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks1to5 });
|
|
689
|
+
const checkpoint1 = await makeCheckpoint(1, blocks1to5);
|
|
690
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1));
|
|
691
|
+
const blocks6to10 = await Promise.all(times(5, i => makeBlock(i + 6)));
|
|
692
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks6to10 });
|
|
693
|
+
|
|
694
|
+
// Advance the proven cursor onto an uncheckpointed block (8) via a carried id, so it LEADS the
|
|
695
|
+
// source checkpointed tip (block 5) and will be clamped down to it on prune.
|
|
696
|
+
await tipsStore.handleBlockStreamEvent({
|
|
697
|
+
type: 'chain-proven',
|
|
698
|
+
block: makeBlockId(8),
|
|
699
|
+
checkpoint: { number: CheckpointNumber(2), hash: new Fr(202).toString() },
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
// Prune to block 7, carrying the source's confirmed checkpointed and proven tips (both block 5 / ckpt 1
|
|
703
|
+
// here, the source's proven tip having rolled back together with its checkpointed tip).
|
|
704
|
+
await tipsStore.handleBlockStreamEvent({
|
|
705
|
+
type: 'chain-pruned',
|
|
706
|
+
block: makeBlockId(7),
|
|
707
|
+
checkpointed: makeTipId(5),
|
|
708
|
+
proven: makeTipId(5),
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
// Must not throw; the proven cursor is clamped to the carried proven tip, resolving to ckpt 1.
|
|
712
|
+
const tips = await tipsStore.getL2Tips();
|
|
713
|
+
expect(tips.proposed).toEqual(makeTip(7));
|
|
714
|
+
expect(tips.proven.block).toEqual(makeTip(5));
|
|
715
|
+
expect(tips.proven.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
it('keeps the checkpointed tip when pruning to an uncheckpointed block ahead of it', async () => {
|
|
719
|
+
const blocks1to5 = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
720
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks1to5 });
|
|
721
|
+
const checkpoint1 = await makeCheckpoint(1, blocks1to5);
|
|
722
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(checkpoint1)); // checkpointed = block 5 / ckpt 1
|
|
723
|
+
|
|
724
|
+
const blocks6to7 = await Promise.all(times(2, i => makeBlock(i + 6)));
|
|
725
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks6to7 }); // proposed = 7
|
|
726
|
+
|
|
727
|
+
// Prune to block 6: an uncheckpointed block AHEAD of the checkpointed tip (block 5). The source
|
|
728
|
+
// checkpointed tip is still block 5 / ckpt 1, so the checkpointed cursor must not move.
|
|
729
|
+
await tipsStore.handleBlockStreamEvent({
|
|
730
|
+
type: 'chain-pruned',
|
|
731
|
+
block: makeBlockId(6),
|
|
732
|
+
checkpointed: makeTipId(5),
|
|
733
|
+
proven: makeTipId(0),
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
const tips = await tipsStore.getL2Tips();
|
|
737
|
+
expect(tips.proposed).toEqual(makeTip(6));
|
|
738
|
+
expect(tips.checkpointed.block).toEqual(makeTip(5));
|
|
739
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(1)); // must NOT be zero
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// Per-cursor clamping on prune: when the source rolls back its proven tip below its checkpointed tip
|
|
743
|
+
// (e.g. a proof tx dropped by an L1 reorg), the prune event carries both source tips and each local
|
|
744
|
+
// cursor must clamp to its OWN source tip. Clamping the proven cursor onto the (higher) checkpointed
|
|
745
|
+
// tip would transiently report unproven blocks as proven until the corrective chain-proven event lands.
|
|
746
|
+
it('clamps the proven cursor to the source proven tip, separately from the checkpointed cursor, on prune', async () => {
|
|
747
|
+
// Checkpoint blocks 1-15 across three checkpoints (ckpt 1 = 1-5, ckpt 2 = 6-10, ckpt 3 = 11-15).
|
|
748
|
+
const blocks1to5 = await Promise.all(times(5, i => makeBlock(i + 1)));
|
|
749
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks1to5 });
|
|
750
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(await makeCheckpoint(1, blocks1to5)));
|
|
751
|
+
const blocks6to10 = await Promise.all(times(5, i => makeBlock(i + 6)));
|
|
752
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks6to10 });
|
|
753
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(await makeCheckpoint(2, blocks6to10)));
|
|
754
|
+
const blocks11to15 = await Promise.all(times(5, i => makeBlock(i + 11)));
|
|
755
|
+
await tipsStore.handleBlockStreamEvent({ type: 'blocks-added', blocks: blocks11to15 });
|
|
756
|
+
await tipsStore.handleBlockStreamEvent(await makeCheckpointedEvent(await makeCheckpoint(3, blocks11to15)));
|
|
757
|
+
|
|
758
|
+
// Prove the whole chain up to block 15 (ckpt 3), so the local proven cursor leads both source tips below.
|
|
759
|
+
await tipsStore.handleBlockStreamEvent({
|
|
760
|
+
type: 'chain-proven',
|
|
761
|
+
block: makeBlockId(15),
|
|
762
|
+
checkpoint: makeCheckpointIdForBlock(15),
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
let tips = await tipsStore.getL2Tips();
|
|
766
|
+
expect(tips.checkpointed.block).toEqual(makeTip(15));
|
|
767
|
+
expect(tips.proven.block).toEqual(makeTip(15));
|
|
768
|
+
|
|
769
|
+
// Prune arrives with the source's proven tip (block 5 / ckpt 1) BELOW its checkpointed tip (block 10 /
|
|
770
|
+
// ckpt 2) and below the local proven cursor (block 15). Each cursor must clamp to its own source tip.
|
|
771
|
+
await tipsStore.handleBlockStreamEvent({
|
|
772
|
+
type: 'chain-pruned',
|
|
773
|
+
block: makeBlockId(10),
|
|
774
|
+
checkpointed: makeTipId(10),
|
|
775
|
+
proven: makeTipId(5),
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
tips = await tipsStore.getL2Tips();
|
|
779
|
+
// The proven cursor lands exactly on the source proven tip, NOT on the (higher) checkpointed tip.
|
|
780
|
+
expect(tips.proven.block).toEqual(makeTip(5));
|
|
781
|
+
expect(tips.proven.checkpoint.number).toEqual(CheckpointNumber(1));
|
|
782
|
+
// The checkpointed cursor lands on the source checkpointed tip.
|
|
783
|
+
expect(tips.checkpointed.block).toEqual(makeTip(10));
|
|
784
|
+
expect(tips.checkpointed.checkpoint.number).toEqual(CheckpointNumber(2));
|
|
543
785
|
});
|
|
544
786
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ViemCommitteeAttestations } from '@aztec/ethereum/contracts';
|
|
1
2
|
import { EpochNumber, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
4
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
4
5
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
5
7
|
|
|
6
8
|
import { z } from 'zod';
|
|
7
9
|
|
|
@@ -30,6 +32,14 @@ export type ValidateCheckpointNegativeResult =
|
|
|
30
32
|
attestors: EthAddress[];
|
|
31
33
|
/** Committee attestations for this checkpoint as they were posted to L1 */
|
|
32
34
|
attestations: CommitteeAttestation[];
|
|
35
|
+
/**
|
|
36
|
+
* The exact packed `CommitteeAttestations` tuple as posted to L1 calldata, carried verbatim so the
|
|
37
|
+
* invalidation evidence is byte-faithful to the stored `attestationsHash`. A repack via
|
|
38
|
+
* `packAttestations` is not a round-trip inverse of `fromPacked`, so it would diverge from the hash
|
|
39
|
+
* and revert `invalidateBadAttestation`/`invalidateInsufficientAttestations`. Always populated on the
|
|
40
|
+
* calldata validation path, the only production source of invalidation evidence.
|
|
41
|
+
*/
|
|
42
|
+
verbatimAttestations: ViemCommitteeAttestations;
|
|
33
43
|
/** Reason for the checkpoint being invalid: not enough attestations were posted */
|
|
34
44
|
reason: 'insufficient-attestations';
|
|
35
45
|
}
|
|
@@ -47,6 +57,12 @@ export type ValidateCheckpointNegativeResult =
|
|
|
47
57
|
attestors: EthAddress[];
|
|
48
58
|
/** Committee attestations for this checkpoint as they were posted to L1 */
|
|
49
59
|
attestations: CommitteeAttestation[];
|
|
60
|
+
/**
|
|
61
|
+
* The exact packed `CommitteeAttestations` tuple as posted to L1 calldata, carried verbatim so the
|
|
62
|
+
* invalidation evidence is byte-faithful to the stored `attestationsHash`. See the same field on the
|
|
63
|
+
* insufficient-attestations variant for why a repack cannot be used.
|
|
64
|
+
*/
|
|
65
|
+
verbatimAttestations: ViemCommitteeAttestations;
|
|
50
66
|
/** Reason for the checkpoint being invalid: an invalid attestation was posted */
|
|
51
67
|
reason: 'invalid-attestation';
|
|
52
68
|
/** Index in the attestations array of the invalid attestation posted */
|
|
@@ -56,6 +72,12 @@ export type ValidateCheckpointNegativeResult =
|
|
|
56
72
|
/** Result type for validating checkpoint attestations */
|
|
57
73
|
export type ValidateCheckpointResult = { valid: true } | ValidateCheckpointNegativeResult;
|
|
58
74
|
|
|
75
|
+
/** Zod schema for the raw packed `CommitteeAttestations` viem tuple (two 0x-prefixed hex strings). */
|
|
76
|
+
const ViemCommitteeAttestationsSchema: ZodFor<ViemCommitteeAttestations> = z.object({
|
|
77
|
+
signatureIndices: schemas.HexStringWith0x,
|
|
78
|
+
signaturesOrAddresses: schemas.HexStringWith0x,
|
|
79
|
+
});
|
|
80
|
+
|
|
59
81
|
export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> = z.union([
|
|
60
82
|
z.object({ valid: z.literal(true) }),
|
|
61
83
|
z.object({
|
|
@@ -66,6 +88,7 @@ export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> =
|
|
|
66
88
|
seed: schemas.BigInt,
|
|
67
89
|
attestors: z.array(schemas.EthAddress),
|
|
68
90
|
attestations: z.array(CommitteeAttestation.schema),
|
|
91
|
+
verbatimAttestations: ViemCommitteeAttestationsSchema,
|
|
69
92
|
reason: z.literal('insufficient-attestations'),
|
|
70
93
|
}),
|
|
71
94
|
z.object({
|
|
@@ -76,6 +99,7 @@ export const ValidateCheckpointResultSchema: ZodFor<ValidateCheckpointResult> =
|
|
|
76
99
|
seed: schemas.BigInt,
|
|
77
100
|
attestors: z.array(schemas.EthAddress),
|
|
78
101
|
attestations: z.array(CommitteeAttestation.schema),
|
|
102
|
+
verbatimAttestations: ViemCommitteeAttestationsSchema,
|
|
79
103
|
reason: z.literal('invalid-attestation'),
|
|
80
104
|
invalidIndex: z.number(),
|
|
81
105
|
}),
|
|
@@ -87,6 +111,8 @@ export function serializeValidateCheckpointResult(result: ValidateCheckpointResu
|
|
|
87
111
|
}
|
|
88
112
|
|
|
89
113
|
const checkpointBuffer = serializeCheckpointInfo(result.checkpoint);
|
|
114
|
+
const signatureIndices = hexToBuffer(result.verbatimAttestations.signatureIndices);
|
|
115
|
+
const signaturesOrAddresses = hexToBuffer(result.verbatimAttestations.signaturesOrAddresses);
|
|
90
116
|
return serializeToBuffer(
|
|
91
117
|
result.valid,
|
|
92
118
|
result.reason,
|
|
@@ -101,6 +127,10 @@ export function serializeValidateCheckpointResult(result: ValidateCheckpointResu
|
|
|
101
127
|
result.attestations.length,
|
|
102
128
|
result.attestations,
|
|
103
129
|
result.reason === 'invalid-attestation' ? result.invalidIndex : 0,
|
|
130
|
+
signatureIndices.length,
|
|
131
|
+
signatureIndices,
|
|
132
|
+
signaturesOrAddresses.length,
|
|
133
|
+
signaturesOrAddresses,
|
|
104
134
|
);
|
|
105
135
|
}
|
|
106
136
|
|
|
@@ -118,10 +148,26 @@ export function deserializeValidateCheckpointResult(bufferOrReader: Buffer | Buf
|
|
|
118
148
|
const attestors = reader.readVector(EthAddress, MAX_COMMITTEE_SIZE);
|
|
119
149
|
const attestations = reader.readVector(CommitteeAttestation, MAX_COMMITTEE_SIZE);
|
|
120
150
|
const invalidIndex = reader.readNumber();
|
|
151
|
+
const verbatimAttestations: ViemCommitteeAttestations = {
|
|
152
|
+
signatureIndices: bufferToHex(reader.readBuffer()),
|
|
153
|
+
signaturesOrAddresses: bufferToHex(reader.readBuffer()),
|
|
154
|
+
};
|
|
155
|
+
|
|
121
156
|
if (reason === 'insufficient-attestations') {
|
|
122
|
-
return { valid, reason, checkpoint, committee, epoch, seed, attestors, attestations };
|
|
157
|
+
return { valid, reason, checkpoint, committee, epoch, seed, attestors, attestations, verbatimAttestations };
|
|
123
158
|
} else if (reason === 'invalid-attestation') {
|
|
124
|
-
return {
|
|
159
|
+
return {
|
|
160
|
+
valid,
|
|
161
|
+
reason,
|
|
162
|
+
checkpoint,
|
|
163
|
+
committee,
|
|
164
|
+
epoch,
|
|
165
|
+
seed,
|
|
166
|
+
attestors,
|
|
167
|
+
invalidIndex,
|
|
168
|
+
attestations,
|
|
169
|
+
verbatimAttestations,
|
|
170
|
+
};
|
|
125
171
|
} else {
|
|
126
172
|
const _: never = reason;
|
|
127
173
|
throw new Error(`Unknown reason: ${reason}`);
|
|
@@ -14,7 +14,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
|
|
16
16
|
import { L2Block } from '../block/l2_block.js';
|
|
17
|
-
import {
|
|
17
|
+
import { MAX_CAPACITY_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
|
|
18
18
|
import { computeCheckpointOutHash } from '../messaging/out_hash.js';
|
|
19
19
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
20
20
|
import { schemas } from '../schemas/schemas.js';
|
|
@@ -68,7 +68,7 @@ export class Checkpoint {
|
|
|
68
68
|
const reader = BufferReader.asReader(buf);
|
|
69
69
|
const archive = reader.readObject(AppendOnlyTreeSnapshot);
|
|
70
70
|
const header = reader.readObject(CheckpointHeader);
|
|
71
|
-
const blocks = reader.readVector(L2Block,
|
|
71
|
+
const blocks = reader.readVector(L2Block, MAX_CAPACITY_BLOCKS_PER_CHECKPOINT);
|
|
72
72
|
const number = CheckpointNumber(reader.readNumber());
|
|
73
73
|
const feeAssetPriceModifier = reader.readInt256();
|
|
74
74
|
return new Checkpoint(archive, header, blocks, number, feeAssetPriceModifier);
|
package/src/checkpoint/index.ts
CHANGED