@aztec/stdlib 0.0.1-commit.96bb3f7 → 0.0.1-commit.a072138
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 +18 -14
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +22 -20
- 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 +9 -9
- 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 +56 -59
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +64 -110
- package/dest/block/l2_block_source.d.ts +65 -39
- 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_address.js +1 -1
- package/dest/contract/contract_class_id.d.ts +1 -1
- package/dest/contract/contract_class_id.js +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 +2 -3
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/database-version/database_version.d.ts +58 -0
- package/dest/database-version/database_version.d.ts.map +1 -0
- package/dest/database-version/database_version.js +69 -0
- package/dest/database-version/version_manager.d.ts +3 -49
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +1 -66
- 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.d.ts +3 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +5 -1
- package/dest/errors/proving_error.d.ts +2 -2
- package/dest/errors/proving_error.d.ts.map +1 -1
- package/dest/hash/hash.js +2 -2
- package/dest/hash/map_slot.d.ts +1 -1
- package/dest/hash/map_slot.d.ts.map +1 -1
- package/dest/hash/map_slot.js +4 -3
- 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 +18 -15
- 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 +65 -68
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +10 -16
- package/dest/interfaces/block-builder.d.ts +22 -14
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- 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 +8 -8
- 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 +70 -14
- 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/derivation.d.ts +3 -3
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +1 -1
- package/dest/keys/public_keys.d.ts +5 -1
- package/dest/keys/public_keys.d.ts.map +1 -1
- package/dest/keys/utils.d.ts +1 -1
- package/dest/keys/utils.d.ts.map +1 -1
- package/dest/keys/utils.js +7 -3
- package/dest/l1-contracts/slash_factory.d.ts +1 -1
- package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
- package/dest/l1-contracts/slash_factory.js +1 -0
- 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 +11 -9
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +12 -8
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +6 -5
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -3
- 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 +23 -8
- 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 +20 -7
- 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/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +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 +20 -14
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +45 -27
- 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 +4 -4
- package/dest/tx/indexed_tx_effect.d.ts +5 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +3 -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 +14 -11
- package/src/abi/utils.ts +17 -0
- package/src/block/block_hash.ts +26 -25
- 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 +102 -150
- package/src/block/l2_block_source.ts +71 -42
- 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/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/index.ts +0 -2
- package/src/contract/private_function.ts +2 -3
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/database-version/database_version.ts +87 -0
- package/src/database-version/version_manager.ts +1 -77
- 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 +10 -1
- package/src/hash/hash.ts +2 -2
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +18 -24
- package/src/interfaces/aztec-node.ts +85 -134
- package/src/interfaces/block-builder.ts +40 -23
- 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 +9 -11
- 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/keys/derivation.ts +8 -8
- package/src/keys/key_types.ts +1 -1
- package/src/keys/utils.ts +7 -3
- package/src/l1-contracts/slash_factory.ts +1 -0
- package/src/logs/log_id.ts +7 -6
- package/src/logs/siloed_tag.ts +3 -2
- 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 +36 -13
- package/src/p2p/checkpoint_proposal.ts +29 -11
- 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/stats/stats.ts +0 -2
- package/src/tests/factories.ts +6 -26
- package/src/tests/jest.ts +1 -1
- package/src/tests/mocks.ts +62 -42
- package/src/tx/block_header.ts +11 -3
- package/src/tx/indexed_tx_effect.ts +3 -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/dest/database-version/index.d.ts +0 -2
- package/dest/database-version/index.d.ts.map +0 -1
- package/dest/database-version/index.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
- package/src/database-version/index.ts +0 -1
|
@@ -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
|
|
|
@@ -87,5 +87,5 @@ export async function computeInitializationHashFromEncodedArgs(
|
|
|
87
87
|
encodedArgs: Fr[],
|
|
88
88
|
): Promise<Fr> {
|
|
89
89
|
const argsHash = await computeVarArgsHash(encodedArgs);
|
|
90
|
-
return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.
|
|
90
|
+
return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.INITIALIZER);
|
|
91
91
|
}
|
|
@@ -13,7 +13,7 @@ import { computePrivateFunctionsRoot } from './private_function.js';
|
|
|
13
13
|
*
|
|
14
14
|
* ```
|
|
15
15
|
* version = 1
|
|
16
|
-
* private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash],
|
|
16
|
+
* private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF))
|
|
17
17
|
* private_functions_root = merkleize(private_function_leaves)
|
|
18
18
|
* bytecode_commitment = calculate_commitment(packed_bytecode)
|
|
19
19
|
* contract_class_id = pedersen([version, artifact_hash, private_functions_root, bytecode_commitment], GENERATOR__CLASS_IDENTIFIER)
|
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';
|
|
@@ -32,13 +31,13 @@ function computePrivateFunctionLeaves(fns: PrivateFunction[]): Promise<Buffer[]>
|
|
|
32
31
|
|
|
33
32
|
/** Returns the leaf for a given private function. */
|
|
34
33
|
export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<Buffer> {
|
|
35
|
-
return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.
|
|
34
|
+
return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.PRIVATE_FUNCTION_LEAF)).toBuffer();
|
|
36
35
|
}
|
|
37
36
|
|
|
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,
|
|
@@ -99,7 +99,7 @@ export async function createPrivateFunctionMembershipProof(
|
|
|
99
99
|
* contract_class = db.get_contract_class(contract_class_id)
|
|
100
100
|
*
|
|
101
101
|
* // Compute function leaf and assert it belongs to the private functions tree
|
|
102
|
-
* function_leaf = pedersen([selector as Field, vk_hash],
|
|
102
|
+
* function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
|
|
103
103
|
* computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
|
|
104
104
|
* assert computed_private_function_tree_root == contract_class.private_functions_root
|
|
105
105
|
*
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Symbol for Node.js custom inspect. Using Symbol.for() is the documented way to
|
|
8
|
+
* reference this without importing node:util. In browsers, objects with this symbol
|
|
9
|
+
* simply won't have custom inspect behavior (which is fine).
|
|
10
|
+
* @see https://nodejs.org/api/util.html#utilinspectcustom
|
|
11
|
+
*/
|
|
12
|
+
const inspectCustomSymbol = Symbol.for('nodejs.util.inspect.custom');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents a version record for storing in a version file.
|
|
16
|
+
*/
|
|
17
|
+
export class DatabaseVersion {
|
|
18
|
+
constructor(
|
|
19
|
+
/** The version of the data on disk. Used to perform upgrades */
|
|
20
|
+
public readonly schemaVersion: number,
|
|
21
|
+
/** The rollup the data pertains to */
|
|
22
|
+
public readonly rollupAddress: EthAddress,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
public toBuffer(): Buffer {
|
|
26
|
+
return Buffer.from(jsonStringify(this));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static fromBuffer(buf: Buffer): DatabaseVersion {
|
|
30
|
+
try {
|
|
31
|
+
return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Compares two versions. If the rollups addresses are different then it returns undefined
|
|
39
|
+
*/
|
|
40
|
+
public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
|
|
41
|
+
if (this.rollupAddress.equals(other.rollupAddress)) {
|
|
42
|
+
if (this.schemaVersion < other.schemaVersion) {
|
|
43
|
+
return -1;
|
|
44
|
+
} else if (this.schemaVersion > other.schemaVersion) {
|
|
45
|
+
return 1;
|
|
46
|
+
} else {
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Checks if two versions exactly match
|
|
55
|
+
*/
|
|
56
|
+
public equals(other: DatabaseVersion): boolean {
|
|
57
|
+
return this.cmp(other) === 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the schema for this class
|
|
62
|
+
*/
|
|
63
|
+
static get schema() {
|
|
64
|
+
return z
|
|
65
|
+
.object({
|
|
66
|
+
schemaVersion: z.number(),
|
|
67
|
+
rollupAddress: EthAddress.schema,
|
|
68
|
+
})
|
|
69
|
+
.transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Allows for better introspection in Node.js console. Ignored in browser envs. */
|
|
73
|
+
public [inspectCustomSymbol](): string {
|
|
74
|
+
return this.toString();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public toString(): string {
|
|
78
|
+
return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns an empty instance
|
|
83
|
+
*/
|
|
84
|
+
static empty() {
|
|
85
|
+
return new DatabaseVersion(0, EthAddress.ZERO);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,86 +1,10 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
3
|
|
|
5
4
|
import fs from 'fs/promises';
|
|
6
|
-
import { inspect } from 'node:util';
|
|
7
5
|
import { join } from 'path';
|
|
8
|
-
import { z } from 'zod';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
* Represents a version record for storing in a version file.
|
|
12
|
-
*/
|
|
13
|
-
export class DatabaseVersion {
|
|
14
|
-
constructor(
|
|
15
|
-
/** The version of the data on disk. Used to perform upgrades */
|
|
16
|
-
public readonly schemaVersion: number,
|
|
17
|
-
/** The rollup the data pertains to */
|
|
18
|
-
public readonly rollupAddress: EthAddress,
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
public toBuffer(): Buffer {
|
|
22
|
-
return Buffer.from(jsonStringify(this));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public static fromBuffer(buf: Buffer): DatabaseVersion {
|
|
26
|
-
try {
|
|
27
|
-
return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Compares two versions. If the rollups addresses are different then it returns undefined
|
|
35
|
-
*/
|
|
36
|
-
public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
|
|
37
|
-
if (this.rollupAddress.equals(other.rollupAddress)) {
|
|
38
|
-
if (this.schemaVersion < other.schemaVersion) {
|
|
39
|
-
return -1;
|
|
40
|
-
} else if (this.schemaVersion > other.schemaVersion) {
|
|
41
|
-
return 1;
|
|
42
|
-
} else {
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Checks if two versions exactly match
|
|
51
|
-
*/
|
|
52
|
-
public equals(other: DatabaseVersion): boolean {
|
|
53
|
-
return this.cmp(other) === 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns the schema for this class
|
|
58
|
-
*/
|
|
59
|
-
static get schema() {
|
|
60
|
-
return z
|
|
61
|
-
.object({
|
|
62
|
-
schemaVersion: z.number(),
|
|
63
|
-
rollupAddress: EthAddress.schema,
|
|
64
|
-
})
|
|
65
|
-
.transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Allows for better introspection. */
|
|
69
|
-
public [inspect.custom](): string {
|
|
70
|
-
return this.toString();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public toString(): string {
|
|
74
|
-
return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Returns an empty instance
|
|
79
|
-
*/
|
|
80
|
-
static empty() {
|
|
81
|
-
return new DatabaseVersion(0, EthAddress.ZERO);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
7
|
+
import { DatabaseVersion } from './database_version.js';
|
|
84
8
|
|
|
85
9
|
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'writeFile' | 'rm' | 'mkdir'>;
|
|
86
10
|
|