@aztec/stdlib 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/contract_artifact.d.ts +2 -2
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +1 -1
- package/dest/abi/function_call.d.ts +47 -9
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +20 -3
- package/dest/abi/selector.js +3 -1
- package/dest/abi/utils.d.ts +7 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +7 -0
- package/dest/auth_witness/auth_witness.d.ts +2 -1
- package/dest/auth_witness/auth_witness.d.ts.map +1 -1
- package/dest/auth_witness/auth_witness.js +3 -3
- package/dest/avm/avm.d.ts +62 -62
- package/dest/avm/avm_accumulated_data.d.ts +30 -3
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +5 -2
- package/dest/avm/avm_circuit_public_inputs.d.ts +9 -9
- package/dest/avm/avm_circuit_public_inputs.js +3 -1
- package/dest/avm/avm_proving_request.d.ts +299 -299
- package/dest/avm/contract_storage_read.d.ts +13 -1
- package/dest/avm/contract_storage_read.d.ts.map +1 -1
- package/dest/avm/contract_storage_update_request.d.ts +13 -1
- package/dest/avm/contract_storage_update_request.d.ts.map +1 -1
- package/dest/avm/public_call_stack_item_compressed.d.ts +3 -1
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +1 -1
- package/dest/avm/public_data_read.d.ts +10 -1
- package/dest/avm/public_data_read.d.ts.map +1 -1
- package/dest/avm/public_data_update_request.d.ts +10 -1
- package/dest/avm/public_data_update_request.d.ts.map +1 -1
- package/dest/avm/public_data_update_request.js +3 -1
- package/dest/avm/public_data_write.d.ts +7 -1
- package/dest/avm/public_data_write.d.ts.map +1 -1
- package/dest/avm/public_inner_call_request.d.ts +4 -1
- package/dest/avm/public_inner_call_request.d.ts.map +1 -1
- package/dest/avm/public_inner_call_request.js +3 -1
- package/dest/avm/revert_code.d.ts +4 -4
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +3 -1
- package/dest/aztec-address/index.js +4 -2
- package/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/block_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 +18 -14
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +22 -20
- package/dest/block/block_parameter.d.ts +4 -3
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -0
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +5 -2
- package/dest/block/checkpointed_l2_block.d.ts +20 -137
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +7 -45
- package/dest/block/in_block.d.ts +9 -9
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +5 -5
- package/dest/block/index.d.ts +2 -3
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -2
- package/dest/block/l2_block.d.ts +57 -57
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +64 -108
- package/dest/block/l2_block_source.d.ts +317 -68
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +25 -6
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +15 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +8 -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 +106 -31
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +478 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -17
- package/dest/checkpoint/checkpoint.d.ts +43 -19
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +38 -14
- 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/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- package/dest/checkpoint/index.d.ts +3 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +2 -0
- package/dest/checkpoint/published_checkpoint.d.ts +33 -16
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +5 -5
- 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/complete_address.d.ts +4 -1
- package/dest/contract/complete_address.d.ts.map +1 -1
- 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/contract_deployment_data.d.ts +5 -5
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_instance.d.ts +16 -16
- package/dest/contract/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 +3 -49
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +1 -64
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- package/dest/deserialization/index.d.ts +11 -0
- package/dest/deserialization/index.d.ts.map +1 -0
- package/dest/deserialization/index.js +10 -0
- package/dest/epoch-helpers/index.d.ts +7 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -3
- package/dest/errors/proving_error.d.ts +2 -2
- package/dest/errors/proving_error.d.ts.map +1 -1
- 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/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- 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/api_limit.d.ts +3 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +2 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +27 -17
- package/dest/interfaces/aztec-node-admin.d.ts +111 -32
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +14 -6
- package/dest/interfaces/aztec-node.d.ts +75 -77
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +15 -16
- package/dest/interfaces/block-builder.d.ts +22 -14
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- package/dest/interfaces/configs.d.ts +28 -8
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +5 -1
- package/dest/interfaces/get_logs_response.d.ts +16 -9
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.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 +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- 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 +52 -52
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +1 -7
- package/dest/interfaces/server_circuit_prover.d.ts +4 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/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 +155 -19
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +8 -3
- package/dest/kernel/claimed_length_array.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +19 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +16 -8
- package/dest/kernel/hints/index.d.ts +2 -2
- package/dest/kernel/hints/index.js +2 -2
- package/dest/kernel/hints/key_validation_hint.d.ts +2 -1
- package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request.d.ts +2 -1
- package/dest/kernel/hints/key_validation_request.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request_and_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/private_kernel_reset_hints.d.ts +13 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request.d.ts +7 -1
- package/dest/kernel/hints/read_request.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.d.ts +7 -1
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/{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/hints/transient_data_squashing_hint.js +3 -1
- package/dest/kernel/log_hash.js +3 -1
- package/dest/kernel/private_accumulated_data.d.ts +23 -1
- package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +25 -1
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_request.d.ts +16 -1
- package/dest/kernel/private_call_request.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +81 -8
- 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 +33 -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_data.d.ts +7 -1
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +22 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +4 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +12 -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 +25 -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_log_data.js +5 -2
- package/dest/kernel/private_to_avm_accumulated_data.d.ts +2 -2
- package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
- package/dest/kernel/private_to_public_accumulated_data.js +3 -1
- package/dest/kernel/private_to_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_accumulated_data.d.ts +17 -1
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +18 -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 +13 -4
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +12 -10
- package/dest/kernel/public_call_request.d.ts +22 -1
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +5 -2
- package/dest/kernel/utils/optional_number.d.ts +7 -1
- package/dest/kernel/utils/optional_number.d.ts.map +1 -1
- package/dest/keys/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.d.ts +5 -1
- package/dest/keys/public_keys.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/contract_class_log.js +3 -1
- package/dest/logs/extended_contract_class_log.d.ts +3 -1
- package/dest/logs/extended_contract_class_log.d.ts.map +1 -1
- package/dest/logs/extended_public_log.d.ts +17 -9
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +21 -14
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +20 -17
- package/dest/logs/private_log.d.ts +2 -2
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +3 -1
- package/dest/logs/public_log.js +3 -1
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +2 -5
- package/dest/messaging/in_hash.d.ts +4 -2
- package/dest/messaging/in_hash.d.ts.map +1 -1
- package/dest/messaging/in_hash.js +3 -1
- package/dest/messaging/inbox_leaf.d.ts +3 -1
- package/dest/messaging/inbox_leaf.d.ts.map +1 -1
- package/dest/messaging/l1_actor.d.ts +7 -1
- package/dest/messaging/l1_actor.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.d.ts +6 -1
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l2_actor.d.ts +7 -1
- package/dest/messaging/l2_actor.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +88 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +160 -42
- package/dest/messaging/out_hash.d.ts +41 -3
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +54 -19
- package/dest/note/index.d.ts +1 -2
- package/dest/note/index.d.ts.map +1 -1
- package/dest/note/index.js +0 -1
- package/dest/note/note_dao.d.ts +36 -5
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +15 -12
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +102 -23
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +138 -39
- package/dest/p2p/checkpoint_attestation.d.ts +82 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +179 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +243 -0
- package/dest/p2p/consensus_payload.d.ts +20 -11
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +24 -19
- package/dest/p2p/constants.d.ts +5 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +3 -0
- package/dest/p2p/gossipable.d.ts +4 -3
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +16 -5
- package/dest/p2p/index.d.ts +5 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +4 -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/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +42 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +75 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +10 -3
- package/dest/parity/parity_base_private_inputs.d.ts +3 -1
- package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
- package/dest/parity/parity_public_inputs.d.ts +4 -1
- package/dest/parity/parity_public_inputs.d.ts.map +1 -1
- package/dest/parity/parity_root_private_inputs.d.ts +2 -1
- package/dest/parity/parity_root_private_inputs.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.d.ts +1 -1
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +9 -4
- package/dest/proofs/proof.d.ts +4 -1
- package/dest/proofs/proof.d.ts.map +1 -1
- package/dest/proofs/recursive_proof.d.ts +10 -1
- package/dest/proofs/recursive_proof.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.d.ts +34 -1
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.d.ts +12 -1
- package/dest/rollup/block_constant_data.d.ts.map +1 -1
- package/dest/rollup/block_headers_hash.js +1 -1
- package/dest/rollup/block_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/block_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.d.ts +47 -11
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +8 -12
- package/dest/rollup/block_root_rollup_private_inputs.d.ts +64 -1
- package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.d.ts +10 -1
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +3 -1
- package/dest/rollup/checkpoint_header.d.ts +43 -13
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +50 -20
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +46 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +11 -3
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +44 -3
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +13 -2
- package/dest/rollup/epoch_constant_data.d.ts +16 -1
- package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
- package/dest/rollup/root_rollup_private_inputs.d.ts +6 -1
- package/dest/rollup/root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts +21 -6
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +10 -4
- package/dest/rollup/tree_snapshot_diff_hints.d.ts +24 -1
- package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts +29 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
- package/dest/schemas/schemas.d.ts +1 -1
- package/dest/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 +16 -10
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +71 -36
- package/dest/tests/jest.js +1 -1
- package/dest/tests/mocks.d.ts +77 -19
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +133 -62
- 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/append_only_tree_snapshot.d.ts +13 -1
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +3 -1
- package/dest/trees/nullifier_leaf.d.ts +13 -1
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.d.ts +10 -1
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.d.ts +17 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +7 -6
- package/dest/trees/public_data_witness.d.ts +11 -1
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/tx/block_header.d.ts +14 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +9 -3
- package/dest/tx/call_context.d.ts +13 -1
- package/dest/tx/call_context.d.ts.map +1 -1
- package/dest/tx/call_context.js +3 -1
- package/dest/tx/capsule.d.ts +4 -1
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/execution_payload.d.ts +9 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/function_data.d.ts +4 -2
- package/dest/tx/function_data.d.ts.map +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +12 -4
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +3 -1
- package/dest/tx/hashed_values.d.ts +7 -1
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/in_tx.d.ts +4 -4
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/indexed_tx_effect.d.ts +5 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +3 -2
- package/dest/tx/partial_state_reference.d.ts +4 -1
- package/dest/tx/partial_state_reference.d.ts.map +1 -1
- package/dest/tx/private_execution_result.d.ts +23 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +4 -21
- package/dest/tx/private_tx_constant_data.d.ts +16 -1
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/profiling.d.ts +152 -29
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +47 -10
- package/dest/tx/protocol_contracts.d.ts +2 -2
- package/dest/tx/protocol_contracts.d.ts.map +1 -1
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/public_call_request_with_calldata.d.ts +7 -1
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- package/dest/tx/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/state_reference.d.ts +3 -1
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/state_reference.js +3 -1
- package/dest/tx/tree_snapshots.js +3 -1
- package/dest/tx/tx.d.ts +24 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +9 -4
- package/dest/tx/tx_context.d.ts +2 -1
- package/dest/tx/tx_context.d.ts.map +1 -1
- package/dest/tx/tx_effect.d.ts +32 -6
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +3 -8
- package/dest/tx/tx_execution_request.d.ts +30 -1
- package/dest/tx/tx_execution_request.d.ts.map +1 -1
- package/dest/tx/tx_execution_request.js +6 -2
- package/dest/tx/tx_hash.d.ts +2 -1
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +47 -13
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- package/dest/tx/tx_request.d.ts +6 -1
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/tx/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 +3 -2
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +3 -1
- package/dest/tx/validator/tx_validator.d.ts +2 -2
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/types/shared.d.ts +4 -1
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/validators/schemas.d.ts +38 -38
- 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/dest/vks/verification_key.d.ts +22 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/vk_data.d.ts +7 -1
- package/dest/vks/vk_data.d.ts.map +1 -1
- package/dest/zkpassport/index.d.ts +3 -4
- package/dest/zkpassport/index.d.ts.map +1 -1
- package/dest/zkpassport/index.js +9 -9
- package/package.json +27 -13
- package/src/abi/contract_artifact.ts +10 -10
- package/src/abi/function_call.ts +25 -3
- package/src/abi/utils.ts +17 -0
- package/src/auth_witness/auth_witness.ts +3 -3
- package/src/block/attestation_info.ts +9 -6
- package/src/block/block_data.ts +26 -0
- package/src/block/block_hash.ts +26 -25
- package/src/block/block_parameter.ts +4 -2
- package/src/block/body.ts +2 -1
- package/src/block/checkpointed_l2_block.ts +8 -58
- package/src/block/in_block.ts +6 -6
- package/src/block/index.ts +1 -2
- package/src/block/l2_block.ts +102 -149
- package/src/block/l2_block_source.ts +145 -44
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +15 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +130 -39
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +480 -36
- package/src/block/validate_block_result.ts +40 -35
- package/src/checkpoint/checkpoint.ts +62 -21
- package/src/checkpoint/checkpoint_data.ts +51 -0
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +2 -0
- package/src/checkpoint/published_checkpoint.ts +7 -4
- 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/index.ts +0 -2
- 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/deserialization/index.ts +21 -0
- 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/api_limit.ts +2 -0
- package/src/interfaces/archiver.ts +31 -24
- package/src/interfaces/aztec-node-admin.ts +31 -4
- package/src/interfaces/aztec-node.ts +110 -129
- package/src/interfaces/block-builder.ts +41 -23
- package/src/interfaces/configs.ts +15 -1
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/merkle_tree_operations.ts +1 -1
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/prover-broker.ts +22 -0
- package/src/interfaces/prover-client.ts +22 -0
- package/src/interfaces/proving-job.ts +2 -11
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/interfaces/slasher.ts +4 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +73 -15
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +20 -12
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +17 -14
- 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/log_id.ts +22 -18
- package/src/logs/siloed_tag.ts +2 -2
- package/src/messaging/in_hash.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +178 -52
- package/src/messaging/out_hash.ts +62 -21
- package/src/note/index.ts +0 -1
- package/src/note/note_dao.ts +18 -13
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +211 -46
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +36 -25
- package/src/p2p/checkpoint_proposal.ts +387 -0
- package/src/p2p/consensus_payload.ts +29 -18
- package/src/p2p/constants.ts +6 -0
- package/src/p2p/gossipable.ts +14 -4
- package/src/p2p/index.ts +4 -1
- package/src/p2p/message_validator.ts +14 -2
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +88 -0
- package/src/p2p/topic_type.ts +4 -3
- package/src/proofs/chonk_proof.ts +9 -5
- package/src/rollup/block_headers_hash.ts +1 -1
- package/src/rollup/block_rollup_public_inputs.ts +5 -11
- package/src/rollup/checkpoint_header.ts +64 -21
- package/src/rollup/checkpoint_rollup_public_inputs.ts +17 -5
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
- package/src/rollup/root_rollup_public_inputs.ts +16 -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 +70 -54
- package/src/tests/jest.ts +1 -1
- package/src/tests/mocks.ts +228 -95
- package/src/timetable/index.ts +66 -0
- package/src/trees/public_data_leaf.ts +11 -5
- package/src/tx/block_header.ts +12 -4
- package/src/tx/global_variable_builder.ts +1 -1
- package/src/tx/global_variables.ts +3 -3
- package/src/tx/index.ts +0 -1
- package/src/tx/indexed_tx_effect.ts +3 -2
- package/src/tx/private_execution_result.ts +1 -16
- package/src/tx/profiling.ts +51 -9
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/tx.ts +10 -9
- package/src/tx/tx_effect.ts +0 -9
- package/src/tx/tx_execution_request.ts +2 -0
- package/src/tx/tx_receipt.ts +75 -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 +4 -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/src/zkpassport/index.ts +11 -12
- package/dest/block/l2_block_code_to_purge.d.ts +0 -12
- package/dest/block/l2_block_code_to_purge.d.ts.map +0 -1
- package/dest/block/l2_block_code_to_purge.js +0 -61
- package/dest/block/l2_block_header.d.ts +0 -98
- package/dest/block/l2_block_header.d.ts.map +0 -1
- package/dest/block/l2_block_header.js +0 -153
- package/dest/block/l2_block_new.d.ts +0 -135
- package/dest/block/l2_block_new.d.ts.map +0 -1
- package/dest/block/l2_block_new.js +0 -152
- package/dest/contract/contract_class_metadata.d.ts +0 -8
- package/dest/contract/contract_class_metadata.d.ts.map +0 -1
- package/dest/contract/contract_class_metadata.js +0 -1
- package/dest/contract/contract_metadata.d.ts +0 -7
- package/dest/contract/contract_metadata.d.ts.map +0 -1
- package/dest/contract/contract_metadata.js +0 -1
- package/dest/database-version/index.d.ts +0 -2
- package/dest/database-version/index.d.ts.map +0 -1
- package/dest/database-version/index.js +0 -1
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts +0 -25
- package/dest/kernel/hints/key_validation_request_and_generator.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/dest/p2p/block_attestation.d.ts +0 -80
- package/dest/p2p/block_attestation.d.ts.map +0 -1
- package/dest/tx/content_commitment.d.ts +0 -49
- package/dest/tx/content_commitment.d.ts.map +0 -1
- package/dest/tx/content_commitment.js +0 -90
- package/src/block/l2_block_code_to_purge.ts +0 -88
- package/src/block/l2_block_header.ts +0 -246
- package/src/block/l2_block_new.ts +0 -207
- package/src/contract/contract_class_metadata.ts +0 -8
- package/src/contract/contract_metadata.ts +0 -7
- package/src/database-version/index.ts +0 -1
- package/src/note/notes_filter.ts +0 -38
- package/src/tx/content_commitment.ts +0 -113
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { BlockNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
4
|
+
import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
|
+
import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
9
|
+
|
|
10
|
+
import type { L2BlockInfo } from '../block/l2_block_info.js';
|
|
11
|
+
import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
|
|
12
|
+
import { DutyType, type SigningContext } from '../ha-signing/index.js';
|
|
13
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
14
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
15
|
+
import { TxHash } from '../tx/index.js';
|
|
16
|
+
import type { Tx } from '../tx/tx.js';
|
|
17
|
+
import { BlockProposal } from './block_proposal.js';
|
|
18
|
+
import { Gossipable } from './gossipable.js';
|
|
19
|
+
import {
|
|
20
|
+
SignatureDomainSeparator,
|
|
21
|
+
getHashedSignaturePayload,
|
|
22
|
+
getHashedSignaturePayloadEthSignedMessage,
|
|
23
|
+
} from './signature_utils.js';
|
|
24
|
+
import { SignedTxs } from './signed_txs.js';
|
|
25
|
+
import { TopicType } from './topic_type.js';
|
|
26
|
+
|
|
27
|
+
// REFACTOR(palla): Use a branded type instead of a subclass of Buffer32
|
|
28
|
+
export class CheckpointProposalHash extends Buffer32 {
|
|
29
|
+
constructor(hash: Buffer) {
|
|
30
|
+
super(hash);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type CheckpointProposalOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Whether to include the tx objects along with the block proposal.
|
|
37
|
+
* Dramatically increases size of the payload but eliminates failed reexecutions due to missing txs.
|
|
38
|
+
*/
|
|
39
|
+
publishFullTxs?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to generate an invalid checkpoint proposal for broadcasting.
|
|
42
|
+
* Use only for testing.
|
|
43
|
+
*/
|
|
44
|
+
broadcastInvalidCheckpointProposal?: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Data for the last block included in a checkpoint proposal */
|
|
48
|
+
export type CheckpointLastBlockData = {
|
|
49
|
+
/** The per-block header for the last block in the checkpoint */
|
|
50
|
+
blockHeader: BlockHeader;
|
|
51
|
+
/** Index of this block within the checkpoint (should be the last index, e.g., numBlocks - 1) */
|
|
52
|
+
indexWithinCheckpoint: IndexWithinCheckpoint;
|
|
53
|
+
/** The sequence of transactions in the last block */
|
|
54
|
+
txHashes: TxHash[];
|
|
55
|
+
/** The tx in the last block (optional, for DA guarantees) */
|
|
56
|
+
txs?: Tx[];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** Last block included in a checkpoint proposal */
|
|
60
|
+
export type CheckpointLastBlock = Omit<CheckpointLastBlockData, 'txs'> & {
|
|
61
|
+
/** The proposer's signature over the block data (separate from checkpoint signature) */
|
|
62
|
+
signature: Signature;
|
|
63
|
+
/** The signed transactions in the last block (optional, for DA guarantees) */
|
|
64
|
+
signedTxs?: SignedTxs;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A checkpoint proposal is created by the leader of the chain for the last block in a checkpoint.
|
|
69
|
+
* It includes the aggregated checkpoint header that validators will attest to, plus optionally
|
|
70
|
+
* the last block's info for nodes to re-execute. This marks the completion of a slot's worth of blocks.
|
|
71
|
+
*/
|
|
72
|
+
export class CheckpointProposal extends Gossipable {
|
|
73
|
+
static override p2pTopic = TopicType.checkpoint_proposal;
|
|
74
|
+
|
|
75
|
+
private sender: EthAddress | undefined;
|
|
76
|
+
|
|
77
|
+
constructor(
|
|
78
|
+
/** The aggregated checkpoint header for consensus */
|
|
79
|
+
public readonly checkpointHeader: CheckpointHeader,
|
|
80
|
+
|
|
81
|
+
/** Archive root after this checkpoint is applied */
|
|
82
|
+
public readonly archive: Fr,
|
|
83
|
+
|
|
84
|
+
/** The fee asset price modifier in basis points (from oracle) */
|
|
85
|
+
public readonly feeAssetPriceModifier: bigint,
|
|
86
|
+
|
|
87
|
+
/** The proposer's signature over the checkpoint payload (checkpointHeader + archive + feeAssetPriceModifier) */
|
|
88
|
+
public readonly signature: Signature,
|
|
89
|
+
|
|
90
|
+
/** Optional last block info, including its own signature for BlockProposal extraction */
|
|
91
|
+
public readonly lastBlock?: CheckpointLastBlock,
|
|
92
|
+
) {
|
|
93
|
+
super();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override generateP2PMessageIdentifier(): Promise<Buffer32> {
|
|
97
|
+
return Promise.resolve(new CheckpointProposalHash(keccak256(this.signature.toBuffer())));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get slotNumber(): SlotNumber {
|
|
101
|
+
return this.checkpointHeader.slotNumber;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get blockNumber(): BlockNumber {
|
|
105
|
+
if (!this.lastBlock) {
|
|
106
|
+
throw new Error('Cannot get blockNumber without lastBlock');
|
|
107
|
+
}
|
|
108
|
+
return this.lastBlock.blockHeader.getBlockNumber();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Convenience getter for txHashes from lastBlock */
|
|
112
|
+
get txHashes(): TxHash[] {
|
|
113
|
+
return this.lastBlock?.txHashes ?? [];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Convenience getter for txs from lastBlock */
|
|
117
|
+
get txs(): Tx[] | undefined {
|
|
118
|
+
return this.lastBlock?.signedTxs?.txs;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Extract a BlockProposal from the last block info.
|
|
123
|
+
* Uses inHash from checkpointHeader.contentCommitment.inHash
|
|
124
|
+
*/
|
|
125
|
+
getBlockProposal(): BlockProposal | undefined {
|
|
126
|
+
if (!this.lastBlock) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return new BlockProposal(
|
|
131
|
+
this.lastBlock.blockHeader,
|
|
132
|
+
this.lastBlock.indexWithinCheckpoint,
|
|
133
|
+
this.checkpointHeader.inHash,
|
|
134
|
+
this.archive,
|
|
135
|
+
this.lastBlock.txHashes,
|
|
136
|
+
this.lastBlock.signature,
|
|
137
|
+
this.lastBlock.signedTxs,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'> {
|
|
142
|
+
if (!this.lastBlock) {
|
|
143
|
+
throw new Error('Cannot get blockInfo without lastBlock');
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
slotNumber: this.slotNumber,
|
|
147
|
+
lastArchive: this.lastBlock.blockHeader.lastArchive.root,
|
|
148
|
+
timestamp: this.lastBlock.blockHeader.globalVariables.timestamp,
|
|
149
|
+
archive: this.archive,
|
|
150
|
+
txCount: this.lastBlock.txHashes.length,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
toCheckpointInfo() {
|
|
155
|
+
return {
|
|
156
|
+
slotNumber: this.slotNumber,
|
|
157
|
+
archive: this.archive,
|
|
158
|
+
lastBlockNumber: this.lastBlock?.blockHeader.getBlockNumber(),
|
|
159
|
+
lastBlockIndex: this.lastBlock?.indexWithinCheckpoint,
|
|
160
|
+
blockHeadersHash: this.checkpointHeader.blockHeadersHash,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get the payload to sign for this checkpoint proposal.
|
|
166
|
+
* The signature is over the checkpoint header + archive root + feeAssetPriceModifier (for consensus).
|
|
167
|
+
*/
|
|
168
|
+
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
|
|
169
|
+
return serializeToBuffer([
|
|
170
|
+
domainSeparator,
|
|
171
|
+
this.checkpointHeader,
|
|
172
|
+
this.archive,
|
|
173
|
+
serializeSignedBigInt(this.feeAssetPriceModifier),
|
|
174
|
+
]);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static async createProposalFromSigner(
|
|
178
|
+
checkpointHeader: CheckpointHeader,
|
|
179
|
+
archiveRoot: Fr,
|
|
180
|
+
feeAssetPriceModifier: bigint,
|
|
181
|
+
lastBlockInfo: CheckpointLastBlockData | undefined,
|
|
182
|
+
payloadSigner: (payload: Buffer32, context: SigningContext) => Promise<Signature>,
|
|
183
|
+
): Promise<CheckpointProposal> {
|
|
184
|
+
// Sign the checkpoint payload with CHECKPOINT_PROPOSAL duty type
|
|
185
|
+
const tempProposal = new CheckpointProposal(
|
|
186
|
+
checkpointHeader,
|
|
187
|
+
archiveRoot,
|
|
188
|
+
feeAssetPriceModifier,
|
|
189
|
+
Signature.empty(),
|
|
190
|
+
);
|
|
191
|
+
const checkpointHash = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.checkpointProposal);
|
|
192
|
+
|
|
193
|
+
const checkpointContext: SigningContext = {
|
|
194
|
+
slot: checkpointHeader.slotNumber,
|
|
195
|
+
blockNumber: lastBlockInfo?.blockHeader?.globalVariables.blockNumber ?? BlockNumber(0),
|
|
196
|
+
dutyType: DutyType.CHECKPOINT_PROPOSAL,
|
|
197
|
+
};
|
|
198
|
+
const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
|
|
199
|
+
|
|
200
|
+
if (!lastBlockInfo) {
|
|
201
|
+
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const lastBlockProposal = await BlockProposal.createProposalFromSigner(
|
|
205
|
+
lastBlockInfo.blockHeader,
|
|
206
|
+
lastBlockInfo.indexWithinCheckpoint,
|
|
207
|
+
checkpointHeader.inHash,
|
|
208
|
+
archiveRoot,
|
|
209
|
+
lastBlockInfo.txHashes,
|
|
210
|
+
lastBlockInfo.txs,
|
|
211
|
+
payloadSigner,
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
|
|
215
|
+
blockHeader: lastBlockInfo.blockHeader,
|
|
216
|
+
indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
|
|
217
|
+
txHashes: lastBlockInfo.txHashes,
|
|
218
|
+
signature: lastBlockProposal.signature,
|
|
219
|
+
signedTxs: lastBlockProposal.signedTxs,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Lazily evaluate the sender of the proposal; result is cached.
|
|
225
|
+
* If there's a lastBlock, also verifies the block proposal sender matches the checkpoint sender.
|
|
226
|
+
* @returns The sender address, or undefined if signature recovery fails or senders don't match
|
|
227
|
+
*/
|
|
228
|
+
getSender(): EthAddress | undefined {
|
|
229
|
+
if (!this.sender) {
|
|
230
|
+
const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.checkpointProposal);
|
|
231
|
+
const checkpointSender = tryRecoverAddress(hashed, this.signature);
|
|
232
|
+
|
|
233
|
+
// If there's a lastBlock, verify the block proposal sender matches
|
|
234
|
+
if (checkpointSender && this.lastBlock) {
|
|
235
|
+
const blockProposal = this.getBlockProposal();
|
|
236
|
+
const blockSender = blockProposal?.getSender();
|
|
237
|
+
if (!blockSender || !blockSender.equals(checkpointSender)) {
|
|
238
|
+
return undefined; // Sender mismatch - fail
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Cache the sender for later use
|
|
243
|
+
this.sender = checkpointSender;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this.sender;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getPayload() {
|
|
250
|
+
return this.getPayloadToSign(SignatureDomainSeparator.checkpointProposal);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
toBuffer(): Buffer {
|
|
254
|
+
const buffer: any[] = [
|
|
255
|
+
this.checkpointHeader,
|
|
256
|
+
this.archive,
|
|
257
|
+
serializeSignedBigInt(this.feeAssetPriceModifier),
|
|
258
|
+
this.signature,
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
if (this.lastBlock) {
|
|
262
|
+
buffer.push(1); // hasLastBlock = true
|
|
263
|
+
buffer.push(this.lastBlock.blockHeader);
|
|
264
|
+
buffer.push(this.lastBlock.indexWithinCheckpoint);
|
|
265
|
+
buffer.push(this.lastBlock.signature);
|
|
266
|
+
buffer.push(this.lastBlock.txHashes.length);
|
|
267
|
+
buffer.push(this.lastBlock.txHashes);
|
|
268
|
+
if (this.lastBlock.signedTxs) {
|
|
269
|
+
buffer.push(1); // hasSignedTxs = true
|
|
270
|
+
buffer.push(this.lastBlock.signedTxs.toBuffer());
|
|
271
|
+
} else {
|
|
272
|
+
buffer.push(0); // hasSignedTxs = false
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
buffer.push(0); // hasLastBlock = false
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return serializeToBuffer(buffer);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static fromBuffer(buf: Buffer | BufferReader): CheckpointProposal {
|
|
282
|
+
const reader = BufferReader.asReader(buf);
|
|
283
|
+
|
|
284
|
+
const checkpointHeader = reader.readObject(CheckpointHeader);
|
|
285
|
+
const archive = reader.readObject(Fr);
|
|
286
|
+
const feeAssetPriceModifier = reader.readInt256();
|
|
287
|
+
const signature = reader.readObject(Signature);
|
|
288
|
+
|
|
289
|
+
const hasLastBlock = reader.readNumber();
|
|
290
|
+
|
|
291
|
+
if (hasLastBlock) {
|
|
292
|
+
const blockHeader = reader.readObject(BlockHeader);
|
|
293
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
|
|
294
|
+
const blockSignature = reader.readObject(Signature);
|
|
295
|
+
const txHashCount = reader.readNumber();
|
|
296
|
+
if (txHashCount > MAX_TXS_PER_BLOCK) {
|
|
297
|
+
throw new Error(`txHashes count ${txHashCount} exceeds maximum ${MAX_TXS_PER_BLOCK}`);
|
|
298
|
+
}
|
|
299
|
+
const txHashes = reader.readArray(txHashCount, TxHash);
|
|
300
|
+
|
|
301
|
+
let signedTxs: SignedTxs | undefined;
|
|
302
|
+
if (!reader.isEmpty()) {
|
|
303
|
+
const hasSignedTxs = reader.readNumber();
|
|
304
|
+
if (hasSignedTxs) {
|
|
305
|
+
signedTxs = SignedTxs.fromBuffer(reader);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return new CheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, signature, {
|
|
310
|
+
blockHeader,
|
|
311
|
+
indexWithinCheckpoint,
|
|
312
|
+
txHashes,
|
|
313
|
+
signature: blockSignature,
|
|
314
|
+
signedTxs,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return new CheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, signature);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
getSize(): number {
|
|
322
|
+
let size =
|
|
323
|
+
this.checkpointHeader.toBuffer().length +
|
|
324
|
+
this.archive.size +
|
|
325
|
+
this.signature.getSize() +
|
|
326
|
+
8 /* feeAssetPriceModifier */ +
|
|
327
|
+
4; /* hasLastBlock flag */
|
|
328
|
+
|
|
329
|
+
if (this.lastBlock) {
|
|
330
|
+
size +=
|
|
331
|
+
this.lastBlock.blockHeader.getSize() +
|
|
332
|
+
4 /* indexWithinCheckpoint */ +
|
|
333
|
+
this.lastBlock.signature.getSize() +
|
|
334
|
+
4 /* txHashes.length */ +
|
|
335
|
+
this.lastBlock.txHashes.length * TxHash.SIZE +
|
|
336
|
+
4 /* hasSignedTxs flag */ +
|
|
337
|
+
(this.lastBlock.signedTxs ? this.lastBlock.signedTxs.getSize() : 0);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return size;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
static empty(): CheckpointProposal {
|
|
344
|
+
return new CheckpointProposal(CheckpointHeader.empty(), Fr.ZERO, 0n, Signature.empty());
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
static random(): CheckpointProposal {
|
|
348
|
+
return new CheckpointProposal(CheckpointHeader.random(), Fr.random(), 0n, Signature.random(), {
|
|
349
|
+
blockHeader: BlockHeader.random(),
|
|
350
|
+
indexWithinCheckpoint: IndexWithinCheckpoint(Math.floor(Math.random() * 5)),
|
|
351
|
+
txHashes: [TxHash.random(), TxHash.random()],
|
|
352
|
+
signature: Signature.random(),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
toInspect() {
|
|
357
|
+
return {
|
|
358
|
+
checkpointHeader: this.checkpointHeader.toInspect(),
|
|
359
|
+
archive: this.archive.toString(),
|
|
360
|
+
signature: this.signature.toString(),
|
|
361
|
+
feeAssetPriceModifier: this.feeAssetPriceModifier.toString(),
|
|
362
|
+
lastBlock: this.lastBlock
|
|
363
|
+
? {
|
|
364
|
+
blockHeader: this.lastBlock.blockHeader.toInspect(),
|
|
365
|
+
indexWithinCheckpoint: this.lastBlock.indexWithinCheckpoint,
|
|
366
|
+
txHashes: this.lastBlock.txHashes.map(h => h.toString()),
|
|
367
|
+
signature: this.lastBlock.signature.toString(),
|
|
368
|
+
}
|
|
369
|
+
: undefined,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Returns a copy of this proposal without lastBlock info, as a CheckpointProposalCore.
|
|
375
|
+
* Used when the lastBlock has been extracted and stored separately.
|
|
376
|
+
*/
|
|
377
|
+
toCore(): CheckpointProposalCore {
|
|
378
|
+
return new CheckpointProposal(this.checkpointHeader, this.archive, this.feeAssetPriceModifier, this.signature);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* A checkpoint proposal without the lastBlock info.
|
|
384
|
+
* Used when the lastBlock has been extracted and handled separately as a BlockProposal.
|
|
385
|
+
* This type makes it clear that lastBlock and getBlockProposal() are not available.
|
|
386
|
+
*/
|
|
387
|
+
export type CheckpointProposalCore = Omit<CheckpointProposal, 'lastBlock' | 'getBlockProposal' | 'toCore'>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
import { hexToBuffer } from '@aztec/foundation/string';
|
|
5
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
6
6
|
|
|
7
7
|
import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
|
|
10
|
-
import type { L2Block } from '../block/l2_block.js';
|
|
11
10
|
import type { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
12
11
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
12
|
+
import type { CheckpointProposal, CheckpointProposalCore } from './checkpoint_proposal.js';
|
|
13
13
|
import type { Signable, SignatureDomainSeparator } from './signature_utils.js';
|
|
14
14
|
|
|
15
|
+
/** Checkpoint consensus payload as signed by validators and verified on L1. */
|
|
15
16
|
export class ConsensusPayload implements Signable {
|
|
16
17
|
private size: number | undefined;
|
|
17
18
|
|
|
@@ -20,6 +21,8 @@ export class ConsensusPayload implements Signable {
|
|
|
20
21
|
public readonly header: CheckpointHeader,
|
|
21
22
|
/** The archive root after the block is added */
|
|
22
23
|
public readonly archive: Fr,
|
|
24
|
+
/** The fee asset price modifier in basis points (from oracle) */
|
|
25
|
+
public readonly feeAssetPriceModifier: bigint = 0n,
|
|
23
26
|
) {}
|
|
24
27
|
|
|
25
28
|
static get schema() {
|
|
@@ -27,12 +30,13 @@ export class ConsensusPayload implements Signable {
|
|
|
27
30
|
.object({
|
|
28
31
|
header: CheckpointHeader.schema,
|
|
29
32
|
archive: schemas.Fr,
|
|
33
|
+
feeAssetPriceModifier: schemas.BigInt,
|
|
30
34
|
})
|
|
31
|
-
.transform(obj => new ConsensusPayload(obj.header, obj.archive));
|
|
35
|
+
.transform(obj => new ConsensusPayload(obj.header, obj.archive, obj.feeAssetPriceModifier));
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
static getFields(fields: FieldsOf<ConsensusPayload>) {
|
|
35
|
-
return [fields.header, fields.archive] as const;
|
|
39
|
+
return [fields.header, fields.archive, fields.feeAssetPriceModifier] as const;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
|
|
@@ -49,44 +53,50 @@ export class ConsensusPayload implements Signable {
|
|
|
49
53
|
const headerHash = this.header.hash().toString();
|
|
50
54
|
const encodedData = encodeAbiParameters(abi, [
|
|
51
55
|
domainSeparator,
|
|
52
|
-
[archiveRoot, [
|
|
56
|
+
[archiveRoot, [this.feeAssetPriceModifier], headerHash],
|
|
53
57
|
] as const);
|
|
54
58
|
|
|
55
59
|
return hexToBuffer(encodedData);
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
toBuffer(): Buffer {
|
|
59
|
-
return serializeToBuffer([this.header, this.archive]);
|
|
63
|
+
return serializeToBuffer([this.header, this.archive, serializeSignedBigInt(this.feeAssetPriceModifier)]);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
public equals(other: ConsensusPayload): boolean {
|
|
63
|
-
|
|
66
|
+
public equals(other: ConsensusPayload | CheckpointProposal | CheckpointProposalCore): boolean {
|
|
67
|
+
const otherHeader = 'checkpointHeader' in other ? other.checkpointHeader : other.header;
|
|
68
|
+
const otherModifier = 'feeAssetPriceModifier' in other ? other.feeAssetPriceModifier : 0n;
|
|
69
|
+
return (
|
|
70
|
+
this.header.equals(otherHeader) &&
|
|
71
|
+
this.archive.equals(other.archive) &&
|
|
72
|
+
this.feeAssetPriceModifier === otherModifier
|
|
73
|
+
);
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
static fromBuffer(buf: Buffer | BufferReader): ConsensusPayload {
|
|
67
77
|
const reader = BufferReader.asReader(buf);
|
|
68
|
-
const payload = new ConsensusPayload(
|
|
78
|
+
const payload = new ConsensusPayload(
|
|
79
|
+
reader.readObject(CheckpointHeader),
|
|
80
|
+
reader.readObject(Fr),
|
|
81
|
+
reader.readInt256(),
|
|
82
|
+
);
|
|
69
83
|
return payload;
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
static fromFields(fields: FieldsOf<ConsensusPayload>): ConsensusPayload {
|
|
73
|
-
return new ConsensusPayload(fields.header, fields.archive);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static fromBlock(block: L2Block): ConsensusPayload {
|
|
77
|
-
return new ConsensusPayload(block.header.toCheckpointHeader(), block.archive.root);
|
|
87
|
+
return new ConsensusPayload(fields.header, fields.archive, fields.feeAssetPriceModifier);
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
static fromCheckpoint(checkpoint: Checkpoint): ConsensusPayload {
|
|
81
|
-
return new ConsensusPayload(checkpoint.header, checkpoint.archive.root);
|
|
91
|
+
return new ConsensusPayload(checkpoint.header, checkpoint.archive.root, checkpoint.feeAssetPriceModifier);
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
static empty(): ConsensusPayload {
|
|
85
|
-
return new ConsensusPayload(CheckpointHeader.empty(), Fr.ZERO);
|
|
95
|
+
return new ConsensusPayload(CheckpointHeader.empty(), Fr.ZERO, 0n);
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
static random(): ConsensusPayload {
|
|
89
|
-
return new ConsensusPayload(CheckpointHeader.random(), Fr.random());
|
|
99
|
+
return new ConsensusPayload(CheckpointHeader.random(), Fr.random(), 0n);
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
/**
|
|
@@ -106,10 +116,11 @@ export class ConsensusPayload implements Signable {
|
|
|
106
116
|
return {
|
|
107
117
|
header: this.header.toInspect(),
|
|
108
118
|
archive: this.archive.toString(),
|
|
119
|
+
feeAssetPriceModifier: this.feeAssetPriceModifier.toString(),
|
|
109
120
|
};
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
toString() {
|
|
113
|
-
return `header: ${this.header.toString()}, archive: ${this.archive.toString()}}`;
|
|
124
|
+
return `header: ${this.header.toString()}, archive: ${this.archive.toString()}, feeAssetPriceModifier: ${this.feeAssetPriceModifier}}`;
|
|
114
125
|
}
|
|
115
126
|
}
|
package/src/p2p/gossipable.ts
CHANGED
|
@@ -7,23 +7,33 @@ export class P2PMessage {
|
|
|
7
7
|
constructor(
|
|
8
8
|
public readonly payload: Buffer,
|
|
9
9
|
public readonly timestamp?: Date,
|
|
10
|
+
public readonly traceContext?: string,
|
|
10
11
|
) {}
|
|
11
12
|
|
|
12
|
-
static fromGossipable(message: Gossipable, instrumentMessages = false): P2PMessage {
|
|
13
|
-
|
|
13
|
+
static fromGossipable(message: Gossipable, instrumentMessages = false, traceContext?: string): P2PMessage {
|
|
14
|
+
if (!instrumentMessages) {
|
|
15
|
+
return new P2PMessage(message.toBuffer());
|
|
16
|
+
}
|
|
17
|
+
return new P2PMessage(message.toBuffer(), new Date(), traceContext);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
static fromMessageData(messageData: Buffer, instrumentMessages = false): P2PMessage {
|
|
17
21
|
const reader = new BufferReader(messageData);
|
|
18
|
-
|
|
22
|
+
let timestamp: Date | undefined;
|
|
23
|
+
let traceContext: string | undefined;
|
|
24
|
+
if (instrumentMessages) {
|
|
25
|
+
timestamp = new Date(Number(reader.readUInt64()));
|
|
26
|
+
traceContext = reader.readString();
|
|
27
|
+
}
|
|
19
28
|
const payload = reader.readBuffer();
|
|
20
|
-
return new P2PMessage(payload, timestamp);
|
|
29
|
+
return new P2PMessage(payload, timestamp, traceContext);
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
toMessageData(): Buffer {
|
|
24
33
|
const arr: Buffer[] = [];
|
|
25
34
|
if (this.timestamp) {
|
|
26
35
|
arr.push(bigintToUInt64BE(BigInt(this.timestamp.getTime())));
|
|
36
|
+
arr.push(serializeToBuffer(this.traceContext ?? ''));
|
|
27
37
|
}
|
|
28
38
|
arr.push(serializeToBuffer(this.payload.length, this.payload));
|
|
29
39
|
return serializeToBuffer(arr);
|
package/src/p2p/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export * from './attestation_utils.js';
|
|
2
|
-
export * from './block_attestation.js';
|
|
3
2
|
export * from './block_proposal.js';
|
|
3
|
+
export * from './checkpoint_attestation.js';
|
|
4
|
+
export * from './checkpoint_proposal.js';
|
|
4
5
|
export * from './consensus_payload.js';
|
|
5
6
|
export * from './gossipable.js';
|
|
6
7
|
export * from './interface.js';
|
|
7
8
|
export * from './signature_utils.js';
|
|
9
|
+
export * from './signed_txs.js';
|
|
8
10
|
export * from './topic_type.js';
|
|
9
11
|
export * from './client_type.js';
|
|
10
12
|
export * from './message_validator.js';
|
|
11
13
|
export * from './peer_error.js';
|
|
14
|
+
export * from './constants.js';
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { PeerErrorSeverity } from './peer_error.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Result of validating a P2P message.
|
|
5
|
+
* - 'accept': Message is valid and should be accepted and processed
|
|
6
|
+
* - 'ignore': Message should be ignored (not propagated or processed, but sender not penalized)
|
|
7
|
+
* - 'reject': Message is invalid (rejected and sender penalized)
|
|
8
|
+
*/
|
|
9
|
+
export type ValidationResult =
|
|
10
|
+
| { result: 'accept' }
|
|
11
|
+
| { result: 'ignore' }
|
|
12
|
+
| { result: 'reject'; severity: PeerErrorSeverity };
|
|
13
|
+
|
|
3
14
|
/**
|
|
4
15
|
* P2PValidator
|
|
5
16
|
*
|
|
6
|
-
* A validator for P2P messages, which returns a
|
|
17
|
+
* A validator for P2P messages, which returns a ValidationResult indicating
|
|
18
|
+
* whether to accept, ignore, or reject the message
|
|
7
19
|
*/
|
|
8
20
|
export interface P2PValidator<T> {
|
|
9
|
-
validate(message: T): Promise<
|
|
21
|
+
validate(message: T): Promise<ValidationResult>;
|
|
10
22
|
}
|
|
@@ -4,8 +4,10 @@ import { makeEthSignDigest } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
|
4
4
|
|
|
5
5
|
export enum SignatureDomainSeparator {
|
|
6
6
|
blockProposal = 0,
|
|
7
|
-
|
|
7
|
+
checkpointAttestation = 1,
|
|
8
8
|
attestationsAndSigners = 2,
|
|
9
|
+
checkpointProposal = 3,
|
|
10
|
+
signedTxs = 4,
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface Signable {
|