@aztec/simulator 0.85.0 → 0.86.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/private/providers/acvm_native.d.ts +1 -1
- package/dest/private/providers/acvm_native.d.ts.map +1 -1
- package/dest/private/providers/acvm_native.js +4 -3
- package/dest/private/providers/acvm_wasm.d.ts +2 -1
- package/dest/private/providers/acvm_wasm.d.ts.map +1 -1
- package/dest/private/providers/acvm_wasm.js +6 -1
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts +2 -1
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -1
- package/dest/private/providers/acvm_wasm_with_blobs.js +6 -1
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts +2 -1
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map +1 -1
- package/dest/private/providers/simulation_provider.d.ts +2 -1
- package/dest/private/providers/simulation_provider.d.ts.map +1 -1
- package/dest/public/avm/avm_context.d.ts +2 -2
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.d.ts +2 -1
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +2 -1
- package/dest/public/avm/avm_simulator_interface.d.ts +11 -0
- package/dest/public/avm/avm_simulator_interface.d.ts.map +1 -0
- package/dest/public/avm/avm_simulator_interface.js +3 -0
- package/dest/public/avm/errors.d.ts +1 -16
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +0 -37
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/index.d.ts +2 -85
- package/dest/public/avm/fixtures/index.d.ts.map +1 -1
- package/dest/public/avm/fixtures/index.js +2 -174
- package/dest/public/avm/fixtures/initializers.d.ts +42 -0
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -0
- package/dest/public/avm/fixtures/initializers.js +42 -0
- package/dest/public/avm/fixtures/utils.d.ts +46 -0
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -0
- package/dest/public/avm/fixtures/utils.js +136 -0
- package/dest/public/avm/index.d.ts +0 -1
- package/dest/public/avm/index.d.ts.map +1 -1
- package/dest/public/avm/index.js +0 -1
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +1 -1
- package/dest/public/avm/opcodes/external_calls.d.ts +3 -2
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +14 -9
- package/dest/public/avm/opcodes/instruction.d.ts +5 -5
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction.js +6 -6
- package/dest/public/avm/revert_reason.d.ts +18 -0
- package/dest/public/avm/revert_reason.d.ts.map +1 -0
- package/dest/public/avm/revert_reason.js +38 -0
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +2 -4
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +70 -69
- package/dest/{common → public}/debug_fn_name.d.ts +1 -1
- package/dest/{common → public}/debug_fn_name.d.ts.map +1 -1
- package/dest/public/fixtures/index.d.ts +1 -0
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +1 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +3 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -0
- package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.js +1 -1
- package/dest/public/hinting_db_sources.d.ts +15 -5
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +65 -27
- package/dest/public/index.d.ts +2 -6
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +2 -6
- package/dest/public/public_db_sources.d.ts +19 -52
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +96 -107
- package/dest/public/public_processor/public_processor.d.ts +6 -6
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +24 -26
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +3 -2
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +2 -2
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +3 -4
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +11 -21
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +5 -4
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +21 -10
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +3 -2
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +2 -2
- package/dest/public/side_effect_trace.d.ts +1 -3
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +3 -2
- package/dest/public/state_manager/state_manager.d.ts +6 -4
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +20 -41
- package/package.json +14 -16
- package/src/private/providers/acvm_native.ts +5 -4
- package/src/private/providers/acvm_wasm.ts +5 -2
- package/src/private/providers/acvm_wasm_with_blobs.ts +5 -3
- package/src/private/providers/circuit_recording/simulation_provider_recorder_wrapper.ts +3 -2
- package/src/private/providers/simulation_provider.ts +2 -1
- package/src/public/avm/avm_context.ts +2 -2
- package/src/public/avm/avm_simulator.ts +4 -8
- package/src/public/avm/avm_simulator_interface.ts +8 -0
- package/src/public/avm/errors.ts +1 -53
- package/src/public/avm/fixtures/avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/index.ts +2 -308
- package/src/public/avm/fixtures/initializers.ts +101 -0
- package/src/public/avm/fixtures/utils.ts +213 -0
- package/src/public/avm/index.ts +0 -1
- package/src/public/avm/opcodes/accrued_substate.ts +1 -5
- package/src/public/avm/opcodes/external_calls.ts +17 -11
- package/src/public/avm/opcodes/instruction.ts +9 -8
- package/src/public/avm/revert_reason.ts +55 -0
- package/src/public/avm/serialization/bytecode_serialization.ts +72 -74
- package/src/{common → public}/debug_fn_name.ts +1 -1
- package/src/public/fixtures/index.ts +1 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +3 -5
- package/src/public/{avm/fixtures → fixtures}/simple_contract_data_source.ts +1 -1
- package/src/public/hinting_db_sources.ts +104 -39
- package/src/public/index.ts +2 -6
- package/src/public/public_db_sources.ts +111 -164
- package/src/public/public_processor/public_processor.ts +27 -29
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +4 -3
- package/src/public/public_tx_simulator/public_tx_context.ts +10 -47
- package/src/public/public_tx_simulator/public_tx_simulator.ts +25 -10
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -3
- package/src/public/side_effect_trace.ts +2 -4
- package/src/public/state_manager/state_manager.ts +24 -50
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
- /package/dest/{common → public}/debug_fn_name.js +0 -0
- /package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/instruction.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"instruction.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/instruction.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,GAAG,EAAqD,MAAM,eAAe,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAA4B,MAAM,+CAA+C,CAAC;AAEnH,KAAK,sBAAsB,GAAG;IAC5B,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,8BAAsB,WAAW;IAC/B;;;;OAIG;aACa,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3D;;OAEG;IACI,SAAS,IAAI,OAAO;IAI3B;;;;OAIG;IACI,QAAQ,IAAI,MAAM;WAUX,UAAU,CACtB,IAAI,EAAE,sBAAsB,GAAG;QAAE,UAAU,EAAE,WAAW,EAAE,CAAC;QAAC,EAAE,EAAE,GAAG,CAAA;KAAE,EACrE,GAAG,EAAE,YAAY,GAAG,MAAM,GACzB,WAAW;IAKP,QAAQ,IAAI,MAAM;IAOzB;;;;;OAKG;IACI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,WAAW,GAAG,UAAU;IAS9E;;;;;OAKG;WACW,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,UAAU,EAAE,WAAW,EAAE;0BAElD,YAAY,GAAG,MAAM,KAAG,WAAW;;IAQzD;;;OAGG;IACH,SAAS,CAAC,OAAO,CAAC,aAAa,GAAE,MAAU,GAAG,GAAG;IAMjD;;;OAGG;IACH,IAAW,IAAI,IAAI,MAAM,CAMxB;IAED;;;OAGG;IACH,IAAW,MAAM,IAAI,MAAM,CAM1B;CACF"}
|
|
@@ -23,15 +23,15 @@ import { Opcode, deserialize, serializeAs } from '../serialization/instruction_s
|
|
|
23
23
|
return instructionStr;
|
|
24
24
|
}
|
|
25
25
|
// Default deserialization which uses Class.opcode and Class.wireFormat.
|
|
26
|
-
static
|
|
27
|
-
return this.as(this.wireFormat).
|
|
26
|
+
static fromBuffer(buf) {
|
|
27
|
+
return this.as(this.wireFormat).fromBuffer(buf);
|
|
28
28
|
}
|
|
29
29
|
// Default serialization which uses Class.opcode and Class.wireFormat.
|
|
30
|
-
|
|
30
|
+
toBuffer() {
|
|
31
31
|
const klass = this.constructor;
|
|
32
32
|
assert(klass.opcode !== undefined && klass.opcode !== null);
|
|
33
33
|
assert(klass.wireFormat !== undefined && klass.wireFormat !== null);
|
|
34
|
-
return this.as(klass.opcode, klass.wireFormat).
|
|
34
|
+
return this.as(klass.opcode, klass.wireFormat).toBuffer();
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Returns a new instruction instance that can be serialized with the given opcode and wire format.
|
|
@@ -39,7 +39,7 @@ import { Opcode, deserialize, serializeAs } from '../serialization/instruction_s
|
|
|
39
39
|
* @param wireFormat The wire format of the instruction.
|
|
40
40
|
* @returns The new instruction instance.
|
|
41
41
|
*/ as(opcode, wireFormat) {
|
|
42
|
-
return Object.defineProperty(this, '
|
|
42
|
+
return Object.defineProperty(this, 'toBuffer', {
|
|
43
43
|
value: ()=>{
|
|
44
44
|
return serializeAs(wireFormat, opcode, this);
|
|
45
45
|
},
|
|
@@ -53,7 +53,7 @@ import { Opcode, deserialize, serializeAs } from '../serialization/instruction_s
|
|
|
53
53
|
* @returns The new instruction class.
|
|
54
54
|
*/ static as(wireFormat) {
|
|
55
55
|
return Object.assign(this, {
|
|
56
|
-
|
|
56
|
+
fromBuffer: (buf)=>{
|
|
57
57
|
const res = deserialize(buf, wireFormat);
|
|
58
58
|
const args = res.slice(1); // Remove opcode.
|
|
59
59
|
return new this(...args);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AvmContext } from './avm_context.js';
|
|
3
|
+
import { type AvmExecutionError, AvmRevertReason } from './errors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create a "revert reason" error for an exceptional halt.
|
|
6
|
+
*
|
|
7
|
+
* @param haltingError - the lower-level error causing the exceptional halt
|
|
8
|
+
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
9
|
+
*/
|
|
10
|
+
export declare function revertReasonFromExceptionalHalt(haltingError: AvmExecutionError, context: AvmContext): Promise<AvmRevertReason>;
|
|
11
|
+
/**
|
|
12
|
+
* Create a "revert reason" error for an explicit revert (a root cause).
|
|
13
|
+
*
|
|
14
|
+
* @param revertData - output data of the explicit REVERT instruction
|
|
15
|
+
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
16
|
+
*/
|
|
17
|
+
export declare function revertReasonFromExplicitRevert(revertData: Fr[], context: AvmContext): Promise<AvmRevertReason>;
|
|
18
|
+
//# sourceMappingURL=revert_reason.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revert_reason.d.ts","sourceRoot":"","sources":["../../../src/public/avm/revert_reason.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA8BtE;;;;;GAKG;AACH,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,eAAe,CAAC,CAE1B;AAED;;;;;GAKG;AACH,wBAAsB,8BAA8B,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAEpH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AvmRevertReason } from './errors.js';
|
|
2
|
+
async function createRevertReason(message, revertData, context) {
|
|
3
|
+
// We drop the returnPc information.
|
|
4
|
+
const internalCallStack = context.machineState.internalCallStack.map((entry)=>entry.callPc);
|
|
5
|
+
// If we are reverting due to the same error that we have been tracking, we use the nested error as the cause.
|
|
6
|
+
let nestedError = undefined;
|
|
7
|
+
const revertDataEquals = (a, b)=>a.length === b.length && a.every((v, i)=>v.equals(b[i]));
|
|
8
|
+
if (context.machineState.collectedRevertInfo && revertDataEquals(context.machineState.collectedRevertInfo.revertDataRepresentative, revertData)) {
|
|
9
|
+
nestedError = context.machineState.collectedRevertInfo.recursiveRevertReason;
|
|
10
|
+
message = context.machineState.collectedRevertInfo.recursiveRevertReason.message;
|
|
11
|
+
}
|
|
12
|
+
const fnName = await context.persistableState.getPublicFunctionDebugName(context.environment);
|
|
13
|
+
return new AvmRevertReason(message, /*failingFunction=*/ {
|
|
14
|
+
contractAddress: context.environment.address,
|
|
15
|
+
functionName: fnName
|
|
16
|
+
}, /*noirCallStack=*/ [
|
|
17
|
+
...internalCallStack,
|
|
18
|
+
context.machineState.pc
|
|
19
|
+
].map((pc)=>`0.${pc}`), /*options=*/ {
|
|
20
|
+
cause: nestedError
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a "revert reason" error for an exceptional halt.
|
|
25
|
+
*
|
|
26
|
+
* @param haltingError - the lower-level error causing the exceptional halt
|
|
27
|
+
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
28
|
+
*/ export async function revertReasonFromExceptionalHalt(haltingError, context) {
|
|
29
|
+
return await createRevertReason(haltingError.message, [], context);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a "revert reason" error for an explicit revert (a root cause).
|
|
33
|
+
*
|
|
34
|
+
* @param revertData - output data of the explicit REVERT instruction
|
|
35
|
+
* @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack
|
|
36
|
+
*/ export async function revertReasonFromExplicitRevert(revertData, context) {
|
|
37
|
+
return await createRevertReason('Assertion failed: ', revertData, context);
|
|
38
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import { type Bufferable } from '@aztec/foundation/serialize';
|
|
3
4
|
import { Instruction } from '../opcodes/index.js';
|
|
4
5
|
import { BufferCursor } from './buffer_cursor.js';
|
|
5
6
|
import { Opcode } from './instruction_serialization.js';
|
|
6
7
|
export type InstructionDeserializer = (buf: BufferCursor | Buffer) => Instruction;
|
|
7
|
-
export interface Serializable {
|
|
8
|
-
serialize(): Buffer;
|
|
9
|
-
}
|
|
10
8
|
export interface Deserializable {
|
|
11
9
|
deserialize: InstructionDeserializer;
|
|
12
10
|
}
|
|
@@ -15,7 +13,7 @@ export declare const INSTRUCTION_SET: Map<Opcode, InstructionDeserializer>;
|
|
|
15
13
|
/**
|
|
16
14
|
* Serializes an array of instructions to bytecode.
|
|
17
15
|
*/
|
|
18
|
-
export declare function encodeToBytecode(instructions:
|
|
16
|
+
export declare function encodeToBytecode(instructions: Bufferable[]): Buffer;
|
|
19
17
|
export declare function decodeFromBytecode(bytecode: Buffer, instructionSet?: InstructionSet): Instruction[];
|
|
20
18
|
export declare function decodeInstructionFromBytecode(bytecode: Buffer, pc: number, instructionSet?: InstructionSet): [Instruction, number];
|
|
21
19
|
//# sourceMappingURL=bytecode_serialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytecode_serialization.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/serialization/bytecode_serialization.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"bytecode_serialization.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/serialization/bytecode_serialization.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,6BAA6B,CAAC;AAGjF,OAAO,EAgBL,WAAW,EAgCZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAoB,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,KAAK,WAAW,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,uBAAuB,CAAC;CACtC;AAED,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAClE,eAAO,MAAM,eAAe,sCAoF1B,CAAC;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,MAAM,CAEnE;AAGD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,GAAE,cAAgC,GAAG,WAAW,EAAE,CASpH;AAGD,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,cAAc,GAAE,cAAgC,GAC/C,CAAC,WAAW,EAAE,MAAM,CAAC,CA+BvB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serializeToBuffer } from '@aztec/foundation/serialize';
|
|
1
2
|
import { AvmExecutionError, AvmParsingError, InvalidOpcodeError, InvalidProgramCounterError } from '../errors.js';
|
|
2
3
|
import { Add, And, Call, CalldataCopy, Cast, DebugLog, Div, EcAdd, EmitNoteHash, EmitNullifier, EmitUnencryptedLog, Eq, FieldDiv, GetContractInstance, GetEnvVar, Instruction, InternalCall, InternalReturn, Jump, JumpI, KeccakF1600, L1ToL2MessageExists, Lt, Lte, Mov, Mul, Not, NoteHashExists, NullifierExists, Or, Poseidon2, Return, ReturndataCopy, ReturndataSize, Revert, SLoad, SStore, SendL2ToL1Message, Set, Sha256Compression, Shl, Shr, StaticCall, Sub, SuccessCopy, ToRadixBE, Xor } from '../opcodes/index.js';
|
|
3
4
|
import { BufferCursor } from './buffer_cursor.js';
|
|
@@ -5,289 +6,289 @@ import { MAX_OPCODE_VALUE, Opcode } from './instruction_serialization.js';
|
|
|
5
6
|
export const INSTRUCTION_SET = new Map([
|
|
6
7
|
[
|
|
7
8
|
Opcode.ADD_8,
|
|
8
|
-
Add.as(Add.wireFormat8).
|
|
9
|
+
Add.as(Add.wireFormat8).fromBuffer
|
|
9
10
|
],
|
|
10
11
|
[
|
|
11
12
|
Opcode.ADD_16,
|
|
12
|
-
Add.as(Add.wireFormat16).
|
|
13
|
+
Add.as(Add.wireFormat16).fromBuffer
|
|
13
14
|
],
|
|
14
15
|
[
|
|
15
16
|
Opcode.SUB_8,
|
|
16
|
-
Sub.as(Sub.wireFormat8).
|
|
17
|
+
Sub.as(Sub.wireFormat8).fromBuffer
|
|
17
18
|
],
|
|
18
19
|
[
|
|
19
20
|
Opcode.SUB_16,
|
|
20
|
-
Sub.as(Sub.wireFormat16).
|
|
21
|
+
Sub.as(Sub.wireFormat16).fromBuffer
|
|
21
22
|
],
|
|
22
23
|
[
|
|
23
24
|
Opcode.MUL_8,
|
|
24
|
-
Mul.as(Mul.wireFormat8).
|
|
25
|
+
Mul.as(Mul.wireFormat8).fromBuffer
|
|
25
26
|
],
|
|
26
27
|
[
|
|
27
28
|
Opcode.MUL_16,
|
|
28
|
-
Mul.as(Mul.wireFormat16).
|
|
29
|
+
Mul.as(Mul.wireFormat16).fromBuffer
|
|
29
30
|
],
|
|
30
31
|
[
|
|
31
32
|
Opcode.DIV_8,
|
|
32
|
-
Div.as(Div.wireFormat8).
|
|
33
|
+
Div.as(Div.wireFormat8).fromBuffer
|
|
33
34
|
],
|
|
34
35
|
[
|
|
35
36
|
Opcode.DIV_16,
|
|
36
|
-
Div.as(Div.wireFormat16).
|
|
37
|
+
Div.as(Div.wireFormat16).fromBuffer
|
|
37
38
|
],
|
|
38
39
|
[
|
|
39
40
|
Opcode.FDIV_8,
|
|
40
|
-
FieldDiv.as(FieldDiv.wireFormat8).
|
|
41
|
+
FieldDiv.as(FieldDiv.wireFormat8).fromBuffer
|
|
41
42
|
],
|
|
42
43
|
[
|
|
43
44
|
Opcode.FDIV_16,
|
|
44
|
-
FieldDiv.as(FieldDiv.wireFormat16).
|
|
45
|
+
FieldDiv.as(FieldDiv.wireFormat16).fromBuffer
|
|
45
46
|
],
|
|
46
47
|
[
|
|
47
48
|
Opcode.EQ_8,
|
|
48
|
-
Eq.as(Eq.wireFormat8).
|
|
49
|
+
Eq.as(Eq.wireFormat8).fromBuffer
|
|
49
50
|
],
|
|
50
51
|
[
|
|
51
52
|
Opcode.EQ_16,
|
|
52
|
-
Eq.as(Eq.wireFormat16).
|
|
53
|
+
Eq.as(Eq.wireFormat16).fromBuffer
|
|
53
54
|
],
|
|
54
55
|
[
|
|
55
56
|
Opcode.LT_8,
|
|
56
|
-
Lt.as(Lt.wireFormat8).
|
|
57
|
+
Lt.as(Lt.wireFormat8).fromBuffer
|
|
57
58
|
],
|
|
58
59
|
[
|
|
59
60
|
Opcode.LT_16,
|
|
60
|
-
Lt.as(Lt.wireFormat16).
|
|
61
|
+
Lt.as(Lt.wireFormat16).fromBuffer
|
|
61
62
|
],
|
|
62
63
|
[
|
|
63
64
|
Opcode.LTE_8,
|
|
64
|
-
Lte.as(Lte.wireFormat8).
|
|
65
|
+
Lte.as(Lte.wireFormat8).fromBuffer
|
|
65
66
|
],
|
|
66
67
|
[
|
|
67
68
|
Opcode.LTE_16,
|
|
68
|
-
Lte.as(Lte.wireFormat16).
|
|
69
|
+
Lte.as(Lte.wireFormat16).fromBuffer
|
|
69
70
|
],
|
|
70
71
|
[
|
|
71
72
|
Opcode.AND_8,
|
|
72
|
-
And.as(And.wireFormat8).
|
|
73
|
+
And.as(And.wireFormat8).fromBuffer
|
|
73
74
|
],
|
|
74
75
|
[
|
|
75
76
|
Opcode.AND_16,
|
|
76
|
-
And.as(And.wireFormat16).
|
|
77
|
+
And.as(And.wireFormat16).fromBuffer
|
|
77
78
|
],
|
|
78
79
|
[
|
|
79
80
|
Opcode.OR_8,
|
|
80
|
-
Or.as(Or.wireFormat8).
|
|
81
|
+
Or.as(Or.wireFormat8).fromBuffer
|
|
81
82
|
],
|
|
82
83
|
[
|
|
83
84
|
Opcode.OR_16,
|
|
84
|
-
Or.as(Or.wireFormat16).
|
|
85
|
+
Or.as(Or.wireFormat16).fromBuffer
|
|
85
86
|
],
|
|
86
87
|
[
|
|
87
88
|
Opcode.XOR_8,
|
|
88
|
-
Xor.as(Xor.wireFormat8).
|
|
89
|
+
Xor.as(Xor.wireFormat8).fromBuffer
|
|
89
90
|
],
|
|
90
91
|
[
|
|
91
92
|
Opcode.XOR_16,
|
|
92
|
-
Xor.as(Xor.wireFormat16).
|
|
93
|
+
Xor.as(Xor.wireFormat16).fromBuffer
|
|
93
94
|
],
|
|
94
95
|
[
|
|
95
96
|
Opcode.NOT_8,
|
|
96
|
-
Not.as(Not.wireFormat8).
|
|
97
|
+
Not.as(Not.wireFormat8).fromBuffer
|
|
97
98
|
],
|
|
98
99
|
[
|
|
99
100
|
Opcode.NOT_16,
|
|
100
|
-
Not.as(Not.wireFormat16).
|
|
101
|
+
Not.as(Not.wireFormat16).fromBuffer
|
|
101
102
|
],
|
|
102
103
|
[
|
|
103
104
|
Opcode.SHL_8,
|
|
104
|
-
Shl.as(Shl.wireFormat8).
|
|
105
|
+
Shl.as(Shl.wireFormat8).fromBuffer
|
|
105
106
|
],
|
|
106
107
|
[
|
|
107
108
|
Opcode.SHL_16,
|
|
108
|
-
Shl.as(Shl.wireFormat16).
|
|
109
|
+
Shl.as(Shl.wireFormat16).fromBuffer
|
|
109
110
|
],
|
|
110
111
|
[
|
|
111
112
|
Opcode.SHR_8,
|
|
112
|
-
Shr.as(Shr.wireFormat8).
|
|
113
|
+
Shr.as(Shr.wireFormat8).fromBuffer
|
|
113
114
|
],
|
|
114
115
|
[
|
|
115
116
|
Opcode.SHR_16,
|
|
116
|
-
Shr.as(Shr.wireFormat16).
|
|
117
|
+
Shr.as(Shr.wireFormat16).fromBuffer
|
|
117
118
|
],
|
|
118
119
|
[
|
|
119
120
|
Opcode.CAST_8,
|
|
120
|
-
Cast.as(Cast.wireFormat8).
|
|
121
|
+
Cast.as(Cast.wireFormat8).fromBuffer
|
|
121
122
|
],
|
|
122
123
|
[
|
|
123
124
|
Opcode.CAST_16,
|
|
124
|
-
Cast.as(Cast.wireFormat16).
|
|
125
|
+
Cast.as(Cast.wireFormat16).fromBuffer
|
|
125
126
|
],
|
|
126
127
|
// Execution Environment
|
|
127
128
|
[
|
|
128
129
|
Opcode.GETENVVAR_16,
|
|
129
|
-
GetEnvVar.as(GetEnvVar.wireFormat16).
|
|
130
|
+
GetEnvVar.as(GetEnvVar.wireFormat16).fromBuffer
|
|
130
131
|
],
|
|
131
132
|
[
|
|
132
133
|
CalldataCopy.opcode,
|
|
133
|
-
Instruction.
|
|
134
|
+
Instruction.fromBuffer.bind(CalldataCopy)
|
|
134
135
|
],
|
|
135
136
|
[
|
|
136
137
|
SuccessCopy.opcode,
|
|
137
|
-
Instruction.
|
|
138
|
+
Instruction.fromBuffer.bind(SuccessCopy)
|
|
138
139
|
],
|
|
139
140
|
[
|
|
140
141
|
Opcode.RETURNDATASIZE,
|
|
141
|
-
Instruction.
|
|
142
|
+
Instruction.fromBuffer.bind(ReturndataSize)
|
|
142
143
|
],
|
|
143
144
|
[
|
|
144
145
|
Opcode.RETURNDATACOPY,
|
|
145
|
-
Instruction.
|
|
146
|
+
Instruction.fromBuffer.bind(ReturndataCopy)
|
|
146
147
|
],
|
|
147
148
|
// Machine State - Internal Control Flow
|
|
148
149
|
[
|
|
149
150
|
Jump.opcode,
|
|
150
|
-
Instruction.
|
|
151
|
+
Instruction.fromBuffer.bind(Jump)
|
|
151
152
|
],
|
|
152
153
|
[
|
|
153
154
|
JumpI.opcode,
|
|
154
|
-
Instruction.
|
|
155
|
+
Instruction.fromBuffer.bind(JumpI)
|
|
155
156
|
],
|
|
156
157
|
[
|
|
157
158
|
InternalCall.opcode,
|
|
158
|
-
Instruction.
|
|
159
|
+
Instruction.fromBuffer.bind(InternalCall)
|
|
159
160
|
],
|
|
160
161
|
[
|
|
161
162
|
InternalReturn.opcode,
|
|
162
|
-
Instruction.
|
|
163
|
+
Instruction.fromBuffer.bind(InternalReturn)
|
|
163
164
|
],
|
|
164
165
|
[
|
|
165
166
|
Opcode.SET_8,
|
|
166
|
-
Set.as(Set.wireFormat8).
|
|
167
|
+
Set.as(Set.wireFormat8).fromBuffer
|
|
167
168
|
],
|
|
168
169
|
[
|
|
169
170
|
Opcode.SET_16,
|
|
170
|
-
Set.as(Set.wireFormat16).
|
|
171
|
+
Set.as(Set.wireFormat16).fromBuffer
|
|
171
172
|
],
|
|
172
173
|
[
|
|
173
174
|
Opcode.SET_32,
|
|
174
|
-
Set.as(Set.wireFormat32).
|
|
175
|
+
Set.as(Set.wireFormat32).fromBuffer
|
|
175
176
|
],
|
|
176
177
|
[
|
|
177
178
|
Opcode.SET_64,
|
|
178
|
-
Set.as(Set.wireFormat64).
|
|
179
|
+
Set.as(Set.wireFormat64).fromBuffer
|
|
179
180
|
],
|
|
180
181
|
[
|
|
181
182
|
Opcode.SET_128,
|
|
182
|
-
Set.as(Set.wireFormat128).
|
|
183
|
+
Set.as(Set.wireFormat128).fromBuffer
|
|
183
184
|
],
|
|
184
185
|
[
|
|
185
186
|
Opcode.SET_FF,
|
|
186
|
-
Set.as(Set.wireFormatFF).
|
|
187
|
+
Set.as(Set.wireFormatFF).fromBuffer
|
|
187
188
|
],
|
|
188
189
|
[
|
|
189
190
|
Opcode.MOV_8,
|
|
190
|
-
Mov.as(Mov.wireFormat8).
|
|
191
|
+
Mov.as(Mov.wireFormat8).fromBuffer
|
|
191
192
|
],
|
|
192
193
|
[
|
|
193
194
|
Opcode.MOV_16,
|
|
194
|
-
Mov.as(Mov.wireFormat16).
|
|
195
|
+
Mov.as(Mov.wireFormat16).fromBuffer
|
|
195
196
|
],
|
|
196
197
|
// World State
|
|
197
198
|
[
|
|
198
199
|
SLoad.opcode,
|
|
199
|
-
Instruction.
|
|
200
|
+
Instruction.fromBuffer.bind(SLoad)
|
|
200
201
|
],
|
|
201
202
|
[
|
|
202
203
|
SStore.opcode,
|
|
203
|
-
Instruction.
|
|
204
|
+
Instruction.fromBuffer.bind(SStore)
|
|
204
205
|
],
|
|
205
206
|
[
|
|
206
207
|
NoteHashExists.opcode,
|
|
207
|
-
Instruction.
|
|
208
|
+
Instruction.fromBuffer.bind(NoteHashExists)
|
|
208
209
|
],
|
|
209
210
|
[
|
|
210
211
|
EmitNoteHash.opcode,
|
|
211
|
-
Instruction.
|
|
212
|
+
Instruction.fromBuffer.bind(EmitNoteHash)
|
|
212
213
|
],
|
|
213
214
|
[
|
|
214
215
|
NullifierExists.opcode,
|
|
215
|
-
Instruction.
|
|
216
|
+
Instruction.fromBuffer.bind(NullifierExists)
|
|
216
217
|
],
|
|
217
218
|
[
|
|
218
219
|
EmitNullifier.opcode,
|
|
219
|
-
Instruction.
|
|
220
|
+
Instruction.fromBuffer.bind(EmitNullifier)
|
|
220
221
|
],
|
|
221
222
|
[
|
|
222
223
|
L1ToL2MessageExists.opcode,
|
|
223
|
-
Instruction.
|
|
224
|
+
Instruction.fromBuffer.bind(L1ToL2MessageExists)
|
|
224
225
|
],
|
|
225
226
|
// Accrued Substate
|
|
226
227
|
[
|
|
227
228
|
EmitUnencryptedLog.opcode,
|
|
228
|
-
Instruction.
|
|
229
|
+
Instruction.fromBuffer.bind(EmitUnencryptedLog)
|
|
229
230
|
],
|
|
230
231
|
[
|
|
231
232
|
SendL2ToL1Message.opcode,
|
|
232
|
-
Instruction.
|
|
233
|
+
Instruction.fromBuffer.bind(SendL2ToL1Message)
|
|
233
234
|
],
|
|
234
235
|
[
|
|
235
236
|
GetContractInstance.opcode,
|
|
236
|
-
Instruction.
|
|
237
|
+
Instruction.fromBuffer.bind(GetContractInstance)
|
|
237
238
|
],
|
|
238
239
|
// Control Flow - Contract Calls
|
|
239
240
|
[
|
|
240
241
|
Call.opcode,
|
|
241
|
-
Instruction.
|
|
242
|
+
Instruction.fromBuffer.bind(Call)
|
|
242
243
|
],
|
|
243
244
|
[
|
|
244
245
|
StaticCall.opcode,
|
|
245
|
-
Instruction.
|
|
246
|
+
Instruction.fromBuffer.bind(StaticCall)
|
|
246
247
|
],
|
|
247
248
|
[
|
|
248
249
|
Return.opcode,
|
|
249
|
-
Instruction.
|
|
250
|
+
Instruction.fromBuffer.bind(Return)
|
|
250
251
|
],
|
|
251
252
|
[
|
|
252
253
|
Opcode.REVERT_8,
|
|
253
|
-
Revert.as(Revert.wireFormat8).
|
|
254
|
+
Revert.as(Revert.wireFormat8).fromBuffer
|
|
254
255
|
],
|
|
255
256
|
[
|
|
256
257
|
Opcode.REVERT_16,
|
|
257
|
-
Revert.as(Revert.wireFormat16).
|
|
258
|
+
Revert.as(Revert.wireFormat16).fromBuffer
|
|
258
259
|
],
|
|
259
260
|
// Misc
|
|
260
261
|
[
|
|
261
262
|
DebugLog.opcode,
|
|
262
|
-
Instruction.
|
|
263
|
+
Instruction.fromBuffer.bind(DebugLog)
|
|
263
264
|
],
|
|
264
265
|
// Gadgets
|
|
265
266
|
[
|
|
266
267
|
EcAdd.opcode,
|
|
267
|
-
Instruction.
|
|
268
|
+
Instruction.fromBuffer.bind(EcAdd)
|
|
268
269
|
],
|
|
269
270
|
[
|
|
270
271
|
Poseidon2.opcode,
|
|
271
|
-
Instruction.
|
|
272
|
+
Instruction.fromBuffer.bind(Poseidon2)
|
|
272
273
|
],
|
|
273
274
|
[
|
|
274
275
|
Sha256Compression.opcode,
|
|
275
|
-
Instruction.
|
|
276
|
+
Instruction.fromBuffer.bind(Sha256Compression)
|
|
276
277
|
],
|
|
277
278
|
[
|
|
278
279
|
KeccakF1600.opcode,
|
|
279
|
-
Instruction.
|
|
280
|
+
Instruction.fromBuffer.bind(KeccakF1600)
|
|
280
281
|
],
|
|
281
282
|
// Conversions
|
|
282
283
|
[
|
|
283
284
|
ToRadixBE.opcode,
|
|
284
|
-
Instruction.
|
|
285
|
+
Instruction.fromBuffer.bind(ToRadixBE)
|
|
285
286
|
]
|
|
286
287
|
]);
|
|
287
288
|
/**
|
|
288
289
|
* Serializes an array of instructions to bytecode.
|
|
289
290
|
*/ export function encodeToBytecode(instructions) {
|
|
290
|
-
return
|
|
291
|
+
return serializeToBuffer(instructions);
|
|
291
292
|
}
|
|
292
293
|
// For testing only
|
|
293
294
|
export function decodeFromBytecode(bytecode, instructionSet = INSTRUCTION_SET) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { PublicContractsDBInterface } from '
|
|
3
|
+
import type { PublicContractsDBInterface } from './db_interfaces.js';
|
|
4
4
|
export declare function getPublicFunctionDebugName(db: PublicContractsDBInterface, contractAddress: AztecAddress, calldata: Fr[]): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=debug_fn_name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/public/debug_fn_name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,0BAA0B,EAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,EAAE,EAAE,GACb,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,YAAY,CAAC;AAC3B,cAAc,kCAAkC,CAAC"}
|
|
@@ -4,9 +4,9 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
5
|
import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
6
6
|
import { BaseAvmSimulationTester } from '../avm/fixtures/base_avm_simulation_tester.js';
|
|
7
|
-
import { SimpleContractDataSource } from '../avm/fixtures/simple_contract_data_source.js';
|
|
8
7
|
import type { PublicTxResult } from '../public_tx_simulator/public_tx_simulator.js';
|
|
9
8
|
import { TestExecutorMetrics } from '../test_executor_metrics.js';
|
|
9
|
+
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
10
10
|
export type TestEnqueuedCall = {
|
|
11
11
|
sender?: AztecAddress;
|
|
12
12
|
address: AztecAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAiC,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAiC,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAM5E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,uBAAuB;;IASjE,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,aAAa,CAAC,CAAS;gBAG7B,UAAU,EAAE,yBAAyB,EACrC,kBAAkB,EAAE,wBAAwB,EAC5C,OAAO,GAAE,eAAkC,EACnC,OAAO,GAAE,mBAA+C;WAe9C,MAAM,CACxB,OAAO,GAAE,eAAkC,EAC3C,OAAO,GAAE,mBAA+C,GACvD,OAAO,CAAC,wBAAwB,CAAC;IAM7B,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAIzB,QAAQ,CACnB,MAAM,EAAE,YAAY,EACpB,UAAU,GAAE,gBAAgB,EAAO,EACnC,QAAQ,GAAE,gBAAgB,EAAO,EACjC,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,GAAE,YAAqB,EAE/B,cAAc,KAAkC,GAC/C,OAAO,CAAC,EAAE,CAAC;IAcD,UAAU,CACrB,MAAM,EAAE,YAAY,EACpB,UAAU,GAAE,gBAAgB,EAAO,EACnC,QAAQ,GAAE,gBAAgB,EAAO,EACjC,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,GAAE,YAAqB,EAE/B,cAAc,KAAkC,EAChD,OAAO,GAAE,MAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAyBb,mBAAmB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,cAAc,CAAC,EAAE,EAAE,GAClB,OAAO,CAAC,cAAc,CAAC;IAInB,kBAAkB;CAuB1B;AAED,wBAAgB,cAAc,oBAM7B"}
|
|
@@ -7,10 +7,10 @@ import { GlobalVariables, PublicCallRequestWithCalldata } from '@aztec/stdlib/tx
|
|
|
7
7
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
8
8
|
import { BaseAvmSimulationTester } from '../avm/fixtures/base_avm_simulation_tester.js';
|
|
9
9
|
import { DEFAULT_BLOCK_NUMBER, getContractFunctionAbi, getFunctionSelector } from '../avm/fixtures/index.js';
|
|
10
|
-
import {
|
|
11
|
-
import { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
|
|
10
|
+
import { PublicContractsDB } from '../public_db_sources.js';
|
|
12
11
|
import { MeasuredPublicTxSimulator } from '../public_tx_simulator/measured_public_tx_simulator.js';
|
|
13
12
|
import { TestExecutorMetrics } from '../test_executor_metrics.js';
|
|
13
|
+
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
14
14
|
import { createTxForPublicCalls } from './utils.js';
|
|
15
15
|
const TIMESTAMP = new Fr(99833);
|
|
16
16
|
const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
@@ -25,9 +25,8 @@ const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
|
25
25
|
metricsPrefix;
|
|
26
26
|
constructor(merkleTree, contractDataSource, globals = defaultGlobals(), metrics = new TestExecutorMetrics()){
|
|
27
27
|
super(contractDataSource, merkleTree), this.metrics = metrics, this.txCount = 0;
|
|
28
|
-
const treesDB = new PublicTreesDB(merkleTree);
|
|
29
28
|
const contractsDB = new PublicContractsDB(contractDataSource);
|
|
30
|
-
this.simulator = new MeasuredPublicTxSimulator(
|
|
29
|
+
this.simulator = new MeasuredPublicTxSimulator(merkleTree, contractsDB, globals, /*doMerkleOperations=*/ true, /*skipFeeEnforcement=*/ false, this.metrics);
|
|
31
30
|
}
|
|
32
31
|
static async create(globals = defaultGlobals(), metrics = new TestExecutorMetrics()) {
|
|
33
32
|
const contractDataSource = new SimpleContractDataSource();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple_contract_data_source.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/simple_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAInH;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IAC1D,MAAM,yCAA+C;IAG5D,OAAO,CAAC,eAAe,CAA+C;IAEtE,OAAO,CAAC,iBAAiB,CAAuD;IAEhF,OAAO,CAAC,iBAAiB,CAA4C;IAErE,OAAO,CAAC,iBAAiB,CAAkC;IAI3D;;;OAGG;IACG,cAAc,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,EAAE,2BAA2B;IAOzC,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB;IAkBjE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIlE,qBAAqB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIvD,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAIpF,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAI9B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAWjF,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB9F,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhG,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { getFunctionSelector } from '
|
|
2
|
+
import { getFunctionSelector } from '../avm/fixtures/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* This class is used during public/avm testing to function as a database of
|
|
5
5
|
* contract contract classes and instances. Tests can populate it with classes
|
|
@@ -6,9 +6,8 @@ import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
6
6
|
import { type AvmExecutionHints } from '@aztec/stdlib/avm';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
8
|
import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
|
-
import { type IndexedTreeId, MerkleTreeId, type MerkleTreeLeafType, type SequentialInsertionResult } from '@aztec/stdlib/trees';
|
|
9
|
+
import { type BatchInsertionResult, type IndexedTreeId, MerkleTreeId, type MerkleTreeLeafType, type MerkleTreeWriteOperations, type SequentialInsertionResult } from '@aztec/stdlib/trees';
|
|
10
10
|
import type { PublicContractsDBInterface } from './db_interfaces.js';
|
|
11
|
-
import { PublicTreesDB } from './public_db_sources.js';
|
|
12
11
|
/**
|
|
13
12
|
* A public contracts database that forwards requests and collects AVM hints.
|
|
14
13
|
*/
|
|
@@ -22,15 +21,17 @@ export declare class HintingPublicContractsDB implements PublicContractsDBInterf
|
|
|
22
21
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
|
-
* A
|
|
24
|
+
* A low-level merkle DB that collects hints.
|
|
26
25
|
*/
|
|
27
|
-
export declare class
|
|
26
|
+
export declare class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
27
|
+
private db;
|
|
28
28
|
private hints;
|
|
29
29
|
private static readonly log;
|
|
30
30
|
private checkpointStack;
|
|
31
31
|
private nextCheckpointId;
|
|
32
32
|
private checkpointActionCounter;
|
|
33
|
-
|
|
33
|
+
static create(db: MerkleTreeWriteOperations, hints: AvmExecutionHints): Promise<HintingMerkleWriteOperations>;
|
|
34
|
+
private constructor();
|
|
34
35
|
getSiblingPath<N extends number>(treeId: MerkleTreeId, index: bigint): Promise<SiblingPath<N>>;
|
|
35
36
|
getPreviousValueIndex<ID extends IndexedTreeId>(treeId: ID, value: bigint): Promise<{
|
|
36
37
|
index: bigint;
|
|
@@ -48,5 +49,14 @@ export declare class HintingPublicTreesDB extends PublicTreesDB {
|
|
|
48
49
|
private getTreesStateHash;
|
|
49
50
|
private static logTreeChange;
|
|
50
51
|
private appendLeafInternal;
|
|
52
|
+
getTreeInfo(treeId: MerkleTreeId): Promise<import("@aztec/stdlib/trees").TreeInfo>;
|
|
53
|
+
getStateReference(): Promise<import("@aztec/stdlib/tx").StateReference>;
|
|
54
|
+
getInitialHeader(): import("@aztec/stdlib/tx").BlockHeader;
|
|
55
|
+
updateArchive(header: any): Promise<void>;
|
|
56
|
+
batchInsert<TreeHeight extends number, SubtreeSiblingPathHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[], subtreeHeight: number): Promise<BatchInsertionResult<TreeHeight, SubtreeSiblingPathHeight>>;
|
|
57
|
+
close(): Promise<void>;
|
|
58
|
+
findLeafIndices<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(bigint | undefined)[]>;
|
|
59
|
+
findLeafIndicesAfter<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[], startIndex: bigint): Promise<(bigint | undefined)[]>;
|
|
60
|
+
getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(treeId: ID, leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
|
|
51
61
|
}
|
|
52
62
|
//# sourceMappingURL=hinting_db_sources.d.ts.map
|