@aztec/stdlib 0.0.1-commit.0c875d939 → 0.0.1-commit.0ec55a70b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/authorization_selector.d.ts +3 -6
- package/dest/abi/authorization_selector.d.ts.map +1 -1
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +6 -45
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +17 -70
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +64 -7
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/event_selector.d.ts +3 -6
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.d.ts +3 -6
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +2 -4
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/abi/note_selector.d.ts +3 -6
- package/dest/abi/note_selector.d.ts.map +1 -1
- package/dest/abi/note_selector.js +1 -3
- package/dest/abi/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/auth_witness/auth_witness.js +3 -3
- package/dest/avm/avm_proving_request.d.ts +166 -166
- package/dest/avm/revert_code.d.ts +9 -4
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +16 -21
- package/dest/aztec-address/index.d.ts +3 -6
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +2 -4
- package/dest/block/attestation_info.d.ts +3 -2
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -5
- package/dest/block/block_data.d.ts +341 -0
- package/dest/block/block_data.d.ts.map +1 -0
- package/dest/block/block_data.js +26 -0
- package/dest/block/block_hash.d.ts +11 -10
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +10 -9
- package/dest/block/block_parameter.d.ts +30 -3
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +36 -2
- package/dest/block/index.d.ts +2 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -0
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_info.d.ts +6 -5
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +6 -5
- package/dest/block/l2_block_source.d.ts +149 -10
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
- package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +26 -18
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +4 -3
- package/dest/checkpoint/checkpoint.d.ts +13 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +23 -9
- package/dest/checkpoint/checkpoint_data.d.ts +192 -0
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -0
- package/dest/checkpoint/checkpoint_data.js +38 -0
- 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 +11 -2
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +1 -2
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/chain-config.d.ts +2 -2
- package/dest/config/chain-config.d.ts.map +1 -1
- package/dest/config/chain-config.js +9 -3
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/config/sequencer-config.d.ts +7 -3
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +27 -1
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +7 -7
- 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.js +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_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +4 -6
- package/dest/epoch-helpers/index.d.ts +11 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +16 -2
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/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/fee_math.d.ts +49 -0
- package/dest/gas/fee_math.d.ts.map +1 -0
- package/dest/gas/fee_math.js +80 -0
- package/dest/gas/gas_fees.d.ts +5 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +13 -1
- package/dest/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/ha-signing/config.d.ts +136 -0
- package/dest/ha-signing/config.d.ts.map +1 -0
- package/dest/ha-signing/config.js +98 -0
- package/dest/ha-signing/index.d.ts +4 -0
- package/dest/ha-signing/index.d.ts.map +1 -0
- package/dest/ha-signing/index.js +3 -0
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/ha-signing/types.d.ts +90 -0
- package/dest/ha-signing/types.d.ts.map +1 -0
- package/dest/ha-signing/types.js +39 -0
- package/dest/hash/hash.d.ts +34 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +72 -11
- package/dest/hash/map_slot.js +2 -2
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +11 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +17 -3
- package/dest/interfaces/aztec-node-admin.d.ts +126 -47
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +14 -7
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- package/dest/interfaces/aztec-node.d.ts +59 -54
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +23 -16
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +13 -6
- package/dest/interfaces/block_response.d.ts +156 -0
- package/dest/interfaces/block_response.d.ts.map +1 -0
- package/dest/interfaces/block_response.js +24 -0
- package/dest/interfaces/chain_tips.d.ts +304 -0
- package/dest/interfaces/chain_tips.d.ts.map +1 -0
- package/dest/interfaces/chain_tips.js +11 -0
- package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
- package/dest/interfaces/checkpoint_parameter.js +20 -0
- package/dest/interfaces/checkpoint_response.d.ts +312 -0
- package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
- package/dest/interfaces/checkpoint_response.js +26 -0
- package/dest/interfaces/client.d.ts +7 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +6 -0
- package/dest/interfaces/configs.d.ts +87 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +12 -3
- package/dest/interfaces/l1_publish_info.d.ts +43 -0
- package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
- package/dest/interfaces/l1_publish_info.js +26 -0
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +13 -22
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +3 -8
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -4
- package/dest/interfaces/proving-job.d.ts +34 -34
- package/dest/interfaces/server.d.ts +6 -1
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +5 -0
- package/dest/interfaces/slasher.d.ts +1 -10
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +0 -2
- package/dest/interfaces/validator.d.ts +127 -64
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +10 -5
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +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 +13 -10
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/kernel/hints/index.d.ts +2 -2
- package/dest/kernel/hints/index.js +2 -2
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts +24 -0
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts.map +1 -0
- package/dest/kernel/hints/{key_validation_request_and_generator.js → key_validation_request_and_separator.js} +12 -15
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts → scoped_key_validation_request_and_separator.d.ts} +8 -8
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts.map → scoped_key_validation_request_and_separator.d.ts.map} +1 -1
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.js → scoped_key_validation_request_and_separator.js} +6 -6
- package/dest/kernel/private_circuit_public_inputs.d.ts +9 -9
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +16 -16
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +3 -3
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +4 -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 +11 -7
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +3 -3
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_validation_requests.d.ts +3 -3
- package/dest/kernel/private_validation_requests.js +9 -9
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +3 -3
- package/dest/keys/key_types.d.ts.map +1 -1
- package/dest/keys/public_keys.js +2 -2
- package/dest/keys/utils.js +5 -5
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -0
- package/dest/l1-contracts/index.d.ts +2 -2
- package/dest/l1-contracts/index.d.ts.map +1 -1
- package/dest/l1-contracts/index.js +1 -1
- package/dest/logs/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +35 -20
- package/dest/logs/index.d.ts +4 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +3 -1
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/log_id.d.ts +1 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +1 -2
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/pre_tag.d.ts +16 -11
- package/dest/logs/pre_tag.d.ts.map +1 -1
- package/dest/logs/pre_tag.js +2 -2
- package/dest/logs/private_log.d.ts +2 -2
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +2 -1
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +12 -9
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +15 -2
- package/dest/logs/tag.d.ts +5 -6
- package/dest/logs/tag.d.ts.map +1 -1
- package/dest/logs/tag.js +5 -1
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/block_proposal.d.ts +23 -15
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +46 -43
- package/dest/p2p/checkpoint_attestation.d.ts +10 -8
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +17 -24
- package/dest/p2p/checkpoint_proposal.d.ts +21 -20
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +35 -62
- package/dest/p2p/client_type.d.ts +2 -5
- package/dest/p2p/client_type.d.ts.map +1 -1
- package/dest/p2p/client_type.js +0 -7
- package/dest/p2p/consensus_payload.d.ts +18 -7
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +31 -19
- package/dest/p2p/gossipable.d.ts +4 -4
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/p2p/signature_utils.d.ts +28 -19
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +118 -21
- package/dest/p2p/signed_txs.d.ts +15 -13
- package/dest/p2p/signed_txs.d.ts.map +1 -1
- package/dest/p2p/signed_txs.js +26 -24
- package/dest/p2p/topic_type.d.ts +3 -4
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +7 -24
- package/dest/parity/parity_base_private_inputs.d.ts +7 -3
- package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
- package/dest/parity/parity_base_private_inputs.js +7 -5
- package/dest/parity/parity_public_inputs.d.ts +7 -3
- package/dest/parity/parity_public_inputs.d.ts.map +1 -1
- package/dest/parity/parity_public_inputs.js +6 -3
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/rollup/block_headers_hash.d.ts +1 -1
- package/dest/rollup/block_headers_hash.d.ts.map +1 -1
- package/dest/rollup/block_headers_hash.js +8 -2
- package/dest/rollup/checkpoint_header.d.ts +2 -2
- package/dest/rollup/checkpoint_header.js +2 -2
- package/dest/slashing/index.d.ts +2 -3
- package/dest/slashing/index.d.ts.map +1 -1
- package/dest/slashing/index.js +1 -2
- package/dest/slashing/serialization.d.ts +2 -6
- package/dest/slashing/serialization.d.ts.map +1 -1
- package/dest/slashing/serialization.js +0 -60
- package/dest/slashing/types.d.ts +4 -90
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +0 -14
- package/dest/slashing/{tally.d.ts → votes.d.ts} +7 -2
- package/dest/slashing/votes.d.ts.map +1 -0
- package/dest/slashing/{tally.js → votes.js} +30 -2
- package/dest/tests/factories.d.ts +5 -10
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +35 -54
- package/dest/tests/mocks.d.ts +11 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +59 -45
- package/dest/timetable/index.d.ts +51 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +218 -14
- package/dest/trees/nullifier_leaf.d.ts +2 -1
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_leaf.js +3 -0
- package/dest/tx/block_header.d.ts +4 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +7 -3
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/fee_provider.d.ts +10 -0
- package/dest/tx/fee_provider.d.ts.map +1 -0
- package/dest/tx/fee_provider.js +1 -0
- package/dest/tx/global_variable_builder.d.ts +3 -4
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +4 -4
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/index.d.ts +2 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/indexed_tx_effect.d.ts +1 -1
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +1 -2
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +17 -5
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +19 -9
- package/dest/tx/protocol_contracts.d.ts +1 -1
- package/dest/tx/protocol_contracts.d.ts.map +1 -1
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/public_simulation_output.d.ts +4 -2
- package/dest/tx/public_simulation_output.d.ts.map +1 -1
- package/dest/tx/public_simulation_output.js +7 -3
- package/dest/tx/simulated_tx.d.ts +116 -5
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +7 -4
- package/dest/tx/tx.d.ts +8 -7
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +29 -6
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +23 -19
- package/dest/tx/tx_request.js +2 -2
- package/dest/tx/validator/error_texts.d.ts +10 -2
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +11 -1
- package/dest/types/shared.d.ts +1 -10
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/types/shared.js +0 -9
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/dest/vks/verification_key.d.ts +2 -137
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +5 -126
- package/dest/world-state/genesis_data.d.ts +11 -0
- package/dest/world-state/genesis_data.d.ts.map +1 -0
- package/dest/world-state/genesis_data.js +4 -0
- package/dest/world-state/index.d.ts +2 -1
- package/dest/world-state/index.d.ts.map +1 -1
- package/dest/world-state/index.js +1 -0
- package/dest/world-state/world_state_revision.d.ts +8 -1
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +7 -1
- package/package.json +12 -11
- package/src/abi/abi.ts +25 -2
- package/src/abi/authorization_selector.ts +2 -8
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +36 -82
- package/src/abi/encoder.ts +85 -6
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/event_selector.ts +2 -8
- package/src/abi/function_selector.ts +4 -13
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/abi/note_selector.ts +3 -12
- package/src/abi/selector.ts +1 -1
- package/src/abi/utils.ts +25 -0
- package/src/auth_witness/auth_witness.ts +3 -3
- package/src/avm/revert_code.ts +26 -25
- package/src/aztec-address/index.ts +4 -10
- package/src/block/attestation_info.ts +11 -11
- package/src/block/block_data.ts +42 -0
- package/src/block/block_hash.ts +21 -14
- package/src/block/block_parameter.ts +35 -2
- package/src/block/index.ts +1 -0
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_info.ts +8 -6
- package/src/block/l2_block_source.ts +88 -9
- package/src/block/l2_block_stream/interfaces.ts +6 -2
- package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
- package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
- package/src/block/proposal/attestations_and_signers.ts +32 -17
- package/src/block/test/l2_tips_store_test_suite.ts +9 -2
- package/src/checkpoint/checkpoint.ts +28 -7
- package/src/checkpoint/checkpoint_data.ts +91 -0
- package/src/checkpoint/index.ts +2 -0
- package/src/checkpoint/published_checkpoint.ts +3 -1
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/chain-config.ts +9 -4
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/config/sequencer-config.ts +49 -3
- package/src/contract/contract_address.ts +7 -7
- package/src/contract/contract_class.ts +3 -3
- package/src/contract/contract_class_id.ts +5 -5
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/contract/private_function.ts +5 -3
- package/src/epoch-helpers/index.ts +27 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/file-store/local.ts +15 -5
- package/src/file-store/s3.ts +12 -3
- package/src/gas/README.md +154 -0
- package/src/gas/fee_math.ts +120 -0
- package/src/gas/gas_fees.ts +20 -1
- package/src/gas/gas_settings.ts +65 -12
- package/src/gas/index.ts +1 -0
- package/src/ha-signing/config.ts +159 -0
- package/src/ha-signing/index.ts +29 -0
- package/src/ha-signing/local_config.ts +46 -0
- package/src/ha-signing/types.ts +126 -0
- package/src/hash/hash.ts +72 -11
- package/src/hash/map_slot.ts +2 -2
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +28 -2
- package/src/interfaces/aztec-node-admin.ts +31 -8
- package/src/interfaces/aztec-node-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +129 -85
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/block_response.ts +79 -0
- package/src/interfaces/chain_tips.ts +24 -0
- package/src/interfaces/checkpoint_parameter.ts +22 -0
- package/src/interfaces/checkpoint_response.ts +84 -0
- package/src/interfaces/client.ts +6 -0
- package/src/interfaces/configs.ts +43 -8
- package/src/interfaces/l1_publish_info.ts +40 -0
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +12 -21
- package/src/interfaces/p2p.ts +2 -13
- package/src/interfaces/prover-client.ts +10 -5
- package/src/interfaces/server.ts +5 -0
- package/src/interfaces/slasher.ts +0 -6
- package/src/interfaces/validator.ts +68 -37
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/kernel/hints/index.ts +2 -2
- package/src/kernel/hints/{key_validation_request_and_generator.ts → key_validation_request_and_separator.ts} +12 -15
- package/src/kernel/hints/{scoped_key_validation_request_and_generator.ts → scoped_key_validation_request_and_separator.ts} +10 -10
- package/src/kernel/private_circuit_public_inputs.ts +14 -14
- package/src/kernel/private_kernel_circuit_public_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +14 -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 +8 -8
- package/src/keys/key_types.ts +6 -2
- package/src/keys/public_keys.ts +2 -2
- package/src/keys/utils.ts +5 -5
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/l1-contracts/index.ts +1 -1
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +41 -22
- package/src/logs/index.ts +3 -1
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/log_id.ts +1 -2
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/pre_tag.ts +5 -5
- package/src/logs/public_log.ts +4 -2
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +22 -12
- package/src/logs/tag.ts +9 -9
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/note/note_dao.ts +1 -4
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/block_proposal.ts +97 -39
- package/src/p2p/checkpoint_attestation.ts +20 -29
- package/src/p2p/checkpoint_proposal.ts +87 -84
- package/src/p2p/client_type.ts +0 -6
- package/src/p2p/consensus_payload.ts +50 -28
- package/src/p2p/gossipable.ts +4 -4
- package/src/p2p/index.ts +0 -1
- package/src/p2p/peer_error.ts +7 -0
- package/src/p2p/signature_utils.ts +110 -25
- package/src/p2p/signed_txs.ts +46 -28
- package/src/p2p/topic_type.ts +8 -15
- package/src/parity/parity_base_private_inputs.ts +10 -4
- package/src/parity/parity_public_inputs.ts +9 -2
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/rollup/block_headers_hash.ts +11 -2
- package/src/rollup/checkpoint_header.ts +2 -2
- package/src/slashing/index.ts +1 -2
- package/src/slashing/serialization.ts +1 -81
- package/src/slashing/types.ts +3 -35
- package/src/slashing/{tally.ts → votes.ts} +34 -1
- package/src/tests/factories.ts +37 -63
- package/src/tests/mocks.ts +90 -51
- package/src/timetable/index.ts +308 -13
- package/src/trees/nullifier_leaf.ts +4 -0
- package/src/tx/block_header.ts +10 -4
- package/src/tx/capsule.ts +10 -2
- package/src/tx/fee_provider.ts +10 -0
- package/src/tx/global_variable_builder.ts +2 -3
- package/src/tx/global_variables.ts +3 -3
- package/src/tx/index.ts +1 -0
- package/src/tx/indexed_tx_effect.ts +1 -2
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +18 -9
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/simulated_tx.ts +14 -3
- package/src/tx/tx.ts +22 -13
- package/src/tx/tx_receipt.ts +28 -16
- package/src/tx/tx_request.ts +2 -2
- package/src/tx/validator/error_texts.ts +13 -1
- package/src/types/shared.ts +0 -10
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/src/vks/verification_key.ts +5 -184
- package/src/world-state/genesis_data.ts +15 -0
- package/src/world-state/index.ts +1 -0
- package/src/world-state/world_state_revision.ts +9 -1
- package/dest/abi/mocked_keys.d.ts +0 -2
- package/dest/abi/mocked_keys.d.ts.map +0 -1
- package/dest/abi/mocked_keys.js +0 -1
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts +0 -30
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +0 -1
- package/dest/l1-contracts/slash_factory.d.ts +0 -45
- package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
- package/dest/l1-contracts/slash_factory.js +0 -158
- package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
- package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
- package/dest/slashing/empire.d.ts +0 -31
- package/dest/slashing/empire.d.ts.map +0 -1
- package/dest/slashing/empire.js +0 -87
- package/dest/slashing/tally.d.ts.map +0 -1
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/abi/mocked_keys.ts +0 -2
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
- package/src/l1-contracts/slash_factory.ts +0 -180
- package/src/slashing/empire.ts +0 -104
- package/src/update-checker/update-checker.ts +0 -166
package/src/slashing/types.ts
CHANGED
|
@@ -126,45 +126,13 @@ export type ValidatorSlash = {
|
|
|
126
126
|
offenses: ValidatorSlashOffense[];
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
export type SlashPayload = {
|
|
131
|
-
address: EthAddress;
|
|
132
|
-
slashes: ValidatorSlash[];
|
|
133
|
-
timestamp: bigint;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/** Slash payload with round information from empire slash proposer */
|
|
137
|
-
export type SlashPayloadRound = SlashPayload & { votes: bigint; round: bigint };
|
|
138
|
-
|
|
139
|
-
export const SlashPayloadRoundSchema = zodFor<SlashPayloadRound>()(
|
|
140
|
-
z.object({
|
|
141
|
-
address: schemas.EthAddress,
|
|
142
|
-
timestamp: schemas.BigInt,
|
|
143
|
-
votes: schemas.BigInt,
|
|
144
|
-
round: schemas.BigInt,
|
|
145
|
-
slashes: z.array(
|
|
146
|
-
z.object({
|
|
147
|
-
validator: schemas.EthAddress,
|
|
148
|
-
amount: schemas.BigInt,
|
|
149
|
-
offenses: z.array(z.object({ offenseType: OffenseTypeSchema, epochOrSlot: schemas.BigInt })),
|
|
150
|
-
}),
|
|
151
|
-
),
|
|
152
|
-
}),
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
/** Votes for a validator slash in the consensus slash proposer */
|
|
129
|
+
/** Votes for a validator slash in the slashing proposer */
|
|
156
130
|
export type ValidatorSlashVote = number;
|
|
157
131
|
|
|
158
132
|
export type ProposerSlashAction =
|
|
159
|
-
/**
|
|
160
|
-
| { type: 'create-empire-payload'; data: ValidatorSlash[] }
|
|
161
|
-
/** Vote for a slashing payload on an empire-based slash proposer */
|
|
162
|
-
| { type: 'vote-empire-payload'; payload: EthAddress }
|
|
163
|
-
/** Execute a slashing payload on an empire-based slash proposer */
|
|
164
|
-
| { type: 'execute-empire-payload'; round: bigint }
|
|
165
|
-
/** Vote for offenses on a consensus slashing proposer */
|
|
133
|
+
/** Vote for offenses on the slashing proposer */
|
|
166
134
|
| { type: 'vote-offenses'; votes: ValidatorSlashVote[]; committees: EthAddress[][]; round: bigint }
|
|
167
|
-
/** Execute a slashing round on
|
|
135
|
+
/** Execute a slashing round on the slashing proposer */
|
|
168
136
|
| { type: 'execute-slash'; committees: EthAddress[][]; round: bigint };
|
|
169
137
|
|
|
170
138
|
export type ProposerSlashActionType = ProposerSlashAction['type'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import type { PartialBy } from '@aztec/foundation/types';
|
|
5
6
|
|
|
6
7
|
import { getEpochForOffense } from './helpers.js';
|
|
@@ -12,6 +13,9 @@ import type { Offense, ValidatorSlashVote } from './types.js';
|
|
|
12
13
|
* @param committees - Array of committees (each containing array of validator addresses)
|
|
13
14
|
* @param epochsForCommittees - Array of epochs corresponding to each committee
|
|
14
15
|
* @param settings - Settings including slashingAmounts and optional validator override lists
|
|
16
|
+
* @param settings.maxSlashedValidators - If set, limits the total number of [validator, epoch] pairs
|
|
17
|
+
* with non-zero votes. The lowest-vote pairs are zeroed out to stay within the limit.
|
|
18
|
+
* @param logger - Logger, logs which validators were dropped.
|
|
15
19
|
* @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
|
|
16
20
|
*/
|
|
17
21
|
export function getSlashConsensusVotesFromOffenses(
|
|
@@ -22,9 +26,11 @@ export function getSlashConsensusVotesFromOffenses(
|
|
|
22
26
|
slashingAmounts: [bigint, bigint, bigint];
|
|
23
27
|
epochDuration: number;
|
|
24
28
|
targetCommitteeSize: number;
|
|
29
|
+
maxSlashedValidators?: number;
|
|
25
30
|
},
|
|
31
|
+
logger: Logger = createLogger('slasher:votes'),
|
|
26
32
|
): ValidatorSlashVote[] {
|
|
27
|
-
const { slashingAmounts, targetCommitteeSize } = settings;
|
|
33
|
+
const { slashingAmounts, targetCommitteeSize, maxSlashedValidators } = settings;
|
|
28
34
|
|
|
29
35
|
if (committees.length !== epochsForCommittees.length) {
|
|
30
36
|
throw new Error('committees and epochsForCommittees must have the same length');
|
|
@@ -53,6 +59,33 @@ export function getSlashConsensusVotesFromOffenses(
|
|
|
53
59
|
return padArrayEnd(votes, 0, targetCommitteeSize);
|
|
54
60
|
});
|
|
55
61
|
|
|
62
|
+
// if a cap is set, zero out the lowest-vote [validator, epoch] pairs so that the most severe slashes stay.
|
|
63
|
+
if (maxSlashedValidators === undefined) {
|
|
64
|
+
return votes;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const nonZeroByDescendingVote = [...votes.entries()].filter(([, vote]) => vote > 0).sort(([, a], [, b]) => b - a);
|
|
68
|
+
|
|
69
|
+
const toTruncate = nonZeroByDescendingVote.slice(maxSlashedValidators);
|
|
70
|
+
for (const [idx] of toTruncate) {
|
|
71
|
+
votes[idx] = 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (toTruncate.length > 0) {
|
|
75
|
+
const truncated = toTruncate.map(([idx]) => {
|
|
76
|
+
const committeeIndex = Math.floor(idx / targetCommitteeSize);
|
|
77
|
+
const positionInCommittee = idx % targetCommitteeSize;
|
|
78
|
+
return {
|
|
79
|
+
validator: committees[committeeIndex][positionInCommittee].toString(),
|
|
80
|
+
epoch: epochsForCommittees[committeeIndex],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
logger.warn(
|
|
84
|
+
`Truncated ${toTruncate.length} validator-epoch pairs to stay within limit of ${maxSlashedValidators}`,
|
|
85
|
+
{ truncated },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
56
89
|
return votes;
|
|
57
90
|
}
|
|
58
91
|
|
package/src/tests/factories.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
10
10
|
CHONK_PROOF_LENGTH,
|
|
11
11
|
CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
|
|
12
|
-
GeneratorIndex,
|
|
13
12
|
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
14
13
|
MAX_CHECKPOINTS_PER_EPOCH,
|
|
15
14
|
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
@@ -46,7 +45,6 @@ import { type FieldsOf, makeTuple } from '@aztec/foundation/array';
|
|
|
46
45
|
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
47
46
|
import { compact } from '@aztec/foundation/collection';
|
|
48
47
|
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
49
|
-
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
50
48
|
import { SchnorrSignature } from '@aztec/foundation/crypto/schnorr';
|
|
51
49
|
import { sha256 } from '@aztec/foundation/crypto/sha256';
|
|
52
50
|
import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -92,17 +90,16 @@ import {
|
|
|
92
90
|
type ContractClassPublic,
|
|
93
91
|
ContractDeploymentData,
|
|
94
92
|
type ContractInstanceWithAddress,
|
|
95
|
-
type ExecutablePrivateFunctionWithMembershipProof,
|
|
96
93
|
type PrivateFunction,
|
|
97
94
|
SerializableContractInstance,
|
|
98
|
-
type UtilityFunctionWithMembershipProof,
|
|
99
95
|
computeContractClassId,
|
|
96
|
+
computePartialAddress,
|
|
100
97
|
computePublicBytecodeCommitment,
|
|
101
98
|
} from '../contract/index.js';
|
|
102
99
|
import { Gas, GasFees, GasSettings } from '../gas/index.js';
|
|
103
100
|
import { computeCalldataHash } from '../hash/hash.js';
|
|
104
101
|
import { KeyValidationRequest } from '../kernel/hints/key_validation_request.js';
|
|
105
|
-
import {
|
|
102
|
+
import { KeyValidationRequestAndSeparator } from '../kernel/hints/key_validation_request_and_separator.js';
|
|
106
103
|
import { ReadRequest, ScopedReadRequest } from '../kernel/hints/read_request.js';
|
|
107
104
|
import {
|
|
108
105
|
ClaimedLengthArray,
|
|
@@ -128,6 +125,7 @@ import {
|
|
|
128
125
|
PublicCallRequestArrayLengths,
|
|
129
126
|
} from '../kernel/public_call_request.js';
|
|
130
127
|
import { PublicKeys, computeAddress } from '../keys/index.js';
|
|
128
|
+
import { ExtendedDirectionalAppTaggingSecret } from '../logs/extended_directional_app_tagging_secret.js';
|
|
131
129
|
import { ContractClassLog, ContractClassLogFields } from '../logs/index.js';
|
|
132
130
|
import { PrivateLog } from '../logs/private_log.js';
|
|
133
131
|
import { FlatPublicLogs, PublicLog } from '../logs/public_log.js';
|
|
@@ -177,7 +175,7 @@ import { TxHash } from '../tx/tx_hash.js';
|
|
|
177
175
|
import { TxRequest } from '../tx/tx_request.js';
|
|
178
176
|
import { Vector } from '../types/index.js';
|
|
179
177
|
import { VkData } from '../vks/index.js';
|
|
180
|
-
import {
|
|
178
|
+
import { VerificationKeyAsFields, VerificationKeyData } from '../vks/verification_key.js';
|
|
181
179
|
|
|
182
180
|
/**
|
|
183
181
|
* Creates an arbitrary side effect object with the given seed.
|
|
@@ -233,7 +231,7 @@ export function makeTxContext(seed: number = 1): TxContext {
|
|
|
233
231
|
* Creates a default instance of gas settings. No seed value is used to ensure we allocate a sensible amount of gas for testing.
|
|
234
232
|
*/
|
|
235
233
|
export function makeGasSettings() {
|
|
236
|
-
return GasSettings.
|
|
234
|
+
return GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) });
|
|
237
235
|
}
|
|
238
236
|
|
|
239
237
|
/**
|
|
@@ -259,12 +257,12 @@ function makeKeyValidationRequests(seed: number): KeyValidationRequest {
|
|
|
259
257
|
}
|
|
260
258
|
|
|
261
259
|
/**
|
|
262
|
-
* Creates arbitrary
|
|
263
|
-
* @param seed - The seed to use for generating the
|
|
264
|
-
* @returns A
|
|
260
|
+
* Creates arbitrary KeyValidationRequestAndSeparator from the given seed.
|
|
261
|
+
* @param seed - The seed to use for generating the KeyValidationRequestAndSeparator.
|
|
262
|
+
* @returns A KeyValidationRequestAndSeparator.
|
|
265
263
|
*/
|
|
266
|
-
function
|
|
267
|
-
return new
|
|
264
|
+
function makeKeyValidationRequestAndSeparators(seed: number): KeyValidationRequestAndSeparator {
|
|
265
|
+
return new KeyValidationRequestAndSeparator(makeKeyValidationRequests(seed), fr(seed + 4));
|
|
268
266
|
}
|
|
269
267
|
|
|
270
268
|
export function makePublicDataWrite(seed = 1) {
|
|
@@ -574,14 +572,6 @@ export function makeVerificationKeyAsFields(size: number): VerificationKeyAsFiel
|
|
|
574
572
|
return VerificationKeyAsFields.makeFake(size);
|
|
575
573
|
}
|
|
576
574
|
|
|
577
|
-
/**
|
|
578
|
-
* Creates arbitrary/mocked verification key.
|
|
579
|
-
* @returns A verification key object
|
|
580
|
-
*/
|
|
581
|
-
export function makeVerificationKey(): VerificationKey {
|
|
582
|
-
return VerificationKey.makeFake();
|
|
583
|
-
}
|
|
584
|
-
|
|
585
575
|
/**
|
|
586
576
|
* Creates an arbitrary point in a curve.
|
|
587
577
|
* @param seed - Seed to generate the point values.
|
|
@@ -656,7 +646,7 @@ function makeClaimedLengthArray<T extends Serializable, N extends number>(
|
|
|
656
646
|
*/
|
|
657
647
|
export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicInputs {
|
|
658
648
|
return PrivateCircuitPublicInputs.from({
|
|
659
|
-
|
|
649
|
+
expirationTimestamp: BigInt(seed + 0x31415),
|
|
660
650
|
callContext: makeCallContext(seed, { isStaticCall: true }),
|
|
661
651
|
argsHash: fr(seed + 0x100),
|
|
662
652
|
returnsHash: fr(seed + 0x200),
|
|
@@ -671,9 +661,9 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn
|
|
|
671
661
|
makeScopedReadRequest,
|
|
672
662
|
seed + 0x310,
|
|
673
663
|
),
|
|
674
|
-
|
|
664
|
+
keyValidationRequestsAndSeparators: makeClaimedLengthArray(
|
|
675
665
|
MAX_KEY_VALIDATION_REQUESTS_PER_CALL,
|
|
676
|
-
|
|
666
|
+
makeKeyValidationRequestAndSeparators,
|
|
677
667
|
seed + 0x320,
|
|
678
668
|
),
|
|
679
669
|
noteHashes: makeClaimedLengthArray(MAX_NOTE_HASHES_PER_CALL, makeNoteHash, seed + 0x400),
|
|
@@ -864,11 +854,16 @@ export function makeParityPublicInputs(seed = 0): ParityPublicInputs {
|
|
|
864
854
|
new Fr(BigInt(seed + 0x200)),
|
|
865
855
|
new Fr(BigInt(seed + 0x300)),
|
|
866
856
|
new Fr(BigInt(seed + 0x400)),
|
|
857
|
+
new Fr(BigInt(seed + 0x500)),
|
|
867
858
|
);
|
|
868
859
|
}
|
|
869
860
|
|
|
870
861
|
export function makeParityBasePrivateInputs(seed = 0): ParityBasePrivateInputs {
|
|
871
|
-
return new ParityBasePrivateInputs(
|
|
862
|
+
return new ParityBasePrivateInputs(
|
|
863
|
+
makeTuple(NUM_MSGS_PER_BASE_PARITY, fr, seed + 0x3000),
|
|
864
|
+
new Fr(seed + 0x4000),
|
|
865
|
+
new Fr(seed + 0x5000),
|
|
866
|
+
);
|
|
872
867
|
}
|
|
873
868
|
|
|
874
869
|
export function makeParityRootPrivateInputs(seed = 0) {
|
|
@@ -1182,35 +1177,6 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
|
|
|
1182
1177
|
});
|
|
1183
1178
|
}
|
|
1184
1179
|
|
|
1185
|
-
export function makeExecutablePrivateFunctionWithMembershipProof(
|
|
1186
|
-
seed = 0,
|
|
1187
|
-
): ExecutablePrivateFunctionWithMembershipProof {
|
|
1188
|
-
return {
|
|
1189
|
-
selector: makeSelector(seed),
|
|
1190
|
-
bytecode: makeBytes(100, seed + 1),
|
|
1191
|
-
artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
|
|
1192
|
-
artifactTreeLeafIndex: seed + 2,
|
|
1193
|
-
privateFunctionTreeSiblingPath: makeTuple(3, fr, seed + 3),
|
|
1194
|
-
privateFunctionTreeLeafIndex: seed + 3,
|
|
1195
|
-
artifactMetadataHash: fr(seed + 4),
|
|
1196
|
-
functionMetadataHash: fr(seed + 5),
|
|
1197
|
-
utilityFunctionsTreeRoot: fr(seed + 6),
|
|
1198
|
-
vkHash: fr(seed + 7),
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
export function makeUtilityFunctionWithMembershipProof(seed = 0): UtilityFunctionWithMembershipProof {
|
|
1203
|
-
return {
|
|
1204
|
-
selector: makeSelector(seed),
|
|
1205
|
-
bytecode: makeBytes(100, seed + 1),
|
|
1206
|
-
artifactTreeSiblingPath: makeTuple(3, fr, seed + 2),
|
|
1207
|
-
artifactTreeLeafIndex: seed + 2,
|
|
1208
|
-
artifactMetadataHash: fr(seed + 4),
|
|
1209
|
-
functionMetadataHash: fr(seed + 5),
|
|
1210
|
-
privateFunctionsArtifactTreeRoot: fr(seed + 6),
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
1180
|
export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer): Promise<ContractClassPublic> {
|
|
1215
1181
|
const artifactHash = fr(seed + 1);
|
|
1216
1182
|
const privateFunctionsRoot = fr(seed + 3);
|
|
@@ -1222,8 +1188,6 @@ export async function makeContractClassPublic(seed = 0, publicBytecode?: Buffer)
|
|
|
1222
1188
|
artifactHash,
|
|
1223
1189
|
packedBytecode,
|
|
1224
1190
|
privateFunctionsRoot,
|
|
1225
|
-
privateFunctions: [],
|
|
1226
|
-
utilityFunctions: [],
|
|
1227
1191
|
version: 1,
|
|
1228
1192
|
};
|
|
1229
1193
|
}
|
|
@@ -1285,14 +1249,12 @@ export async function makeContractInstanceFromClassId(
|
|
|
1285
1249
|
const deployer = overrides?.deployer ?? new AztecAddress(new Fr(seed + 2));
|
|
1286
1250
|
const publicKeys = overrides?.publicKeys ?? (await makePublicKeys(seed + 3));
|
|
1287
1251
|
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
GeneratorIndex.PARTIAL_ADDRESS,
|
|
1295
|
-
);
|
|
1252
|
+
const partialAddress = await computePartialAddress({
|
|
1253
|
+
originalContractClassId: classId,
|
|
1254
|
+
salt,
|
|
1255
|
+
initializationHash,
|
|
1256
|
+
deployer,
|
|
1257
|
+
});
|
|
1296
1258
|
const address = await computeAddress(publicKeys, partialAddress);
|
|
1297
1259
|
return new SerializableContractInstance({
|
|
1298
1260
|
version: 1,
|
|
@@ -1747,6 +1709,10 @@ export function makeL2Tips(
|
|
|
1747
1709
|
block: { number: bn, hash },
|
|
1748
1710
|
checkpoint: { number: cpn, hash: cph },
|
|
1749
1711
|
},
|
|
1712
|
+
proposedCheckpoint: {
|
|
1713
|
+
block: { number: bn, hash },
|
|
1714
|
+
checkpoint: { number: cpn, hash: cph },
|
|
1715
|
+
},
|
|
1750
1716
|
proven: {
|
|
1751
1717
|
block: { number: bn, hash },
|
|
1752
1718
|
checkpoint: { number: cpn, hash: cph },
|
|
@@ -1757,3 +1723,11 @@ export function makeL2Tips(
|
|
|
1757
1723
|
},
|
|
1758
1724
|
};
|
|
1759
1725
|
}
|
|
1726
|
+
|
|
1727
|
+
export async function randomExtendedDirectionalAppTaggingSecret(): Promise<ExtendedDirectionalAppTaggingSecret> {
|
|
1728
|
+
const resolvedApp = await AztecAddress.random();
|
|
1729
|
+
// Using the fromString method like this is messy as it leaks the underlying serialization format but I don't want to
|
|
1730
|
+
// expose the type's constructor just for tests since in prod the secret is always constructed via compute. Also this
|
|
1731
|
+
// method is tested in extended_directional_app_tagging_secret.test.ts hence all should be fine.
|
|
1732
|
+
return ExtendedDirectionalAppTaggingSecret.fromString(`${Fr.random().toString()}:${resolvedApp.toString()}`);
|
|
1733
|
+
}
|
package/src/tests/mocks.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FIXED_DA_GAS,
|
|
3
|
-
FIXED_L2_GAS,
|
|
4
2
|
MAX_ENQUEUED_CALLS_PER_TX,
|
|
5
|
-
MAX_INCLUDE_BY_TIMESTAMP_DURATION,
|
|
6
3
|
MAX_NULLIFIERS_PER_TX,
|
|
7
4
|
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
5
|
+
MAX_TX_LIFETIME,
|
|
6
|
+
PRIVATE_TX_L2_GAS_OVERHEAD,
|
|
7
|
+
PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
8
|
+
TX_DA_GAS_OVERHEAD,
|
|
8
9
|
} from '@aztec/constants';
|
|
9
10
|
import { type FieldsOf, makeTuple } from '@aztec/foundation/array';
|
|
10
11
|
import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
|
|
@@ -13,8 +14,11 @@ import { padArrayEnd, times } from '@aztec/foundation/collection';
|
|
|
13
14
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
15
|
import { Secp256k1Signer } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
15
16
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
17
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
18
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
17
19
|
|
|
20
|
+
import { type TypedDataDefinition, hashTypedData } from 'viem';
|
|
21
|
+
|
|
18
22
|
import type { ContractArtifact } from '../abi/abi.js';
|
|
19
23
|
import { PublicTxEffect } from '../avm/avm.js';
|
|
20
24
|
import type { AvmAccumulatedData } from '../avm/avm_accumulated_data.js';
|
|
@@ -50,7 +54,7 @@ import { BlockProposal } from '../p2p/block_proposal.js';
|
|
|
50
54
|
import { CheckpointAttestation } from '../p2p/checkpoint_attestation.js';
|
|
51
55
|
import { CheckpointProposal } from '../p2p/checkpoint_proposal.js';
|
|
52
56
|
import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
53
|
-
import {
|
|
57
|
+
import { type CoordinationSignatureContext, getHashedSignaturePayloadTypedData } from '../p2p/signature_utils.js';
|
|
54
58
|
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
55
59
|
import { ProvingRequestType } from '../proofs/proving_request_type.js';
|
|
56
60
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
@@ -85,6 +89,15 @@ import {
|
|
|
85
89
|
makePublicDataWrite,
|
|
86
90
|
} from './factories.js';
|
|
87
91
|
|
|
92
|
+
export const TEST_COORDINATION_SIGNATURE_CONTEXT: CoordinationSignatureContext = {
|
|
93
|
+
chainId: 31337,
|
|
94
|
+
rollupAddress: EthAddress.fromNumber(1),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function signTypedData(signer: Secp256k1Signer, typedData: TypedDataDefinition): Signature {
|
|
98
|
+
return signer.sign(Buffer32.fromString(hashTypedData(typedData)));
|
|
99
|
+
}
|
|
100
|
+
|
|
88
101
|
export const randomTxHash = (): TxHash => TxHash.random();
|
|
89
102
|
|
|
90
103
|
export const mockTx = async (
|
|
@@ -97,6 +110,7 @@ export const mockTx = async (
|
|
|
97
110
|
publicCalldataSize = 2,
|
|
98
111
|
feePayer,
|
|
99
112
|
chonkProof = ChonkProof.random(),
|
|
113
|
+
gasLimits,
|
|
100
114
|
maxFeesPerGas = new GasFees(10, 10),
|
|
101
115
|
maxPriorityFeesPerGas,
|
|
102
116
|
gasUsed = Gas.empty(),
|
|
@@ -113,6 +127,7 @@ export const mockTx = async (
|
|
|
113
127
|
publicCalldataSize?: number;
|
|
114
128
|
feePayer?: AztecAddress;
|
|
115
129
|
chonkProof?: ChonkProof;
|
|
130
|
+
gasLimits?: Gas;
|
|
116
131
|
maxFeesPerGas?: GasFees;
|
|
117
132
|
maxPriorityFeesPerGas?: GasFees;
|
|
118
133
|
gasUsed?: Gas;
|
|
@@ -131,7 +146,7 @@ export const mockTx = async (
|
|
|
131
146
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
132
147
|
const firstNullifier = new Nullifier(new Fr(seed + 1), Fr.ZERO, 0);
|
|
133
148
|
data.constants.anchorBlockHeader = anchorBlockHeader;
|
|
134
|
-
data.constants.txContext.gasSettings = GasSettings.
|
|
149
|
+
data.constants.txContext.gasSettings = GasSettings.fallback({ gasLimits, maxFeesPerGas, maxPriorityFeesPerGas });
|
|
135
150
|
data.feePayer = feePayer ?? (await AztecAddress.random());
|
|
136
151
|
data.gasUsed = gasUsed;
|
|
137
152
|
data.constants.txContext.chainId = chainId;
|
|
@@ -139,8 +154,8 @@ export const mockTx = async (
|
|
|
139
154
|
data.constants.vkTreeRoot = vkTreeRoot;
|
|
140
155
|
data.constants.protocolContractsHash = protocolContractsHash;
|
|
141
156
|
|
|
142
|
-
// Set
|
|
143
|
-
data.
|
|
157
|
+
// Set expirationTimestamp to the maximum allowed duration from the current time.
|
|
158
|
+
data.expirationTimestamp = BigInt(Math.floor(Date.now() / 1000) + MAX_TX_LIFETIME);
|
|
144
159
|
|
|
145
160
|
const publicFunctionCalldata: HashedValues[] = [];
|
|
146
161
|
if (!isForPublic) {
|
|
@@ -197,7 +212,7 @@ export async function mockProcessedTx({
|
|
|
197
212
|
db,
|
|
198
213
|
chainId = Fr.ZERO,
|
|
199
214
|
version = Fr.ZERO,
|
|
200
|
-
gasSettings = GasSettings.
|
|
215
|
+
gasSettings = GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) }),
|
|
201
216
|
vkTreeRoot = Fr.ZERO,
|
|
202
217
|
protocolContracts = makeProtocolContracts(seed + 0x100),
|
|
203
218
|
globalVariables = GlobalVariables.empty(),
|
|
@@ -205,8 +220,11 @@ export async function mockProcessedTx({
|
|
|
205
220
|
feePayer,
|
|
206
221
|
feePaymentPublicDataWrite,
|
|
207
222
|
// The default gasUsed is the tx overhead.
|
|
208
|
-
gasUsed = Gas.from({ daGas: FIXED_DA_GAS, l2Gas: FIXED_L2_GAS }),
|
|
209
223
|
privateOnly = false,
|
|
224
|
+
gasUsed = Gas.from({
|
|
225
|
+
daGas: TX_DA_GAS_OVERHEAD,
|
|
226
|
+
l2Gas: privateOnly ? PRIVATE_TX_L2_GAS_OVERHEAD : PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
227
|
+
}),
|
|
210
228
|
avmAccumulatedData,
|
|
211
229
|
...mockTxOpts
|
|
212
230
|
}: {
|
|
@@ -421,10 +439,13 @@ export async function mockCheckpointAndMessages(
|
|
|
421
439
|
Partial<Parameters<typeof L2Block.random>[1]> = {},
|
|
422
440
|
) {
|
|
423
441
|
const slotNumber = options.slotNumber ?? SlotNumber(Number(checkpointNumber) * 10);
|
|
442
|
+
const globals = GlobalVariables.random({ slotNumber, ...options });
|
|
424
443
|
const blocksAndMessages = [];
|
|
444
|
+
|
|
425
445
|
// Track the previous block's archive to ensure consecutive blocks have consistent archive roots.
|
|
426
446
|
// The current block's header.lastArchive must equal the previous block's archive.
|
|
427
447
|
let lastArchive: AppendOnlyTreeSnapshot | undefined = previousArchive;
|
|
448
|
+
|
|
428
449
|
// Pass maxEffects via txOptions so it reaches TxEffect.random
|
|
429
450
|
const txOptions = maxEffects !== undefined ? { maxEffects } : {};
|
|
430
451
|
for (let i = 0; i < (blocks?.length ?? numBlocks); i++) {
|
|
@@ -433,11 +454,11 @@ export async function mockCheckpointAndMessages(
|
|
|
433
454
|
block:
|
|
434
455
|
blocks?.[i] ??
|
|
435
456
|
(await L2Block.random(blockNumber, {
|
|
457
|
+
...globals,
|
|
436
458
|
checkpointNumber,
|
|
437
459
|
indexWithinCheckpoint: IndexWithinCheckpoint(i),
|
|
438
460
|
txsPerBlock: numTxsPerBlock,
|
|
439
461
|
txOptions,
|
|
440
|
-
slotNumber,
|
|
441
462
|
...options,
|
|
442
463
|
...makeBlockOptions(blockNumber),
|
|
443
464
|
...(lastArchive ? { lastArchive } : {}),
|
|
@@ -451,12 +472,18 @@ export async function mockCheckpointAndMessages(
|
|
|
451
472
|
|
|
452
473
|
const messages = blocksAndMessages[0].messages;
|
|
453
474
|
const inHash = computeInHashFromL1ToL2Messages(messages);
|
|
454
|
-
const
|
|
475
|
+
const firstBlockLastArchive = blocksAndMessages[0].block.header.lastArchive;
|
|
476
|
+
const checkpoint = await Checkpoint.random(checkpointNumber, {
|
|
477
|
+
numBlocks: 0,
|
|
478
|
+
inHash,
|
|
479
|
+
...options,
|
|
480
|
+
...globals,
|
|
481
|
+
lastArchive: firstBlockLastArchive,
|
|
482
|
+
lastArchiveRoot: firstBlockLastArchive.root,
|
|
483
|
+
archive: lastArchive,
|
|
484
|
+
});
|
|
485
|
+
|
|
455
486
|
checkpoint.blocks = blocksAndMessages.map(({ block }) => block);
|
|
456
|
-
// Set the checkpoint's archive to match the last block's archive for proper chaining.
|
|
457
|
-
// When the archiver reconstructs checkpoints from L1, it uses the checkpoint's archive root
|
|
458
|
-
// from the L1 event to set the last block's archive. Without this, the archive chain breaks.
|
|
459
|
-
checkpoint.archive = lastArchive!;
|
|
460
487
|
|
|
461
488
|
// Return lastArchive so callers can chain it across multiple checkpoints
|
|
462
489
|
return { checkpoint, messages, lastArchive };
|
|
@@ -504,6 +531,7 @@ export interface MakeConsensusPayloadOptions {
|
|
|
504
531
|
txHashes?: TxHash[];
|
|
505
532
|
txs?: Tx[];
|
|
506
533
|
feeAssetPriceModifier?: bigint;
|
|
534
|
+
signatureContext?: CoordinationSignatureContext;
|
|
507
535
|
}
|
|
508
536
|
|
|
509
537
|
export interface MakeBlockProposalOptions {
|
|
@@ -514,6 +542,7 @@ export interface MakeBlockProposalOptions {
|
|
|
514
542
|
archiveRoot?: Fr;
|
|
515
543
|
txHashes?: TxHash[];
|
|
516
544
|
txs?: Tx[];
|
|
545
|
+
signatureContext?: CoordinationSignatureContext;
|
|
517
546
|
}
|
|
518
547
|
|
|
519
548
|
export interface MakeCheckpointProposalOptions {
|
|
@@ -521,6 +550,7 @@ export interface MakeCheckpointProposalOptions {
|
|
|
521
550
|
checkpointHeader?: CheckpointHeader;
|
|
522
551
|
archiveRoot?: Fr;
|
|
523
552
|
feeAssetPriceModifier?: bigint;
|
|
553
|
+
signatureContext?: CoordinationSignatureContext;
|
|
524
554
|
/** Options for the lastBlock - if undefined, no lastBlock is included */
|
|
525
555
|
lastBlock?: {
|
|
526
556
|
blockHeader?: BlockHeader;
|
|
@@ -531,10 +561,7 @@ export interface MakeCheckpointProposalOptions {
|
|
|
531
561
|
}
|
|
532
562
|
|
|
533
563
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
534
|
-
const makeAndSignConsensusPayload = (
|
|
535
|
-
domainSeparator: SignatureDomainSeparator,
|
|
536
|
-
options?: MakeConsensusPayloadOptions,
|
|
537
|
-
) => {
|
|
564
|
+
const makeAndSignConsensusPayload = (options?: MakeConsensusPayloadOptions) => {
|
|
538
565
|
const header = options?.header ?? makeCheckpointHeader(1);
|
|
539
566
|
const { signer = Secp256k1Signer.random(), archive = Fr.random(), feeAssetPriceModifier = 0n } = options ?? {};
|
|
540
567
|
|
|
@@ -542,9 +569,10 @@ const makeAndSignConsensusPayload = (
|
|
|
542
569
|
header,
|
|
543
570
|
archive,
|
|
544
571
|
feeAssetPriceModifier,
|
|
572
|
+
signatureContext: TEST_COORDINATION_SIGNATURE_CONTEXT,
|
|
545
573
|
});
|
|
546
574
|
|
|
547
|
-
const hash =
|
|
575
|
+
const hash = getHashedSignaturePayloadTypedData(payload);
|
|
548
576
|
const signature = signer.sign(hash);
|
|
549
577
|
|
|
550
578
|
return { blockNumber: header.slotNumber, payload, signature };
|
|
@@ -554,10 +582,7 @@ export const makeAndSignCommitteeAttestationsAndSigners = (
|
|
|
554
582
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
555
583
|
signer: Secp256k1Signer = Secp256k1Signer.random(),
|
|
556
584
|
) => {
|
|
557
|
-
const hash =
|
|
558
|
-
attestationsAndSigners,
|
|
559
|
-
SignatureDomainSeparator.attestationsAndSigners,
|
|
560
|
-
);
|
|
585
|
+
const hash = getHashedSignaturePayloadTypedData(attestationsAndSigners);
|
|
561
586
|
return signer.sign(hash);
|
|
562
587
|
};
|
|
563
588
|
|
|
@@ -569,41 +594,51 @@ export const makeBlockProposal = (options?: MakeBlockProposalOptions): Promise<B
|
|
|
569
594
|
const txHashes = options?.txHashes ?? [0, 1, 2, 3, 4, 5].map(() => TxHash.random());
|
|
570
595
|
const txs = options?.txs;
|
|
571
596
|
const signer = options?.signer ?? Secp256k1Signer.random();
|
|
597
|
+
const signatureContext = options?.signatureContext ?? TEST_COORDINATION_SIGNATURE_CONTEXT;
|
|
572
598
|
|
|
573
599
|
return BlockProposal.createProposalFromSigner(
|
|
574
600
|
blockHeader,
|
|
601
|
+
CheckpointNumber(1),
|
|
575
602
|
indexWithinCheckpoint,
|
|
576
603
|
inHash,
|
|
577
604
|
archiveRoot,
|
|
578
605
|
txHashes,
|
|
579
606
|
txs,
|
|
580
|
-
|
|
607
|
+
signatureContext,
|
|
608
|
+
(typedData, _context) => Promise.resolve(signTypedData(signer, typedData)),
|
|
609
|
+
(typedData, _context) => Promise.resolve(signTypedData(signer, typedData)),
|
|
581
610
|
);
|
|
582
611
|
};
|
|
583
612
|
|
|
584
|
-
export const makeCheckpointProposal = (options?: MakeCheckpointProposalOptions): Promise<CheckpointProposal> => {
|
|
585
|
-
const blockHeader = options?.lastBlock?.blockHeader ?? makeBlockHeader(1);
|
|
613
|
+
export const makeCheckpointProposal = async (options?: MakeCheckpointProposalOptions): Promise<CheckpointProposal> => {
|
|
586
614
|
const checkpointHeader = options?.checkpointHeader ?? makeCheckpointHeader(1);
|
|
587
615
|
const archiveRoot = options?.archiveRoot ?? Fr.random();
|
|
588
616
|
const feeAssetPriceModifier = options?.feeAssetPriceModifier ?? 0n;
|
|
589
617
|
const signer = options?.signer ?? Secp256k1Signer.random();
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
618
|
+
const signatureContext = options?.signatureContext ?? TEST_COORDINATION_SIGNATURE_CONTEXT;
|
|
619
|
+
|
|
620
|
+
// Build a signed block proposal if lastBlock options are provided
|
|
621
|
+
const lastBlockProposal = options?.lastBlock
|
|
622
|
+
? await makeBlockProposal({
|
|
623
|
+
blockHeader: options.lastBlock.blockHeader,
|
|
624
|
+
indexWithinCheckpoint: options.lastBlock.indexWithinCheckpoint ?? IndexWithinCheckpoint(4),
|
|
625
|
+
inHash: checkpointHeader.inHash,
|
|
626
|
+
archiveRoot,
|
|
627
|
+
txHashes: options.lastBlock.txHashes,
|
|
597
628
|
txs: options.lastBlock.txs,
|
|
598
|
-
|
|
629
|
+
signer,
|
|
630
|
+
signatureContext,
|
|
631
|
+
})
|
|
599
632
|
: undefined;
|
|
600
633
|
|
|
601
634
|
return CheckpointProposal.createProposalFromSigner(
|
|
602
635
|
checkpointHeader,
|
|
603
636
|
archiveRoot,
|
|
637
|
+
CheckpointNumber(1),
|
|
604
638
|
feeAssetPriceModifier,
|
|
605
|
-
|
|
606
|
-
|
|
639
|
+
lastBlockProposal,
|
|
640
|
+
signatureContext,
|
|
641
|
+
typedData => Promise.resolve(signTypedData(signer, typedData)),
|
|
607
642
|
);
|
|
608
643
|
};
|
|
609
644
|
|
|
@@ -617,6 +652,7 @@ export type MakeCheckpointAttestationOptions = {
|
|
|
617
652
|
attesterSigner?: Secp256k1Signer;
|
|
618
653
|
proposerSigner?: Secp256k1Signer;
|
|
619
654
|
signer?: Secp256k1Signer;
|
|
655
|
+
signatureContext?: CoordinationSignatureContext;
|
|
620
656
|
};
|
|
621
657
|
|
|
622
658
|
/**
|
|
@@ -626,26 +662,27 @@ export const makeCheckpointAttestation = (options: MakeCheckpointAttestationOpti
|
|
|
626
662
|
const header = options.header ?? makeCheckpointHeader(1);
|
|
627
663
|
const archive = options.archive ?? Fr.random();
|
|
628
664
|
const feeAssetPriceModifier = options.feeAssetPriceModifier ?? 0n;
|
|
665
|
+
const signatureContext = options.signatureContext ?? TEST_COORDINATION_SIGNATURE_CONTEXT;
|
|
629
666
|
const { signer, attesterSigner = signer, proposerSigner = signer } = options;
|
|
630
667
|
|
|
631
|
-
const payload = new ConsensusPayload(header, archive, feeAssetPriceModifier);
|
|
668
|
+
const payload = new ConsensusPayload(header, archive, feeAssetPriceModifier, signatureContext);
|
|
632
669
|
|
|
633
670
|
// Sign as attester
|
|
634
|
-
const attestationHash =
|
|
635
|
-
payload,
|
|
636
|
-
SignatureDomainSeparator.checkpointAttestation,
|
|
637
|
-
);
|
|
671
|
+
const attestationHash = getHashedSignaturePayloadTypedData(payload);
|
|
638
672
|
const attestationSigner = attesterSigner ?? Secp256k1Signer.random();
|
|
639
673
|
const attestationSignature = attestationSigner.sign(attestationHash);
|
|
640
674
|
|
|
641
675
|
// Sign as proposer - use CheckpointProposal's payload format (serializeToBuffer)
|
|
642
676
|
// This is different from ConsensusPayload's format (ABI encoding)
|
|
643
677
|
const proposalSignerToUse = proposerSigner ?? Secp256k1Signer.random();
|
|
644
|
-
const tempProposal = new CheckpointProposal(
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
678
|
+
const tempProposal = new CheckpointProposal(
|
|
679
|
+
header,
|
|
680
|
+
archive,
|
|
681
|
+
feeAssetPriceModifier,
|
|
682
|
+
Signature.empty(),
|
|
683
|
+
signatureContext,
|
|
648
684
|
);
|
|
685
|
+
const proposalHash = getHashedSignaturePayloadTypedData(tempProposal);
|
|
649
686
|
const proposerSignature = proposalSignerToUse.sign(proposalHash);
|
|
650
687
|
|
|
651
688
|
return new CheckpointAttestation(payload, attestationSignature, proposerSignature);
|
|
@@ -658,13 +695,15 @@ export const makeCheckpointAttestationFromProposal = (
|
|
|
658
695
|
proposal: CheckpointProposal,
|
|
659
696
|
attesterSigner?: Secp256k1Signer,
|
|
660
697
|
): CheckpointAttestation => {
|
|
661
|
-
const payload = new ConsensusPayload(
|
|
698
|
+
const payload = new ConsensusPayload(
|
|
699
|
+
proposal.checkpointHeader,
|
|
700
|
+
proposal.archive,
|
|
701
|
+
proposal.feeAssetPriceModifier,
|
|
702
|
+
proposal.signatureContext,
|
|
703
|
+
);
|
|
662
704
|
|
|
663
705
|
// Sign as attester
|
|
664
|
-
const attestationHash =
|
|
665
|
-
payload,
|
|
666
|
-
SignatureDomainSeparator.checkpointAttestation,
|
|
667
|
-
);
|
|
706
|
+
const attestationHash = getHashedSignaturePayloadTypedData(payload);
|
|
668
707
|
const attestationSigner = attesterSigner ?? Secp256k1Signer.random();
|
|
669
708
|
const attestationSignature = attestationSigner.sign(attestationHash);
|
|
670
709
|
|