@aztec/simulator 0.73.0 → 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2
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/acvm/acvm.js +18 -21
- package/dest/acvm/acvm_types.js +3 -2
- package/dest/acvm/deserialize.js +9 -13
- package/dest/acvm/index.js +0 -1
- package/dest/acvm/oracle/index.js +0 -1
- package/dest/acvm/oracle/oracle.js +42 -23
- package/dest/acvm/oracle/typed_oracle.js +36 -38
- package/dest/acvm/serialize.js +7 -14
- package/dest/avm/avm_context.js +24 -27
- package/dest/avm/avm_contract_call_result.js +12 -7
- package/dest/avm/avm_execution_environment.js +10 -7
- package/dest/avm/avm_gas.js +93 -56
- package/dest/avm/avm_machine_state.js +60 -61
- package/dest/avm/avm_memory_types.js +166 -255
- package/dest/avm/avm_simulator.js +68 -47
- package/dest/avm/avm_tree.js +282 -276
- package/dest/avm/bytecode_utils.js +8 -6
- package/dest/avm/errors.js +46 -63
- package/dest/avm/fixtures/avm_simulation_tester.js +20 -20
- package/dest/avm/fixtures/base_avm_simulation_tester.js +21 -16
- package/dest/avm/fixtures/index.js +49 -22
- package/dest/avm/fixtures/simple_contract_data_source.js +9 -13
- package/dest/avm/index.js +0 -1
- package/dest/avm/journal/index.js +0 -1
- package/dest/avm/journal/journal.js +147 -200
- package/dest/avm/journal/nullifiers.js +43 -46
- package/dest/avm/journal/public_storage.js +73 -87
- package/dest/avm/opcodes/accrued_substate.js +140 -110
- package/dest/avm/opcodes/addressing_mode.js +29 -31
- package/dest/avm/opcodes/arithmetic.js +17 -15
- package/dest/avm/opcodes/bitwise.js +40 -26
- package/dest/avm/opcodes/comparators.js +12 -10
- package/dest/avm/opcodes/contract.js +31 -29
- package/dest/avm/opcodes/control_flow.js +47 -43
- package/dest/avm/opcodes/conversion.js +30 -26
- package/dest/avm/opcodes/ec_add.js +35 -34
- package/dest/avm/opcodes/environment_getters.js +33 -33
- package/dest/avm/opcodes/external_calls.js +83 -74
- package/dest/avm/opcodes/hashing.js +69 -61
- package/dest/avm/opcodes/index.js +0 -1
- package/dest/avm/opcodes/instruction.js +31 -40
- package/dest/avm/opcodes/instruction_impl.js +12 -15
- package/dest/avm/opcodes/memory.js +177 -156
- package/dest/avm/opcodes/misc.js +27 -25
- package/dest/avm/opcodes/multi_scalar_mul.js +43 -41
- package/dest/avm/opcodes/storage.js +28 -25
- package/dest/avm/serialization/buffer_cursor.js +4 -4
- package/dest/avm/serialization/bytecode_serialization.js +292 -89
- package/dest/avm/serialization/instruction_serialization.js +67 -28
- package/dest/avm/test_utils.js +6 -9
- package/dest/client/client_execution_context.js +197 -219
- package/dest/client/db_oracle.js +4 -7
- package/dest/client/execution_note_cache.js +80 -81
- package/dest/client/index.js +0 -1
- package/dest/client/pick_notes.js +27 -30
- package/dest/client/private_execution.js +13 -14
- package/dest/client/simulator.js +44 -48
- package/dest/client/unconstrained_execution.js +8 -11
- package/dest/client/view_data_oracle.js +130 -139
- package/dest/common/debug_fn_name.js +1 -4
- package/dest/common/errors.js +30 -39
- package/dest/common/hashed_values_cache.js +16 -20
- package/dest/common/index.js +0 -1
- package/dest/common/message_load_oracle_inputs.js +7 -7
- package/dest/common/simulation_provider.js +3 -6
- package/dest/common.js +0 -1
- package/dest/providers/acvm_native.js +46 -32
- package/dest/providers/acvm_wasm.js +18 -10
- package/dest/providers/acvm_wasm_with_blobs.js +2 -5
- package/dest/providers/factory.js +5 -5
- package/dest/providers/index.js +0 -1
- package/dest/public/bytecode_errors.js +1 -2
- package/dest/public/db_interfaces.js +1 -2
- package/dest/public/execution.js +2 -4
- package/dest/public/executor_metrics.js +16 -12
- package/dest/public/fee_payment.js +2 -5
- package/dest/public/fixtures/index.js +0 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +15 -20
- package/dest/public/fixtures/utils.js +11 -14
- package/dest/public/index.js +0 -1
- package/dest/public/public_db_sources.js +79 -87
- package/dest/public/public_processor.js +310 -306
- package/dest/public/public_processor_metrics.js +46 -27
- package/dest/public/public_tx_context.js +97 -118
- package/dest/public/public_tx_simulator.js +299 -314
- package/dest/public/side_effect_errors.js +1 -2
- package/dest/public/side_effect_trace.js +44 -105
- package/dest/public/side_effect_trace_interface.js +1 -2
- package/dest/public/unique_class_ids.js +22 -27
- package/dest/public/utils.js +16 -11
- package/dest/server.js +0 -1
- package/dest/stats/index.js +0 -1
- package/dest/stats/stats.js +1 -2
- package/dest/test/utils.js +5 -4
- package/package.json +11 -11
- package/src/acvm/oracle/typed_oracle.ts +34 -34
- package/src/avm/avm_machine_state.ts +18 -14
- package/src/avm/avm_memory_types.ts +43 -183
- package/src/avm/avm_simulator.ts +37 -11
- package/src/avm/fixtures/avm_simulation_tester.ts +2 -3
- package/src/avm/fixtures/index.ts +39 -0
- package/src/avm/opcodes/accrued_substate.ts +7 -21
- package/src/avm/opcodes/addressing_mode.ts +9 -2
- package/src/avm/opcodes/arithmetic.ts +1 -3
- package/src/avm/opcodes/bitwise.ts +2 -6
- package/src/avm/opcodes/comparators.ts +1 -3
- package/src/avm/opcodes/contract.ts +1 -3
- package/src/avm/opcodes/control_flow.ts +1 -9
- package/src/avm/opcodes/conversion.ts +1 -3
- package/src/avm/opcodes/ec_add.ts +1 -3
- package/src/avm/opcodes/environment_getters.ts +1 -3
- package/src/avm/opcodes/external_calls.ts +3 -6
- package/src/avm/opcodes/hashing.ts +3 -9
- package/src/avm/opcodes/memory.ts +6 -20
- package/src/avm/opcodes/misc.ts +1 -3
- package/src/avm/opcodes/multi_scalar_mul.ts +1 -7
- package/src/avm/opcodes/storage.ts +2 -6
- package/src/client/index.ts +2 -2
- package/src/public/fixtures/public_tx_simulation_tester.ts +2 -3
- package/src/public/side_effect_trace.ts +1 -42
- package/src/public/side_effect_trace_interface.ts +0 -21
- package/dest/acvm/acvm.d.ts +0 -35
- package/dest/acvm/acvm.d.ts.map +0 -1
- package/dest/acvm/acvm_types.d.ts +0 -10
- package/dest/acvm/acvm_types.d.ts.map +0 -1
- package/dest/acvm/deserialize.d.ts +0 -36
- package/dest/acvm/deserialize.d.ts.map +0 -1
- package/dest/acvm/index.d.ts +0 -6
- package/dest/acvm/index.d.ts.map +0 -1
- package/dest/acvm/oracle/index.d.ts +0 -14
- package/dest/acvm/oracle/index.d.ts.map +0 -1
- package/dest/acvm/oracle/oracle.d.ts +0 -49
- package/dest/acvm/oracle/oracle.d.ts.map +0 -1
- package/dest/acvm/oracle/typed_oracle.d.ts +0 -75
- package/dest/acvm/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/acvm/serialize.d.ts +0 -20
- package/dest/acvm/serialize.d.ts.map +0 -1
- package/dest/avm/avm_context.d.ts +0 -39
- package/dest/avm/avm_context.d.ts.map +0 -1
- package/dest/avm/avm_contract_call_result.d.ts +0 -30
- package/dest/avm/avm_contract_call_result.d.ts.map +0 -1
- package/dest/avm/avm_execution_environment.d.ts +0 -21
- package/dest/avm/avm_execution_environment.d.ts.map +0 -1
- package/dest/avm/avm_gas.d.ts +0 -60
- package/dest/avm/avm_gas.d.ts.map +0 -1
- package/dest/avm/avm_machine_state.d.ts +0 -93
- package/dest/avm/avm_machine_state.d.ts.map +0 -1
- package/dest/avm/avm_memory_types.d.ts +0 -310
- package/dest/avm/avm_memory_types.d.ts.map +0 -1
- package/dest/avm/avm_simulator.d.ts +0 -37
- package/dest/avm/avm_simulator.d.ts.map +0 -1
- package/dest/avm/avm_tree.d.ts +0 -281
- package/dest/avm/avm_tree.d.ts.map +0 -1
- package/dest/avm/bytecode_utils.d.ts +0 -5
- package/dest/avm/bytecode_utils.d.ts.map +0 -1
- package/dest/avm/errors.d.ts +0 -121
- package/dest/avm/errors.d.ts.map +0 -1
- package/dest/avm/fixtures/avm_simulation_tester.d.ts +0 -21
- package/dest/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
- package/dest/avm/fixtures/base_avm_simulation_tester.d.ts +0 -35
- package/dest/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
- package/dest/avm/fixtures/index.d.ts +0 -63
- package/dest/avm/fixtures/index.d.ts.map +0 -1
- package/dest/avm/fixtures/simple_contract_data_source.d.ts +0 -31
- package/dest/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
- package/dest/avm/index.d.ts +0 -4
- package/dest/avm/index.d.ts.map +0 -1
- package/dest/avm/journal/index.d.ts +0 -2
- package/dest/avm/journal/index.d.ts.map +0 -1
- package/dest/avm/journal/journal.d.ts +0 -176
- package/dest/avm/journal/journal.d.ts.map +0 -1
- package/dest/avm/journal/nullifiers.d.ts +0 -62
- package/dest/avm/journal/nullifiers.d.ts.map +0 -1
- package/dest/avm/journal/public_storage.d.ts +0 -66
- package/dest/avm/journal/public_storage.d.ts.map +0 -1
- package/dest/avm/opcodes/accrued_substate.d.ts +0 -75
- package/dest/avm/opcodes/accrued_substate.d.ts.map +0 -1
- package/dest/avm/opcodes/addressing_mode.d.ts +0 -27
- package/dest/avm/opcodes/addressing_mode.d.ts.map +0 -1
- package/dest/avm/opcodes/arithmetic.d.ts +0 -37
- package/dest/avm/opcodes/arithmetic.d.ts.map +0 -1
- package/dest/avm/opcodes/bitwise.d.ts +0 -50
- package/dest/avm/opcodes/bitwise.d.ts.map +0 -1
- package/dest/avm/opcodes/comparators.d.ts +0 -25
- package/dest/avm/opcodes/comparators.d.ts.map +0 -1
- package/dest/avm/opcodes/contract.d.ts +0 -21
- package/dest/avm/opcodes/contract.d.ts.map +0 -1
- package/dest/avm/opcodes/control_flow.d.ts +0 -41
- package/dest/avm/opcodes/control_flow.d.ts.map +0 -1
- package/dest/avm/opcodes/conversion.d.ts +0 -17
- package/dest/avm/opcodes/conversion.d.ts.map +0 -1
- package/dest/avm/opcodes/ec_add.d.ts +0 -19
- package/dest/avm/opcodes/ec_add.d.ts.map +0 -1
- package/dest/avm/opcodes/environment_getters.d.ts +0 -28
- package/dest/avm/opcodes/environment_getters.d.ts.map +0 -1
- package/dest/avm/opcodes/external_calls.d.ts +0 -50
- package/dest/avm/opcodes/external_calls.d.ts.map +0 -1
- package/dest/avm/opcodes/hashing.d.ts +0 -36
- package/dest/avm/opcodes/hashing.d.ts.map +0 -1
- package/dest/avm/opcodes/index.d.ts +0 -16
- package/dest/avm/opcodes/index.d.ts.map +0 -1
- package/dest/avm/opcodes/instruction.d.ts +0 -70
- package/dest/avm/opcodes/instruction.d.ts.map +0 -1
- package/dest/avm/opcodes/instruction_impl.d.ts +0 -19
- package/dest/avm/opcodes/instruction_impl.d.ts.map +0 -1
- package/dest/avm/opcodes/memory.d.ts +0 -74
- package/dest/avm/opcodes/memory.d.ts.map +0 -1
- package/dest/avm/opcodes/misc.d.ts +0 -17
- package/dest/avm/opcodes/misc.d.ts.map +0 -1
- package/dest/avm/opcodes/multi_scalar_mul.d.ts +0 -16
- package/dest/avm/opcodes/multi_scalar_mul.d.ts.map +0 -1
- package/dest/avm/opcodes/storage.d.ts +0 -24
- package/dest/avm/opcodes/storage.d.ts.map +0 -1
- package/dest/avm/serialization/buffer_cursor.d.ts +0 -28
- package/dest/avm/serialization/buffer_cursor.d.ts.map +0 -1
- package/dest/avm/serialization/bytecode_serialization.d.ts +0 -21
- package/dest/avm/serialization/bytecode_serialization.d.ts.map +0 -1
- package/dest/avm/serialization/instruction_serialization.d.ts +0 -105
- package/dest/avm/serialization/instruction_serialization.d.ts.map +0 -1
- package/dest/avm/test_utils.d.ts +0 -16
- package/dest/avm/test_utils.d.ts.map +0 -1
- package/dest/client/client_execution_context.d.ts +0 -214
- package/dest/client/client_execution_context.d.ts.map +0 -1
- package/dest/client/db_oracle.d.ts +0 -229
- package/dest/client/db_oracle.d.ts.map +0 -1
- package/dest/client/execution_note_cache.d.ts +0 -93
- package/dest/client/execution_note_cache.d.ts.map +0 -1
- package/dest/client/index.d.ts +0 -15
- package/dest/client/index.d.ts.map +0 -1
- package/dest/client/pick_notes.d.ts +0 -85
- package/dest/client/pick_notes.d.ts.map +0 -1
- package/dest/client/private_execution.d.ts +0 -19
- package/dest/client/private_execution.d.ts.map +0 -1
- package/dest/client/simulator.d.ts +0 -60
- package/dest/client/simulator.d.ts.map +0 -1
- package/dest/client/unconstrained_execution.d.ts +0 -10
- package/dest/client/unconstrained_execution.d.ts.map +0 -1
- package/dest/client/view_data_oracle.d.ts +0 -159
- package/dest/client/view_data_oracle.d.ts.map +0 -1
- package/dest/common/debug_fn_name.d.ts +0 -4
- package/dest/common/debug_fn_name.d.ts.map +0 -1
- package/dest/common/errors.d.ts +0 -54
- package/dest/common/errors.d.ts.map +0 -1
- package/dest/common/hashed_values_cache.d.ts +0 -28
- package/dest/common/hashed_values_cache.d.ts.map +0 -1
- package/dest/common/index.d.ts +0 -3
- package/dest/common/index.d.ts.map +0 -1
- package/dest/common/message_load_oracle_inputs.d.ts +0 -15
- package/dest/common/message_load_oracle_inputs.d.ts.map +0 -1
- package/dest/common/simulation_provider.d.ts +0 -19
- package/dest/common/simulation_provider.d.ts.map +0 -1
- package/dest/common.d.ts +0 -2
- package/dest/common.d.ts.map +0 -1
- package/dest/providers/acvm_native.d.ts +0 -40
- package/dest/providers/acvm_native.d.ts.map +0 -1
- package/dest/providers/acvm_wasm.d.ts +0 -15
- package/dest/providers/acvm_wasm.d.ts.map +0 -1
- package/dest/providers/acvm_wasm_with_blobs.d.ts +0 -19
- package/dest/providers/acvm_wasm_with_blobs.d.ts.map +0 -1
- package/dest/providers/factory.d.ts +0 -12
- package/dest/providers/factory.d.ts.map +0 -1
- package/dest/providers/index.d.ts +0 -5
- package/dest/providers/index.d.ts.map +0 -1
- package/dest/public/bytecode_errors.d.ts +0 -4
- package/dest/public/bytecode_errors.d.ts.map +0 -1
- package/dest/public/db_interfaces.d.ts +0 -105
- package/dest/public/db_interfaces.d.ts.map +0 -1
- package/dest/public/execution.d.ts +0 -102
- package/dest/public/execution.d.ts.map +0 -1
- package/dest/public/executor_metrics.d.ts +0 -13
- package/dest/public/executor_metrics.d.ts.map +0 -1
- package/dest/public/fee_payment.d.ts +0 -11
- package/dest/public/fee_payment.d.ts.map +0 -1
- package/dest/public/fixtures/index.d.ts +0 -3
- package/dest/public/fixtures/index.d.ts.map +0 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +0 -21
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +0 -1
- package/dest/public/fixtures/utils.d.ts +0 -17
- package/dest/public/fixtures/utils.d.ts.map +0 -1
- package/dest/public/index.d.ts +0 -9
- package/dest/public/index.d.ts.map +0 -1
- package/dest/public/public_db_sources.d.ts +0 -81
- package/dest/public/public_db_sources.d.ts.map +0 -1
- package/dest/public/public_processor.d.ts +0 -72
- package/dest/public/public_processor.d.ts.map +0 -1
- package/dest/public/public_processor_metrics.d.ts +0 -27
- package/dest/public/public_processor_metrics.d.ts.map +0 -1
- package/dest/public/public_tx_context.d.ts +0 -131
- package/dest/public/public_tx_context.d.ts.map +0 -1
- package/dest/public/public_tx_simulator.d.ts +0 -99
- package/dest/public/public_tx_simulator.d.ts.map +0 -1
- package/dest/public/side_effect_errors.d.ts +0 -4
- package/dest/public/side_effect_errors.d.ts.map +0 -1
- package/dest/public/side_effect_trace.d.ts +0 -146
- package/dest/public/side_effect_trace.d.ts.map +0 -1
- package/dest/public/side_effect_trace_interface.d.ts +0 -49
- package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
- package/dest/public/unique_class_ids.d.ts +0 -37
- package/dest/public/unique_class_ids.d.ts.map +0 -1
- package/dest/public/utils.d.ts +0 -5
- package/dest/public/utils.d.ts.map +0 -1
- package/dest/server.d.ts +0 -6
- package/dest/server.d.ts.map +0 -1
- package/dest/stats/index.d.ts +0 -2
- package/dest/stats/index.d.ts.map +0 -1
- package/dest/stats/stats.d.ts +0 -4
- package/dest/stats/stats.d.ts.map +0 -1
- package/dest/test/utils.d.ts +0 -12
- package/dest/test/utils.d.ts.map +0 -1
package/dest/avm/avm_tree.d.ts
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { type IndexedTreeId, MerkleTreeId, type MerkleTreeReadOperations } from '@aztec/circuit-types';
|
|
2
|
-
import { AppendOnlyTreeSnapshot, NullifierLeafPreimage, PublicDataTreeLeafPreimage } from '@aztec/circuits.js';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { type IndexedTreeLeafPreimage, type TreeLeafPreimage } from '@aztec/foundation/trees';
|
|
5
|
-
/****************************************************/
|
|
6
|
-
/****** Structs Used by the AvmEphemeralForest ******/
|
|
7
|
-
/****************************************************/
|
|
8
|
-
/**
|
|
9
|
-
* The preimage and the leaf index of the Low Leaf (Low Nullifier or Low Public Data Leaf)
|
|
10
|
-
*/
|
|
11
|
-
type PreimageWitness<T extends IndexedTreeLeafPreimage> = {
|
|
12
|
-
preimage: T;
|
|
13
|
-
index: bigint;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* The result of fetching a leaf from an indexed tree. Contains the preimage and wether the leaf was already present
|
|
17
|
-
* or it's a low leaf.
|
|
18
|
-
*/
|
|
19
|
-
type GetLeafResult<T extends IndexedTreeLeafPreimage> = PreimageWitness<T> & {
|
|
20
|
-
alreadyPresent: boolean;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Contains the low sibling path and a boolean if the next index pointed to
|
|
24
|
-
* by the low leaf is an update or an insertion (i.e. exists or not).
|
|
25
|
-
*/
|
|
26
|
-
type LeafWitness<T extends IndexedTreeLeafPreimage> = PreimageWitness<T> & {
|
|
27
|
-
siblingPath: Fr[];
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The result of an update in an indexed merkle tree (no new leaf inserted)
|
|
31
|
-
*/
|
|
32
|
-
type IndexedUpdateResult<T extends IndexedTreeLeafPreimage> = {
|
|
33
|
-
element: T;
|
|
34
|
-
lowWitness: LeafWitness<T>;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* The result of an insertion in an indexed merkle tree.
|
|
38
|
-
* This will be used to hint the circuit
|
|
39
|
-
*/
|
|
40
|
-
export type IndexedInsertResult<T extends IndexedTreeLeafPreimage> = IndexedUpdateResult<T> & {
|
|
41
|
-
leafIndex: bigint;
|
|
42
|
-
insertionPath: Fr[];
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* The result of an indexed upsert in an indexed merkle tree.
|
|
46
|
-
* This will be used to hint the circuit
|
|
47
|
-
*/
|
|
48
|
-
export type IndexedUpsertResult<T extends IndexedTreeLeafPreimage> = (IndexedUpdateResult<T> & {
|
|
49
|
-
update: true;
|
|
50
|
-
}) | (IndexedInsertResult<T> & {
|
|
51
|
-
update: false;
|
|
52
|
-
});
|
|
53
|
-
/****************************************************/
|
|
54
|
-
/****** The AvmEphemeralForest Class ****************/
|
|
55
|
-
/****************************************************/
|
|
56
|
-
/**
|
|
57
|
-
* This provides a forkable abstraction over the EphemeralAvmTree class
|
|
58
|
-
* It contains the logic to look up into a read-only MerkleTreeDb to discover
|
|
59
|
-
* the sibling paths and low witnesses that weren't inserted as part of this tx
|
|
60
|
-
*/
|
|
61
|
-
export declare class AvmEphemeralForest {
|
|
62
|
-
treeDb: MerkleTreeReadOperations;
|
|
63
|
-
treeMap: Map<MerkleTreeId, EphemeralAvmTree>;
|
|
64
|
-
indexedUpdates: Map<IndexedTreeId, Map<bigint, IndexedTreeLeafPreimage>>;
|
|
65
|
-
indexedSortedKeys: Map<IndexedTreeId, [Fr, bigint][]>;
|
|
66
|
-
constructor(treeDb: MerkleTreeReadOperations, treeMap: Map<MerkleTreeId, EphemeralAvmTree>, indexedUpdates: Map<IndexedTreeId, Map<bigint, IndexedTreeLeafPreimage>>, indexedSortedKeys: Map<IndexedTreeId, [Fr, bigint][]>);
|
|
67
|
-
static create(treeDb: MerkleTreeReadOperations): Promise<AvmEphemeralForest>;
|
|
68
|
-
fork(): AvmEphemeralForest;
|
|
69
|
-
/**
|
|
70
|
-
* Gets sibling path for a leaf - if the sibling path is not found in the tree, it is fetched from the DB
|
|
71
|
-
* @param treeId - The tree to be queried for a sibling path.
|
|
72
|
-
* @param index - The index of the leaf for which a sibling path should be returned.
|
|
73
|
-
* @returns The sibling path of the leaf.
|
|
74
|
-
*/
|
|
75
|
-
getSiblingPath(treeId: MerkleTreeId, index: bigint): Promise<Fr[]>;
|
|
76
|
-
/**
|
|
77
|
-
* This does the work of appending the new leaf and updating the low witness
|
|
78
|
-
* @param treeId - The tree to be queried for a sibling path.
|
|
79
|
-
* @param lowWitnessIndex - The index of the low leaf in the tree.
|
|
80
|
-
* @param lowWitness - The preimage of the low leaf.
|
|
81
|
-
* @param newLeafPreimage - The preimage of the new leaf to be inserted.
|
|
82
|
-
* @returns The sibling path of the new leaf (i.e. the insertion path)
|
|
83
|
-
*/
|
|
84
|
-
appendIndexedTree<ID extends IndexedTreeId, T extends IndexedTreeLeafPreimage>(treeId: ID, lowLeafIndex: bigint, lowLeafPreimage: T, newLeafPreimage: T): Promise<Fr[]>;
|
|
85
|
-
/**
|
|
86
|
-
* This writes or updates a slot in the public data tree with a value
|
|
87
|
-
* @param slot - The slot to be written to.
|
|
88
|
-
* @param newValue - The value to be written or updated to
|
|
89
|
-
* @returns The insertion result which contains the insertion path, low leaf and the new leaf index
|
|
90
|
-
*/
|
|
91
|
-
writePublicStorage(slot: Fr, newValue: Fr): Promise<IndexedUpsertResult<PublicDataTreeLeafPreimage>>;
|
|
92
|
-
private _updateSortedKeys;
|
|
93
|
-
/**
|
|
94
|
-
* This appends a nullifier to the nullifier tree, and throws if the nullifier already exists
|
|
95
|
-
* @param value - The nullifier to be appended
|
|
96
|
-
* @returns The insertion result which contains the insertion path, low leaf and the new leaf index
|
|
97
|
-
*/
|
|
98
|
-
appendNullifier(nullifier: Fr): Promise<IndexedInsertResult<NullifierLeafPreimage>>;
|
|
99
|
-
/**
|
|
100
|
-
* This appends a note hash to the note hash tree
|
|
101
|
-
* @param value - The note hash to be appended
|
|
102
|
-
* @returns The insertion result which contains the insertion path
|
|
103
|
-
*/
|
|
104
|
-
appendNoteHash(noteHash: Fr): Promise<Fr[]>;
|
|
105
|
-
/**
|
|
106
|
-
* This is wrapper around treeId to set values in the indexedUpdates map
|
|
107
|
-
*/
|
|
108
|
-
private setIndexedUpdates;
|
|
109
|
-
/**
|
|
110
|
-
* This is wrapper around treeId to get values in the indexedUpdates map.
|
|
111
|
-
* Should only be called if we know the value exists.
|
|
112
|
-
*/
|
|
113
|
-
private getIndexedUpdate;
|
|
114
|
-
/**
|
|
115
|
-
* This is wrapper around treeId to check membership (i.e. has()) of index in the indexedUpdates map
|
|
116
|
-
*/
|
|
117
|
-
private hasLocalUpdates;
|
|
118
|
-
/**
|
|
119
|
-
* Get the leaf or low leaf preimage and its index in the indexed tree given a key (slot or nullifier value).
|
|
120
|
-
* If the key is not found in the tree, it does an external lookup to the underlying merkle DB.
|
|
121
|
-
* @param treeId - The tree we are looking up in
|
|
122
|
-
* @param key - The key for which we are look up the leaf or low leaf for.
|
|
123
|
-
* @param T - The type of the preimage (PublicData or Nullifier)
|
|
124
|
-
* @returns The leaf or low leaf info (preimage & leaf index).
|
|
125
|
-
*/
|
|
126
|
-
getLeafOrLowLeafInfo<ID extends IndexedTreeId, T extends IndexedTreeLeafPreimage>(treeId: ID, key: Fr): Promise<GetLeafResult<T>>;
|
|
127
|
-
/**
|
|
128
|
-
* Internal helper to get the leaf or low leaf preimage and its index in the indexed tree given a key (slot or nullifier value).
|
|
129
|
-
* If the key is not found in the tree, it does an external lookup to the underlying merkle DB.
|
|
130
|
-
* Indicates whethe the sibling path is absent in the ephemeral tree.
|
|
131
|
-
* @param treeId - The tree we are looking up in
|
|
132
|
-
* @param key - The key for which we are look up the leaf or low leaf for.
|
|
133
|
-
* @param T - The type of the preimage (PublicData or Nullifier)
|
|
134
|
-
* @returns [
|
|
135
|
-
* getLeafResult - The leaf or low leaf info (preimage & leaf index),
|
|
136
|
-
* pathAbsentInEphemeralTree - whether its sibling path is absent in the ephemeral tree (useful during insertions)
|
|
137
|
-
* ]
|
|
138
|
-
*/
|
|
139
|
-
_getLeafOrLowLeafInfo<ID extends IndexedTreeId, T extends IndexedTreeLeafPreimage>(treeId: ID, key: Fr): Promise<[GetLeafResult<T>, /*pathAbsentInEphemeralTree=*/ boolean]>;
|
|
140
|
-
/**
|
|
141
|
-
* Helper to search for the leaf with the specified key in the indexedUpdates
|
|
142
|
-
* and return its leafIndex.
|
|
143
|
-
* If not present, return the leafIndex of the largest leaf <= the specified key
|
|
144
|
-
* (the leafIndex of the next lowest key).
|
|
145
|
-
*
|
|
146
|
-
* If no entry exists in indexedUpdates <= the specified key, return -1.
|
|
147
|
-
* @returns - The leafIndex of the leaf with the largest key <= the specified key.
|
|
148
|
-
*/
|
|
149
|
-
private _getLeafIndexOrNextLowestInIndexedUpdates;
|
|
150
|
-
/**
|
|
151
|
-
* Query the external DB to get leaf if present, low leaf if absent
|
|
152
|
-
*/
|
|
153
|
-
private _getLeafOrLowLeafWitnessInExternalDb;
|
|
154
|
-
/**
|
|
155
|
-
* This hashes the preimage to a field element
|
|
156
|
-
*/
|
|
157
|
-
hashPreimage<T extends TreeLeafPreimage>(preimage: T): Promise<Fr>;
|
|
158
|
-
getTreeSnapshot(id: MerkleTreeId): Promise<AppendOnlyTreeSnapshot>;
|
|
159
|
-
}
|
|
160
|
-
/****************************************************/
|
|
161
|
-
/****** Some useful Structs and Enums **************/
|
|
162
|
-
/****************************************************/
|
|
163
|
-
declare enum TreeType {
|
|
164
|
-
LEAF = 0,
|
|
165
|
-
NODE = 1
|
|
166
|
-
}
|
|
167
|
-
type Leaf = {
|
|
168
|
-
tag: TreeType.LEAF;
|
|
169
|
-
value: Fr;
|
|
170
|
-
};
|
|
171
|
-
type Node = {
|
|
172
|
-
tag: TreeType.NODE;
|
|
173
|
-
leftTree: Tree;
|
|
174
|
-
rightTree: Tree;
|
|
175
|
-
};
|
|
176
|
-
type Tree = Leaf | Node;
|
|
177
|
-
/****************************************************/
|
|
178
|
-
/****** Some Helpful Constructors for Trees ********/
|
|
179
|
-
/****************************************************/
|
|
180
|
-
declare const Node: (left: Tree, right: Tree) => Node;
|
|
181
|
-
declare const Leaf: (value: Fr) => Leaf;
|
|
182
|
-
/****************************************************/
|
|
183
|
-
/****** The EphemeralAvmTree Class *****************/
|
|
184
|
-
/****************************************************/
|
|
185
|
-
/**
|
|
186
|
-
* This class contains a recursively defined tree that has leaves at different heights
|
|
187
|
-
* It is seeded by an existing merkle treeDb for which it derives a frontier
|
|
188
|
-
* It is intended to be a lightweight tree that contains only the necessary information to suppport appends or updates
|
|
189
|
-
*/
|
|
190
|
-
export declare class EphemeralAvmTree {
|
|
191
|
-
private root;
|
|
192
|
-
leafCount: bigint;
|
|
193
|
-
depth: number;
|
|
194
|
-
private zeroHashes;
|
|
195
|
-
private tree;
|
|
196
|
-
frontier: Fr[];
|
|
197
|
-
private constructor();
|
|
198
|
-
static create(forkedLeafCount: bigint, depth: number, treeDb: MerkleTreeReadOperations, merkleId: MerkleTreeId): Promise<EphemeralAvmTree>;
|
|
199
|
-
/**
|
|
200
|
-
* This is a recursive function that inserts a leaf into the tree
|
|
201
|
-
* @param value - The value of the leaf to be inserted
|
|
202
|
-
*/
|
|
203
|
-
appendLeaf(value: Fr): void;
|
|
204
|
-
/**
|
|
205
|
-
* This is a recursive function that upserts a leaf into the tree at a index and depth
|
|
206
|
-
* @param value - The value of the leaf to be inserted
|
|
207
|
-
* @param index - The index of the leaf to be inserted
|
|
208
|
-
* @param depth - The depth of the leaf to be inserted (defaults to the bottom of the tree)
|
|
209
|
-
*/
|
|
210
|
-
updateLeaf(value: Fr, index: bigint, depth?: number): void;
|
|
211
|
-
/**
|
|
212
|
-
* Get the sibling path of a leaf in the tree
|
|
213
|
-
* @param index - The index of the leaf for which a sibling path should be returned.
|
|
214
|
-
* @returns The sibling path of the leaf, can fail if the path is not found
|
|
215
|
-
*/
|
|
216
|
-
getSiblingPath(index: bigint): Promise<Fr[] | undefined>;
|
|
217
|
-
/**
|
|
218
|
-
* This upserts the nodes of the sibling path into the tree
|
|
219
|
-
* @param index - The index of the leaf that the sibling path is derived from
|
|
220
|
-
* @param siblingPath - The sibling path of the index
|
|
221
|
-
*/
|
|
222
|
-
insertSiblingPath(index: bigint, siblingPath: Fr[]): void;
|
|
223
|
-
/**
|
|
224
|
-
* This is a helper function that computes the index of the frontier nodes at each depth
|
|
225
|
-
* @param leafCount - The number of leaves in the tree
|
|
226
|
-
* @returns An array of frontier indices at each depth, sorted from leaf to root
|
|
227
|
-
*/
|
|
228
|
-
static computeFrontierLeafIndices(leafCount: number): number[];
|
|
229
|
-
/**
|
|
230
|
-
* This derives the frontier and inserts them into the tree
|
|
231
|
-
* @param treeDb - The treeDb to be queried for sibling paths
|
|
232
|
-
* @param merkleId - The treeId of the tree to be queried for sibling paths
|
|
233
|
-
*/
|
|
234
|
-
initializeFrontier(treeDb: MerkleTreeReadOperations, merkleId: MerkleTreeId): Promise<void>;
|
|
235
|
-
/**
|
|
236
|
-
* Computes the root of the tree
|
|
237
|
-
*/
|
|
238
|
-
getRoot(): Promise<Fr>;
|
|
239
|
-
/**
|
|
240
|
-
* Recursively hashes the subtree
|
|
241
|
-
* @param tree - The tree to be hashed
|
|
242
|
-
* @param depth - The depth of the tree
|
|
243
|
-
*/
|
|
244
|
-
hashTree(tree: Tree, depth: number): Promise<Fr>;
|
|
245
|
-
/**
|
|
246
|
-
* Extracts the subtree from a given index and depth
|
|
247
|
-
* @param index - The index of the node to be extracted
|
|
248
|
-
* @param depth - The depth of the node to be extracted
|
|
249
|
-
* @returns The subtree rooted at the index and depth
|
|
250
|
-
*/
|
|
251
|
-
getNode(index: bigint, depth: number): Tree | undefined;
|
|
252
|
-
/**
|
|
253
|
-
* This is the recursive helper for getNode
|
|
254
|
-
*/
|
|
255
|
-
private _getNode;
|
|
256
|
-
/** Our tree traversal uses an array of 1s and 0s to represent the path to a leaf and expects them to be in LE order
|
|
257
|
-
* This helps with deriving it given an index and (optionally a depth)
|
|
258
|
-
* @param index - The index to derive a path to within the tree, does not have to terminate at a leaf
|
|
259
|
-
* @param depth - The depth to traverse, if not provided it will traverse to the bottom of the tree
|
|
260
|
-
* @returns The path to the leaf in LE order
|
|
261
|
-
*/
|
|
262
|
-
private _derivePathLE;
|
|
263
|
-
/** Sometimes we want it in BE order, to make truncating easier
|
|
264
|
-
* @param index - The index to derive a path to within the tree, does not have to terminate at a leaf
|
|
265
|
-
* @param depth - The depth to traverse, if not provided it will traverse to the bottom of the tree
|
|
266
|
-
* @returns The path to the leaf in LE order
|
|
267
|
-
*/
|
|
268
|
-
private _derivePathBE;
|
|
269
|
-
/**
|
|
270
|
-
* This is a recursive function that upserts a leaf into the tree given a path
|
|
271
|
-
* @param value - The value of the leaf to be upserted
|
|
272
|
-
* @param insertPath - The path to the leaf, this should be ordered from leaf to root (i.e. LE encoded)
|
|
273
|
-
* @param depth - The depth of the tree
|
|
274
|
-
* @param tree - The current tree
|
|
275
|
-
* @param appendMode - If true we append the relevant zeroHashes to the tree as we traverse
|
|
276
|
-
*/
|
|
277
|
-
private _insertLeaf;
|
|
278
|
-
private _getSiblingPath;
|
|
279
|
-
}
|
|
280
|
-
export {};
|
|
281
|
-
//# sourceMappingURL=avm_tree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"avm_tree.d.ts","sourceRoot":"","sources":["../../src/avm/avm_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAE/G,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK9F,sDAAsD;AACtD,sDAAsD;AACtD,sDAAsD;AAEtD;;GAEG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,uBAAuB,IAAI;IACxD,QAAQ,EAAE,CAAC,CAAC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,CAAC,aAAa;IAIrB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAQrB;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;YA4BL,eAAe;CAkC9B"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
export declare function markBytecodeAsAvm(bytecode: Buffer): Buffer;
|
|
4
|
-
export declare function isAvmBytecode(bytecode: Buffer): boolean;
|
|
5
|
-
//# sourceMappingURL=bytecode_utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bytecode_utils.d.ts","sourceRoot":"","sources":["../../src/avm/bytecode_utils.ts"],"names":[],"mappings":";;AASA,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGvD"}
|
package/dest/avm/errors.d.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { type FailingFunction, type NoirCallStack } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress, type Fr, type Point } from '@aztec/circuits.js';
|
|
3
|
-
import { ExecutionError } from '../common/errors.js';
|
|
4
|
-
import { type AvmContext } from './avm_context.js';
|
|
5
|
-
/**
|
|
6
|
-
* Avm-specific errors should derive from this
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class AvmExecutionError extends Error {
|
|
9
|
-
constructor(message: string);
|
|
10
|
-
}
|
|
11
|
-
export declare class NoBytecodeForContractError extends AvmExecutionError {
|
|
12
|
-
constructor(contractAddress: AztecAddress);
|
|
13
|
-
}
|
|
14
|
-
export declare class ArithmeticError extends AvmExecutionError {
|
|
15
|
-
constructor(message: string);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Error is thrown when the program counter goes to an invalid location.
|
|
19
|
-
* There is no instruction at the provided pc
|
|
20
|
-
*/
|
|
21
|
-
export declare class InvalidProgramCounterError extends AvmExecutionError {
|
|
22
|
-
constructor(pc: number, max: number);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Error is thrown when the program counter points to a byte
|
|
26
|
-
* of an invalid opcode.
|
|
27
|
-
*/
|
|
28
|
-
export declare class InvalidOpcodeError extends AvmExecutionError {
|
|
29
|
-
constructor(str: string);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Error is thrown during parsing.
|
|
33
|
-
*/
|
|
34
|
-
export declare class AvmParsingError extends AvmExecutionError {
|
|
35
|
-
constructor(str: string);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Error is thrown when the tag has an invalid value.
|
|
39
|
-
*/
|
|
40
|
-
export declare class InvalidTagValueError extends AvmExecutionError {
|
|
41
|
-
constructor(tagValue: number);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Error thrown during an instruction's execution (during its execute()).
|
|
45
|
-
*/
|
|
46
|
-
export declare class InstructionExecutionError extends AvmExecutionError {
|
|
47
|
-
constructor(message: string);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Error thrown on failed AVM memory tag check.
|
|
51
|
-
*/
|
|
52
|
-
export declare class TagCheckError extends AvmExecutionError {
|
|
53
|
-
static forOffset(offset: number, gotTag: string, expectedTag: string): TagCheckError;
|
|
54
|
-
static forTag(gotTag: string, expectedTag: string): TagCheckError;
|
|
55
|
-
constructor(message: string);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Error is thrown when a relative memory address resolved to an offset which
|
|
59
|
-
* is out of range, i.e, greater than maxUint32.
|
|
60
|
-
*/
|
|
61
|
-
export declare class RelativeAddressOutOfRangeError extends AvmExecutionError {
|
|
62
|
-
constructor(baseAddr: number, relOffset: number);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Error is thrown when a memory slice contains addresses which are
|
|
66
|
-
* out of range, i.e, greater than maxUint32.
|
|
67
|
-
*/
|
|
68
|
-
export declare class MemorySliceOutOfRangeError extends AvmExecutionError {
|
|
69
|
-
constructor(baseAddr: number, size: number);
|
|
70
|
-
}
|
|
71
|
-
/** Error thrown when out of gas. */
|
|
72
|
-
export declare class OutOfGasError extends AvmExecutionError {
|
|
73
|
-
constructor(dimensions: string[]);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Error is thrown when the supplied points length is not a multiple of 3. Specific for MSM opcode.
|
|
77
|
-
*/
|
|
78
|
-
export declare class MSMPointsLengthError extends AvmExecutionError {
|
|
79
|
-
constructor(pointsReadLength: number);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Error is thrown when one of the supplied points does not lie on the Grumpkin curve. Specific for MSM opcode.
|
|
83
|
-
*/
|
|
84
|
-
export declare class MSMPointNotOnCurveError extends AvmExecutionError {
|
|
85
|
-
constructor(point: Point);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Error is thrown when some inputs of ToRadixBE are not valid.
|
|
89
|
-
*/
|
|
90
|
-
export declare class InvalidToRadixInputsError extends AvmExecutionError {
|
|
91
|
-
constructor(errorString: string);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Error is thrown when a static call attempts to alter some state
|
|
95
|
-
*/
|
|
96
|
-
export declare class StaticCallAlterationError extends InstructionExecutionError {
|
|
97
|
-
constructor();
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Meaningfully named alias for ExecutionError when used in the context of the AVM.
|
|
101
|
-
* Maintains a recursive structure reflecting the AVM's external callstack/errorstack, where
|
|
102
|
-
* options.cause is the error that caused this error (if this is not the root-cause itself).
|
|
103
|
-
*/
|
|
104
|
-
export declare class AvmRevertReason extends ExecutionError {
|
|
105
|
-
constructor(message: string, failingFunction: FailingFunction, noirCallStack: NoirCallStack, options?: ErrorOptions);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create a "revert reason" error for an exceptional halt.
|
|
109
|
-
*
|
|
110
|
-
* @param haltingError - the lower-level error causing the exceptional halt
|
|
111
|
-
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
112
|
-
*/
|
|
113
|
-
export declare function revertReasonFromExceptionalHalt(haltingError: AvmExecutionError, context: AvmContext): Promise<AvmRevertReason>;
|
|
114
|
-
/**
|
|
115
|
-
* Create a "revert reason" error for an explicit revert (a root cause).
|
|
116
|
-
*
|
|
117
|
-
* @param revertData - output data of the explicit REVERT instruction
|
|
118
|
-
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
119
|
-
*/
|
|
120
|
-
export declare function revertReasonFromExplicitRevert(revertData: Fr[], context: AvmContext): Promise<AvmRevertReason>;
|
|
121
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dest/avm/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/avm/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,8BAAsB,iBAAkB,SAAQ,KAAK;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,0BAA2B,SAAQ,iBAAiB;gBACnD,eAAe,EAAE,YAAY;CAI1C;AAED,qBAAa,eAAgB,SAAQ,iBAAiB;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,iBAAiB;gBACnD,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAIpC;AAED;;;G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AE,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY;CAGpH;AA8BD;;;;;GAKG;AACH,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,eAAe,CAAC,CAE1B;AAED;;;;;GAKG;AACH,wBAAsB,8BAA8B,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAEpH"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type MerkleTreeWriteOperations } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
|
-
import { type AvmContractCallResult } from '../../avm/avm_contract_call_result.js';
|
|
4
|
-
import { AvmPersistableStateManager } from '../../server.js';
|
|
5
|
-
import { BaseAvmSimulationTester } from './base_avm_simulation_tester.js';
|
|
6
|
-
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
7
|
-
/**
|
|
8
|
-
* A test class that extends the BaseAvmSimulationTester to enable real-app testing of the core AvmSimulator.
|
|
9
|
-
* It provides an interface for simulating one top-level call at a time and maintains state between
|
|
10
|
-
* subsequent top-level calls.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
13
|
-
private stateManager;
|
|
14
|
-
constructor(contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, skipContractDeployments: boolean | undefined, stateManager: AvmPersistableStateManager);
|
|
15
|
-
static create(skipContractDeployments?: boolean): Promise<AvmSimulationTester>;
|
|
16
|
-
/**
|
|
17
|
-
* Simulate a top-level contract call.
|
|
18
|
-
*/
|
|
19
|
-
simulateCall(sender: AztecAddress, address: AztecAddress, fnName: string, args: any[], isStaticCall?: boolean): Promise<AvmContractCallResult>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=avm_simulation_tester.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/avm/fixtures/avm_simulation_tester.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGtE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAUnF,OAAO,EAAE,0BAA0B,EAAgB,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAK5E;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAK5D,OAAO,CAAC,YAAY;gBAHpB,kBAAkB,EAAE,wBAAwB,EAC5C,WAAW,EAAE,yBAAyB,EACtC,uBAAuB,qBAAQ,EACvB,YAAY,EAAE,0BAA0B;WAKrC,MAAM,CAAC,uBAAuB,UAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiBlF;;OAEG;IACG,YAAY,CAChB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EAAE,EACX,YAAY,UAAQ,GACnB,OAAO,CAAC,qBAAqB,CAAC;CAsClC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type MerkleTreeWriteOperations } from '@aztec/circuit-types';
|
|
2
|
-
import { type ContractClassPublic, type ContractInstanceWithAddress } from '@aztec/circuits.js';
|
|
3
|
-
import { type ContractArtifact } from '@aztec/foundation/abi';
|
|
4
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
5
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
6
|
-
import { type SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
7
|
-
/**
|
|
8
|
-
* An abstract test class that enables tests of real apps in the AVM without requiring e2e tests.
|
|
9
|
-
* It enables this by letting us (1) perform pseudo-contract-deployments (and registrations)
|
|
10
|
-
* that trigger merkle tree operations and (2) maintain a contract data source to store
|
|
11
|
-
* and retrieve contract classes and instances.
|
|
12
|
-
*
|
|
13
|
-
* This class is meant to be extended when writing tests for a specific simulation interface.
|
|
14
|
-
* For example, has been extended for testing of the core AvmSimulator, and again for the PublicTxSimulator,
|
|
15
|
-
* both of which benefit from such pseudo-deployments by populating merkle trees and a contract data source
|
|
16
|
-
* with contract information.
|
|
17
|
-
*/
|
|
18
|
-
export declare abstract class BaseAvmSimulationTester {
|
|
19
|
-
contractDataSource: SimpleContractDataSource;
|
|
20
|
-
merkleTrees: MerkleTreeWriteOperations;
|
|
21
|
-
private skipContractDeployments;
|
|
22
|
-
logger: import("@aztec/foundation/log").Logger;
|
|
23
|
-
constructor(contractDataSource: SimpleContractDataSource, merkleTrees: MerkleTreeWriteOperations, skipContractDeployments?: boolean);
|
|
24
|
-
setFeePayerBalance(feePayer: AztecAddress, balance: Fr): Promise<void>;
|
|
25
|
-
setPublicStorage(address: AztecAddress, slot: Fr, value: Fr): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Derive the contract class and instance with some seed.
|
|
28
|
-
* Add both to the contract data source along with the contract artifact.
|
|
29
|
-
*/
|
|
30
|
-
registerAndDeployContract(constructorArgs: any[], deployer: AztecAddress, contractArtifact: ContractArtifact, seed?: number): Promise<ContractInstanceWithAddress>;
|
|
31
|
-
getFirstContractInstance(): ContractInstanceWithAddress;
|
|
32
|
-
addContractClass(contractClass: ContractClassPublic, contractArtifact: ContractArtifact): Promise<void>;
|
|
33
|
-
addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=base_avm_simulation_tester.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{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1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { GlobalVariables } from '@aztec/circuits.js';
|
|
4
|
-
import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/foundation/abi';
|
|
5
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
6
|
-
import { type PublicSideEffectTraceInterface } from '../../public/side_effect_trace_interface.js';
|
|
7
|
-
import { type WorldStateDB } from '../../server.js';
|
|
8
|
-
import { AvmContext } from '../avm_context.js';
|
|
9
|
-
import { AvmExecutionEnvironment } from '../avm_execution_environment.js';
|
|
10
|
-
import { AvmMachineState } from '../avm_machine_state.js';
|
|
11
|
-
import { Field, Uint8, Uint32, Uint64 } from '../avm_memory_types.js';
|
|
12
|
-
import { type AvmEphemeralForest } from '../avm_tree.js';
|
|
13
|
-
import { type AvmRevertReason } from '../errors.js';
|
|
14
|
-
import { AvmPersistableStateManager } from '../journal/journal.js';
|
|
15
|
-
import { NullifierManager } from '../journal/nullifiers.js';
|
|
16
|
-
import { PublicStorage } from '../journal/public_storage.js';
|
|
17
|
-
export declare const PUBLIC_DISPATCH_FN_NAME = "public_dispatch";
|
|
18
|
-
/**
|
|
19
|
-
* Create a new AVM context with default values.
|
|
20
|
-
*/
|
|
21
|
-
export declare function initContext(overrides?: {
|
|
22
|
-
persistableState?: AvmPersistableStateManager;
|
|
23
|
-
env?: AvmExecutionEnvironment;
|
|
24
|
-
machineState?: AvmMachineState;
|
|
25
|
-
}): AvmContext;
|
|
26
|
-
/** Creates an empty state manager with mocked host storage. */
|
|
27
|
-
export declare function initPersistableStateManager(overrides?: {
|
|
28
|
-
worldStateDB?: WorldStateDB;
|
|
29
|
-
trace?: PublicSideEffectTraceInterface;
|
|
30
|
-
publicStorage?: PublicStorage;
|
|
31
|
-
nullifiers?: NullifierManager;
|
|
32
|
-
doMerkleOperations?: boolean;
|
|
33
|
-
merkleTrees?: AvmEphemeralForest;
|
|
34
|
-
firstNullifier?: Fr;
|
|
35
|
-
}): AvmPersistableStateManager;
|
|
36
|
-
/**
|
|
37
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
38
|
-
*/
|
|
39
|
-
export declare function initExecutionEnvironment(overrides?: Partial<AvmExecutionEnvironment>): AvmExecutionEnvironment;
|
|
40
|
-
/**
|
|
41
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
42
|
-
*/
|
|
43
|
-
export declare function initGlobalVariables(overrides?: Partial<GlobalVariables>): GlobalVariables;
|
|
44
|
-
/**
|
|
45
|
-
* Create an empty instance of the Machine State where all values are set to a large enough amount, unless overridden in the overrides object
|
|
46
|
-
*/
|
|
47
|
-
export declare function initMachineState(overrides?: Partial<AvmMachineState>): AvmMachineState;
|
|
48
|
-
/**
|
|
49
|
-
* Create a new object with all the same properties as the original, except for the ones in the overrides object.
|
|
50
|
-
*/
|
|
51
|
-
export declare function allSameExcept(original: any, overrides: any): any;
|
|
52
|
-
export declare function randomMemoryBytes(length: number): Uint8[];
|
|
53
|
-
export declare function randomMemoryUint32s(length: number): Uint32[];
|
|
54
|
-
export declare function randomMemoryUint64s(length: number): Uint64[];
|
|
55
|
-
export declare function randomMemoryFields(length: number): Field[];
|
|
56
|
-
export declare function getFunctionSelector(functionName: string, contractArtifact: ContractArtifact): Promise<FunctionSelector>;
|
|
57
|
-
export declare function getContractFunctionArtifact(functionName: string, contractArtifact: ContractArtifact): FunctionArtifact | undefined;
|
|
58
|
-
export declare function resolveContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[], contractArtifact: ContractArtifact): string | undefined;
|
|
59
|
-
export declare function getAvmTestContractFunctionSelector(functionName: string): Promise<FunctionSelector>;
|
|
60
|
-
export declare function getAvmTestContractArtifact(functionName: string): FunctionArtifact;
|
|
61
|
-
export declare function getAvmTestContractBytecode(functionName: string): Buffer;
|
|
62
|
-
export declare function resolveAvmTestContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[]): string | undefined;
|
|
63
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/avm/fixtures/index.ts"],"names":[],"mappings":";;AACA,OAAO,EAAW,eAAe,EAAoC,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGvG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAQ9C,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAClG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE;IACtC,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;IAC9C,GAAG,CAAC,EAAE,uBAAuB,CAAC;IAC9B,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC,GAAG,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B,EAAE,gBAAgB,GACjC,gBAAgB,GAAG,SAAS,CAM9B;AAED,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,EAAE,EAAE,EACZ,gBAAgB,EAAE,gBAAgB,GACjC,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,kCAAkC,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAElG;AAED,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAOjF;AAED,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED,wBAAgB,sCAAsC,CACpD,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,EAAE,EAAE,GACX,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress, type FunctionSelector, type PublicFunction } from '@aztec/circuits.js';
|
|
2
|
-
import { type ContractArtifact } from '@aztec/foundation/abi';
|
|
3
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
5
|
-
/**
|
|
6
|
-
* This class is used during public/avm testing to function as a database of
|
|
7
|
-
* contract contract classes and instances. Tests can populate it with classes
|
|
8
|
-
* and instances and then probe it via the ContractDataSource interface.
|
|
9
|
-
*
|
|
10
|
-
* This class does not include any real merkle trees & merkle operations.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SimpleContractDataSource implements ContractDataSource {
|
|
13
|
-
logger: import("@aztec/foundation/log").Logger;
|
|
14
|
-
private contractClasses;
|
|
15
|
-
private contractInstances;
|
|
16
|
-
private contractArtifacts;
|
|
17
|
-
getFirstContractInstance(): ContractInstanceWithAddress;
|
|
18
|
-
addContractArtifact(classId: Fr, artifact: ContractArtifact): void;
|
|
19
|
-
getPublicFunction(_address: AztecAddress, _selector: FunctionSelector): Promise<PublicFunction>;
|
|
20
|
-
getBlockNumber(): Promise<number>;
|
|
21
|
-
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
22
|
-
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
23
|
-
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
24
|
-
getContractClassIds(): Promise<Fr[]>;
|
|
25
|
-
getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined>;
|
|
26
|
-
getContractFunctionName(_address: AztecAddress, _selector: FunctionSelector): Promise<string>;
|
|
27
|
-
registerContractFunctionSignatures(_address: AztecAddress, _signatures: string[]): Promise<void>;
|
|
28
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
29
|
-
addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=simple_contract_data_source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple_contract_data_source.d.ts","sourceRoot":"","sources":["../../../src/avm/fixtures/simple_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAKnD;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IAC1D,MAAM,yCAA+C;IAG5D,OAAO,CAAC,eAAe,CAA+C;IAEtE,OAAO,CAAC,iBAAiB,CAAuD;IAEhF,OAAO,CAAC,i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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/avm/journal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|