@aztec/stdlib 0.0.1-commit.dbf9cec → 0.0.1-commit.ddcf04837
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/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/authorization_selector.d.ts +3 -6
- package/dest/abi/authorization_selector.d.ts.map +1 -1
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +6 -45
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +17 -67
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +28 -1
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/event_selector.d.ts +3 -6
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.d.ts +3 -6
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +2 -4
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/abi/note_selector.d.ts +3 -6
- package/dest/abi/note_selector.d.ts.map +1 -1
- package/dest/abi/note_selector.js +1 -3
- package/dest/abi/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/avm/revert_code.d.ts +8 -18
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -30
- package/dest/aztec-address/index.d.ts +3 -6
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +2 -4
- package/dest/block/block_data.d.ts +8 -8
- package/dest/block/block_data.d.ts.map +1 -1
- package/dest/block/block_data.js +2 -2
- package/dest/block/block_hash.d.ts +11 -10
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +10 -9
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_info.d.ts +6 -5
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +6 -5
- package/dest/block/l2_block_source.d.ts +95 -10
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
- 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 +4 -3
- package/dest/checkpoint/checkpoint.d.ts +8 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +18 -5
- package/dest/checkpoint/checkpoint_data.d.ts +71 -5
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +10 -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/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/chain-config.d.ts +1 -1
- package/dest/config/chain-config.d.ts.map +1 -1
- package/dest/config/chain-config.js +7 -1
- 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/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +15 -2
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +3 -3
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.js +2 -2
- 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_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- package/dest/epoch-helpers/index.d.ts +11 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +16 -2
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/gas/fee_math.d.ts +49 -0
- package/dest/gas/fee_math.d.ts.map +1 -0
- package/dest/gas/fee_math.js +80 -0
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +13 -1
- package/dest/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/ha-signing/config.d.ts +49 -14
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +20 -15
- package/dest/ha-signing/index.d.ts +4 -3
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +3 -2
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/ha-signing/types.d.ts +37 -32
- package/dest/ha-signing/types.d.ts.map +1 -1
- package/dest/ha-signing/types.js +13 -6
- package/dest/hash/hash.d.ts +19 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +29 -0
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -3
- package/dest/interfaces/aztec-node-admin.d.ts +79 -43
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -3
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- package/dest/interfaces/aztec-node.d.ts +21 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +7 -2
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +13 -6
- package/dest/interfaces/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/configs.d.ts +62 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -2
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +12 -21
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -4
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/slasher.d.ts +1 -10
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +0 -2
- package/dest/interfaces/validator.d.ts +111 -60
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +8 -5
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -0
- package/dest/l1-contracts/index.d.ts +2 -2
- package/dest/l1-contracts/index.d.ts.map +1 -1
- package/dest/l1-contracts/index.js +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/log_id.d.ts +1 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +1 -2
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +2 -1
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +8 -7
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +11 -3
- package/dest/logs/tag.d.ts +5 -6
- package/dest/logs/tag.d.ts.map +1 -1
- package/dest/logs/tag.js +4 -0
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/block_proposal.d.ts +6 -8
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +4 -9
- package/dest/p2p/checkpoint_attestation.d.ts +4 -6
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts +8 -15
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +5 -34
- package/dest/p2p/gossipable.d.ts +4 -4
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/slashing/index.d.ts +2 -3
- package/dest/slashing/index.d.ts.map +1 -1
- package/dest/slashing/index.js +1 -2
- package/dest/slashing/serialization.d.ts +2 -6
- package/dest/slashing/serialization.d.ts.map +1 -1
- package/dest/slashing/serialization.js +0 -60
- package/dest/slashing/types.d.ts +4 -90
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +0 -14
- package/dest/slashing/{tally.d.ts → votes.d.ts} +7 -2
- package/dest/slashing/votes.d.ts.map +1 -0
- package/dest/slashing/{tally.js → votes.js} +30 -2
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +11 -28
- package/dest/tests/mocks.d.ts +4 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +27 -27
- package/dest/timetable/index.d.ts +51 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +204 -14
- package/dest/tx/block_header.d.ts +4 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +5 -1
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/fee_provider.d.ts +10 -0
- package/dest/tx/fee_provider.d.ts.map +1 -0
- package/dest/tx/fee_provider.js +1 -0
- package/dest/tx/global_variable_builder.d.ts +3 -4
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/index.d.ts +2 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/indexed_tx_effect.d.ts +1 -1
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +1 -2
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/simulated_tx.d.ts +116 -5
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +7 -4
- package/dest/tx/tx.d.ts +8 -7
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +14 -5
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +14 -18
- package/dest/tx/validator/error_texts.d.ts +9 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +10 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/dest/world-state/genesis_data.d.ts +11 -0
- package/dest/world-state/genesis_data.d.ts.map +1 -0
- package/dest/world-state/genesis_data.js +4 -0
- package/dest/world-state/index.d.ts +2 -1
- package/dest/world-state/index.d.ts.map +1 -1
- package/dest/world-state/index.js +1 -0
- package/package.json +10 -9
- package/src/abi/abi.ts +25 -2
- package/src/abi/authorization_selector.ts +2 -8
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +36 -79
- package/src/abi/encoder.ts +41 -1
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/event_selector.ts +2 -8
- package/src/abi/function_selector.ts +4 -13
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/abi/note_selector.ts +3 -12
- package/src/abi/selector.ts +1 -1
- package/src/abi/utils.ts +25 -0
- package/src/avm/revert_code.ts +25 -39
- package/src/aztec-address/index.ts +4 -10
- package/src/block/block_data.ts +3 -4
- package/src/block/block_hash.ts +21 -14
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_info.ts +8 -6
- package/src/block/l2_block_source.ts +26 -9
- package/src/block/l2_block_stream/interfaces.ts +6 -2
- package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
- package/src/block/test/l2_tips_store_test_suite.ts +9 -2
- package/src/checkpoint/checkpoint.ts +23 -4
- package/src/checkpoint/checkpoint_data.ts +40 -4
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/chain-config.ts +7 -1
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/config/sequencer-config.ts +21 -3
- package/src/contract/contract_address.ts +3 -3
- package/src/contract/contract_class_id.ts +2 -2
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/epoch-helpers/index.ts +27 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/gas/README.md +154 -0
- package/src/gas/fee_math.ts +120 -0
- package/src/gas/gas_fees.ts +15 -1
- package/src/gas/gas_settings.ts +65 -12
- package/src/gas/index.ts +1 -0
- package/src/ha-signing/config.ts +45 -38
- package/src/ha-signing/index.ts +12 -1
- package/src/ha-signing/local_config.ts +46 -0
- package/src/ha-signing/types.ts +48 -34
- package/src/hash/hash.ts +34 -0
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +6 -3
- package/src/interfaces/aztec-node-admin.ts +5 -7
- package/src/interfaces/aztec-node-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +39 -5
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/configs.ts +25 -8
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +11 -20
- package/src/interfaces/prover-client.ts +10 -5
- package/src/interfaces/slasher.ts +0 -6
- package/src/interfaces/validator.ts +62 -37
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/l1-contracts/index.ts +1 -1
- package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/log_id.ts +1 -2
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/public_log.ts +4 -2
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +15 -11
- package/src/logs/tag.ts +8 -8
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/note/note_dao.ts +1 -4
- package/src/p2p/block_proposal.ts +13 -9
- package/src/p2p/checkpoint_attestation.ts +5 -9
- package/src/p2p/checkpoint_proposal.ts +19 -48
- package/src/p2p/gossipable.ts +4 -4
- package/src/p2p/peer_error.ts +7 -0
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/slashing/index.ts +1 -2
- package/src/slashing/serialization.ts +1 -81
- package/src/slashing/types.ts +3 -35
- package/src/slashing/{tally.ts → votes.ts} +34 -1
- package/src/tests/factories.ts +5 -34
- package/src/tests/mocks.ts +33 -18
- package/src/timetable/index.ts +293 -13
- package/src/tx/block_header.ts +8 -2
- package/src/tx/capsule.ts +10 -2
- package/src/tx/fee_provider.ts +10 -0
- package/src/tx/global_variable_builder.ts +2 -3
- package/src/tx/index.ts +1 -0
- package/src/tx/indexed_tx_effect.ts +1 -2
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/simulated_tx.ts +14 -3
- package/src/tx/tx.ts +22 -13
- package/src/tx/tx_receipt.ts +18 -16
- package/src/tx/validator/error_texts.ts +12 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/src/world-state/genesis_data.ts +15 -0
- package/src/world-state/index.ts +1 -0
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- package/dest/l1-contracts/slash_factory.d.ts +0 -45
- package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
- package/dest/l1-contracts/slash_factory.js +0 -158
- package/dest/slashing/empire.d.ts +0 -31
- package/dest/slashing/empire.d.ts.map +0 -1
- package/dest/slashing/empire.js +0 -87
- package/dest/slashing/tally.d.ts.map +0 -1
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
- package/src/l1-contracts/slash_factory.ts +0 -180
- package/src/slashing/empire.ts +0 -104
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -13,7 +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
|
+
import type { CheckpointData, CommonCheckpointData, ProposedCheckpointData } from '../checkpoint/checkpoint_data.js';
|
|
17
17
|
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
18
18
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
19
19
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
@@ -49,6 +49,12 @@ export interface L2BlockSource {
|
|
|
49
49
|
*/
|
|
50
50
|
getBlockNumber(): Promise<BlockNumber>;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Gets the number of the latest L2 checkpoint processed by the block source implementation.
|
|
54
|
+
* @returns The number of the latest L2 checkpoint processed by the block source implementation.
|
|
55
|
+
*/
|
|
56
|
+
getCheckpointNumber(): Promise<CheckpointNumber>;
|
|
57
|
+
|
|
52
58
|
/**
|
|
53
59
|
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
54
60
|
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
@@ -62,9 +68,8 @@ export interface L2BlockSource {
|
|
|
62
68
|
getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
|
|
63
69
|
|
|
64
70
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* TODO(#13569): Compute proper finalized block number based on L1 finalized block.
|
|
71
|
+
* Returns the finalized L2 block number. A block is finalized when it was proven
|
|
72
|
+
* in an L1 block that has itself been finalized on Ethereum.
|
|
68
73
|
* @returns The finalized block number.
|
|
69
74
|
*/
|
|
70
75
|
getFinalizedL2BlockNumber(): Promise<BlockNumber>;
|
|
@@ -170,14 +175,18 @@ export interface L2BlockSource {
|
|
|
170
175
|
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
171
176
|
|
|
172
177
|
/**
|
|
173
|
-
* Returns the
|
|
178
|
+
* Returns the last L2 slot number for which we have all L1 data needed to build the next checkpoint.
|
|
179
|
+
* Determined by the max of two signals: L1 block sync progress and latest synced checkpoint slot.
|
|
180
|
+
* The checkpoint signal handles missed L1 blocks, since a published checkpoint seals the message tree
|
|
181
|
+
* for the next checkpoint via the inbox LAG mechanism.
|
|
174
182
|
*/
|
|
175
|
-
|
|
183
|
+
getSyncedL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
176
184
|
|
|
177
185
|
/**
|
|
178
|
-
* Returns the
|
|
186
|
+
* Returns the last L2 epoch number that has been fully synchronized from L1.
|
|
187
|
+
* An epoch is fully synced when all its L2 slots have been fully synced.
|
|
179
188
|
*/
|
|
180
|
-
|
|
189
|
+
getSyncedL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
181
190
|
|
|
182
191
|
/**
|
|
183
192
|
* Returns all checkpointed block headers for a given epoch.
|
|
@@ -220,6 +229,12 @@ export interface L2BlockSource {
|
|
|
220
229
|
*/
|
|
221
230
|
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
222
231
|
|
|
232
|
+
/** Returns the checkpoint at the proposed chain tip. */
|
|
233
|
+
getProposedCheckpoint(): Promise<CommonCheckpointData | undefined>;
|
|
234
|
+
|
|
235
|
+
/** Returns proposed checkpoint, if set, undefined if not*/
|
|
236
|
+
getProposedCheckpointOnly(): Promise<ProposedCheckpointData | undefined>;
|
|
237
|
+
|
|
223
238
|
/** Force a sync. */
|
|
224
239
|
syncImmediate(): Promise<void>;
|
|
225
240
|
|
|
@@ -303,12 +318,13 @@ export interface L2BlockSourceEventEmitter extends L2BlockSource {
|
|
|
303
318
|
* - proven: Proven block on L1.
|
|
304
319
|
* - finalized: Proven block on a finalized L1 block (not implemented, set to proven for now).
|
|
305
320
|
*/
|
|
306
|
-
export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
321
|
+
export type L2BlockTag = 'proposed' | 'proposedCheckpoint' | 'checkpointed' | 'proven' | 'finalized';
|
|
307
322
|
|
|
308
323
|
/** Tips of the L2 chain. */
|
|
309
324
|
export type L2Tips = {
|
|
310
325
|
proposed: L2BlockId;
|
|
311
326
|
checkpointed: L2TipId;
|
|
327
|
+
proposedCheckpoint: L2TipId;
|
|
312
328
|
proven: L2TipId;
|
|
313
329
|
finalized: L2TipId;
|
|
314
330
|
};
|
|
@@ -353,6 +369,7 @@ const L2TipIdSchema = z.object({
|
|
|
353
369
|
export const L2TipsSchema = z.object({
|
|
354
370
|
proposed: L2BlockIdSchema,
|
|
355
371
|
checkpointed: L2TipIdSchema,
|
|
372
|
+
proposedCheckpoint: L2TipIdSchema,
|
|
356
373
|
proven: L2TipIdSchema,
|
|
357
374
|
finalized: L2TipIdSchema,
|
|
358
375
|
});
|
|
@@ -2,10 +2,14 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
|
|
|
2
2
|
import type { L2Block } from '../l2_block.js';
|
|
3
3
|
import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
4
4
|
|
|
5
|
+
/** Provides the current chain tips. Implemented by world-state, l2-tips-store, and AztecNode. */
|
|
6
|
+
export interface L2TipsProvider {
|
|
7
|
+
getL2Tips(): Promise<L2Tips>;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
6
|
-
export interface L2BlockStreamLocalDataProvider {
|
|
11
|
+
export interface L2BlockStreamLocalDataProvider extends L2TipsProvider {
|
|
7
12
|
getL2BlockHash(number: number): Promise<string | undefined>;
|
|
8
|
-
getL2Tips(): Promise<L2Tips>;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
/** Interface to a handler of events emitted. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
1
|
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
|
|
4
3
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
4
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
|
|
5
5
|
import type { L2Block } from '../l2_block.js';
|
|
6
6
|
import {
|
|
7
7
|
type CheckpointId,
|
|
@@ -66,24 +66,29 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
|
|
|
66
66
|
|
|
67
67
|
public getL2Tips(): Promise<L2Tips> {
|
|
68
68
|
return this.runInTransaction(async () => {
|
|
69
|
-
const [proposedBlockId, finalizedBlockId, provenBlockId, checkpointedBlockId] =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
const [proposedBlockId, finalizedBlockId, provenBlockId, checkpointedBlockId, proposedCheckpointBlockId] =
|
|
70
|
+
await Promise.all([
|
|
71
|
+
this.getBlockId('proposed'),
|
|
72
|
+
this.getBlockId('finalized'),
|
|
73
|
+
this.getBlockId('proven'),
|
|
74
|
+
this.getBlockId('checkpointed'),
|
|
75
|
+
this.getBlockId('proposedCheckpoint'),
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
const [finalizedCheckpointId, provenCheckpointId, checkpointedCheckpointId, proposedCheckpointId] =
|
|
79
|
+
await Promise.all([
|
|
80
|
+
this.getCheckpointId('finalized'),
|
|
81
|
+
this.getCheckpointId('proven'),
|
|
82
|
+
this.getCheckpointId('checkpointed'),
|
|
83
|
+
this.getCheckpointId('proposedCheckpoint'),
|
|
84
|
+
]);
|
|
81
85
|
|
|
82
86
|
return {
|
|
83
87
|
proposed: proposedBlockId,
|
|
84
88
|
finalized: { block: finalizedBlockId, checkpoint: finalizedCheckpointId },
|
|
85
89
|
proven: { block: provenBlockId, checkpoint: provenCheckpointId },
|
|
86
90
|
checkpointed: { block: checkpointedBlockId, checkpoint: checkpointedCheckpointId },
|
|
91
|
+
proposedCheckpoint: { block: proposedCheckpointBlockId, checkpoint: proposedCheckpointId },
|
|
87
92
|
};
|
|
88
93
|
});
|
|
89
94
|
}
|
|
@@ -164,6 +169,12 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
|
|
|
164
169
|
await this.runInTransaction(async () => {
|
|
165
170
|
await this.saveTag('checkpointed', event.block);
|
|
166
171
|
await this.saveCheckpoint(event.checkpoint);
|
|
172
|
+
// proposedCheckpoint is always >= checkpointed. If checkpointed has caught up
|
|
173
|
+
// or surpassed it, advance proposedCheckpoint to match.
|
|
174
|
+
const proposedCheckpointBlock = await this.getBlockId('proposedCheckpoint');
|
|
175
|
+
if (event.block.number > proposedCheckpointBlock.number) {
|
|
176
|
+
await this.saveTag('proposedCheckpoint', event.block);
|
|
177
|
+
}
|
|
167
178
|
});
|
|
168
179
|
}
|
|
169
180
|
|
|
@@ -174,6 +185,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
|
|
|
174
185
|
await this.runInTransaction(async () => {
|
|
175
186
|
await this.saveTag('proposed', event.block);
|
|
176
187
|
await this.saveTag('checkpointed', event.block);
|
|
188
|
+
await this.saveTag('proposedCheckpoint', event.block);
|
|
177
189
|
const storeProven = await this.getBlockId('proven');
|
|
178
190
|
if (storeProven.number > event.block.number) {
|
|
179
191
|
await this.saveTag('proven', event.block);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
1
|
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
import { times } from '@aztec/foundation/collection';
|
|
4
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -13,6 +12,7 @@ import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/
|
|
|
13
12
|
|
|
14
13
|
import { jestExpect as expect } from '@jest/expect';
|
|
15
14
|
|
|
15
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
|
|
16
16
|
import type { L2TipsStore } from '../l2_block_stream/index.js';
|
|
17
17
|
|
|
18
18
|
export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
@@ -67,11 +67,18 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
|
67
67
|
checkpoint: makeCheckpointIdForBlock(blockNumber),
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
const makeTips = (
|
|
70
|
+
const makeTips = (
|
|
71
|
+
proposed: number,
|
|
72
|
+
proven: number,
|
|
73
|
+
finalized: number,
|
|
74
|
+
checkpointed: number = 0,
|
|
75
|
+
proposedCheckpoint: number = 0,
|
|
76
|
+
) => ({
|
|
71
77
|
proposed: makeTip(proposed),
|
|
72
78
|
proven: makeTipId(proven),
|
|
73
79
|
finalized: makeTipId(finalized),
|
|
74
80
|
checkpointed: makeTipId(checkpointed),
|
|
81
|
+
proposedCheckpoint: makeTipId(proposedCheckpoint),
|
|
75
82
|
});
|
|
76
83
|
|
|
77
84
|
const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
IndexWithinCheckpoint,
|
|
7
7
|
SlotNumber,
|
|
8
8
|
} from '@aztec/foundation/branded-types';
|
|
9
|
-
import { sum } from '@aztec/foundation/collection';
|
|
9
|
+
import { pick, sum } from '@aztec/foundation/collection';
|
|
10
10
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
11
|
import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
12
12
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
@@ -100,7 +100,16 @@ export class Checkpoint {
|
|
|
100
100
|
* checkpoints up to and including this one in the epoch.
|
|
101
101
|
*/
|
|
102
102
|
public getCheckpointOutHash(): Fr {
|
|
103
|
-
|
|
103
|
+
return Checkpoint.getCheckpointOutHash(this.blocks);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns the out hash computed from all l2-to-l1 messages in this checkpoint.
|
|
108
|
+
* Note: This value is different from the out hash in the header, which is the **accumulated** out hash over all
|
|
109
|
+
* checkpoints up to and including this one in the epoch.
|
|
110
|
+
*/
|
|
111
|
+
static getCheckpointOutHash(blocks: L2Block[]): Fr {
|
|
112
|
+
const msgs = blocks.map(block => block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
|
|
104
113
|
return computeCheckpointOutHash(msgs);
|
|
105
114
|
}
|
|
106
115
|
|
|
@@ -152,10 +161,12 @@ export class Checkpoint {
|
|
|
152
161
|
startBlockNumber?: number;
|
|
153
162
|
previousArchive?: AppendOnlyTreeSnapshot;
|
|
154
163
|
feeAssetPriceModifier?: bigint;
|
|
164
|
+
archive?: AppendOnlyTreeSnapshot;
|
|
155
165
|
} & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
|
|
156
166
|
Partial<Parameters<typeof L2Block.random>[1]> = {},
|
|
157
167
|
) {
|
|
158
|
-
const
|
|
168
|
+
const headerOptions = previousArchive ? { lastArchiveRoot: previousArchive.root, ...options } : options;
|
|
169
|
+
const header = CheckpointHeader.random(headerOptions);
|
|
159
170
|
|
|
160
171
|
// Create blocks sequentially to chain archive roots properly.
|
|
161
172
|
// Each block's header.lastArchive must equal the previous block's archive.
|
|
@@ -163,14 +174,22 @@ export class Checkpoint {
|
|
|
163
174
|
let lastArchive = previousArchive;
|
|
164
175
|
for (let i = 0; i < numBlocks; i++) {
|
|
165
176
|
const block = await L2Block.random(BlockNumber(startBlockNumber + i), {
|
|
177
|
+
checkpointNumber,
|
|
166
178
|
indexWithinCheckpoint: IndexWithinCheckpoint(i),
|
|
167
179
|
...options,
|
|
168
180
|
...(lastArchive ? { lastArchive } : {}),
|
|
181
|
+
...pick(header, 'slotNumber', 'timestamp', 'coinbase', 'feeRecipient', 'gasFees'),
|
|
169
182
|
});
|
|
170
183
|
lastArchive = block.archive;
|
|
171
184
|
blocks.push(block);
|
|
172
185
|
}
|
|
173
186
|
|
|
174
|
-
return new Checkpoint(
|
|
187
|
+
return new Checkpoint(
|
|
188
|
+
options.archive ?? AppendOnlyTreeSnapshot.random(),
|
|
189
|
+
header,
|
|
190
|
+
blocks,
|
|
191
|
+
checkpointNumber,
|
|
192
|
+
feeAssetPriceModifier,
|
|
193
|
+
);
|
|
175
194
|
}
|
|
176
195
|
}
|
|
@@ -14,18 +14,54 @@ import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
|
14
14
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
15
15
|
import { L1PublishedData } from './published_checkpoint.js';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
export type
|
|
17
|
+
/** Base type for checkpoint data */
|
|
18
|
+
export type CommonCheckpointData = {
|
|
19
19
|
checkpointNumber: CheckpointNumber;
|
|
20
20
|
header: CheckpointHeader;
|
|
21
|
-
archive: AppendOnlyTreeSnapshot;
|
|
22
|
-
checkpointOutHash: Fr;
|
|
23
21
|
startBlock: BlockNumber;
|
|
24
22
|
blockCount: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Data stored with checkpoint data after publishing on l1 */
|
|
26
|
+
export type L1EnrichedCheckpointData = {
|
|
25
27
|
attestations: CommitteeAttestation[];
|
|
26
28
|
l1: L1PublishedData;
|
|
27
29
|
};
|
|
28
30
|
|
|
31
|
+
/** Data stored alongside checkpoint data in storage */
|
|
32
|
+
export type StorageEnrichedCheckpointData = {
|
|
33
|
+
archive: AppendOnlyTreeSnapshot;
|
|
34
|
+
checkpointOutHash: Fr;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Data stored only with proposed checkpoint data */
|
|
38
|
+
export type ProposedOnlyCheckpointData = {
|
|
39
|
+
totalManaUsed: bigint;
|
|
40
|
+
feeAssetPriceModifier: bigint;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Lightweight checkpoint metadata without full block data. */
|
|
44
|
+
export type CheckpointData = CommonCheckpointData & StorageEnrichedCheckpointData & L1EnrichedCheckpointData;
|
|
45
|
+
|
|
46
|
+
/** Input for setting a proposed checkpoint. The archive and checkpointOutHash are computed
|
|
47
|
+
* internally by the block store from the stored blocks. */
|
|
48
|
+
export type ProposedCheckpointInput = CommonCheckpointData & ProposedOnlyCheckpointData;
|
|
49
|
+
|
|
50
|
+
/** Full data for a proposed checkpoint (proposed but not yet L1-confirmed).
|
|
51
|
+
* Includes fee-relevant fields used during pipelining to compute the fee header override. */
|
|
52
|
+
export type ProposedCheckpointData = ProposedCheckpointInput & StorageEnrichedCheckpointData;
|
|
53
|
+
|
|
54
|
+
export const ProposedCheckpointDataSchema = z.object({
|
|
55
|
+
checkpointNumber: CheckpointNumberSchema,
|
|
56
|
+
header: CheckpointHeader.schema,
|
|
57
|
+
archive: AppendOnlyTreeSnapshot.schema,
|
|
58
|
+
checkpointOutHash: schemas.Fr,
|
|
59
|
+
startBlock: BlockNumberSchema,
|
|
60
|
+
blockCount: z.number(),
|
|
61
|
+
totalManaUsed: schemas.BigInt,
|
|
62
|
+
feeAssetPriceModifier: schemas.BigInt,
|
|
63
|
+
});
|
|
64
|
+
|
|
29
65
|
export const CheckpointDataSchema = z
|
|
30
66
|
.object({
|
|
31
67
|
checkpointNumber: CheckpointNumberSchema,
|
package/src/checkpoint/index.ts
CHANGED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB, MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
|
|
2
|
+
import type { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { sum } from '@aztec/foundation/collection';
|
|
4
|
+
|
|
5
|
+
import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
|
|
6
|
+
import type { Checkpoint } from './checkpoint.js';
|
|
7
|
+
|
|
8
|
+
export class CheckpointValidationError extends Error {
|
|
9
|
+
constructor(
|
|
10
|
+
message: string,
|
|
11
|
+
public readonly checkpointNumber: CheckpointNumber,
|
|
12
|
+
public readonly slot: SlotNumber,
|
|
13
|
+
) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'CheckpointValidationError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Validates a checkpoint. Throws a CheckpointValidationError if any validation fails.
|
|
21
|
+
* - Validates structural integrity (non-empty, block count, sequential numbers, archive chaining, slot consistency)
|
|
22
|
+
* - Validates checkpoint blob field count against maxBlobFields limit
|
|
23
|
+
* - Validates total L2 gas used by checkpoint blocks against the Rollup contract mana limit
|
|
24
|
+
* - Validates total DA gas used by checkpoint blocks against MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT
|
|
25
|
+
* - Validates individual block L2 gas and DA gas against maxL2BlockGas and maxDABlockGas limits
|
|
26
|
+
*/
|
|
27
|
+
export function validateCheckpoint(
|
|
28
|
+
checkpoint: Checkpoint,
|
|
29
|
+
opts: {
|
|
30
|
+
rollupManaLimit?: number;
|
|
31
|
+
maxL2BlockGas?: number;
|
|
32
|
+
maxDABlockGas?: number;
|
|
33
|
+
maxTxsPerCheckpoint?: number;
|
|
34
|
+
maxTxsPerBlock?: number;
|
|
35
|
+
},
|
|
36
|
+
): void {
|
|
37
|
+
validateCheckpointStructure(checkpoint);
|
|
38
|
+
validateCheckpointLimits(checkpoint, opts);
|
|
39
|
+
validateCheckpointBlocksLimits(checkpoint, opts);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Validates structural integrity of a checkpoint.
|
|
44
|
+
* - Non-empty block list
|
|
45
|
+
* - Block count within MAX_BLOCKS_PER_CHECKPOINT
|
|
46
|
+
* - Checkpoint slot matches the first block's slot
|
|
47
|
+
* - Checkpoint lastArchiveRoot matches the first block's lastArchive root
|
|
48
|
+
* - Sequential block numbers without gaps
|
|
49
|
+
* - Sequential indexWithinCheckpoint starting at 0
|
|
50
|
+
* - Archive root chaining between consecutive blocks
|
|
51
|
+
* - Consistent slot number across all blocks
|
|
52
|
+
* - Global variables (slot, timestamp, coinbase, feeRecipient, gasFees) match checkpoint header for each block
|
|
53
|
+
*/
|
|
54
|
+
export function validateCheckpointStructure(checkpoint: Checkpoint): void {
|
|
55
|
+
const { blocks, number, slot } = checkpoint;
|
|
56
|
+
|
|
57
|
+
if (blocks.length === 0) {
|
|
58
|
+
throw new CheckpointValidationError('Checkpoint has no blocks', number, slot);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (blocks.length > MAX_BLOCKS_PER_CHECKPOINT) {
|
|
62
|
+
throw new CheckpointValidationError(
|
|
63
|
+
`Checkpoint has ${blocks.length} blocks, exceeding limit of ${MAX_BLOCKS_PER_CHECKPOINT}`,
|
|
64
|
+
number,
|
|
65
|
+
slot,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const firstBlock = blocks[0];
|
|
70
|
+
|
|
71
|
+
if (!checkpoint.header.lastArchiveRoot.equals(firstBlock.header.lastArchive.root)) {
|
|
72
|
+
throw new CheckpointValidationError(
|
|
73
|
+
`Checkpoint lastArchiveRoot does not match first block's lastArchive root`,
|
|
74
|
+
number,
|
|
75
|
+
slot,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
80
|
+
const block = blocks[i];
|
|
81
|
+
|
|
82
|
+
if (block.indexWithinCheckpoint !== i) {
|
|
83
|
+
throw new CheckpointValidationError(
|
|
84
|
+
`Block at index ${i} has indexWithinCheckpoint ${block.indexWithinCheckpoint}, expected ${i}`,
|
|
85
|
+
number,
|
|
86
|
+
slot,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (block.slot !== slot) {
|
|
91
|
+
throw new CheckpointValidationError(
|
|
92
|
+
`Block ${block.number} has slot ${block.slot}, expected ${slot} (all blocks must share the same slot)`,
|
|
93
|
+
number,
|
|
94
|
+
slot,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!checkpoint.header.matchesGlobalVariables(block.header.globalVariables)) {
|
|
99
|
+
throw new CheckpointValidationError(
|
|
100
|
+
`Block ${block.number} global variables (slot, timestamp, coinbase, feeRecipient, gasFees) do not match checkpoint header`,
|
|
101
|
+
number,
|
|
102
|
+
slot,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (i > 0) {
|
|
107
|
+
const prev = blocks[i - 1];
|
|
108
|
+
if (block.number !== prev.number + 1) {
|
|
109
|
+
throw new CheckpointValidationError(
|
|
110
|
+
`Block numbers are not sequential: block at index ${i - 1} has number ${prev.number}, block at index ${i} has number ${block.number}`,
|
|
111
|
+
number,
|
|
112
|
+
slot,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!block.header.lastArchive.root.equals(prev.archive.root)) {
|
|
117
|
+
throw new CheckpointValidationError(
|
|
118
|
+
`Block ${block.number} lastArchive root does not match archive root of block ${prev.number}`,
|
|
119
|
+
number,
|
|
120
|
+
slot,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Validates checkpoint blocks gas limits */
|
|
128
|
+
function validateCheckpointBlocksLimits(
|
|
129
|
+
checkpoint: Checkpoint,
|
|
130
|
+
opts: {
|
|
131
|
+
maxL2BlockGas?: number;
|
|
132
|
+
maxDABlockGas?: number;
|
|
133
|
+
maxTxsPerBlock?: number;
|
|
134
|
+
},
|
|
135
|
+
): void {
|
|
136
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = opts;
|
|
137
|
+
|
|
138
|
+
if (maxL2BlockGas !== undefined) {
|
|
139
|
+
for (const block of checkpoint.blocks) {
|
|
140
|
+
const blockL2Gas = block.header.totalManaUsed.toNumber();
|
|
141
|
+
if (blockL2Gas > maxL2BlockGas) {
|
|
142
|
+
throw new CheckpointValidationError(
|
|
143
|
+
`Block ${block.number} in checkpoint has L2 gas used ${blockL2Gas} exceeding limit of ${maxL2BlockGas}`,
|
|
144
|
+
checkpoint.number,
|
|
145
|
+
checkpoint.slot,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (maxDABlockGas !== undefined) {
|
|
152
|
+
for (const block of checkpoint.blocks) {
|
|
153
|
+
const blockDAGas = block.computeDAGasUsed();
|
|
154
|
+
if (blockDAGas > maxDABlockGas) {
|
|
155
|
+
throw new CheckpointValidationError(
|
|
156
|
+
`Block ${block.number} in checkpoint has DA gas used ${blockDAGas} exceeding limit of ${maxDABlockGas}`,
|
|
157
|
+
checkpoint.number,
|
|
158
|
+
checkpoint.slot,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (maxTxsPerBlock !== undefined) {
|
|
165
|
+
for (const block of checkpoint.blocks) {
|
|
166
|
+
const blockTxCount = block.body.txEffects.length;
|
|
167
|
+
if (blockTxCount > maxTxsPerBlock) {
|
|
168
|
+
throw new CheckpointValidationError(
|
|
169
|
+
`Block ${block.number} in checkpoint has ${blockTxCount} txs exceeding limit of ${maxTxsPerBlock}`,
|
|
170
|
+
checkpoint.number,
|
|
171
|
+
checkpoint.slot,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Validates checkpoint max blob fields, gas limits, and tx limits */
|
|
179
|
+
function validateCheckpointLimits(
|
|
180
|
+
checkpoint: Checkpoint,
|
|
181
|
+
opts: {
|
|
182
|
+
rollupManaLimit?: number;
|
|
183
|
+
maxTxsPerCheckpoint?: number;
|
|
184
|
+
},
|
|
185
|
+
): void {
|
|
186
|
+
const { rollupManaLimit, maxTxsPerCheckpoint } = opts;
|
|
187
|
+
|
|
188
|
+
const maxBlobFields = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB;
|
|
189
|
+
const maxDAGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
190
|
+
|
|
191
|
+
if (rollupManaLimit !== undefined) {
|
|
192
|
+
const checkpointMana = sum(checkpoint.blocks.map(block => block.header.totalManaUsed.toNumber()));
|
|
193
|
+
if (checkpointMana > rollupManaLimit) {
|
|
194
|
+
throw new CheckpointValidationError(
|
|
195
|
+
`Checkpoint mana cost ${checkpointMana} exceeds rollup limit of ${rollupManaLimit}`,
|
|
196
|
+
checkpoint.number,
|
|
197
|
+
checkpoint.slot,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const checkpointDAGas = sum(checkpoint.blocks.map(block => block.computeDAGasUsed()));
|
|
203
|
+
if (checkpointDAGas > maxDAGas) {
|
|
204
|
+
throw new CheckpointValidationError(
|
|
205
|
+
`Checkpoint DA gas cost ${checkpointDAGas} exceeds limit of ${maxDAGas}`,
|
|
206
|
+
checkpoint.number,
|
|
207
|
+
checkpoint.slot,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const checkpointBlobFields = checkpoint.toBlobFields().length;
|
|
212
|
+
if (checkpointBlobFields > maxBlobFields) {
|
|
213
|
+
throw new CheckpointValidationError(
|
|
214
|
+
`Checkpoint blob field count ${checkpointBlobFields} exceeds limit of ${maxBlobFields}`,
|
|
215
|
+
checkpoint.number,
|
|
216
|
+
checkpoint.slot,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (maxTxsPerCheckpoint !== undefined) {
|
|
221
|
+
const checkpointTxCount = sum(checkpoint.blocks.map(block => block.body.txEffects.length));
|
|
222
|
+
if (checkpointTxCount > maxTxsPerCheckpoint) {
|
|
223
|
+
throw new CheckpointValidationError(
|
|
224
|
+
`Checkpoint tx count ${checkpointTxCount} exceeds limit of ${maxTxsPerCheckpoint}`,
|
|
225
|
+
checkpoint.number,
|
|
226
|
+
checkpoint.slot,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -21,7 +21,13 @@ export const chainConfigMappings: ConfigMappingsType<ChainConfig> = {
|
|
|
21
21
|
rollupVersion: {
|
|
22
22
|
env: 'ROLLUP_VERSION',
|
|
23
23
|
description: 'The version of the rollup.',
|
|
24
|
-
parseEnv: (val: string) =>
|
|
24
|
+
parseEnv: (val: string) => {
|
|
25
|
+
const parsed = parseInt(val, 10);
|
|
26
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
27
|
+
throw new Error(`Invalid rollup version: ${val}`);
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
},
|
|
25
31
|
},
|
|
26
32
|
l1Contracts: {
|
|
27
33
|
description: 'The deployed L1 contract addresses',
|
package/src/config/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
import { zodFor } from '../schemas/index.js';
|
|
6
|
+
|
|
7
|
+
export type PipelineConfig = {
|
|
8
|
+
/** Whether to enable build-ahead proposer pipelining. */
|
|
9
|
+
enableProposerPipelining: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Pipelining config mappings for fields that need to be shared across packages.
|
|
14
|
+
*/
|
|
15
|
+
export const pipelineConfigMappings: ConfigMappingsType<PipelineConfig> = {
|
|
16
|
+
enableProposerPipelining: {
|
|
17
|
+
env: 'SEQ_ENABLE_PROPOSER_PIPELINING',
|
|
18
|
+
description: 'Whether to enable build-ahead proposer pipelining.',
|
|
19
|
+
...booleanConfigHelper(false),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const PipelineConfigSchema = zodFor<PipelineConfig>()(
|
|
24
|
+
z.object({
|
|
25
|
+
enableProposerPipelining: z.boolean(),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export function getPipelineConfigEnvVars(): PipelineConfig {
|
|
30
|
+
return getConfigFromMappings(pipelineConfigMappings);
|
|
31
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
2
|
|
|
3
3
|
import type { SequencerConfig } from '../interfaces/configs.js';
|
|
4
|
+
import { DEFAULT_P2P_PROPAGATION_TIME } from '../timetable/index.js';
|
|
5
|
+
|
|
6
|
+
/** Default maximum number of transactions per block. */
|
|
7
|
+
export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Partial sequencer config mappings for fields that need to be shared across packages.
|
|
@@ -9,21 +13,35 @@ import type { SequencerConfig } from '../interfaces/configs.js';
|
|
|
9
13
|
* to avoid duplication.
|
|
10
14
|
*/
|
|
11
15
|
export const sharedSequencerConfigMappings: ConfigMappingsType<
|
|
12
|
-
Pick<
|
|
16
|
+
Pick<
|
|
17
|
+
SequencerConfig,
|
|
18
|
+
'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock' | 'attestationPropagationTime'
|
|
19
|
+
>
|
|
13
20
|
> = {
|
|
14
21
|
blockDurationMs: {
|
|
15
22
|
env: 'SEQ_BLOCK_DURATION_MS',
|
|
16
23
|
description:
|
|
17
24
|
'Duration per block in milliseconds when building multiple blocks per slot. ' +
|
|
18
25
|
'If undefined (default), builds a single block per slot using the full slot duration.',
|
|
19
|
-
parseEnv: (val: string) =>
|
|
26
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
20
27
|
},
|
|
21
28
|
expectedBlockProposalsPerSlot: {
|
|
22
29
|
env: 'SEQ_EXPECTED_BLOCK_PROPOSALS_PER_SLOT',
|
|
23
30
|
description:
|
|
24
31
|
'Expected number of block proposals per slot for P2P peer scoring. ' +
|
|
25
32
|
'0 (default) disables block proposal scoring. Set to a positive value to enable.',
|
|
26
|
-
parseEnv: (val: string) =>
|
|
33
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
27
34
|
defaultValue: 0,
|
|
28
35
|
},
|
|
36
|
+
maxTxsPerBlock: {
|
|
37
|
+
env: 'SEQ_MAX_TX_PER_BLOCK',
|
|
38
|
+
description: 'The maximum number of txs to include in a block.',
|
|
39
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
40
|
+
},
|
|
41
|
+
attestationPropagationTime: {
|
|
42
|
+
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
43
|
+
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way).',
|
|
44
|
+
parseEnv: (val: string) => parseFloat(val),
|
|
45
|
+
defaultValue: DEFAULT_P2P_PROPAGATION_TIME,
|
|
46
|
+
},
|
|
29
47
|
};
|