@aztec/stdlib 0.0.1-commit.1142ef1 → 0.0.1-commit.1bea0213
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/function_call.d.ts +9 -1
- package/dest/abi/function_call.d.ts.map +1 -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_circuit_public_inputs.d.ts +9 -9
- 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_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/revert_code.d.ts +4 -4
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/block/block_hash.d.ts +16 -9
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +23 -8
- 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 +2 -1
- package/dest/block/checkpointed_l2_block.d.ts +20 -137
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +7 -45
- package/dest/block/in_block.d.ts +8 -8
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +4 -4
- 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.d.ts +55 -59
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +64 -109
- package/dest/block/l2_block_source.d.ts +63 -38
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +2 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +9 -6
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +37 -34
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- 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 +2 -7
- package/dest/block/validate_block_result.d.ts +1 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +5 -4
- package/dest/checkpoint/checkpoint.d.ts +30 -20
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +18 -6
- package/dest/checkpoint/published_checkpoint.d.ts +17 -15
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +4 -3
- package/dest/config/node-rpc-config.js +1 -1
- 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/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +1 -2
- package/dest/database-version/version_manager.d.ts +4 -2
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- 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/epoch-helpers/index.js +1 -1
- package/dest/errors/proving_error.d.ts +2 -2
- package/dest/errors/proving_error.d.ts.map +1 -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 +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +16 -14
- package/dest/interfaces/aztec-node-admin.d.ts +56 -26
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +61 -43
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +7 -9
- package/dest/interfaces/block-builder.d.ts +16 -14
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +8 -8
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +3 -3
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +10 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +14 -14
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +69 -13
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +2 -2
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +1 -1
- 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 +16 -6
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +16 -8
- 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/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_to_avm_accumulated_data.d.ts +2 -2
- 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_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/public_call_request.d.ts +22 -1
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- 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/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 +7 -5
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +10 -6
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +5 -5
- 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 +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +5 -3
- package/dest/messaging/out_hash.d.ts +41 -4
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +52 -26
- 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/block_proposal.d.ts +14 -6
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +25 -7
- package/dest/p2p/checkpoint_attestation.d.ts +5 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +11 -5
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +17 -5
- package/dest/p2p/consensus_payload.d.ts +4 -3
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +0 -3
- package/dest/p2p/constants.d.ts +3 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +2 -0
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/message_validator.d.ts +18 -3
- package/dest/p2p/message_validator.d.ts.map +1 -1
- package/dest/p2p/message_validator.js +2 -1
- package/dest/p2p/signed_txs.d.ts +3 -1
- package/dest/p2p/signed_txs.d.ts.map +1 -1
- package/dest/p2p/signed_txs.js +6 -1
- package/dest/p2p/topic_type.js +2 -1
- 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 +44 -3
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +2 -2
- 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_header.d.ts +29 -2
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +21 -5
- 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 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +10 -6
- 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 +12 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +4 -1
- 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 +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +6 -15
- package/dest/tests/jest.js +1 -1
- package/dest/tests/mocks.d.ts +15 -13
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +41 -24
- 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/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 +14 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +5 -1
- package/dest/tx/call_context.d.ts +13 -1
- package/dest/tx/call_context.d.ts.map +1 -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_variables.d.ts +9 -1
- package/dest/tx/global_variables.d.ts.map +1 -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 +3 -3
- package/dest/tx/indexed_tx_effect.d.ts +4 -4
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +2 -2
- 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 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +1 -1
- 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/state_reference.d.ts +3 -1
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/tx.d.ts +24 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +6 -3
- 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 +0 -7
- 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_hash.d.ts +2 -1
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +47 -13
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- package/dest/tx/tx_request.d.ts +6 -1
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- 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/utils.ts +17 -0
- package/src/block/block_hash.ts +36 -10
- package/src/block/block_parameter.ts +4 -2
- package/src/block/body.ts +2 -1
- package/src/block/checkpointed_l2_block.ts +8 -58
- package/src/block/in_block.ts +5 -5
- package/src/block/index.ts +0 -2
- package/src/block/l2_block.ts +101 -149
- package/src/block/l2_block_source.ts +69 -41
- package/src/block/l2_block_stream/interfaces.ts +8 -5
- package/src/block/l2_block_stream/l2_block_stream.ts +45 -37
- package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
- package/src/block/test/l2_tips_store_test_suite.ts +4 -9
- package/src/block/validate_block_result.ts +5 -4
- package/src/checkpoint/checkpoint.ts +33 -11
- package/src/checkpoint/published_checkpoint.ts +4 -3
- package/src/config/node-rpc-config.ts +1 -1
- package/src/contract/index.ts +0 -2
- package/src/contract/private_function.ts +1 -2
- package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
- package/src/deserialization/index.ts +21 -0
- package/src/epoch-helpers/index.ts +1 -1
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +16 -23
- package/src/interfaces/aztec-node.ts +76 -74
- package/src/interfaces/block-builder.ts +31 -24
- package/src/interfaces/configs.ts +1 -3
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/prover-client.ts +15 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +8 -9
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +17 -6
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +17 -14
- package/src/logs/log_id.ts +6 -6
- package/src/messaging/l2_to_l1_membership.ts +5 -3
- package/src/messaging/out_hash.ts +60 -29
- package/src/note/note_dao.ts +18 -13
- package/src/p2p/block_proposal.ts +27 -11
- package/src/p2p/checkpoint_proposal.ts +20 -9
- package/src/p2p/consensus_payload.ts +0 -5
- package/src/p2p/constants.ts +3 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/message_validator.ts +14 -2
- package/src/p2p/signed_txs.ts +6 -1
- package/src/p2p/topic_type.ts +1 -1
- 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 +2 -2
- package/src/rollup/checkpoint_header.ts +20 -0
- package/src/rollup/checkpoint_rollup_public_inputs.ts +12 -6
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
- package/src/rollup/root_rollup_public_inputs.ts +4 -1
- package/src/tests/factories.ts +6 -26
- package/src/tests/jest.ts +1 -1
- package/src/tests/mocks.ts +56 -38
- package/src/tx/block_header.ts +11 -3
- package/src/tx/indexed_tx_effect.ts +2 -2
- package/src/tx/private_execution_result.ts +1 -1
- package/src/tx/profiling.ts +46 -4
- package/src/tx/tx.ts +8 -9
- package/src/tx/tx_effect.ts +0 -9
- package/src/tx/tx_receipt.ts +75 -18
- package/src/tx/validator/error_texts.ts +3 -0
- package/src/zkpassport/index.ts +11 -12
- package/dest/block/l2_block_code_to_purge.d.ts +0 -11
- package/dest/block/l2_block_code_to_purge.d.ts.map +0 -1
- package/dest/block/l2_block_code_to_purge.js +0 -55
- package/dest/block/l2_block_header.d.ts +0 -94
- package/dest/block/l2_block_header.d.ts.map +0 -1
- package/dest/block/l2_block_header.js +0 -160
- package/dest/block/l2_block_new.d.ts +0 -134
- package/dest/block/l2_block_new.d.ts.map +0 -1
- package/dest/block/l2_block_new.js +0 -155
- 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/src/block/l2_block_code_to_purge.ts +0 -80
- package/src/block/l2_block_header.ts +0 -255
- package/src/block/l2_block_new.ts +0 -211
- package/src/contract/contract_class_metadata.ts +0 -8
- package/src/contract/contract_metadata.ts +0 -7
|
@@ -4,9 +4,12 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
|
|
6
6
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
7
|
-
import { type L2BlockId, type
|
|
7
|
+
import { type L2BlockId, type L2BlockSource, makeL2BlockId } from '../l2_block_source.js';
|
|
8
8
|
import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider } from './interfaces.js';
|
|
9
9
|
|
|
10
|
+
/** Maximum number of checkpoints to prefetch at once during sync. Matches MAX_RPC_CHECKPOINTS_LEN. */
|
|
11
|
+
export const CHECKPOINT_PREFETCH_LIMIT = 50;
|
|
12
|
+
|
|
10
13
|
/** Creates a stream of events for new blocks, chain tips updates, and reorgs, out of polling an archiver or a node. */
|
|
11
14
|
export class L2BlockStream {
|
|
12
15
|
private readonly runningPromise: RunningPromise;
|
|
@@ -16,13 +19,12 @@ export class L2BlockStream {
|
|
|
16
19
|
constructor(
|
|
17
20
|
private l2BlockSource: Pick<
|
|
18
21
|
L2BlockSource,
|
|
19
|
-
'
|
|
22
|
+
'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
|
|
20
23
|
>,
|
|
21
24
|
private localData: L2BlockStreamLocalDataProvider,
|
|
22
25
|
private handler: L2BlockStreamEventHandler,
|
|
23
26
|
private readonly log = createLogger('types:block_stream'),
|
|
24
27
|
private opts: {
|
|
25
|
-
proven?: boolean;
|
|
26
28
|
pollIntervalMS?: number;
|
|
27
29
|
batchSize?: number;
|
|
28
30
|
startingBlock?: number;
|
|
@@ -30,6 +32,8 @@ export class L2BlockStream {
|
|
|
30
32
|
skipFinalized?: boolean;
|
|
31
33
|
/** When true, checkpoint events will not be emitted. Blocks are still fetched via checkpoints but only blocks-added events are emitted. */
|
|
32
34
|
ignoreCheckpoints?: boolean;
|
|
35
|
+
/** Maximum number of checkpoints to prefetch at once during sync. Defaults to CHECKPOINT_PREFETCH_LIMIT (50). */
|
|
36
|
+
checkpointPrefetchLimit?: number;
|
|
33
37
|
} = {},
|
|
34
38
|
) {
|
|
35
39
|
// Note that RunningPromise is in stopped state by default. This promise won't run until someone invokes `start`,
|
|
@@ -85,18 +89,9 @@ export class L2BlockStream {
|
|
|
85
89
|
this.log.verbose(
|
|
86
90
|
`Reorg detected. Pruning blocks from ${latestBlockNumber + 1} to ${localTips.proposed.number}.`,
|
|
87
91
|
);
|
|
88
|
-
// This check is not 100% accurate
|
|
89
|
-
// If the local tips are sufficiently behind the source tips, such that we are missing at least one checkpoint
|
|
90
|
-
// that has now been re-orged due to a proof failure then this will indicate a failure to checkpoint rather than a failure to prove
|
|
91
|
-
// TODO: (mbps/PhilWindle): Improve re-org detection accuracy when we come to do re-orgs
|
|
92
|
-
let reason: L2BlockPruneReason = 'unproven';
|
|
93
|
-
if (latestBlockNumber === localTips.checkpointed.block.number && !this.opts.ignoreCheckpoints) {
|
|
94
|
-
reason = 'uncheckpointed';
|
|
95
|
-
}
|
|
96
92
|
await this.emitEvent({
|
|
97
93
|
type: 'chain-pruned',
|
|
98
94
|
block: makeL2BlockId(latestBlockNumber, hash),
|
|
99
|
-
reason,
|
|
100
95
|
checkpoint: sourceTips.checkpointed.checkpoint,
|
|
101
96
|
});
|
|
102
97
|
}
|
|
@@ -133,7 +128,7 @@ export class L2BlockStream {
|
|
|
133
128
|
if (!this.opts.ignoreCheckpoints) {
|
|
134
129
|
let loop1Iterations = 0;
|
|
135
130
|
while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
|
|
136
|
-
const checkpoints = await this.l2BlockSource.
|
|
131
|
+
const checkpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointToEmit, 1);
|
|
137
132
|
if (checkpoints.length === 0) {
|
|
138
133
|
break;
|
|
139
134
|
}
|
|
@@ -159,27 +154,36 @@ export class L2BlockStream {
|
|
|
159
154
|
}
|
|
160
155
|
}
|
|
161
156
|
|
|
162
|
-
// Loop 2: Fetch new checkpointed blocks. For each
|
|
157
|
+
// Loop 2: Fetch new checkpointed blocks. For each checkpoint, emit all blocks
|
|
163
158
|
// from that checkpoint that we need, then emit the checkpoint event.
|
|
164
|
-
// We
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
// We prefetch multiple checkpoints, then process them one by one.
|
|
160
|
+
let prefetchedCheckpoints: PublishedCheckpoint[] = [];
|
|
161
|
+
let prefetchIdx = 0;
|
|
162
|
+
let nextCheckpointNumber: CheckpointNumber | undefined;
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
// Find the starting checkpoint number
|
|
165
|
+
if (nextBlockNumber <= sourceTips.checkpointed.block.number) {
|
|
166
|
+
const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
|
|
167
|
+
if (blocks.length > 0) {
|
|
168
|
+
nextCheckpointNumber = blocks[0].checkpointNumber;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
while (nextBlockNumber <= sourceTips.checkpointed.block.number && nextCheckpointNumber !== undefined) {
|
|
173
|
+
// Refill the prefetch buffer when exhausted
|
|
174
|
+
if (prefetchIdx >= prefetchedCheckpoints.length) {
|
|
175
|
+
const prefetchLimit = this.opts.checkpointPrefetchLimit ?? CHECKPOINT_PREFETCH_LIMIT;
|
|
176
|
+
prefetchedCheckpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointNumber, prefetchLimit);
|
|
177
|
+
prefetchIdx = 0;
|
|
178
|
+
if (prefetchedCheckpoints.length === 0) {
|
|
177
179
|
break;
|
|
178
180
|
}
|
|
179
|
-
checkpoint = checkpoints[0];
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
const checkpoint = prefetchedCheckpoints[prefetchIdx]!;
|
|
184
|
+
|
|
182
185
|
// Get all blocks from this checkpoint that we need, respecting batchSize
|
|
186
|
+
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
|
|
183
187
|
const blocksForCheckpoint = checkpoint.checkpoint.blocks
|
|
184
188
|
.filter(b => b.number >= nextBlockNumber)
|
|
185
189
|
.slice(0, limit);
|
|
@@ -189,23 +193,27 @@ export class L2BlockStream {
|
|
|
189
193
|
await this.emitEvent({ type: 'blocks-added', blocks: blocksForCheckpoint });
|
|
190
194
|
nextBlockNumber = blocksForCheckpoint.at(-1)!.number + 1;
|
|
191
195
|
|
|
192
|
-
// If we've reached the end of this checkpoint, emit the checkpoint event
|
|
196
|
+
// If we've reached the end of this checkpoint, emit the checkpoint event and move to next
|
|
193
197
|
const lastBlockInCheckpoint = checkpoint.checkpoint.blocks.at(-1)!;
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
if (nextBlockNumber > lastBlockInCheckpoint.number) {
|
|
199
|
+
if (!this.opts.ignoreCheckpoints) {
|
|
200
|
+
const lastBlockHash = await lastBlockInCheckpoint.hash();
|
|
201
|
+
await this.emitEvent({
|
|
202
|
+
type: 'chain-checkpointed',
|
|
203
|
+
checkpoint,
|
|
204
|
+
block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
prefetchIdx++;
|
|
208
|
+
nextCheckpointNumber = CheckpointNumber(nextCheckpointNumber + 1);
|
|
201
209
|
}
|
|
202
210
|
}
|
|
203
211
|
|
|
204
212
|
// Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
|
|
205
213
|
while (nextBlockNumber <= sourceTips.proposed.number) {
|
|
206
214
|
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
|
|
207
|
-
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}
|
|
208
|
-
const blocks = await this.l2BlockSource.
|
|
215
|
+
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}`);
|
|
216
|
+
const blocks = await this.l2BlockSource.getBlocks(BlockNumber(nextBlockNumber), BlockNumber(limit));
|
|
209
217
|
if (blocks.length === 0) {
|
|
210
218
|
break;
|
|
211
219
|
}
|
|
@@ -2,7 +2,7 @@ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
|
2
2
|
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
|
|
4
4
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { L2Block } from '../l2_block.js';
|
|
6
6
|
import {
|
|
7
7
|
type CheckpointId,
|
|
8
8
|
GENESIS_CHECKPOINT_HEADER_HASH,
|
|
@@ -109,7 +109,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// Protected helper that subclasses can override for block hash computation
|
|
112
|
-
protected computeBlockHash(block:
|
|
112
|
+
protected computeBlockHash(block: L2Block): Promise<string> {
|
|
113
113
|
return block.hash().then(hash => hash.toString());
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -5,8 +5,8 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
5
5
|
import {
|
|
6
6
|
type CheckpointId,
|
|
7
7
|
GENESIS_CHECKPOINT_HEADER_HASH,
|
|
8
|
+
L2Block,
|
|
8
9
|
type L2BlockId,
|
|
9
|
-
L2BlockNew,
|
|
10
10
|
type L2TipId,
|
|
11
11
|
} from '@aztec/stdlib/block';
|
|
12
12
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -31,8 +31,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
31
31
|
blockToCheckpoint.clear();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
const makeBlock = async (number: number): Promise<
|
|
35
|
-
const block = await
|
|
34
|
+
const makeBlock = async (number: number): Promise<L2Block> => {
|
|
35
|
+
const block = await L2Block.random(BlockNumber(number));
|
|
36
36
|
blockHashes.set(number, (await block.hash()).toString());
|
|
37
37
|
return block;
|
|
38
38
|
};
|
|
@@ -74,7 +74,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
74
74
|
checkpointed: makeTipId(checkpointed),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
const makeCheckpoint = async (checkpointNumber: number, blocks:
|
|
77
|
+
const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
|
|
78
78
|
const checkpoint = await Checkpoint.random(CheckpointNumber(checkpointNumber), {
|
|
79
79
|
numBlocks: blocks.length,
|
|
80
80
|
startBlockNumber: blocks[0].number,
|
|
@@ -243,7 +243,6 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
243
243
|
await tipsStore.handleBlockStreamEvent({
|
|
244
244
|
type: 'chain-pruned',
|
|
245
245
|
block: makeBlockId(5),
|
|
246
|
-
reason: 'unproven',
|
|
247
246
|
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
248
247
|
});
|
|
249
248
|
|
|
@@ -268,7 +267,6 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
268
267
|
await tipsStore.handleBlockStreamEvent({
|
|
269
268
|
type: 'chain-pruned',
|
|
270
269
|
block: makeTip(0),
|
|
271
|
-
reason: 'unproven',
|
|
272
270
|
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
273
271
|
});
|
|
274
272
|
|
|
@@ -334,7 +332,6 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
334
332
|
await tipsStore.handleBlockStreamEvent({
|
|
335
333
|
type: 'chain-pruned',
|
|
336
334
|
block: makeBlockId(5),
|
|
337
|
-
reason: 'unproven',
|
|
338
335
|
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
339
336
|
});
|
|
340
337
|
|
|
@@ -399,7 +396,6 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
399
396
|
await tipsStore.handleBlockStreamEvent({
|
|
400
397
|
type: 'chain-pruned',
|
|
401
398
|
block: makeBlockId(3),
|
|
402
|
-
reason: 'unproven',
|
|
403
399
|
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
404
400
|
});
|
|
405
401
|
|
|
@@ -478,7 +474,6 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
478
474
|
await tipsStore.handleBlockStreamEvent({
|
|
479
475
|
type: 'chain-pruned',
|
|
480
476
|
block: makeBlockId(3),
|
|
481
|
-
reason: 'unproven',
|
|
482
477
|
checkpoint: { number: CheckpointNumber.ZERO, hash: GENESIS_CHECKPOINT_HEADER_HASH.toString() },
|
|
483
478
|
});
|
|
484
479
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
deserializeCheckpointInfo,
|
|
12
12
|
serializeCheckpointInfo,
|
|
13
13
|
} from '../checkpoint/checkpoint_info.js';
|
|
14
|
+
import { MAX_COMMITTEE_SIZE } from '../deserialization/index.js';
|
|
14
15
|
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
15
16
|
|
|
16
17
|
/** Subtype for invalid checkpoint validation results */
|
|
@@ -109,13 +110,13 @@ export function deserializeValidateCheckpointResult(bufferOrReader: Buffer | Buf
|
|
|
109
110
|
if (valid) {
|
|
110
111
|
return { valid };
|
|
111
112
|
}
|
|
112
|
-
const reason = reader.readString() as 'insufficient-attestations' | 'invalid-attestation';
|
|
113
|
+
const reason = reader.readString(64) as 'insufficient-attestations' | 'invalid-attestation';
|
|
113
114
|
const checkpoint = deserializeCheckpointInfo(reader.readBuffer());
|
|
114
|
-
const committee = reader.readVector(EthAddress);
|
|
115
|
+
const committee = reader.readVector(EthAddress, MAX_COMMITTEE_SIZE);
|
|
115
116
|
const epoch = EpochNumber(reader.readNumber());
|
|
116
117
|
const seed = reader.readBigInt();
|
|
117
|
-
const attestors = reader.readVector(EthAddress);
|
|
118
|
-
const attestations = reader.readVector(CommitteeAttestation);
|
|
118
|
+
const attestors = reader.readVector(EthAddress, MAX_COMMITTEE_SIZE);
|
|
119
|
+
const attestations = reader.readVector(CommitteeAttestation, MAX_COMMITTEE_SIZE);
|
|
119
120
|
const invalidIndex = reader.readNumber();
|
|
120
121
|
if (reason === 'insufficient-attestations') {
|
|
121
122
|
return { valid, reason, checkpoint, committee, epoch, seed, attestors, attestations };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BlockNumber,
|
|
4
|
+
CheckpointNumber,
|
|
5
|
+
CheckpointNumberSchema,
|
|
6
|
+
IndexWithinCheckpoint,
|
|
7
|
+
SlotNumber,
|
|
8
|
+
} from '@aztec/foundation/branded-types';
|
|
3
9
|
import { sum } from '@aztec/foundation/collection';
|
|
4
10
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
11
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -7,11 +13,15 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
7
13
|
|
|
8
14
|
import { z } from 'zod';
|
|
9
15
|
|
|
10
|
-
import {
|
|
16
|
+
import { L2Block } from '../block/l2_block.js';
|
|
17
|
+
import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
|
|
18
|
+
import { computeCheckpointOutHash } from '../messaging/out_hash.js';
|
|
11
19
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
12
20
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
13
21
|
import type { CheckpointInfo } from './checkpoint_info.js';
|
|
14
22
|
|
|
23
|
+
type FieldsOfCheckpoint = Omit<FieldsOf<Checkpoint>, 'slot'>;
|
|
24
|
+
|
|
15
25
|
export class Checkpoint {
|
|
16
26
|
constructor(
|
|
17
27
|
/** Snapshot of archive tree after the checkpoint is added. */
|
|
@@ -19,27 +29,31 @@ export class Checkpoint {
|
|
|
19
29
|
/** Header of the checkpoint. */
|
|
20
30
|
public header: CheckpointHeader,
|
|
21
31
|
/** L2 blocks in the checkpoint. */
|
|
22
|
-
public blocks:
|
|
32
|
+
public blocks: L2Block[],
|
|
23
33
|
/** Number of the checkpoint. */
|
|
24
34
|
public number: CheckpointNumber,
|
|
25
35
|
) {}
|
|
26
36
|
|
|
37
|
+
get slot(): SlotNumber {
|
|
38
|
+
return this.header.slotNumber;
|
|
39
|
+
}
|
|
40
|
+
|
|
27
41
|
static get schema() {
|
|
28
42
|
return z
|
|
29
43
|
.object({
|
|
30
44
|
archive: AppendOnlyTreeSnapshot.schema,
|
|
31
45
|
header: CheckpointHeader.schema,
|
|
32
|
-
blocks: z.array(
|
|
46
|
+
blocks: z.array(L2Block.schema),
|
|
33
47
|
number: CheckpointNumberSchema,
|
|
34
48
|
})
|
|
35
49
|
.transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
|
|
36
50
|
}
|
|
37
51
|
|
|
38
|
-
static from(fields:
|
|
52
|
+
static from(fields: FieldsOfCheckpoint) {
|
|
39
53
|
return new Checkpoint(...Checkpoint.getFields(fields));
|
|
40
54
|
}
|
|
41
55
|
|
|
42
|
-
static getFields(fields:
|
|
56
|
+
static getFields(fields: FieldsOfCheckpoint) {
|
|
43
57
|
return [fields.archive, fields.header, fields.blocks, fields.number] as const;
|
|
44
58
|
}
|
|
45
59
|
|
|
@@ -48,7 +62,7 @@ export class Checkpoint {
|
|
|
48
62
|
return new Checkpoint(
|
|
49
63
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
50
64
|
reader.readObject(CheckpointHeader),
|
|
51
|
-
reader.readVector(
|
|
65
|
+
reader.readVector(L2Block, MAX_BLOCKS_PER_CHECKPOINT),
|
|
52
66
|
CheckpointNumber(reader.readNumber()),
|
|
53
67
|
);
|
|
54
68
|
}
|
|
@@ -66,6 +80,14 @@ export class Checkpoint {
|
|
|
66
80
|
return this.header.hash();
|
|
67
81
|
}
|
|
68
82
|
|
|
83
|
+
// Returns the out hash computed from all l2-to-l1 messages in this checkpoint.
|
|
84
|
+
// Note: This value is different from the out hash in the header, which is the **accumulated** out hash over all
|
|
85
|
+
// checkpoints up to and including this one in the epoch.
|
|
86
|
+
public getCheckpointOutHash(): Fr {
|
|
87
|
+
const msgs = this.blocks.map(block => block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
|
|
88
|
+
return computeCheckpointOutHash(msgs);
|
|
89
|
+
}
|
|
90
|
+
|
|
69
91
|
public getState() {
|
|
70
92
|
return this.blocks.at(-1)!.header.state;
|
|
71
93
|
}
|
|
@@ -113,17 +135,17 @@ export class Checkpoint {
|
|
|
113
135
|
startBlockNumber?: number;
|
|
114
136
|
previousArchive?: AppendOnlyTreeSnapshot;
|
|
115
137
|
} & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
|
|
116
|
-
Partial<Parameters<typeof
|
|
138
|
+
Partial<Parameters<typeof L2Block.random>[1]> = {},
|
|
117
139
|
) {
|
|
118
140
|
const header = CheckpointHeader.random(options);
|
|
119
141
|
|
|
120
142
|
// Create blocks sequentially to chain archive roots properly.
|
|
121
143
|
// Each block's header.lastArchive must equal the previous block's archive.
|
|
122
|
-
const blocks:
|
|
144
|
+
const blocks: L2Block[] = [];
|
|
123
145
|
let lastArchive = previousArchive;
|
|
124
146
|
for (let i = 0; i < numBlocks; i++) {
|
|
125
|
-
const block = await
|
|
126
|
-
indexWithinCheckpoint: i,
|
|
147
|
+
const block = await L2Block.random(BlockNumber(startBlockNumber + i), {
|
|
148
|
+
indexWithinCheckpoint: IndexWithinCheckpoint(i),
|
|
127
149
|
...options,
|
|
128
150
|
...(lastArchive ? { lastArchive } : {}),
|
|
129
151
|
});
|
|
@@ -8,6 +8,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
|
|
10
10
|
import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
|
|
11
|
+
import { MAX_BLOCK_HASH_STRING_LENGTH, MAX_COMMITTEE_SIZE } from '../deserialization/index.js';
|
|
11
12
|
import { Checkpoint } from './checkpoint.js';
|
|
12
13
|
|
|
13
14
|
export class L1PublishedData {
|
|
@@ -42,7 +43,7 @@ export class L1PublishedData {
|
|
|
42
43
|
static fromBuffer(bufferOrReader: Buffer | BufferReader): L1PublishedData {
|
|
43
44
|
const reader = BufferReader.asReader(bufferOrReader);
|
|
44
45
|
const l1BlockNumber = reader.readBigInt();
|
|
45
|
-
const l1BlockHash = reader.readString();
|
|
46
|
+
const l1BlockHash = reader.readString(MAX_BLOCK_HASH_STRING_LENGTH);
|
|
46
47
|
const l1Timestamp = reader.readBigInt();
|
|
47
48
|
return new L1PublishedData(l1BlockNumber, l1Timestamp, l1BlockHash);
|
|
48
49
|
}
|
|
@@ -82,9 +83,9 @@ export class PublishedCheckpoint {
|
|
|
82
83
|
const reader = BufferReader.asReader(bufferOrReader);
|
|
83
84
|
const checkpoint = reader.readObject(Checkpoint);
|
|
84
85
|
const l1BlockNumber = reader.readBigInt();
|
|
85
|
-
const l1BlockHash = reader.readString();
|
|
86
|
+
const l1BlockHash = reader.readString(MAX_BLOCK_HASH_STRING_LENGTH);
|
|
86
87
|
const l1Timestamp = reader.readBigInt();
|
|
87
|
-
const attestations = reader.readVector(CommitteeAttestation);
|
|
88
|
+
const attestations = reader.readVector(CommitteeAttestation, MAX_COMMITTEE_SIZE);
|
|
88
89
|
return new PublishedCheckpoint(
|
|
89
90
|
checkpoint,
|
|
90
91
|
new L1PublishedData(l1BlockNumber, l1Timestamp, l1BlockHash),
|
|
@@ -21,7 +21,7 @@ export const nodeRpcConfigMappings: ConfigMappingsType<NodeRPCConfig> = {
|
|
|
21
21
|
rpcMaxBodySize: {
|
|
22
22
|
env: 'RPC_MAX_BODY_SIZE',
|
|
23
23
|
description: 'Maximum allowed batch size for JSON RPC batch requests.',
|
|
24
|
-
defaultValue: '
|
|
24
|
+
defaultValue: '1mb',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
package/src/contract/index.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export * from './artifact_hash.js';
|
|
2
2
|
export * from './contract_address.js';
|
|
3
3
|
export * from './contract_class.js';
|
|
4
|
-
export * from './contract_class_metadata.js';
|
|
5
4
|
export * from './contract_class_id.js';
|
|
6
5
|
export * from './contract_deployment_data.js';
|
|
7
6
|
export * from './contract_instance.js';
|
|
8
|
-
export * from './contract_metadata.js';
|
|
9
7
|
export * from './contract_instance_update.js';
|
|
10
8
|
export * from './private_function.js';
|
|
11
9
|
export * from './private_function_membership_proof.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FUNCTION_TREE_HEIGHT, GeneratorIndex } from '@aztec/constants';
|
|
2
|
-
import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
|
|
3
2
|
import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
4
|
import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
|
|
@@ -38,7 +37,7 @@ export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<B
|
|
|
38
37
|
async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
|
|
39
38
|
if (!privateFunctionTreeCalculator) {
|
|
40
39
|
const functionTreeZeroLeaf = (
|
|
41
|
-
await
|
|
40
|
+
await poseidon2Hash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
|
|
42
41
|
).toBuffer() as Buffer<ArrayBuffer>;
|
|
43
42
|
privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
|
|
44
43
|
FUNCTION_TREE_HEIGHT,
|
|
@@ -68,23 +68,22 @@ export class DelayedPublicMutableValues {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return DelayedPublicMutableValues.fromFields(fields);
|
|
71
|
+
const fieldPromises = Array.from({ length: DELAYED_PUBLIC_MUTABLE_VALUES_LEN }).map((_, i) =>
|
|
72
|
+
readStorage(delayedPublicMutableSlot.add(new Fr(i))),
|
|
73
|
+
);
|
|
74
|
+
return DelayedPublicMutableValues.fromFields(await Promise.all(fieldPromises));
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
isEmpty(): boolean {
|
|
79
78
|
return this.svc.isEmpty() && this.sdc.isEmpty();
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
const
|
|
81
|
+
writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
|
|
82
|
+
const fieldPromises = this.toFields().map((field, i) =>
|
|
83
|
+
storageWrite(delayedPublicMutableSlot.add(new Fr(i)), field),
|
|
84
|
+
);
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
|
|
87
|
-
}
|
|
86
|
+
return Promise.all(fieldPromises);
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
async hash(): Promise<Fr> {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for deserialization bounds checking.
|
|
3
|
+
* These constants define maximum allowed sizes during deserialization
|
|
4
|
+
* to prevent DoS attacks via maliciously crafted messages.
|
|
5
|
+
*/
|
|
6
|
+
import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
7
|
+
|
|
8
|
+
/** Max transactions per block for deserialization validation */
|
|
9
|
+
export const MAX_TXS_PER_BLOCK = 2 ** 16;
|
|
10
|
+
|
|
11
|
+
/** Max committee size - theoretical max from bitmap design (256 bytes × 8 bits) */
|
|
12
|
+
export const MAX_COMMITTEE_SIZE = 2048;
|
|
13
|
+
|
|
14
|
+
/** Max blocks per checkpoint */
|
|
15
|
+
export const MAX_BLOCKS_PER_CHECKPOINT = 72;
|
|
16
|
+
|
|
17
|
+
/** Max tx effects per body (based on blob capacity per checkpoint) */
|
|
18
|
+
export const MAX_TX_EFFECTS_PER_BODY = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB;
|
|
19
|
+
|
|
20
|
+
/** Max block hash string length (hex: 0x + 64 chars, with generous headroom) */
|
|
21
|
+
export const MAX_BLOCK_HASH_STRING_LENGTH = 128;
|
|
@@ -69,7 +69,7 @@ export function getSlotRangeForEpoch(
|
|
|
69
69
|
epochNumber: EpochNumber,
|
|
70
70
|
constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
71
71
|
): [SlotNumber, SlotNumber] {
|
|
72
|
-
const startSlot = SlotNumber(epochNumber * constants.epochDuration);
|
|
72
|
+
const startSlot = SlotNumber(Number(epochNumber) * constants.epochDuration);
|
|
73
73
|
return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -4,9 +4,8 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
|
-
import { CheckpointedL2Block
|
|
7
|
+
import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
|
|
8
8
|
import { L2Block } from '../block/l2_block.js';
|
|
9
|
-
import { L2BlockNew } from '../block/l2_block_new.js';
|
|
10
9
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
11
10
|
import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
|
|
12
11
|
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
@@ -83,6 +82,8 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
83
82
|
getRegistryAddress: z.function().args().returns(schemas.EthAddress),
|
|
84
83
|
getBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
85
84
|
getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
85
|
+
getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
86
|
+
getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
86
87
|
getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
87
88
|
getBlockHeader: z
|
|
88
89
|
.function()
|
|
@@ -91,45 +92,37 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
91
92
|
getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
|
|
92
93
|
getCheckpointedBlocks: z
|
|
93
94
|
.function()
|
|
94
|
-
.args(BlockNumberSchema, schemas.Integer
|
|
95
|
+
.args(BlockNumberSchema, schemas.Integer)
|
|
95
96
|
.returns(z.array(CheckpointedL2Block.schema)),
|
|
96
|
-
getBlocks: z
|
|
97
|
-
|
|
98
|
-
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
99
|
-
.returns(z.array(L2Block.schema)),
|
|
100
|
-
getPublishedCheckpoints: z
|
|
97
|
+
getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
|
|
98
|
+
getCheckpoints: z
|
|
101
99
|
.function()
|
|
102
100
|
.args(CheckpointNumberSchema, schemas.Integer)
|
|
103
101
|
.returns(z.array(PublishedCheckpoint.schema)),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
107
|
-
.returns(z.array(PublishedL2Block.schema)),
|
|
108
|
-
getL2BlocksNew: z
|
|
109
|
-
.function()
|
|
110
|
-
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
111
|
-
.returns(z.array(L2BlockNew.schema)),
|
|
112
|
-
getPublishedBlockByHash: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
|
|
113
|
-
getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(PublishedL2Block.schema.optional()),
|
|
102
|
+
getCheckpointedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
|
|
103
|
+
getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
|
|
114
104
|
getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
115
105
|
getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
116
|
-
|
|
106
|
+
getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
107
|
+
getL2BlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
108
|
+
getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
117
109
|
getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
|
|
118
110
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
119
111
|
getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
|
|
120
112
|
getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
|
|
121
113
|
getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
getCheckpointedBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointedL2Block.schema)),
|
|
115
|
+
getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2Block.schema)),
|
|
116
|
+
getCheckpointedBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
124
117
|
isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
|
|
125
118
|
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
126
119
|
getPrivateLogsByTags: z
|
|
127
120
|
.function()
|
|
128
|
-
.args(z.array(SiloedTag.schema))
|
|
121
|
+
.args(z.array(SiloedTag.schema), optional(z.number().gte(0)))
|
|
129
122
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
130
123
|
getPublicLogsByTagsFromContract: z
|
|
131
124
|
.function()
|
|
132
|
-
.args(schemas.AztecAddress, z.array(Tag.schema))
|
|
125
|
+
.args(schemas.AztecAddress, z.array(Tag.schema), optional(z.number().gte(0)))
|
|
133
126
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
134
127
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
135
128
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|