@aztec/stdlib 0.0.1-commit.c7c42ec → 0.0.1-commit.f295ac2
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/contract_artifact.d.ts +2 -2
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +1 -1
- package/dest/abi/function_call.d.ts +9 -1
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/selector.js +3 -1
- package/dest/abi/utils.d.ts +7 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +7 -0
- package/dest/auth_witness/auth_witness.d.ts +2 -1
- package/dest/auth_witness/auth_witness.d.ts.map +1 -1
- package/dest/avm/avm.d.ts +62 -62
- package/dest/avm/avm_accumulated_data.d.ts +30 -3
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +5 -2
- package/dest/avm/avm_circuit_public_inputs.d.ts +9 -9
- package/dest/avm/avm_circuit_public_inputs.js +3 -1
- package/dest/avm/avm_proving_request.d.ts +299 -299
- package/dest/avm/contract_storage_read.d.ts +13 -1
- package/dest/avm/contract_storage_read.d.ts.map +1 -1
- package/dest/avm/contract_storage_update_request.d.ts +13 -1
- package/dest/avm/contract_storage_update_request.d.ts.map +1 -1
- package/dest/avm/public_call_stack_item_compressed.d.ts +3 -1
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +1 -1
- package/dest/avm/public_data_read.d.ts +10 -1
- package/dest/avm/public_data_read.d.ts.map +1 -1
- package/dest/avm/public_data_update_request.d.ts +10 -1
- package/dest/avm/public_data_update_request.d.ts.map +1 -1
- package/dest/avm/public_data_update_request.js +3 -1
- package/dest/avm/public_data_write.d.ts +7 -1
- package/dest/avm/public_data_write.d.ts.map +1 -1
- package/dest/avm/public_inner_call_request.d.ts +4 -1
- package/dest/avm/public_inner_call_request.d.ts.map +1 -1
- package/dest/avm/public_inner_call_request.js +3 -1
- package/dest/avm/revert_code.d.ts +4 -4
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +3 -1
- package/dest/aztec-address/index.js +4 -2
- package/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/block_hash.d.ts +7 -1
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +12 -0
- package/dest/block/block_parameter.d.ts +4 -3
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -0
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +5 -2
- package/dest/block/checkpointed_l2_block.d.ts +16 -133
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +5 -43
- package/dest/block/in_block.d.ts +3 -3
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/index.d.ts +1 -3
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +0 -2
- package/dest/block/l2_block_new.d.ts +20 -13
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +13 -7
- package/dest/block/l2_block_source.d.ts +276 -55
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +25 -6
- 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 +15 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +93 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- 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 +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- 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 +478 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -17
- package/dest/checkpoint/checkpoint.d.ts +24 -14
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +16 -3
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- 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/published_checkpoint.d.ts +15 -13
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +4 -3
- package/dest/contract/complete_address.d.ts +4 -1
- package/dest/contract/complete_address.d.ts.map +1 -1
- package/dest/contract/contract_deployment_data.d.ts +5 -5
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_instance.d.ts +16 -16
- package/dest/database-version/version_manager.d.ts +4 -2
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +3 -1
- package/dest/deserialization/index.d.ts +11 -0
- package/dest/deserialization/index.d.ts.map +1 -0
- package/dest/deserialization/index.js +10 -0
- package/dest/errors/proving_error.d.ts +2 -2
- package/dest/errors/proving_error.d.ts.map +1 -1
- package/dest/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +16 -12
- package/dest/interfaces/aztec-node-admin.d.ts +64 -31
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +45 -49
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +15 -12
- package/dest/interfaces/block-builder.d.ts +19 -17
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +12 -7
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/get_logs_response.d.ts +1 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/proving-job.d.ts +184 -184
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +1 -7
- package/dest/interfaces/server_circuit_prover.d.ts +4 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +108 -18
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +5 -3
- package/dest/kernel/claimed_length_array.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +19 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +14 -4
- package/dest/kernel/hints/key_validation_hint.d.ts +2 -1
- package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request.d.ts +2 -1
- package/dest/kernel/hints/key_validation_request.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts +6 -1
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +13 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request.d.ts +7 -1
- package/dest/kernel/hints/read_request.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.d.ts +7 -1
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/transient_data_squashing_hint.js +3 -1
- package/dest/kernel/log_hash.js +3 -1
- package/dest/kernel/private_accumulated_data.d.ts +23 -1
- package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +25 -1
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_request.d.ts +16 -1
- package/dest/kernel/private_call_request.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +74 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +31 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.d.ts +7 -1
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +22 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +4 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +23 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +5 -2
- package/dest/kernel/private_to_avm_accumulated_data.d.ts +2 -2
- package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
- package/dest/kernel/private_to_public_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts +17 -1
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +16 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.d.ts +10 -1
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +3 -1
- package/dest/kernel/public_call_request.d.ts +22 -1
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +5 -2
- package/dest/kernel/utils/optional_number.d.ts +7 -1
- package/dest/kernel/utils/optional_number.d.ts.map +1 -1
- package/dest/keys/public_keys.d.ts +5 -1
- package/dest/keys/public_keys.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +3 -1
- package/dest/logs/extended_contract_class_log.d.ts +3 -1
- package/dest/logs/extended_contract_class_log.d.ts.map +1 -1
- package/dest/logs/extended_public_log.d.ts +5 -3
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +5 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/private_log.js +3 -1
- package/dest/logs/public_log.js +3 -1
- package/dest/messaging/in_hash.d.ts +4 -2
- package/dest/messaging/in_hash.d.ts.map +1 -1
- package/dest/messaging/in_hash.js +3 -1
- package/dest/messaging/inbox_leaf.d.ts +3 -1
- package/dest/messaging/inbox_leaf.d.ts.map +1 -1
- package/dest/messaging/l1_actor.d.ts +7 -1
- package/dest/messaging/l1_actor.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.d.ts +6 -1
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l2_actor.d.ts +7 -1
- package/dest/messaging/l2_actor.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +88 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +160 -42
- package/dest/messaging/out_hash.d.ts +41 -3
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +54 -19
- package/dest/note/note_dao.d.ts +36 -5
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +15 -12
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +93 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +140 -39
- package/dest/p2p/checkpoint_attestation.d.ts +81 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +160 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +229 -0
- package/dest/p2p/consensus_payload.d.ts +9 -9
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -5
- package/dest/p2p/gossipable.d.ts +4 -3
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +16 -5
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +42 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +75 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +10 -3
- package/dest/parity/parity_base_private_inputs.d.ts +3 -1
- package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
- package/dest/parity/parity_public_inputs.d.ts +4 -1
- package/dest/parity/parity_public_inputs.d.ts.map +1 -1
- package/dest/parity/parity_root_private_inputs.d.ts +2 -1
- package/dest/parity/parity_root_private_inputs.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.d.ts +1 -1
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +9 -4
- package/dest/proofs/proof.d.ts +4 -1
- package/dest/proofs/proof.d.ts.map +1 -1
- package/dest/proofs/recursive_proof.d.ts +10 -1
- package/dest/proofs/recursive_proof.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.d.ts +34 -1
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.d.ts +12 -1
- package/dest/rollup/block_constant_data.d.ts.map +1 -1
- package/dest/rollup/block_headers_hash.js +1 -1
- package/dest/rollup/block_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/block_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.d.ts +47 -11
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +8 -12
- package/dest/rollup/block_root_rollup_private_inputs.d.ts +64 -1
- package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.d.ts +10 -1
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +3 -1
- package/dest/rollup/checkpoint_header.d.ts +42 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +49 -19
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +41 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +10 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +44 -3
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +13 -2
- package/dest/rollup/epoch_constant_data.d.ts +16 -1
- package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
- package/dest/rollup/root_rollup_private_inputs.d.ts +6 -1
- package/dest/rollup/root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts +18 -3
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +9 -3
- package/dest/rollup/tree_snapshot_diff_hints.d.ts +24 -1
- package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts +29 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
- package/dest/schemas/schemas.d.ts +1 -1
- package/dest/tests/factories.d.ts +16 -10
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +60 -25
- package/dest/tests/jest.d.ts +4 -4
- package/dest/tests/jest.js +9 -9
- package/dest/tests/mocks.d.ts +66 -16
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +114 -54
- package/dest/trees/append_only_tree_snapshot.d.ts +13 -1
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +3 -1
- package/dest/trees/nullifier_leaf.d.ts +13 -1
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.d.ts +10 -1
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.d.ts +16 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_witness.d.ts +11 -1
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/tx/block_header.d.ts +12 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +6 -1
- package/dest/tx/call_context.d.ts +13 -1
- package/dest/tx/call_context.d.ts.map +1 -1
- package/dest/tx/call_context.js +3 -1
- package/dest/tx/capsule.d.ts +4 -1
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/execution_payload.d.ts +9 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/function_data.d.ts +4 -2
- package/dest/tx/function_data.d.ts.map +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +9 -1
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +3 -1
- package/dest/tx/hashed_values.d.ts +7 -1
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/in_tx.d.ts +1 -1
- 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/partial_state_reference.d.ts +4 -1
- package/dest/tx/partial_state_reference.d.ts.map +1 -1
- package/dest/tx/private_execution_result.d.ts +23 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +4 -21
- package/dest/tx/private_tx_constant_data.d.ts +16 -1
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/profiling.d.ts +149 -26
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +44 -7
- package/dest/tx/protocol_contracts.d.ts +1 -1
- package/dest/tx/public_call_request_with_calldata.d.ts +7 -1
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- package/dest/tx/state_reference.d.ts +3 -1
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/state_reference.js +3 -1
- package/dest/tx/tree_snapshots.js +3 -1
- package/dest/tx/tx.d.ts +23 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +3 -1
- package/dest/tx/tx_context.d.ts +2 -1
- package/dest/tx/tx_context.d.ts.map +1 -1
- package/dest/tx/tx_effect.d.ts +32 -6
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +3 -8
- package/dest/tx/tx_execution_request.d.ts +30 -1
- package/dest/tx/tx_execution_request.d.ts.map +1 -1
- package/dest/tx/tx_execution_request.js +6 -2
- package/dest/tx/tx_hash.d.ts +2 -1
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +7 -1
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_request.d.ts +6 -1
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/types/shared.d.ts +4 -1
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/validators/schemas.d.ts +8 -8
- package/dest/vks/verification_key.d.ts +22 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/vk_data.d.ts +7 -1
- package/dest/vks/vk_data.d.ts.map +1 -1
- package/dest/zkpassport/index.d.ts +3 -4
- package/dest/zkpassport/index.d.ts.map +1 -1
- package/dest/zkpassport/index.js +9 -9
- package/package.json +12 -10
- package/src/abi/contract_artifact.ts +10 -10
- package/src/abi/utils.ts +17 -0
- package/src/block/attestation_info.ts +9 -6
- package/src/block/block_hash.ts +22 -0
- package/src/block/block_parameter.ts +4 -2
- package/src/block/body.ts +2 -1
- package/src/block/checkpointed_l2_block.ts +5 -55
- package/src/block/in_block.ts +2 -2
- package/src/block/index.ts +0 -2
- package/src/block/l2_block_new.ts +30 -9
- package/src/block/l2_block_source.ts +100 -30
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +15 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +111 -37
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +480 -36
- package/src/block/validate_block_result.ts +40 -35
- package/src/checkpoint/checkpoint.ts +28 -5
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/published_checkpoint.ts +4 -3
- package/src/contract/index.ts +0 -2
- package/src/deserialization/index.ts +21 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +24 -14
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +81 -69
- package/src/interfaces/block-builder.ts +33 -26
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/proving-job.ts +2 -11
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/interfaces/validator.ts +64 -14
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +20 -12
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +22 -10
- package/src/messaging/in_hash.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +178 -52
- package/src/messaging/out_hash.ts +62 -21
- package/src/note/note_dao.ts +18 -13
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +204 -44
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +348 -0
- package/src/p2p/consensus_payload.ts +5 -7
- package/src/p2p/gossipable.ts +14 -4
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +88 -0
- package/src/p2p/topic_type.ts +4 -3
- package/src/proofs/chonk_proof.ts +9 -5
- package/src/rollup/block_headers_hash.ts +1 -1
- package/src/rollup/block_rollup_public_inputs.ts +5 -11
- package/src/rollup/checkpoint_header.ts +63 -20
- package/src/rollup/checkpoint_rollup_public_inputs.ts +12 -0
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
- package/src/rollup/root_rollup_public_inputs.ts +9 -0
- package/src/tests/factories.ts +56 -40
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +198 -85
- package/src/tx/block_header.ts +5 -0
- package/src/tx/global_variable_builder.ts +1 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +1 -16
- package/src/tx/profiling.ts +46 -4
- package/src/tx/tx.ts +2 -0
- package/src/tx/tx_effect.ts +0 -9
- package/src/tx/tx_execution_request.ts +2 -0
- package/src/zkpassport/index.ts +11 -12
- package/dest/block/l2_block.d.ts +0 -143
- package/dest/block/l2_block.d.ts.map +0 -1
- package/dest/block/l2_block.js +0 -198
- package/dest/block/l2_block_code_to_purge.d.ts +0 -12
- package/dest/block/l2_block_code_to_purge.d.ts.map +0 -1
- package/dest/block/l2_block_code_to_purge.js +0 -61
- package/dest/block/l2_block_header.d.ts +0 -98
- package/dest/block/l2_block_header.d.ts.map +0 -1
- package/dest/block/l2_block_header.js +0 -153
- package/dest/contract/contract_class_metadata.d.ts +0 -8
- package/dest/contract/contract_class_metadata.d.ts.map +0 -1
- package/dest/contract/contract_class_metadata.js +0 -1
- package/dest/contract/contract_metadata.d.ts +0 -7
- package/dest/contract/contract_metadata.d.ts.map +0 -1
- package/dest/contract/contract_metadata.js +0 -1
- package/dest/p2p/block_attestation.d.ts +0 -80
- package/dest/p2p/block_attestation.d.ts.map +0 -1
- package/dest/tx/content_commitment.d.ts +0 -49
- package/dest/tx/content_commitment.d.ts.map +0 -1
- package/dest/tx/content_commitment.js +0 -90
- package/src/block/l2_block.ts +0 -271
- package/src/block/l2_block_code_to_purge.ts +0 -88
- package/src/block/l2_block_header.ts +0 -246
- package/src/contract/contract_class_metadata.ts +0 -8
- package/src/contract/contract_metadata.ts +0 -7
- package/src/tx/content_commitment.ts +0 -113
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type BlockBlobData, encodeBlockBlobData } from '@aztec/blob-lib/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BlockNumber,
|
|
4
|
+
CheckpointNumber,
|
|
5
|
+
CheckpointNumberSchema,
|
|
6
|
+
IndexWithinCheckpoint,
|
|
7
|
+
IndexWithinCheckpointSchema,
|
|
8
|
+
SlotNumber,
|
|
9
|
+
} from '@aztec/foundation/branded-types';
|
|
3
10
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
11
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
12
|
|
|
@@ -11,9 +18,13 @@ import { BlockHeader } from '../tx/block_header.js';
|
|
|
11
18
|
import { Body } from './body.js';
|
|
12
19
|
import type { L2BlockInfo } from './l2_block_info.js';
|
|
13
20
|
|
|
21
|
+
// TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
22
|
+
// TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
|
|
23
|
+
// if the blockNumber is there, why not these as well? Consider whether they should be part of the
|
|
24
|
+
// circuits structs though.
|
|
25
|
+
|
|
14
26
|
/**
|
|
15
27
|
* An L2 block with a header and a body.
|
|
16
|
-
* TODO: Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
17
28
|
*/
|
|
18
29
|
export class L2BlockNew {
|
|
19
30
|
constructor(
|
|
@@ -26,13 +37,17 @@ export class L2BlockNew {
|
|
|
26
37
|
/** Number of the checkpoint that the block belongs to. */
|
|
27
38
|
public checkpointNumber: CheckpointNumber,
|
|
28
39
|
/** Index of the block within the checkpoint. */
|
|
29
|
-
public indexWithinCheckpoint:
|
|
40
|
+
public indexWithinCheckpoint: IndexWithinCheckpoint,
|
|
30
41
|
) {}
|
|
31
42
|
|
|
32
43
|
get number(): BlockNumber {
|
|
33
44
|
return this.header.globalVariables.blockNumber;
|
|
34
45
|
}
|
|
35
46
|
|
|
47
|
+
get slot(): SlotNumber {
|
|
48
|
+
return this.header.globalVariables.slotNumber;
|
|
49
|
+
}
|
|
50
|
+
|
|
36
51
|
get timestamp(): bigint {
|
|
37
52
|
return this.header.globalVariables.timestamp;
|
|
38
53
|
}
|
|
@@ -44,7 +59,7 @@ export class L2BlockNew {
|
|
|
44
59
|
header: BlockHeader.schema,
|
|
45
60
|
body: Body.schema,
|
|
46
61
|
checkpointNumber: CheckpointNumberSchema,
|
|
47
|
-
indexWithinCheckpoint:
|
|
62
|
+
indexWithinCheckpoint: IndexWithinCheckpointSchema,
|
|
48
63
|
})
|
|
49
64
|
.transform(
|
|
50
65
|
({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
|
|
@@ -62,7 +77,7 @@ export class L2BlockNew {
|
|
|
62
77
|
const archive = reader.readObject(AppendOnlyTreeSnapshot);
|
|
63
78
|
const body = reader.readObject(Body);
|
|
64
79
|
const checkpointNumber = CheckpointNumber(reader.readNumber());
|
|
65
|
-
const indexWithinCheckpoint = reader.readNumber();
|
|
80
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
|
|
66
81
|
|
|
67
82
|
return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
68
83
|
}
|
|
@@ -127,8 +142,14 @@ export class L2BlockNew {
|
|
|
127
142
|
};
|
|
128
143
|
}
|
|
129
144
|
|
|
130
|
-
static empty() {
|
|
131
|
-
return new L2BlockNew(
|
|
145
|
+
static empty(header?: BlockHeader) {
|
|
146
|
+
return new L2BlockNew(
|
|
147
|
+
AppendOnlyTreeSnapshot.empty(),
|
|
148
|
+
header ?? BlockHeader.empty(),
|
|
149
|
+
Body.empty(),
|
|
150
|
+
CheckpointNumber(0),
|
|
151
|
+
IndexWithinCheckpoint(0),
|
|
152
|
+
);
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
/**
|
|
@@ -144,14 +165,14 @@ export class L2BlockNew {
|
|
|
144
165
|
blockNumber: BlockNumber,
|
|
145
166
|
{
|
|
146
167
|
checkpointNumber = CheckpointNumber(Number(blockNumber)),
|
|
147
|
-
indexWithinCheckpoint = 0,
|
|
168
|
+
indexWithinCheckpoint = IndexWithinCheckpoint(0),
|
|
148
169
|
txsPerBlock = 1,
|
|
149
170
|
txOptions = {},
|
|
150
171
|
makeTxOptions,
|
|
151
172
|
...blockHeaderOverrides
|
|
152
173
|
}: {
|
|
153
174
|
checkpointNumber?: CheckpointNumber;
|
|
154
|
-
indexWithinCheckpoint?:
|
|
175
|
+
indexWithinCheckpoint?: IndexWithinCheckpoint;
|
|
155
176
|
txsPerBlock?: number;
|
|
156
177
|
txOptions?: Partial<Parameters<typeof Body.random>[0]>;
|
|
157
178
|
makeTxOptions?: (txIndex: number) => Partial<Parameters<typeof Body.random>[0]>;
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
BlockNumber,
|
|
3
3
|
BlockNumberSchema,
|
|
4
4
|
CheckpointNumber,
|
|
5
|
+
CheckpointNumberSchema,
|
|
5
6
|
type EpochNumber,
|
|
6
7
|
type SlotNumber,
|
|
7
8
|
} from '@aztec/foundation/branded-types';
|
|
@@ -14,14 +15,14 @@ import { z } from 'zod';
|
|
|
14
15
|
import type { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
15
16
|
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
16
17
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
18
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
17
19
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
18
20
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
19
21
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
20
22
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
21
|
-
import {
|
|
22
|
-
import type { L2Block } from './l2_block.js';
|
|
23
|
+
import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
|
|
23
24
|
import type { L2BlockNew } from './l2_block_new.js';
|
|
24
|
-
import type {
|
|
25
|
+
import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Interface of classes allowing for the retrieval of L2 blocks.
|
|
@@ -66,6 +67,8 @@ export interface L2BlockSource {
|
|
|
66
67
|
*/
|
|
67
68
|
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
68
69
|
|
|
70
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
71
|
+
|
|
69
72
|
/**
|
|
70
73
|
* Retrieves a collection of published checkpoints
|
|
71
74
|
* @param checkpointNumber The first checkpoint to be retrieved
|
|
@@ -101,6 +104,20 @@ export interface L2BlockSource {
|
|
|
101
104
|
*/
|
|
102
105
|
getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
|
|
103
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Gets an L2 block by its hash.
|
|
109
|
+
* @param blockHash - The block hash to retrieve.
|
|
110
|
+
* @returns The requested L2 block (or undefined if not found).
|
|
111
|
+
*/
|
|
112
|
+
getL2BlockNewByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Gets an L2 block by its archive root.
|
|
116
|
+
* @param archive - The archive root to retrieve.
|
|
117
|
+
* @returns The requested L2 block (or undefined if not found).
|
|
118
|
+
*/
|
|
119
|
+
getL2BlockNewByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
|
|
120
|
+
|
|
104
121
|
/**
|
|
105
122
|
* Gets a tx effect.
|
|
106
123
|
* @param txHash - The hash of the tx corresponding to the tx effect.
|
|
@@ -161,10 +178,10 @@ export interface L2BlockSource {
|
|
|
161
178
|
isPendingChainInvalid(): Promise<boolean>;
|
|
162
179
|
|
|
163
180
|
/**
|
|
164
|
-
* Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive
|
|
165
|
-
* that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
|
|
181
|
+
* Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive
|
|
182
|
+
* checkpoint that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
|
|
166
183
|
*/
|
|
167
|
-
getPendingChainValidationStatus(): Promise<
|
|
184
|
+
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
168
185
|
|
|
169
186
|
/** Force a sync. */
|
|
170
187
|
syncImmediate(): Promise<void>;
|
|
@@ -175,30 +192,38 @@ export interface L2BlockSource {
|
|
|
175
192
|
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
176
193
|
* @param number - The block number to return (inclusive).
|
|
177
194
|
* @returns The requested L2 block.
|
|
178
|
-
* @deprecated Use getL2BlockNew instead.
|
|
179
195
|
*/
|
|
180
|
-
getBlock(number: BlockNumber): Promise<
|
|
196
|
+
getBlock(number: BlockNumber): Promise<L2BlockNew | undefined>;
|
|
197
|
+
|
|
198
|
+
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
181
199
|
|
|
182
200
|
/**
|
|
183
201
|
* Returns all blocks for a given epoch.
|
|
184
202
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
185
203
|
* @param epochNumber - The epoch number to return blocks for.
|
|
186
204
|
*/
|
|
187
|
-
getBlocksForEpoch(epochNumber: EpochNumber): Promise<
|
|
205
|
+
getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2BlockNew[]>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns all blocks for a given slot.
|
|
209
|
+
* @dev Use this method only with recent slots, since it walks the block list backwards.
|
|
210
|
+
* @param slotNumber - The slot number to return blocks for.
|
|
211
|
+
*/
|
|
212
|
+
getBlocksForSlot(slotNumber: SlotNumber): Promise<L2BlockNew[]>;
|
|
188
213
|
|
|
189
214
|
/**
|
|
190
215
|
* Gets a published block by its block hash.
|
|
191
216
|
* @param blockHash - The block hash to retrieve.
|
|
192
217
|
* @returns The requested block (or undefined if not found).
|
|
193
218
|
*/
|
|
194
|
-
getPublishedBlockByHash(blockHash: Fr): Promise<
|
|
219
|
+
getPublishedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
|
|
195
220
|
|
|
196
221
|
/**
|
|
197
222
|
* Gets a published block by its archive root.
|
|
198
223
|
* @param archive - The archive root to retrieve.
|
|
199
224
|
* @returns The requested block (or undefined if not found).
|
|
200
225
|
*/
|
|
201
|
-
getPublishedBlockByArchive(archive: Fr): Promise<
|
|
226
|
+
getPublishedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
|
|
202
227
|
|
|
203
228
|
/**
|
|
204
229
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
@@ -207,10 +232,10 @@ export interface L2BlockSource {
|
|
|
207
232
|
* @param proven - If true, only return blocks that have been proven.
|
|
208
233
|
* @returns The requested L2 blocks.
|
|
209
234
|
*/
|
|
210
|
-
getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<
|
|
235
|
+
getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
211
236
|
|
|
212
237
|
/** Equivalent to getBlocks but includes publish data. */
|
|
213
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<
|
|
238
|
+
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
214
239
|
}
|
|
215
240
|
|
|
216
241
|
/**
|
|
@@ -230,26 +255,42 @@ export interface L2BlockSink {
|
|
|
230
255
|
* see L2BlockSourceEvents for the events emitted.
|
|
231
256
|
*/
|
|
232
257
|
export type ArchiverEmitter = TypedEventEmitter<{
|
|
233
|
-
[L2BlockSourceEvents.
|
|
258
|
+
[L2BlockSourceEvents.L2PruneUnproven]: (args: L2PruneUnprovenEvent) => void;
|
|
259
|
+
[L2BlockSourceEvents.L2PruneUncheckpointed]: (args: L2PruneUncheckpointedEvent) => void;
|
|
234
260
|
[L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
|
|
235
|
-
[L2BlockSourceEvents.
|
|
261
|
+
[L2BlockSourceEvents.InvalidAttestationsCheckpointDetected]: (args: InvalidCheckpointDetectedEvent) => void;
|
|
262
|
+
[L2BlockSourceEvents.L2BlocksCheckpointed]: (args: L2CheckpointEvent) => void;
|
|
236
263
|
}>;
|
|
237
|
-
export interface L2BlockSourceEventEmitter extends L2BlockSource
|
|
264
|
+
export interface L2BlockSourceEventEmitter extends L2BlockSource {
|
|
265
|
+
events: ArchiverEmitter;
|
|
266
|
+
}
|
|
238
267
|
|
|
239
268
|
/**
|
|
240
269
|
* Identifier for L2 block tags.
|
|
241
|
-
* -
|
|
270
|
+
* - proposed: Latest block proposed on L2.
|
|
271
|
+
* - checkpointed: Checkpointed block on L1.
|
|
242
272
|
* - proven: Proven block on L1.
|
|
243
273
|
* - finalized: Proven block on a finalized L1 block (not implemented, set to proven for now).
|
|
244
274
|
*/
|
|
245
|
-
export type L2BlockTag = '
|
|
275
|
+
export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
246
276
|
|
|
247
277
|
/** Tips of the L2 chain. */
|
|
248
|
-
export type L2Tips =
|
|
278
|
+
export type L2Tips = {
|
|
279
|
+
proposed: L2BlockId;
|
|
280
|
+
checkpointed: L2TipId;
|
|
281
|
+
proven: L2TipId;
|
|
282
|
+
finalized: L2TipId;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const GENESIS_CHECKPOINT_HEADER_HASH = CheckpointHeader.empty().hash();
|
|
249
286
|
|
|
250
287
|
/** Identifies a block by number and hash. */
|
|
251
288
|
export type L2BlockId = { number: BlockNumber; hash: string };
|
|
252
289
|
|
|
290
|
+
export type CheckpointId = { number: CheckpointNumber; hash: string };
|
|
291
|
+
|
|
292
|
+
export type L2TipId = { block: L2BlockId; checkpoint: CheckpointId };
|
|
293
|
+
|
|
253
294
|
/** Creates an L2 block id */
|
|
254
295
|
export function makeL2BlockId(number: BlockNumber, hash?: string): L2BlockId {
|
|
255
296
|
if (number !== 0 && !hash) {
|
|
@@ -258,21 +299,39 @@ export function makeL2BlockId(number: BlockNumber, hash?: string): L2BlockId {
|
|
|
258
299
|
return { number, hash: hash! };
|
|
259
300
|
}
|
|
260
301
|
|
|
302
|
+
/** Creates an L2 checkpoint id */
|
|
303
|
+
export function makeL2CheckpointId(number: CheckpointNumber, hash: string): CheckpointId {
|
|
304
|
+
return { number, hash };
|
|
305
|
+
}
|
|
306
|
+
|
|
261
307
|
const L2BlockIdSchema = z.object({
|
|
262
308
|
number: BlockNumberSchema,
|
|
263
309
|
hash: z.string(),
|
|
264
310
|
});
|
|
265
311
|
|
|
312
|
+
const L2CheckpointIdSchema = z.object({
|
|
313
|
+
number: CheckpointNumberSchema,
|
|
314
|
+
hash: z.string(),
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const L2TipIdSchema = z.object({
|
|
318
|
+
block: L2BlockIdSchema,
|
|
319
|
+
checkpoint: L2CheckpointIdSchema,
|
|
320
|
+
});
|
|
321
|
+
|
|
266
322
|
export const L2TipsSchema = z.object({
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
323
|
+
proposed: L2BlockIdSchema,
|
|
324
|
+
checkpointed: L2TipIdSchema,
|
|
325
|
+
proven: L2TipIdSchema,
|
|
326
|
+
finalized: L2TipIdSchema,
|
|
270
327
|
});
|
|
271
328
|
|
|
272
329
|
export enum L2BlockSourceEvents {
|
|
273
|
-
|
|
330
|
+
L2PruneUnproven = 'l2PruneUnproven',
|
|
331
|
+
L2PruneUncheckpointed = 'l2PruneUncheckpointed',
|
|
274
332
|
L2BlockProven = 'l2BlockProven',
|
|
275
|
-
|
|
333
|
+
L2BlocksCheckpointed = 'l2BlocksCheckpointed',
|
|
334
|
+
InvalidAttestationsCheckpointDetected = 'invalidCheckpointDetected',
|
|
276
335
|
}
|
|
277
336
|
|
|
278
337
|
export type L2BlockProvenEvent = {
|
|
@@ -282,13 +341,24 @@ export type L2BlockProvenEvent = {
|
|
|
282
341
|
epochNumber: EpochNumber;
|
|
283
342
|
};
|
|
284
343
|
|
|
285
|
-
export type
|
|
286
|
-
type: '
|
|
344
|
+
export type L2PruneUnprovenEvent = {
|
|
345
|
+
type: 'l2PruneUnproven';
|
|
287
346
|
epochNumber: EpochNumber;
|
|
288
|
-
blocks:
|
|
347
|
+
blocks: L2BlockNew[];
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export type L2PruneUncheckpointedEvent = {
|
|
351
|
+
type: 'l2PruneUncheckpointed';
|
|
352
|
+
slotNumber: SlotNumber;
|
|
353
|
+
blocks: L2BlockNew[];
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export type L2CheckpointEvent = {
|
|
357
|
+
type: 'l2BlocksCheckpointed';
|
|
358
|
+
checkpoint: PublishedCheckpoint;
|
|
289
359
|
};
|
|
290
360
|
|
|
291
|
-
export type
|
|
292
|
-
type: '
|
|
293
|
-
validationResult:
|
|
361
|
+
export type InvalidCheckpointDetectedEvent = {
|
|
362
|
+
type: 'invalidCheckpointDetected';
|
|
363
|
+
validationResult: ValidateCheckpointNegativeResult;
|
|
294
364
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
2
|
+
import type { L2BlockNew } from '../l2_block_new.js';
|
|
3
|
+
import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
3
4
|
|
|
4
5
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
5
6
|
export interface L2BlockStreamLocalDataProvider {
|
|
@@ -15,11 +16,21 @@ export interface L2BlockStreamEventHandler {
|
|
|
15
16
|
export type L2BlockStreamEvent =
|
|
16
17
|
| /** Emits blocks added to the chain. */ {
|
|
17
18
|
type: 'blocks-added';
|
|
18
|
-
blocks:
|
|
19
|
+
blocks: L2BlockNew[];
|
|
19
20
|
}
|
|
20
|
-
| /**
|
|
21
|
+
| /** Emits checkpoints published to L1. */ {
|
|
22
|
+
type: 'chain-checkpointed';
|
|
23
|
+
checkpoint: PublishedCheckpoint;
|
|
24
|
+
block: L2BlockId;
|
|
25
|
+
}
|
|
26
|
+
| /**
|
|
27
|
+
* Reports last correct block (new tip of the proposed chain). Note that this is not necessarily the anchor block
|
|
28
|
+
* that will be used in the transaction - if the chain has already moved past the reorg, we'll also see blocks-added
|
|
29
|
+
* events that will push the anchor block forward.
|
|
30
|
+
*/ {
|
|
21
31
|
type: 'chain-pruned';
|
|
22
32
|
block: L2BlockId;
|
|
33
|
+
checkpoint: CheckpointId;
|
|
23
34
|
}
|
|
24
35
|
| /** Reports new proven block. */ {
|
|
25
36
|
type: 'chain-proven';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { AbortError } from '@aztec/foundation/error';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
|
|
6
|
+
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
6
7
|
import { type L2BlockId, type L2BlockSource, makeL2BlockId } from '../l2_block_source.js';
|
|
7
8
|
import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider } from './interfaces.js';
|
|
8
9
|
|
|
@@ -13,7 +14,10 @@ export class L2BlockStream {
|
|
|
13
14
|
private hasStarted = false;
|
|
14
15
|
|
|
15
16
|
constructor(
|
|
16
|
-
private l2BlockSource: Pick<
|
|
17
|
+
private l2BlockSource: Pick<
|
|
18
|
+
L2BlockSource,
|
|
19
|
+
'getL2BlocksNew' | 'getBlockHeader' | 'getL2Tips' | 'getPublishedCheckpoints' | 'getCheckpointedBlocks'
|
|
20
|
+
>,
|
|
17
21
|
private localData: L2BlockStreamLocalDataProvider,
|
|
18
22
|
private handler: L2BlockStreamEventHandler,
|
|
19
23
|
private readonly log = createLogger('types:block_stream'),
|
|
@@ -24,6 +28,8 @@ export class L2BlockStream {
|
|
|
24
28
|
startingBlock?: number;
|
|
25
29
|
/** Instead of downloading all blocks, only fetch the smallest subset that results in reliable reorg detection. */
|
|
26
30
|
skipFinalized?: boolean;
|
|
31
|
+
/** When true, checkpoint events will not be emitted. Blocks are still fetched via checkpoints but only blocks-added events are emitted. */
|
|
32
|
+
ignoreCheckpoints?: boolean;
|
|
27
33
|
} = {},
|
|
28
34
|
) {
|
|
29
35
|
// Note that RunningPromise is in stopped state by default. This promise won't run until someone invokes `start`,
|
|
@@ -61,36 +67,29 @@ export class L2BlockStream {
|
|
|
61
67
|
try {
|
|
62
68
|
const sourceTips = await this.l2BlockSource.getL2Tips();
|
|
63
69
|
const localTips = await this.localData.getL2Tips();
|
|
64
|
-
this.log.trace(`Running L2 block stream`, {
|
|
65
|
-
sourceLatest: sourceTips.latest.number,
|
|
66
|
-
localLatest: localTips.latest.number,
|
|
67
|
-
sourceFinalized: sourceTips.finalized.number,
|
|
68
|
-
localFinalized: localTips.finalized.number,
|
|
69
|
-
sourceProven: sourceTips.proven.number,
|
|
70
|
-
localProven: localTips.proven.number,
|
|
71
|
-
sourceLatestHash: sourceTips.latest.hash,
|
|
72
|
-
localLatestHash: localTips.latest.hash,
|
|
73
|
-
sourceProvenHash: sourceTips.proven.hash,
|
|
74
|
-
localProvenHash: localTips.proven.hash,
|
|
75
|
-
sourceFinalizedHash: sourceTips.finalized.hash,
|
|
76
|
-
localFinalizedHash: localTips.finalized.hash,
|
|
77
|
-
});
|
|
70
|
+
this.log.trace(`Running L2 block stream`, { sourceTips, localTips });
|
|
78
71
|
|
|
79
72
|
// Check if there was a reorg and emit a chain-pruned event if so.
|
|
80
|
-
let latestBlockNumber = localTips.
|
|
81
|
-
const sourceCache = new BlockHashCache([sourceTips.
|
|
73
|
+
let latestBlockNumber = localTips.proposed.number;
|
|
74
|
+
const sourceCache = new BlockHashCache([sourceTips.proposed]);
|
|
82
75
|
while (!(await this.areBlockHashesEqualAt(latestBlockNumber, { sourceCache }))) {
|
|
83
76
|
latestBlockNumber--;
|
|
84
77
|
}
|
|
85
78
|
|
|
86
|
-
if (latestBlockNumber < localTips.
|
|
87
|
-
latestBlockNumber = BlockNumber(Math.min(latestBlockNumber, sourceTips.
|
|
79
|
+
if (latestBlockNumber < localTips.proposed.number) {
|
|
80
|
+
latestBlockNumber = BlockNumber(Math.min(latestBlockNumber, sourceTips.proposed.number)); // see #13471
|
|
88
81
|
const hash = sourceCache.get(latestBlockNumber) ?? (await this.getBlockHashFromSource(latestBlockNumber));
|
|
89
82
|
if (latestBlockNumber !== 0 && !hash) {
|
|
90
83
|
throw new Error(`Block hash not found in block source for block number ${latestBlockNumber}`);
|
|
91
84
|
}
|
|
92
|
-
this.log.verbose(
|
|
93
|
-
|
|
85
|
+
this.log.verbose(
|
|
86
|
+
`Reorg detected. Pruning blocks from ${latestBlockNumber + 1} to ${localTips.proposed.number}.`,
|
|
87
|
+
);
|
|
88
|
+
await this.emitEvent({
|
|
89
|
+
type: 'chain-pruned',
|
|
90
|
+
block: makeL2BlockId(latestBlockNumber, hash),
|
|
91
|
+
checkpoint: sourceTips.checkpointed.checkpoint,
|
|
92
|
+
});
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
// If we are just starting, use the starting block number from the options.
|
|
@@ -105,40 +104,115 @@ export class L2BlockStream {
|
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
let nextBlockNumber = latestBlockNumber + 1;
|
|
107
|
+
let nextCheckpointToEmit = CheckpointNumber(localTips.checkpointed.checkpoint.number + 1);
|
|
108
108
|
if (this.opts.skipFinalized) {
|
|
109
109
|
// When skipping finalized blocks we need to provide reliable reorg detection while fetching as few blocks as
|
|
110
110
|
// possible. Finalized blocks cannot be reorged by definition, so we can skip most of them. We do need the very
|
|
111
111
|
// last finalized block however in order to guarantee that we will eventually find a block in which our local
|
|
112
112
|
// store matches the source.
|
|
113
113
|
// If the last finalized block is behind our local tip, there is nothing to skip.
|
|
114
|
-
nextBlockNumber = Math.max(sourceTips.finalized.number, nextBlockNumber);
|
|
114
|
+
nextBlockNumber = Math.max(sourceTips.finalized.block.number, nextBlockNumber);
|
|
115
|
+
// If the next checkpoint to emit is behind the finalized tip then skip forward
|
|
116
|
+
nextCheckpointToEmit = CheckpointNumber(Math.max(nextCheckpointToEmit, sourceTips.finalized.checkpoint.number));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Loop 1: Emit checkpoint events for checkpoints whose blocks are already in local storage.
|
|
120
|
+
// This handles the case where blocks were synced as uncheckpointed and later became checkpointed.
|
|
121
|
+
// The guard `lastBlockInCheckpoint.number > localTips.proposed.number` ensures we don't emit
|
|
122
|
+
// checkpoints for blocks we don't have (e.g., when startingBlock skips earlier blocks).
|
|
123
|
+
// Since only one checkpoint can ever be uncheckpointed, this loop should iterate at most once.
|
|
124
|
+
if (!this.opts.ignoreCheckpoints) {
|
|
125
|
+
let loop1Iterations = 0;
|
|
126
|
+
while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
|
|
127
|
+
const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(nextCheckpointToEmit, 1);
|
|
128
|
+
if (checkpoints.length === 0) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
const lastBlockInCheckpoint = checkpoints[0].checkpoint.blocks.at(-1)!;
|
|
132
|
+
// If this checkpoint has blocks we haven't seen yet, stop - they need to be fetched first
|
|
133
|
+
if (lastBlockInCheckpoint.number > localTips.proposed.number) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
loop1Iterations++;
|
|
137
|
+
if (loop1Iterations > 1) {
|
|
138
|
+
this.log.warn(
|
|
139
|
+
`Emitting multiple checkpoints (${loop1Iterations}) for already-local blocks. ` +
|
|
140
|
+
`Next checkpoint: ${nextCheckpointToEmit}, source checkpointed: ${sourceTips.checkpointed.checkpoint.number}`,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
const lastBlockHash = await lastBlockInCheckpoint.hash();
|
|
144
|
+
await this.emitEvent({
|
|
145
|
+
type: 'chain-checkpointed',
|
|
146
|
+
checkpoint: checkpoints[0],
|
|
147
|
+
block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
|
|
148
|
+
});
|
|
149
|
+
nextCheckpointToEmit = CheckpointNumber(nextCheckpointToEmit + 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Loop 2: Fetch new checkpointed blocks. For each block, get its checkpoint, emit all blocks
|
|
154
|
+
// from that checkpoint that we need, then emit the checkpoint event.
|
|
155
|
+
// We cache the current checkpoint to avoid redundant fetches when batchSize < checkpoint size.
|
|
156
|
+
let checkpoint: PublishedCheckpoint | undefined;
|
|
157
|
+
while (nextBlockNumber <= sourceTips.checkpointed.block.number) {
|
|
158
|
+
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
|
|
159
|
+
|
|
160
|
+
// Check if we need to fetch a new checkpoint (nextBlockNumber is beyond the cached one)
|
|
161
|
+
if (!checkpoint || nextBlockNumber > checkpoint.checkpoint.blocks.at(-1)!.number) {
|
|
162
|
+
const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
|
|
163
|
+
if (blocks.length === 0) {
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(blocks[0].checkpointNumber, 1);
|
|
167
|
+
if (checkpoints.length === 0) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
checkpoint = checkpoints[0];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Get all blocks from this checkpoint that we need, respecting batchSize
|
|
174
|
+
const blocksForCheckpoint = checkpoint.checkpoint.blocks
|
|
175
|
+
.filter(b => b.number >= nextBlockNumber)
|
|
176
|
+
.slice(0, limit);
|
|
177
|
+
if (blocksForCheckpoint.length === 0) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
await this.emitEvent({ type: 'blocks-added', blocks: blocksForCheckpoint });
|
|
181
|
+
nextBlockNumber = blocksForCheckpoint.at(-1)!.number + 1;
|
|
182
|
+
|
|
183
|
+
// If we've reached the end of this checkpoint, emit the checkpoint event
|
|
184
|
+
const lastBlockInCheckpoint = checkpoint.checkpoint.blocks.at(-1)!;
|
|
185
|
+
if (!this.opts.ignoreCheckpoints && nextBlockNumber > lastBlockInCheckpoint.number) {
|
|
186
|
+
const lastBlockHash = await lastBlockInCheckpoint.hash();
|
|
187
|
+
await this.emitEvent({
|
|
188
|
+
type: 'chain-checkpointed',
|
|
189
|
+
checkpoint,
|
|
190
|
+
block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
115
193
|
}
|
|
116
194
|
|
|
117
|
-
//
|
|
118
|
-
while (nextBlockNumber <= sourceTips.
|
|
119
|
-
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.
|
|
195
|
+
// Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
|
|
196
|
+
while (nextBlockNumber <= sourceTips.proposed.number) {
|
|
197
|
+
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
|
|
120
198
|
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit} proven=${this.opts.proven}`);
|
|
121
|
-
const blocks = await this.l2BlockSource.
|
|
122
|
-
BlockNumber(nextBlockNumber),
|
|
123
|
-
limit,
|
|
124
|
-
this.opts.proven,
|
|
125
|
-
);
|
|
199
|
+
const blocks = await this.l2BlockSource.getL2BlocksNew(BlockNumber(nextBlockNumber), limit, this.opts.proven);
|
|
126
200
|
if (blocks.length === 0) {
|
|
127
201
|
break;
|
|
128
202
|
}
|
|
129
203
|
await this.emitEvent({ type: 'blocks-added', blocks });
|
|
130
|
-
nextBlockNumber = blocks.at(-1)!.
|
|
204
|
+
nextBlockNumber = blocks.at(-1)!.number + 1;
|
|
131
205
|
}
|
|
132
206
|
|
|
133
207
|
// Update the proven and finalized tips.
|
|
134
|
-
if (localTips.proven !== undefined && sourceTips.proven.number !== localTips.proven.number) {
|
|
208
|
+
if (localTips.proven !== undefined && sourceTips.proven.block.number !== localTips.proven.block.number) {
|
|
135
209
|
await this.emitEvent({
|
|
136
210
|
type: 'chain-proven',
|
|
137
|
-
block: sourceTips.proven,
|
|
211
|
+
block: sourceTips.proven.block,
|
|
138
212
|
});
|
|
139
213
|
}
|
|
140
|
-
if (localTips.finalized !== undefined && sourceTips.finalized.number !== localTips.finalized.number) {
|
|
141
|
-
await this.emitEvent({ type: 'chain-finalized', block: sourceTips.finalized });
|
|
214
|
+
if (localTips.finalized !== undefined && sourceTips.finalized.block.number !== localTips.finalized.block.number) {
|
|
215
|
+
await this.emitEvent({ type: 'chain-finalized', block: sourceTips.finalized.block });
|
|
142
216
|
}
|
|
143
217
|
} catch (err: any) {
|
|
144
218
|
if (err.name === 'AbortError') {
|
|
@@ -186,7 +260,7 @@ export class L2BlockStream {
|
|
|
186
260
|
|
|
187
261
|
private async emitEvent(event: L2BlockStreamEvent) {
|
|
188
262
|
this.log.debug(
|
|
189
|
-
`Emitting ${event.type} (${event.type === 'blocks-added' ? event.blocks.length : event.block.number})`,
|
|
263
|
+
`Emitting ${event.type} (${event.type === 'blocks-added' ? event.blocks.length : event.type === 'chain-checkpointed' ? event.checkpoint.checkpoint.number : event.block.number})`,
|
|
190
264
|
);
|
|
191
265
|
await this.handler.handleBlockStreamEvent(event);
|
|
192
266
|
if (!this.isRunning() && !this.isSyncing) {
|