@aztec/simulator 0.44.0 → 0.45.1
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/oracle/oracle.d.ts +3 -3
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.js +8 -8
- package/dest/acvm/oracle/typed_oracle.d.ts +1 -1
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.js +2 -2
- package/dest/avm/avm_context.d.ts +1 -1
- package/dest/avm/avm_context.d.ts.map +1 -1
- package/dest/avm/avm_context.js +3 -3
- package/dest/avm/{avm_message_call_result.d.ts → avm_contract_call_result.d.ts} +2 -2
- package/dest/avm/avm_contract_call_result.d.ts.map +1 -0
- package/dest/avm/avm_contract_call_result.js +18 -0
- package/dest/avm/avm_execution_environment.d.ts +7 -11
- package/dest/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/avm/avm_execution_environment.js +11 -20
- package/dest/avm/avm_gas.js +2 -2
- package/dest/avm/avm_simulator.d.ts +4 -4
- package/dest/avm/avm_simulator.d.ts.map +1 -1
- package/dest/avm/avm_simulator.js +7 -7
- package/dest/avm/bytecode_utils.d.ts +5 -0
- package/dest/avm/bytecode_utils.d.ts.map +1 -0
- package/dest/avm/bytecode_utils.js +29 -0
- package/dest/avm/errors.js +2 -2
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +3 -3
- package/dest/avm/journal/journal.d.ts +5 -5
- package/dest/avm/journal/journal.d.ts.map +1 -1
- package/dest/avm/journal/journal.js +9 -7
- package/dest/avm/journal/public_storage.d.ts +1 -1
- package/dest/avm/journal/public_storage.d.ts.map +1 -1
- package/dest/avm/journal/public_storage.js +2 -2
- package/dest/avm/opcodes/accrued_substate.d.ts +1 -2
- package/dest/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/avm/opcodes/accrued_substate.js +6 -15
- package/dest/avm/opcodes/environment_getters.d.ts +13 -8
- package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/avm/opcodes/environment_getters.js +20 -13
- package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/avm/opcodes/external_calls.js +1 -2
- package/dest/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/avm/serialization/bytecode_serialization.js +5 -5
- package/dest/avm/serialization/instruction_serialization.d.ts +9 -9
- package/dest/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/avm/serialization/instruction_serialization.js +10 -10
- package/dest/client/client_execution_context.d.ts +3 -1
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +9 -7
- package/dest/client/view_data_oracle.d.ts +3 -1
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +6 -4
- package/dest/mocks/fixtures.d.ts +3 -3
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +7 -7
- package/dest/public/abstract_phase_manager.js +21 -21
- package/dest/public/execution.d.ts +10 -9
- package/dest/public/execution.d.ts.map +1 -1
- package/dest/public/execution.js +6 -6
- package/dest/public/executor.d.ts +4 -4
- package/dest/public/executor.d.ts.map +1 -1
- package/dest/public/executor.js +19 -14
- package/dest/public/hints_builder.d.ts +3 -3
- package/dest/public/hints_builder.d.ts.map +1 -1
- package/dest/public/hints_builder.js +1 -1
- package/dest/public/index.d.ts +1 -1
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_kernel.d.ts +1 -1
- package/dest/public/public_kernel.d.ts.map +1 -1
- package/dest/public/public_kernel.js +2 -2
- package/dest/public/side_effect_trace.d.ts +7 -6
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +32 -18
- package/dest/public/side_effect_trace_interface.d.ts +3 -3
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/tail_phase_manager.js +3 -3
- package/dest/rollup/rollup.d.ts +1 -1
- package/dest/rollup/rollup.d.ts.map +1 -1
- package/dest/rollup/rollup.js +2 -2
- package/package.json +9 -9
- package/src/acvm/oracle/oracle.ts +16 -20
- package/src/acvm/oracle/typed_oracle.ts +6 -1
- package/src/avm/avm_context.ts +2 -2
- package/src/avm/{avm_message_call_result.ts → avm_contract_call_result.ts} +1 -1
- package/src/avm/avm_execution_environment.ts +10 -27
- package/src/avm/avm_gas.ts +1 -1
- package/src/avm/avm_simulator.ts +9 -11
- package/src/avm/bytecode_utils.ts +32 -0
- package/src/avm/errors.ts +1 -1
- package/src/avm/fixtures/index.ts +3 -6
- package/src/avm/journal/journal.ts +14 -11
- package/src/avm/journal/public_storage.ts +2 -2
- package/src/avm/opcodes/accrued_substate.ts +6 -19
- package/src/avm/opcodes/environment_getters.ts +23 -14
- package/src/avm/opcodes/external_calls.ts +2 -3
- package/src/avm/serialization/bytecode_serialization.ts +4 -3
- package/src/avm/serialization/instruction_serialization.ts +3 -3
- package/src/client/client_execution_context.ts +15 -6
- package/src/client/view_data_oracle.ts +12 -3
- package/src/mocks/fixtures.ts +8 -8
- package/src/public/abstract_phase_manager.ts +26 -26
- package/src/public/execution.ts +19 -15
- package/src/public/executor.ts +35 -20
- package/src/public/hints_builder.ts +3 -3
- package/src/public/index.ts +1 -1
- package/src/public/public_kernel.ts +2 -1
- package/src/public/side_effect_trace.ts +40 -22
- package/src/public/side_effect_trace_interface.ts +3 -3
- package/src/public/tail_phase_manager.ts +4 -4
- package/src/rollup/rollup.ts +3 -1
- package/dest/avm/avm_message_call_result.d.ts.map +0 -1
- package/dest/avm/avm_message_call_result.js +0 -18
- package/dest/public/transitional_adaptors.d.ts +0 -17
- package/dest/public/transitional_adaptors.d.ts.map +0 -1
- package/dest/public/transitional_adaptors.js +0 -42
- package/src/public/transitional_adaptors.ts +0 -70
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
L2ToL1Message,
|
|
26
26
|
LogHash,
|
|
27
27
|
MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
MAX_NEW_NULLIFIERS_PER_CALL,
|
|
28
|
+
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
29
|
+
MAX_NOTE_HASHES_PER_CALL,
|
|
31
30
|
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
31
|
+
MAX_NULLIFIERS_PER_CALL,
|
|
32
32
|
MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL,
|
|
33
33
|
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
34
34
|
MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
|
|
@@ -57,7 +57,7 @@ import { computeVarArgsHash } from '@aztec/circuits.js/hash';
|
|
|
57
57
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
58
58
|
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
59
59
|
import {
|
|
60
|
-
type
|
|
60
|
+
type PublicExecutionRequest,
|
|
61
61
|
type PublicExecutionResult,
|
|
62
62
|
type PublicExecutor,
|
|
63
63
|
accumulateReturnValues,
|
|
@@ -176,12 +176,14 @@ export abstract class AbstractPhaseManager {
|
|
|
176
176
|
call => revertibleCallStack.find(p => p.equals(call)) || nonRevertibleCallStack.find(p => p.equals(call)),
|
|
177
177
|
);
|
|
178
178
|
|
|
179
|
+
const teardownCallStack = tx.publicTeardownFunctionCall.isEmpty() ? [] : [tx.publicTeardownFunctionCall];
|
|
180
|
+
|
|
179
181
|
if (callRequestsStack.length === 0) {
|
|
180
182
|
return {
|
|
181
183
|
[PublicKernelType.NON_PUBLIC]: [],
|
|
182
184
|
[PublicKernelType.SETUP]: [],
|
|
183
185
|
[PublicKernelType.APP_LOGIC]: [],
|
|
184
|
-
[PublicKernelType.TEARDOWN]:
|
|
186
|
+
[PublicKernelType.TEARDOWN]: teardownCallStack,
|
|
185
187
|
[PublicKernelType.TAIL]: [],
|
|
186
188
|
};
|
|
187
189
|
}
|
|
@@ -191,8 +193,6 @@ export abstract class AbstractPhaseManager {
|
|
|
191
193
|
c => revertibleCallStack.findIndex(p => p.equals(c)) !== -1,
|
|
192
194
|
);
|
|
193
195
|
|
|
194
|
-
const teardownCallStack = tx.publicTeardownFunctionCall.isEmpty() ? [] : [tx.publicTeardownFunctionCall];
|
|
195
|
-
|
|
196
196
|
if (firstRevertibleCallIndex === 0) {
|
|
197
197
|
return {
|
|
198
198
|
[PublicKernelType.NON_PUBLIC]: [],
|
|
@@ -256,7 +256,7 @@ export abstract class AbstractPhaseManager {
|
|
|
256
256
|
const enqueuedCallResults = [];
|
|
257
257
|
|
|
258
258
|
for (const enqueuedCall of enqueuedCalls) {
|
|
259
|
-
const executionStack: (
|
|
259
|
+
const executionStack: (PublicExecutionRequest | PublicExecutionResult)[] = [enqueuedCall];
|
|
260
260
|
|
|
261
261
|
// Keep track of which result is for the top/enqueued call
|
|
262
262
|
let enqueuedExecutionResult: PublicExecutionResult | undefined;
|
|
@@ -283,10 +283,10 @@ export abstract class AbstractPhaseManager {
|
|
|
283
283
|
|
|
284
284
|
// Sanity check for a current upstream assumption.
|
|
285
285
|
// Consumers of the result seem to expect "reverted <=> revertReason !== undefined".
|
|
286
|
-
const functionSelector = result.
|
|
286
|
+
const functionSelector = result.executionRequest.functionSelector.toString();
|
|
287
287
|
if (result.reverted && !result.revertReason) {
|
|
288
288
|
throw new Error(
|
|
289
|
-
`Simulation of ${result.
|
|
289
|
+
`Simulation of ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
|
|
290
290
|
result.functionName
|
|
291
291
|
}) reverted with no reason.`,
|
|
292
292
|
);
|
|
@@ -294,7 +294,7 @@ export abstract class AbstractPhaseManager {
|
|
|
294
294
|
|
|
295
295
|
if (result.reverted && !PhaseIsRevertible[this.phase]) {
|
|
296
296
|
this.log.debug(
|
|
297
|
-
`Simulation error on ${result.
|
|
297
|
+
`Simulation error on ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
|
|
298
298
|
result.functionName
|
|
299
299
|
}) with reason: ${result.revertReason}`,
|
|
300
300
|
);
|
|
@@ -308,7 +308,7 @@ export abstract class AbstractPhaseManager {
|
|
|
308
308
|
|
|
309
309
|
// Simulate the public kernel circuit.
|
|
310
310
|
this.log.debug(
|
|
311
|
-
`Running public kernel circuit for ${result.
|
|
311
|
+
`Running public kernel circuit for ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
|
|
312
312
|
result.functionName
|
|
313
313
|
})`,
|
|
314
314
|
);
|
|
@@ -331,7 +331,7 @@ export abstract class AbstractPhaseManager {
|
|
|
331
331
|
// but the kernel carries the reverted flag forward. But if the simulator reverts, so should the kernel.
|
|
332
332
|
if (result.reverted && kernelPublicOutput.revertCode.isOK()) {
|
|
333
333
|
throw new Error(
|
|
334
|
-
`Public kernel circuit did not revert on ${result.
|
|
334
|
+
`Public kernel circuit did not revert on ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
|
|
335
335
|
result.functionName
|
|
336
336
|
}), but simulator did.`,
|
|
337
337
|
);
|
|
@@ -341,7 +341,7 @@ export abstract class AbstractPhaseManager {
|
|
|
341
341
|
// So safely return the revert reason and the kernel output (which has had its revertible side effects dropped)
|
|
342
342
|
if (result.reverted) {
|
|
343
343
|
this.log.debug(
|
|
344
|
-
`Reverting on ${result.
|
|
344
|
+
`Reverting on ${result.executionRequest.contractAddress.toString()}:${functionSelector}(${
|
|
345
345
|
result.functionName
|
|
346
346
|
}) with reason: ${result.revertReason}`,
|
|
347
347
|
);
|
|
@@ -375,7 +375,7 @@ export abstract class AbstractPhaseManager {
|
|
|
375
375
|
|
|
376
376
|
/** Returns all pending private and public nullifiers. */
|
|
377
377
|
private getSiloedPendingNullifiers(ko: PublicKernelCircuitPublicInputs) {
|
|
378
|
-
return [...ko.end.
|
|
378
|
+
return [...ko.end.nullifiers, ...ko.endNonRevertibleData.nullifiers].filter(n => !n.isEmpty());
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
protected getAvailableGas(tx: Tx, previousPublicKernelOutput: PublicKernelCircuitPublicInputs) {
|
|
@@ -430,12 +430,12 @@ export abstract class AbstractPhaseManager {
|
|
|
430
430
|
);
|
|
431
431
|
|
|
432
432
|
const publicCircuitPublicInputs = PublicCircuitPublicInputs.from({
|
|
433
|
-
callContext: result.
|
|
433
|
+
callContext: result.executionRequest.callContext,
|
|
434
434
|
proverAddress: AztecAddress.ZERO,
|
|
435
|
-
argsHash: computeVarArgsHash(result.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
argsHash: computeVarArgsHash(result.executionRequest.args),
|
|
436
|
+
noteHashes: padArrayEnd(result.noteHashes, NoteHash.empty(), MAX_NOTE_HASHES_PER_CALL),
|
|
437
|
+
nullifiers: padArrayEnd(result.nullifiers, Nullifier.empty(), MAX_NULLIFIERS_PER_CALL),
|
|
438
|
+
l2ToL1Msgs: padArrayEnd(result.l2ToL1Messages, L2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
439
439
|
startSideEffectCounter: result.startSideEffectCounter,
|
|
440
440
|
endSideEffectCounter: result.endSideEffectCounter,
|
|
441
441
|
returnsHash: computeVarArgsHash(result.returnValues),
|
|
@@ -481,8 +481,8 @@ export abstract class AbstractPhaseManager {
|
|
|
481
481
|
});
|
|
482
482
|
|
|
483
483
|
return new PublicCallStackItem(
|
|
484
|
-
result.
|
|
485
|
-
new FunctionData(result.
|
|
484
|
+
result.executionRequest.contractAddress,
|
|
485
|
+
new FunctionData(result.executionRequest.functionSelector, false),
|
|
486
486
|
publicCircuitPublicInputs,
|
|
487
487
|
isExecutionRequest,
|
|
488
488
|
);
|
|
@@ -506,15 +506,15 @@ export abstract class AbstractPhaseManager {
|
|
|
506
506
|
*/
|
|
507
507
|
static getMaxSideEffectCounter(inputs: PublicKernelCircuitPublicInputs): number {
|
|
508
508
|
const sideEffectCounters = [
|
|
509
|
-
...inputs.endNonRevertibleData.
|
|
510
|
-
...inputs.endNonRevertibleData.
|
|
509
|
+
...inputs.endNonRevertibleData.noteHashes,
|
|
510
|
+
...inputs.endNonRevertibleData.nullifiers,
|
|
511
511
|
...inputs.endNonRevertibleData.noteEncryptedLogsHashes,
|
|
512
512
|
...inputs.endNonRevertibleData.encryptedLogsHashes,
|
|
513
513
|
...inputs.endNonRevertibleData.unencryptedLogsHashes,
|
|
514
514
|
...inputs.endNonRevertibleData.publicCallStack,
|
|
515
515
|
...inputs.endNonRevertibleData.publicDataUpdateRequests,
|
|
516
|
-
...inputs.end.
|
|
517
|
-
...inputs.end.
|
|
516
|
+
...inputs.end.noteHashes,
|
|
517
|
+
...inputs.end.nullifiers,
|
|
518
518
|
...inputs.end.noteEncryptedLogsHashes,
|
|
519
519
|
...inputs.end.encryptedLogsHashes,
|
|
520
520
|
...inputs.end.unencryptedLogsHashes,
|
package/src/public/execution.ts
CHANGED
|
@@ -18,8 +18,8 @@ import { type Gas } from '../avm/avm_gas.js';
|
|
|
18
18
|
* The public function execution result.
|
|
19
19
|
*/
|
|
20
20
|
export interface PublicExecutionResult {
|
|
21
|
-
/** The execution that triggered this result. */
|
|
22
|
-
|
|
21
|
+
/** The execution request that triggered this result. */
|
|
22
|
+
executionRequest: PublicExecutionRequest;
|
|
23
23
|
|
|
24
24
|
/** The side effect counter at the start of the function call. */
|
|
25
25
|
startSideEffectCounter: Fr;
|
|
@@ -48,11 +48,11 @@ export interface PublicExecutionResult {
|
|
|
48
48
|
/** The contract storage update requests performed by the function. */
|
|
49
49
|
contractStorageUpdateRequests: ContractStorageUpdateRequest[];
|
|
50
50
|
/** The new note hashes to be inserted into the note hashes tree. */
|
|
51
|
-
|
|
51
|
+
noteHashes: NoteHash[];
|
|
52
52
|
/** The new l2 to l1 messages generated in this call. */
|
|
53
|
-
|
|
53
|
+
l2ToL1Messages: L2ToL1Message[];
|
|
54
54
|
/** The new nullifiers to be inserted into the nullifier tree. */
|
|
55
|
-
|
|
55
|
+
nullifiers: Nullifier[];
|
|
56
56
|
/** The note hash read requests emitted in this call. */
|
|
57
57
|
noteHashReadRequests: ReadRequest[];
|
|
58
58
|
/** The nullifier read requests emitted in this call. */
|
|
@@ -90,9 +90,13 @@ export interface PublicExecutionResult {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* The execution of a public function.
|
|
93
|
+
* The execution request of a public function.
|
|
94
|
+
* A subset of PublicCallRequest
|
|
94
95
|
*/
|
|
95
|
-
export type
|
|
96
|
+
export type PublicExecutionRequest = Pick<
|
|
97
|
+
PublicCallRequest,
|
|
98
|
+
'contractAddress' | 'functionSelector' | 'callContext' | 'args'
|
|
99
|
+
>;
|
|
96
100
|
|
|
97
101
|
/**
|
|
98
102
|
* Returns if the input is a public execution result and not just a public execution.
|
|
@@ -100,9 +104,9 @@ export type PublicExecution = Pick<PublicCallRequest, 'contractAddress' | 'funct
|
|
|
100
104
|
* @returns Whether the input is a public execution result and not just a public execution.
|
|
101
105
|
*/
|
|
102
106
|
export function isPublicExecutionResult(
|
|
103
|
-
input:
|
|
107
|
+
input: PublicExecutionRequest | PublicExecutionResult,
|
|
104
108
|
): input is PublicExecutionResult {
|
|
105
|
-
return '
|
|
109
|
+
return 'executionRequest' in input && input.executionRequest !== undefined;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
/**
|
|
@@ -111,17 +115,17 @@ export function isPublicExecutionResult(
|
|
|
111
115
|
*/
|
|
112
116
|
|
|
113
117
|
export function checkValidStaticCall(
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
noteHashes: NoteHash[],
|
|
119
|
+
nullifiers: Nullifier[],
|
|
116
120
|
contractStorageUpdateRequests: ContractStorageUpdateRequest[],
|
|
117
|
-
|
|
121
|
+
l2ToL1Messages: L2ToL1Message[],
|
|
118
122
|
unencryptedLogs: UnencryptedFunctionL2Logs,
|
|
119
123
|
) {
|
|
120
124
|
if (
|
|
121
125
|
contractStorageUpdateRequests.length > 0 ||
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
noteHashes.length > 0 ||
|
|
127
|
+
nullifiers.length > 0 ||
|
|
128
|
+
l2ToL1Messages.length > 0 ||
|
|
125
129
|
unencryptedLogs.logs.length > 0
|
|
126
130
|
) {
|
|
127
131
|
throw new Error('Static call cannot update the state, emit L2->L1 messages or generate logs');
|
package/src/public/executor.ts
CHANGED
|
@@ -4,21 +4,21 @@ import { createDebugLogger } from '@aztec/foundation/log';
|
|
|
4
4
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
5
|
|
|
6
6
|
import { AvmContext } from '../avm/avm_context.js';
|
|
7
|
+
import { AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
7
8
|
import { AvmMachineState } from '../avm/avm_machine_state.js';
|
|
8
9
|
import { AvmSimulator } from '../avm/avm_simulator.js';
|
|
9
10
|
import { HostStorage } from '../avm/journal/host_storage.js';
|
|
10
11
|
import { AvmPersistableStateManager } from '../avm/journal/index.js';
|
|
11
12
|
import { type CommitmentsDB, type PublicContractsDB, type PublicStateDB } from './db_interfaces.js';
|
|
12
|
-
import { type
|
|
13
|
+
import { type PublicExecutionRequest, type PublicExecutionResult } from './execution.js';
|
|
13
14
|
import { PublicSideEffectTrace } from './side_effect_trace.js';
|
|
14
|
-
import { createAvmExecutionEnvironment } from './transitional_adaptors.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Handles execution of public functions.
|
|
18
18
|
*/
|
|
19
19
|
export class PublicExecutor {
|
|
20
20
|
constructor(
|
|
21
|
-
private readonly
|
|
21
|
+
private readonly publicStorageDB: PublicStateDB,
|
|
22
22
|
private readonly contractsDb: PublicContractsDB,
|
|
23
23
|
private readonly commitmentsDb: CommitmentsDB,
|
|
24
24
|
private readonly header: Header,
|
|
@@ -38,10 +38,10 @@ export class PublicExecutor {
|
|
|
38
38
|
* @returns The result of execution, including the results of all nested calls.
|
|
39
39
|
*/
|
|
40
40
|
public async simulate(
|
|
41
|
-
executionRequest:
|
|
41
|
+
executionRequest: PublicExecutionRequest,
|
|
42
42
|
globalVariables: GlobalVariables,
|
|
43
43
|
availableGas: Gas,
|
|
44
|
-
|
|
44
|
+
_txContext: TxContext,
|
|
45
45
|
pendingSiloedNullifiers: Nullifier[],
|
|
46
46
|
transactionFee: Fr = Fr.ZERO,
|
|
47
47
|
startSideEffectCounter: number = 0,
|
|
@@ -53,7 +53,7 @@ export class PublicExecutor {
|
|
|
53
53
|
PublicExecutor.log.verbose(`[AVM] Executing public external function ${fnName}.`);
|
|
54
54
|
const timer = new Timer();
|
|
55
55
|
|
|
56
|
-
const hostStorage = new HostStorage(this.
|
|
56
|
+
const hostStorage = new HostStorage(this.publicStorageDB, this.contractsDb, this.commitmentsDb);
|
|
57
57
|
const trace = new PublicSideEffectTrace(startSideEffectCounter);
|
|
58
58
|
const avmPersistableState = AvmPersistableStateManager.newWithPendingSiloedNullifiers(
|
|
59
59
|
hostStorage,
|
|
@@ -65,7 +65,6 @@ export class PublicExecutor {
|
|
|
65
65
|
executionRequest,
|
|
66
66
|
this.header,
|
|
67
67
|
globalVariables,
|
|
68
|
-
txContext.gasSettings,
|
|
69
68
|
transactionFee,
|
|
70
69
|
);
|
|
71
70
|
|
|
@@ -75,7 +74,7 @@ export class PublicExecutor {
|
|
|
75
74
|
const avmResult = await simulator.execute();
|
|
76
75
|
const bytecode = simulator.getBytecode()!;
|
|
77
76
|
|
|
78
|
-
// Commit the
|
|
77
|
+
// Commit the public storage state to the DBs since this is a top-level execution.
|
|
79
78
|
// Observe that this will write all the state changes to the DBs, not only the latest for each slot.
|
|
80
79
|
// However, the underlying DB keep a cache and will only write the latest state to disk.
|
|
81
80
|
// TODO(dbanks12): this should be unnecessary here or should be exposed by state manager
|
|
@@ -105,18 +104,34 @@ export class PublicExecutor {
|
|
|
105
104
|
// (which counts the request itself)
|
|
106
105
|
);
|
|
107
106
|
|
|
108
|
-
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): is this really needed?
|
|
109
|
-
// should already be handled in simulation.
|
|
110
|
-
if (executionRequest.callContext.isStaticCall) {
|
|
111
|
-
checkValidStaticCall(
|
|
112
|
-
publicExecutionResult.newNoteHashes,
|
|
113
|
-
publicExecutionResult.newNullifiers,
|
|
114
|
-
publicExecutionResult.contractStorageUpdateRequests,
|
|
115
|
-
publicExecutionResult.newL2ToL1Messages,
|
|
116
|
-
publicExecutionResult.unencryptedLogs,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
107
|
return publicExecutionResult;
|
|
121
108
|
}
|
|
122
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Convert a PublicExecutionRequest object to an AvmExecutionEnvironment
|
|
113
|
+
*
|
|
114
|
+
* @param executionRequest
|
|
115
|
+
* @param globalVariables
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
function createAvmExecutionEnvironment(
|
|
119
|
+
executionRequest: PublicExecutionRequest,
|
|
120
|
+
header: Header,
|
|
121
|
+
globalVariables: GlobalVariables,
|
|
122
|
+
transactionFee: Fr,
|
|
123
|
+
): AvmExecutionEnvironment {
|
|
124
|
+
return new AvmExecutionEnvironment(
|
|
125
|
+
executionRequest.contractAddress,
|
|
126
|
+
executionRequest.callContext.storageContractAddress,
|
|
127
|
+
executionRequest.callContext.msgSender,
|
|
128
|
+
executionRequest.functionSelector,
|
|
129
|
+
/*contractCallDepth=*/ Fr.zero(),
|
|
130
|
+
transactionFee,
|
|
131
|
+
header,
|
|
132
|
+
globalVariables,
|
|
133
|
+
executionRequest.callContext.isStaticCall,
|
|
134
|
+
executionRequest.callContext.isDelegateCall,
|
|
135
|
+
executionRequest.args,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MerkleTreeId } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
type Fr,
|
|
4
|
-
type
|
|
4
|
+
type MAX_NULLIFIERS_PER_TX,
|
|
5
5
|
type MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX,
|
|
6
6
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
7
7
|
type MAX_PUBLIC_DATA_HINTS,
|
|
@@ -30,7 +30,7 @@ export class HintsBuilder {
|
|
|
30
30
|
|
|
31
31
|
async getNullifierReadRequestHints(
|
|
32
32
|
nullifierReadRequests: Tuple<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
|
|
33
|
-
pendingNullifiers: Tuple<Nullifier, typeof
|
|
33
|
+
pendingNullifiers: Tuple<Nullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
34
34
|
) {
|
|
35
35
|
return (
|
|
36
36
|
await buildSiloedNullifierReadRequestHints(
|
|
@@ -45,7 +45,7 @@ export class HintsBuilder {
|
|
|
45
45
|
|
|
46
46
|
getNullifierNonExistentReadRequestHints(
|
|
47
47
|
nullifierNonExistentReadRequests: Tuple<ScopedReadRequest, typeof MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX>,
|
|
48
|
-
pendingNullifiers: Tuple<Nullifier, typeof
|
|
48
|
+
pendingNullifiers: Tuple<Nullifier, typeof MAX_NULLIFIERS_PER_TX>,
|
|
49
49
|
) {
|
|
50
50
|
return buildNullifierNonExistentReadRequestHints(this, nullifierNonExistentReadRequests, pendingNullifiers);
|
|
51
51
|
}
|
package/src/public/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './abstract_phase_manager.js';
|
|
2
2
|
export * from './db_interfaces.js';
|
|
3
|
-
export { isPublicExecutionResult, type
|
|
3
|
+
export { isPublicExecutionResult, type PublicExecutionRequest, type PublicExecutionResult } from './execution.js';
|
|
4
4
|
export { PublicExecutor } from './executor.js';
|
|
5
5
|
export * from './fee_payment.js';
|
|
6
6
|
export { HintsBuilder } from './hints_builder.js';
|
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
convertSimulatedPublicTeardownInputsToWitnessMap,
|
|
22
22
|
convertSimulatedPublicTeardownOutputFromWitnessMap,
|
|
23
23
|
} from '@aztec/noir-protocol-circuits-types';
|
|
24
|
-
import { type SimulationProvider, WASMSimulator } from '@aztec/simulator';
|
|
25
24
|
|
|
25
|
+
import { WASMSimulator } from '../providers/acvm_wasm.js';
|
|
26
|
+
import { type SimulationProvider } from '../providers/simulation_provider.js';
|
|
26
27
|
import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simulator.js';
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -16,19 +16,21 @@ import {
|
|
|
16
16
|
Nullifier,
|
|
17
17
|
ReadRequest,
|
|
18
18
|
} from '@aztec/circuits.js';
|
|
19
|
-
import { EventSelector } from '@aztec/foundation/abi';
|
|
20
19
|
import { Fr } from '@aztec/foundation/fields';
|
|
20
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
21
21
|
import { type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
22
22
|
|
|
23
|
+
import { type AvmContractCallResult } from '../avm/avm_contract_call_result.js';
|
|
23
24
|
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
24
|
-
import { type AvmContractCallResults } from '../avm/avm_message_call_result.js';
|
|
25
25
|
import { createSimulationError } from '../common/errors.js';
|
|
26
|
-
import { type
|
|
26
|
+
import { type PublicExecutionRequest, type PublicExecutionResult } from './execution.js';
|
|
27
27
|
import { type PublicSideEffectTraceInterface } from './side_effect_trace_interface.js';
|
|
28
28
|
|
|
29
29
|
export type TracedContractInstance = { exists: boolean } & ContractInstanceWithAddress;
|
|
30
30
|
|
|
31
31
|
export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
32
|
+
public logger = createDebugLogger('aztec:public_side_effect_trace');
|
|
33
|
+
|
|
32
34
|
/** The side effect counter increments with every call to the trace. */
|
|
33
35
|
private sideEffectCounter: number; // kept as number until finalized for efficiency
|
|
34
36
|
|
|
@@ -36,11 +38,11 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
36
38
|
private contractStorageUpdateRequests: ContractStorageUpdateRequest[] = [];
|
|
37
39
|
|
|
38
40
|
private noteHashReadRequests: ReadRequest[] = [];
|
|
39
|
-
private
|
|
41
|
+
private noteHashes: NoteHash[] = [];
|
|
40
42
|
|
|
41
43
|
private nullifierReadRequests: ReadRequest[] = [];
|
|
42
44
|
private nullifierNonExistentReadRequests: ReadRequest[] = [];
|
|
43
|
-
private
|
|
45
|
+
private nullifiers: Nullifier[] = [];
|
|
44
46
|
|
|
45
47
|
private l1ToL2MsgReadRequests: ReadRequest[] = [];
|
|
46
48
|
private newL2ToL1Messages: L2ToL1Message[] = [];
|
|
@@ -85,6 +87,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
85
87
|
this.avmCircuitHints.storageValues.items.push(
|
|
86
88
|
new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ value),
|
|
87
89
|
);
|
|
90
|
+
this.logger.debug(`SLOAD cnt: ${this.sideEffectCounter} val: ${value} slot: ${slot}`);
|
|
88
91
|
this.incrementSideEffectCounter();
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -94,6 +97,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
94
97
|
this.contractStorageUpdateRequests.push(
|
|
95
98
|
new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, storageAddress),
|
|
96
99
|
);
|
|
100
|
+
this.logger.debug(`SSTORE cnt: ${this.sideEffectCounter} val: ${value} slot: ${slot}`);
|
|
97
101
|
this.incrementSideEffectCounter();
|
|
98
102
|
}
|
|
99
103
|
|
|
@@ -106,6 +110,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
106
110
|
this.avmCircuitHints.noteHashExists.items.push(
|
|
107
111
|
new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ new Fr(exists ? 1 : 0)),
|
|
108
112
|
);
|
|
113
|
+
this.logger.debug(`NOTE_HASH_CHECK cnt: ${this.sideEffectCounter}`);
|
|
109
114
|
this.incrementSideEffectCounter();
|
|
110
115
|
}
|
|
111
116
|
|
|
@@ -116,7 +121,8 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
116
121
|
// IS there, and the AVM circuit should accept THAT noteHash as a hint. The circuit will then compare
|
|
117
122
|
// the noteHash against the one provided by the user code to determine what to return to the user (exists or not),
|
|
118
123
|
// and will then propagate the actually-present noteHash to its public inputs.
|
|
119
|
-
this.
|
|
124
|
+
this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter));
|
|
125
|
+
this.logger.debug(`NEW_NOTE_HASH cnt: ${this.sideEffectCounter}`);
|
|
120
126
|
this.incrementSideEffectCounter();
|
|
121
127
|
}
|
|
122
128
|
|
|
@@ -133,13 +139,15 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
133
139
|
this.avmCircuitHints.nullifierExists.items.push(
|
|
134
140
|
new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ new Fr(exists ? 1 : 0)),
|
|
135
141
|
);
|
|
142
|
+
this.logger.debug(`NULLIFIER_EXISTS cnt: ${this.sideEffectCounter}`);
|
|
136
143
|
this.incrementSideEffectCounter();
|
|
137
144
|
}
|
|
138
145
|
|
|
139
146
|
public traceNewNullifier(_storageAddress: Fr, nullifier: Fr) {
|
|
140
147
|
// TODO(4805): check if some threshold is reached for max new nullifier
|
|
141
148
|
// NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call
|
|
142
|
-
this.
|
|
149
|
+
this.nullifiers.push(new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO));
|
|
150
|
+
this.logger.debug(`NEW_NULLIFIER cnt: ${this.sideEffectCounter}`);
|
|
143
151
|
this.incrementSideEffectCounter();
|
|
144
152
|
}
|
|
145
153
|
|
|
@@ -152,6 +160,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
152
160
|
this.avmCircuitHints.l1ToL2MessageExists.items.push(
|
|
153
161
|
new AvmKeyValueHint(/*key=*/ new Fr(this.sideEffectCounter), /*value=*/ new Fr(exists ? 1 : 0)),
|
|
154
162
|
);
|
|
163
|
+
this.logger.debug(`L1_TO_L2_MSG_CHECK cnt: ${this.sideEffectCounter}`);
|
|
155
164
|
this.incrementSideEffectCounter();
|
|
156
165
|
}
|
|
157
166
|
|
|
@@ -159,21 +168,25 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
159
168
|
// TODO(4805): check if some threshold is reached for max messages
|
|
160
169
|
const recipientAddress = EthAddress.fromField(recipient);
|
|
161
170
|
this.newL2ToL1Messages.push(new L2ToL1Message(recipientAddress, content, this.sideEffectCounter));
|
|
171
|
+
this.logger.debug(`NEW_L2_TO_L1_MSG cnt: ${this.sideEffectCounter}`);
|
|
162
172
|
this.incrementSideEffectCounter();
|
|
163
173
|
}
|
|
164
174
|
|
|
165
|
-
public traceUnencryptedLog(contractAddress: Fr,
|
|
175
|
+
public traceUnencryptedLog(contractAddress: Fr, log: Fr[]) {
|
|
166
176
|
// TODO(4805): check if some threshold is reached for max logs
|
|
167
177
|
const ulog = new UnencryptedL2Log(
|
|
168
178
|
AztecAddress.fromField(contractAddress),
|
|
169
|
-
EventSelector.fromField(event),
|
|
170
179
|
Buffer.concat(log.map(f => f.toBuffer())),
|
|
171
180
|
);
|
|
172
181
|
const basicLogHash = Fr.fromBuffer(ulog.hash());
|
|
173
182
|
this.unencryptedLogs.push(ulog);
|
|
174
183
|
this.allUnencryptedLogs.push(ulog);
|
|
175
|
-
//
|
|
184
|
+
// We want the length of the buffer output from function_l2_logs -> toBuffer to equal the stored log length in the kernels.
|
|
185
|
+
// The kernels store the length of the processed log as 4 bytes; thus for this length value to match the log length stored in the kernels,
|
|
186
|
+
// we need to add four to the length here.
|
|
187
|
+
// https://github.com/AztecProtocol/aztec-packages/issues/6578#issuecomment-2125003435
|
|
176
188
|
this.unencryptedLogsHashes.push(new LogHash(basicLogHash, this.sideEffectCounter, new Fr(ulog.length + 4)));
|
|
189
|
+
this.logger.debug(`NEW_UNENCRYPTED_LOG cnt: ${this.sideEffectCounter}`);
|
|
177
190
|
this.incrementSideEffectCounter();
|
|
178
191
|
}
|
|
179
192
|
|
|
@@ -191,6 +204,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
191
204
|
instance.publicKeysHash,
|
|
192
205
|
),
|
|
193
206
|
);
|
|
207
|
+
this.logger.debug(`CONTRACT_INSTANCE cnt: ${this.sideEffectCounter}`);
|
|
194
208
|
this.incrementSideEffectCounter();
|
|
195
209
|
}
|
|
196
210
|
|
|
@@ -210,7 +224,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
210
224
|
/** Bytecode used for this execution. */
|
|
211
225
|
bytecode: Buffer,
|
|
212
226
|
/** The call's results */
|
|
213
|
-
avmCallResults:
|
|
227
|
+
avmCallResults: AvmContractCallResult,
|
|
214
228
|
/** Function name for logging */
|
|
215
229
|
functionName: string = 'unknown',
|
|
216
230
|
) {
|
|
@@ -234,7 +248,12 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
234
248
|
result.startGasLeft.l2Gas - result.endGasLeft.l2Gas,
|
|
235
249
|
);
|
|
236
250
|
this.avmCircuitHints.externalCalls.items.push(
|
|
237
|
-
new AvmExternalCallHint(
|
|
251
|
+
new AvmExternalCallHint(
|
|
252
|
+
/*success=*/ new Fr(result.reverted ? 0 : 1),
|
|
253
|
+
result.returnValues,
|
|
254
|
+
gasUsed,
|
|
255
|
+
result.endSideEffectCounter,
|
|
256
|
+
),
|
|
238
257
|
);
|
|
239
258
|
}
|
|
240
259
|
|
|
@@ -251,14 +270,14 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
251
270
|
/** Bytecode used for this execution. */
|
|
252
271
|
bytecode: Buffer,
|
|
253
272
|
/** The call's results */
|
|
254
|
-
avmCallResults:
|
|
273
|
+
avmCallResults: AvmContractCallResult,
|
|
255
274
|
/** Function name for logging */
|
|
256
275
|
functionName: string = 'unknown',
|
|
257
276
|
/** The side effect counter of the execution request itself */
|
|
258
277
|
requestSideEffectCounter: number = this.startSideEffectCounter,
|
|
259
278
|
): PublicExecutionResult {
|
|
260
279
|
return {
|
|
261
|
-
|
|
280
|
+
executionRequest: createPublicExecutionRequest(requestSideEffectCounter, avmEnvironment),
|
|
262
281
|
|
|
263
282
|
startSideEffectCounter: new Fr(this.startSideEffectCounter),
|
|
264
283
|
endSideEffectCounter: new Fr(this.sideEffectCounter),
|
|
@@ -275,12 +294,12 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
275
294
|
contractStorageReads: this.contractStorageReads,
|
|
276
295
|
contractStorageUpdateRequests: this.contractStorageUpdateRequests,
|
|
277
296
|
noteHashReadRequests: this.noteHashReadRequests,
|
|
278
|
-
|
|
297
|
+
noteHashes: this.noteHashes,
|
|
279
298
|
nullifierReadRequests: this.nullifierReadRequests,
|
|
280
299
|
nullifierNonExistentReadRequests: this.nullifierNonExistentReadRequests,
|
|
281
|
-
|
|
300
|
+
nullifiers: this.nullifiers,
|
|
282
301
|
l1ToL2MsgReadRequests: this.l1ToL2MsgReadRequests,
|
|
283
|
-
|
|
302
|
+
l2ToL1Messages: this.newL2ToL1Messages,
|
|
284
303
|
// correct the type on these now that they are finalized (lists won't grow)
|
|
285
304
|
unencryptedLogs: new UnencryptedFunctionL2Logs(this.unencryptedLogs),
|
|
286
305
|
allUnencryptedLogs: new UnencryptedFunctionL2Logs(this.allUnencryptedLogs),
|
|
@@ -303,21 +322,20 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
|
303
322
|
function createPublicExecutionRequest(
|
|
304
323
|
requestSideEffectCounter: number,
|
|
305
324
|
avmEnvironment: AvmExecutionEnvironment,
|
|
306
|
-
):
|
|
325
|
+
): PublicExecutionRequest {
|
|
307
326
|
const callContext = CallContext.from({
|
|
308
327
|
msgSender: avmEnvironment.sender,
|
|
309
328
|
storageContractAddress: avmEnvironment.storageAddress,
|
|
310
|
-
functionSelector: avmEnvironment.
|
|
329
|
+
functionSelector: avmEnvironment.functionSelector,
|
|
311
330
|
isDelegateCall: avmEnvironment.isDelegateCall,
|
|
312
331
|
isStaticCall: avmEnvironment.isStaticCall,
|
|
313
332
|
sideEffectCounter: requestSideEffectCounter,
|
|
314
333
|
});
|
|
315
|
-
|
|
334
|
+
return {
|
|
316
335
|
contractAddress: avmEnvironment.address,
|
|
317
|
-
functionSelector: avmEnvironment.
|
|
336
|
+
functionSelector: avmEnvironment.functionSelector,
|
|
318
337
|
callContext,
|
|
319
338
|
// execution request does not contain AvmContextInputs prefix
|
|
320
339
|
args: avmEnvironment.getCalldataWithoutPrefix(),
|
|
321
340
|
};
|
|
322
|
-
return execution;
|
|
323
341
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Gas } from '@aztec/circuits.js';
|
|
2
2
|
import { type Fr } from '@aztec/foundation/fields';
|
|
3
3
|
|
|
4
|
+
import { type AvmContractCallResult } from '../avm/avm_contract_call_result.js';
|
|
4
5
|
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
5
|
-
import { type AvmContractCallResults } from '../avm/avm_message_call_result.js';
|
|
6
6
|
import { type TracedContractInstance } from './side_effect_trace.js';
|
|
7
7
|
|
|
8
8
|
export interface PublicSideEffectTraceInterface {
|
|
@@ -17,7 +17,7 @@ export interface PublicSideEffectTraceInterface {
|
|
|
17
17
|
traceL1ToL2MessageCheck(contractAddress: Fr, msgHash: Fr, msgLeafIndex: Fr, exists: boolean): void;
|
|
18
18
|
// TODO(dbanks12): should new message accept contract address as arg?
|
|
19
19
|
traceNewL2ToL1Message(recipient: Fr, content: Fr): void;
|
|
20
|
-
traceUnencryptedLog(contractAddress: Fr,
|
|
20
|
+
traceUnencryptedLog(contractAddress: Fr, log: Fr[]): void;
|
|
21
21
|
// TODO(dbanks12): odd that getContractInstance is a one-off in that it accepts an entire object instead of components
|
|
22
22
|
traceGetContractInstance(instance: TracedContractInstance): void;
|
|
23
23
|
traceNestedCall(
|
|
@@ -34,7 +34,7 @@ export interface PublicSideEffectTraceInterface {
|
|
|
34
34
|
/** Bytecode used for this execution. */
|
|
35
35
|
bytecode: Buffer,
|
|
36
36
|
/** The call's results */
|
|
37
|
-
avmCallResults:
|
|
37
|
+
avmCallResults: AvmContractCallResult,
|
|
38
38
|
/** Function name */
|
|
39
39
|
functionName: string,
|
|
40
40
|
): void;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type GlobalVariables,
|
|
5
5
|
type Header,
|
|
6
6
|
type KernelCircuitPublicInputs,
|
|
7
|
-
|
|
7
|
+
MAX_NULLIFIERS_PER_TX,
|
|
8
8
|
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
9
9
|
type PublicKernelCircuitPublicInputs,
|
|
10
10
|
PublicKernelTailCircuitPrivateInputs,
|
|
@@ -69,9 +69,9 @@ export class TailPhaseManager extends AbstractPhaseManager {
|
|
|
69
69
|
const { validationRequests, endNonRevertibleData: nonRevertibleData, end: revertibleData } = previousOutput;
|
|
70
70
|
|
|
71
71
|
const pendingNullifiers = mergeAccumulatedData(
|
|
72
|
-
nonRevertibleData.
|
|
73
|
-
revertibleData.
|
|
74
|
-
|
|
72
|
+
nonRevertibleData.nullifiers,
|
|
73
|
+
revertibleData.nullifiers,
|
|
74
|
+
MAX_NULLIFIERS_PER_TX,
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
const nullifierReadRequestHints = await this.hintsBuilder.getNullifierReadRequestHints(
|