@aztec/simulator 2.1.0-rc.9 → 3.0.0-devnet.2
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/private/acvm_native.d.ts +1 -2
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.d.ts +2 -1
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +5 -2
- package/dest/public/avm/avm_gas.js +2 -2
- package/dest/public/avm/avm_simulator.d.ts +1 -1
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +14 -21
- package/dest/public/avm/errors.d.ts +5 -14
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +7 -20
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +2 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +2 -3
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +2 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +22 -0
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.js +2 -2
- package/dest/public/avm/opcodes/accrued_substate.d.ts +2 -2
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +7 -7
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/public/avm/opcodes/addressing_mode.js +2 -3
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/public/avm/opcodes/conversion.js +3 -0
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
- package/dest/public/avm/opcodes/ec_add.js +3 -2
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +5 -7
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction.js +5 -6
- package/dest/public/avm/opcodes/misc.d.ts +2 -1
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/public/avm/opcodes/misc.js +28 -8
- package/dest/public/avm/serialization/instruction_serialization.d.ts +8 -0
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +10 -0
- package/dest/public/avm/test_utils.d.ts +2 -2
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +6 -9
- package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
- package/dest/public/fixtures/bulk_test.js +63 -130
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +12 -0
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tester.js +29 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +9 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tests.js +109 -0
- package/dest/public/fixtures/index.d.ts +2 -1
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +2 -1
- package/dest/public/fixtures/minimal_public_tx.d.ts +2 -1
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
- package/dest/public/fixtures/minimal_public_tx.js +8 -22
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +4 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +11 -6
- package/dest/public/fixtures/utils.js +1 -1
- package/dest/public/hinting_db_sources.d.ts +2 -0
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +3 -0
- package/dest/public/index.d.ts +1 -1
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/public_db_sources.d.ts +2 -2
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +11 -1
- package/dest/public/public_errors.d.ts +12 -0
- package/dest/public/public_errors.d.ts.map +1 -0
- package/dest/public/public_errors.js +13 -0
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +2 -0
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +3 -0
- package/dest/public/public_processor/public_processor.d.ts +9 -4
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +12 -6
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +41 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +89 -0
- package/dest/public/public_tx_simulator/index.d.ts +1 -0
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +5 -4
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +3 -4
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +4 -2
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +12 -8
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +24 -11
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +112 -44
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +9 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.js +1 -0
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +2 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +2 -2
- package/dest/public/side_effect_errors.d.ts +41 -1
- package/dest/public/side_effect_errors.d.ts.map +1 -1
- package/dest/public/side_effect_errors.js +70 -1
- package/dest/public/side_effect_trace.d.ts +11 -4
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +35 -20
- package/dest/public/side_effect_trace_interface.d.ts +6 -0
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.d.ts +0 -3
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.js +1 -6
- package/dest/public/state_manager/state_manager.d.ts +7 -2
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +54 -15
- package/package.json +21 -17
- package/src/private/acvm_native.ts +1 -2
- package/src/private/circuit_recording/simulator_recorder_wrapper.ts +1 -1
- package/src/public/avm/avm_execution_environment.ts +4 -1
- package/src/public/avm/avm_gas.ts +2 -2
- package/src/public/avm/avm_simulator.ts +16 -27
- package/src/public/avm/errors.ts +7 -24
- package/src/public/avm/fixtures/avm_simulation_tester.ts +4 -2
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +32 -0
- package/src/public/avm/fixtures/initializers.ts +2 -1
- package/src/public/avm/opcodes/accrued_substate.ts +4 -4
- package/src/public/avm/opcodes/addressing_mode.ts +3 -3
- package/src/public/avm/opcodes/conversion.ts +4 -0
- package/src/public/avm/opcodes/ec_add.ts +3 -2
- package/src/public/avm/opcodes/environment_getters.ts +6 -8
- package/src/public/avm/opcodes/instruction.ts +8 -6
- package/src/public/avm/opcodes/misc.ts +41 -7
- package/src/public/avm/serialization/instruction_serialization.ts +12 -0
- package/src/public/avm/test_utils.ts +6 -14
- package/src/public/fixtures/bulk_test.ts +41 -23
- package/src/public/fixtures/custom_bytecode_tester.ts +49 -0
- package/src/public/fixtures/custom_bytecode_tests.ts +135 -0
- package/src/public/fixtures/index.ts +2 -1
- package/src/public/fixtures/minimal_public_tx.ts +8 -31
- package/src/public/fixtures/public_tx_simulation_tester.ts +16 -12
- package/src/public/fixtures/utils.ts +1 -1
- package/src/public/hinting_db_sources.ts +5 -0
- package/src/public/index.ts +6 -1
- package/src/public/public_db_sources.ts +19 -3
- package/src/public/public_errors.ts +14 -0
- package/src/public/public_processor/guarded_merkle_tree.ts +4 -0
- package/src/public/public_processor/public_processor.ts +23 -25
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +128 -0
- package/src/public/public_tx_simulator/index.ts +1 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +12 -9
- package/src/public/public_tx_simulator/public_tx_context.ts +11 -4
- package/src/public/public_tx_simulator/public_tx_simulator.ts +178 -60
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +11 -0
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +3 -12
- package/src/public/side_effect_errors.ts +91 -1
- package/src/public/side_effect_trace.ts +48 -23
- package/src/public/side_effect_trace_interface.ts +6 -0
- package/src/public/state_manager/nullifiers.ts +1 -7
- package/src/public/state_manager/state_manager.ts +73 -25
- package/dest/public/bytecode_errors.d.ts +0 -4
- package/dest/public/bytecode_errors.d.ts.map +0 -1
- package/dest/public/bytecode_errors.js +0 -6
- package/src/public/bytecode_errors.ts +0 -6
|
@@ -1,31 +1,64 @@
|
|
|
1
|
-
import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
|
|
1
|
+
import { AVM_MAX_PROCESSABLE_L2_GAS, DEFAULT_MAX_DEBUG_LOG_MEMORY_READS } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
|
+
import { ProtocolContractAddress, ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
4
5
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
5
6
|
import { AvmCircuitInputs, AvmExecutionHints, AvmTxHint } from '@aztec/stdlib/avm';
|
|
6
7
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
7
8
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
8
9
|
import { NestedProcessReturnValues, TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
10
|
+
import { strict as assert } from 'assert';
|
|
9
11
|
import { AvmSimulator } from '../avm/index.js';
|
|
10
12
|
import { getPublicFunctionDebugName } from '../debug_fn_name.js';
|
|
11
13
|
import { HintingMerkleWriteOperations, HintingPublicContractsDB } from '../hinting_db_sources.js';
|
|
12
14
|
import { PublicTreesDB } from '../public_db_sources.js';
|
|
15
|
+
import { L2ToL1MessageLimitReachedError, NoteHashLimitReachedError, NullifierCollisionError, NullifierLimitReachedError } from '../side_effect_errors.js';
|
|
13
16
|
import { PublicTxContext } from './public_tx_context.js';
|
|
17
|
+
// The errors below are only thrown here in the public tx simulator,
|
|
18
|
+
// and only during revertible phases (revertible insertions, app logic and teardown).
|
|
19
|
+
// These are strictly "checked" errors (not exported and never propagated).
|
|
20
|
+
// They are used internally for control flow to trigger rollbacks to the post-setup state.
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when public tx simulation reverts in a known/checked way during revertible insertions.
|
|
23
|
+
*/ class TxSimRevertibleInsertionsRevert extends Error {
|
|
24
|
+
constructor(){
|
|
25
|
+
super('Public Tx Simulation reverted during Revertible Insertions');
|
|
26
|
+
this.name = 'TxSimRevertibleInsertionsRevert';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when public tx simulation reverts during app logic.
|
|
31
|
+
*/ class TxSimAppLogicRevert extends Error {
|
|
32
|
+
constructor(){
|
|
33
|
+
super('Public Tx Simulation reverted during App Logic');
|
|
34
|
+
this.name = 'TxSimAppLogicRevert';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Error thrown when public tx simulation reverts during teardown.
|
|
39
|
+
*/ class TxSimTeardownRevert extends Error {
|
|
40
|
+
constructor(){
|
|
41
|
+
super('Public Tx Simulation reverted during Teardown');
|
|
42
|
+
this.name = 'TxSimTeardownRevert';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
14
45
|
export class PublicTxSimulator {
|
|
15
46
|
merkleTree;
|
|
16
47
|
contractsDB;
|
|
17
48
|
globalVariables;
|
|
18
|
-
doMerkleOperations;
|
|
19
|
-
skipFeeEnforcement;
|
|
20
|
-
clientInitiatedSimulation;
|
|
21
49
|
log;
|
|
22
|
-
|
|
50
|
+
config;
|
|
51
|
+
constructor(merkleTree, contractsDB, globalVariables, config){
|
|
23
52
|
this.merkleTree = merkleTree;
|
|
24
53
|
this.contractsDB = contractsDB;
|
|
25
54
|
this.globalVariables = globalVariables;
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
55
|
+
this.config = {
|
|
56
|
+
proverId: config?.proverId ?? Fr.ZERO,
|
|
57
|
+
doMerkleOperations: config?.doMerkleOperations ?? false,
|
|
58
|
+
skipFeeEnforcement: config?.skipFeeEnforcement ?? false,
|
|
59
|
+
clientInitiatedSimulation: config?.clientInitiatedSimulation ?? false,
|
|
60
|
+
maxDebugLogMemoryReads: config?.maxDebugLogMemoryReads ?? DEFAULT_MAX_DEBUG_LOG_MEMORY_READS
|
|
61
|
+
};
|
|
29
62
|
this.log = createLogger(`simulator:public_tx_simulator`);
|
|
30
63
|
}
|
|
31
64
|
/**
|
|
@@ -39,11 +72,11 @@ export class PublicTxSimulator {
|
|
|
39
72
|
txHash
|
|
40
73
|
});
|
|
41
74
|
// Create hinting DBs.
|
|
42
|
-
const hints = new AvmExecutionHints(this.globalVariables, AvmTxHint.fromTx(tx, this.globalVariables.gasFees));
|
|
75
|
+
const hints = new AvmExecutionHints(this.globalVariables, AvmTxHint.fromTx(tx, this.globalVariables.gasFees), ProtocolContractsList);
|
|
43
76
|
const hintingMerkleTree = await HintingMerkleWriteOperations.create(this.merkleTree, hints);
|
|
44
77
|
const hintingTreesDB = new PublicTreesDB(hintingMerkleTree);
|
|
45
78
|
const hintingContractsDB = new HintingPublicContractsDB(this.contractsDB, hints);
|
|
46
|
-
const context = await PublicTxContext.create(hintingTreesDB, hintingContractsDB, tx, this.globalVariables, this.doMerkleOperations);
|
|
79
|
+
const context = await PublicTxContext.create(hintingTreesDB, hintingContractsDB, tx, this.globalVariables, ProtocolContractsList, this.config.doMerkleOperations, this.config.proverId);
|
|
47
80
|
// This will throw if there is a nullifier collision.
|
|
48
81
|
// In that case the transaction will be thrown out.
|
|
49
82
|
await this.insertNonRevertiblesFromPrivate(context, tx);
|
|
@@ -60,43 +93,50 @@ export class PublicTxSimulator {
|
|
|
60
93
|
// The checkpoint we should go back to if anything from now on reverts.
|
|
61
94
|
await context.state.fork();
|
|
62
95
|
try {
|
|
63
|
-
// This will throw if there is a nullifier collision.
|
|
96
|
+
// This will throw if there is a nullifier collision or other insertion error (limit reached).
|
|
64
97
|
await this.insertRevertiblesFromPrivate(context, tx);
|
|
65
98
|
// Only proceed with app logic if there was no revert during revertible insertion.
|
|
66
99
|
if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
|
|
67
100
|
const appLogicResult = await this.simulatePhase(TxExecutionPhase.APP_LOGIC, context);
|
|
68
101
|
processedPhases.push(appLogicResult);
|
|
69
102
|
if (appLogicResult.reverted) {
|
|
70
|
-
throw new
|
|
103
|
+
throw new TxSimAppLogicRevert();
|
|
71
104
|
}
|
|
72
105
|
}
|
|
73
106
|
} catch (e) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
if (e instanceof TxSimRevertibleInsertionsRevert || e instanceof TxSimAppLogicRevert) {
|
|
108
|
+
// We revert to the post-setup state.
|
|
109
|
+
await context.state.discardForkedState();
|
|
110
|
+
// But we also create a new fork so that the teardown phase can transparently
|
|
111
|
+
// commit or rollback at the end of teardown.
|
|
112
|
+
await context.state.fork();
|
|
113
|
+
} else {
|
|
114
|
+
// Unchecked/unknown error - re-throw as-is
|
|
115
|
+
throw e;
|
|
116
|
+
}
|
|
80
117
|
}
|
|
81
118
|
try {
|
|
82
119
|
if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
|
|
83
120
|
const teardownResult = await this.simulatePhase(TxExecutionPhase.TEARDOWN, context);
|
|
84
121
|
processedPhases.push(teardownResult);
|
|
85
122
|
if (teardownResult.reverted) {
|
|
86
|
-
throw new
|
|
123
|
+
throw new TxSimTeardownRevert();
|
|
87
124
|
}
|
|
88
125
|
}
|
|
89
126
|
// We commit the forked state and we are done.
|
|
90
127
|
await context.state.mergeForkedState();
|
|
91
128
|
} catch (e) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
if (e instanceof TxSimTeardownRevert) {
|
|
130
|
+
// We revert to the post-setup state and we are done.
|
|
131
|
+
await context.state.discardForkedState();
|
|
132
|
+
} else {
|
|
133
|
+
// Unchecked/unknown error - re-throw as-is
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
95
136
|
}
|
|
96
137
|
context.halt();
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
138
|
+
// Such transactions should be filtered by GasTxValidator.
|
|
139
|
+
assert(context.getActualGasUsed().l2Gas <= AVM_MAX_PROCESSABLE_L2_GAS, `Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the AVM maximum processable gas of ${AVM_MAX_PROCESSABLE_L2_GAS}`);
|
|
100
140
|
await this.payFee(context);
|
|
101
141
|
const publicInputs = await context.generateAvmCircuitPublicInputs();
|
|
102
142
|
const avmProvingRequest = PublicTxSimulator.generateProvingRequest(publicInputs, hints);
|
|
@@ -117,7 +157,8 @@ export class PublicTxSimulator {
|
|
|
117
157
|
},
|
|
118
158
|
revertCode,
|
|
119
159
|
revertReason: context.revertReason,
|
|
120
|
-
processedPhases: processedPhases
|
|
160
|
+
processedPhases: processedPhases,
|
|
161
|
+
logs: context.state.getActiveStateManager().getLogs()
|
|
121
162
|
};
|
|
122
163
|
} finally{
|
|
123
164
|
// Make sure there are no new contracts in the tx-level cache.
|
|
@@ -200,7 +241,7 @@ export class PublicTxSimulator {
|
|
|
200
241
|
const address = request.contractAddress;
|
|
201
242
|
const sender = request.msgSender;
|
|
202
243
|
this.log.debug(`Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`);
|
|
203
|
-
const simulator = await AvmSimulator.create(stateManager, address, sender, transactionFee, this.globalVariables, request.isStaticCall, calldata, allocatedGas, this.clientInitiatedSimulation);
|
|
244
|
+
const simulator = await AvmSimulator.create(stateManager, address, sender, transactionFee, this.globalVariables, request.isStaticCall, calldata, allocatedGas, this.config.clientInitiatedSimulation, this.config.maxDebugLogMemoryReads);
|
|
204
245
|
const avmCallResult = await simulator.execute();
|
|
205
246
|
return avmCallResult.finalize();
|
|
206
247
|
}
|
|
@@ -229,7 +270,12 @@ export class PublicTxSimulator {
|
|
|
229
270
|
}
|
|
230
271
|
/**
|
|
231
272
|
* Insert the revertible accumulated data from private into the public state.
|
|
232
|
-
*
|
|
273
|
+
* Throws TxSimRevertibleInsertionsRevert if there is some checked error during revertible insertions.
|
|
274
|
+
* This function checks for the following errors:
|
|
275
|
+
* - NullifierLimitReachedError
|
|
276
|
+
* - NullifierCollisionError
|
|
277
|
+
* - NoteHashLimitReachedError
|
|
278
|
+
* - L2ToL1MessageLimitReachedError
|
|
233
279
|
*/ async insertRevertiblesFromPrivate(context, tx) {
|
|
234
280
|
const stateManager = context.state.getActiveStateManager();
|
|
235
281
|
try {
|
|
@@ -237,25 +283,49 @@ export class PublicTxSimulator {
|
|
|
237
283
|
await stateManager.writeSiloedNullifier(siloedNullifier);
|
|
238
284
|
}
|
|
239
285
|
} catch (e) {
|
|
240
|
-
|
|
241
|
-
|
|
286
|
+
if (e instanceof NullifierLimitReachedError || e instanceof NullifierCollisionError) {
|
|
287
|
+
context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible nullifiers from private.\nDetails: ${e.message}`, []));
|
|
288
|
+
throw new TxSimRevertibleInsertionsRevert();
|
|
289
|
+
} else {
|
|
290
|
+
// Unchecked/unknown error - re-throw as-is
|
|
291
|
+
throw e;
|
|
292
|
+
}
|
|
242
293
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
294
|
+
try {
|
|
295
|
+
for (const noteHash of context.revertibleAccumulatedDataFromPrivate.noteHashes){
|
|
296
|
+
if (!noteHash.isEmpty()) {
|
|
297
|
+
// Revertible note hashes from private are not hashed with nonce, since private can't know their final position, only we can.
|
|
298
|
+
await stateManager.writeSiloedNoteHash(noteHash);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
} catch (e) {
|
|
302
|
+
if (e instanceof NoteHashLimitReachedError) {
|
|
303
|
+
context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible note hashes from private.\nDetails: ${e.message}`, []));
|
|
304
|
+
throw new TxSimRevertibleInsertionsRevert();
|
|
305
|
+
} else {
|
|
306
|
+
// Unchecked/unknown error - re-throw as-is
|
|
307
|
+
throw e;
|
|
247
308
|
}
|
|
248
309
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
310
|
+
try {
|
|
311
|
+
for (const l2ToL1Message of context.revertibleAccumulatedDataFromPrivate.l2ToL1Msgs){
|
|
312
|
+
if (!l2ToL1Message.isEmpty()) {
|
|
313
|
+
stateManager.writeScopedL2ToL1Message(l2ToL1Message);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
} catch (e) {
|
|
317
|
+
if (e instanceof L2ToL1MessageLimitReachedError) {
|
|
318
|
+
context.revert(TxExecutionPhase.APP_LOGIC, new SimulationError(`Error encountered when inserting revertible L2-to-L1 messages from private.\nDetails: ${e.message}`, []));
|
|
319
|
+
throw new TxSimRevertibleInsertionsRevert();
|
|
320
|
+
} else {
|
|
321
|
+
// Unchecked/unknown error - re-throw as-is
|
|
322
|
+
throw e;
|
|
252
323
|
}
|
|
253
324
|
}
|
|
254
325
|
// add new contracts to the contracts db so that their functions may be found and called
|
|
255
326
|
// FIXME(fcarreiro): this should conceptually use the hinted contracts db.
|
|
256
327
|
// However things should work as they are now because the hinted db would still pick up the new contracts.
|
|
257
328
|
await this.contractsDB.addNewRevertibleContracts(tx);
|
|
258
|
-
return /*success=*/ true;
|
|
259
329
|
}
|
|
260
330
|
async payFee(context) {
|
|
261
331
|
const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
|
|
@@ -271,11 +341,9 @@ export class PublicTxSimulator {
|
|
|
271
341
|
// We allow to fake the balance of the fee payer to allow fee estimation
|
|
272
342
|
// When mocking the balance of the fee payer, the circuit should not be able to prove the simulation
|
|
273
343
|
if (currentBalance.lt(txFee)) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
currentBalance = txFee;
|
|
278
|
-
}
|
|
344
|
+
// Without "skipFeeEnforcement", such transactions should be filtered by GasTxValidator.
|
|
345
|
+
assert(this.config.skipFeeEnforcement, `Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`);
|
|
346
|
+
currentBalance = txFee;
|
|
279
347
|
}
|
|
280
348
|
const updatedBalance = currentBalance.sub(txFee);
|
|
281
349
|
await stateManager.writeStorage(feeJuiceAddress, balanceSlot, updatedBalance, true);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Tx } from '@aztec/stdlib/tx';
|
|
2
|
+
import type { PublicTxResult } from './public_tx_simulator.js';
|
|
3
|
+
export interface PublicTxSimulatorInterface {
|
|
4
|
+
simulate(tx: Tx): Promise<PublicTxResult>;
|
|
5
|
+
}
|
|
6
|
+
export interface MeasuredPublicTxSimulatorInterface {
|
|
7
|
+
simulate(tx: Tx, txLabel: string): Promise<PublicTxResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=public_tx_simulator_interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_tx_simulator_interface.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -8,12 +8,13 @@ import type { PublicContractsDB } from '../public_db_sources.js';
|
|
|
8
8
|
import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
|
|
9
9
|
import { MeasuredPublicTxSimulator } from './measured_public_tx_simulator.js';
|
|
10
10
|
import { PublicTxContext } from './public_tx_context.js';
|
|
11
|
+
import type { PublicTxSimulatorConfig } from './public_tx_simulator.js';
|
|
11
12
|
/**
|
|
12
13
|
* A public tx simulator that tracks runtime/production metrics with telemetry.
|
|
13
14
|
*/
|
|
14
15
|
export declare class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
|
|
15
16
|
readonly tracer: Tracer;
|
|
16
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables,
|
|
17
|
+
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicTxSimulatorConfig>);
|
|
17
18
|
protected simulateEnqueuedCall(phase: TxExecutionPhase, context: PublicTxContext, callRequest: PublicCallRequestWithCalldata): Promise<AvmFinalizedCallResult>;
|
|
18
19
|
protected simulateEnqueuedCallInternal(stateManager: PublicPersistableStateManager, callRequest: PublicCallRequestWithCalldata, allocatedGas: Gas, transactionFee: Fr, fnName: string): Promise<AvmFinalizedCallResult>;
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/telemetry_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,MAAM,EAAiC,MAAM,yBAAyB,CAAC;AAEvH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"telemetry_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/telemetry_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC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js';
|
|
|
12
12
|
* A public tx simulator that tracks runtime/production metrics with telemetry.
|
|
13
13
|
*/ export class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
|
|
14
14
|
/* tracer needed by trackSpans */ tracer;
|
|
15
|
-
constructor(merkleTree, contractsDB, globalVariables,
|
|
15
|
+
constructor(merkleTree, contractsDB, globalVariables, telemetryClient = getTelemetryClient(), config){
|
|
16
16
|
const metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator');
|
|
17
|
-
super(merkleTree, contractsDB, globalVariables,
|
|
17
|
+
super(merkleTree, contractsDB, globalVariables, metrics, config);
|
|
18
18
|
this.tracer = metrics.tracer;
|
|
19
19
|
}
|
|
20
20
|
async simulateEnqueuedCall(phase, context, callRequest) {
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { CheckedPublicExecutionError } from './public_errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Any error that can be thrown during side effect insertion in public.
|
|
4
|
+
* Includes SideEffectLimitReachedError and NullifierCollisionError.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class SideEffectError extends CheckedPublicExecutionError {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class SideEffectLimitReachedError extends SideEffectError {
|
|
2
10
|
constructor(sideEffectType: string, limit: number);
|
|
3
11
|
}
|
|
12
|
+
export declare class MaxCallsToUniqueContractClassIdsError extends SideEffectLimitReachedError {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
export declare class NullifierLimitReachedError extends SideEffectLimitReachedError {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
export declare class NoteHashLimitReachedError extends SideEffectLimitReachedError {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class L2ToL1MessageLimitReachedError extends SideEffectLimitReachedError {
|
|
22
|
+
constructor();
|
|
23
|
+
}
|
|
24
|
+
export declare class NullifierCollisionError extends SideEffectError {
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Any error that can be thrown during side effect reads in public.
|
|
29
|
+
* Note: Thrown at state manager level and unknown by simulation, hence NOT considered
|
|
30
|
+
* CheckedPublicExecutionErrors. Currently only includes append-only tree reads.
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class SideEffectReadError extends Error {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
export declare class IndexOutOfRangeError extends SideEffectReadError {
|
|
36
|
+
constructor(tree: string, index: number, limit: number);
|
|
37
|
+
}
|
|
38
|
+
export declare class NoteHashIndexOutOfRangeError extends IndexOutOfRangeError {
|
|
39
|
+
constructor(index: number);
|
|
40
|
+
}
|
|
41
|
+
export declare class L1ToL2MessageIndexOutOfRangeError extends IndexOutOfRangeError {
|
|
42
|
+
constructor(index: number);
|
|
43
|
+
}
|
|
4
44
|
//# sourceMappingURL=side_effect_errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side_effect_errors.d.ts","sourceRoot":"","sources":["../../src/public/side_effect_errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side_effect_errors.d.ts","sourceRoot":"","sources":["../../src/public/side_effect_errors.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;GAGG;AACH,8BAAsB,eAAgB,SAAQ,2BAA2B;gBAC3D,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,2BAA4B,SAAQ,eAAe;gBAClD,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAIlD;AAED,qBAAa,qCAAsC,SAAQ,2BAA2B;;CAKrF;AAED,qBAAa,0BAA2B,SAAQ,2BAA2B;;CAK1E;AAED,qBAAa,yBAA0B,SAAQ,2BAA2B;;CAKzE;AAED,qBAAa,8BAA+B,SAAQ,2BAA2B;;CAK9E;AAED,qBAAa,uBAAwB,SAAQ,eAAe;gBAC9C,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,8BAAsB,mBAAoB,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAC/C,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAIvD;AAED,qBAAa,4BAA6B,SAAQ,oBAAoB;gBACxD,KAAK,EAAE,MAAM;CAI1B;AAED,qBAAa,iCAAkC,SAAQ,oBAAoB;gBAC7D,KAAK,EAAE,MAAM;CAI1B"}
|
|
@@ -1,6 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
import { L1_TO_L2_MSG_TREE_LEAF_COUNT, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, NOTE_HASH_TREE_LEAF_COUNT } from '@aztec/constants';
|
|
2
|
+
import { CheckedPublicExecutionError } from './public_errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* Any error that can be thrown during side effect insertion in public.
|
|
5
|
+
* Includes SideEffectLimitReachedError and NullifierCollisionError.
|
|
6
|
+
*/ export class SideEffectError extends CheckedPublicExecutionError {
|
|
7
|
+
constructor(message){
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'SideEffectInsertionError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class SideEffectLimitReachedError extends SideEffectError {
|
|
2
13
|
constructor(sideEffectType, limit){
|
|
3
14
|
super(`Reached the limit (${limit}) on number of '${sideEffectType}' per tx`);
|
|
4
15
|
this.name = 'SideEffectLimitReachedError';
|
|
5
16
|
}
|
|
6
17
|
}
|
|
18
|
+
export class MaxCallsToUniqueContractClassIdsError extends SideEffectLimitReachedError {
|
|
19
|
+
constructor(){
|
|
20
|
+
super('contract calls to unique class IDs', MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS);
|
|
21
|
+
this.name = 'MaxCallsToUniqueContractClassIdsError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class NullifierLimitReachedError extends SideEffectLimitReachedError {
|
|
25
|
+
constructor(){
|
|
26
|
+
super('nullifier', MAX_NULLIFIERS_PER_TX);
|
|
27
|
+
this.name = 'NullifierLimitReachedError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class NoteHashLimitReachedError extends SideEffectLimitReachedError {
|
|
31
|
+
constructor(){
|
|
32
|
+
super('note hash', MAX_NOTE_HASHES_PER_TX);
|
|
33
|
+
this.name = 'NoteHashLimitReachedError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class L2ToL1MessageLimitReachedError extends SideEffectLimitReachedError {
|
|
37
|
+
constructor(){
|
|
38
|
+
super('l2 to l1 message', MAX_L2_TO_L1_MSGS_PER_TX);
|
|
39
|
+
this.name = 'L2ToL1MessageLimitReachedError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class NullifierCollisionError extends SideEffectError {
|
|
43
|
+
constructor(message){
|
|
44
|
+
super(`Nullifier collision: ${message}`);
|
|
45
|
+
this.name = 'NullifierCollisionError';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Any error that can be thrown during side effect reads in public.
|
|
50
|
+
* Note: Thrown at state manager level and unknown by simulation, hence NOT considered
|
|
51
|
+
* CheckedPublicExecutionErrors. Currently only includes append-only tree reads.
|
|
52
|
+
*/ export class SideEffectReadError extends Error {
|
|
53
|
+
constructor(message){
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = 'SideEffectReadError';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class IndexOutOfRangeError extends SideEffectReadError {
|
|
59
|
+
constructor(tree, index, limit){
|
|
60
|
+
super(`Attempting to read index ${index} of ${tree} tree with maximum ${limit} leaves`);
|
|
61
|
+
this.name = 'IndexOutOfRangeError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export class NoteHashIndexOutOfRangeError extends IndexOutOfRangeError {
|
|
65
|
+
constructor(index){
|
|
66
|
+
super('note hash', index, NOTE_HASH_TREE_LEAF_COUNT);
|
|
67
|
+
this.name = 'NoteHashIndexOutOfRangeError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class L1ToL2MessageIndexOutOfRangeError extends IndexOutOfRangeError {
|
|
71
|
+
constructor(index){
|
|
72
|
+
super('l1 to l2 message', index, L1_TO_L2_MSG_TREE_LEAF_COUNT);
|
|
73
|
+
this.name = 'L1ToL2MessageIndexOutOfRangeError';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { type LogLevel } from '@aztec/foundation/log';
|
|
2
3
|
import { PublicDataUpdateRequest } from '@aztec/stdlib/avm';
|
|
3
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { NoteHash, Nullifier } from '@aztec/stdlib/kernel';
|
|
5
|
-
import { PublicLog } from '@aztec/stdlib/logs';
|
|
6
|
+
import { DebugLog, PublicLog } from '@aztec/stdlib/logs';
|
|
6
7
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
7
8
|
import type { PublicSideEffectTraceInterface } from './side_effect_trace_interface.js';
|
|
8
9
|
import { UniqueClassIds } from './unique_class_ids.js';
|
|
@@ -24,8 +25,8 @@ export declare class SideEffectArrayLengths {
|
|
|
24
25
|
readonly noteHashes: number;
|
|
25
26
|
readonly nullifiers: number;
|
|
26
27
|
readonly l2ToL1Msgs: number;
|
|
27
|
-
readonly
|
|
28
|
-
constructor(publicDataWrites: number, protocolPublicDataWrites: number, noteHashes: number, nullifiers: number, l2ToL1Msgs: number,
|
|
28
|
+
readonly publicLogFields: number;
|
|
29
|
+
constructor(publicDataWrites: number, protocolPublicDataWrites: number, noteHashes: number, nullifiers: number, l2ToL1Msgs: number, publicLogFields: number);
|
|
29
30
|
static empty(): SideEffectArrayLengths;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
@@ -41,6 +42,8 @@ export declare class SideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
41
42
|
/** We need to track the set of class IDs used, to enforce limits. */
|
|
42
43
|
private uniqueClassIds;
|
|
43
44
|
private writtenPublicDataSlots;
|
|
45
|
+
private debugLogs;
|
|
46
|
+
private debugLogMemoryReads;
|
|
44
47
|
log: import("@aztec/foundation/log").Logger;
|
|
45
48
|
/** The side effect counter increments with every call to the trace. */
|
|
46
49
|
private sideEffectCounter;
|
|
@@ -61,7 +64,7 @@ export declare class SideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
61
64
|
*/
|
|
62
65
|
previousSideEffectArrayLengths?: SideEffectArrayLengths,
|
|
63
66
|
/** We need to track the set of class IDs used, to enforce limits. */
|
|
64
|
-
uniqueClassIds?: UniqueClassIds, writtenPublicDataSlots?: Set<string
|
|
67
|
+
uniqueClassIds?: UniqueClassIds, writtenPublicDataSlots?: Set<string>, debugLogs?: DebugLog[], debugLogMemoryReads?: number);
|
|
65
68
|
fork(): SideEffectTrace;
|
|
66
69
|
merge(forkedTrace: this, reverted?: boolean): void;
|
|
67
70
|
getCounter(): number;
|
|
@@ -74,6 +77,10 @@ export declare class SideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
74
77
|
traceNewNullifier(siloedNullifier: Fr): void;
|
|
75
78
|
traceNewL2ToL1Message(contractAddress: AztecAddress, recipient: Fr, content: Fr): void;
|
|
76
79
|
tracePublicLog(contractAddress: AztecAddress, log: Fr[]): void;
|
|
80
|
+
traceDebugLog(contractAddress: AztecAddress, level: LogLevel, message: string, fields: Fr[]): void;
|
|
81
|
+
getDebugLogs(): DebugLog[];
|
|
82
|
+
getDebugLogMemoryReads(): number;
|
|
83
|
+
traceDebugLogMemoryReads(memoryReads: number): void;
|
|
77
84
|
traceGetContractClass(contractClassId: Fr, exists: boolean): void;
|
|
78
85
|
getSideEffects(): SideEffects;
|
|
79
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side_effect_trace.d.ts","sourceRoot":"","sources":["../../src/public/side_effect_trace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side_effect_trace.d.ts","sourceRoot":"","sources":["../../src/public/side_effect_trace.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAiB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAW7E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;IAII;AACJ,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;IAC5C,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC;AAEF,qBAAa,sBAAsB;aAEf,gBAAgB,EAAE,MAAM;aACxB,wBAAwB,EAAE,MAAM;aAChC,UAAU,EAAE,MAAM;aAClB,UAAU,EAAE,MAAM;aAClB,UAAU,EAAE,MAAM;aAClB,eAAe,EAAE,MAAM;gBALvB,gBAAgB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