@aztec/stdlib 6.0.0-nightly.20260604 → 6.0.0-nightly.20260721
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/avm/avm.js +1 -1
- package/dest/avm/avm_proving_request.d.ts +70 -70
- package/dest/avm/index.d.ts +1 -6
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -5
- 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_class.d.ts +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -2
- 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/index.d.ts +1 -2
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -1
- 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/interfaces/archiver.d.ts +7 -9
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -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 +8 -3
- 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 +71 -12
- 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-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 +4 -4
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +2 -2
- package/dest/interfaces/server.d.ts +1 -3
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +0 -2
- 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 +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +0 -1
- package/dest/kernel/hints/read_request.js +1 -1
- package/dest/kernel/index.d.ts +6 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +5 -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 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +10 -7
- 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_4_circuit_private_inputs.d.ts +24 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
- 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_inner_4_circuit_private_inputs.d.ts +18 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +4 -1
- 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 +1 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +2 -1
- 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 +1 -2
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +0 -1
- package/dest/keys/derivation.d.ts +41 -5
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +53 -23
- 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 +44 -28
- 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/message_context.d.ts +5 -15
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +1 -66
- package/dest/logs/pending_tagged_log.d.ts +6 -8
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +1 -31
- 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/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 +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- 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 +1 -27
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +10 -45
- 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 +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- 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/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- 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/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/world_state_revision.d.ts +1 -18
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +0 -20
- package/package.json +8 -8
- package/src/abi/buffer.ts +13 -1
- package/src/avm/avm.ts +1 -1
- package/src/avm/index.ts +0 -5
- 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_class.ts +3 -2
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/index.ts +0 -1
- 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/interfaces/archiver.ts +8 -9
- 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 +8 -2
- package/src/interfaces/p2p.ts +29 -9
- package/src/interfaces/private_kernel_prover.ts +104 -13
- package/src/interfaces/prover-client.ts +1 -3
- package/src/interfaces/prover-node.ts +32 -17
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server.ts +0 -2
- 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 +0 -1
- package/src/kernel/hints/read_request.ts +1 -1
- package/src/kernel/index.ts +5 -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 -7
- 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_4_circuit_private_inputs.ts +52 -0
- package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
- package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
- package/src/kernel/private_kernel_prover_output.ts +4 -0
- 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 +0 -7
- package/src/kernel/private_log_data.ts +4 -1
- package/src/kernel/utils/index.ts +0 -1
- package/src/keys/derivation.ts +71 -21
- package/src/logs/app_tagging_secret.ts +56 -24
- package/src/logs/app_tagging_secret_kind.ts +1 -1
- package/src/logs/contract_class_log.ts +0 -9
- package/src/logs/message_context.ts +7 -65
- package/src/logs/pending_tagged_log.ts +6 -33
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/index.ts +0 -1
- 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 +6 -2
- package/src/tests/factories.ts +13 -51
- 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 +0 -1
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/tx/profiling.ts +2 -0
- package/src/tx/tx.ts +17 -0
- package/src/tx/validator/error_texts.ts +2 -1
- package/src/world-state/world_state_revision.ts +0 -33
- package/dest/avm/contract_storage_read.d.ts +0 -58
- package/dest/avm/contract_storage_read.d.ts.map +0 -1
- package/dest/avm/contract_storage_read.js +0 -65
- package/dest/avm/contract_storage_update_request.d.ts +0 -65
- package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
- package/dest/avm/contract_storage_update_request.js +0 -80
- package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
- package/dest/avm/public_call_stack_item_compressed.js +0 -70
- package/dest/avm/public_data_update_request.d.ts +0 -62
- package/dest/avm/public_data_update_request.d.ts.map +0 -1
- package/dest/avm/public_data_update_request.js +0 -67
- package/dest/avm/public_inner_call_request.d.ts +0 -50
- package/dest/avm/public_inner_call_request.d.ts.map +0 -1
- package/dest/avm/public_inner_call_request.js +0 -74
- package/dest/contract/deployment_info.d.ts +0 -24
- package/dest/contract/deployment_info.d.ts.map +0 -1
- package/dest/contract/deployment_info.js +0 -3
- 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/interfaces/prover-coordination.d.ts +0 -15
- package/dest/interfaces/prover-coordination.d.ts.map +0 -1
- package/dest/interfaces/prover-coordination.js +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
- 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/kernel/utils/optional_number.d.ts +0 -31
- package/dest/kernel/utils/optional_number.d.ts.map +0 -1
- package/dest/kernel/utils/optional_number.js +0 -42
- package/dest/p2p/interface.d.ts +0 -5
- package/dest/p2p/interface.d.ts.map +0 -1
- package/dest/p2p/interface.js +0 -1
- package/dest/tx/validator/empty_validator.d.ts +0 -5
- package/dest/tx/validator/empty_validator.d.ts.map +0 -1
- package/dest/tx/validator/empty_validator.js +0 -7
- package/src/avm/contract_storage_read.ts +0 -77
- package/src/avm/contract_storage_update_request.ts +0 -93
- package/src/avm/public_call_stack_item_compressed.ts +0 -113
- package/src/avm/public_data_update_request.ts +0 -106
- package/src/avm/public_inner_call_request.ts +0 -85
- package/src/contract/deployment_info.ts +0 -25
- package/src/interfaces/epoch-prover.ts +0 -72
- package/src/interfaces/prover-coordination.ts +0 -17
- package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/kernel/utils/optional_number.ts +0 -50
- package/src/p2p/interface.ts +0 -4
- package/src/tx/validator/empty_validator.ts +0 -7
|
@@ -2,9 +2,17 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
2
2
|
import { type Logger } from '@aztec/foundation/log';
|
|
3
3
|
import fs from 'fs/promises';
|
|
4
4
|
import { DatabaseVersion } from './database_version.js';
|
|
5
|
-
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | '
|
|
5
|
+
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'rm' | 'mkdir' | 'rename' | 'open'>;
|
|
6
6
|
export declare const DATABASE_VERSION_FILE_NAME = "db_version";
|
|
7
7
|
export type SchemaVersionMismatchPolicy = 'reset' | 'throw';
|
|
8
|
+
/**
|
|
9
|
+
* How to react when the version file exists but cannot be read (permissions, IO error, truncation).
|
|
10
|
+
* `'reset'` (default) treats the store as unversioned and lets the reset path run — safe for stores
|
|
11
|
+
* where an empty state is legitimate. `'throw'` refuses to open, leaving data untouched — required
|
|
12
|
+
* for protection stores (e.g. signing protection) that must never be silently wiped by a transient
|
|
13
|
+
* filesystem error. A genuinely missing file (ENOENT) is a first boot and is never affected by this.
|
|
14
|
+
*/
|
|
15
|
+
export type VersionFileReadFailurePolicy = 'reset' | 'throw';
|
|
8
16
|
export type DatabaseVersionManagerOptions<T> = {
|
|
9
17
|
schemaVersion: number;
|
|
10
18
|
rollupAddress: EthAddress;
|
|
@@ -12,6 +20,7 @@ export type DatabaseVersionManagerOptions<T> = {
|
|
|
12
20
|
onOpen: (dataDir: string) => Promise<T>;
|
|
13
21
|
onUpgrade?: (dataDir: string, currentVersion: number, latestVersion: number) => Promise<void>;
|
|
14
22
|
schemaVersionMismatchPolicy?: SchemaVersionMismatchPolicy;
|
|
23
|
+
versionFileReadFailurePolicy?: VersionFileReadFailurePolicy;
|
|
15
24
|
fileSystem?: DatabaseVersionManagerFs;
|
|
16
25
|
log?: Logger;
|
|
17
26
|
};
|
|
@@ -28,6 +37,7 @@ export declare class DatabaseVersionManager<T> {
|
|
|
28
37
|
private onOpen;
|
|
29
38
|
private onUpgrade?;
|
|
30
39
|
private schemaVersionMismatchPolicy;
|
|
40
|
+
private versionFileReadFailurePolicy;
|
|
31
41
|
private fileSystem;
|
|
32
42
|
private log;
|
|
33
43
|
/**
|
|
@@ -37,13 +47,16 @@ export declare class DatabaseVersionManager<T> {
|
|
|
37
47
|
* @param rollupAddress - The rollup contract address
|
|
38
48
|
* @param dataDirectory - The directory where version information will be stored
|
|
39
49
|
* @param onOpen - A callback to the open the database at the given location
|
|
40
|
-
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
50
|
+
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
51
|
+
* database. Must be idempotent: since the version marker is written only after a successful open, a crash after
|
|
52
|
+
* onUpgrade but before the marker is written re-runs onUpgrade on the next start.
|
|
41
53
|
* @param schemaVersionMismatchPolicy - Whether schema mismatches should reset data or throw
|
|
54
|
+
* @param versionFileReadFailurePolicy - Whether an unreadable (non-missing) version file should reset data or throw
|
|
42
55
|
* @param fileSystem - An interface to access the filesystem
|
|
43
56
|
* @param log - Optional custom logger
|
|
44
57
|
* @param options - Configuration options
|
|
45
58
|
*/
|
|
46
|
-
constructor({ schemaVersion, rollupAddress, dataDirectory, onOpen, onUpgrade, schemaVersionMismatchPolicy, fileSystem, log }: DatabaseVersionManagerOptions<T>);
|
|
59
|
+
constructor({ schemaVersion, rollupAddress, dataDirectory, onOpen, onUpgrade, schemaVersionMismatchPolicy, versionFileReadFailurePolicy, fileSystem, log }: DatabaseVersionManagerOptions<T>);
|
|
47
60
|
static writeVersion(version: DatabaseVersion, dataDir: string, fileSystem?: DatabaseVersionManagerFs): Promise<void>;
|
|
48
61
|
/**
|
|
49
62
|
* Checks the stored version against the current version and handles the outcome
|
|
@@ -54,6 +67,7 @@ export declare class DatabaseVersionManager<T> {
|
|
|
54
67
|
* @returns True if data was reset, false if upgraded or no change needed
|
|
55
68
|
*/
|
|
56
69
|
open(): Promise<[T, boolean]>;
|
|
70
|
+
private closeQuietly;
|
|
57
71
|
/**
|
|
58
72
|
* Writes the current version to the version file
|
|
59
73
|
*/
|
|
@@ -71,4 +85,4 @@ export declare class DatabaseVersionManager<T> {
|
|
|
71
85
|
*/
|
|
72
86
|
getSchemaVersion(): number;
|
|
73
87
|
}
|
|
74
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
88
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbl9tYW5hZ2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGF0YWJhc2UtdmVyc2lvbi92ZXJzaW9uX21hbmFnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQzNELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUVsRSxPQUFPLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFHN0IsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE1BQU0sTUFBTSx3QkFBd0IsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLEVBQUUsVUFBVSxHQUFHLElBQUksR0FBRyxPQUFPLEdBQUcsUUFBUSxHQUFHLE1BQU0sQ0FBQyxDQUFDO0FBRXhHLGVBQU8sTUFBTSwwQkFBMEIsZUFBZSxDQUFDO0FBQ3ZELE1BQU0sTUFBTSwyQkFBMkIsR0FBRyxPQUFPLEdBQUcsT0FBTyxDQUFDO0FBRTVEOzs7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AAEF;;;;GAIG;AACH,qBAAa,sBAAsB,CAAC,CAAC;IACnC,gBAAuB,YAAY,gBAA8B;IAEjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkB;IAEjD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,SAAS,CAAC,CAAoF;IACtG,OAAO,CAAC,2BAA2B,CAA8B;IACjE,OAAO,CAAC,4BAA4B,CAA+B;IACnE,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,GAAG,CAAS;IAEpB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,MAAM,EACN,SAAS,EACT,2BAAqC,EACrC,4BAAsC,EACtC,UAAe,EACf,GAAgD,EACjD,EAAE,6BAA6B,CAAC,CAAC,CAAC,EAelC;IAED,OAAa,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,wBAA6B,iBA6B7G;IAED;;;;;;;OAOG;IACU,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAqGzC;YAMa,YAAY;IAe1B;;OAEG;IACI,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;IAED;;OAEG;IACU,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ/C;IAED;;OAEG;IACI,gBAAgB,IAAI,MAAM,CAEhC;IAED;;OAEG;IACI,gBAAgB,IAAI,MAAM,CAEhC;CACF"}
|
|
@@ -15,6 +15,7 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
15
15
|
onOpen;
|
|
16
16
|
onUpgrade;
|
|
17
17
|
schemaVersionMismatchPolicy;
|
|
18
|
+
versionFileReadFailurePolicy;
|
|
18
19
|
fileSystem;
|
|
19
20
|
log;
|
|
20
21
|
/**
|
|
@@ -24,12 +25,15 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
24
25
|
* @param rollupAddress - The rollup contract address
|
|
25
26
|
* @param dataDirectory - The directory where version information will be stored
|
|
26
27
|
* @param onOpen - A callback to the open the database at the given location
|
|
27
|
-
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
28
|
+
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
29
|
+
* database. Must be idempotent: since the version marker is written only after a successful open, a crash after
|
|
30
|
+
* onUpgrade but before the marker is written re-runs onUpgrade on the next start.
|
|
28
31
|
* @param schemaVersionMismatchPolicy - Whether schema mismatches should reset data or throw
|
|
32
|
+
* @param versionFileReadFailurePolicy - Whether an unreadable (non-missing) version file should reset data or throw
|
|
29
33
|
* @param fileSystem - An interface to access the filesystem
|
|
30
34
|
* @param log - Optional custom logger
|
|
31
35
|
* @param options - Configuration options
|
|
32
|
-
*/ constructor({ schemaVersion, rollupAddress, dataDirectory, onOpen, onUpgrade, schemaVersionMismatchPolicy = 'reset', fileSystem = fs, log = createLogger(`foundation:version-manager`) }){
|
|
36
|
+
*/ constructor({ schemaVersion, rollupAddress, dataDirectory, onOpen, onUpgrade, schemaVersionMismatchPolicy = 'reset', versionFileReadFailurePolicy = 'reset', fileSystem = fs, log = createLogger(`foundation:version-manager`) }){
|
|
33
37
|
if (schemaVersion < 1) {
|
|
34
38
|
throw new TypeError(`Invalid schema version received: ${schemaVersion}`);
|
|
35
39
|
}
|
|
@@ -39,6 +43,7 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
39
43
|
this.onOpen = onOpen;
|
|
40
44
|
this.onUpgrade = onUpgrade;
|
|
41
45
|
this.schemaVersionMismatchPolicy = schemaVersionMismatchPolicy;
|
|
46
|
+
this.versionFileReadFailurePolicy = versionFileReadFailurePolicy;
|
|
42
47
|
this.fileSystem = fileSystem;
|
|
43
48
|
this.log = log;
|
|
44
49
|
}
|
|
@@ -46,7 +51,31 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
46
51
|
await fileSystem.mkdir(dataDir, {
|
|
47
52
|
recursive: true
|
|
48
53
|
});
|
|
49
|
-
|
|
54
|
+
const finalPath = join(dataDir, DatabaseVersionManager.VERSION_FILE);
|
|
55
|
+
const tmpPath = `${finalPath}.tmp`;
|
|
56
|
+
// Atomic durable write: fill a temp file, fsync it, then rename it into place. The marker only
|
|
57
|
+
// becomes visible under its final name once its bytes are durably on disk, so a crash mid-write
|
|
58
|
+
// can never leave a "valid" version file sitting over an empty or partially-populated data dir.
|
|
59
|
+
const handle = await fileSystem.open(tmpPath, 'w');
|
|
60
|
+
try {
|
|
61
|
+
await handle.writeFile(version.toBuffer());
|
|
62
|
+
await handle.sync();
|
|
63
|
+
} finally{
|
|
64
|
+
await handle.close();
|
|
65
|
+
}
|
|
66
|
+
await fileSystem.rename(tmpPath, finalPath);
|
|
67
|
+
// Best-effort fsync of the containing directory so the rename itself survives a crash. Not all
|
|
68
|
+
// filesystems support directory fsync, so a failure here is non-fatal.
|
|
69
|
+
try {
|
|
70
|
+
const dirHandle = await fileSystem.open(dataDir, 'r');
|
|
71
|
+
try {
|
|
72
|
+
await dirHandle.sync();
|
|
73
|
+
} finally{
|
|
74
|
+
await dirHandle.close();
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
// directory fsync is best-effort
|
|
78
|
+
}
|
|
50
79
|
}
|
|
51
80
|
/**
|
|
52
81
|
* Checks the stored version against the current version and handles the outcome
|
|
@@ -68,6 +97,15 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
68
97
|
storedVersion = DatabaseVersion.empty();
|
|
69
98
|
// only turn off these logs if the data dir didn't exist before
|
|
70
99
|
shouldLogDataReset = false;
|
|
100
|
+
} else if (this.versionFileReadFailurePolicy === 'throw') {
|
|
101
|
+
// The version file exists but could not be read/parsed (permissions, IO error, truncation).
|
|
102
|
+
// Treating this as "unversioned" would reset the data directory, silently wiping a store that
|
|
103
|
+
// must fail closed. Refuse to open instead, leaving the data untouched for the operator.
|
|
104
|
+
const code = err?.code;
|
|
105
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
106
|
+
throw new Error(`Failed to read database version file at ${this.versionFile} (${code ?? 'unknown error'}: ${message}). ` + `Refusing to open the database; data was NOT reset. Resolve the underlying filesystem error and retry.`, {
|
|
107
|
+
cause: err
|
|
108
|
+
});
|
|
71
109
|
} else {
|
|
72
110
|
this.log.warn(`Failed to read stored version information: ${err}. Defaulting to empty version`);
|
|
73
111
|
storedVersion = DatabaseVersion.empty();
|
|
@@ -113,14 +151,46 @@ export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
|
113
151
|
if (needsReset) {
|
|
114
152
|
await this.resetDataDirectory();
|
|
115
153
|
}
|
|
116
|
-
//
|
|
117
|
-
|
|
154
|
+
// Open the database first, then record the version marker. Writing the marker only after a
|
|
155
|
+
// successful open makes it a post-commit record: if the process crashes between the reset and a
|
|
156
|
+
// durable open, no marker is left behind, so the next startup re-runs the reset instead of
|
|
157
|
+
// trusting a marker that sits over empty or partially-initialized data.
|
|
158
|
+
const instance = await this.onOpen(this.dataDirectory);
|
|
159
|
+
// Only (re)write the marker when it would actually change — first boot, reset, or upgrade. On a
|
|
160
|
+
// normal boot it already matches, so skipping avoids an unnecessary fsync (and the directory
|
|
161
|
+
// write permission the temp-file+rename needs) and, more importantly, any window where a
|
|
162
|
+
// marker-write failure would orphan the database we just opened.
|
|
163
|
+
if (!storedVersion.equals(this.currentVersion)) {
|
|
164
|
+
try {
|
|
165
|
+
await this.writeVersion();
|
|
166
|
+
} catch (err) {
|
|
167
|
+
// The database opened but recording the marker failed; close the freshly opened instance so
|
|
168
|
+
// we do not leak its file handles / locks before propagating the failure.
|
|
169
|
+
await this.closeQuietly(instance);
|
|
170
|
+
throw err;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
118
173
|
return [
|
|
119
|
-
|
|
174
|
+
instance,
|
|
120
175
|
needsReset
|
|
121
176
|
];
|
|
122
177
|
}
|
|
123
178
|
/**
|
|
179
|
+
* Best-effort close of a just-opened database instance, used to avoid leaking handles/locks when a
|
|
180
|
+
* post-open step fails. Swallows close errors so the original failure is the one that propagates.
|
|
181
|
+
*/ async closeQuietly(instance) {
|
|
182
|
+
const closable = instance;
|
|
183
|
+
const dispose = closable?.close ?? closable?.[Symbol.asyncDispose];
|
|
184
|
+
if (typeof dispose !== 'function') {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
await dispose.call(closable);
|
|
189
|
+
} catch (err) {
|
|
190
|
+
this.log.warn(`Failed to close database after version-write failure: ${err}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
124
194
|
* Writes the current version to the version file
|
|
125
195
|
*/ writeVersion(dir) {
|
|
126
196
|
return DatabaseVersionManager.writeVersion(this.currentVersion, dir ?? this.dataDirectory, this.fileSystem);
|
|
@@ -2,10 +2,42 @@
|
|
|
2
2
|
export declare const MAX_TXS_PER_BLOCK: number;
|
|
3
3
|
/** Max committee size - theoretical max from bitmap design (256 bytes × 8 bits) */
|
|
4
4
|
export declare const MAX_COMMITTEE_SIZE = 2048;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Maximum number of L2 blocks in a provable checkpoint. Used for deserialization and when ingesting
|
|
7
|
+
* checkpoints already accepted by L1.
|
|
8
|
+
*
|
|
9
|
+
* This MUST be >= the number of blocks the proving system can carry, or a structurally-valid, provable
|
|
10
|
+
* checkpoint that L1 accepts would be rejected on ingest (`validateCheckpoint`) and wedge the archiver.
|
|
11
|
+
* The circuits and L1 impose no explicit per-checkpoint block count; the ceiling comes from the
|
|
12
|
+
* blob-field budget:
|
|
13
|
+
*
|
|
14
|
+
* budget = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB = 6 * 4096 = 24,576 fields
|
|
15
|
+
*
|
|
16
|
+
* per-block minimal blob footprint:
|
|
17
|
+
* first block (may be empty) = 7 fields (NUM_FIRST_BLOCK_END_BLOB_FIELDS)
|
|
18
|
+
* every other (needs >= 1 tx) = 6 + 4 = 10 fields
|
|
19
|
+
* (NUM_BLOCK_END_BLOB_FIELDS + a 4-field minimal tx:
|
|
20
|
+
* tx start marker + tx hash + fee + 1 mandatory nullifier)
|
|
21
|
+
* + 1 checkpoint-end marker (NUM_CHECKPOINT_END_MARKER_FIELDS)
|
|
22
|
+
*
|
|
23
|
+
* max N: 7 + 10*(N - 1) + 1 <= 24,576 => 10*(N - 1) <= 24,568 => N <= 2,457
|
|
24
|
+
*
|
|
25
|
+
* Only the first block may be empty; every other block needs >= 1 tx (the circuits have no empty-tx
|
|
26
|
+
* variant for non-first blocks), so 2457 is the largest provable checkpoint. The blob format can encode
|
|
27
|
+
* more blocks than this (up to ~4095 with all-empty blocks), but such a checkpoint is unprovable and
|
|
28
|
+
* can only reach L1 with a malicious committee supermajority — a terminal network compromise where a
|
|
29
|
+
* wedged archiver is an acceptable outcome. We therefore bound ingest to the provable maximum.
|
|
30
|
+
* Invariant checked by the unit test in deserialization.test.ts.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MAX_CAPACITY_BLOCKS_PER_CHECKPOINT = 2457;
|
|
33
|
+
/**
|
|
34
|
+
* Max blocks per checkpoint we are willing to build or attest to (conservative client policy, and the
|
|
35
|
+
* default block-count limit for `validateCheckpoint`). Distinct from {@link MAX_CAPACITY_BLOCKS_PER_CHECKPOINT},
|
|
36
|
+
* which is the higher ceiling we tolerate when deserializing checkpoints already accepted by L1.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT = 72;
|
|
7
39
|
/** Max tx effects per body (based on blob capacity per checkpoint) */
|
|
8
40
|
export declare const MAX_TX_EFFECTS_PER_BODY: number;
|
|
9
41
|
/** Max block hash string length (hex: 0x + 64 chars, with generous headroom) */
|
|
10
42
|
export declare const MAX_BLOCK_HASH_STRING_LENGTH = 128;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZXNlcmlhbGl6YXRpb24vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT0EsZ0VBQWdFO0FBQ2hFLGVBQU8sTUFBTSxpQkFBaUIsUUFBVSxDQUFDO0FBRXpDLG9GQUFtRjtBQUNuRixlQUFPLE1BQU0sa0JBQWtCLE9BQU8sQ0FBQztBQUV2Qzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0EwQkc7QUFDSCxlQUFPLE1BQU0sa0NBQWtDLE9BQU8sQ0FBQztBQUV2RDs7OztHQUlHO0FBQ0gsZUFBTyxNQUFNLG9DQUFvQyxLQUFLLENBQUM7QUFFdkQsc0VBQXNFO0FBQ3RFLGVBQU8sTUFBTSx1QkFBdUIsUUFBeUMsQ0FBQztBQUU5RSxnRkFBZ0Y7QUFDaEYsZUFBTyxNQUFNLDRCQUE0QixNQUFNLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deserialization/index.ts"],"names":[],"mappings":"AAOA,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC,oFAAmF;AACnF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deserialization/index.ts"],"names":[],"mappings":"AAOA,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC,oFAAmF;AACnF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,QAAyC,CAAC;AAE9E,gFAAgF;AAChF,eAAO,MAAM,4BAA4B,MAAM,CAAC"}
|
|
@@ -5,6 +5,37 @@
|
|
|
5
5
|
*/ import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
6
6
|
/** Max transactions per block for deserialization validation */ export const MAX_TXS_PER_BLOCK = 2 ** 16;
|
|
7
7
|
/** Max committee size - theoretical max from bitmap design (256 bytes × 8 bits) */ export const MAX_COMMITTEE_SIZE = 2048;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of L2 blocks in a provable checkpoint. Used for deserialization and when ingesting
|
|
10
|
+
* checkpoints already accepted by L1.
|
|
11
|
+
*
|
|
12
|
+
* This MUST be >= the number of blocks the proving system can carry, or a structurally-valid, provable
|
|
13
|
+
* checkpoint that L1 accepts would be rejected on ingest (`validateCheckpoint`) and wedge the archiver.
|
|
14
|
+
* The circuits and L1 impose no explicit per-checkpoint block count; the ceiling comes from the
|
|
15
|
+
* blob-field budget:
|
|
16
|
+
*
|
|
17
|
+
* budget = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB = 6 * 4096 = 24,576 fields
|
|
18
|
+
*
|
|
19
|
+
* per-block minimal blob footprint:
|
|
20
|
+
* first block (may be empty) = 7 fields (NUM_FIRST_BLOCK_END_BLOB_FIELDS)
|
|
21
|
+
* every other (needs >= 1 tx) = 6 + 4 = 10 fields
|
|
22
|
+
* (NUM_BLOCK_END_BLOB_FIELDS + a 4-field minimal tx:
|
|
23
|
+
* tx start marker + tx hash + fee + 1 mandatory nullifier)
|
|
24
|
+
* + 1 checkpoint-end marker (NUM_CHECKPOINT_END_MARKER_FIELDS)
|
|
25
|
+
*
|
|
26
|
+
* max N: 7 + 10*(N - 1) + 1 <= 24,576 => 10*(N - 1) <= 24,568 => N <= 2,457
|
|
27
|
+
*
|
|
28
|
+
* Only the first block may be empty; every other block needs >= 1 tx (the circuits have no empty-tx
|
|
29
|
+
* variant for non-first blocks), so 2457 is the largest provable checkpoint. The blob format can encode
|
|
30
|
+
* more blocks than this (up to ~4095 with all-empty blocks), but such a checkpoint is unprovable and
|
|
31
|
+
* can only reach L1 with a malicious committee supermajority — a terminal network compromise where a
|
|
32
|
+
* wedged archiver is an acceptable outcome. We therefore bound ingest to the provable maximum.
|
|
33
|
+
* Invariant checked by the unit test in deserialization.test.ts.
|
|
34
|
+
*/ export const MAX_CAPACITY_BLOCKS_PER_CHECKPOINT = 2457;
|
|
35
|
+
/**
|
|
36
|
+
* Max blocks per checkpoint we are willing to build or attest to (conservative client policy, and the
|
|
37
|
+
* default block-count limit for `validateCheckpoint`). Distinct from {@link MAX_CAPACITY_BLOCKS_PER_CHECKPOINT},
|
|
38
|
+
* which is the higher ceiling we tolerate when deserializing checkpoints already accepted by L1.
|
|
39
|
+
*/ export const MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT = 72;
|
|
9
40
|
/** Max tx effects per body (based on blob capacity per checkpoint) */ export const MAX_TX_EFFECTS_PER_BODY = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB;
|
|
10
41
|
/** Max block hash string length (hex: 0x + 64 chars, with generous headroom) */ export const MAX_BLOCK_HASH_STRING_LENGTH = 128;
|
|
@@ -5,4 +5,4 @@ export declare function createFileStore(config: string, logger?: Logger): Promis
|
|
|
5
5
|
export declare function createFileStore(config: undefined, logger?: Logger): Promise<undefined>;
|
|
6
6
|
export declare function createReadOnlyFileStore(config: string, logger?: Logger, options?: HttpFileStoreOptions): Promise<ReadOnlyFileStore>;
|
|
7
7
|
export declare function createReadOnlyFileStore(config: undefined, logger?: Logger, options?: HttpFileStoreOptions): Promise<undefined>;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//#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/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAYnE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3F,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAmD9F,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC9B,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { GoogleCloudFileStore } from './gcs.js';
|
|
3
3
|
import { HttpFileStore } from './http.js';
|
|
4
4
|
import { LocalFileStore } from './local.js';
|
|
5
|
+
import { InMemoryFileStore } from './memory.js';
|
|
5
6
|
import { S3FileStore } from './s3.js';
|
|
6
7
|
const supportedExamples = [
|
|
7
8
|
`gs://bucket-name/path/to/store`,
|
|
@@ -12,6 +13,12 @@ const supportedExamples = [
|
|
|
12
13
|
export async function createFileStore(config, logger = createLogger('stdlib:file-store')) {
|
|
13
14
|
if (config === undefined) {
|
|
14
15
|
return undefined;
|
|
16
|
+
} else if (config.startsWith('mem://')) {
|
|
17
|
+
// In-memory store for tests (see InMemoryFileStore). The namespace is everything after the
|
|
18
|
+
// scheme, so `mem://X` and a later `mem://X` share data, like two file:// stores over one dir.
|
|
19
|
+
const namespace = config.slice('mem://'.length).replace(/\/+$/, '');
|
|
20
|
+
logger.info(`Creating in-memory file store at ${namespace}`);
|
|
21
|
+
return new InMemoryFileStore(namespace);
|
|
15
22
|
} else if (config.startsWith('file://')) {
|
|
16
23
|
const url = new URL(config);
|
|
17
24
|
if (url.host) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './interface.js';
|
|
2
2
|
export * from './factory.js';
|
|
3
3
|
export { type HttpFileStoreOptions } from './http.js';
|
|
4
|
-
|
|
4
|
+
export { InMemoryFileStore } from './memory.js';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maWxlLXN0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxjQUFjLENBQUM7QUFDN0IsT0FBTyxFQUFFLEtBQUssb0JBQW9CLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFDdEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sYUFBYSxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
package/dest/file-store/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileStore, FileStoreSaveOptions } from './interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
4
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
5
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
6
|
+
* filesystem can introduce timing flakes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class InMemoryFileStore implements FileStore {
|
|
9
|
+
private readonly namespace;
|
|
10
|
+
private readonly files;
|
|
11
|
+
constructor(namespace: string);
|
|
12
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */
|
|
13
|
+
static clear(namespace?: string): void;
|
|
14
|
+
save(path: string, data: Buffer, opts?: FileStoreSaveOptions): Promise<string>;
|
|
15
|
+
upload(destPath: string, srcPath: string, opts?: FileStoreSaveOptions): Promise<string>;
|
|
16
|
+
read(pathOrUrl: string): Promise<Buffer>;
|
|
17
|
+
download(pathOrUrl: string, destPath: string): Promise<void>;
|
|
18
|
+
exists(pathOrUrl: string): Promise<boolean>;
|
|
19
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */
|
|
20
|
+
listFiles(prefix?: string): string[];
|
|
21
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to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AEjD;IAED,4GAA4G;IACrG,SAAS,CAAC,MAAM,SAAK,GAAG,MAAM,EAAE,CAItC;IAED,8FAA8F;IAC9F,OAAO,CAAC,GAAG;CAWZ"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { writeFile } from 'fs/promises';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { gunzip as gunzipCb, gzip as gzipCb } from 'zlib';
|
|
4
|
+
const gzip = promisify(gzipCb);
|
|
5
|
+
const gunzip = promisify(gunzipCb);
|
|
6
|
+
// Backing data is shared per namespace so that a store created for writing and a (read-only) store
|
|
7
|
+
// created later from the same `mem://` URL observe the same files — mirroring how two `file://`
|
|
8
|
+
// stores over the same directory share state on disk. Without this, `FileStoreTxSource`, which
|
|
9
|
+
// builds its own store from the URL, would never see what a test wrote through a different instance.
|
|
10
|
+
const namespaces = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* In-memory {@link FileStore}, addressed via `mem://<namespace>/...`. Reads and writes are synchronous
|
|
13
|
+
* map operations with no disk I/O, so it is deterministic — useful for tests that exercise consumers
|
|
14
|
+
* of a file store (e.g. the tx file store) rather than the on-disk store itself, where a real
|
|
15
|
+
* filesystem can introduce timing flakes.
|
|
16
|
+
*/ export class InMemoryFileStore {
|
|
17
|
+
namespace;
|
|
18
|
+
files;
|
|
19
|
+
constructor(namespace){
|
|
20
|
+
this.namespace = namespace;
|
|
21
|
+
let files = namespaces.get(namespace);
|
|
22
|
+
if (!files) {
|
|
23
|
+
files = new Map();
|
|
24
|
+
namespaces.set(namespace, files);
|
|
25
|
+
}
|
|
26
|
+
this.files = files;
|
|
27
|
+
}
|
|
28
|
+
/** Clears all in-memory file store data, or a single namespace. Intended for test isolation. */ static clear(namespace) {
|
|
29
|
+
if (namespace === undefined) {
|
|
30
|
+
namespaces.clear();
|
|
31
|
+
} else {
|
|
32
|
+
namespaces.delete(namespace);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async save(path, data, opts) {
|
|
36
|
+
const toStore = opts?.compress ? await gzip(data) : data;
|
|
37
|
+
const key = this.key(path);
|
|
38
|
+
this.files.set(key, Buffer.from(toStore));
|
|
39
|
+
return `mem://${this.namespace}/${key}`;
|
|
40
|
+
}
|
|
41
|
+
async upload(destPath, srcPath, opts) {
|
|
42
|
+
const { readFile } = await import('fs/promises');
|
|
43
|
+
return this.save(destPath, await readFile(srcPath), opts);
|
|
44
|
+
}
|
|
45
|
+
async read(pathOrUrl) {
|
|
46
|
+
const data = this.files.get(this.key(pathOrUrl));
|
|
47
|
+
if (data === undefined) {
|
|
48
|
+
throw new Error(`File not found in memory store: ${pathOrUrl}`);
|
|
49
|
+
}
|
|
50
|
+
// Match LocalFileStore: transparently gunzip content that was stored compressed.
|
|
51
|
+
if (data.length >= 2 && data[0] === 0x1f && data[1] === 0x8b) {
|
|
52
|
+
return await gunzip(data);
|
|
53
|
+
}
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
async download(pathOrUrl, destPath) {
|
|
57
|
+
await writeFile(destPath, await this.read(pathOrUrl));
|
|
58
|
+
}
|
|
59
|
+
exists(pathOrUrl) {
|
|
60
|
+
return Promise.resolve(this.files.has(this.key(pathOrUrl)));
|
|
61
|
+
}
|
|
62
|
+
/** Lists stored file keys, optionally restricted to those under `prefix`. Not part of {@link FileStore}. */ listFiles(prefix = '') {
|
|
63
|
+
const keys = [
|
|
64
|
+
...this.files.keys()
|
|
65
|
+
];
|
|
66
|
+
const normalizedPrefix = prefix.replace(/^\/+/, '');
|
|
67
|
+
return normalizedPrefix ? keys.filter((k)=>k.startsWith(normalizedPrefix)) : keys;
|
|
68
|
+
}
|
|
69
|
+
/** Resolves a relative path or a `mem://` URI (as returned by `save`) to the registry key. */ key(pathOrUrl) {
|
|
70
|
+
const ownPrefix = `mem://${this.namespace}/`;
|
|
71
|
+
if (pathOrUrl.startsWith(ownPrefix)) {
|
|
72
|
+
return pathOrUrl.slice(ownPrefix.length);
|
|
73
|
+
}
|
|
74
|
+
if (pathOrUrl.startsWith('mem://')) {
|
|
75
|
+
// A mem:// URI for some namespace: drop the scheme and the leading namespace segment.
|
|
76
|
+
return pathOrUrl.slice('mem://'.length).replace(/^[^/]*\//, '');
|
|
77
|
+
}
|
|
78
|
+
return pathOrUrl.replace(/^\/+/, '');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -4,12 +4,6 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Gas } from './gas.js';
|
|
6
6
|
import { GasFees } from './gas_fees.js';
|
|
7
|
-
/** Approximate max DA gas limit. Arbitrary, assuming 4 blocks per checkpoint — users should use gas estimation. */
|
|
8
|
-
export declare const APPROXIMATE_MAX_DA_GAS_PER_BLOCK: number;
|
|
9
|
-
/** Fallback teardown L2 gas limit. Arbitrary — users should use gas estimation. */
|
|
10
|
-
export declare const FALLBACK_TEARDOWN_L2_GAS_LIMIT: number;
|
|
11
|
-
/** Fallback teardown DA gas limit. Arbitrary — users should use gas estimation. */
|
|
12
|
-
export declare const FALLBACK_TEARDOWN_DA_GAS_LIMIT: number;
|
|
13
7
|
export declare const GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT = 6540000;
|
|
14
8
|
export declare const GAS_ESTIMATION_L2_GAS_LIMIT: number;
|
|
15
9
|
export declare const GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT = 786432;
|
|
@@ -78,18 +72,18 @@ export declare class GasSettings {
|
|
|
78
72
|
static empty(): GasSettings;
|
|
79
73
|
/**
|
|
80
74
|
* Fills in gas limits high enough for transactions to be included in most cases.
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
75
|
+
* Callers must supply `gasLimits` — typically the most a single tx may declare on the network
|
|
76
|
+
* (`min(per-tx max, per-block allocation)`), i.e. a node's advertised `txsLimits.gas`. Since teardown gas
|
|
77
|
+
* is reserved from gasLimits during private execution (see gas_meter.nr), the effective gas available for
|
|
78
|
+
* app logic is gasLimits - teardownGasLimits - privateOverhead; the teardown default is derived from the
|
|
79
|
+
* effective total so it always stays below it.
|
|
86
80
|
* These values won't work if:
|
|
87
81
|
* - Teardown consumes more than the arbitrarily assigned fallback limits
|
|
88
82
|
* - The rest of the transaction consumes more than the remaining gas after teardown
|
|
89
83
|
* - The DA gas limit is too low for the transaction, while still within the checkpoint limit
|
|
90
84
|
*/
|
|
91
85
|
static fallback(overrides: {
|
|
92
|
-
gasLimits
|
|
86
|
+
gasLimits: Gas;
|
|
93
87
|
teardownGasLimits?: Gas;
|
|
94
88
|
maxFeesPerGas: GasFees;
|
|
95
89
|
maxPriorityFeesPerGas?: GasFees;
|
|
@@ -119,4 +113,4 @@ export declare class GasSettings {
|
|
|
119
113
|
toFields(): Fr[];
|
|
120
114
|
static getFields(fields: FieldsOf<GasSettings>): readonly [Gas, Gas, GasFees, GasFees];
|
|
121
115
|
}
|
|
122
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
116
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2FzX3NldHRpbmdzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2FzL2dhc19zZXR0aW5ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxVQUFVLEVBQUUsV0FBVyxFQUFzQyxNQUFNLDZCQUE2QixDQUFDO0FBQ3hILE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRXhELE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFeEIsT0FBTyxFQUFFLEdBQUcsRUFBaUIsTUFBTSxVQUFVLENBQUM7QUFDOUMsT0F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FXLENBQUMseUNBRTdDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas_settings.d.ts","sourceRoot":"","sources":["../../src/gas/gas_settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAsC,MAAM,6BAA6B,CAAC;AACxH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAiB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"gas_settings.d.ts","sourceRoot":"","sources":["../../src/gas/gas_settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAsC,MAAM,6BAA6B,CAAC;AACxH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAiB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,oCAAoC,UAAyB,CAAC;AAC3E,eAAO,MAAM,2BAA2B,QAAgE,CAAC;AACzG,eAAO,MAAM,oCAAoC,SAAwC,CAAC;AAC1F,eAAO,MAAM,2BAA2B,QAA+E,CAAC;AAGxH,mGAAmG;AACnG,qBAAa,WAAW;aAEJ,SAAS,EAAE,GAAG;aACd,iBAAiB,EAAE,GAAG;aACtB,aAAa,EAAE,OAAO;aACtB,qBAAqB,EAAE,OAAO;IAJhD,YACkB,SAAS,EAAE,GAAG,EACd,iBAAiB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AE,UAAU,GAAG,IAAI,CAAC;IAQjC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,WAAW,CAQzD;IAED,QAAQ,IAAI,EAAE,EAAE,CAQf;IAED,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,yCAE7C;CACF"}
|
package/dest/gas/gas_settings.js
CHANGED
|
@@ -4,9 +4,6 @@ import { BufferReader, BufferSink, FieldReader, serializeToFields, serializeToSi
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Gas, GasDimensions } from './gas.js';
|
|
6
6
|
import { GasFees } from './gas_fees.js';
|
|
7
|
-
/** Approximate max DA gas limit. Arbitrary, assuming 4 blocks per checkpoint — users should use gas estimation. */ export const APPROXIMATE_MAX_DA_GAS_PER_BLOCK = Math.floor(MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT / 4);
|
|
8
|
-
/** Fallback teardown L2 gas limit. Arbitrary — users should use gas estimation. */ export const FALLBACK_TEARDOWN_L2_GAS_LIMIT = Math.floor(MAX_PROCESSABLE_L2_GAS / 8);
|
|
9
|
-
/** Fallback teardown DA gas limit. Arbitrary — users should use gas estimation. */ export const FALLBACK_TEARDOWN_DA_GAS_LIMIT = Math.floor(APPROXIMATE_MAX_DA_GAS_PER_BLOCK / 2);
|
|
10
7
|
// For gas estimation, we use intentionally high limits above what the network can process,
|
|
11
8
|
// so the simulation runs without hitting gas caps. Since teardown gas is counted towards total,
|
|
12
9
|
// the total estimation limit is teardown + max processable.
|
|
@@ -64,25 +61,21 @@ export const GAS_ESTIMATION_DA_GAS_LIMIT = GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT
|
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
66
63
|
* Fills in gas limits high enough for transactions to be included in most cases.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
64
|
+
* Callers must supply `gasLimits` — typically the most a single tx may declare on the network
|
|
65
|
+
* (`min(per-tx max, per-block allocation)`), i.e. a node's advertised `txsLimits.gas`. Since teardown gas
|
|
66
|
+
* is reserved from gasLimits during private execution (see gas_meter.nr), the effective gas available for
|
|
67
|
+
* app logic is gasLimits - teardownGasLimits - privateOverhead; the teardown default is derived from the
|
|
68
|
+
* effective total so it always stays below it.
|
|
72
69
|
* These values won't work if:
|
|
73
70
|
* - Teardown consumes more than the arbitrarily assigned fallback limits
|
|
74
71
|
* - The rest of the transaction consumes more than the remaining gas after teardown
|
|
75
72
|
* - The DA gas limit is too low for the transaction, while still within the checkpoint limit
|
|
76
73
|
*/ static fallback(overrides) {
|
|
74
|
+
const gasLimits = overrides.gasLimits;
|
|
75
|
+
const teardownGasLimits = overrides.teardownGasLimits ?? new Gas(Math.floor(gasLimits.daGas / 2), Math.floor(gasLimits.l2Gas / 8));
|
|
77
76
|
return GasSettings.from({
|
|
78
|
-
gasLimits
|
|
79
|
-
|
|
80
|
-
daGas: APPROXIMATE_MAX_DA_GAS_PER_BLOCK
|
|
81
|
-
},
|
|
82
|
-
teardownGasLimits: overrides.teardownGasLimits ?? {
|
|
83
|
-
l2Gas: FALLBACK_TEARDOWN_L2_GAS_LIMIT,
|
|
84
|
-
daGas: FALLBACK_TEARDOWN_DA_GAS_LIMIT
|
|
85
|
-
},
|
|
77
|
+
gasLimits,
|
|
78
|
+
teardownGasLimits,
|
|
86
79
|
maxFeesPerGas: overrides.maxFeesPerGas,
|
|
87
80
|
maxPriorityFeesPerGas: overrides.maxPriorityFeesPerGas ?? GasFees.empty()
|
|
88
81
|
});
|
package/dest/gas/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export * from './gas.js';
|
|
|
3
3
|
export * from './gas_fees.js';
|
|
4
4
|
export * from './gas_settings.js';
|
|
5
5
|
export * from './gas_used.js';
|
|
6
|
-
|
|
6
|
+
export * from './tx_gas_limits.js';
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nYXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLG9CQUFvQixDQUFDIn0=
|
package/dest/gas/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gas/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gas/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|