@aztec/stdlib 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065
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/buffer.d.ts +6 -2
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +13 -1
- package/dest/abi/contract_artifact.d.ts +14 -1
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +17 -0
- package/dest/avm/avm.js +1 -1
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/avm/contract_storage_read.d.ts +58 -0
- package/dest/avm/contract_storage_read.d.ts.map +1 -0
- package/dest/avm/contract_storage_read.js +65 -0
- package/dest/avm/contract_storage_update_request.d.ts +65 -0
- package/dest/avm/contract_storage_update_request.d.ts.map +1 -0
- package/dest/avm/contract_storage_update_request.js +80 -0
- package/dest/avm/index.d.ts +6 -1
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +5 -0
- package/dest/avm/public_call_stack_item_compressed.d.ts +43 -0
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +1 -0
- package/dest/avm/public_call_stack_item_compressed.js +70 -0
- package/dest/avm/public_data_update_request.d.ts +62 -0
- package/dest/avm/public_data_update_request.d.ts.map +1 -0
- package/dest/avm/public_data_update_request.js +67 -0
- package/dest/avm/public_inner_call_request.d.ts +50 -0
- package/dest/avm/public_inner_call_request.d.ts.map +1 -0
- package/dest/avm/public_inner_call_request.js +74 -0
- package/dest/aztec-address/index.d.ts +35 -5
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +32 -8
- package/dest/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +46 -23
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -1
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- 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 +81 -11
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +149 -152
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +6 -12
- 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 +8 -32
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +17 -18
- 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 +70 -58
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +47 -7
- 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 +296 -37
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/checkpoint/checkpoint.js +2 -2
- 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/simulation_overrides.d.ts +61 -0
- package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
- package/dest/checkpoint/simulation_overrides.js +98 -0
- package/dest/checkpoint/validate.d.ts +11 -3
- package/dest/checkpoint/validate.d.ts.map +1 -1
- package/dest/checkpoint/validate.js +9 -6
- 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/network-consensus-config.d.ts +72 -0
- package/dest/config/network-consensus-config.d.ts.map +1 -0
- package/dest/config/network-consensus-config.js +223 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +22 -3
- package/dest/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/deployment_info.d.ts +24 -0
- package/dest/contract/deployment_info.d.ts.map +1 -0
- package/dest/contract/deployment_info.js +3 -0
- package/dest/contract/index.d.ts +2 -1
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +1 -0
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/interfaces/node-info.d.ts +11 -1
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +7 -1
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/deserialization/index.d.ts +35 -3
- package/dest/deserialization/index.d.ts.map +1 -1
- package/dest/deserialization/index.js +32 -1
- package/dest/file-store/factory.d.ts +1 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +7 -0
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/file-store/index.js +1 -0
- package/dest/file-store/memory.d.ts +24 -0
- package/dest/file-store/memory.d.ts.map +1 -0
- package/dest/file-store/memory.js +80 -0
- package/dest/gas/gas_settings.d.ts +7 -13
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +9 -16
- 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/gas/tx_gas_limits.d.ts +72 -0
- package/dest/gas/tx_gas_limits.d.ts.map +1 -0
- package/dest/gas/tx_gas_limits.js +85 -0
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/hash/hash.d.ts +1 -2
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -7
- package/dest/interfaces/archiver.d.ts +12 -7
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +4 -2
- package/dest/interfaces/aztec-node-admin.d.ts +24 -17
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +1 -1
- package/dest/interfaces/aztec-node-debug.d.ts +40 -2
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.js +29 -1
- package/dest/interfaces/aztec-node.d.ts +69 -28
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +56 -20
- package/dest/interfaces/block-builder.d.ts +3 -1
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.d.ts +8 -47
- package/dest/interfaces/chain_tips.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.js +1 -6
- package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
- package/dest/interfaces/checkpoint_parameter.js +3 -3
- package/dest/interfaces/client.d.ts +2 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +27 -6
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +5 -1
- package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
- package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
- package/dest/interfaces/get_tx_by_hash_options.js +4 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +3 -9
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +38 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +14 -2
- package/dest/interfaces/private_kernel_prover.d.ts +9 -11
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +2 -3
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-coordination.d.ts +15 -0
- package/dest/interfaces/prover-coordination.d.ts.map +1 -0
- package/dest/interfaces/prover-coordination.js +1 -0
- package/dest/interfaces/prover-node.d.ts +12 -8
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +24 -17
- package/dest/interfaces/proving-job.d.ts +87 -74
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +13 -4
- package/dest/interfaces/server.d.ts +2 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +1 -1
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +15 -4
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/hints/index.d.ts +2 -1
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +1 -0
- package/dest/kernel/hints/read_request.js +1 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +14 -0
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +1 -0
- package/dest/kernel/hints/tree_leaf_read_request.js +33 -0
- package/dest/kernel/index.d.ts +2 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/log_hash.d.ts +1 -1
- package/dest/kernel/log_hash.d.ts.map +1 -1
- package/dest/kernel/log_hash.js +2 -2
- package/dest/kernel/note_hash.js +1 -1
- package/dest/kernel/nullifier.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/kernel/private_kernel_simulated_output.d.ts +7 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +1 -2
- package/dest/kernel/private_log_data.d.ts +1 -1
- package/dest/kernel/private_log_data.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +1 -1
- package/dest/kernel/utils/index.d.ts +2 -1
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +1 -0
- package/dest/kernel/utils/optional_number.d.ts +31 -0
- package/dest/kernel/utils/optional_number.d.ts.map +1 -0
- package/dest/kernel/utils/optional_number.js +42 -0
- package/dest/keys/derivation.d.ts +41 -6
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +49 -26
- package/dest/logs/app_tagging_secret.d.ts +30 -7
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +46 -39
- package/dest/logs/app_tagging_secret_kind.js +1 -1
- package/dest/logs/contract_class_log.d.ts +1 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +0 -4
- package/dest/logs/index.d.ts +1 -3
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -2
- package/dest/logs/shared_secret_derivation.d.ts +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/messaging/l1_to_l2_message.d.ts +23 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +36 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +10 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- package/dest/p2p/checkpoint_proposal.d.ts +2 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.d.ts +2 -1
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/interface.d.ts +5 -0
- package/dest/p2p/interface.d.ts.map +1 -0
- package/dest/p2p/interface.js +1 -0
- package/dest/p2p/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.d.ts +8 -3
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +20 -10
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +27 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +40 -15
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -2
- package/dest/timetable/budgets.d.ts +57 -0
- package/dest/timetable/budgets.d.ts.map +1 -0
- package/dest/timetable/budgets.js +56 -0
- package/dest/timetable/build_proposer_timetable.d.ts +21 -0
- package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
- package/dest/timetable/build_proposer_timetable.js +17 -0
- package/dest/timetable/consensus_timetable.d.ts +70 -0
- package/dest/timetable/consensus_timetable.d.ts.map +1 -0
- package/dest/timetable/consensus_timetable.js +89 -0
- package/dest/timetable/index.d.ts +5 -84
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +4 -209
- package/dest/timetable/proposer_timetable.d.ts +106 -0
- package/dest/timetable/proposer_timetable.d.ts.map +1 -0
- package/dest/timetable/proposer_timetable.js +132 -0
- package/dest/trees/nullifier_membership_witness.d.ts +5 -8
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +0 -9
- package/dest/trees/public_data_witness.d.ts +7 -17
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +0 -27
- package/dest/tx/execution_payload.d.ts +1 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/execution_payload.js +1 -1
- package/dest/tx/fee_provider.d.ts +2 -2
- package/dest/tx/fee_provider.d.ts.map +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -12
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +2 -2
- 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/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/tx.d.ts +9 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +15 -0
- package/dest/tx/validator/empty_validator.d.ts +5 -0
- package/dest/tx/validator/empty_validator.d.ts.map +1 -0
- package/dest/tx/validator/empty_validator.js +7 -0
- package/dest/tx/validator/error_texts.d.ts +2 -2
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- package/dest/world-state/genesis_data.d.ts +9 -1
- package/dest/world-state/genesis_data.d.ts.map +1 -1
- package/dest/world-state/genesis_data.js +1 -0
- package/dest/world-state/world_state_revision.d.ts +18 -1
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +20 -0
- package/package.json +8 -8
- package/src/abi/buffer.ts +13 -1
- package/src/abi/contract_artifact.ts +19 -0
- package/src/avm/avm.ts +1 -1
- package/src/avm/contract_storage_read.ts +77 -0
- package/src/avm/contract_storage_update_request.ts +93 -0
- package/src/avm/index.ts +5 -0
- package/src/avm/public_call_stack_item_compressed.ts +113 -0
- package/src/avm/public_data_update_request.ts +106 -0
- package/src/avm/public_inner_call_request.ts +85 -0
- package/src/aztec-address/index.ts +36 -6
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +67 -13
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +96 -10
- package/src/block/l2_block_stream/l2_block_stream.ts +216 -175
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +12 -41
- package/src/block/l2_block_stream/l2_tips_store_base.ts +84 -93
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/test/l2_tips_store_test_suite.ts +270 -28
- package/src/block/validate_block_result.ts +48 -2
- package/src/checkpoint/checkpoint.ts +2 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/simulation_overrides.ts +171 -0
- package/src/checkpoint/validate.ts +16 -6
- package/src/config/index.ts +1 -0
- package/src/config/network-consensus-config.ts +291 -0
- package/src/config/sequencer-config.ts +36 -5
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/deployment_info.ts +25 -0
- package/src/contract/index.ts +1 -0
- package/src/contract/interfaces/contract_data_source.ts +2 -4
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/interfaces/node-info.ts +11 -0
- package/src/contract/partial_address.ts +8 -2
- package/src/database-version/version_manager.ts +96 -6
- package/src/deserialization/index.ts +35 -2
- package/src/file-store/factory.ts +7 -0
- package/src/file-store/index.ts +1 -0
- package/src/file-store/memory.ts +94 -0
- package/src/gas/README.md +92 -0
- package/src/gas/gas_settings.ts +11 -21
- package/src/gas/index.ts +1 -0
- package/src/gas/tx_gas_limits.ts +123 -0
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/hash/hash.ts +0 -8
- package/src/interfaces/archiver.ts +14 -7
- package/src/interfaces/aztec-node-admin.ts +1 -1
- package/src/interfaces/aztec-node-debug.ts +54 -2
- package/src/interfaces/aztec-node.ts +121 -43
- package/src/interfaces/block-builder.ts +2 -0
- package/src/interfaces/chain_tips.ts +8 -16
- package/src/interfaces/checkpoint_parameter.ts +3 -3
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/configs.ts +27 -6
- package/src/interfaces/get_tx_by_hash_options.ts +14 -0
- package/src/interfaces/merkle_tree_operations.ts +2 -9
- package/src/interfaces/p2p.ts +29 -9
- package/src/interfaces/private_kernel_prover.ts +10 -12
- package/src/interfaces/prover-client.ts +1 -3
- package/src/interfaces/prover-coordination.ts +17 -0
- package/src/interfaces/prover-node.ts +32 -17
- package/src/interfaces/proving-job.ts +15 -3
- package/src/interfaces/server.ts +1 -1
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/validator.ts +11 -0
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/hints/index.ts +1 -0
- package/src/kernel/hints/read_request.ts +1 -1
- package/src/kernel/hints/tree_leaf_read_request.ts +35 -0
- package/src/kernel/index.ts +1 -1
- package/src/kernel/log_hash.ts +5 -2
- package/src/kernel/note_hash.ts +1 -1
- package/src/kernel/nullifier.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/kernel/private_kernel_simulated_output.ts +7 -0
- package/src/kernel/private_log_data.ts +4 -1
- package/src/kernel/utils/index.ts +1 -0
- package/src/kernel/utils/optional_number.ts +50 -0
- package/src/keys/derivation.ts +69 -24
- package/src/logs/app_tagging_secret.ts +62 -39
- package/src/logs/app_tagging_secret_kind.ts +1 -1
- package/src/logs/contract_class_log.ts +0 -9
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/messaging/l1_to_l2_message.ts +51 -13
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/interface.ts +4 -0
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/rollup/checkpoint_header.ts +16 -2
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +51 -13
- package/src/tests/mocks.ts +7 -2
- package/src/timetable/README.md +609 -0
- package/src/timetable/budgets.ts +87 -0
- package/src/timetable/build_proposer_timetable.ts +42 -0
- package/src/timetable/consensus_timetable.ts +126 -0
- package/src/timetable/index.ts +4 -304
- package/src/timetable/proposer_timetable.ts +190 -0
- package/src/timetable/timetable-example.svg +108 -0
- package/src/trees/nullifier_membership_witness.ts +0 -11
- package/src/trees/public_data_witness.ts +0 -31
- package/src/tx/execution_payload.ts +2 -1
- package/src/tx/fee_provider.ts +1 -1
- package/src/tx/global_variable_builder.ts +1 -17
- package/src/tx/global_variables.ts +2 -2
- package/src/tx/index.ts +1 -0
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/tx/tx.ts +17 -0
- package/src/tx/validator/empty_validator.ts +7 -0
- package/src/tx/validator/error_texts.ts +2 -1
- package/src/world-state/genesis_data.ts +10 -0
- package/src/world-state/world_state_revision.ts +33 -0
- package/dest/interfaces/epoch-prover.d.ts +0 -57
- package/dest/interfaces/epoch-prover.d.ts.map +0 -1
- package/dest/interfaces/epoch-prover.js +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- package/dest/logs/message_context.d.ts +0 -27
- package/dest/logs/message_context.d.ts.map +0 -1
- package/dest/logs/message_context.js +0 -74
- package/dest/logs/pending_tagged_log.d.ts +0 -13
- package/dest/logs/pending_tagged_log.d.ts.map +0 -1
- package/dest/logs/pending_tagged_log.js +0 -34
- package/src/interfaces/epoch-prover.ts +0 -72
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/logs/message_context.ts +0 -76
- package/src/logs/pending_tagged_log.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.3100065",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
95
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
96
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
97
|
-
"@aztec/constants": "0.0.1-commit.
|
|
98
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
99
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
100
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
101
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
95
|
+
"@aztec/bb.js": "0.0.1-commit.3100065",
|
|
96
|
+
"@aztec/blob-lib": "0.0.1-commit.3100065",
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.3100065",
|
|
98
|
+
"@aztec/ethereum": "0.0.1-commit.3100065",
|
|
99
|
+
"@aztec/foundation": "0.0.1-commit.3100065",
|
|
100
|
+
"@aztec/l1-artifacts": "0.0.1-commit.3100065",
|
|
101
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.3100065",
|
|
102
102
|
"@google-cloud/storage": "^7.15.0",
|
|
103
103
|
"axios": "^1.15.1",
|
|
104
104
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/buffer.ts
CHANGED
|
@@ -38,11 +38,23 @@ export function bufferAsFields(input: Buffer, targetLength: number): Fr[] {
|
|
|
38
38
|
* bytecode commitment computations to diverge from what the circuit produced.
|
|
39
39
|
*
|
|
40
40
|
* @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
|
|
41
|
+
* @param maxByteLength - Optional upper bound on the declared byte length. When the field array comes
|
|
42
|
+
* from untrusted input (e.g. a gossiped contract-class log), pass the payload capacity so an
|
|
43
|
+
* attacker-declared length cannot force a large `Buffer.alloc` before the value is otherwise
|
|
44
|
+
* rejected. Throws if the declared length exceeds it, before allocating.
|
|
41
45
|
* @returns A buffer of exactly `byteLength` bytes.
|
|
42
46
|
*/
|
|
43
|
-
export function bufferFromFields(fields: Fr[]): Buffer {
|
|
47
|
+
export function bufferFromFields(fields: Fr[], maxByteLength?: number): Buffer {
|
|
48
|
+
// A valid bufferAsFields output always has at least the leading byte-length field, so an empty
|
|
49
|
+
// input encodes no data. Guard so `length` (the destructured head) is never undefined.
|
|
50
|
+
if (fields.length === 0) {
|
|
51
|
+
return Buffer.alloc(0);
|
|
52
|
+
}
|
|
44
53
|
const [length, ...payload] = fields;
|
|
45
54
|
const byteLength = length.toNumber();
|
|
55
|
+
if (maxByteLength !== undefined && byteLength > maxByteLength) {
|
|
56
|
+
throw new Error(`Declared byte length ${byteLength} exceeds maximum ${maxByteLength}`);
|
|
57
|
+
}
|
|
46
58
|
const raw = Buffer.concat(payload.map(f => f.toBuffer().subarray(1)));
|
|
47
59
|
if (raw.length >= byteLength) {
|
|
48
60
|
return raw.subarray(0, byteLength);
|
|
@@ -61,6 +61,25 @@ export function loadContractArtifact(input: NoirCompiledContract): ContractArtif
|
|
|
61
61
|
return generateContractArtifact(input);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Like {@link loadContractArtifact}, but fully validates an already-processed artifact against the
|
|
66
|
+
* contract artifact schema before returning it. Use when loading an artifact from untrusted or
|
|
67
|
+
* external JSON (e.g. a file path passed to the CLI), so a malformed artifact is rejected up-front
|
|
68
|
+
* with a clear schema error instead of surfacing as an opaque failure later during deployment.
|
|
69
|
+
*
|
|
70
|
+
* `loadContractArtifact` only runs the shallow `isContractArtifact` shape check on already-processed
|
|
71
|
+
* artifacts; raw nargo output is validated via `generateContractArtifact` regardless. The returned
|
|
72
|
+
* object is identical to `loadContractArtifact`'s; the schema parse is used purely for validation.
|
|
73
|
+
* @param input - Input object as generated by nargo compile, or an already-processed artifact.
|
|
74
|
+
* @returns A valid contract artifact instance.
|
|
75
|
+
*/
|
|
76
|
+
export function loadContractArtifactWithValidation(input: NoirCompiledContract): ContractArtifact {
|
|
77
|
+
if (isContractArtifact(input)) {
|
|
78
|
+
ContractArtifactSchema.parse(input);
|
|
79
|
+
}
|
|
80
|
+
return loadContractArtifact(input);
|
|
81
|
+
}
|
|
82
|
+
|
|
64
83
|
/**
|
|
65
84
|
* Gets nargo build output and returns a valid contract artifact instance.
|
|
66
85
|
* Differs from loadContractArtifact() by retaining all bytecode.
|
package/src/avm/avm.ts
CHANGED
|
@@ -1152,7 +1152,7 @@ export class CallStackMetadata {
|
|
|
1152
1152
|
|
|
1153
1153
|
const { stack, leaf } = failingCall;
|
|
1154
1154
|
const aztecCallStack = stack.map(call => ({
|
|
1155
|
-
contractAddress: AztecAddress.
|
|
1155
|
+
contractAddress: AztecAddress.fromFieldUnsafe(call.contractAddress),
|
|
1156
1156
|
functionSelector: call.calldata.length > 0 ? FunctionSelector.fromFieldOrUndefined(call.calldata[0]) : undefined,
|
|
1157
1157
|
}));
|
|
1158
1158
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CONTRACT_STORAGE_READ_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
+
|
|
5
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Contract storage read operation on a specific contract.
|
|
9
|
+
*
|
|
10
|
+
* Note: Similar to `PublicDataRead` but it's from the POV of contract storage so we are not working with public data
|
|
11
|
+
* tree leaf index but storage slot index.
|
|
12
|
+
*/
|
|
13
|
+
export class ContractStorageRead {
|
|
14
|
+
constructor(
|
|
15
|
+
/**
|
|
16
|
+
* Storage slot we are reading from.
|
|
17
|
+
*/
|
|
18
|
+
public readonly storageSlot: Fr,
|
|
19
|
+
/**
|
|
20
|
+
* Value read from the storage slot.
|
|
21
|
+
*/
|
|
22
|
+
public readonly currentValue: Fr,
|
|
23
|
+
/**
|
|
24
|
+
* Side effect counter tracking position of this event in tx execution.
|
|
25
|
+
*/
|
|
26
|
+
public readonly counter: number,
|
|
27
|
+
/**
|
|
28
|
+
* Contract address whose storage is being read.
|
|
29
|
+
*/
|
|
30
|
+
public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
|
|
31
|
+
) {}
|
|
32
|
+
|
|
33
|
+
static from(args: { storageSlot: Fr; currentValue: Fr; counter: number; contractAddress?: AztecAddress }) {
|
|
34
|
+
return new ContractStorageRead(args.storageSlot, args.currentValue, args.counter, args.contractAddress);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
toBuffer() {
|
|
38
|
+
return serializeToBuffer(this.storageSlot, this.currentValue, new Fr(this.counter));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
42
|
+
const reader = BufferReader.asReader(buffer);
|
|
43
|
+
return new ContractStorageRead(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader).toNumber());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static empty() {
|
|
47
|
+
return new ContractStorageRead(Fr.ZERO, Fr.ZERO, 0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
isEmpty() {
|
|
51
|
+
return this.storageSlot.isZero() && this.currentValue.isZero() && this.counter == 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
toFriendlyJSON() {
|
|
55
|
+
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.currentValue.toFriendlyJSON()}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
toFields(): Fr[] {
|
|
59
|
+
const fields = [this.storageSlot, this.currentValue, new Fr(this.counter)];
|
|
60
|
+
if (fields.length !== CONTRACT_STORAGE_READ_LENGTH) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Invalid number of fields for ContractStorageRead. Expected ${CONTRACT_STORAGE_READ_LENGTH}, got ${fields.length}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return fields;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static fromFields(fields: Fr[] | FieldReader): ContractStorageRead {
|
|
69
|
+
const reader = FieldReader.asReader(fields);
|
|
70
|
+
|
|
71
|
+
const storageSlot = reader.readField();
|
|
72
|
+
const currentValue = reader.readField();
|
|
73
|
+
const counter = reader.readField().toNumber();
|
|
74
|
+
|
|
75
|
+
return new ContractStorageRead(storageSlot, currentValue, counter);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
+
|
|
6
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Contract storage update request for a slot on a specific contract.
|
|
10
|
+
*
|
|
11
|
+
* Note: Similar to `PublicDataUpdateRequest` but it's from the POV of contract storage so we are not working with
|
|
12
|
+
* public data tree leaf index but storage slot index.
|
|
13
|
+
*/
|
|
14
|
+
export class ContractStorageUpdateRequest {
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* Storage slot we are updating.
|
|
18
|
+
*/
|
|
19
|
+
public readonly storageSlot: Fr,
|
|
20
|
+
/**
|
|
21
|
+
* New value of the storage slot.
|
|
22
|
+
*/
|
|
23
|
+
public readonly newValue: Fr,
|
|
24
|
+
/**
|
|
25
|
+
* Side effect counter tracking position of this event in tx execution.
|
|
26
|
+
*/
|
|
27
|
+
public readonly counter: number,
|
|
28
|
+
/**
|
|
29
|
+
* Contract address whose storage is being read.
|
|
30
|
+
*/
|
|
31
|
+
public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
|
|
32
|
+
) {}
|
|
33
|
+
|
|
34
|
+
toBuffer() {
|
|
35
|
+
return serializeToBuffer(this.storageSlot, this.newValue, this.counter);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
39
|
+
const reader = BufferReader.asReader(buffer);
|
|
40
|
+
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create ContractStorageUpdateRequest from a fields dictionary.
|
|
45
|
+
* @param fields - The dictionary.
|
|
46
|
+
* @returns A ContractStorageUpdateRequest object.
|
|
47
|
+
*/
|
|
48
|
+
static from(fields: FieldsOf<ContractStorageUpdateRequest>): ContractStorageUpdateRequest {
|
|
49
|
+
return new ContractStorageUpdateRequest(...ContractStorageUpdateRequest.getFields(fields));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Serialize into a field array. Low-level utility.
|
|
54
|
+
* @param fields - Object with fields.
|
|
55
|
+
* @returns The array.
|
|
56
|
+
*/
|
|
57
|
+
static getFields(fields: FieldsOf<ContractStorageUpdateRequest>) {
|
|
58
|
+
return [fields.storageSlot, fields.newValue, fields.counter, fields.contractAddress] as const;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static empty() {
|
|
62
|
+
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
isEmpty() {
|
|
66
|
+
return this.storageSlot.isZero() && this.newValue.isZero();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
toFriendlyJSON() {
|
|
70
|
+
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, sideEffectCounter=${
|
|
71
|
+
this.counter
|
|
72
|
+
}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
toFields(): Fr[] {
|
|
76
|
+
const fields = [this.storageSlot, this.newValue, new Fr(this.counter)];
|
|
77
|
+
if (fields.length !== CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`Invalid number of fields for ContractStorageUpdateRequest. Expected ${CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH}, got ${fields.length}`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return fields;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static fromFields(fields: Fr[] | FieldReader): ContractStorageUpdateRequest {
|
|
86
|
+
const reader = FieldReader.asReader(fields);
|
|
87
|
+
|
|
88
|
+
const storageSlot = reader.readField();
|
|
89
|
+
const newValue = reader.readField();
|
|
90
|
+
|
|
91
|
+
return new ContractStorageUpdateRequest(storageSlot, newValue, reader.readU32());
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/avm/index.ts
CHANGED
|
@@ -3,5 +3,10 @@ export * from './avm_accumulated_data.js';
|
|
|
3
3
|
export * from './avm_circuit_public_inputs.js';
|
|
4
4
|
export * from './revert_code.js';
|
|
5
5
|
export * from './public_data_write.js';
|
|
6
|
+
export * from './public_data_update_request.js';
|
|
7
|
+
export * from './contract_storage_update_request.js';
|
|
8
|
+
export * from './contract_storage_read.js';
|
|
9
|
+
export * from './public_inner_call_request.js';
|
|
10
|
+
export * from './public_call_stack_item_compressed.js';
|
|
6
11
|
export * from './avm_proving_request.js';
|
|
7
12
|
export * from './message_pack.js';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
+
|
|
6
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
import { Gas } from '../gas/gas.js';
|
|
8
|
+
import { CallContext } from '../tx/call_context.js';
|
|
9
|
+
import { RevertCode } from './revert_code.js';
|
|
10
|
+
|
|
11
|
+
// TO BE REMOVED
|
|
12
|
+
/**
|
|
13
|
+
* Compressed call stack item on a public call.
|
|
14
|
+
*/
|
|
15
|
+
export class PublicCallStackItemCompressed {
|
|
16
|
+
constructor(
|
|
17
|
+
public contractAddress: AztecAddress,
|
|
18
|
+
public callContext: CallContext,
|
|
19
|
+
public argsHash: Fr,
|
|
20
|
+
public returnsHash: Fr,
|
|
21
|
+
public revertCode: RevertCode,
|
|
22
|
+
/** How much gas was available for execution. */
|
|
23
|
+
public startGasLeft: Gas,
|
|
24
|
+
/** How much gas was left after execution. */
|
|
25
|
+
public endGasLeft: Gas,
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
static getFields(fields: FieldsOf<PublicCallStackItemCompressed>) {
|
|
29
|
+
return [
|
|
30
|
+
fields.contractAddress,
|
|
31
|
+
fields.callContext,
|
|
32
|
+
fields.argsHash,
|
|
33
|
+
fields.returnsHash,
|
|
34
|
+
fields.revertCode,
|
|
35
|
+
fields.startGasLeft,
|
|
36
|
+
fields.endGasLeft,
|
|
37
|
+
] as const;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
toFields(): Fr[] {
|
|
41
|
+
const fields = serializeToFields(...PublicCallStackItemCompressed.getFields(this));
|
|
42
|
+
if (fields.length !== PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Invalid number of fields for PublicCallStackItemCompressed. Expected ${PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH}, got ${fields.length}`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return fields;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
toBuffer() {
|
|
51
|
+
return serializeToBuffer(...PublicCallStackItemCompressed.getFields(this));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Deserializes from a buffer or reader.
|
|
56
|
+
* @param buffer - Buffer or reader to read from.
|
|
57
|
+
* @returns The deserialized instance.
|
|
58
|
+
*/
|
|
59
|
+
static fromBuffer(buffer: Buffer | BufferReader): PublicCallStackItemCompressed {
|
|
60
|
+
const reader = BufferReader.asReader(buffer);
|
|
61
|
+
return new PublicCallStackItemCompressed(
|
|
62
|
+
reader.readObject(AztecAddress),
|
|
63
|
+
reader.readObject(CallContext),
|
|
64
|
+
reader.readObject(Fr),
|
|
65
|
+
reader.readObject(Fr),
|
|
66
|
+
reader.readObject(RevertCode),
|
|
67
|
+
reader.readObject(Gas),
|
|
68
|
+
reader.readObject(Gas),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static fromFields(fields: Fr[] | FieldReader): PublicCallStackItemCompressed {
|
|
73
|
+
const reader = FieldReader.asReader(fields);
|
|
74
|
+
|
|
75
|
+
return new PublicCallStackItemCompressed(
|
|
76
|
+
AztecAddress.fromFields(reader),
|
|
77
|
+
CallContext.fromFields(reader),
|
|
78
|
+
reader.readField(),
|
|
79
|
+
reader.readField(),
|
|
80
|
+
RevertCode.fromFields(reader),
|
|
81
|
+
Gas.fromFields(reader),
|
|
82
|
+
Gas.fromFields(reader),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Returns a new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
88
|
+
* @returns A new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
89
|
+
*/
|
|
90
|
+
public static empty(): PublicCallStackItemCompressed {
|
|
91
|
+
return new PublicCallStackItemCompressed(
|
|
92
|
+
AztecAddress.ZERO,
|
|
93
|
+
CallContext.empty(),
|
|
94
|
+
Fr.ZERO,
|
|
95
|
+
Fr.ZERO,
|
|
96
|
+
RevertCode.OK,
|
|
97
|
+
Gas.empty(),
|
|
98
|
+
Gas.empty(),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
isEmpty() {
|
|
103
|
+
return (
|
|
104
|
+
this.contractAddress.isZero() &&
|
|
105
|
+
this.callContext.isEmpty() &&
|
|
106
|
+
this.argsHash.isEmpty() &&
|
|
107
|
+
this.returnsHash.isEmpty() &&
|
|
108
|
+
this.revertCode.equals(RevertCode.OK) &&
|
|
109
|
+
this.startGasLeft.isEmpty() &&
|
|
110
|
+
this.endGasLeft.isEmpty()
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
+
|
|
4
|
+
import { inspect } from 'util';
|
|
5
|
+
|
|
6
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
import { computePublicDataTreeLeafSlot } from '../hash/hash.js';
|
|
8
|
+
import type { ContractStorageUpdateRequest } from './contract_storage_update_request.js';
|
|
9
|
+
|
|
10
|
+
// TO BE REMOVED.
|
|
11
|
+
/**
|
|
12
|
+
* Write operations on the public data tree including the previous value.
|
|
13
|
+
*/
|
|
14
|
+
export class PublicDataUpdateRequest {
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* Index of the leaf in the public data tree which is to be updated.
|
|
18
|
+
*/
|
|
19
|
+
public readonly leafSlot: Fr,
|
|
20
|
+
/**
|
|
21
|
+
* New value of the leaf.
|
|
22
|
+
*/
|
|
23
|
+
public readonly newValue: Fr,
|
|
24
|
+
/**
|
|
25
|
+
* Side effect counter tracking position of this event in tx execution.
|
|
26
|
+
*/
|
|
27
|
+
public readonly sideEffectCounter: number,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
static from(args: {
|
|
31
|
+
/**
|
|
32
|
+
* Index of the leaf in the public data tree which is to be updated.
|
|
33
|
+
*/
|
|
34
|
+
leafIndex: Fr;
|
|
35
|
+
/**
|
|
36
|
+
* New value of the leaf.
|
|
37
|
+
*/
|
|
38
|
+
newValue: Fr;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Side effect counter tracking position of this event in tx execution.
|
|
42
|
+
*/
|
|
43
|
+
sideEffectCounter: number;
|
|
44
|
+
}) {
|
|
45
|
+
return new PublicDataUpdateRequest(args.leafIndex, args.newValue, args.sideEffectCounter);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get counter() {
|
|
49
|
+
return this.sideEffectCounter;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get position() {
|
|
53
|
+
return this.leafSlot;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
toBuffer() {
|
|
57
|
+
return serializeToBuffer(this.leafSlot, this.newValue, this.sideEffectCounter);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
isEmpty() {
|
|
61
|
+
return this.leafSlot.isZero() && this.newValue.isZero();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static fromFields(fields: Fr[] | FieldReader) {
|
|
65
|
+
const reader = FieldReader.asReader(fields);
|
|
66
|
+
return new PublicDataUpdateRequest(reader.readField(), reader.readField(), reader.readU32());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static isEmpty(x: PublicDataUpdateRequest) {
|
|
70
|
+
return x.isEmpty();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
equals(other: PublicDataUpdateRequest) {
|
|
74
|
+
return this.leafSlot.equals(other.leafSlot) && this.newValue.equals(other.newValue);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
78
|
+
const reader = BufferReader.asReader(buffer);
|
|
79
|
+
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static async fromContractStorageUpdateRequest(
|
|
83
|
+
contractAddress: AztecAddress,
|
|
84
|
+
updateRequest: ContractStorageUpdateRequest,
|
|
85
|
+
) {
|
|
86
|
+
const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, updateRequest.storageSlot);
|
|
87
|
+
|
|
88
|
+
return new PublicDataUpdateRequest(leafSlot, updateRequest.newValue, updateRequest.counter);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static empty() {
|
|
92
|
+
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
toFriendlyJSON() {
|
|
96
|
+
return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, SideEffectCounter=${
|
|
97
|
+
this.sideEffectCounter
|
|
98
|
+
}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[inspect.custom]() {
|
|
102
|
+
return `PublicDataUpdateRequest { leafSlot: ${this.leafSlot.toFriendlyJSON()}, newValue: ${this.newValue.toFriendlyJSON()}, sideEffectCounter: ${
|
|
103
|
+
this.sideEffectCounter
|
|
104
|
+
} }`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
3
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
+
|
|
5
|
+
import { inspect } from 'util';
|
|
6
|
+
|
|
7
|
+
import { PublicCallStackItemCompressed } from './public_call_stack_item_compressed.js';
|
|
8
|
+
|
|
9
|
+
// TO BE REMOVED
|
|
10
|
+
/**
|
|
11
|
+
* Represents a request to call a public function.
|
|
12
|
+
*/
|
|
13
|
+
export class PublicInnerCallRequest {
|
|
14
|
+
constructor(
|
|
15
|
+
public item: PublicCallStackItemCompressed,
|
|
16
|
+
/**
|
|
17
|
+
* The counter for this call request.
|
|
18
|
+
*/
|
|
19
|
+
public counter: number,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
getSize() {
|
|
23
|
+
return this.isEmpty() ? 0 : this.toBuffer().length;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Serialize this as a buffer.
|
|
28
|
+
* @returns The buffer.
|
|
29
|
+
*/
|
|
30
|
+
toBuffer() {
|
|
31
|
+
return serializeToBuffer(this.item, this.counter);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Deserialize this from a buffer.
|
|
36
|
+
* @param buffer - The bufferable type from which to deserialize.
|
|
37
|
+
* @returns The deserialized instance of PublicInnerCallRequest.
|
|
38
|
+
*/
|
|
39
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
40
|
+
const reader = BufferReader.asReader(buffer);
|
|
41
|
+
return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromBuffer(reader), reader.readNumber());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Create PublicInnerCallRequest from a fields dictionary.
|
|
46
|
+
* @param fields - The dictionary.
|
|
47
|
+
* @returns A PublicInnerCallRequest object.
|
|
48
|
+
*/
|
|
49
|
+
static from(fields: FieldsOf<PublicInnerCallRequest>): PublicInnerCallRequest {
|
|
50
|
+
return new PublicInnerCallRequest(...PublicInnerCallRequest.getFields(fields));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Serialize into a field array. Low-level utility.
|
|
55
|
+
* @param fields - Object with fields.
|
|
56
|
+
* @returns The array.
|
|
57
|
+
*/
|
|
58
|
+
static getFields(fields: FieldsOf<PublicInnerCallRequest>) {
|
|
59
|
+
return [fields.item, fields.counter] as const;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
toFields(): Fr[] {
|
|
63
|
+
return serializeToFields([this.item, this.counter]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static fromFields(fields: Fr[] | FieldReader): PublicInnerCallRequest {
|
|
67
|
+
const reader = FieldReader.asReader(fields);
|
|
68
|
+
return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromFields(reader), reader.readU32());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static empty() {
|
|
72
|
+
return new PublicInnerCallRequest(PublicCallStackItemCompressed.empty(), 0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
isEmpty(): boolean {
|
|
76
|
+
return this.item.isEmpty() && this.counter == 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[inspect.custom]() {
|
|
80
|
+
return `PublicInnerCallRequest {
|
|
81
|
+
item: ${this.item.toFields()}
|
|
82
|
+
counter: ${this.counter}
|
|
83
|
+
}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -43,34 +43,64 @@ export class AztecAddress {
|
|
|
43
43
|
static ZERO = new AztecAddress(Buffer.alloc(32, 0));
|
|
44
44
|
|
|
45
45
|
/** Null msg sender address. Not part of the protocol contracts tree. */
|
|
46
|
-
static NULL_MSG_SENDER = AztecAddress.
|
|
46
|
+
static NULL_MSG_SENDER = AztecAddress.fromBigIntUnsafe(NULL_MSG_SENDER_CONTRACT_ADDRESS);
|
|
47
47
|
|
|
48
48
|
static zero(): AztecAddress {
|
|
49
49
|
return AztecAddress.ZERO;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Builds an `AztecAddress` from a field **without checking it is a valid address** (the x-coordinate of a point on
|
|
54
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
55
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
56
|
+
*/
|
|
57
|
+
static fromFieldUnsafe(fr: Fr) {
|
|
53
58
|
return new AztecAddress(fr);
|
|
54
59
|
}
|
|
55
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Deserializes an `AztecAddress` from a buffer. It does **not** check the value is a valid Grumpkin-curve address
|
|
63
|
+
* (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized data. Use
|
|
64
|
+
* {@link AztecAddress.random} for valid test addresses.
|
|
65
|
+
*/
|
|
56
66
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
57
67
|
return new AztecAddress(fromBuffer(buffer, Fr));
|
|
58
68
|
}
|
|
59
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Deserializes an `AztecAddress` from a field reader. It does **not** check the value is a valid Grumpkin-curve
|
|
72
|
+
* address (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized
|
|
73
|
+
* data. Use {@link AztecAddress.random} for valid test addresses.
|
|
74
|
+
*/
|
|
60
75
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
61
76
|
const reader = FieldReader.asReader(fields);
|
|
62
77
|
return new AztecAddress(reader.readField());
|
|
63
78
|
}
|
|
64
79
|
|
|
65
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Builds an `AztecAddress` from a bigint **without checking it is a valid address** (the x-coordinate of a point on
|
|
82
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
83
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
84
|
+
*/
|
|
85
|
+
static fromBigIntUnsafe(value: bigint) {
|
|
66
86
|
return new AztecAddress(new Fr(value));
|
|
67
87
|
}
|
|
68
88
|
|
|
69
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Builds an `AztecAddress` from a number **without checking it is a valid address** (the x-coordinate of a point on
|
|
91
|
+
* the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
|
|
92
|
+
* untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
93
|
+
*/
|
|
94
|
+
static fromNumberUnsafe(value: number) {
|
|
70
95
|
return new AztecAddress(new Fr(value));
|
|
71
96
|
}
|
|
72
97
|
|
|
73
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Builds an `AztecAddress` from a hex string **without checking it is a valid address** (the x-coordinate of a
|
|
100
|
+
* point on the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to
|
|
101
|
+
* validate an untrusted one, or {@link AztecAddress.random} for valid test addresses.
|
|
102
|
+
*/
|
|
103
|
+
static fromStringUnsafe(buf: string) {
|
|
74
104
|
return new AztecAddress(hexToBuffer(buf));
|
|
75
105
|
}
|
|
76
106
|
|
|
@@ -89,7 +119,7 @@ export class AztecAddress {
|
|
|
89
119
|
if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
|
|
90
120
|
return new AztecAddress(obj);
|
|
91
121
|
}
|
|
92
|
-
return AztecAddress.
|
|
122
|
+
return AztecAddress.fromStringUnsafe(obj);
|
|
93
123
|
}
|
|
94
124
|
|
|
95
125
|
/**
|
|
@@ -60,9 +60,14 @@ export function getAttestationInfoFromPayload(
|
|
|
60
60
|
return { address: attestation.address, status: 'provided-as-address' as const };
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Try to recover address from signature
|
|
63
|
+
// Try to recover address from signature. Recover with default opts (no allowYParityAsV): a slot
|
|
64
|
+
// whose recovery byte is in yParity form (v ∈ {0, 1}) is judged invalid here, matching L1 proving
|
|
65
|
+
// (ValidatorSelectionLib.verifyAttestations → ECDSA.recover only accepts v ∈ {27, 28}). A malicious
|
|
66
|
+
// proposer that lands such a slot cannot have it silently treated as valid off-chain; it is routed to
|
|
67
|
+
// invalid-attestation and invalidated. The gossip receipt path (recoverCoordinationSigner) stays
|
|
68
|
+
// lenient with allowYParityAsV; A-1351 normalizes on pool ingress and before the L1 bundle.
|
|
64
69
|
try {
|
|
65
|
-
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature
|
|
70
|
+
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
|
|
66
71
|
return { address: recoveredAddress, status: 'recovered-from-signature' as const };
|
|
67
72
|
} catch {
|
|
68
73
|
// Signature present but recovery failed
|