@aztec/stdlib 1.2.0 → 2.0.0-nightly.20250813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/abi.d.ts +0 -67
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +1 -14
- package/dest/abi/authorization_selector.d.ts +52 -0
- package/dest/abi/authorization_selector.d.ts.map +1 -0
- package/dest/abi/authorization_selector.js +70 -0
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +0 -40
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +3 -6
- package/dest/abi/index.d.ts +1 -0
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/avm/avm.d.ts +278 -412
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +12 -12
- package/dest/avm/avm_proving_request.d.ts +160 -186
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/l2_block.d.ts +8 -0
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +9 -0
- package/dest/block/l2_block_source.d.ts +446 -2
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +29 -0
- package/dest/block/proposal/committee_attestation.d.ts +3 -1
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
- package/dest/block/proposal/committee_attestation.js +3 -0
- package/dest/block/published_l2_block.d.ts +2 -1
- package/dest/block/published_l2_block.d.ts.map +1 -1
- package/dest/block/published_l2_block.js +6 -1
- package/dest/contract/contract_instance.d.ts +3 -3
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +3 -3
- package/dest/contract/interfaces/contract_class.d.ts +2 -2
- package/dest/contract/interfaces/protocol_contract_addresses.d.ts +9 -9
- package/dest/contract/interfaces/protocol_contract_addresses.d.ts.map +1 -1
- package/dest/contract/interfaces/protocol_contract_addresses.js +4 -4
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/contract/utility_function_membership_proof.d.ts +1 -1
- package/dest/contract/utility_function_membership_proof.js +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +20 -0
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -0
- package/dest/{shared_mutable/shared_mutable_values.js → delayed_public_mutable/delayed_public_mutable_values.js} +9 -9
- package/dest/{shared_mutable/shared_mutable_values_with_hash.d.ts → delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts} +6 -6
- package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts.map +1 -0
- package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.js +30 -0
- package/dest/delayed_public_mutable/index.d.ts +5 -0
- package/dest/delayed_public_mutable/index.d.ts.map +1 -0
- package/dest/delayed_public_mutable/index.js +4 -0
- package/dest/delayed_public_mutable/scheduled_delay_change.d.ts.map +1 -0
- package/dest/delayed_public_mutable/scheduled_value_change.d.ts.map +1 -0
- package/dest/gas/gas.d.ts +1 -0
- package/dest/gas/gas.d.ts.map +1 -1
- package/dest/gas/gas.js +3 -0
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +1 -4
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +4 -2
- package/dest/interfaces/aztec-node-admin.d.ts +211 -8
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +9 -3
- package/dest/interfaces/configs.d.ts +27 -0
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -1
- package/dest/interfaces/get_logs_response.d.ts +1 -1
- package/dest/interfaces/proving-job.d.ts +166 -192
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +3 -1
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +1 -1
- package/dest/interfaces/server.d.ts +4 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +4 -2
- package/dest/interfaces/slasher.d.ts +86 -0
- package/dest/interfaces/slasher.d.ts.map +1 -0
- package/dest/interfaces/slasher.js +23 -0
- package/dest/interfaces/tx_provider.d.ts +24 -0
- package/dest/interfaces/tx_provider.d.ts.map +1 -0
- package/dest/kernel/claimed_length_array.d.ts +34 -0
- package/dest/kernel/claimed_length_array.d.ts.map +1 -0
- package/dest/kernel/claimed_length_array.js +58 -0
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -6
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +18 -20
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +7 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +17 -32
- package/dest/kernel/hints/build_transient_data_hints.d.ts +4 -3
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -10
- 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 +1 -2
- package/dest/kernel/hints/note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/note_hash_read_request_hints.js +4 -4
- package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/nullifier_read_request_hints.js +4 -4
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +5 -5
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.js +9 -9
- package/dest/kernel/hints/read_request_hints.d.ts +17 -17
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.js +28 -28
- package/dest/kernel/hints/{transient_data_index_hint.d.ts → transient_data_squashing_hint.d.ts} +5 -5
- package/dest/kernel/hints/transient_data_squashing_hint.d.ts.map +1 -0
- package/dest/kernel/hints/{transient_data_index_hint.js → transient_data_squashing_hint.js} +5 -5
- package/dest/kernel/index.d.ts +1 -0
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -0
- package/dest/kernel/private_accumulated_data.d.ts +16 -15
- package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_accumulated_data.js +3 -3
- package/dest/kernel/private_call_data.d.ts +4 -4
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +2 -2
- package/dest/kernel/private_circuit_public_inputs.d.ts +26 -25
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +33 -15
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +9 -0
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +8 -4
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +9 -6
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +11 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +20 -18
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +4 -4
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +9 -10
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +11 -11
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +11 -12
- package/dest/kernel/private_validation_requests.d.ts +8 -20
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +9 -21
- package/dest/kernel/utils/order_and_comparison.d.ts +0 -3
- package/dest/kernel/utils/order_and_comparison.d.ts.map +1 -1
- package/dest/kernel/utils/order_and_comparison.js +0 -19
- package/dest/logs/extended_public_log.d.ts +1 -1
- package/dest/logs/shared_secret_derivation.d.ts +1 -1
- package/dest/logs/shared_secret_derivation.js +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +4 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +49 -54
- package/dest/messaging/l2_to_l1_message.d.ts +2 -0
- package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_message.js +7 -0
- package/dest/note/notes_filter.d.ts +5 -2
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -1
- package/dest/p2p/attestation_utils.d.ts +10 -0
- package/dest/p2p/attestation_utils.d.ts.map +1 -0
- package/dest/p2p/attestation_utils.js +21 -0
- package/dest/p2p/block_attestation.d.ts +3 -4
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_attestation.js +3 -4
- package/dest/p2p/block_proposal.d.ts +8 -1
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +21 -8
- package/dest/p2p/consensus_payload.d.ts +3 -11
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +13 -22
- package/dest/p2p/index.d.ts +1 -0
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +5 -3
- package/dest/rollup/block_root_rollup.d.ts +1 -1
- package/dest/slashing/index.d.ts +51 -0
- package/dest/slashing/index.d.ts.map +1 -0
- package/dest/slashing/index.js +54 -0
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +0 -2
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +25 -24
- package/dest/tests/mocks.d.ts +2 -0
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +31 -22
- package/dest/tx/index.d.ts +0 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +2 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +11 -11
- package/dest/tx/processed_tx.d.ts +2 -2
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +4 -4
- package/dest/tx/proven_tx.d.ts +1 -1
- package/dest/tx/proven_tx.d.ts.map +1 -1
- package/dest/tx/proven_tx.js +7 -3
- package/dest/tx/simulated_tx.d.ts +11 -17
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +12 -12
- package/dest/tx/tx.d.ts +25 -25
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +60 -48
- package/dest/tx/tx_effect.d.ts +2 -2
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +3 -18
- package/dest/tx/tx_execution_request.js +2 -2
- package/dest/tx/tx_hash.d.ts +7 -0
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_hash.js +19 -1
- package/dest/tx/tx_request.d.ts +5 -5
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/tx/tx_request.js +7 -7
- package/dest/tx/validator/error_texts.d.ts +1 -0
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -0
- package/dest/tx/validator/tx_validator.d.ts +6 -4
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/tx/validator/tx_validator.js +3 -0
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +4 -4
- package/package.json +10 -9
- package/src/abi/abi.ts +0 -38
- package/src/abi/authorization_selector.ts +95 -0
- package/src/abi/contract_artifact.ts +0 -49
- package/src/abi/decoder.ts +3 -6
- package/src/abi/index.ts +1 -0
- package/src/avm/avm.ts +7 -9
- package/src/block/l2_block.ts +18 -0
- package/src/block/l2_block_source.ts +70 -1
- package/src/block/proposal/committee_attestation.ts +5 -1
- package/src/block/published_l2_block.ts +14 -5
- package/src/contract/contract_instance.ts +3 -3
- package/src/contract/interfaces/protocol_contract_addresses.ts +5 -10
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/contract/utility_function_membership_proof.ts +1 -1
- package/src/{shared_mutable/shared_mutable_values.ts → delayed_public_mutable/delayed_public_mutable_values.ts} +10 -10
- package/src/delayed_public_mutable/delayed_public_mutable_values_with_hash.ts +38 -0
- package/src/delayed_public_mutable/index.ts +4 -0
- package/src/gas/gas.ts +4 -0
- package/src/hash/hash.ts +1 -4
- package/src/interfaces/archiver.ts +3 -1
- package/src/interfaces/aztec-node-admin.ts +19 -8
- package/src/interfaces/configs.ts +17 -0
- package/src/interfaces/pxe.ts +4 -2
- package/src/interfaces/server.ts +4 -2
- package/src/interfaces/slasher.ts +49 -0
- package/src/interfaces/tx_provider.ts +16 -0
- package/src/kernel/claimed_length_array.ts +104 -0
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +28 -30
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +28 -59
- package/src/kernel/hints/build_transient_data_hints.ts +12 -14
- package/src/kernel/hints/index.ts +1 -2
- package/src/kernel/hints/note_hash_read_request_hints.ts +4 -16
- package/src/kernel/hints/nullifier_read_request_hints.ts +4 -16
- package/src/kernel/hints/private_kernel_reset_hints.ts +7 -7
- package/src/kernel/hints/read_request_hints.ts +22 -22
- package/src/kernel/hints/{transient_data_index_hint.ts → transient_data_squashing_hint.ts} +5 -5
- package/src/kernel/index.ts +1 -0
- package/src/kernel/private_accumulated_data.ts +23 -23
- package/src/kernel/private_call_data.ts +3 -3
- package/src/kernel/private_circuit_public_inputs.ts +92 -68
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -1
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +13 -4
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +20 -20
- package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +7 -7
- package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +16 -10
- package/src/kernel/private_validation_requests.ts +19 -50
- package/src/kernel/utils/order_and_comparison.ts +0 -25
- package/src/logs/shared_secret_derivation.ts +1 -1
- package/src/messaging/l2_to_l1_membership.ts +76 -85
- package/src/messaging/l2_to_l1_message.ts +9 -0
- package/src/note/notes_filter.ts +6 -3
- package/src/p2p/attestation_utils.ts +35 -0
- package/src/p2p/block_attestation.ts +3 -4
- package/src/p2p/block_proposal.ts +23 -5
- package/src/p2p/consensus_payload.ts +10 -29
- package/src/p2p/index.ts +1 -0
- package/src/p2p/topic_type.ts +3 -1
- package/src/slashing/index.ts +74 -0
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +37 -27
- package/src/tests/mocks.ts +24 -22
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +11 -9
- package/src/tx/processed_tx.ts +6 -6
- package/src/tx/proven_tx.ts +7 -8
- package/src/tx/simulated_tx.ts +13 -19
- package/src/tx/tx.ts +70 -57
- package/src/tx/tx_effect.ts +5 -20
- package/src/tx/tx_execution_request.ts +2 -2
- package/src/tx/tx_hash.ts +21 -1
- package/src/tx/tx_request.ts +7 -6
- package/src/tx/validator/error_texts.ts +1 -0
- package/src/tx/validator/tx_validator.ts +5 -0
- package/src/versioning/versioning.ts +0 -3
- package/src/vks/verification_key.ts +4 -7
- package/dest/interfaces/tx-collector.d.ts +0 -15
- package/dest/interfaces/tx-collector.d.ts.map +0 -1
- package/dest/kernel/hints/rollup_validation_requests.d.ts +0 -34
- package/dest/kernel/hints/rollup_validation_requests.d.ts.map +0 -1
- package/dest/kernel/hints/rollup_validation_requests.js +0 -55
- package/dest/kernel/hints/transient_data_index_hint.d.ts.map +0 -1
- package/dest/shared_mutable/index.d.ts +0 -5
- package/dest/shared_mutable/index.d.ts.map +0 -1
- package/dest/shared_mutable/index.js +0 -4
- package/dest/shared_mutable/scheduled_delay_change.d.ts.map +0 -1
- package/dest/shared_mutable/scheduled_value_change.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values.d.ts +0 -20
- package/dest/shared_mutable/shared_mutable_values.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values_with_hash.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values_with_hash.js +0 -30
- package/dest/tx/include_by_timestamp.d.ts +0 -54
- package/dest/tx/include_by_timestamp.d.ts.map +0 -1
- package/dest/tx/include_by_timestamp.js +0 -72
- package/src/interfaces/tx-collector.ts +0 -17
- package/src/kernel/hints/rollup_validation_requests.ts +0 -71
- package/src/shared_mutable/index.ts +0 -4
- package/src/shared_mutable/shared_mutable_values_with_hash.ts +0 -38
- package/src/tx/include_by_timestamp.ts +0 -90
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.d.ts +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.js +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.d.ts +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.js +0 -0
- /package/dest/interfaces/{tx-collector.js → tx_provider.js} +0 -0
- /package/src/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.ts +0 -0
- /package/src/{shared_mutable → delayed_public_mutable}/scheduled_value_change.ts +0 -0
|
@@ -2,7 +2,6 @@ import { type ZodFor } from '@aztec/foundation/schemas';
|
|
|
2
2
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { type ContractArtifact } from '../abi/abi.js';
|
|
5
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
6
5
|
import { type ContractInstanceWithAddress } from '../contract/interfaces/contract_instance.js';
|
|
7
6
|
import type { GasUsed } from '../gas/gas_used.js';
|
|
8
7
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
@@ -16,14 +15,13 @@ export type ContractOverrides = Record<string, {
|
|
|
16
15
|
}>;
|
|
17
16
|
export declare class SimulationOverrides {
|
|
18
17
|
contracts?: ContractOverrides | undefined;
|
|
19
|
-
|
|
20
|
-
constructor(contracts?: ContractOverrides | undefined, msgSender?: AztecAddress | undefined);
|
|
18
|
+
constructor(contracts?: ContractOverrides | undefined);
|
|
21
19
|
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
22
20
|
contracts: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
23
21
|
instance: z.ZodIntersection<z.ZodObject<{
|
|
24
22
|
version: z.ZodLiteral<1>;
|
|
25
23
|
salt: ZodFor<import("@aztec/foundation/schemas").Fr>;
|
|
26
|
-
deployer: ZodFor<AztecAddress>;
|
|
24
|
+
deployer: ZodFor<import("../aztec-address/index.js").AztecAddress>;
|
|
27
25
|
currentContractClassId: ZodFor<import("@aztec/foundation/schemas").Fr>;
|
|
28
26
|
originalContractClassId: ZodFor<import("@aztec/foundation/schemas").Fr>;
|
|
29
27
|
initializationHash: ZodFor<import("@aztec/foundation/schemas").Fr>;
|
|
@@ -52,7 +50,7 @@ export declare class SimulationOverrides {
|
|
|
52
50
|
version: 1;
|
|
53
51
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
54
52
|
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
55
|
-
deployer: AztecAddress;
|
|
53
|
+
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
56
54
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
57
55
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
58
56
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
@@ -70,9 +68,9 @@ export declare class SimulationOverrides {
|
|
|
70
68
|
originalContractClassId?: any;
|
|
71
69
|
initializationHash?: any;
|
|
72
70
|
}>, z.ZodObject<{
|
|
73
|
-
address: ZodFor<AztecAddress>;
|
|
71
|
+
address: ZodFor<import("../aztec-address/index.js").AztecAddress>;
|
|
74
72
|
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
address: AztecAddress;
|
|
73
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
76
74
|
}, {
|
|
77
75
|
address?: any;
|
|
78
76
|
}>>;
|
|
@@ -82,12 +80,12 @@ export declare class SimulationOverrides {
|
|
|
82
80
|
version: 1;
|
|
83
81
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
84
82
|
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
85
|
-
deployer: AztecAddress;
|
|
83
|
+
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
86
84
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
87
85
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
88
86
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
89
87
|
} & {
|
|
90
|
-
address: AztecAddress;
|
|
88
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
91
89
|
};
|
|
92
90
|
artifact: ContractArtifact;
|
|
93
91
|
}, {
|
|
@@ -109,25 +107,22 @@ export declare class SimulationOverrides {
|
|
|
109
107
|
};
|
|
110
108
|
artifact?: any;
|
|
111
109
|
}>>>;
|
|
112
|
-
msgSender: import("@aztec/foundation/schemas").ZodNullableOptional<ZodFor<AztecAddress>>;
|
|
113
110
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
msgSender?: AztecAddress | undefined;
|
|
115
111
|
contracts?: Record<string, {
|
|
116
112
|
instance: {
|
|
117
113
|
version: 1;
|
|
118
114
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
119
115
|
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
120
|
-
deployer: AztecAddress;
|
|
116
|
+
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
121
117
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
122
118
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
123
119
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
124
120
|
} & {
|
|
125
|
-
address: AztecAddress;
|
|
121
|
+
address: import("../aztec-address/index.js").AztecAddress;
|
|
126
122
|
};
|
|
127
123
|
artifact: ContractArtifact;
|
|
128
124
|
}> | undefined;
|
|
129
125
|
}, {
|
|
130
|
-
msgSender?: any;
|
|
131
126
|
contracts?: Record<string, {
|
|
132
127
|
instance: {
|
|
133
128
|
version: 1;
|
|
@@ -148,7 +143,6 @@ export declare class SimulationOverrides {
|
|
|
148
143
|
artifact?: any;
|
|
149
144
|
}> | undefined;
|
|
150
145
|
}>, SimulationOverrides, {
|
|
151
|
-
msgSender?: any;
|
|
152
146
|
contracts?: Record<string, {
|
|
153
147
|
instance: {
|
|
154
148
|
version: 1;
|
|
@@ -175,7 +169,7 @@ export declare class PrivateSimulationResult {
|
|
|
175
169
|
publicInputs: PrivateKernelTailCircuitPublicInputs;
|
|
176
170
|
constructor(privateExecutionResult: PrivateExecutionResult, publicInputs: PrivateKernelTailCircuitPublicInputs);
|
|
177
171
|
getPrivateReturnValues(): NestedProcessReturnValues;
|
|
178
|
-
toSimulatedTx(): Tx
|
|
172
|
+
toSimulatedTx(): Promise<Tx>;
|
|
179
173
|
}
|
|
180
174
|
export declare class TxSimulationResult {
|
|
181
175
|
privateExecutionResult: PrivateExecutionResult;
|
|
@@ -189,7 +183,7 @@ export declare class TxSimulationResult {
|
|
|
189
183
|
static fromPrivateSimulationResultAndPublicOutput(privateSimulationResult: PrivateSimulationResult, publicOutput?: PublicSimulationOutput, stats?: SimulationStats): TxSimulationResult;
|
|
190
184
|
static random(): Promise<TxSimulationResult>;
|
|
191
185
|
getPrivateReturnValues(): NestedProcessReturnValues;
|
|
192
|
-
toSimulatedTx(): Tx
|
|
186
|
+
toSimulatedTx(): Promise<Tx>;
|
|
193
187
|
getPublicReturnValues(): NestedProcessReturnValues[];
|
|
194
188
|
}
|
|
195
189
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulated_tx.d.ts","sourceRoot":"","sources":["../../src/tx/simulated_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,eAAe,CAAC;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"simulated_tx.d.ts","sourceRoot":"","sources":["../../src/tx/simulated_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAE9G,OAAO,EAEL,sBAAsB,EAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,C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AChD,YAAY,CAAC,EAAE,sBAAsB,EACrC,KAAK,CAAC,EAAE,eAAe;WAUZ,MAAM;IAQnB,sBAAsB;IAItB,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC;IAI5B,qBAAqB;CAGtB;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,sBAAsB,GAAG,yBAAyB,CAWhH"}
|
package/dest/tx/simulated_tx.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { optional } from '@aztec/foundation/schemas';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { ContractArtifactSchema } from '../abi/abi.js';
|
|
4
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
4
|
import { ContractInstanceWithAddressSchema } from '../contract/interfaces/contract_instance.js';
|
|
6
5
|
import { Gas } from '../gas/gas.js';
|
|
7
6
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
@@ -15,20 +14,17 @@ import { Tx } from './tx.js';
|
|
|
15
14
|
* set, it *must* be run without the kernel circuits, or validations will fail
|
|
16
15
|
*/ export class SimulationOverrides {
|
|
17
16
|
contracts;
|
|
18
|
-
|
|
19
|
-
constructor(contracts, msgSender){
|
|
17
|
+
constructor(contracts){
|
|
20
18
|
this.contracts = contracts;
|
|
21
|
-
this.msgSender = msgSender;
|
|
22
19
|
}
|
|
23
20
|
static get schema() {
|
|
24
21
|
return z.object({
|
|
25
22
|
contracts: optional(z.record(z.string(), z.object({
|
|
26
23
|
instance: ContractInstanceWithAddressSchema,
|
|
27
24
|
artifact: ContractArtifactSchema
|
|
28
|
-
})))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return new SimulationOverrides(contracts, msgSender);
|
|
25
|
+
})))
|
|
26
|
+
}).transform(({ contracts })=>{
|
|
27
|
+
return new SimulationOverrides(contracts);
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
30
|
}
|
|
@@ -42,10 +38,14 @@ export class PrivateSimulationResult {
|
|
|
42
38
|
getPrivateReturnValues() {
|
|
43
39
|
return accumulatePrivateReturnValues(this.privateExecutionResult);
|
|
44
40
|
}
|
|
45
|
-
toSimulatedTx() {
|
|
41
|
+
async toSimulatedTx() {
|
|
46
42
|
const contractClassLogs = collectSortedContractClassLogs(this.privateExecutionResult);
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
return await Tx.create({
|
|
44
|
+
data: this.publicInputs,
|
|
45
|
+
clientIvcProof: ClientIvcProof.empty(),
|
|
46
|
+
contractClassLogFields: contractClassLogs,
|
|
47
|
+
publicFunctionCalldata: this.privateExecutionResult.publicFunctionCalldata
|
|
48
|
+
});
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
export class TxSimulationResult {
|
|
@@ -102,7 +102,7 @@ export class TxSimulationResult {
|
|
|
102
102
|
*/ export function accumulatePrivateReturnValues(executionResult) {
|
|
103
103
|
const collectPrivateReturnValuesRecursive = (executionResult)=>{
|
|
104
104
|
const acc = new NestedProcessReturnValues(executionResult.returnValues);
|
|
105
|
-
acc.nested = executionResult.
|
|
105
|
+
acc.nested = executionResult.nestedExecutionResults.map((nestedExecutionResult)=>collectPrivateReturnValuesRecursive(nestedExecutionResult));
|
|
106
106
|
return acc;
|
|
107
107
|
};
|
|
108
108
|
return collectPrivateReturnValuesRecursive(executionResult.entrypoint);
|
package/dest/tx/tx.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { TxHash } from './tx_hash.js';
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class Tx extends Gossipable {
|
|
22
22
|
#private;
|
|
23
|
+
/** Identifier of the tx */
|
|
24
|
+
readonly txHash: TxHash;
|
|
23
25
|
/**
|
|
24
26
|
* Output of the private kernel circuit for this tx.
|
|
25
27
|
*/
|
|
@@ -34,15 +36,16 @@ export declare class Tx extends Gossipable {
|
|
|
34
36
|
* Their order should match the order of the log hashes returned from `this.data.getNonEmptyContractClassLogsHashes`.
|
|
35
37
|
* It's checked in data_validator.ts
|
|
36
38
|
*/
|
|
37
|
-
contractClassLogFields: ContractClassLogFields[];
|
|
39
|
+
readonly contractClassLogFields: ContractClassLogFields[];
|
|
38
40
|
/**
|
|
39
41
|
* An array of calldata for the enqueued public function calls and the teardown function call.
|
|
40
42
|
*/
|
|
41
|
-
publicFunctionCalldata: HashedValues[];
|
|
43
|
+
readonly publicFunctionCalldata: HashedValues[];
|
|
42
44
|
static p2pTopic: TopicType;
|
|
43
|
-
private txHash;
|
|
44
45
|
private calldataMap;
|
|
45
46
|
constructor(
|
|
47
|
+
/** Identifier of the tx */
|
|
48
|
+
txHash: TxHash,
|
|
46
49
|
/**
|
|
47
50
|
* Output of the private kernel circuit for this tx.
|
|
48
51
|
*/
|
|
@@ -83,6 +86,8 @@ export declare class Tx extends Gossipable {
|
|
|
83
86
|
*/
|
|
84
87
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
85
88
|
static get schema(): ZodFor<Tx>;
|
|
89
|
+
static computeTxHash(fields: Pick<FieldsOf<Tx>, 'data'>): Promise<TxHash>;
|
|
90
|
+
static create(fields: Omit<FieldsOf<Tx>, 'txHash'>): Promise<Tx>;
|
|
86
91
|
static from(fields: FieldsOf<Tx>): Tx;
|
|
87
92
|
/**
|
|
88
93
|
* Gets public logs emitted by this tx.
|
|
@@ -98,38 +103,26 @@ export declare class Tx extends Gossipable {
|
|
|
98
103
|
*/
|
|
99
104
|
getSplitContractClassLogs(revertible: boolean): ContractClassLog[];
|
|
100
105
|
/**
|
|
101
|
-
*
|
|
106
|
+
* Return transaction hash.
|
|
102
107
|
* @returns The hash of the public inputs of the private kernel tail circuit.
|
|
103
108
|
*/
|
|
104
|
-
getTxHash(
|
|
109
|
+
getTxHash(): TxHash;
|
|
105
110
|
/**
|
|
106
111
|
* Allows setting the hash of the Tx.
|
|
107
112
|
* Use this when you want to skip computing it from the original data.
|
|
108
113
|
* Don't set a Tx hash received from an untrusted source.
|
|
109
114
|
* @param hash - The hash to set.
|
|
110
115
|
*/
|
|
111
|
-
setTxHash(
|
|
116
|
+
setTxHash(_hash: TxHash): this;
|
|
112
117
|
getCalldataMap(): Map<string, Fr[]>;
|
|
113
118
|
/** Returns stats about this tx. */
|
|
114
|
-
getStats():
|
|
119
|
+
getStats(): TxStats;
|
|
115
120
|
getSize(): number;
|
|
116
121
|
/**
|
|
117
122
|
* Estimates the tx size based on its private effects. Note that the actual size of the tx
|
|
118
123
|
* after processing will probably be larger, as public execution would generate more data.
|
|
119
124
|
*/
|
|
120
125
|
getEstimatedPrivateTxEffectsSize(): number;
|
|
121
|
-
/**
|
|
122
|
-
* Convenience function to get a hash out of a tx or a tx-like.
|
|
123
|
-
* @param tx - Tx-like object.
|
|
124
|
-
* @returns - The hash.
|
|
125
|
-
*/
|
|
126
|
-
static getHash(tx: Tx | HasHash): Promise<TxHash>;
|
|
127
|
-
/**
|
|
128
|
-
* Convenience function to get array of hashes for an array of txs.
|
|
129
|
-
* @param txs - The txs to get the hashes from.
|
|
130
|
-
* @returns The corresponding array of hashes.
|
|
131
|
-
*/
|
|
132
|
-
static getHashes(txs: (Tx | HasHash)[]): Promise<TxHash[]>;
|
|
133
126
|
/**
|
|
134
127
|
* Clones a tx, making a deep copy of all fields.
|
|
135
128
|
* @param tx - The transaction to be cloned.
|
|
@@ -141,11 +134,18 @@ export declare class Tx extends Gossipable {
|
|
|
141
134
|
* @param randomProof - Whether to create a random proof - this will be random bytes of the full size.
|
|
142
135
|
* @returns A random tx.
|
|
143
136
|
*/
|
|
144
|
-
static random(
|
|
137
|
+
static random(args?: {
|
|
138
|
+
randomProof?: boolean;
|
|
139
|
+
txHash?: string | TxHash;
|
|
140
|
+
}): Tx;
|
|
141
|
+
/** Recomputes the tx hash. Used for testing purposes only when a property of the tx was mutated. */
|
|
142
|
+
recomputeHash(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Helper class to handle Serialization and Deserialization of Txs array.
|
|
146
|
+
*/
|
|
147
|
+
export declare class TxArray extends Array<Tx> {
|
|
148
|
+
static fromBuffer(buffer: Buffer | BufferReader): TxArray;
|
|
149
|
+
toBuffer(): Buffer;
|
|
145
150
|
}
|
|
146
|
-
/** Utility type for an entity that has a hash property for a txhash */
|
|
147
|
-
type HasHash = {
|
|
148
|
-
hash: TxHash;
|
|
149
|
-
};
|
|
150
|
-
export {};
|
|
151
151
|
//# sourceMappingURL=tx.d.ts.map
|
package/dest/tx/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/tx/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAyD,MAAM,6BAA6B,CAAC;AAClH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE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AC,qBAAqB,CAAC;IAI9E,oBAAoB,IAAI,gBAAgB,EAAE;IAW1C;;;;OAIG;IACH,yBAAyB,CAAC,UAAU,EAAE,OAAO,GAAG,gBAAgB,EAAE;IAYlE;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM;IAIvB,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC;IAUnC,mCAAmC;IACnC,QAAQ,IAAI,OAAO;IAmBnB,OAAO;IASP;;;OAGG;IACH,gCAAgC;IAShC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE;IAUxB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,GAAG,EAAE;IAUjF,oGAAoG;IACvF,aAAa;CAW3B;AAED;;GAEG;AACH,qBAAa,OAAQ,SAAQ,KAAK,CAAC,EAAE,CAAC;IACpC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO;IAWlD,QAAQ,IAAI,MAAM;CAG1B"}
|
package/dest/tx/tx.js
CHANGED
|
@@ -14,15 +14,14 @@ import { TxHash } from './tx_hash.js';
|
|
|
14
14
|
/**
|
|
15
15
|
* The interface of an L2 transaction.
|
|
16
16
|
*/ export class Tx extends Gossipable {
|
|
17
|
+
txHash;
|
|
17
18
|
data;
|
|
18
19
|
clientIvcProof;
|
|
19
20
|
contractClassLogFields;
|
|
20
21
|
publicFunctionCalldata;
|
|
21
22
|
static p2pTopic = TopicType.tx;
|
|
22
|
-
// For memoization
|
|
23
|
-
txHash;
|
|
24
23
|
calldataMap;
|
|
25
|
-
constructor(/**
|
|
24
|
+
constructor(/** Identifier of the tx */ txHash, /**
|
|
26
25
|
* Output of the private kernel circuit for this tx.
|
|
27
26
|
*/ data, /**
|
|
28
27
|
* Proof from the private kernel circuit.
|
|
@@ -34,11 +33,11 @@ import { TxHash } from './tx_hash.js';
|
|
|
34
33
|
*/ contractClassLogFields, /**
|
|
35
34
|
* An array of calldata for the enqueued public function calls and the teardown function call.
|
|
36
35
|
*/ publicFunctionCalldata){
|
|
37
|
-
super(), this.data = data, this.clientIvcProof = clientIvcProof, this.contractClassLogFields = contractClassLogFields, this.publicFunctionCalldata = publicFunctionCalldata;
|
|
36
|
+
super(), this.txHash = txHash, this.data = data, this.clientIvcProof = clientIvcProof, this.contractClassLogFields = contractClassLogFields, this.publicFunctionCalldata = publicFunctionCalldata;
|
|
38
37
|
}
|
|
39
38
|
// Gossipable method
|
|
40
|
-
|
|
41
|
-
return new Buffer32(
|
|
39
|
+
generateP2PMessageIdentifier() {
|
|
40
|
+
return Promise.resolve(new Buffer32(this.getTxHash().toBuffer()));
|
|
42
41
|
}
|
|
43
42
|
hasPublicCalls() {
|
|
44
43
|
return this.numberOfPublicCalls() > 0;
|
|
@@ -79,13 +78,14 @@ import { TxHash } from './tx_hash.js';
|
|
|
79
78
|
* @returns An instance of Tx.
|
|
80
79
|
*/ static fromBuffer(buffer) {
|
|
81
80
|
const reader = BufferReader.asReader(buffer);
|
|
82
|
-
return new Tx(reader.readObject(PrivateKernelTailCircuitPublicInputs), reader.readObject(ClientIvcProof), reader.readVectorUint8Prefix(ContractClassLogFields), reader.readVectorUint8Prefix(HashedValues));
|
|
81
|
+
return new Tx(reader.readObject(TxHash), reader.readObject(PrivateKernelTailCircuitPublicInputs), reader.readObject(ClientIvcProof), reader.readVectorUint8Prefix(ContractClassLogFields), reader.readVectorUint8Prefix(HashedValues));
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
84
|
* Serializes the Tx object into a Buffer.
|
|
86
85
|
* @returns Buffer representation of the Tx object.
|
|
87
86
|
*/ toBuffer() {
|
|
88
87
|
return serializeToBuffer([
|
|
88
|
+
this.txHash,
|
|
89
89
|
this.data,
|
|
90
90
|
this.clientIvcProof,
|
|
91
91
|
serializeArrayOfBufferableToVector(this.contractClassLogFields, 1),
|
|
@@ -98,18 +98,29 @@ import { TxHash } from './tx_hash.js';
|
|
|
98
98
|
clientIvcProof: ClientIvcProof.schema,
|
|
99
99
|
contractClassLogFields: z.array(ContractClassLogFields.schema),
|
|
100
100
|
publicFunctionCalldata: z.array(HashedValues.schema)
|
|
101
|
-
}).transform(Tx.
|
|
101
|
+
}).transform(Tx.create);
|
|
102
|
+
}
|
|
103
|
+
static async computeTxHash(fields) {
|
|
104
|
+
const hash = fields.data.forPublic ? await fields.data.toPrivateToPublicKernelCircuitPublicInputs().hash() : await fields.data.toPrivateToRollupKernelCircuitPublicInputs().hash();
|
|
105
|
+
return new TxHash(hash);
|
|
106
|
+
}
|
|
107
|
+
static async create(fields) {
|
|
108
|
+
const txHash = await Tx.computeTxHash(fields);
|
|
109
|
+
return Tx.from({
|
|
110
|
+
...fields,
|
|
111
|
+
txHash
|
|
112
|
+
});
|
|
102
113
|
}
|
|
103
114
|
static from(fields) {
|
|
104
|
-
return new Tx(fields.data, fields.clientIvcProof, fields.contractClassLogFields, fields.publicFunctionCalldata);
|
|
115
|
+
return new Tx(fields.txHash, fields.data, fields.clientIvcProof, fields.contractClassLogFields, fields.publicFunctionCalldata);
|
|
105
116
|
}
|
|
106
117
|
/**
|
|
107
118
|
* Gets public logs emitted by this tx.
|
|
108
119
|
* @param logsSource - An instance of `L2LogsSource` which can be used to obtain the logs.
|
|
109
120
|
* @returns The requested logs.
|
|
110
|
-
*/
|
|
121
|
+
*/ getPublicLogs(logsSource) {
|
|
111
122
|
return logsSource.getPublicLogs({
|
|
112
|
-
txHash:
|
|
123
|
+
txHash: this.getTxHash()
|
|
113
124
|
});
|
|
114
125
|
}
|
|
115
126
|
getContractClassLogs() {
|
|
@@ -133,13 +144,9 @@ import { TxHash } from './tx_hash.js';
|
|
|
133
144
|
return revertible ? contractClassLogs.slice(numNonRevertible) : contractClassLogs.slice(0, numNonRevertible);
|
|
134
145
|
}
|
|
135
146
|
/**
|
|
136
|
-
*
|
|
147
|
+
* Return transaction hash.
|
|
137
148
|
* @returns The hash of the public inputs of the private kernel tail circuit.
|
|
138
|
-
*/
|
|
139
|
-
if (!this.txHash || forceRecompute) {
|
|
140
|
-
const hash = this.data.forPublic ? await this.data.toPrivateToPublicKernelCircuitPublicInputs().hash() : await this.data.toPrivateToRollupKernelCircuitPublicInputs().hash();
|
|
141
|
-
this.txHash = new TxHash(hash);
|
|
142
|
-
}
|
|
149
|
+
*/ getTxHash() {
|
|
143
150
|
return this.txHash;
|
|
144
151
|
}
|
|
145
152
|
/**
|
|
@@ -147,8 +154,8 @@ import { TxHash } from './tx_hash.js';
|
|
|
147
154
|
* Use this when you want to skip computing it from the original data.
|
|
148
155
|
* Don't set a Tx hash received from an untrusted source.
|
|
149
156
|
* @param hash - The hash to set.
|
|
150
|
-
*/ setTxHash(
|
|
151
|
-
this
|
|
157
|
+
*/ setTxHash(_hash) {
|
|
158
|
+
return this;
|
|
152
159
|
}
|
|
153
160
|
getCalldataMap() {
|
|
154
161
|
if (!this.calldataMap) {
|
|
@@ -158,13 +165,13 @@ import { TxHash } from './tx_hash.js';
|
|
|
158
165
|
}
|
|
159
166
|
return this.calldataMap;
|
|
160
167
|
}
|
|
161
|
-
/** Returns stats about this tx. */
|
|
168
|
+
/** Returns stats about this tx. */ getStats() {
|
|
162
169
|
return {
|
|
163
|
-
txHash:
|
|
170
|
+
txHash: this.txHash.toString(),
|
|
164
171
|
noteHashCount: this.data.getNonEmptyNoteHashes().length,
|
|
165
172
|
nullifierCount: this.data.getNonEmptyNullifiers().length,
|
|
166
173
|
privateLogCount: this.data.getNonEmptyPrivateLogs().length,
|
|
167
|
-
|
|
174
|
+
classPublishedCount: this.data.getNonEmptyContractClassLogsHashes().length,
|
|
168
175
|
contractClassLogSize: this.data.getEmittedContractClassLogsLength(),
|
|
169
176
|
proofSize: this.clientIvcProof.clientIvcProofBuffer.length,
|
|
170
177
|
size: this.toBuffer().length,
|
|
@@ -182,20 +189,6 @@ import { TxHash } from './tx_hash.js';
|
|
|
182
189
|
return this.data.getNonEmptyNoteHashes().length * Fr.SIZE_IN_BYTES + this.data.getNonEmptyNullifiers().length * Fr.SIZE_IN_BYTES + this.data.getEmittedPrivateLogsLength() * Fr.SIZE_IN_BYTES + this.data.getEmittedContractClassLogsLength() * Fr.SIZE_IN_BYTES;
|
|
183
190
|
}
|
|
184
191
|
/**
|
|
185
|
-
* Convenience function to get a hash out of a tx or a tx-like.
|
|
186
|
-
* @param tx - Tx-like object.
|
|
187
|
-
* @returns - The hash.
|
|
188
|
-
*/ static async getHash(tx) {
|
|
189
|
-
return hasHash(tx) ? tx.hash : await tx.getTxHash();
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Convenience function to get array of hashes for an array of txs.
|
|
193
|
-
* @param txs - The txs to get the hashes from.
|
|
194
|
-
* @returns The corresponding array of hashes.
|
|
195
|
-
*/ static async getHashes(txs) {
|
|
196
|
-
return await Promise.all(txs.map(Tx.getHash));
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
192
|
* Clones a tx, making a deep copy of all fields.
|
|
200
193
|
* @param tx - The transaction to be cloned.
|
|
201
194
|
* @returns The cloned transaction.
|
|
@@ -204,22 +197,28 @@ import { TxHash } from './tx_hash.js';
|
|
|
204
197
|
const clientIvcProof = ClientIvcProof.fromBuffer(tx.clientIvcProof.toBuffer());
|
|
205
198
|
const contractClassLogFields = tx.contractClassLogFields.map((p)=>p.clone());
|
|
206
199
|
const publicFunctionCalldata = tx.publicFunctionCalldata.map((cd)=>HashedValues.fromBuffer(cd.toBuffer()));
|
|
207
|
-
const clonedTx = new Tx(publicInputs, clientIvcProof, contractClassLogFields, publicFunctionCalldata);
|
|
208
|
-
if (tx.txHash) {
|
|
209
|
-
clonedTx.setTxHash(TxHash.fromBuffer(tx.txHash.toBuffer()));
|
|
210
|
-
}
|
|
200
|
+
const clonedTx = new Tx(tx.txHash, publicInputs, clientIvcProof, contractClassLogFields, publicFunctionCalldata);
|
|
211
201
|
return clonedTx;
|
|
212
202
|
}
|
|
213
203
|
/**
|
|
214
204
|
* Creates a random tx.
|
|
215
205
|
* @param randomProof - Whether to create a random proof - this will be random bytes of the full size.
|
|
216
206
|
* @returns A random tx.
|
|
217
|
-
*/ static random(
|
|
218
|
-
return
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
207
|
+
*/ static random(args = {}) {
|
|
208
|
+
return Tx.from({
|
|
209
|
+
txHash: (typeof args.txHash === 'string' ? TxHash.fromString(args.txHash) : args.txHash) ?? TxHash.random(),
|
|
210
|
+
data: PrivateKernelTailCircuitPublicInputs.emptyWithNullifier(),
|
|
211
|
+
clientIvcProof: args.randomProof ? ClientIvcProof.random() : ClientIvcProof.empty(),
|
|
212
|
+
contractClassLogFields: [
|
|
213
|
+
ContractClassLogFields.random()
|
|
214
|
+
],
|
|
215
|
+
publicFunctionCalldata: [
|
|
216
|
+
HashedValues.random()
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/** Recomputes the tx hash. Used for testing purposes only when a property of the tx was mutated. */ async recomputeHash() {
|
|
221
|
+
this.txHash = await Tx.computeTxHash(this);
|
|
223
222
|
}
|
|
224
223
|
#combinePublicCallRequestWithCallData(request) {
|
|
225
224
|
const calldataMap = this.getCalldataMap();
|
|
@@ -229,6 +228,19 @@ import { TxHash } from './tx_hash.js';
|
|
|
229
228
|
return new PublicCallRequestWithCalldata(request, calldata);
|
|
230
229
|
}
|
|
231
230
|
}
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
/**
|
|
232
|
+
* Helper class to handle Serialization and Deserialization of Txs array.
|
|
233
|
+
*/ export class TxArray extends Array {
|
|
234
|
+
static fromBuffer(buffer) {
|
|
235
|
+
try {
|
|
236
|
+
const reader = BufferReader.asReader(buffer);
|
|
237
|
+
const txs = reader.readVector(Tx);
|
|
238
|
+
return new TxArray(...txs);
|
|
239
|
+
} catch {
|
|
240
|
+
return new TxArray();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
toBuffer() {
|
|
244
|
+
return serializeArrayOfBufferableToVector(this);
|
|
245
|
+
}
|
|
234
246
|
}
|
package/dest/tx/tx_effect.d.ts
CHANGED
|
@@ -108,9 +108,9 @@ export declare class TxEffect {
|
|
|
108
108
|
static fromBuffer(buffer: Buffer | BufferReader): TxEffect;
|
|
109
109
|
/**
|
|
110
110
|
* Computes txOutHash of this tx effect.
|
|
111
|
-
* @dev Follows new_sha in
|
|
111
|
+
* @dev Follows new_sha in unbalanced_merkle_tree.nr
|
|
112
112
|
*/
|
|
113
|
-
txOutHash(): Buffer
|
|
113
|
+
txOutHash(): Buffer;
|
|
114
114
|
static random(numPublicCallsPerTx?: number, numPublicLogsPerCall?: number, maxEffects?: number | undefined): Promise<TxEffect>;
|
|
115
115
|
static empty(): TxEffect;
|
|
116
116
|
isEmpty(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/tx_effect.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/tx_effect.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,WAAW,EAGZ,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,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_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTES_PREFIX, NULLIFIERS_PREFIX, PRIVATE_LOGS_PREFIX, PUBLIC_DATA_UPDATE_REQUESTS_PREFIX, PUBLIC_LOGS_PREFIX, REVERT_CODE_PREFIX, TX_FEE_PREFIX } from '@aztec/constants';
|
|
2
2
|
import { makeTuple, makeTupleAsync } from '@aztec/foundation/array';
|
|
3
3
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
4
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
|
-
import { sha256Trunc } from '@aztec/foundation/crypto';
|
|
6
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
7
5
|
import { schemas } from '@aztec/foundation/schemas';
|
|
8
6
|
import { BufferReader, FieldReader, serializeArrayOfBufferableToVector, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
9
7
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
8
|
+
import { computeUnbalancedMerkleTreeRoot } from '@aztec/foundation/trees';
|
|
10
9
|
import { inspect } from 'util';
|
|
11
10
|
import { z } from 'zod';
|
|
12
11
|
import { PublicDataWrite } from '../avm/public_data_write.js';
|
|
@@ -137,27 +136,13 @@ export class TxEffect {
|
|
|
137
136
|
}
|
|
138
137
|
/**
|
|
139
138
|
* Computes txOutHash of this tx effect.
|
|
140
|
-
* @dev Follows new_sha in
|
|
139
|
+
* @dev Follows new_sha in unbalanced_merkle_tree.nr
|
|
141
140
|
*/ txOutHash() {
|
|
142
141
|
const { l2ToL1Msgs } = this;
|
|
143
142
|
if (l2ToL1Msgs.length == 0) {
|
|
144
143
|
return Buffer.alloc(32);
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
let thisLayer = padArrayEnd(l2ToL1Msgs.map((msg)=>msg.toBuffer()), Buffer.alloc(32), 2 ** depth);
|
|
148
|
-
let nextLayer = [];
|
|
149
|
-
for(let i = 0; i < depth; i++){
|
|
150
|
-
for(let j = 0; j < thisLayer.length; j += 2){
|
|
151
|
-
// Store the hash of each pair one layer up
|
|
152
|
-
nextLayer[j / 2] = sha256Trunc(Buffer.concat([
|
|
153
|
-
thisLayer[j],
|
|
154
|
-
thisLayer[j + 1]
|
|
155
|
-
]));
|
|
156
|
-
}
|
|
157
|
-
thisLayer = nextLayer;
|
|
158
|
-
nextLayer = [];
|
|
159
|
-
}
|
|
160
|
-
return thisLayer[0];
|
|
145
|
+
return computeUnbalancedMerkleTreeRoot(l2ToL1Msgs.map((msg)=>msg.toBuffer()));
|
|
161
146
|
}
|
|
162
147
|
static async random(numPublicCallsPerTx = 3, numPublicLogsPerCall = 1, maxEffects = undefined) {
|
|
163
148
|
return new TxEffect(RevertCode.random(), TxHash.random(), new Fr(Math.floor(Math.random() * 100_000)), makeTuple(maxEffects === undefined ? MAX_NOTE_HASHES_PER_TX : Math.min(maxEffects, MAX_NOTE_HASHES_PER_TX), Fr.random), makeTuple(maxEffects === undefined ? MAX_NULLIFIERS_PER_TX : Math.min(maxEffects, MAX_NULLIFIERS_PER_TX), Fr.random), makeTuple(maxEffects === undefined ? MAX_L2_TO_L1_MSGS_PER_TX : Math.min(maxEffects, MAX_L2_TO_L1_MSGS_PER_TX), Fr.random), makeTuple(maxEffects === undefined ? MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX : Math.min(maxEffects, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX), PublicDataWrite.random), makeTuple(MAX_PRIVATE_LOGS_PER_TX, ()=>PrivateLog.random()), await makeTupleAsync(numPublicCallsPerTx * numPublicLogsPerCall, async ()=>await PublicLog.random()), await makeTupleAsync(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLog.random));
|
|
@@ -68,8 +68,8 @@ import { TxRequest } from './tx_request.js';
|
|
|
68
68
|
}).transform(TxExecutionRequest.from);
|
|
69
69
|
}
|
|
70
70
|
toTxRequest() {
|
|
71
|
-
return new TxRequest(this.origin, // Entrypoints must be private as
|
|
72
|
-
new FunctionData(this.functionSelector, true), this.
|
|
71
|
+
return new TxRequest(this.origin, this.firstCallArgsHash, this.txContext, // Entrypoints must be private as defined by the protocol.
|
|
72
|
+
new FunctionData(this.functionSelector, true), this.salt);
|
|
73
73
|
}
|
|
74
74
|
static getFields(fields) {
|
|
75
75
|
return [
|
package/dest/tx/tx_hash.d.ts
CHANGED
|
@@ -24,4 +24,11 @@ export declare class TxHash {
|
|
|
24
24
|
static zero(): TxHash;
|
|
25
25
|
static get SIZE(): number;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Helper class to handle Serialization and Deserialization of TxHashes array.
|
|
29
|
+
**/
|
|
30
|
+
export declare class TxHashArray extends Array<TxHash> {
|
|
31
|
+
static fromBuffer(buffer: Buffer | BufferReader): TxHashArray;
|
|
32
|
+
toBuffer(): Buffer;
|
|
33
|
+
}
|
|
27
34
|
//# sourceMappingURL=tx_hash.d.ts.map
|
package/dest/tx/tx_hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/tx/tx_hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/tx/tx_hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAsC,MAAM,6BAA6B,CAAC;AAI/F;;;GAGG;AACH,qBAAa,MAAM;IAEf,mGAAmG;aACnF,IAAI,EAAE,EAAE;;IADxB,mGAAmG;IACnF,IAAI,EAAE,EAAE;IAG1B,MAAM,CAAC,MAAM;IAIb,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY;IAKnD,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM;IAI/B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE;IAInB,QAAQ;IAIR,QAAQ;IAIR,QAAQ;IAIf,MAAM;IAIC,MAAM,CAAC,KAAK,EAAE,MAAM;IAI3B,MAAM,KAAK,MAAM,iNAEhB;IAED,MAAM,CAAC,IAAI;IAIX,MAAM,KAAK,IAAI,WAEd;CACF;AAED;;IAEI;AACJ,qBAAa,WAAY,SAAQ,KAAK,CAAC,MAAM,CAAC;IAC5C,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAWxC,QAAQ,IAAI,MAAM;CAG1B"}
|
package/dest/tx/tx_hash.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
2
|
+
import { BufferReader, serializeArrayOfBufferableToVector } from '@aztec/foundation/serialize';
|
|
3
3
|
import { schemas } from '../schemas/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* A class representing hash of Aztec transaction.
|
|
@@ -50,3 +50,21 @@ import { schemas } from '../schemas/index.js';
|
|
|
50
50
|
return Fr.SIZE_IN_BYTES;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Helper class to handle Serialization and Deserialization of TxHashes array.
|
|
55
|
+
**/ export class TxHashArray extends Array {
|
|
56
|
+
static fromBuffer(buffer) {
|
|
57
|
+
try {
|
|
58
|
+
const reader = BufferReader.asReader(buffer);
|
|
59
|
+
const hashes = reader.readVector(TxHash);
|
|
60
|
+
return new TxHashArray(...hashes);
|
|
61
|
+
} catch {
|
|
62
|
+
return new TxHashArray();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
toBuffer() {
|
|
66
|
+
return serializeArrayOfBufferableToVector([
|
|
67
|
+
...this
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
}
|