@aztec/stdlib 0.0.1-commit.d431d1c → 0.0.1-commit.dbf9cec
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/decoder.d.ts +1 -1
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +1 -4
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +9 -5
- package/dest/abi/function_call.d.ts +39 -9
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +20 -3
- package/dest/auth_witness/auth_witness.js +3 -3
- package/dest/avm/avm.d.ts +300 -300
- package/dest/avm/avm_proving_request.d.ts +166 -166
- package/dest/avm/revert_code.d.ts +16 -1
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -5
- package/dest/block/block_data.d.ts +52 -0
- package/dest/block/block_data.d.ts.map +1 -0
- package/dest/block/block_data.js +12 -0
- package/dest/block/block_hash.d.ts +16 -18
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +21 -31
- package/dest/block/block_parameter.d.ts +4 -4
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -2
- package/dest/block/checkpointed_l2_block.d.ts +6 -6
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +3 -3
- package/dest/block/in_block.d.ts +11 -11
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +5 -5
- package/dest/block/index.d.ts +3 -2
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +2 -1
- package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
- package/dest/block/l2_block.d.ts.map +1 -0
- package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
- package/dest/block/l2_block_source.d.ts +58 -30
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -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 +14 -4
- 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.js +2 -2
- package/dest/checkpoint/checkpoint.d.ts +27 -13
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +27 -16
- package/dest/checkpoint/checkpoint_data.d.ts +120 -0
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -0
- package/dest/checkpoint/checkpoint_data.js +26 -0
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/published_checkpoint.d.ts +19 -4
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +1 -2
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/config/sequencer-config.d.ts +10 -0
- package/dest/config/sequencer-config.d.ts.map +1 -0
- package/dest/config/sequencer-config.js +18 -0
- package/dest/contract/contract_address.js +4 -4
- package/dest/contract/contract_class.d.ts +2 -3
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.d.ts.map +1 -1
- package/dest/contract/contract_class_id.js +6 -5
- package/dest/contract/interfaces/node-info.d.ts +3 -1
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +2 -1
- 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 +3 -4
- 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 +2 -50
- 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/epoch-helpers/index.d.ts +7 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -3
- package/dest/file-store/local.d.ts +3 -3
- package/dest/file-store/local.d.ts.map +1 -1
- package/dest/file-store/local.js +13 -4
- package/dest/file-store/s3.d.ts +1 -1
- package/dest/file-store/s3.d.ts.map +1 -1
- package/dest/file-store/s3.js +11 -3
- package/dest/ha-signing/config.d.ts +101 -0
- package/dest/ha-signing/config.d.ts.map +1 -0
- package/dest/ha-signing/config.js +92 -0
- package/dest/ha-signing/index.d.ts +3 -0
- package/dest/ha-signing/index.d.ts.map +1 -0
- package/dest/ha-signing/index.js +2 -0
- package/dest/ha-signing/types.d.ts +85 -0
- package/dest/ha-signing/types.d.ts.map +1 -0
- package/dest/ha-signing/types.js +32 -0
- package/dest/hash/hash.d.ts +2 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +16 -10
- 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/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +22 -16
- package/dest/interfaces/aztec-node-admin.d.ts +49 -3
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +12 -4
- package/dest/interfaces/aztec-node.d.ts +51 -58
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +13 -17
- package/dest/interfaces/block-builder.d.ts +13 -7
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- package/dest/interfaces/configs.d.ts +18 -3
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +4 -1
- package/dest/interfaces/get_logs_response.d.ts +15 -8
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +2 -2
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +4 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.d.ts +16 -1
- package/dest/interfaces/prover-broker.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.js +4 -1
- package/dest/interfaces/prover-client.d.ts +15 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +12 -1
- package/dest/interfaces/proving-job.d.ts +202 -202
- package/dest/interfaces/slasher.d.ts +9 -1
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +2 -0
- 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 +52 -6
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +5 -2
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- 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 +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +4 -4
- 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 -15
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/kernel/hints/index.d.ts +2 -2
- package/dest/kernel/hints/index.js +2 -2
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts +24 -0
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts.map +1 -0
- package/dest/kernel/hints/{key_validation_request_and_generator.js → key_validation_request_and_separator.js} +12 -15
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts → scoped_key_validation_request_and_separator.d.ts} +8 -8
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts.map → scoped_key_validation_request_and_separator.d.ts.map} +1 -1
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.js → scoped_key_validation_request_and_separator.js} +6 -6
- package/dest/kernel/private_circuit_public_inputs.d.ts +9 -9
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +16 -16
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_validation_requests.d.ts +3 -3
- package/dest/kernel/private_validation_requests.js +9 -9
- package/dest/keys/derivation.d.ts +3 -3
- package/dest/keys/derivation.js +15 -15
- package/dest/keys/key_types.d.ts +3 -3
- package/dest/keys/key_types.d.ts.map +1 -1
- package/dest/keys/public_keys.js +2 -2
- package/dest/keys/utils.d.ts +1 -1
- package/dest/keys/utils.d.ts.map +1 -1
- package/dest/keys/utils.js +8 -4
- 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/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +23 -15
- package/dest/logs/extended_public_log.d.ts +13 -7
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/index.d.ts +3 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -1
- package/dest/logs/log_id.d.ts +17 -14
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +20 -17
- package/dest/logs/pre_tag.d.ts +16 -11
- package/dest/logs/pre_tag.d.ts.map +1 -1
- package/dest/logs/pre_tag.js +2 -2
- package/dest/logs/private_log.d.ts +2 -2
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/siloed_tag.d.ts +5 -3
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +8 -6
- package/dest/logs/tag.js +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +2 -2
- package/dest/messaging/l2_to_l1_membership.js +3 -3
- package/dest/note/index.d.ts +1 -2
- package/dest/note/index.d.ts.map +1 -1
- package/dest/note/index.js +0 -1
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/block_proposal.d.ts +14 -7
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +3 -5
- package/dest/p2p/checkpoint_attestation.d.ts +2 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +27 -8
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +30 -16
- package/dest/p2p/client_type.d.ts +2 -5
- package/dest/p2p/client_type.d.ts.map +1 -1
- package/dest/p2p/client_type.js +0 -7
- package/dest/p2p/consensus_payload.d.ts +12 -3
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +22 -15
- package/dest/p2p/constants.d.ts +3 -1
- package/dest/p2p/constants.d.ts.map +1 -1
- package/dest/p2p/constants.js +1 -0
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/p2p/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/topic_type.d.ts +3 -4
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +7 -24
- package/dest/rollup/checkpoint_header.d.ts +2 -2
- package/dest/rollup/checkpoint_header.js +2 -2
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +3 -3
- package/dest/slashing/empire.d.ts +1 -1
- package/dest/slashing/empire.d.ts.map +1 -1
- package/dest/slashing/empire.js +2 -0
- package/dest/slashing/helpers.d.ts +2 -2
- package/dest/slashing/helpers.d.ts.map +1 -1
- package/dest/slashing/helpers.js +6 -0
- package/dest/slashing/tally.d.ts +2 -1
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +6 -2
- package/dest/slashing/types.d.ts +7 -3
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +13 -1
- package/dest/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +3 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +22 -14
- package/dest/tests/jest.d.ts +4 -4
- package/dest/tests/jest.js +9 -9
- package/dest/tests/mocks.d.ts +19 -11
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +37 -26
- package/dest/timetable/index.d.ts +37 -0
- package/dest/timetable/index.d.ts.map +1 -0
- package/dest/timetable/index.js +39 -0
- package/dest/trees/public_data_leaf.d.ts +2 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +7 -6
- package/dest/tx/block_header.d.ts +3 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -3
- package/dest/tx/global_variables.d.ts +4 -4
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/in_tx.d.ts +3 -3
- 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/profiling.d.ts +4 -4
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +3 -3
- package/dest/tx/protocol_contracts.d.ts +1 -1
- package/dest/tx/protocol_contracts.d.ts.map +1 -1
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/public_simulation_output.d.ts +4 -2
- package/dest/tx/public_simulation_output.d.ts.map +1 -1
- package/dest/tx/public_simulation_output.js +7 -3
- package/dest/tx/tx_receipt.d.ts +57 -15
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +55 -16
- package/dest/tx/tx_request.js +2 -2
- package/dest/tx/validator/empty_validator.d.ts +2 -2
- package/dest/tx/validator/empty_validator.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.d.ts +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- package/dest/tx/validator/tx_validator.d.ts +2 -2
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/validators/schemas.d.ts +30 -30
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +4 -3
- package/dest/validators/types.d.ts +3 -3
- package/dest/validators/types.d.ts.map +1 -1
- package/package.json +25 -13
- package/src/abi/decoder.ts +1 -4
- package/src/abi/encoder.ts +8 -5
- package/src/abi/function_call.ts +25 -3
- package/src/auth_witness/auth_witness.ts +3 -3
- package/src/avm/revert_code.ts +15 -0
- package/src/block/block_data.ts +26 -0
- package/src/block/block_hash.ts +26 -47
- package/src/block/block_parameter.ts +3 -3
- package/src/block/checkpointed_l2_block.ts +4 -4
- package/src/block/in_block.ts +8 -8
- package/src/block/index.ts +2 -1
- package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
- package/src/block/l2_block_source.ts +62 -31
- package/src/block/l2_block_stream/interfaces.ts +2 -2
- package/src/block/l2_block_stream/l2_block_stream.ts +26 -6
- package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
- package/src/block/test/l2_tips_store_test_suite.ts +4 -4
- package/src/checkpoint/checkpoint.ts +38 -20
- package/src/checkpoint/checkpoint_data.ts +51 -0
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/published_checkpoint.ts +3 -1
- package/src/config/index.ts +1 -0
- package/src/config/node-rpc-config.ts +1 -1
- package/src/config/sequencer-config.ts +29 -0
- package/src/contract/contract_address.ts +4 -4
- package/src/contract/contract_class.ts +3 -3
- package/src/contract/contract_class_id.ts +6 -5
- package/src/contract/interfaces/node-info.ts +3 -0
- package/src/contract/private_function.ts +3 -4
- 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/epoch-helpers/index.ts +13 -1
- package/src/file-store/local.ts +15 -5
- package/src/file-store/s3.ts +12 -3
- package/src/ha-signing/config.ts +149 -0
- package/src/ha-signing/index.ts +18 -0
- package/src/ha-signing/types.ts +112 -0
- package/src/hash/hash.ts +14 -10
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/archiver.ts +22 -25
- package/src/interfaces/aztec-node-admin.ts +26 -2
- package/src/interfaces/aztec-node.ts +73 -117
- package/src/interfaces/block-builder.ts +16 -5
- package/src/interfaces/configs.ts +13 -4
- package/src/interfaces/merkle_tree_operations.ts +1 -1
- package/src/interfaces/p2p.ts +3 -14
- package/src/interfaces/prover-broker.ts +22 -0
- package/src/interfaces/prover-client.ts +22 -0
- package/src/interfaces/slasher.ts +4 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +14 -6
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +16 -28
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/kernel/hints/index.ts +2 -2
- package/src/kernel/hints/{key_validation_request_and_generator.ts → key_validation_request_and_separator.ts} +12 -15
- package/src/kernel/hints/{scoped_key_validation_request_and_generator.ts → scoped_key_validation_request_and_separator.ts} +10 -10
- package/src/kernel/private_circuit_public_inputs.ts +14 -14
- package/src/kernel/private_kernel_circuit_public_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +5 -5
- package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +5 -5
- package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +5 -5
- package/src/kernel/private_validation_requests.ts +8 -8
- package/src/keys/derivation.ts +15 -15
- package/src/keys/key_types.ts +6 -2
- package/src/keys/public_keys.ts +2 -2
- package/src/keys/utils.ts +8 -4
- package/src/l1-contracts/slash_factory.ts +1 -0
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +24 -16
- package/src/logs/index.ts +2 -1
- package/src/logs/log_id.ts +22 -18
- package/src/logs/pre_tag.ts +5 -5
- package/src/logs/siloed_tag.ts +10 -4
- package/src/logs/tag.ts +1 -1
- package/src/messaging/l2_to_l1_membership.ts +3 -3
- package/src/note/index.ts +0 -1
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/block_proposal.ts +13 -8
- package/src/p2p/checkpoint_attestation.ts +6 -1
- package/src/p2p/checkpoint_proposal.ts +55 -16
- package/src/p2p/client_type.ts +0 -6
- package/src/p2p/consensus_payload.ts +25 -12
- package/src/p2p/constants.ts +3 -0
- package/src/p2p/index.ts +0 -1
- package/src/p2p/message_validator.ts +14 -2
- package/src/p2p/topic_type.ts +8 -15
- package/src/rollup/checkpoint_header.ts +2 -2
- package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
- package/src/rollup/root_rollup_public_inputs.ts +7 -7
- package/src/slashing/empire.ts +3 -1
- package/src/slashing/helpers.ts +8 -0
- package/src/slashing/tally.ts +8 -2
- package/src/slashing/types.ts +14 -0
- package/src/stats/stats.ts +0 -2
- package/src/tests/factories.ts +27 -18
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +54 -30
- package/src/timetable/index.ts +66 -0
- package/src/trees/public_data_leaf.ts +11 -5
- package/src/tx/block_header.ts +8 -5
- package/src/tx/global_variables.ts +3 -3
- package/src/tx/indexed_tx_effect.ts +3 -2
- package/src/tx/profiling.ts +5 -5
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/tx_receipt.ts +85 -18
- package/src/tx/tx_request.ts +2 -2
- package/src/tx/validator/empty_validator.ts +1 -1
- package/src/tx/validator/error_texts.ts +1 -1
- package/src/tx/validator/tx_validator.ts +1 -1
- package/src/validators/schemas.ts +8 -1
- package/src/validators/types.ts +5 -4
- package/dest/block/l2_block_new.d.ts.map +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/dest/kernel/hints/key_validation_request_and_generator.d.ts +0 -30
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +0 -1
- package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
- package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
- package/dest/note/notes_filter.d.ts +0 -27
- package/dest/note/notes_filter.d.ts.map +0 -1
- package/dest/note/notes_filter.js +0 -11
- package/src/database-version/index.ts +0 -1
- package/src/note/notes_filter.ts +0 -38
|
@@ -2,9 +2,9 @@ import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
6
|
|
|
7
|
-
export const BlockParameterSchema = z.union([
|
|
7
|
+
export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
|
|
8
8
|
|
|
9
|
-
/** Block parameter - either a specific BlockNumber, block hash (
|
|
9
|
+
/** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
|
|
10
10
|
export type BlockParameter = z.infer<typeof BlockParameterSchema>;
|
|
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|
|
7
7
|
|
|
8
8
|
import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
|
|
9
9
|
import { MAX_BLOCK_HASH_STRING_LENGTH, MAX_COMMITTEE_SIZE } from '../deserialization/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { L2Block } from './l2_block.js';
|
|
11
11
|
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -16,7 +16,7 @@ import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
|
16
16
|
export class CheckpointedL2Block {
|
|
17
17
|
constructor(
|
|
18
18
|
public checkpointNumber: CheckpointNumber,
|
|
19
|
-
public block:
|
|
19
|
+
public block: L2Block,
|
|
20
20
|
public l1: L1PublishedData,
|
|
21
21
|
public attestations: CommitteeAttestation[],
|
|
22
22
|
) {}
|
|
@@ -24,7 +24,7 @@ export class CheckpointedL2Block {
|
|
|
24
24
|
return z
|
|
25
25
|
.object({
|
|
26
26
|
checkpointNumber: CheckpointNumberSchema,
|
|
27
|
-
block:
|
|
27
|
+
block: L2Block.schema,
|
|
28
28
|
l1: L1PublishedData.schema,
|
|
29
29
|
attestations: z.array(CommitteeAttestation.schema),
|
|
30
30
|
})
|
|
@@ -34,7 +34,7 @@ export class CheckpointedL2Block {
|
|
|
34
34
|
static fromBuffer(bufferOrReader: Buffer | BufferReader): CheckpointedL2Block {
|
|
35
35
|
const reader = BufferReader.asReader(bufferOrReader);
|
|
36
36
|
const checkpointNumber = reader.readNumber();
|
|
37
|
-
const block = reader.readObject(
|
|
37
|
+
const block = reader.readObject(L2Block);
|
|
38
38
|
const l1BlockNumber = reader.readBigInt();
|
|
39
39
|
const l1BlockHash = reader.readString(MAX_BLOCK_HASH_STRING_LENGTH);
|
|
40
40
|
const l1Timestamp = reader.readBigInt();
|
package/src/block/in_block.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types'
|
|
|
2
2
|
|
|
3
3
|
import { type ZodTypeAny, z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
|
+
import type { L2Block } from './l2_block.js';
|
|
7
7
|
|
|
8
8
|
export type InBlock = {
|
|
9
9
|
l2BlockNumber: BlockNumber;
|
|
10
|
-
l2BlockHash:
|
|
10
|
+
l2BlockHash: BlockHash;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
|
|
@@ -17,8 +17,8 @@ export type DataInBlock<T> = {
|
|
|
17
17
|
|
|
18
18
|
export function randomInBlock(): InBlock {
|
|
19
19
|
return {
|
|
20
|
-
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
|
|
21
|
-
l2BlockHash:
|
|
20
|
+
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000) + 1),
|
|
21
|
+
l2BlockHash: BlockHash.random(),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -29,18 +29,18 @@ export function randomDataInBlock<T>(data: T): DataInBlock<T> {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export async function wrapDataInBlock<T>(data: T, block:
|
|
32
|
+
export async function wrapDataInBlock<T>(data: T, block: L2Block): Promise<DataInBlock<T>> {
|
|
33
33
|
return {
|
|
34
34
|
data,
|
|
35
35
|
l2BlockNumber: block.number,
|
|
36
|
-
l2BlockHash:
|
|
36
|
+
l2BlockHash: await block.hash(),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function inBlockSchema() {
|
|
41
41
|
return z.object({
|
|
42
42
|
l2BlockNumber: BlockNumberSchema,
|
|
43
|
-
l2BlockHash:
|
|
43
|
+
l2BlockHash: BlockHash.schema,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
package/src/block/index.ts
CHANGED
|
@@ -15,18 +15,14 @@ import { z } from 'zod';
|
|
|
15
15
|
import type { PrivateLog } from '../logs/private_log.js';
|
|
16
16
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
17
17
|
import { BlockHeader } from '../tx/block_header.js';
|
|
18
|
+
import type { BlockHash } from './block_hash.js';
|
|
18
19
|
import { Body } from './body.js';
|
|
19
20
|
import type { L2BlockInfo } from './l2_block_info.js';
|
|
20
21
|
|
|
21
|
-
// TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
22
|
-
// TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
|
|
23
|
-
// if the blockNumber is there, why not these as well? Consider whether they should be part of the
|
|
24
|
-
// circuits structs though.
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* An L2 block with a header and a body.
|
|
28
24
|
*/
|
|
29
|
-
export class
|
|
25
|
+
export class L2Block {
|
|
30
26
|
constructor(
|
|
31
27
|
/** Snapshot of archive tree after the block is applied. */
|
|
32
28
|
public archive: AppendOnlyTreeSnapshot,
|
|
@@ -63,7 +59,7 @@ export class L2BlockNew {
|
|
|
63
59
|
})
|
|
64
60
|
.transform(
|
|
65
61
|
({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
|
|
66
|
-
new
|
|
62
|
+
new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint),
|
|
67
63
|
);
|
|
68
64
|
}
|
|
69
65
|
|
|
@@ -79,7 +75,7 @@ export class L2BlockNew {
|
|
|
79
75
|
const checkpointNumber = CheckpointNumber(reader.readNumber());
|
|
80
76
|
const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
|
|
81
77
|
|
|
82
|
-
return new
|
|
78
|
+
return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
/**
|
|
@@ -94,7 +90,7 @@ export class L2BlockNew {
|
|
|
94
90
|
* Returns the block's hash (hash of block header).
|
|
95
91
|
* @returns The block's hash.
|
|
96
92
|
*/
|
|
97
|
-
public hash(): Promise<
|
|
93
|
+
public hash(): Promise<BlockHash> {
|
|
98
94
|
return this.header.hash();
|
|
99
95
|
}
|
|
100
96
|
|
|
@@ -143,7 +139,7 @@ export class L2BlockNew {
|
|
|
143
139
|
}
|
|
144
140
|
|
|
145
141
|
static empty(header?: BlockHeader) {
|
|
146
|
-
return new
|
|
142
|
+
return new L2Block(
|
|
147
143
|
AppendOnlyTreeSnapshot.empty(),
|
|
148
144
|
header ?? BlockHeader.empty(),
|
|
149
145
|
Body.empty(),
|
|
@@ -177,11 +173,11 @@ export class L2BlockNew {
|
|
|
177
173
|
txOptions?: Partial<Parameters<typeof Body.random>[0]>;
|
|
178
174
|
makeTxOptions?: (txIndex: number) => Partial<Parameters<typeof Body.random>[0]>;
|
|
179
175
|
} & Partial<Parameters<typeof BlockHeader.random>[0]> = {},
|
|
180
|
-
): Promise<
|
|
176
|
+
): Promise<L2Block> {
|
|
181
177
|
const archive = new AppendOnlyTreeSnapshot(Fr.random(), blockNumber + 1);
|
|
182
178
|
const header = BlockHeader.random({ blockNumber, ...blockHeaderOverrides });
|
|
183
179
|
const body = await Body.random({ txsPerBlock, makeTxOptions, ...txOptions });
|
|
184
|
-
return new
|
|
180
|
+
return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
/**
|
|
@@ -13,6 +13,7 @@ import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
|
13
13
|
import { z } from 'zod';
|
|
14
14
|
|
|
15
15
|
import type { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
16
|
+
import type { CheckpointData } from '../checkpoint/checkpoint_data.js';
|
|
16
17
|
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
17
18
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
18
19
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
@@ -20,8 +21,10 @@ import type { BlockHeader } from '../tx/block_header.js';
|
|
|
20
21
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
21
22
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
22
23
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
24
|
+
import type { BlockData } from './block_data.js';
|
|
25
|
+
import type { BlockHash } from './block_hash.js';
|
|
23
26
|
import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
|
|
24
|
-
import type {
|
|
27
|
+
import type { L2Block } from './l2_block.js';
|
|
25
28
|
import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -52,6 +55,20 @@ export interface L2BlockSource {
|
|
|
52
55
|
*/
|
|
53
56
|
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
54
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Gets the number of the latest L2 block checkpointed seen by the block source implementation.
|
|
60
|
+
* @returns The number of the latest L2 block checkpointed seen by the block source implementation.
|
|
61
|
+
*/
|
|
62
|
+
getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Computes the finalized block number based on the proven block number.
|
|
66
|
+
* A block is considered finalized when it's 2 epochs behind the proven block.
|
|
67
|
+
* TODO(#13569): Compute proper finalized block number based on L1 finalized block.
|
|
68
|
+
* @returns The finalized block number.
|
|
69
|
+
*/
|
|
70
|
+
getFinalizedL2BlockNumber(): Promise<BlockNumber>;
|
|
71
|
+
|
|
55
72
|
/**
|
|
56
73
|
* Gets an l2 block header.
|
|
57
74
|
* @param number - The block number to return or 'latest' for the most recent one.
|
|
@@ -67,15 +84,15 @@ export interface L2BlockSource {
|
|
|
67
84
|
*/
|
|
68
85
|
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
69
86
|
|
|
70
|
-
getCheckpointedBlocks(from: BlockNumber, limit: number
|
|
87
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
|
|
71
88
|
|
|
72
89
|
/**
|
|
73
|
-
* Retrieves a collection of
|
|
74
|
-
* @param checkpointNumber The first checkpoint to be retrieved
|
|
75
|
-
* @param limit The number of checkpoints to be retrieved
|
|
76
|
-
* @returns The collection of complete checkpoints
|
|
90
|
+
* Retrieves a collection of checkpoints.
|
|
91
|
+
* @param checkpointNumber The first checkpoint to be retrieved.
|
|
92
|
+
* @param limit The number of checkpoints to be retrieved.
|
|
93
|
+
* @returns The collection of complete checkpoints.
|
|
77
94
|
*/
|
|
78
|
-
|
|
95
|
+
getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
|
|
79
96
|
|
|
80
97
|
/**
|
|
81
98
|
* Gets the checkpoints for a given epoch
|
|
@@ -83,12 +100,18 @@ export interface L2BlockSource {
|
|
|
83
100
|
*/
|
|
84
101
|
getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
85
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Gets lightweight checkpoint metadata for a given epoch, without fetching full block data.
|
|
105
|
+
* @param epochNumber - Epoch for which we want checkpoint data
|
|
106
|
+
*/
|
|
107
|
+
getCheckpointsDataForEpoch(epochNumber: EpochNumber): Promise<CheckpointData[]>;
|
|
108
|
+
|
|
86
109
|
/**
|
|
87
110
|
* Gets a block header by its hash.
|
|
88
111
|
* @param blockHash - The block hash to retrieve.
|
|
89
112
|
* @returns The requested block header (or undefined if not found).
|
|
90
113
|
*/
|
|
91
|
-
getBlockHeaderByHash(blockHash:
|
|
114
|
+
getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined>;
|
|
92
115
|
|
|
93
116
|
/**
|
|
94
117
|
* Gets a block header by its archive root.
|
|
@@ -97,26 +120,40 @@ export interface L2BlockSource {
|
|
|
97
120
|
*/
|
|
98
121
|
getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
|
|
99
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Gets block metadata (without tx data) by block number.
|
|
125
|
+
* @param number - The block number to retrieve.
|
|
126
|
+
* @returns The requested block data (or undefined if not found).
|
|
127
|
+
*/
|
|
128
|
+
getBlockData(number: BlockNumber): Promise<BlockData | undefined>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Gets block metadata (without tx data) by archive root.
|
|
132
|
+
* @param archive - The archive root to retrieve.
|
|
133
|
+
* @returns The requested block data (or undefined if not found).
|
|
134
|
+
*/
|
|
135
|
+
getBlockDataByArchive(archive: Fr): Promise<BlockData | undefined>;
|
|
136
|
+
|
|
100
137
|
/**
|
|
101
138
|
* Gets an L2 block by block number.
|
|
102
139
|
* @param number - The block number to return.
|
|
103
140
|
* @returns The requested L2 block (or undefined if not found).
|
|
104
141
|
*/
|
|
105
|
-
|
|
142
|
+
getL2Block(number: BlockNumber): Promise<L2Block | undefined>;
|
|
106
143
|
|
|
107
144
|
/**
|
|
108
145
|
* Gets an L2 block by its hash.
|
|
109
146
|
* @param blockHash - The block hash to retrieve.
|
|
110
147
|
* @returns The requested L2 block (or undefined if not found).
|
|
111
148
|
*/
|
|
112
|
-
|
|
149
|
+
getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
|
|
113
150
|
|
|
114
151
|
/**
|
|
115
152
|
* Gets an L2 block by its archive root.
|
|
116
153
|
* @param archive - The archive root to retrieve.
|
|
117
154
|
* @returns The requested L2 block (or undefined if not found).
|
|
118
155
|
*/
|
|
119
|
-
|
|
156
|
+
getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined>;
|
|
120
157
|
|
|
121
158
|
/**
|
|
122
159
|
* Gets a tx effect.
|
|
@@ -143,11 +180,11 @@ export interface L2BlockSource {
|
|
|
143
180
|
getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
144
181
|
|
|
145
182
|
/**
|
|
146
|
-
* Returns all block headers for a given epoch.
|
|
183
|
+
* Returns all checkpointed block headers for a given epoch.
|
|
147
184
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
148
185
|
* @param epochNumber - The epoch number to return headers for.
|
|
149
186
|
*/
|
|
150
|
-
|
|
187
|
+
getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
|
|
151
188
|
|
|
152
189
|
/**
|
|
153
190
|
* Returns whether the given epoch is completed on L1, based on the current L1 and L2 block numbers.
|
|
@@ -193,49 +230,43 @@ export interface L2BlockSource {
|
|
|
193
230
|
* @param number - The block number to return (inclusive).
|
|
194
231
|
* @returns The requested L2 block.
|
|
195
232
|
*/
|
|
196
|
-
getBlock(number: BlockNumber): Promise<
|
|
197
|
-
|
|
198
|
-
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
233
|
+
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
199
234
|
|
|
200
235
|
/**
|
|
201
|
-
* Returns all blocks for a given epoch.
|
|
236
|
+
* Returns all checkpointed blocks for a given epoch.
|
|
202
237
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
203
238
|
* @param epochNumber - The epoch number to return blocks for.
|
|
204
239
|
*/
|
|
205
|
-
|
|
240
|
+
getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]>;
|
|
206
241
|
|
|
207
242
|
/**
|
|
208
243
|
* Returns all blocks for a given slot.
|
|
209
244
|
* @dev Use this method only with recent slots, since it walks the block list backwards.
|
|
210
245
|
* @param slotNumber - The slot number to return blocks for.
|
|
211
246
|
*/
|
|
212
|
-
getBlocksForSlot(slotNumber: SlotNumber): Promise<
|
|
247
|
+
getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]>;
|
|
213
248
|
|
|
214
249
|
/**
|
|
215
|
-
* Gets a
|
|
250
|
+
* Gets a checkpointed block by its block hash.
|
|
216
251
|
* @param blockHash - The block hash to retrieve.
|
|
217
252
|
* @returns The requested block (or undefined if not found).
|
|
218
253
|
*/
|
|
219
|
-
|
|
254
|
+
getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
|
|
220
255
|
|
|
221
256
|
/**
|
|
222
|
-
* Gets a
|
|
257
|
+
* Gets a checkpointed block by its archive root.
|
|
223
258
|
* @param archive - The archive root to retrieve.
|
|
224
259
|
* @returns The requested block (or undefined if not found).
|
|
225
260
|
*/
|
|
226
|
-
|
|
261
|
+
getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
|
|
227
262
|
|
|
228
263
|
/**
|
|
229
264
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
230
265
|
* @param from - Number of the first block to return (inclusive).
|
|
231
266
|
* @param limit - The maximum number of blocks to return.
|
|
232
|
-
* @param proven - If true, only return blocks that have been proven.
|
|
233
267
|
* @returns The requested L2 blocks.
|
|
234
268
|
*/
|
|
235
|
-
getBlocks(from: BlockNumber, limit: number
|
|
236
|
-
|
|
237
|
-
/** Equivalent to getBlocks but includes publish data. */
|
|
238
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
269
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
239
270
|
}
|
|
240
271
|
|
|
241
272
|
/**
|
|
@@ -247,7 +278,7 @@ export interface L2BlockSink {
|
|
|
247
278
|
* @param block - The L2 block to add.
|
|
248
279
|
* @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
|
|
249
280
|
*/
|
|
250
|
-
addBlock(block:
|
|
281
|
+
addBlock(block: L2Block): Promise<void>;
|
|
251
282
|
}
|
|
252
283
|
|
|
253
284
|
/**
|
|
@@ -344,13 +375,13 @@ export type L2BlockProvenEvent = {
|
|
|
344
375
|
export type L2PruneUnprovenEvent = {
|
|
345
376
|
type: 'l2PruneUnproven';
|
|
346
377
|
epochNumber: EpochNumber;
|
|
347
|
-
blocks:
|
|
378
|
+
blocks: L2Block[];
|
|
348
379
|
};
|
|
349
380
|
|
|
350
381
|
export type L2PruneUncheckpointedEvent = {
|
|
351
382
|
type: 'l2PruneUncheckpointed';
|
|
352
383
|
slotNumber: SlotNumber;
|
|
353
|
-
blocks:
|
|
384
|
+
blocks: L2Block[];
|
|
354
385
|
};
|
|
355
386
|
|
|
356
387
|
export type L2CheckpointEvent = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { L2Block } from '../l2_block.js';
|
|
3
3
|
import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
4
4
|
|
|
5
5
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
@@ -16,7 +16,7 @@ export interface L2BlockStreamEventHandler {
|
|
|
16
16
|
export type L2BlockStreamEvent =
|
|
17
17
|
| /** Emits blocks added to the chain. */ {
|
|
18
18
|
type: 'blocks-added';
|
|
19
|
-
blocks:
|
|
19
|
+
blocks: L2Block[];
|
|
20
20
|
}
|
|
21
21
|
| /** Emits checkpoints published to L1. */ {
|
|
22
22
|
type: 'chain-checkpointed';
|
|
@@ -19,13 +19,12 @@ export class L2BlockStream {
|
|
|
19
19
|
constructor(
|
|
20
20
|
private l2BlockSource: Pick<
|
|
21
21
|
L2BlockSource,
|
|
22
|
-
'
|
|
22
|
+
'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
|
|
23
23
|
>,
|
|
24
24
|
private localData: L2BlockStreamLocalDataProvider,
|
|
25
25
|
private handler: L2BlockStreamEventHandler,
|
|
26
26
|
private readonly log = createLogger('types:block_stream'),
|
|
27
27
|
private opts: {
|
|
28
|
-
proven?: boolean;
|
|
29
28
|
pollIntervalMS?: number;
|
|
30
29
|
batchSize?: number;
|
|
31
30
|
startingBlock?: number;
|
|
@@ -110,6 +109,27 @@ export class L2BlockStream {
|
|
|
110
109
|
|
|
111
110
|
let nextBlockNumber = latestBlockNumber + 1;
|
|
112
111
|
let nextCheckpointToEmit = CheckpointNumber(localTips.checkpointed.checkpoint.number + 1);
|
|
112
|
+
|
|
113
|
+
// When startingBlock is set, also skip ahead for checkpoints.
|
|
114
|
+
if (
|
|
115
|
+
this.opts.startingBlock !== undefined &&
|
|
116
|
+
this.opts.startingBlock >= 1 &&
|
|
117
|
+
nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number
|
|
118
|
+
) {
|
|
119
|
+
const startingBlockCheckpoints = await this.l2BlockSource.getCheckpointedBlocks(
|
|
120
|
+
BlockNumber(this.opts.startingBlock),
|
|
121
|
+
1,
|
|
122
|
+
);
|
|
123
|
+
if (startingBlockCheckpoints.length > 0) {
|
|
124
|
+
nextCheckpointToEmit = CheckpointNumber(
|
|
125
|
+
Math.max(nextCheckpointToEmit, startingBlockCheckpoints[0].checkpointNumber),
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
// startingBlock is past all checkpointed blocks; skip Loop 1 entirely.
|
|
129
|
+
nextCheckpointToEmit = CheckpointNumber(sourceTips.checkpointed.checkpoint.number + 1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
113
133
|
if (this.opts.skipFinalized) {
|
|
114
134
|
// When skipping finalized blocks we need to provide reliable reorg detection while fetching as few blocks as
|
|
115
135
|
// possible. Finalized blocks cannot be reorged by definition, so we can skip most of them. We do need the very
|
|
@@ -129,7 +149,7 @@ export class L2BlockStream {
|
|
|
129
149
|
if (!this.opts.ignoreCheckpoints) {
|
|
130
150
|
let loop1Iterations = 0;
|
|
131
151
|
while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
|
|
132
|
-
const checkpoints = await this.l2BlockSource.
|
|
152
|
+
const checkpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointToEmit, 1);
|
|
133
153
|
if (checkpoints.length === 0) {
|
|
134
154
|
break;
|
|
135
155
|
}
|
|
@@ -174,7 +194,7 @@ export class L2BlockStream {
|
|
|
174
194
|
// Refill the prefetch buffer when exhausted
|
|
175
195
|
if (prefetchIdx >= prefetchedCheckpoints.length) {
|
|
176
196
|
const prefetchLimit = this.opts.checkpointPrefetchLimit ?? CHECKPOINT_PREFETCH_LIMIT;
|
|
177
|
-
prefetchedCheckpoints = await this.l2BlockSource.
|
|
197
|
+
prefetchedCheckpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointNumber, prefetchLimit);
|
|
178
198
|
prefetchIdx = 0;
|
|
179
199
|
if (prefetchedCheckpoints.length === 0) {
|
|
180
200
|
break;
|
|
@@ -213,8 +233,8 @@ export class L2BlockStream {
|
|
|
213
233
|
// Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
|
|
214
234
|
while (nextBlockNumber <= sourceTips.proposed.number) {
|
|
215
235
|
const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
|
|
216
|
-
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}
|
|
217
|
-
const blocks = await this.l2BlockSource.
|
|
236
|
+
this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}`);
|
|
237
|
+
const blocks = await this.l2BlockSource.getBlocks(BlockNumber(nextBlockNumber), BlockNumber(limit));
|
|
218
238
|
if (blocks.length === 0) {
|
|
219
239
|
break;
|
|
220
240
|
}
|
|
@@ -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,
|