@aztec/stdlib 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c
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 +9 -1
- package/dest/abi/function_call.d.ts.map +1 -1
- 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/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_hash.d.ts +9 -2
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +15 -0
- 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/index.d.ts +1 -3
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +0 -2
- package/dest/block/l2_block.d.ts +56 -57
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +64 -107
- package/dest/block/l2_block_source.d.ts +296 -67
- 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 +30 -20
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +19 -6
- 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 +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/published_checkpoint.d.ts +17 -15
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +4 -3
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/contract/complete_address.d.ts +4 -1
- package/dest/contract/complete_address.d.ts.map +1 -1
- package/dest/contract/contract_deployment_data.d.ts +5 -5
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_instance.d.ts +16 -16
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +1 -2
- package/dest/database-version/version_manager.d.ts +4 -2
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +3 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- package/dest/deserialization/index.d.ts +11 -0
- package/dest/deserialization/index.d.ts.map +1 -0
- package/dest/deserialization/index.js +10 -0
- package/dest/epoch-helpers/index.js +1 -1
- package/dest/errors/proving_error.d.ts +2 -2
- package/dest/errors/proving_error.d.ts.map +1 -1
- package/dest/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- 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 +20 -16
- package/dest/interfaces/aztec-node-admin.d.ts +67 -31
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +70 -51
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +12 -9
- package/dest/interfaces/block-builder.d.ts +16 -14
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +12 -7
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/get_logs_response.d.ts +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/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-client.d.ts +10 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +184 -184
- 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/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +108 -18
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +5 -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/key_validation_hint.d.ts +2 -1
- package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request.d.ts +2 -1
- package/dest/kernel/hints/key_validation_request.d.ts.map +1 -1
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts +6 -1
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +13 -1
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request.d.ts +7 -1
- package/dest/kernel/hints/read_request.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.d.ts +7 -1
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/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 +74 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +31 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.d.ts +7 -1
- package/dest/kernel/private_kernel_data.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +22 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +4 -1
- package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +23 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_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_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 +16 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.d.ts +10 -1
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +3 -1
- package/dest/kernel/public_call_request.d.ts +22 -1
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/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/public_keys.d.ts +5 -1
- package/dest/keys/public_keys.d.ts.map +1 -1
- 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 +5 -3
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +5 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/private_log.js +3 -1
- package/dest/logs/public_log.js +3 -1
- 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/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 +93 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +140 -39
- package/dest/p2p/checkpoint_attestation.d.ts +81 -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 +160 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +229 -0
- package/dest/p2p/consensus_payload.d.ts +9 -9
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -5
- package/dest/p2p/constants.d.ts +3 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +2 -0
- package/dest/p2p/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 +42 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +49 -19
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +41 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +10 -2
- 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 +18 -3
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +9 -3
- package/dest/rollup/tree_snapshot_diff_hints.d.ts +24 -1
- package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts +4 -1
- package/dest/rollup/tx_merge_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts +29 -1
- package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
- package/dest/schemas/schemas.d.ts +1 -1
- package/dest/tests/factories.d.ts +16 -10
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +60 -25
- package/dest/tests/jest.js +1 -1
- package/dest/tests/mocks.d.ts +69 -18
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +119 -54
- 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 +16 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_witness.d.ts +11 -1
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/tx/block_header.d.ts +14 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +8 -2
- 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 +9 -1
- 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 +1 -1
- 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/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 +149 -26
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +44 -7
- package/dest/tx/protocol_contracts.d.ts +1 -1
- package/dest/tx/public_call_request_with_calldata.d.ts +7 -1
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- 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 +44 -10
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +44 -13
- package/dest/tx/tx_request.d.ts +6 -1
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- package/dest/types/shared.d.ts +4 -1
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/validators/schemas.d.ts +8 -8
- package/dest/vks/verification_key.d.ts +22 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/vk_data.d.ts +7 -1
- package/dest/vks/vk_data.d.ts.map +1 -1
- package/dest/zkpassport/index.d.ts +3 -4
- package/dest/zkpassport/index.d.ts.map +1 -1
- package/dest/zkpassport/index.js +9 -9
- package/package.json +12 -10
- package/src/abi/contract_artifact.ts +10 -10
- package/src/abi/utils.ts +17 -0
- package/src/block/attestation_info.ts +9 -6
- package/src/block/block_hash.ts +27 -1
- 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/index.ts +0 -2
- package/src/block/l2_block.ts +101 -148
- package/src/block/l2_block_source.ts +121 -43
- 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 +34 -11
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/published_checkpoint.ts +4 -3
- package/src/config/node-rpc-config.ts +1 -1
- package/src/contract/index.ts +0 -2
- package/src/contract/private_function.ts +1 -2
- package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
- package/src/deserialization/index.ts +21 -0
- package/src/epoch-helpers/index.ts +1 -1
- package/src/interfaces/api_limit.ts +2 -0
- package/src/interfaces/archiver.ts +24 -23
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +100 -68
- package/src/interfaces/block-builder.ts +31 -24
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/prover-client.ts +15 -0
- package/src/interfaces/proving-job.ts +2 -11
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +63 -14
- 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/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/note_dao.ts +18 -13
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +204 -44
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +348 -0
- package/src/p2p/consensus_payload.ts +5 -7
- package/src/p2p/constants.ts +3 -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 +63 -20
- package/src/rollup/checkpoint_rollup_public_inputs.ts +12 -0
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
- package/src/rollup/root_rollup_public_inputs.ts +9 -0
- package/src/tests/factories.ts +56 -40
- package/src/tests/jest.ts +1 -1
- package/src/tests/mocks.ts +207 -87
- package/src/tx/block_header.ts +11 -3
- package/src/tx/global_variable_builder.ts +1 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +1 -16
- package/src/tx/profiling.ts +46 -4
- 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 +72 -15
- package/src/tx/validator/error_texts.ts +3 -0
- package/src/zkpassport/index.ts +11 -12
- package/dest/block/l2_block_code_to_purge.d.ts +0 -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/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/tx/content_commitment.ts +0 -113
|
@@ -1,36 +1,77 @@
|
|
|
1
|
+
import { OUT_HASH_TREE_LEAF_COUNT } from '@aztec/constants';
|
|
2
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
1
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import {
|
|
4
|
+
import { computeBalancedShaRoot, computeUnbalancedShaRoot, computeWonkyShaRoot } from '@aztec/foundation/trees';
|
|
3
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Computes the out hash of a tx. It's the root of the unbalanced tree of all the L2-to-L1 messages emitted by the tx.
|
|
8
|
+
* @param messages - The L2-to-L1 messages emitted by the tx.
|
|
9
|
+
* @returns The out hash of the tx.
|
|
10
|
+
*/
|
|
4
11
|
export function computeTxOutHash(messages: Fr[]): Fr {
|
|
12
|
+
// Must match the implementation in `tx_base_public_inputs_composer.nr > compute_kernel_out_hash()`
|
|
5
13
|
if (!messages.length) {
|
|
6
14
|
return Fr.ZERO;
|
|
7
15
|
}
|
|
8
|
-
//
|
|
9
|
-
// Zero hashes (which should not happen) are not compressed.
|
|
16
|
+
// It's an unbalanced tree because zero hashes (which should not happen) will be included.
|
|
10
17
|
return Fr.fromBuffer(computeUnbalancedShaRoot(messages.map(msg => msg.toBuffer())));
|
|
11
18
|
}
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Computes the out hash of a block. It's the root of the wonky tree of all the tx out hashes.
|
|
22
|
+
* @param messagesPerTx - The L2-to-L1 messages emitted by the txs in the block. This is an array of message arrays.
|
|
23
|
+
* The array at index 0 contains the messages emitted by the first tx, the array at index 1 contains the messages
|
|
24
|
+
* emitted by the second tx, and so on.
|
|
25
|
+
* @returns The out hash of the block.
|
|
26
|
+
*/
|
|
27
|
+
export function computeBlockOutHash(messagesPerTx: Fr[][]): Fr {
|
|
28
|
+
// See how the tx out hashes are aggregated into a block out hash in `merge_tx_rollups.nr > accumulate_out_hash()`.
|
|
29
|
+
const txOutHashes = messagesPerTx.map(messages => computeTxOutHash(messages));
|
|
30
|
+
return Fr.fromBuffer(computeWonkyShaRoot(txOutHashes.map(hash => hash.toBuffer())));
|
|
16
31
|
}
|
|
17
32
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Computes the out hash of a checkpoint. It's the root of the wonky tree of all the block out hashes.
|
|
35
|
+
* @param messagesPerBlock - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoint. This is an array
|
|
36
|
+
* of arrays of messages. The array at index 0 contains the arrays of messages emitted by the first block, the array at
|
|
37
|
+
* index 1 contains the arrays of messages emitted by the second block, and so on.
|
|
38
|
+
* @returns The out hash of the checkpoint.
|
|
39
|
+
*/
|
|
40
|
+
export function computeCheckpointOutHash(messagesPerBlock: Fr[][][]): Fr {
|
|
41
|
+
// See how the block out hashes are aggregated into a checkpoint out hash in `merge_block_rollups.nr > accumulate_out_hash()`.
|
|
42
|
+
const blockOutHashes = messagesPerBlock.map(block => computeBlockOutHash(block));
|
|
43
|
+
return Fr.fromBuffer(computeWonkyShaRoot(blockOutHashes.map(hash => hash.toBuffer())));
|
|
21
44
|
}
|
|
22
45
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Computes the accumulated (epoch) out hash of a checkpoint. It's the root of the balanced tree of all the out hashes
|
|
48
|
+
* from the first checkpoint in an epoch to the current checkpoint.
|
|
49
|
+
* It's this value that's set to the checkpoint header and validated on L1 instead of the checkpoint out hash.
|
|
50
|
+
* @param checkpointOutHashes - The out hashes of all checkpoints in the epoch.
|
|
51
|
+
* @returns The accumulated (epoch) out hash.
|
|
52
|
+
*/
|
|
53
|
+
export function accumulateCheckpointOutHashes(checkpointOutHashes: Fr[]): Fr {
|
|
54
|
+
// See how the checkpoint out hashes are accumulated in `checkpoint_rollup_public_inputs_composer.nr > accumulate_checkpoint_out_hash()`.
|
|
55
|
+
const paddedOutHashes = padArrayEnd(
|
|
56
|
+
checkpointOutHashes.map(hash => hash.toBuffer()),
|
|
57
|
+
Buffer.alloc(32),
|
|
58
|
+
OUT_HASH_TREE_LEAF_COUNT,
|
|
34
59
|
);
|
|
35
|
-
return Fr.fromBuffer(
|
|
60
|
+
return Fr.fromBuffer(computeBalancedShaRoot(paddedOutHashes));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Computes the epoch out hash. It's the root of the balanced tree of all the checkpoint out hashes.
|
|
65
|
+
* It should match the **accumulated** out hash of the last checkpoint in the epoch.
|
|
66
|
+
* This value will be inserted into the Outbox on L1.
|
|
67
|
+
* @param messagesPerCheckpoint - The L2-to-L1 messages emitted by the txs in the blocks in the checkpoints in the epoch.
|
|
68
|
+
* This is an array of arrays of arrays of messages. The array at index 0 contains the arrays of arrays of messages
|
|
69
|
+
* emitted by the first checkpoint, the array at index 1 contains the arrays of arrays of messages emitted by the second
|
|
70
|
+
* checkpoint, and so on.
|
|
71
|
+
* @returns The epoch out hash.
|
|
72
|
+
*/
|
|
73
|
+
export function computeEpochOutHash(messagesPerCheckpoint: Fr[][][][]): Fr {
|
|
74
|
+
// See how the accumulated out hash is assigned to the root rollup's public inputs in `root_rollup.nr`.
|
|
75
|
+
const checkpointOutHashes = messagesPerCheckpoint.map(checkpoint => computeCheckpointOutHash(checkpoint));
|
|
76
|
+
return accumulateCheckpointOutHashes(checkpointOutHashes);
|
|
36
77
|
}
|
package/src/note/note_dao.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
3
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
@@ -56,8 +55,10 @@ export class NoteDao {
|
|
|
56
55
|
/** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
57
56
|
* reorgs.*/
|
|
58
57
|
public l2BlockHash: string,
|
|
59
|
-
/** The index of the
|
|
60
|
-
public
|
|
58
|
+
/** The index of the tx within the block, used for ordering notes. */
|
|
59
|
+
public txIndexInBlock: number,
|
|
60
|
+
/** The index of the note within the tx (based on note hash position), used for ordering notes. */
|
|
61
|
+
public noteIndexInTx: number,
|
|
61
62
|
) {}
|
|
62
63
|
|
|
63
64
|
toBuffer(): Buffer {
|
|
@@ -73,7 +74,8 @@ export class NoteDao {
|
|
|
73
74
|
this.txHash,
|
|
74
75
|
this.l2BlockNumber,
|
|
75
76
|
Fr.fromHexString(this.l2BlockHash),
|
|
76
|
-
this.
|
|
77
|
+
this.txIndexInBlock,
|
|
78
|
+
this.noteIndexInTx,
|
|
77
79
|
]);
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -91,7 +93,8 @@ export class NoteDao {
|
|
|
91
93
|
const txHash = reader.readObject(TxHash);
|
|
92
94
|
const l2BlockNumber = BlockNumber(reader.readNumber());
|
|
93
95
|
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
94
|
-
const
|
|
96
|
+
const txIndexInBlock = reader.readNumber();
|
|
97
|
+
const noteIndexInTx = reader.readNumber();
|
|
95
98
|
|
|
96
99
|
return new NoteDao(
|
|
97
100
|
note,
|
|
@@ -105,7 +108,8 @@ export class NoteDao {
|
|
|
105
108
|
txHash,
|
|
106
109
|
l2BlockNumber,
|
|
107
110
|
l2BlockHash,
|
|
108
|
-
|
|
111
|
+
txIndexInBlock,
|
|
112
|
+
noteIndexInTx,
|
|
109
113
|
);
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -134,7 +138,8 @@ export class NoteDao {
|
|
|
134
138
|
this.txHash.equals(other.txHash) &&
|
|
135
139
|
this.l2BlockNumber === other.l2BlockNumber &&
|
|
136
140
|
this.l2BlockHash === other.l2BlockHash &&
|
|
137
|
-
this.
|
|
141
|
+
this.txIndexInBlock === other.txIndexInBlock &&
|
|
142
|
+
this.noteIndexInTx === other.noteIndexInTx
|
|
138
143
|
);
|
|
139
144
|
}
|
|
140
145
|
|
|
@@ -143,11 +148,9 @@ export class NoteDao {
|
|
|
143
148
|
* @returns - Its size in bytes.
|
|
144
149
|
*/
|
|
145
150
|
public getSize() {
|
|
146
|
-
const indexSize = Math.ceil(Math.log2(Number(this.index)));
|
|
147
151
|
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
);
|
|
152
|
+
// 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
|
|
153
|
+
return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
static async random({
|
|
@@ -162,7 +165,8 @@ export class NoteDao {
|
|
|
162
165
|
txHash = TxHash.random(),
|
|
163
166
|
l2BlockNumber = BlockNumber(Math.floor(Math.random() * 1000)),
|
|
164
167
|
l2BlockHash = Fr.random().toString(),
|
|
165
|
-
|
|
168
|
+
txIndexInBlock = Math.floor(Math.random() * 100),
|
|
169
|
+
noteIndexInTx = Math.floor(Math.random() * 100),
|
|
166
170
|
}: Partial<NoteDao> = {}) {
|
|
167
171
|
return new NoteDao(
|
|
168
172
|
note,
|
|
@@ -176,7 +180,8 @@ export class NoteDao {
|
|
|
176
180
|
txHash,
|
|
177
181
|
l2BlockNumber,
|
|
178
182
|
l2BlockHash,
|
|
179
|
-
|
|
183
|
+
txIndexInBlock,
|
|
184
|
+
noteIndexInTx,
|
|
180
185
|
);
|
|
181
186
|
}
|
|
182
187
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
|
|
3
3
|
import { CommitteeAttestation } from '../block/index.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { CheckpointAttestation } from './checkpoint_attestation.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns attestation signatures in the order of a series of provided ethereum addresses
|
|
@@ -9,10 +9,10 @@ import type { BlockAttestation } from './block_attestation.js';
|
|
|
9
9
|
* @todo: perform this logic within the memory attestation store instead?
|
|
10
10
|
*/
|
|
11
11
|
export function orderAttestations(
|
|
12
|
-
attestations:
|
|
12
|
+
attestations: CheckpointAttestation[],
|
|
13
13
|
orderAddresses: EthAddress[],
|
|
14
14
|
): CommitteeAttestation[] {
|
|
15
|
-
// Create a map of sender addresses to
|
|
15
|
+
// Create a map of sender addresses to attestations
|
|
16
16
|
const attestationMap = new Map<string, CommitteeAttestation>();
|
|
17
17
|
|
|
18
18
|
for (const attestation of attestations) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { BlockNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
3
|
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
4
4
|
import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
@@ -6,17 +6,21 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
6
6
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
8
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
9
|
+
import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
|
|
9
10
|
|
|
11
|
+
import type { L2Block } from '../block/l2_block.js';
|
|
10
12
|
import type { L2BlockInfo } from '../block/l2_block_info.js';
|
|
13
|
+
import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
|
|
14
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
11
15
|
import { TxHash } from '../tx/index.js';
|
|
12
|
-
import { Tx } from '../tx/tx.js';
|
|
13
|
-
import { ConsensusPayload } from './consensus_payload.js';
|
|
16
|
+
import type { Tx } from '../tx/tx.js';
|
|
14
17
|
import { Gossipable } from './gossipable.js';
|
|
15
18
|
import {
|
|
16
19
|
SignatureDomainSeparator,
|
|
17
20
|
getHashedSignaturePayload,
|
|
18
21
|
getHashedSignaturePayloadEthSignedMessage,
|
|
19
22
|
} from './signature_utils.js';
|
|
23
|
+
import { SignedTxs } from './signed_txs.js';
|
|
20
24
|
import { TopicType } from './topic_type.js';
|
|
21
25
|
|
|
22
26
|
export class BlockProposalHash extends Buffer32 {
|
|
@@ -32,10 +36,9 @@ export type BlockProposalOptions = {
|
|
|
32
36
|
};
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* be included in the head of the chain
|
|
39
|
+
* A block proposal is created by the leader of the chain proposing a sequence of transactions
|
|
40
|
+
* to be included in a block within a checkpoint. This is used for non-last blocks in a slot.
|
|
41
|
+
* The last block is sent as part of a CheckpointProposal.
|
|
39
42
|
*/
|
|
40
43
|
export class BlockProposal extends Gossipable {
|
|
41
44
|
static override p2pTopic = TopicType.block_proposal;
|
|
@@ -43,18 +46,28 @@ export class BlockProposal extends Gossipable {
|
|
|
43
46
|
private sender: EthAddress | undefined;
|
|
44
47
|
|
|
45
48
|
constructor(
|
|
46
|
-
/** The
|
|
47
|
-
public readonly
|
|
49
|
+
/** The per-block header containing block state and global variables */
|
|
50
|
+
public readonly blockHeader: BlockHeader,
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
// TODO(palla/mbps): Is this really needed? Can we just derive it from the indexWithinCheckpoint of the parent block and the slot number?
|
|
53
|
+
// See the block-proposal-handler, we have a lot of extra validations to check this is correct, so maybe we can avoid storing it here.
|
|
54
|
+
/** Index of this block within the checkpoint (0-indexed) */
|
|
55
|
+
public readonly indexWithinCheckpoint: IndexWithinCheckpoint,
|
|
56
|
+
|
|
57
|
+
/** Hash of L1 to L2 messages for this checkpoint (constant across all blocks in checkpoint) */
|
|
58
|
+
public readonly inHash: Fr,
|
|
59
|
+
|
|
60
|
+
/** Archive root after this block is applied */
|
|
61
|
+
public readonly archiveRoot: Fr,
|
|
51
62
|
|
|
52
63
|
/** The sequence of transactions in the block */
|
|
53
64
|
public readonly txHashes: TxHash[],
|
|
54
65
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
/** The proposer's signature over the block data */
|
|
67
|
+
public readonly signature: Signature,
|
|
68
|
+
|
|
69
|
+
/** The signed transactions in the block (optional, for DA guarantees) */
|
|
70
|
+
public readonly signedTxs?: SignedTxs,
|
|
58
71
|
) {
|
|
59
72
|
super();
|
|
60
73
|
}
|
|
@@ -64,59 +77,133 @@ export class BlockProposal extends Gossipable {
|
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
get archive(): Fr {
|
|
67
|
-
return this.
|
|
80
|
+
return this.archiveRoot;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
get slotNumber(): SlotNumber {
|
|
71
|
-
return this.
|
|
84
|
+
return this.blockHeader.getSlot();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get blockNumber(): BlockNumber {
|
|
88
|
+
return this.blockHeader.getBlockNumber();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Convenience getter for txs from signedTxs */
|
|
92
|
+
get txs(): Tx[] | undefined {
|
|
93
|
+
return this.signedTxs?.txs;
|
|
72
94
|
}
|
|
73
95
|
|
|
74
96
|
toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'> {
|
|
75
97
|
return {
|
|
76
98
|
slotNumber: this.slotNumber,
|
|
77
|
-
lastArchive: this.
|
|
78
|
-
timestamp: this.
|
|
79
|
-
archive: this.
|
|
99
|
+
lastArchive: this.blockHeader.lastArchive.root,
|
|
100
|
+
timestamp: this.blockHeader.globalVariables.timestamp,
|
|
101
|
+
archive: this.archiveRoot,
|
|
80
102
|
txCount: this.txHashes.length,
|
|
81
103
|
};
|
|
82
104
|
}
|
|
83
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Get the payload to sign for this block proposal.
|
|
108
|
+
* The signature is over: blockHeader + indexWithinCheckpoint + inHash + archiveRoot + txHashes
|
|
109
|
+
*/
|
|
110
|
+
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
|
|
111
|
+
return serializeToBuffer([
|
|
112
|
+
domainSeparator,
|
|
113
|
+
this.blockHeader,
|
|
114
|
+
this.indexWithinCheckpoint,
|
|
115
|
+
this.inHash,
|
|
116
|
+
this.archiveRoot,
|
|
117
|
+
this.txHashes.length,
|
|
118
|
+
this.txHashes,
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
|
|
84
122
|
static async createProposalFromSigner(
|
|
85
|
-
|
|
123
|
+
blockHeader: BlockHeader,
|
|
124
|
+
indexWithinCheckpoint: IndexWithinCheckpoint,
|
|
125
|
+
inHash: Fr,
|
|
126
|
+
archiveRoot: Fr,
|
|
86
127
|
txHashes: TxHash[],
|
|
87
|
-
// Note(md): Provided separately to tx hashes such that this function can be optional
|
|
88
128
|
txs: Tx[] | undefined,
|
|
89
|
-
payloadSigner: (payload: Buffer32) => Promise<Signature>,
|
|
90
|
-
) {
|
|
91
|
-
|
|
92
|
-
const
|
|
129
|
+
payloadSigner: (payload: Buffer32, context: SigningContext) => Promise<Signature>,
|
|
130
|
+
): Promise<BlockProposal> {
|
|
131
|
+
// Create a temporary proposal to get the payload to sign
|
|
132
|
+
const tempProposal = new BlockProposal(
|
|
133
|
+
blockHeader,
|
|
134
|
+
indexWithinCheckpoint,
|
|
135
|
+
inHash,
|
|
136
|
+
archiveRoot,
|
|
137
|
+
txHashes,
|
|
138
|
+
Signature.empty(),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
// Create the block signing context
|
|
142
|
+
const blockContext: SigningContext = {
|
|
143
|
+
slot: blockHeader.globalVariables.slotNumber,
|
|
144
|
+
blockNumber: blockHeader.globalVariables.blockNumber,
|
|
145
|
+
blockIndexWithinCheckpoint: indexWithinCheckpoint,
|
|
146
|
+
dutyType: DutyType.BLOCK_PROPOSAL,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const hashed = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.blockProposal);
|
|
150
|
+
const sig = await payloadSigner(hashed, blockContext);
|
|
151
|
+
|
|
152
|
+
// If txs are provided, sign them as well
|
|
153
|
+
let signedTxs: SignedTxs | undefined;
|
|
154
|
+
if (txs) {
|
|
155
|
+
const txsSigningContext: SigningContext = { dutyType: DutyType.TXS };
|
|
156
|
+
const txsSigner = (payload: Buffer32) => payloadSigner(payload, txsSigningContext);
|
|
157
|
+
signedTxs = await SignedTxs.createFromSigner(txs, txsSigner);
|
|
158
|
+
}
|
|
93
159
|
|
|
94
|
-
return new BlockProposal(
|
|
160
|
+
return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, sig, signedTxs);
|
|
95
161
|
}
|
|
96
162
|
|
|
97
|
-
/**
|
|
98
|
-
* Lazily evaluate the sender of the proposal; result is cached
|
|
99
|
-
*
|
|
163
|
+
/**
|
|
164
|
+
* Lazily evaluate the sender of the proposal; result is cached.
|
|
165
|
+
* If there's signedTxs, also verifies the signedTxs sender matches the block proposal sender.
|
|
166
|
+
* @returns The sender address, or undefined if signature recovery fails or senders don't match
|
|
100
167
|
*/
|
|
101
168
|
getSender(): EthAddress | undefined {
|
|
102
169
|
if (!this.sender) {
|
|
103
|
-
const hashed = getHashedSignaturePayloadEthSignedMessage(this
|
|
170
|
+
const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.blockProposal);
|
|
171
|
+
const blockSender = tryRecoverAddress(hashed, this.signature);
|
|
172
|
+
|
|
173
|
+
// If there's signedTxs, verify the sender matches
|
|
174
|
+
if (blockSender && this.signedTxs) {
|
|
175
|
+
const txsSender = this.signedTxs.getSender();
|
|
176
|
+
if (!txsSender || !txsSender.equals(blockSender)) {
|
|
177
|
+
return undefined; // Sender mismatch - fail
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
104
181
|
// Cache the sender for later use
|
|
105
|
-
this.sender =
|
|
182
|
+
this.sender = blockSender;
|
|
106
183
|
}
|
|
107
184
|
|
|
108
185
|
return this.sender;
|
|
109
186
|
}
|
|
110
187
|
|
|
111
188
|
getPayload() {
|
|
112
|
-
return this.
|
|
189
|
+
return this.getPayloadToSign(SignatureDomainSeparator.blockProposal);
|
|
113
190
|
}
|
|
114
191
|
|
|
115
192
|
toBuffer(): Buffer {
|
|
116
|
-
const buffer: any[] = [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
193
|
+
const buffer: any[] = [
|
|
194
|
+
this.blockHeader,
|
|
195
|
+
this.indexWithinCheckpoint,
|
|
196
|
+
this.inHash,
|
|
197
|
+
this.archiveRoot,
|
|
198
|
+
this.signature,
|
|
199
|
+
this.txHashes.length,
|
|
200
|
+
this.txHashes,
|
|
201
|
+
];
|
|
202
|
+
if (this.signedTxs) {
|
|
203
|
+
buffer.push(1); // hasSignedTxs = true
|
|
204
|
+
buffer.push(this.signedTxs.toBuffer());
|
|
205
|
+
} else {
|
|
206
|
+
buffer.push(0); // hasSignedTxs = false
|
|
120
207
|
}
|
|
121
208
|
return serializeToBuffer(buffer);
|
|
122
209
|
}
|
|
@@ -124,25 +211,98 @@ export class BlockProposal extends Gossipable {
|
|
|
124
211
|
static fromBuffer(buf: Buffer | BufferReader): BlockProposal {
|
|
125
212
|
const reader = BufferReader.asReader(buf);
|
|
126
213
|
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
214
|
+
const blockHeader = reader.readObject(BlockHeader);
|
|
215
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
|
|
216
|
+
const inHash = reader.readObject(Fr);
|
|
217
|
+
const archiveRoot = reader.readObject(Fr);
|
|
218
|
+
const signature = reader.readObject(Signature);
|
|
219
|
+
const txHashCount = reader.readNumber();
|
|
220
|
+
if (txHashCount > MAX_TXS_PER_BLOCK) {
|
|
221
|
+
throw new Error(`txHashes count ${txHashCount} exceeds maximum ${MAX_TXS_PER_BLOCK}`);
|
|
222
|
+
}
|
|
223
|
+
const txHashes = reader.readArray(txHashCount, TxHash);
|
|
130
224
|
|
|
131
225
|
if (!reader.isEmpty()) {
|
|
132
|
-
const
|
|
133
|
-
|
|
226
|
+
const hasSignedTxs = reader.readNumber();
|
|
227
|
+
if (hasSignedTxs) {
|
|
228
|
+
const signedTxs = SignedTxs.fromBuffer(reader);
|
|
229
|
+
return new BlockProposal(
|
|
230
|
+
blockHeader,
|
|
231
|
+
indexWithinCheckpoint,
|
|
232
|
+
inHash,
|
|
233
|
+
archiveRoot,
|
|
234
|
+
txHashes,
|
|
235
|
+
signature,
|
|
236
|
+
signedTxs,
|
|
237
|
+
);
|
|
238
|
+
}
|
|
134
239
|
}
|
|
135
240
|
|
|
136
|
-
return new BlockProposal(
|
|
241
|
+
return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, signature);
|
|
137
242
|
}
|
|
138
243
|
|
|
139
244
|
getSize(): number {
|
|
140
245
|
return (
|
|
141
|
-
this.
|
|
246
|
+
this.blockHeader.getSize() +
|
|
247
|
+
4 /* indexWithinCheckpoint */ +
|
|
248
|
+
this.inHash.size +
|
|
249
|
+
this.archiveRoot.size +
|
|
142
250
|
this.signature.getSize() +
|
|
143
251
|
4 /* txHashes.length */ +
|
|
144
252
|
this.txHashes.length * TxHash.SIZE +
|
|
145
|
-
|
|
253
|
+
4 /* hasSignedTxs flag */ +
|
|
254
|
+
(this.signedTxs ? this.signedTxs.getSize() : 0)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static empty(): BlockProposal {
|
|
259
|
+
return new BlockProposal(BlockHeader.empty(), IndexWithinCheckpoint(0), Fr.ZERO, Fr.ZERO, [], Signature.empty());
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
static random(): BlockProposal {
|
|
263
|
+
return new BlockProposal(
|
|
264
|
+
BlockHeader.random(),
|
|
265
|
+
IndexWithinCheckpoint(Math.floor(Math.random() * 5)),
|
|
266
|
+
Fr.random(),
|
|
267
|
+
Fr.random(),
|
|
268
|
+
[TxHash.random(), TxHash.random()],
|
|
269
|
+
Signature.random(),
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
toInspect() {
|
|
274
|
+
return {
|
|
275
|
+
blockHeader: this.blockHeader.toInspect(),
|
|
276
|
+
indexWithinCheckpoint: this.indexWithinCheckpoint,
|
|
277
|
+
inHash: this.inHash.toString(),
|
|
278
|
+
archiveRoot: this.archiveRoot.toString(),
|
|
279
|
+
signature: this.signature.toString(),
|
|
280
|
+
txHashes: this.txHashes.map(h => h.toString()),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Check if this proposal matches the given block.
|
|
286
|
+
* Compares the archive root and block header.
|
|
287
|
+
* @param block - The L2Block to compare against
|
|
288
|
+
* @returns True if the proposal matches the block
|
|
289
|
+
*/
|
|
290
|
+
matchesBlock(block: L2Block): boolean {
|
|
291
|
+
return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.header);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Returns a copy of this proposal without signedTxs.
|
|
296
|
+
* Used when storing proposals in attestation pool to avoid storing full tx data.
|
|
297
|
+
*/
|
|
298
|
+
withoutSignedTxs(): BlockProposal {
|
|
299
|
+
return new BlockProposal(
|
|
300
|
+
this.blockHeader,
|
|
301
|
+
this.indexWithinCheckpoint,
|
|
302
|
+
this.inHash,
|
|
303
|
+
this.archiveRoot,
|
|
304
|
+
this.txHashes,
|
|
305
|
+
this.signature,
|
|
146
306
|
);
|
|
147
307
|
}
|
|
148
308
|
}
|