@aztec/simulator 0.63.1 → 0.64.0
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/avm/avm_contract_call_result.d.ts +18 -1
- package/dest/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/avm/avm_contract_call_result.js +30 -3
- package/dest/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/avm/avm_memory_types.js +7 -11
- package/dest/avm/avm_simulator.d.ts +6 -1
- package/dest/avm/avm_simulator.d.ts.map +1 -1
- package/dest/avm/avm_simulator.js +29 -8
- package/dest/avm/avm_tree.d.ts +4 -18
- package/dest/avm/avm_tree.d.ts.map +1 -1
- package/dest/avm/avm_tree.js +71 -53
- package/dest/avm/errors.d.ts +7 -0
- package/dest/avm/errors.d.ts.map +1 -1
- package/dest/avm/errors.js +11 -1
- package/dest/avm/fixtures/index.d.ts +2 -2
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +1 -1
- package/dest/avm/index.d.ts +1 -0
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +2 -1
- package/dest/avm/journal/journal.d.ts +14 -13
- package/dest/avm/journal/journal.d.ts.map +1 -1
- package/dest/avm/journal/journal.js +81 -68
- package/dest/avm/journal/public_storage.d.ts +0 -1
- package/dest/avm/journal/public_storage.d.ts.map +1 -1
- package/dest/avm/journal/public_storage.js +6 -6
- package/dest/avm/opcodes/accrued_substate.js +2 -2
- package/dest/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/avm/opcodes/addressing_mode.js +8 -2
- package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/avm/opcodes/external_calls.js +2 -4
- package/dest/avm/opcodes/instruction.d.ts +1 -1
- package/dest/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/avm/opcodes/instruction.js +1 -1
- package/dest/index.d.ts +0 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/public/dual_side_effect_trace.d.ts +3 -9
- package/dest/public/dual_side_effect_trace.d.ts.map +1 -1
- package/dest/public/dual_side_effect_trace.js +5 -11
- package/dest/public/enqueued_call_side_effect_trace.d.ts +4 -10
- package/dest/public/enqueued_call_side_effect_trace.d.ts.map +1 -1
- package/dest/public/enqueued_call_side_effect_trace.js +6 -15
- package/dest/public/executor_metrics.d.ts +1 -2
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +2 -8
- package/dest/public/fixtures/index.d.ts +14 -0
- package/dest/public/fixtures/index.d.ts.map +1 -0
- package/dest/public/fixtures/index.js +100 -0
- package/dest/public/index.d.ts +1 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -2
- package/dest/public/public_processor.d.ts +0 -2
- package/dest/public/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor.js +5 -12
- package/dest/public/public_tx_context.d.ts +6 -4
- package/dest/public/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_context.js +11 -7
- package/dest/public/public_tx_simulator.d.ts +56 -5
- package/dest/public/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator.js +106 -26
- package/dest/public/side_effect_trace.d.ts +4 -10
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +6 -15
- package/dest/public/side_effect_trace_interface.d.ts +3 -9
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/transitional_adapters.d.ts +1 -2
- package/dest/public/transitional_adapters.d.ts.map +1 -1
- package/dest/public/transitional_adapters.js +8 -10
- package/package.json +10 -10
- package/src/avm/avm_contract_call_result.ts +39 -2
- package/src/avm/avm_memory_types.ts +6 -10
- package/src/avm/avm_simulator.ts +58 -8
- package/src/avm/avm_tree.ts +88 -64
- package/src/avm/errors.ts +11 -0
- package/src/avm/fixtures/index.ts +4 -3
- package/src/avm/index.ts +1 -0
- package/src/avm/journal/journal.ts +118 -126
- package/src/avm/journal/public_storage.ts +5 -6
- package/src/avm/opcodes/accrued_substate.ts +1 -1
- package/src/avm/opcodes/addressing_mode.ts +7 -2
- package/src/avm/opcodes/external_calls.ts +1 -3
- package/src/avm/opcodes/instruction.ts +1 -1
- package/src/index.ts +0 -1
- package/src/public/dual_side_effect_trace.ts +4 -13
- package/src/public/enqueued_call_side_effect_trace.ts +14 -17
- package/src/public/executor_metrics.ts +1 -9
- package/src/public/fixtures/index.ts +158 -0
- package/src/public/index.ts +1 -5
- package/src/public/public_processor.ts +5 -27
- package/src/public/public_tx_context.ts +13 -8
- package/src/public/public_tx_simulator.ts +182 -50
- package/src/public/side_effect_trace.ts +9 -19
- package/src/public/side_effect_trace_interface.ts +3 -9
- package/src/public/transitional_adapters.ts +12 -12
- package/dest/mocks/fixtures.d.ts +0 -28
- package/dest/mocks/fixtures.d.ts.map +0 -1
- package/dest/mocks/fixtures.js +0 -48
- package/dest/mocks/index.d.ts +0 -2
- package/dest/mocks/index.d.ts.map +0 -1
- package/dest/mocks/index.js +0 -2
- package/dest/public/executor.d.ts +0 -47
- package/dest/public/executor.d.ts.map +0 -1
- package/dest/public/executor.js +0 -90
- package/src/mocks/fixtures.ts +0 -72
- package/src/mocks/index.ts +0 -1
- package/src/public/executor.ts +0 -154
|
@@ -3,17 +3,29 @@ import {
|
|
|
3
3
|
type GasUsed,
|
|
4
4
|
type MerkleTreeReadOperations,
|
|
5
5
|
NestedProcessReturnValues,
|
|
6
|
+
type PublicExecutionRequest,
|
|
6
7
|
type SimulationError,
|
|
7
8
|
type Tx,
|
|
8
9
|
TxExecutionPhase,
|
|
9
10
|
UnencryptedFunctionL2Logs,
|
|
10
11
|
} from '@aztec/circuit-types';
|
|
11
|
-
import {
|
|
12
|
+
import { type AvmSimulationStats } from '@aztec/circuit-types/stats';
|
|
13
|
+
import {
|
|
14
|
+
type Fr,
|
|
15
|
+
Gas,
|
|
16
|
+
type GlobalVariables,
|
|
17
|
+
MAX_L2_GAS_PER_ENQUEUED_CALL,
|
|
18
|
+
type PublicCallRequest,
|
|
19
|
+
type RevertCode,
|
|
20
|
+
} from '@aztec/circuits.js';
|
|
12
21
|
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
13
22
|
import { Timer } from '@aztec/foundation/timer';
|
|
23
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
14
24
|
|
|
15
|
-
import { type
|
|
16
|
-
import { type
|
|
25
|
+
import { type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
26
|
+
import { type AvmPersistableStateManager, AvmSimulator } from '../avm/index.js';
|
|
27
|
+
import { getPublicFunctionDebugName } from '../common/debug_fn_name.js';
|
|
28
|
+
import { ExecutorMetrics } from './executor_metrics.js';
|
|
17
29
|
import { type WorldStateDB } from './public_db_sources.js';
|
|
18
30
|
import { PublicTxContext } from './public_tx_context.js';
|
|
19
31
|
|
|
@@ -36,32 +48,37 @@ export type PublicTxResult = {
|
|
|
36
48
|
};
|
|
37
49
|
|
|
38
50
|
export class PublicTxSimulator {
|
|
51
|
+
metrics: ExecutorMetrics;
|
|
52
|
+
|
|
39
53
|
private log: DebugLogger;
|
|
40
54
|
|
|
41
55
|
constructor(
|
|
42
56
|
private db: MerkleTreeReadOperations,
|
|
43
|
-
private globalVariables: GlobalVariables,
|
|
44
57
|
private worldStateDB: WorldStateDB,
|
|
45
|
-
|
|
58
|
+
client: TelemetryClient,
|
|
59
|
+
private globalVariables: GlobalVariables,
|
|
46
60
|
private realAvmProvingRequests: boolean = true,
|
|
61
|
+
private doMerkleOperations: boolean = false,
|
|
47
62
|
) {
|
|
48
63
|
this.log = createDebugLogger(`aztec:public_tx_simulator`);
|
|
64
|
+
this.metrics = new ExecutorMetrics(client, 'PublicTxSimulator');
|
|
49
65
|
}
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
realAvmProvingRequests: boolean = true,
|
|
57
|
-
) {
|
|
58
|
-
return new PublicTxSimulator(db, globalVariables, worldStateDB, publicExecutor, realAvmProvingRequests);
|
|
59
|
-
}
|
|
60
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Simulate a transaction's public portion including all of its phases.
|
|
69
|
+
* @param tx - The transaction to simulate.
|
|
70
|
+
* @returns The result of the transaction's public execution.
|
|
71
|
+
*/
|
|
61
72
|
async simulate(tx: Tx): Promise<PublicTxResult> {
|
|
62
73
|
this.log.verbose(`Processing tx ${tx.getTxHash()}`);
|
|
63
74
|
|
|
64
|
-
const context = await PublicTxContext.create(
|
|
75
|
+
const context = await PublicTxContext.create(
|
|
76
|
+
this.db,
|
|
77
|
+
this.worldStateDB,
|
|
78
|
+
tx,
|
|
79
|
+
this.globalVariables,
|
|
80
|
+
this.doMerkleOperations,
|
|
81
|
+
);
|
|
65
82
|
|
|
66
83
|
// add new contracts to the contracts db so that their functions may be found and called
|
|
67
84
|
// TODO(#4073): This is catching only private deployments, when we add public ones, we'll
|
|
@@ -117,10 +134,20 @@ export class PublicTxSimulator {
|
|
|
117
134
|
};
|
|
118
135
|
}
|
|
119
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Simulate the setup phase of a transaction's public execution.
|
|
139
|
+
* @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
|
|
140
|
+
* @returns The phase result.
|
|
141
|
+
*/
|
|
120
142
|
private async simulateSetupPhase(context: PublicTxContext): Promise<ProcessedPhase> {
|
|
121
143
|
return await this.simulatePhase(TxExecutionPhase.SETUP, context);
|
|
122
144
|
}
|
|
123
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Simulate the app logic phase of a transaction's public execution.
|
|
148
|
+
* @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
|
|
149
|
+
* @returns The phase result.
|
|
150
|
+
*/
|
|
124
151
|
private async simulateAppLogicPhase(context: PublicTxContext): Promise<ProcessedPhase> {
|
|
125
152
|
// Fork the state manager so that we can rollback state if app logic or teardown reverts.
|
|
126
153
|
// Don't need to fork for setup since it's non-revertible (if setup fails, transaction is thrown out).
|
|
@@ -141,6 +168,11 @@ export class PublicTxSimulator {
|
|
|
141
168
|
return result;
|
|
142
169
|
}
|
|
143
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Simulate the teardown phase of a transaction's public execution.
|
|
173
|
+
* @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
|
|
174
|
+
* @returns The phase result.
|
|
175
|
+
*/
|
|
144
176
|
private async simulateTeardownPhase(context: PublicTxContext): Promise<ProcessedPhase> {
|
|
145
177
|
if (!context.state.isForked()) {
|
|
146
178
|
// If state isn't forked (app logic was empty or reverted), fork now
|
|
@@ -161,10 +193,15 @@ export class PublicTxSimulator {
|
|
|
161
193
|
return result;
|
|
162
194
|
}
|
|
163
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Simulate a phase of a transaction's public execution.
|
|
198
|
+
* @param phase - The current phase
|
|
199
|
+
* @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
|
|
200
|
+
* @returns The phase result.
|
|
201
|
+
*/
|
|
164
202
|
private async simulatePhase(phase: TxExecutionPhase, context: PublicTxContext): Promise<ProcessedPhase> {
|
|
165
203
|
const callRequests = context.getCallRequestsForPhase(phase);
|
|
166
204
|
const executionRequests = context.getExecutionRequestsForPhase(phase);
|
|
167
|
-
const txStateManager = context.state.getActiveStateManager();
|
|
168
205
|
|
|
169
206
|
this.log.debug(`Beginning processing in phase ${TxExecutionPhase[phase]} for tx ${context.getTxHash()}`);
|
|
170
207
|
|
|
@@ -180,44 +217,13 @@ export class PublicTxSimulator {
|
|
|
180
217
|
const callRequest = callRequests[i];
|
|
181
218
|
const executionRequest = executionRequests[i];
|
|
182
219
|
|
|
183
|
-
const
|
|
184
|
-
// Gas allocated to an enqueued call can be different from the available gas
|
|
185
|
-
// if there is more gas available than the max allocation per enqueued call.
|
|
186
|
-
const allocatedGas = new Gas(
|
|
187
|
-
/*daGas=*/ availableGas.daGas,
|
|
188
|
-
/*l2Gas=*/ Math.min(availableGas.l2Gas, MAX_L2_GAS_PER_ENQUEUED_CALL),
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
const enqueuedCallResult = (await this.publicExecutor.simulate(
|
|
192
|
-
txStateManager,
|
|
193
|
-
executionRequest,
|
|
194
|
-
this.globalVariables, // todo get from context
|
|
195
|
-
allocatedGas,
|
|
196
|
-
context.getTransactionFee(phase),
|
|
197
|
-
)) as EnqueuedPublicCallExecutionResult;
|
|
198
|
-
|
|
199
|
-
// TODO(dbanks12): remove once AVM proves entire public tx
|
|
200
|
-
await context.updateProvingRequest(
|
|
201
|
-
this.realAvmProvingRequests,
|
|
202
|
-
phase,
|
|
203
|
-
this.worldStateDB,
|
|
204
|
-
txStateManager,
|
|
205
|
-
executionRequest,
|
|
206
|
-
enqueuedCallResult,
|
|
207
|
-
allocatedGas,
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
txStateManager.traceEnqueuedCall(callRequest, executionRequest.args, enqueuedCallResult.reverted!);
|
|
220
|
+
const enqueuedCallResult = await this.simulateEnqueuedCall(phase, context, callRequest, executionRequest);
|
|
211
221
|
|
|
212
|
-
|
|
213
|
-
context.consumeGas(phase, gasUsed);
|
|
214
|
-
returnValues.push(new NestedProcessReturnValues(enqueuedCallResult.returnValues));
|
|
222
|
+
returnValues.push(new NestedProcessReturnValues(enqueuedCallResult.output));
|
|
215
223
|
|
|
216
224
|
if (enqueuedCallResult.reverted) {
|
|
217
225
|
reverted = true;
|
|
218
|
-
const culprit = `${executionRequest.callContext.contractAddress}:${executionRequest.callContext.functionSelector}`;
|
|
219
226
|
revertReason = enqueuedCallResult.revertReason;
|
|
220
|
-
context.revert(phase, enqueuedCallResult.revertReason, culprit); // throws if in setup (non-revertible) phase
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
229
|
|
|
@@ -229,4 +235,130 @@ export class PublicTxSimulator {
|
|
|
229
235
|
revertReason,
|
|
230
236
|
};
|
|
231
237
|
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Simulate an enqueued public call.
|
|
241
|
+
* @param phase - The current phase of public execution
|
|
242
|
+
* @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
|
|
243
|
+
* @param callRequest - The enqueued call to execute
|
|
244
|
+
* @param executionRequest - The execution request (includes args)
|
|
245
|
+
* @returns The result of execution.
|
|
246
|
+
*/
|
|
247
|
+
private async simulateEnqueuedCall(
|
|
248
|
+
phase: TxExecutionPhase,
|
|
249
|
+
context: PublicTxContext,
|
|
250
|
+
callRequest: PublicCallRequest,
|
|
251
|
+
executionRequest: PublicExecutionRequest,
|
|
252
|
+
): Promise<AvmFinalizedCallResult> {
|
|
253
|
+
const stateManager = context.state.getActiveStateManager();
|
|
254
|
+
const address = executionRequest.callContext.contractAddress;
|
|
255
|
+
const selector = executionRequest.callContext.functionSelector;
|
|
256
|
+
const fnName = await getPublicFunctionDebugName(this.worldStateDB, address, selector, executionRequest.args);
|
|
257
|
+
|
|
258
|
+
const availableGas = context.getGasLeftForPhase(phase);
|
|
259
|
+
// Gas allocated to an enqueued call can be different from the available gas
|
|
260
|
+
// if there is more gas available than the max allocation per enqueued call.
|
|
261
|
+
const allocatedGas = new Gas(
|
|
262
|
+
/*daGas=*/ availableGas.daGas,
|
|
263
|
+
/*l2Gas=*/ Math.min(availableGas.l2Gas, MAX_L2_GAS_PER_ENQUEUED_CALL),
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
const result = await this.simulateEnqueuedCallInternal(
|
|
267
|
+
context.state.getActiveStateManager(),
|
|
268
|
+
executionRequest,
|
|
269
|
+
allocatedGas,
|
|
270
|
+
context.getTransactionFee(phase),
|
|
271
|
+
fnName,
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
const gasUsed = allocatedGas.sub(result.gasLeft);
|
|
275
|
+
context.consumeGas(phase, gasUsed);
|
|
276
|
+
this.log.verbose(
|
|
277
|
+
`[AVM] Enqueued public call consumed ${gasUsed.l2Gas} L2 gas ending with ${result.gasLeft.l2Gas} L2 gas left.`,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// TODO(dbanks12): remove once AVM proves entire public tx
|
|
281
|
+
context.updateProvingRequest(
|
|
282
|
+
this.realAvmProvingRequests,
|
|
283
|
+
phase,
|
|
284
|
+
fnName,
|
|
285
|
+
stateManager,
|
|
286
|
+
executionRequest,
|
|
287
|
+
result,
|
|
288
|
+
allocatedGas,
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
stateManager.traceEnqueuedCall(callRequest, executionRequest.args, result.reverted);
|
|
292
|
+
|
|
293
|
+
if (result.reverted) {
|
|
294
|
+
const culprit = `${executionRequest.callContext.contractAddress}:${executionRequest.callContext.functionSelector}`;
|
|
295
|
+
context.revert(phase, result.revertReason, culprit); // throws if in setup (non-revertible) phase
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Simulate an enqueued public call, without modifying the context (PublicTxContext).
|
|
303
|
+
* Resulting modifcations to the context can be applied by the caller.
|
|
304
|
+
*
|
|
305
|
+
* This function can be mocked for testing to skip actual AVM simulation
|
|
306
|
+
* while still simulating phases and generating a proving request.
|
|
307
|
+
*
|
|
308
|
+
* @param stateManager - The state manager for AvmSimulation
|
|
309
|
+
* @param context - The context of the currently executing public transaction portion
|
|
310
|
+
* @param executionRequest - The execution request (includes args)
|
|
311
|
+
* @param allocatedGas - The gas allocated to the enqueued call
|
|
312
|
+
* @param fnName - The name of the function
|
|
313
|
+
* @returns The result of execution.
|
|
314
|
+
*/
|
|
315
|
+
private async simulateEnqueuedCallInternal(
|
|
316
|
+
stateManager: AvmPersistableStateManager,
|
|
317
|
+
executionRequest: PublicExecutionRequest,
|
|
318
|
+
allocatedGas: Gas,
|
|
319
|
+
transactionFee: Fr,
|
|
320
|
+
fnName: string,
|
|
321
|
+
): Promise<AvmFinalizedCallResult> {
|
|
322
|
+
const address = executionRequest.callContext.contractAddress;
|
|
323
|
+
const sender = executionRequest.callContext.msgSender;
|
|
324
|
+
const selector = executionRequest.callContext.functionSelector;
|
|
325
|
+
|
|
326
|
+
this.log.verbose(
|
|
327
|
+
`[AVM] Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`,
|
|
328
|
+
);
|
|
329
|
+
const timer = new Timer();
|
|
330
|
+
|
|
331
|
+
const simulator = AvmSimulator.create(
|
|
332
|
+
stateManager,
|
|
333
|
+
address,
|
|
334
|
+
sender,
|
|
335
|
+
selector,
|
|
336
|
+
transactionFee,
|
|
337
|
+
this.globalVariables,
|
|
338
|
+
executionRequest.callContext.isStaticCall,
|
|
339
|
+
executionRequest.args,
|
|
340
|
+
allocatedGas,
|
|
341
|
+
);
|
|
342
|
+
const avmCallResult = await simulator.execute();
|
|
343
|
+
const result = avmCallResult.finalize();
|
|
344
|
+
|
|
345
|
+
this.log.verbose(
|
|
346
|
+
`[AVM] Simulation of enqueued public call ${fnName} completed. reverted: ${result.reverted}${
|
|
347
|
+
result.reverted ? ', reason: ' + result.revertReason : ''
|
|
348
|
+
}.`,
|
|
349
|
+
{
|
|
350
|
+
eventName: 'avm-simulation',
|
|
351
|
+
appCircuitName: fnName,
|
|
352
|
+
duration: timer.ms(),
|
|
353
|
+
} satisfies AvmSimulationStats,
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
if (result.reverted) {
|
|
357
|
+
this.metrics.recordFunctionSimulationFailure();
|
|
358
|
+
} else {
|
|
359
|
+
this.metrics.recordFunctionSimulation(timer.ms());
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return result;
|
|
363
|
+
}
|
|
232
364
|
}
|
|
@@ -49,9 +49,8 @@ import { createDebugLogger } from '@aztec/foundation/log';
|
|
|
49
49
|
|
|
50
50
|
import { assert } from 'console';
|
|
51
51
|
|
|
52
|
-
import { type AvmContractCallResult } from '../avm/avm_contract_call_result.js';
|
|
52
|
+
import { type AvmContractCallResult, type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
53
53
|
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
54
|
-
import { createSimulationError } from '../common/errors.js';
|
|
55
54
|
import {
|
|
56
55
|
type EnqueuedPublicCallExecutionResultWithSideEffects,
|
|
57
56
|
type PublicFunctionCallResult,
|
|
@@ -200,7 +199,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
200
199
|
public traceNewNoteHash(
|
|
201
200
|
_contractAddress: AztecAddress,
|
|
202
201
|
noteHash: Fr,
|
|
203
|
-
leafIndex: Fr,
|
|
202
|
+
leafIndex: Fr = Fr.zero(),
|
|
204
203
|
path: Fr[] = emptyNoteHashPath(),
|
|
205
204
|
) {
|
|
206
205
|
if (this.noteHashes.length >= MAX_NOTE_HASHES_PER_TX) {
|
|
@@ -380,8 +379,6 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
380
379
|
nestedEnvironment: AvmExecutionEnvironment,
|
|
381
380
|
/** How much gas was available for this public execution. */
|
|
382
381
|
startGasLeft: Gas,
|
|
383
|
-
/** How much gas was left after this public execution. */
|
|
384
|
-
endGasLeft: Gas,
|
|
385
382
|
/** Bytecode used for this execution. */
|
|
386
383
|
bytecode: Buffer,
|
|
387
384
|
/** The call's results */
|
|
@@ -397,9 +394,8 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
397
394
|
const result = nestedCallTrace.toPublicFunctionCallResult(
|
|
398
395
|
nestedEnvironment,
|
|
399
396
|
startGasLeft,
|
|
400
|
-
endGasLeft,
|
|
401
397
|
bytecode,
|
|
402
|
-
avmCallResults,
|
|
398
|
+
avmCallResults.finalize(),
|
|
403
399
|
functionName,
|
|
404
400
|
);
|
|
405
401
|
this.sideEffectCounter = result.endSideEffectCounter.toNumber();
|
|
@@ -410,8 +406,8 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
410
406
|
this.nestedExecutions.push(result);
|
|
411
407
|
|
|
412
408
|
const gasUsed = new Gas(
|
|
413
|
-
result.startGasLeft.daGas -
|
|
414
|
-
result.startGasLeft.l2Gas -
|
|
409
|
+
result.startGasLeft.daGas - avmCallResults.gasLeft.daGas,
|
|
410
|
+
result.startGasLeft.l2Gas - avmCallResults.gasLeft.l2Gas,
|
|
415
411
|
);
|
|
416
412
|
|
|
417
413
|
this.publicCallRequests.push(resultToPublicCallRequest(result));
|
|
@@ -450,12 +446,10 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
450
446
|
avmEnvironment: AvmExecutionEnvironment,
|
|
451
447
|
/** How much gas was available for this public execution. */
|
|
452
448
|
startGasLeft: Gas,
|
|
453
|
-
/** How much gas was left after this public execution. */
|
|
454
|
-
endGasLeft: Gas,
|
|
455
449
|
/** Bytecode used for this execution. */
|
|
456
450
|
bytecode: Buffer,
|
|
457
451
|
/** The call's results */
|
|
458
|
-
avmCallResults:
|
|
452
|
+
avmCallResults: AvmFinalizedCallResult,
|
|
459
453
|
/** Function name for logging */
|
|
460
454
|
functionName: string = 'unknown',
|
|
461
455
|
): PublicFunctionCallResult {
|
|
@@ -465,16 +459,14 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
465
459
|
startSideEffectCounter: new Fr(this.startSideEffectCounter),
|
|
466
460
|
endSideEffectCounter: new Fr(this.sideEffectCounter),
|
|
467
461
|
startGasLeft,
|
|
468
|
-
endGasLeft,
|
|
462
|
+
endGasLeft: avmCallResults.gasLeft,
|
|
469
463
|
transactionFee: avmEnvironment.transactionFee,
|
|
470
464
|
|
|
471
465
|
bytecode,
|
|
472
466
|
calldata: avmEnvironment.calldata,
|
|
473
467
|
returnValues: avmCallResults.output,
|
|
474
468
|
reverted: avmCallResults.reverted,
|
|
475
|
-
revertReason: avmCallResults.revertReason
|
|
476
|
-
? createSimulationError(avmCallResults.revertReason, avmCallResults.output)
|
|
477
|
-
: undefined,
|
|
469
|
+
revertReason: avmCallResults.revertReason,
|
|
478
470
|
|
|
479
471
|
contractStorageReads: this.contractStorageReads,
|
|
480
472
|
contractStorageUpdateRequests: this.contractStorageUpdateRequests,
|
|
@@ -500,10 +492,8 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
500
492
|
}
|
|
501
493
|
|
|
502
494
|
public toPublicEnqueuedCallExecutionResult(
|
|
503
|
-
/** How much gas was left after this public execution. */
|
|
504
|
-
_endGasLeft: Gas,
|
|
505
495
|
/** The call's results */
|
|
506
|
-
_avmCallResults:
|
|
496
|
+
_avmCallResults: AvmFinalizedCallResult,
|
|
507
497
|
): EnqueuedPublicCallExecutionResultWithSideEffects {
|
|
508
498
|
throw new Error('Not implemented');
|
|
509
499
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
11
11
|
import { type Fr } from '@aztec/foundation/fields';
|
|
12
12
|
|
|
13
|
-
import { type AvmContractCallResult } from '../avm/avm_contract_call_result.js';
|
|
13
|
+
import { type AvmContractCallResult, type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
14
14
|
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
15
15
|
import { type EnqueuedPublicCallExecutionResultWithSideEffects, type PublicFunctionCallResult } from './execution.js';
|
|
16
16
|
|
|
@@ -83,8 +83,6 @@ export interface PublicSideEffectTraceInterface {
|
|
|
83
83
|
nestedEnvironment: AvmExecutionEnvironment,
|
|
84
84
|
/** How much gas was available for this public execution. */
|
|
85
85
|
startGasLeft: Gas,
|
|
86
|
-
/** How much gas was left after this public execution. */
|
|
87
|
-
endGasLeft: Gas,
|
|
88
86
|
/** Bytecode used for this execution. */
|
|
89
87
|
bytecode: Buffer,
|
|
90
88
|
/** The call's results */
|
|
@@ -101,22 +99,18 @@ export interface PublicSideEffectTraceInterface {
|
|
|
101
99
|
reverted: boolean,
|
|
102
100
|
): void;
|
|
103
101
|
toPublicEnqueuedCallExecutionResult(
|
|
104
|
-
/** How much gas was left after this public execution. */
|
|
105
|
-
endGasLeft: Gas,
|
|
106
102
|
/** The call's results */
|
|
107
|
-
avmCallResults:
|
|
103
|
+
avmCallResults: AvmFinalizedCallResult,
|
|
108
104
|
): EnqueuedPublicCallExecutionResultWithSideEffects;
|
|
109
105
|
toPublicFunctionCallResult(
|
|
110
106
|
/** The execution environment of the nested call. */
|
|
111
107
|
avmEnvironment: AvmExecutionEnvironment,
|
|
112
108
|
/** How much gas was available for this public execution. */
|
|
113
109
|
startGasLeft: Gas,
|
|
114
|
-
/** How much gas was left after this public execution. */
|
|
115
|
-
endGasLeft: Gas,
|
|
116
110
|
/** Bytecode used for this execution. */
|
|
117
111
|
bytecode: Buffer,
|
|
118
112
|
/** The call's results */
|
|
119
|
-
avmCallResults:
|
|
113
|
+
avmCallResults: AvmFinalizedCallResult,
|
|
120
114
|
/** Function name for logging */
|
|
121
115
|
functionName: string,
|
|
122
116
|
): PublicFunctionCallResult;
|
|
@@ -48,13 +48,11 @@ import { computeNoteHashNonce, computeUniqueNoteHash, computeVarArgsHash, siloNo
|
|
|
48
48
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
49
49
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
50
50
|
|
|
51
|
-
import {
|
|
51
|
+
import { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
52
|
+
import { AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
52
53
|
import { type AvmPersistableStateManager } from '../avm/journal/journal.js';
|
|
53
|
-
import { getPublicFunctionDebugName } from '../common/debug_fn_name.js';
|
|
54
54
|
import { type PublicEnqueuedCallSideEffectTrace } from './enqueued_call_side_effect_trace.js';
|
|
55
55
|
import { type EnqueuedPublicCallExecutionResult, type PublicFunctionCallResult } from './execution.js';
|
|
56
|
-
import { createAvmExecutionEnvironment } from './executor.js';
|
|
57
|
-
import { type WorldStateDB } from './public_db_sources.js';
|
|
58
56
|
|
|
59
57
|
export function generateAvmCircuitPublicInputs(
|
|
60
58
|
trace: PublicEnqueuedCallSideEffectTrace,
|
|
@@ -196,9 +194,9 @@ export function generateAvmCircuitPublicInputs(
|
|
|
196
194
|
return avmCircuitPublicInputs;
|
|
197
195
|
}
|
|
198
196
|
|
|
199
|
-
export
|
|
197
|
+
export function generateAvmProvingRequest(
|
|
200
198
|
real: boolean,
|
|
201
|
-
|
|
199
|
+
fnName: string,
|
|
202
200
|
stateManager: AvmPersistableStateManager,
|
|
203
201
|
historicalHeader: Header,
|
|
204
202
|
globalVariables: GlobalVariables,
|
|
@@ -206,16 +204,19 @@ export async function generateAvmProvingRequest(
|
|
|
206
204
|
result: EnqueuedPublicCallExecutionResult,
|
|
207
205
|
allocatedGas: Gas,
|
|
208
206
|
transactionFee: Fr,
|
|
209
|
-
):
|
|
210
|
-
const
|
|
211
|
-
worldStateDB,
|
|
207
|
+
): AvmProvingRequest {
|
|
208
|
+
const avmExecutionEnv = new AvmExecutionEnvironment(
|
|
212
209
|
executionRequest.callContext.contractAddress,
|
|
210
|
+
executionRequest.callContext.msgSender,
|
|
213
211
|
executionRequest.callContext.functionSelector,
|
|
212
|
+
/*contractCallDepth=*/ Fr.zero(),
|
|
213
|
+
transactionFee,
|
|
214
|
+
globalVariables,
|
|
215
|
+
executionRequest.callContext.isStaticCall,
|
|
214
216
|
executionRequest.args,
|
|
215
217
|
);
|
|
216
218
|
|
|
217
|
-
const
|
|
218
|
-
const avmCallResult = new AvmContractCallResult(result.reverted, result.returnValues);
|
|
219
|
+
const avmCallResult = new AvmFinalizedCallResult(result.reverted, result.returnValues, result.endGasLeft);
|
|
219
220
|
|
|
220
221
|
// Generate an AVM proving request
|
|
221
222
|
let avmProvingRequest: AvmProvingRequest;
|
|
@@ -223,7 +224,6 @@ export async function generateAvmProvingRequest(
|
|
|
223
224
|
const deprecatedFunctionCallResult = stateManager.trace.toPublicFunctionCallResult(
|
|
224
225
|
avmExecutionEnv,
|
|
225
226
|
/*startGasLeft=*/ allocatedGas,
|
|
226
|
-
/*endGasLeft=*/ Gas.from(result.endGasLeft),
|
|
227
227
|
Buffer.alloc(0),
|
|
228
228
|
avmCallResult,
|
|
229
229
|
fnName,
|
package/dest/mocks/fixtures.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { SimulationError } from '@aztec/circuit-types';
|
|
2
|
-
import { Fr } from '@aztec/circuits.js';
|
|
3
|
-
import { FunctionType } from '@aztec/foundation/abi';
|
|
4
|
-
import { type EnqueuedPublicCallExecutionResult } from '../public/execution.js';
|
|
5
|
-
export declare class PublicExecutionResultBuilder {
|
|
6
|
-
private _returnValues;
|
|
7
|
-
private _reverted;
|
|
8
|
-
private _revertReason;
|
|
9
|
-
constructor();
|
|
10
|
-
static empty(basicRevert?: boolean): PublicExecutionResultBuilder;
|
|
11
|
-
static fromPublicExecutionRequest({ returnValues, revertReason, }: {
|
|
12
|
-
returnValues?: Fr[];
|
|
13
|
-
revertReason?: SimulationError;
|
|
14
|
-
}): PublicExecutionResultBuilder;
|
|
15
|
-
withReturnValues(...values: Fr[]): PublicExecutionResultBuilder;
|
|
16
|
-
withReverted(reason: SimulationError): PublicExecutionResultBuilder;
|
|
17
|
-
build(overrides?: Partial<EnqueuedPublicCallExecutionResult>): EnqueuedPublicCallExecutionResult;
|
|
18
|
-
}
|
|
19
|
-
export declare const makeFunctionCall: (name?: string, to?: import("@aztec/circuits.js").AztecAddress, selector?: import("@aztec/circuits.js").FunctionSelector, type?: FunctionType, args?: any[], isStatic?: boolean, returnTypes?: never[]) => {
|
|
20
|
-
name: string;
|
|
21
|
-
to: import("@aztec/circuits.js").AztecAddress;
|
|
22
|
-
selector: import("@aztec/circuits.js").FunctionSelector;
|
|
23
|
-
type: FunctionType;
|
|
24
|
-
args: any[];
|
|
25
|
-
isStatic: boolean;
|
|
26
|
-
returnTypes: never[];
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/mocks/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAe,EAAE,EAAO,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,KAAK,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAEhF,qBAAa,4BAA4B;IACvC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAA0C;;IAI/D,MAAM,CAAC,KAAK,CAAC,WAAW,UAAQ;IAQhC,MAAM,CAAC,0BAA0B,CAAC,EAChC,YAA2B,EAC3B,YAAwB,GACzB,EAAE;QACD,YAAY,CAAC,EAAE,EAAE,EAAE,CAAC;QACpB,YAAY,CAAC,EAAE,eAAe,CAAC;KAChC,GAAG,4BAA4B;IAWhC,gBAAgB,CAAC,GAAG,MAAM,EAAE,EAAE,EAAE,GAAG,4BAA4B;IAK/D,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,4BAA4B;IAMnE,KAAK,CAAC,SAAS,GAAE,OAAO,CAAC,iCAAiC,CAAM,GAAG,iCAAiC;CAUrG;AAED,eAAO,MAAM,gBAAgB;;;;;;;;CAQmC,CAAC"}
|
package/dest/mocks/fixtures.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { SimulationError } from '@aztec/circuit-types';
|
|
2
|
-
import { ARGS_LENGTH, Fr, Gas } from '@aztec/circuits.js';
|
|
3
|
-
import { makeAztecAddress, makeSelector } from '@aztec/circuits.js/testing';
|
|
4
|
-
import { FunctionType } from '@aztec/foundation/abi';
|
|
5
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
6
|
-
export class PublicExecutionResultBuilder {
|
|
7
|
-
constructor() {
|
|
8
|
-
this._returnValues = [];
|
|
9
|
-
this._reverted = false;
|
|
10
|
-
this._revertReason = undefined;
|
|
11
|
-
}
|
|
12
|
-
static empty(basicRevert = false) {
|
|
13
|
-
const builder = new PublicExecutionResultBuilder();
|
|
14
|
-
if (basicRevert) {
|
|
15
|
-
builder.withReverted(new SimulationError('Simulation failed', []));
|
|
16
|
-
}
|
|
17
|
-
return builder;
|
|
18
|
-
}
|
|
19
|
-
static fromPublicExecutionRequest({ returnValues = [new Fr(1n)], revertReason = undefined, }) {
|
|
20
|
-
const builder = new PublicExecutionResultBuilder();
|
|
21
|
-
builder.withReturnValues(...returnValues);
|
|
22
|
-
if (revertReason) {
|
|
23
|
-
builder.withReverted(revertReason);
|
|
24
|
-
}
|
|
25
|
-
return builder;
|
|
26
|
-
}
|
|
27
|
-
withReturnValues(...values) {
|
|
28
|
-
this._returnValues.push(...values);
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
withReverted(reason) {
|
|
32
|
-
this._reverted = true;
|
|
33
|
-
this._revertReason = reason;
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
build(overrides = {}) {
|
|
37
|
-
return {
|
|
38
|
-
endGasLeft: Gas.empty(),
|
|
39
|
-
endSideEffectCounter: Fr.ZERO,
|
|
40
|
-
returnValues: padArrayEnd(this._returnValues, Fr.ZERO, 4), // TODO(#5450) Need to use the proper return values here
|
|
41
|
-
reverted: this._reverted,
|
|
42
|
-
revertReason: this._revertReason,
|
|
43
|
-
...overrides,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export const makeFunctionCall = (name = 'function', to = makeAztecAddress(30), selector = makeSelector(5), type = FunctionType.PUBLIC, args = new Array(ARGS_LENGTH).fill(Fr.ZERO), isStatic = false, returnTypes = []) => ({ name, to, selector, type, args, isStatic, returnTypes });
|
|
48
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbW9ja3MvZml4dHVyZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxXQUFXLEVBQUUsRUFBRSxFQUFFLEdBQUcsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzFELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxZQUFZLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM1RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDckQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBSTNELE1BQU0sT0FBTyw0QkFBNEI7SUFLdkM7UUFKUSxrQkFBYSxHQUFTLEVBQUUsQ0FBQztRQUN6QixjQUFTLEdBQUcsS0FBSyxDQUFDO1FBQ2xCLGtCQUFhLEdBQWdDLFNBQVMsQ0FBQztJQUVoRCxDQUFDO0lBRWhCLE1BQU0sQ0FBQyxLQUFLLENBQUMsV0FBVyxHQUFHLEtBQUs7UUFDOUIsTUFBTSxPQUFPLEdBQUcsSUFBSSw0QkFBNEIsRUFBRSxDQUFDO1FBQ25ELElBQUksV0FBVyxFQUFFLENBQUM7WUFDaEIsT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLGVBQWUsQ0FBQyxtQkFBbUIsRUFBRSxFQUFFLENBQUMsQ0FBQyxDQUFDO1FBQ3JFLENBQUM7UUFDRCxPQUFPLE9BQU8sQ0FBQztJQUNqQixDQUFDO0lBRUQsTUFBTSxDQUFDLDBCQUEwQixDQUFDLEVBQ2hDLFlBQVksR0FBRyxDQUFDLElBQUksRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDLEVBQzNCLFlBQVksR0FBRyxTQUFTLEdBSXpCO1FBQ0MsTUFBTSxPQUFPLEdBQUcsSUFBSSw0QkFBNEIsRUFBRSxDQUFDO1FBRW5ELE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLFlBQVksQ0FBQyxDQUFDO1FBQzFDLElBQUksWUFBWSxFQUFFLENBQUM7WUFDakIsT0FBTyxDQUFDLFlBQVksQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUNyQyxDQUFDO1FBRUQsT0FBTyxPQUFPLENBQUM7SUFDakIsQ0FBQztJQUVELGdCQUFnQixDQUFDLEdBQUcsTUFBWTtRQUM5QixJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxHQUFHLE1BQU0sQ0FBQyxDQUFDO1FBQ25DLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELFlBQVksQ0FBQyxNQUF1QjtRQUNsQyxJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQztRQUN0QixJQUFJLENBQUMsYUFBYSxHQUFHLE1BQU0sQ0FBQztRQUM1QixPQUFPLElBQUksQ0FBQztJQUNkLENBQUM7SUFFRCxLQUFLLENBQUMsWUFBd0QsRUFBRTtRQUM5RCxPQUFPO1lBQ0wsVUFBVSxFQUFFLEdBQUcsQ0FBQyxLQUFLLEVBQUU7WUFDdkIsb0JBQW9CLEVBQUUsRUFBRSxDQUFDLElBQUk7WUFDN0IsWUFBWSxFQUFFLFdBQVcsQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFLEVBQUUsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDLEVBQUUsd0RBQXdEO1lBQ25ILFFBQVEsRUFBRSxJQUFJLENBQUMsU0FBUztZQUN4QixZQUFZLEVBQUUsSUFBSSxDQUFDLGFBQWE7WUFDaEMsR0FBRyxTQUFTO1NBQ2IsQ0FBQztJQUNKLENBQUM7Q0FDRjtBQUVELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQzlCLElBQUksR0FBRyxVQUFVLEVBQ2pCLEVBQUUsR0FBRyxnQkFBZ0IsQ0FBQyxFQUFFLENBQUMsRUFDekIsUUFBUSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsRUFDMUIsSUFBSSxHQUFHLFlBQVksQ0FBQyxNQUFNLEVBQzFCLElBQUksR0FBRyxJQUFJLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxFQUMzQyxRQUFRLEdBQUcsS0FBSyxFQUNoQixXQUFXLEdBQUcsRUFBRSxFQUNoQixFQUFFLENBQUMsQ0FBQyxFQUFFLElBQUksRUFBRSxFQUFFLEVBQUUsUUFBUSxFQUFFLElBQUksRUFBRSxJQUFJLEVBQUUsUUFBUSxFQUFFLFdBQVcsRUFBRSxDQUFDLENBQUMifQ==
|
package/dest/mocks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dest/mocks/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type PublicExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
-
import { Fr, Gas, type GlobalVariables } from '@aztec/circuits.js';
|
|
3
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
4
|
-
import { AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
5
|
-
import { AvmPersistableStateManager } from '../avm/journal/index.js';
|
|
6
|
-
import { type EnqueuedPublicCallExecutionResult, type EnqueuedPublicCallExecutionResultWithSideEffects } from './execution.js';
|
|
7
|
-
import { ExecutorMetrics } from './executor_metrics.js';
|
|
8
|
-
import { type WorldStateDB } from './public_db_sources.js';
|
|
9
|
-
/**
|
|
10
|
-
* Handles execution of public functions.
|
|
11
|
-
*/
|
|
12
|
-
export declare class PublicExecutor {
|
|
13
|
-
private readonly worldStateDB;
|
|
14
|
-
metrics: ExecutorMetrics;
|
|
15
|
-
constructor(worldStateDB: WorldStateDB, client: TelemetryClient);
|
|
16
|
-
static readonly log: import("@aztec/foundation/log").Logger;
|
|
17
|
-
/**
|
|
18
|
-
* Simulate a public execution request.
|
|
19
|
-
* @param executionRequest - The execution to run.
|
|
20
|
-
* @param globalVariables - The global variables to use.
|
|
21
|
-
* @param allocatedGas - The gas available at the start of this enqueued call.
|
|
22
|
-
* @param transactionFee - Fee offered for this TX.
|
|
23
|
-
* @returns The result of execution.
|
|
24
|
-
*/
|
|
25
|
-
simulate(stateManager: AvmPersistableStateManager, executionRequest: PublicExecutionRequest, globalVariables: GlobalVariables, allocatedGas: Gas, transactionFee?: Fr): Promise<EnqueuedPublicCallExecutionResult>;
|
|
26
|
-
/**
|
|
27
|
-
* Simulate an enqueued call on its own, and include its side effects in its results.
|
|
28
|
-
* @param executionRequest - The execution to run.
|
|
29
|
-
* @param globalVariables - The global variables to use.
|
|
30
|
-
* @param allocatedGas - The gas available at the start of this enqueued call.
|
|
31
|
-
* @param transactionFee - Fee offered for this TX.
|
|
32
|
-
* @param startSideEffectCounter - The start counter to initialize the side effect trace with.
|
|
33
|
-
* @returns The result of execution including side effect vectors.
|
|
34
|
-
* FIXME: this function is only used by the TXE. Ideally we would not support this as an external interface.
|
|
35
|
-
* Avoid using this interface as it it shouldn't really exist in the first place.
|
|
36
|
-
*/
|
|
37
|
-
simulateIsolatedEnqueuedCall(executionRequest: PublicExecutionRequest, globalVariables: GlobalVariables, allocatedGas: Gas, transactionFee?: Fr, startSideEffectCounter?: number): Promise<EnqueuedPublicCallExecutionResultWithSideEffects>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Convert a PublicExecutionRequest object to an AvmExecutionEnvironment
|
|
41
|
-
*
|
|
42
|
-
* @param executionRequest
|
|
43
|
-
* @param globalVariables
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
export declare function createAvmExecutionEnvironment(executionRequest: PublicExecutionRequest, globalVariables: GlobalVariables, transactionFee: Fr): AvmExecutionEnvironment;
|
|
47
|
-
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/public/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAIrE,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,gDAAgD,EACtD,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;GAEG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,YAAY;IAFzC,OAAO,EAAE,eAAe,CAAC;gBAEI,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe;IAIhF,MAAM,CAAC,QAAQ,CAAC,GAAG,yCAAwD;IAE3E;;;;;;;OAOG;IACU,QAAQ,CACnB,YAAY,EAAE,0BAA0B,EACxC,gBAAgB,EAAE,sBAAsB,EACxC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,GAAG,EACjB,cAAc,GAAE,EAAY,GAC3B,OAAO,CAAC,iCAAiC,CAAC;IAkD7C;;;;;;;;;;OAUG;IACU,4BAA4B,CACvC,gBAAgB,EAAE,sBAAsB,EACxC,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,GAAG,EACjB,cAAc,GAAE,EAAW,EAC3B,sBAAsB,GAAE,MAAU,GACjC,OAAO,CAAC,gDAAgD,CAAC;CAa7D;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,sBAAsB,EACxC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,EAAE,GACjB,uBAAuB,CAWzB"}
|