@aztec/simulator 0.0.1-commit.9b94fc1 → 0.0.1-commit.d3ec352c
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/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 +5 -4
- package/dest/public/avm/errors.d.ts +7 -1
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +14 -2
- package/dest/public/avm/fixtures/initializers.js +2 -2
- package/dest/public/avm/fixtures/utils.d.ts +3 -2
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
- package/dest/public/avm/fixtures/utils.js +2 -1
- package/dest/public/avm/opcodes/addressing_mode.js +2 -2
- package/dest/public/avm/opcodes/misc.js +2 -2
- package/dest/public/avm/revert_reason.d.ts +1 -1
- package/dest/public/avm/revert_reason.d.ts.map +1 -1
- package/dest/public/avm/revert_reason.js +3 -2
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +9 -6
- package/dest/public/debug_fn_name.d.ts +14 -1
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/debug_fn_name.js +19 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +8 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +14 -5
- package/dest/public/fixtures/simple_contract_data_source.d.ts +4 -3
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +4 -4
- package/dest/public/fixtures/token_test.d.ts +6 -2
- package/dest/public/fixtures/token_test.d.ts.map +1 -1
- package/dest/public/fixtures/token_test.js +12 -10
- package/dest/public/hinting_db_sources.d.ts +3 -2
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/index.d.ts +2 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +3 -2
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.d.ts +5 -5
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +13 -12
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +6 -34
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +22 -139
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +170 -0
- package/dest/public/public_tx_simulator/index.d.ts +2 -1
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +7 -3
- package/dest/public/state_manager/state_manager.d.ts +6 -1
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +4 -1
- package/package.json +18 -18
- package/src/public/avm/avm_simulator.ts +7 -4
- package/src/public/avm/errors.ts +16 -2
- package/src/public/avm/fixtures/initializers.ts +2 -2
- package/src/public/avm/fixtures/utils.ts +2 -1
- package/src/public/avm/opcodes/addressing_mode.ts +2 -2
- package/src/public/avm/opcodes/misc.ts +2 -2
- package/src/public/avm/revert_reason.ts +5 -2
- package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
- package/src/public/debug_fn_name.ts +25 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +29 -7
- package/src/public/fixtures/simple_contract_data_source.ts +7 -8
- package/src/public/fixtures/token_test.ts +17 -8
- package/src/public/hinting_db_sources.ts +2 -1
- package/src/public/index.ts +5 -1
- package/src/public/public_processor/guarded_merkle_tree.ts +2 -1
- package/src/public/public_processor/public_processor.ts +16 -16
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +23 -174
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +240 -0
- package/src/public/public_tx_simulator/index.ts +1 -0
- package/src/public/public_tx_simulator/public_tx_simulator.ts +10 -6
- package/src/public/state_manager/state_manager.ts +8 -1
|
@@ -77,7 +77,7 @@ export class PublicTxSimulator {
|
|
|
77
77
|
// In that case the transaction will be thrown out.
|
|
78
78
|
const setupResult = await this.simulatePhase(TxExecutionPhase.SETUP, context);
|
|
79
79
|
if (setupResult.reverted) {
|
|
80
|
-
throw new Error(`
|
|
80
|
+
throw new Error(`[SETUP] UNRECOVERABLE ERROR! The transaction will be thrown out. ${setupResult.revertReason?.message}`);
|
|
81
81
|
}
|
|
82
82
|
processedPhases.push(setupResult);
|
|
83
83
|
}
|
|
@@ -136,14 +136,18 @@ export class PublicTxSimulator {
|
|
|
136
136
|
await this.payFee(context);
|
|
137
137
|
const publicInputs = await context.generateAvmCircuitPublicInputs();
|
|
138
138
|
const revertCode = context.getFinalRevertCode();
|
|
139
|
-
// We only return the app logic phase information.
|
|
139
|
+
// We only return the app logic phase information, and only 1 per phase.
|
|
140
140
|
const appLogicReturnValues = processedPhases.find(({ phase })=>phase === TxExecutionPhase.APP_LOGIC)?.returnValues ?? [];
|
|
141
|
+
// TODO(fcarreiro): This is a temporary backwards compatibility layer until we migrate to the C++ simulator.
|
|
142
|
+
if (context.revertReason !== undefined) {
|
|
143
|
+
appLogicReturnValues.revertReason = context.revertReason;
|
|
144
|
+
}
|
|
141
145
|
return new PublicTxResult(/*gasUsed=*/ {
|
|
142
146
|
totalGas: context.getActualGasUsed(),
|
|
143
147
|
teardownGas: context.teardownGasUsed,
|
|
144
148
|
publicGas: context.getActualPublicGasUsed(),
|
|
145
149
|
billedGas: context.getTotalGasUsed()
|
|
146
|
-
}, /*revertCode=*/ revertCode, /*
|
|
150
|
+
}, /*revertCode=*/ revertCode, /*callStackMetadata=*/ appLogicReturnValues, /*logs=*/ context.state.getActiveStateManager().getLogs(), /*hints=*/ hints, /*publicInputs=*/ publicInputs);
|
|
147
151
|
}
|
|
148
152
|
computeTxHash(tx) {
|
|
149
153
|
return tx.getTxHash();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { type LogLevel } from '@aztec/foundation/log';
|
|
3
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
5
6
|
import type { DebugLog } from '@aztec/stdlib/logs';
|
|
@@ -153,7 +154,11 @@ export declare class PublicPersistableStateManager {
|
|
|
153
154
|
*/
|
|
154
155
|
getBytecode(contractAddress: AztecAddress): Promise<Buffer | undefined>;
|
|
155
156
|
getPublicFunctionDebugName(avmEnvironment: AvmExecutionEnvironment): Promise<string>;
|
|
157
|
+
getPublicFunctionSelectorAndName(avmEnvironment: AvmExecutionEnvironment): Promise<{
|
|
158
|
+
functionSelector?: FunctionSelector;
|
|
159
|
+
functionName?: string;
|
|
160
|
+
}>;
|
|
156
161
|
padTree(treeId: MerkleTreeId, leavesToInsert: number): Promise<void>;
|
|
157
162
|
getTreeSnapshots(): Promise<TreeS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IACU,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAuCjH;YAEa,8BAA8B;YAiE9B,gBAAgB;IA6B9B;;OAEG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsBnF;IAEY,0BAA0B,CAAC,cAAc,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhG;IAEY,gCAAgC,CAC3C,cAAc,EAAE,uBAAuB,GACtC,OAAO,CAAC;QAAE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAEzE;IAEY,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;IAEY,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CAEtD;CACF"}
|
|
@@ -8,7 +8,7 @@ import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
|
8
8
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
9
9
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
10
10
|
import { strict as assert } from 'assert';
|
|
11
|
-
import { getPublicFunctionDebugName } from '../debug_fn_name.js';
|
|
11
|
+
import { getPublicFunctionDebugName, getPublicFunctionSelectorAndName } from '../debug_fn_name.js';
|
|
12
12
|
import { L1ToL2MessageIndexOutOfRangeError, MaxCallsToUniqueContractClassIdsError, NoteHashIndexOutOfRangeError, NullifierCollisionError } from '../side_effect_errors.js';
|
|
13
13
|
import { NullifierManager } from './nullifiers.js';
|
|
14
14
|
import { PublicStorage } from './public_storage.js';
|
|
@@ -380,6 +380,9 @@ import { PublicStorage } from './public_storage.js';
|
|
|
380
380
|
async getPublicFunctionDebugName(avmEnvironment) {
|
|
381
381
|
return await getPublicFunctionDebugName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
|
|
382
382
|
}
|
|
383
|
+
async getPublicFunctionSelectorAndName(avmEnvironment) {
|
|
384
|
+
return await getPublicFunctionSelectorAndName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
|
|
385
|
+
}
|
|
383
386
|
async padTree(treeId, leavesToInsert) {
|
|
384
387
|
await this.treesDB.padTree(treeId, leavesToInsert);
|
|
385
388
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d3ec352c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"tsconfig": "./tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "yarn clean &&
|
|
21
|
-
"build:dev": "
|
|
20
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
21
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
22
22
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
23
23
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
24
24
|
"build:fuzzer": "tsgo scripts/fuzzing/avm_simulator_bin.ts --outDir dest/scripts/fuzzing --module commonjs --target es2022 --esModuleInterop --allowSyntheticDefaultImports --resolveJsonModule --skipLibCheck"
|
|
@@ -64,26 +64,26 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "0.0.1-commit.
|
|
68
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
69
|
-
"@aztec/native": "0.0.1-commit.
|
|
70
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
71
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
73
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
74
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
75
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
76
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
67
|
+
"@aztec/constants": "0.0.1-commit.d3ec352c",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.d3ec352c",
|
|
69
|
+
"@aztec/native": "0.0.1-commit.d3ec352c",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.d3ec352c",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.d3ec352c",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.d3ec352c",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.d3ec352c",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d3ec352c",
|
|
75
|
+
"@aztec/stdlib": "0.0.1-commit.d3ec352c",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.1-commit.d3ec352c",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.d3ec352c",
|
|
78
78
|
"lodash.clonedeep": "^4.5.0",
|
|
79
79
|
"lodash.merge": "^4.6.2",
|
|
80
80
|
"tslib": "^2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
84
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
85
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
83
|
+
"@aztec/kv-store": "0.0.1-commit.d3ec352c",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.1-commit.d3ec352c",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d3ec352c",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.d3ec352c",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -104,7 +104,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
104
104
|
|
|
105
105
|
if (!bytecode) {
|
|
106
106
|
return await this.handleFailureToRetrieveBytecode(
|
|
107
|
-
`No bytecode found, or limit encountered for max calls to unique contract class IDs. Contract address: ${this.context.environment.address}. Reverting...`,
|
|
107
|
+
`No bytecode found. Contract is not deployed, or limit encountered for max calls to unique contract class IDs. Contract address: ${this.context.environment.address}. Reverting...`,
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -177,7 +177,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
177
177
|
|
|
178
178
|
if (machineState.pc >= bytecode.length) {
|
|
179
179
|
this.log.warn('Passed end of program');
|
|
180
|
-
throw new InvalidProgramCounterError(machineState.pc, /*max=*/ bytecode.length);
|
|
180
|
+
throw new InvalidProgramCounterError(machineState.pc, /*max=*/ bytecode.length - 1);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -235,12 +235,15 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
235
235
|
|
|
236
236
|
private async handleFailureToRetrieveBytecode(message: string): Promise<AvmContractCallResult> {
|
|
237
237
|
// revert, consuming all gas
|
|
238
|
-
const
|
|
238
|
+
const { functionSelector, functionName } = await this.context.persistableState.getPublicFunctionSelectorAndName(
|
|
239
|
+
this.context.environment,
|
|
240
|
+
);
|
|
239
241
|
const revertReason = new AvmRevertReason(
|
|
240
242
|
message,
|
|
241
243
|
/*failingFunction=*/ {
|
|
242
244
|
contractAddress: this.context.environment.address,
|
|
243
|
-
|
|
245
|
+
functionSelector,
|
|
246
|
+
functionName,
|
|
244
247
|
},
|
|
245
248
|
/*noirCallStack=*/ [],
|
|
246
249
|
);
|
package/src/public/avm/errors.ts
CHANGED
|
@@ -58,7 +58,7 @@ export class AvmParsingError extends AvmExecutionError {
|
|
|
58
58
|
*/
|
|
59
59
|
export class InvalidTagValueError extends AvmExecutionError {
|
|
60
60
|
constructor(tagValue: number) {
|
|
61
|
-
super(`Tag value ${tagValue} is invalid.`);
|
|
61
|
+
super(`Tag check failed: Tag value ${tagValue} is invalid.`);
|
|
62
62
|
this.name = 'InvalidTagValueError';
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -77,6 +77,12 @@ export class InstructionExecutionError extends AvmExecutionError {
|
|
|
77
77
|
* Error thrown on failed AVM memory tag check.
|
|
78
78
|
*/
|
|
79
79
|
export class TagCheckError extends AvmExecutionError {
|
|
80
|
+
public static forBaseAddress(gotTag: string): TagCheckError {
|
|
81
|
+
return new TagCheckError(`Base address (mem[0]) is not a valid address (has tag ${gotTag})`);
|
|
82
|
+
}
|
|
83
|
+
public static forIndirectAddress(address: number, gotTag: string): TagCheckError {
|
|
84
|
+
return new TagCheckError(`Address after indirection is not a valid address (address ${address} has tag ${gotTag})`);
|
|
85
|
+
}
|
|
80
86
|
public static forOffset(offset: number, gotTag: string, expectedTag: string): TagCheckError {
|
|
81
87
|
return new TagCheckError(`Tag mismatch at offset ${offset}, got ${gotTag}, expected ${expectedTag}`);
|
|
82
88
|
}
|
|
@@ -97,7 +103,7 @@ export class TagCheckError extends AvmExecutionError {
|
|
|
97
103
|
*/
|
|
98
104
|
export class RelativeAddressOutOfRangeError extends AvmExecutionError {
|
|
99
105
|
constructor(baseAddr: number, relOffset: number) {
|
|
100
|
-
super(`
|
|
106
|
+
super(`Relative address out of range. Base address ${baseAddr}, relative offset ${relOffset}`);
|
|
101
107
|
this.name = 'RelativeAddressOutOfRangeError';
|
|
102
108
|
}
|
|
103
109
|
}
|
|
@@ -161,3 +167,11 @@ export class AvmRevertReason extends ExecutionError {
|
|
|
161
167
|
super(message, failingFunction, noirCallStack, options);
|
|
162
168
|
}
|
|
163
169
|
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Helper to annotate errors occurring during instruction fetching.
|
|
173
|
+
*/
|
|
174
|
+
export function duringInstrFetch(error: Error, pc: number) {
|
|
175
|
+
error.message = `Instruction fetching error at pc ${pc}: ${error.message}`;
|
|
176
|
+
return error;
|
|
177
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
|
|
2
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
@@ -82,7 +82,7 @@ export function initGlobalVariables(overrides?: Partial<GlobalVariables>): Globa
|
|
|
82
82
|
return new GlobalVariables(
|
|
83
83
|
overrides?.chainId ?? Fr.zero(),
|
|
84
84
|
overrides?.version ?? Fr.zero(),
|
|
85
|
-
overrides?.blockNumber ??
|
|
85
|
+
overrides?.blockNumber ?? BlockNumber.ZERO,
|
|
86
86
|
overrides?.slotNumber ?? SlotNumber.ZERO,
|
|
87
87
|
overrides?.timestamp ?? 0n,
|
|
88
88
|
overrides?.coinbase ?? EthAddress.ZERO,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS } from '@aztec/constants';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import {
|
|
4
5
|
type ContractArtifact,
|
|
@@ -28,7 +29,7 @@ import type { AvmRevertReason } from '../errors.js';
|
|
|
28
29
|
|
|
29
30
|
export const PUBLIC_DISPATCH_FN_NAME = 'public_dispatch';
|
|
30
31
|
export const DEFAULT_TIMESTAMP: UInt64 = 99833n;
|
|
31
|
-
export const DEFAULT_BLOCK_NUMBER = 42;
|
|
32
|
+
export const DEFAULT_BLOCK_NUMBER = BlockNumber(42);
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Create a new object with all the same properties as the original, except for the ones in the overrides object.
|
|
@@ -83,7 +83,7 @@ export class Addressing {
|
|
|
83
83
|
baseAddr = mem.get(0);
|
|
84
84
|
const baseAddrTag = baseAddr.getTag();
|
|
85
85
|
if (!TaggedMemory.isValidMemoryAddressTag(baseAddrTag!)) {
|
|
86
|
-
throw TagCheckError.
|
|
86
|
+
throw TagCheckError.forBaseAddress(TypeTag[baseAddrTag!]);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
// Here we know that resolved[i] is at most 32 bits and baseAddr is at most 32 bits.
|
|
@@ -100,7 +100,7 @@ export class Addressing {
|
|
|
100
100
|
|
|
101
101
|
// Final check.
|
|
102
102
|
if (!TaggedMemory.isValidMemoryAddressTag(resolvedTag)) {
|
|
103
|
-
throw TagCheckError.
|
|
103
|
+
throw TagCheckError.forIndirectAddress(resolved[i], TypeTag[resolvedTag]);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
resolved[i] = Number(resolvedValue.toBigInt());
|
|
@@ -56,11 +56,11 @@ export class DebugLog extends Instruction {
|
|
|
56
56
|
const memoryReads = 1 /* level */ + 1 /* fieldsSize */ + this.messageSize /* message */ + fieldsSize; /* fields */
|
|
57
57
|
if (
|
|
58
58
|
context.persistableState.getDebugLogMemoryReads() + memoryReads >
|
|
59
|
-
context.environment.config.maxDebugLogMemoryReads
|
|
59
|
+
context.environment.config.collectionLimits.maxDebugLogMemoryReads
|
|
60
60
|
) {
|
|
61
61
|
// Regular error on purpose: this is not a recoverable error.
|
|
62
62
|
throw new Error(
|
|
63
|
-
`Max debug log memory reads exceeded: ${context.persistableState.getDebugLogMemoryReads() + memoryReads} > ${context.environment.config.maxDebugLogMemoryReads}`,
|
|
63
|
+
`Max debug log memory reads exceeded: ${context.persistableState.getDebugLogMemoryReads() + memoryReads} > ${context.environment.config.collectionLimits.maxDebugLogMemoryReads}`,
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
context.persistableState.writeDebugLogMemoryReads(memoryReads);
|
|
@@ -18,13 +18,16 @@ async function createRevertReason(message: string, revertData: Fr[], context: Av
|
|
|
18
18
|
message = context.machineState.collectedRevertInfo.recursiveRevertReason.message;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const { functionSelector, functionName } = await context.persistableState.getPublicFunctionSelectorAndName(
|
|
22
|
+
context.environment,
|
|
23
|
+
);
|
|
22
24
|
|
|
23
25
|
return new AvmRevertReason(
|
|
24
26
|
message,
|
|
25
27
|
/*failingFunction=*/ {
|
|
26
28
|
contractAddress: context.environment.address,
|
|
27
|
-
|
|
29
|
+
functionSelector,
|
|
30
|
+
functionName,
|
|
28
31
|
},
|
|
29
32
|
/*noirCallStack=*/ [...internalCallStack, context.machineState.pc].map(pc => `0.${pc}`),
|
|
30
33
|
/*options=*/ { cause: nestedError },
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type Bufferable, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AvmExecutionError,
|
|
5
|
+
AvmParsingError,
|
|
6
|
+
InvalidOpcodeError,
|
|
7
|
+
InvalidProgramCounterError,
|
|
8
|
+
InvalidTagValueError,
|
|
9
|
+
duringInstrFetch,
|
|
10
|
+
} from '../errors.js';
|
|
4
11
|
import {
|
|
5
12
|
Add,
|
|
6
13
|
And,
|
|
@@ -172,7 +179,7 @@ export function decodeInstructionFromBytecode(
|
|
|
172
179
|
instructionSet: InstructionSet = INSTRUCTION_SET,
|
|
173
180
|
): [Instruction, number] {
|
|
174
181
|
if (pc >= bytecode.length) {
|
|
175
|
-
throw new InvalidProgramCounterError(pc, bytecode.length);
|
|
182
|
+
throw new InvalidProgramCounterError(pc, bytecode.length - 1);
|
|
176
183
|
}
|
|
177
184
|
|
|
178
185
|
try {
|
|
@@ -182,7 +189,7 @@ export function decodeInstructionFromBytecode(
|
|
|
182
189
|
|
|
183
190
|
if (opcode > MAX_OPCODE_VALUE) {
|
|
184
191
|
throw new InvalidOpcodeError(
|
|
185
|
-
`Opcode ${opcode} (0x${opcode.toString(16)}) value is not in the range of valid opcodes.`,
|
|
192
|
+
`Opcode ${opcode} (0x${opcode.toString(16)}) value is not in the range of valid opcodes (at PC ${pc}).`,
|
|
186
193
|
);
|
|
187
194
|
}
|
|
188
195
|
|
|
@@ -192,13 +199,17 @@ export function decodeInstructionFromBytecode(
|
|
|
192
199
|
}
|
|
193
200
|
|
|
194
201
|
const instructionDeserializer: InstructionDeserializer = instructionDeserializerOrUndef;
|
|
202
|
+
|
|
195
203
|
const instruction = instructionDeserializer(cursor);
|
|
196
204
|
return [instruction, cursor.position() - startingPosition];
|
|
197
205
|
} catch (error) {
|
|
198
|
-
if (error instanceof
|
|
199
|
-
throw error;
|
|
206
|
+
if (error instanceof InvalidTagValueError || error instanceof InvalidOpcodeError) {
|
|
207
|
+
throw duringInstrFetch(error, pc);
|
|
208
|
+
} else if (error instanceof AvmExecutionError) {
|
|
209
|
+
throw new AvmParsingError(`Instruction parsing error at pc ${pc}: ${error.message}`);
|
|
200
210
|
} else {
|
|
201
|
-
|
|
211
|
+
const msg = error instanceof Error ? `: ${error.message}` : '';
|
|
212
|
+
throw new AvmParsingError(`Instruction fetching error at pc ${pc}${msg}`);
|
|
202
213
|
}
|
|
203
214
|
}
|
|
204
215
|
}
|
|
@@ -16,3 +16,28 @@ export async function getPublicFunctionDebugName(
|
|
|
16
16
|
const selector = FunctionSelector.fromField(calldata[0]);
|
|
17
17
|
return (await db.getDebugFunctionName(contractAddress, selector)) ?? selector.toString();
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get the function selector and optional debug name for a public function.
|
|
22
|
+
* Returns the selector and name separately, with name only populated if a debug name is available.
|
|
23
|
+
* @param db - The contracts database
|
|
24
|
+
* @param contractAddress - The contract address
|
|
25
|
+
* @param calldata - The calldata (selector is in calldata[0])
|
|
26
|
+
* @returns An object with functionSelector (always if calldata[0] exists) and functionName (only if debug name found)
|
|
27
|
+
*/
|
|
28
|
+
export async function getPublicFunctionSelectorAndName(
|
|
29
|
+
db: PublicContractsDBInterface,
|
|
30
|
+
contractAddress: AztecAddress,
|
|
31
|
+
calldata: Fr[],
|
|
32
|
+
): Promise<{ functionSelector?: FunctionSelector; functionName?: string }> {
|
|
33
|
+
// Public function is dispatched and therefore the target function is passed in the first argument.
|
|
34
|
+
if (!calldata[0]) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
const selector = FunctionSelector.fromField(calldata[0]);
|
|
38
|
+
const debugName = await db.getDebugFunctionName(contractAddress, selector);
|
|
39
|
+
return {
|
|
40
|
+
functionSelector: selector,
|
|
41
|
+
functionName: debugName ?? undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT } from '@aztec/constants';
|
|
2
2
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import { type ContractArtifact, encodeArguments } from '@aztec/stdlib/abi';
|
|
5
6
|
import { PublicSimulatorConfig, type PublicTxResult } from '@aztec/stdlib/avm';
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
} from '../avm/fixtures/utils.js';
|
|
20
21
|
import { PublicContractsDB } from '../public_db_sources.js';
|
|
21
22
|
import { MeasuredCppPublicTxSimulator } from '../public_tx_simulator/cpp_public_tx_simulator.js';
|
|
22
|
-
import {
|
|
23
|
+
import { MeasuredCppVsTsPublicTxSimulator } from '../public_tx_simulator/cpp_vs_ts_public_tx_simulator.js';
|
|
23
24
|
import type { MeasuredPublicTxSimulatorInterface } from '../public_tx_simulator/public_tx_simulator_interface.js';
|
|
24
25
|
import { TestExecutorMetrics } from '../test_executor_metrics.js';
|
|
25
26
|
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
@@ -44,6 +45,17 @@ const defaultConfig: PublicSimulatorConfig = PublicSimulatorConfig.from({
|
|
|
44
45
|
collectStatistics: false,
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Factory type for creating a MeasuredPublicTxSimulatorInterface.
|
|
50
|
+
*/
|
|
51
|
+
export type MeasuredSimulatorFactory = (
|
|
52
|
+
merkleTree: MerkleTreeWriteOperations,
|
|
53
|
+
contractsDB: PublicContractsDB,
|
|
54
|
+
globals: GlobalVariables,
|
|
55
|
+
metrics: TestExecutorMetrics,
|
|
56
|
+
config: PublicSimulatorConfig,
|
|
57
|
+
) => MeasuredPublicTxSimulatorInterface;
|
|
58
|
+
|
|
47
59
|
/**
|
|
48
60
|
* A test class that extends the BaseAvmSimulationTester to enable real-app testing of the PublicTxSimulator.
|
|
49
61
|
* It provides an interface for simulating one transaction at a time and maintains state between subsequent
|
|
@@ -59,15 +71,17 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
59
71
|
contractDataSource: SimpleContractDataSource,
|
|
60
72
|
globals: GlobalVariables = defaultGlobals(),
|
|
61
73
|
private metrics: TestExecutorMetrics = new TestExecutorMetrics(),
|
|
62
|
-
|
|
74
|
+
simulatorFactory?: MeasuredSimulatorFactory,
|
|
63
75
|
config: PublicSimulatorConfig = defaultConfig,
|
|
64
76
|
) {
|
|
65
77
|
super(contractDataSource, merkleTree);
|
|
66
78
|
|
|
67
79
|
const contractsDB = new PublicContractsDB(contractDataSource);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
if (simulatorFactory) {
|
|
81
|
+
this.simulator = simulatorFactory(merkleTree, contractsDB, globals, this.metrics, config);
|
|
82
|
+
} else {
|
|
83
|
+
this.simulator = new MeasuredCppPublicTxSimulator(merkleTree, contractsDB, globals, this.metrics, config);
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
|
|
73
87
|
public static async create(
|
|
@@ -79,7 +93,10 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
79
93
|
): Promise<PublicTxSimulationTester> {
|
|
80
94
|
const contractDataSource = new SimpleContractDataSource();
|
|
81
95
|
const merkleTree = await worldStateService.fork();
|
|
82
|
-
|
|
96
|
+
const simulatorFactory: MeasuredSimulatorFactory = useCppSimulator
|
|
97
|
+
? (mt, cdb, g, m, c) => new MeasuredCppPublicTxSimulator(mt, cdb, g, m, c)
|
|
98
|
+
: (mt, cdb, g, m, c) => new MeasuredCppVsTsPublicTxSimulator(mt, cdb, g, m, c);
|
|
99
|
+
return new PublicTxSimulationTester(merkleTree, contractDataSource, globals, metrics, simulatorFactory, config);
|
|
83
100
|
}
|
|
84
101
|
|
|
85
102
|
public setMetricsPrefix(prefix: string) {
|
|
@@ -136,6 +153,11 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
136
153
|
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
137
154
|
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}/${txLabelWithCount}` : txLabelWithCount;
|
|
138
155
|
|
|
156
|
+
if (!this.simulator) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
'No simulator configured. Pass a simulatorFactory to the constructor or use PublicTxSimulationTester.create()',
|
|
159
|
+
);
|
|
160
|
+
}
|
|
139
161
|
const avmResult = await this.simulator.simulate(tx, fullTxLabel);
|
|
140
162
|
|
|
141
163
|
// Something like this is often useful for debugging:
|
|
@@ -227,6 +249,6 @@ export function defaultGlobals() {
|
|
|
227
249
|
const globals = GlobalVariables.empty();
|
|
228
250
|
globals.timestamp = DEFAULT_TIMESTAMP;
|
|
229
251
|
globals.gasFees = DEFAULT_GAS_FEES; // apply some nonzero default gas fees
|
|
230
|
-
globals.blockNumber = DEFAULT_BLOCK_NUMBER;
|
|
252
|
+
globals.blockNumber = BlockNumber(DEFAULT_BLOCK_NUMBER);
|
|
231
253
|
return globals;
|
|
232
254
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import type { ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
@@ -59,7 +60,7 @@ export class SimpleContractDataSource implements ContractDataSource {
|
|
|
59
60
|
|
|
60
61
|
/////////////////////////////////////////////////////////////
|
|
61
62
|
// ContractDataSource function implementations
|
|
62
|
-
getBlockNumber(): Promise<
|
|
63
|
+
getBlockNumber(): Promise<BlockNumber> {
|
|
63
64
|
throw new Error('Method not implemented.');
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -90,19 +91,17 @@ export class SimpleContractDataSource implements ContractDataSource {
|
|
|
90
91
|
return this.contractArtifacts.get(contractInstance!.currentContractClassId.toString());
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string> {
|
|
94
|
+
async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
94
95
|
const contractInstance = await this.getContract(address);
|
|
95
96
|
if (!contractInstance) {
|
|
96
|
-
this.logger.warn(
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
-
return `selector:${selector.toString()}`;
|
|
97
|
+
this.logger.warn(`Couldn't get fn name for debugging. Contract not in tester's ContractDataSource.`);
|
|
98
|
+
return undefined;
|
|
100
99
|
}
|
|
101
100
|
const key = `${contractInstance.currentContractClassId.toString()}:${selector.toString()}`;
|
|
102
101
|
const fnName = this.debugFunctionName.get(key);
|
|
103
102
|
if (!fnName) {
|
|
104
|
-
this.logger.warn(`Couldn't get fn name for debugging
|
|
105
|
-
return
|
|
103
|
+
this.logger.warn(`Couldn't get fn name for debugging...`);
|
|
104
|
+
return undefined;
|
|
106
105
|
}
|
|
107
106
|
return fnName;
|
|
108
107
|
}
|
|
@@ -7,11 +7,17 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
|
7
7
|
|
|
8
8
|
import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
|
|
9
9
|
|
|
10
|
+
export type TokenTestOptions = {
|
|
11
|
+
/** Skip return value assertions in balance checks (useful for benchmarking with collectCallMetadata=false) */
|
|
12
|
+
skipReturnValueAssertions?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
10
15
|
export async function tokenTest(
|
|
11
16
|
tester: PublicTxSimulationTester,
|
|
12
17
|
logger: Logger,
|
|
13
18
|
tokenArtifact: ContractArtifact,
|
|
14
19
|
expectToBeTrue: (x: boolean) => void,
|
|
20
|
+
options: TokenTestOptions = {},
|
|
15
21
|
) {
|
|
16
22
|
const timer = new Timer();
|
|
17
23
|
|
|
@@ -36,7 +42,7 @@ export async function tokenTest(
|
|
|
36
42
|
],
|
|
37
43
|
);
|
|
38
44
|
expectToBeTrue(mintResult.revertCode.isOK());
|
|
39
|
-
await checkBalance(tester, token, sender, sender, mintAmount, expectToBeTrue);
|
|
45
|
+
await checkBalance(tester, token, sender, sender, mintAmount, expectToBeTrue, options);
|
|
40
46
|
|
|
41
47
|
const authwitNonce = new Fr(0);
|
|
42
48
|
const transferAmount = 50n;
|
|
@@ -54,8 +60,8 @@ export async function tokenTest(
|
|
|
54
60
|
],
|
|
55
61
|
);
|
|
56
62
|
expectToBeTrue(transferResult.revertCode.isOK());
|
|
57
|
-
await checkBalance(tester, token, sender,
|
|
58
|
-
await checkBalance(tester, token, sender, receiver, transferAmount, expectToBeTrue);
|
|
63
|
+
await checkBalance(tester, token, sender, sender, mintAmount - transferAmount, expectToBeTrue, options);
|
|
64
|
+
await checkBalance(tester, token, sender, receiver, transferAmount, expectToBeTrue, options);
|
|
59
65
|
|
|
60
66
|
// EXECUTE! This means that if using AvmProvingTester subclass, it will PROVE the transaction!
|
|
61
67
|
const burnResult = await tester.executeTxWithLabel(
|
|
@@ -71,7 +77,7 @@ export async function tokenTest(
|
|
|
71
77
|
],
|
|
72
78
|
);
|
|
73
79
|
expectToBeTrue(burnResult.revertCode.isOK());
|
|
74
|
-
await checkBalance(tester, token, sender, receiver, 0n, expectToBeTrue);
|
|
80
|
+
await checkBalance(tester, token, sender, receiver, 0n, expectToBeTrue, options);
|
|
75
81
|
|
|
76
82
|
logger.info(`TokenContract test took ${timer.ms()}ms\n`);
|
|
77
83
|
}
|
|
@@ -116,6 +122,7 @@ async function checkBalance(
|
|
|
116
122
|
account: AztecAddress,
|
|
117
123
|
expectedBalance: bigint,
|
|
118
124
|
expectToBeTrue: (x: boolean) => void,
|
|
125
|
+
options: TokenTestOptions = {},
|
|
119
126
|
) {
|
|
120
127
|
// Strictly simulate this! No need to "execute" (aka prove if using AvmProvingTester subclass).
|
|
121
128
|
const balResult = await tester.simulateTxWithLabel(
|
|
@@ -132,8 +139,10 @@ async function checkBalance(
|
|
|
132
139
|
],
|
|
133
140
|
);
|
|
134
141
|
expectToBeTrue(balResult.revertCode.isOK());
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
if (!options.skipReturnValueAssertions) {
|
|
143
|
+
// should be 1 call with 1 return value that is expectedBalance
|
|
144
|
+
const appLogicReturnValues = balResult.getAppLogicReturnValues();
|
|
145
|
+
expectToBeTrue(appLogicReturnValues.length === 1);
|
|
146
|
+
expectToBeTrue(appLogicReturnValues[0].values?.[0]?.toBigInt() === expectedBalance);
|
|
147
|
+
}
|
|
139
148
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { sha256Trunc } from '@aztec/foundation/crypto';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -596,7 +597,7 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
596
597
|
public async getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(
|
|
597
598
|
treeId: ID,
|
|
598
599
|
leafIndices: bigint[],
|
|
599
|
-
): Promise<(
|
|
600
|
+
): Promise<(BlockNumber | undefined)[]> {
|
|
600
601
|
return await this.db.getBlockNumbersForLeafIndices(treeId, leafIndices);
|
|
601
602
|
}
|
|
602
603
|
}
|