@aztec/simulator 0.86.0 → 0.87.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/common/errors.d.ts +3 -6
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/errors.js +50 -31
- package/dest/private/acvm/acvm.d.ts +0 -2
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/acvm.js +2 -2
- package/dest/private/acvm/deserialize.d.ts +0 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/oracle/oracle.d.ts +2 -2
- package/dest/private/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/private/acvm/oracle/oracle.js +30 -33
- package/dest/private/acvm/oracle/typed_oracle.d.ts +1 -3
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/private/acvm/serialize.d.ts +8 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +26 -0
- package/dest/private/index.d.ts +3 -0
- package/dest/private/index.d.ts.map +1 -1
- package/dest/private/index.js +3 -0
- package/dest/private/private_execution.d.ts.map +1 -1
- package/dest/private/private_execution.js +7 -1
- package/dest/private/providers/acvm_native.d.ts +0 -2
- package/dest/private/providers/acvm_native.d.ts.map +1 -1
- package/dest/private/providers/acvm_native.js +1 -1
- package/dest/private/providers/circuit_recording/circuit_recorder.d.ts +0 -2
- package/dest/private/providers/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/providers/simulation_provider.d.ts.map +1 -1
- package/dest/private/providers/simulation_provider.js +14 -16
- package/dest/private/simulator.d.ts.map +1 -1
- package/dest/private/utility_execution_oracle.d.ts +0 -2
- package/dest/private/utility_execution_oracle.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.js +2 -2
- package/dest/public/avm/avm_execution_environment.d.ts +2 -1
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +4 -2
- package/dest/public/avm/avm_gas.d.ts +0 -15
- package/dest/public/avm/avm_gas.d.ts.map +1 -1
- package/dest/public/avm/avm_gas.js +0 -18
- package/dest/public/avm/avm_memory_types.d.ts +84 -86
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.d.ts +1 -3
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +3 -3
- package/dest/public/avm/avm_simulator_interface.d.ts +0 -2
- package/dest/public/avm/avm_simulator_interface.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.js +1 -1
- package/dest/public/avm/fixtures/utils.d.ts +0 -10
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
- package/dest/public/avm/fixtures/utils.js +0 -42
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +7 -7
- package/dest/public/avm/opcodes/addressing_mode.d.ts +7 -6
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/public/avm/opcodes/addressing_mode.js +18 -15
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/public/avm/opcodes/arithmetic.js +1 -1
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
- package/dest/public/avm/opcodes/bitwise.js +2 -2
- package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
- package/dest/public/avm/opcodes/comparators.js +1 -1
- package/dest/public/avm/opcodes/contract.d.ts +1 -2
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
- package/dest/public/avm/opcodes/contract.js +8 -9
- package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
- package/dest/public/avm/opcodes/control_flow.js +1 -1
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/public/avm/opcodes/conversion.js +1 -1
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
- package/dest/public/avm/opcodes/ec_add.js +1 -1
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +1 -1
- package/dest/public/avm/opcodes/external_calls.d.ts +6 -6
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +22 -22
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
- package/dest/public/avm/opcodes/hashing.js +3 -3
- package/dest/public/avm/opcodes/instruction.d.ts +0 -2
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.d.ts +4 -4
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.js +16 -16
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/public/avm/opcodes/misc.js +18 -11
- package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
- package/dest/public/avm/opcodes/storage.js +2 -2
- package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -2
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -2
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -2
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/executor_metrics.d.ts +3 -3
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +6 -6
- package/dest/public/executor_metrics_interface.d.ts +1 -1
- package/dest/public/executor_metrics_interface.d.ts.map +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 -3
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +19 -26
- package/dest/public/hinting_db_sources.d.ts +0 -2
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +9 -2
- package/dest/public/public_processor/public_processor.d.ts +5 -7
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +10 -7
- package/dest/public/public_tx_simulator/apps_tests/amm_test.js +5 -5
- package/dest/public/public_tx_simulator/apps_tests/token_test.js +6 -6
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +3 -3
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +37 -34
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +15 -4
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +2 -2
- package/dest/public/side_effect_trace.d.ts +2 -39
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +8 -32
- package/dest/public/side_effect_trace_interface.d.ts +0 -4
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- package/dest/public/state_manager/public_storage.d.ts.map +1 -1
- 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 +6 -3
- package/dest/public/test_executor_metrics.d.ts +5 -4
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +47 -11
- package/dest/public/unique_class_ids.d.ts.map +1 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/package.json +18 -17
- package/src/common/errors.ts +77 -41
- package/src/private/acvm/acvm.ts +2 -2
- package/src/private/acvm/oracle/oracle.ts +38 -31
- package/src/private/acvm/oracle/typed_oracle.ts +1 -1
- package/src/private/acvm/serialize.ts +35 -0
- package/src/private/index.ts +3 -0
- package/src/private/pick_notes.ts +4 -4
- package/src/private/private_execution.ts +8 -0
- package/src/private/providers/acvm_native.ts +6 -2
- package/src/private/providers/simulation_provider.ts +14 -16
- package/src/private/simulator.ts +4 -1
- package/src/public/avm/avm_contract_call_result.ts +2 -2
- package/src/public/avm/avm_execution_environment.ts +7 -1
- package/src/public/avm/avm_gas.ts +0 -20
- package/src/public/avm/avm_simulator.ts +3 -1
- package/src/public/avm/fixtures/initializers.ts +1 -0
- package/src/public/avm/fixtures/utils.ts +0 -66
- package/src/public/avm/opcodes/accrued_substate.ts +31 -11
- package/src/public/avm/opcodes/addressing_mode.ts +23 -20
- package/src/public/avm/opcodes/arithmetic.ts +2 -1
- package/src/public/avm/opcodes/bitwise.ts +9 -3
- package/src/public/avm/opcodes/comparators.ts +2 -1
- package/src/public/avm/opcodes/contract.ts +7 -6
- package/src/public/avm/opcodes/control_flow.ts +7 -2
- package/src/public/avm/opcodes/conversion.ts +2 -1
- package/src/public/avm/opcodes/ec_add.ts +2 -1
- package/src/public/avm/opcodes/environment_getters.ts +7 -2
- package/src/public/avm/opcodes/external_calls.ts +26 -14
- package/src/public/avm/opcodes/hashing.ts +17 -5
- package/src/public/avm/opcodes/memory.ts +33 -15
- package/src/public/avm/opcodes/misc.ts +23 -15
- package/src/public/avm/opcodes/storage.ts +9 -3
- package/src/public/avm/serialization/buffer_cursor.ts +4 -1
- package/src/public/executor_metrics.ts +11 -6
- package/src/public/executor_metrics_interface.ts +1 -1
- package/src/public/fixtures/public_tx_simulation_tester.ts +3 -2
- package/src/public/fixtures/utils.ts +21 -28
- package/src/public/hinting_db_sources.ts +17 -4
- package/src/public/public_processor/public_processor.ts +11 -5
- package/src/public/public_tx_simulator/apps_tests/amm_test.ts +5 -5
- package/src/public/public_tx_simulator/apps_tests/token_test.ts +6 -6
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +3 -2
- package/src/public/public_tx_simulator/public_tx_context.ts +96 -81
- package/src/public/public_tx_simulator/public_tx_simulator.ts +14 -3
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +10 -1
- package/src/public/side_effect_trace.ts +7 -111
- package/src/public/side_effect_trace_interface.ts +0 -4
- package/src/public/state_manager/state_manager.ts +13 -5
- package/src/public/test_executor_metrics.ts +60 -13
- package/src/public/avm/opcodes/.eslintrc.cjs +0 -8
|
@@ -66,10 +66,11 @@ export class Set extends Instruction {
|
|
|
66
66
|
const res = TaggedMemory.buildFromTagTruncating(this.value, this.inTag);
|
|
67
67
|
|
|
68
68
|
const memory = context.machineState.memory;
|
|
69
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
70
|
+
|
|
69
71
|
context.machineState.consumeGas(this.gasCost());
|
|
70
72
|
|
|
71
73
|
const operands = [this.dstOffset];
|
|
72
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
73
74
|
const [dstOffset] = addressing.resolve(operands, memory);
|
|
74
75
|
memory.set(dstOffset, res);
|
|
75
76
|
}
|
|
@@ -94,16 +95,22 @@ export class Cast extends Instruction {
|
|
|
94
95
|
OperandType.TAG,
|
|
95
96
|
];
|
|
96
97
|
|
|
97
|
-
constructor(
|
|
98
|
+
constructor(
|
|
99
|
+
private indirect: number,
|
|
100
|
+
private srcOffset: number,
|
|
101
|
+
private dstOffset: number,
|
|
102
|
+
private dstTag: number,
|
|
103
|
+
) {
|
|
98
104
|
super();
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
public async execute(context: AvmContext): Promise<void> {
|
|
102
108
|
const memory = context.machineState.memory;
|
|
109
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
110
|
+
|
|
103
111
|
context.machineState.consumeGas(this.gasCost());
|
|
104
112
|
|
|
105
113
|
const operands = [this.srcOffset, this.dstOffset];
|
|
106
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
107
114
|
const [srcOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
108
115
|
|
|
109
116
|
const a = memory.get(srcOffset);
|
|
@@ -132,16 +139,21 @@ export class Mov extends Instruction {
|
|
|
132
139
|
OperandType.UINT16,
|
|
133
140
|
];
|
|
134
141
|
|
|
135
|
-
constructor(
|
|
142
|
+
constructor(
|
|
143
|
+
private indirect: number,
|
|
144
|
+
private srcOffset: number,
|
|
145
|
+
private dstOffset: number,
|
|
146
|
+
) {
|
|
136
147
|
super();
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
public async execute(context: AvmContext): Promise<void> {
|
|
140
151
|
const memory = context.machineState.memory;
|
|
152
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
153
|
+
|
|
141
154
|
context.machineState.consumeGas(this.gasCost());
|
|
142
155
|
|
|
143
156
|
const operands = [this.srcOffset, this.dstOffset];
|
|
144
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
145
157
|
const [srcOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
146
158
|
const a = memory.get(srcOffset);
|
|
147
159
|
memory.set(dstOffset, a);
|
|
@@ -162,8 +174,8 @@ export class CalldataCopy extends Instruction {
|
|
|
162
174
|
|
|
163
175
|
constructor(
|
|
164
176
|
private indirect: number,
|
|
165
|
-
private cdStartOffset: number,
|
|
166
177
|
private copySizeOffset: number,
|
|
178
|
+
private cdStartOffset: number,
|
|
167
179
|
private dstOffset: number,
|
|
168
180
|
) {
|
|
169
181
|
super();
|
|
@@ -171,9 +183,10 @@ export class CalldataCopy extends Instruction {
|
|
|
171
183
|
|
|
172
184
|
public async execute(context: AvmContext): Promise<void> {
|
|
173
185
|
const memory = context.machineState.memory;
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
const [
|
|
186
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
187
|
+
|
|
188
|
+
const operands = [this.copySizeOffset, this.cdStartOffset, this.dstOffset];
|
|
189
|
+
const [copySizeOffset, cdStartOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
177
190
|
|
|
178
191
|
memory.checkTags(TypeTag.UINT32, cdStartOffset, copySizeOffset);
|
|
179
192
|
const cdStart = memory.get(cdStartOffset).toNumber();
|
|
@@ -195,14 +208,18 @@ export class ReturndataSize extends Instruction {
|
|
|
195
208
|
// Informs (de)serialization. See Instruction.deserialize.
|
|
196
209
|
static readonly wireFormat: OperandType[] = [OperandType.UINT8, OperandType.UINT8, OperandType.UINT16];
|
|
197
210
|
|
|
198
|
-
constructor(
|
|
211
|
+
constructor(
|
|
212
|
+
private indirect: number,
|
|
213
|
+
private dstOffset: number,
|
|
214
|
+
) {
|
|
199
215
|
super();
|
|
200
216
|
}
|
|
201
217
|
|
|
202
218
|
public async execute(context: AvmContext): Promise<void> {
|
|
203
219
|
const memory = context.machineState.memory;
|
|
220
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
221
|
+
|
|
204
222
|
const operands = [this.dstOffset];
|
|
205
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
206
223
|
const [dstOffset] = addressing.resolve(operands, memory);
|
|
207
224
|
context.machineState.consumeGas(this.gasCost());
|
|
208
225
|
|
|
@@ -224,8 +241,8 @@ export class ReturndataCopy extends Instruction {
|
|
|
224
241
|
|
|
225
242
|
constructor(
|
|
226
243
|
private indirect: number,
|
|
227
|
-
private rdStartOffset: number,
|
|
228
244
|
private copySizeOffset: number,
|
|
245
|
+
private rdStartOffset: number,
|
|
229
246
|
private dstOffset: number,
|
|
230
247
|
) {
|
|
231
248
|
super();
|
|
@@ -233,9 +250,10 @@ export class ReturndataCopy extends Instruction {
|
|
|
233
250
|
|
|
234
251
|
public async execute(context: AvmContext): Promise<void> {
|
|
235
252
|
const memory = context.machineState.memory;
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const [
|
|
253
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
254
|
+
|
|
255
|
+
const operands = [this.copySizeOffset, this.rdStartOffset, this.dstOffset];
|
|
256
|
+
const [copySizeOffset, rdStartOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
239
257
|
|
|
240
258
|
memory.checkTags(TypeTag.UINT32, rdStartOffset, copySizeOffset);
|
|
241
259
|
const rdStart = memory.get(rdStartOffset).toNumber();
|
|
@@ -33,28 +33,36 @@ export class DebugLog extends Instruction {
|
|
|
33
33
|
|
|
34
34
|
public async execute(context: AvmContext): Promise<void> {
|
|
35
35
|
const memory = context.machineState.memory;
|
|
36
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
37
|
+
|
|
36
38
|
const operands = [this.messageOffset, this.fieldsOffset, this.fieldsSizeOffset];
|
|
37
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
38
39
|
const [messageOffset, fieldsOffset, fieldsSizeOffset] = addressing.resolve(operands, memory);
|
|
39
|
-
|
|
40
40
|
memory.checkTag(TypeTag.UINT32, fieldsSizeOffset);
|
|
41
|
-
const fieldsSize = memory.get(fieldsSizeOffset).toNumber();
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
// DebugLog is a no-op except when doing client-initiated simulation with debug logging enabled.
|
|
43
|
+
// Note that we still do address resolution and basic tag-checking (above)
|
|
44
|
+
// To avoid a special-case in the witness generator and circuit.
|
|
45
|
+
if (context.environment.clientInitiatedSimulation && DebugLog.logger.isLevelEnabled('verbose')) {
|
|
46
|
+
const fieldsSize = memory.get(fieldsSizeOffset).toNumber();
|
|
47
|
+
|
|
48
|
+
const rawMessage = memory.getSlice(messageOffset, this.messageSize);
|
|
49
|
+
const fields = memory.getSlice(fieldsOffset, fieldsSize);
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
memory.checkTagsRange(TypeTag.UINT8, messageOffset, this.messageSize);
|
|
52
|
+
memory.checkTagsRange(TypeTag.FIELD, fieldsOffset, fieldsSize);
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
// Interpret str<N> = [u8; N] to string.
|
|
55
|
+
const messageAsStr = rawMessage.map(field => String.fromCharCode(field.toNumber())).join('');
|
|
56
|
+
const formattedStr = applyStringFormatting(
|
|
57
|
+
messageAsStr,
|
|
58
|
+
fields.map(field => field.toFr()),
|
|
59
|
+
);
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const formattedStr = applyStringFormatting(
|
|
54
|
-
messageAsStr,
|
|
55
|
-
fields.map(field => field.toFr()),
|
|
56
|
-
);
|
|
61
|
+
DebugLog.logger.verbose(formattedStr);
|
|
62
|
+
}
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
// Despite having dynamic "size" operands, the gas cost is fixed because
|
|
65
|
+
// this opcode is a no-op except during client-initiated simulation
|
|
66
|
+
context.machineState.consumeGas(this.gasCost());
|
|
59
67
|
}
|
|
60
68
|
}
|
|
@@ -14,7 +14,11 @@ abstract class BaseStorageInstruction extends Instruction {
|
|
|
14
14
|
OperandType.UINT16,
|
|
15
15
|
];
|
|
16
16
|
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
protected indirect: number,
|
|
19
|
+
protected aOffset: number,
|
|
20
|
+
protected bOffset: number,
|
|
21
|
+
) {
|
|
18
22
|
super();
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -33,10 +37,11 @@ export class SStore extends BaseStorageInstruction {
|
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
const memory = context.machineState.memory;
|
|
40
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
41
|
+
|
|
36
42
|
context.machineState.consumeGas(this.gasCost());
|
|
37
43
|
|
|
38
44
|
const operands = [this.aOffset, this.bOffset];
|
|
39
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
40
45
|
const [srcOffset, slotOffset] = addressing.resolve(operands, memory);
|
|
41
46
|
memory.checkTag(TypeTag.FIELD, slotOffset);
|
|
42
47
|
memory.checkTag(TypeTag.FIELD, srcOffset);
|
|
@@ -57,10 +62,11 @@ export class SLoad extends BaseStorageInstruction {
|
|
|
57
62
|
|
|
58
63
|
public async execute(context: AvmContext): Promise<void> {
|
|
59
64
|
const memory = context.machineState.memory;
|
|
65
|
+
const addressing = Addressing.fromWire(this.indirect);
|
|
66
|
+
|
|
60
67
|
context.machineState.consumeGas(this.gasCost());
|
|
61
68
|
|
|
62
69
|
const operands = [this.aOffset, this.bOffset];
|
|
63
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
64
70
|
const [slotOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
65
71
|
memory.checkTag(TypeTag.FIELD, slotOffset);
|
|
66
72
|
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* A Buffer-like class that automatically advances the position.
|
|
3
3
|
*/
|
|
4
4
|
export class BufferCursor {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(
|
|
6
|
+
private _buffer: Buffer,
|
|
7
|
+
private _position: number = 0,
|
|
8
|
+
) {}
|
|
6
9
|
|
|
7
10
|
public position(): number {
|
|
8
11
|
return this._position;
|
|
@@ -17,7 +17,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
17
17
|
private fnDuration: Histogram;
|
|
18
18
|
private manaPerSecond: Histogram;
|
|
19
19
|
private manaUsed: Histogram;
|
|
20
|
-
private
|
|
20
|
+
private totalInstructionsExecuted: Histogram;
|
|
21
21
|
private txHashing: Histogram;
|
|
22
22
|
private privateEffectsInsertions: Histogram;
|
|
23
23
|
|
|
@@ -47,9 +47,9 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
47
47
|
valueType: ValueType.INT,
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
this.
|
|
50
|
+
this.totalInstructionsExecuted = meter.createHistogram(Metrics.PUBLIC_EXECUTOR_SIMULATION_TOTAL_INSTRUCTIONS, {
|
|
51
51
|
description: 'Total number of instructions executed',
|
|
52
|
-
unit: 'instructions',
|
|
52
|
+
unit: '#instructions',
|
|
53
53
|
valueType: ValueType.INT,
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -74,7 +74,12 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
74
74
|
// do nothing (unimplemented)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
recordEnqueuedCallSimulation(
|
|
77
|
+
recordEnqueuedCallSimulation(
|
|
78
|
+
fnName: string,
|
|
79
|
+
durationMs: number,
|
|
80
|
+
manaUsed: number,
|
|
81
|
+
totalInstructionsExecuted: number,
|
|
82
|
+
) {
|
|
78
83
|
this.fnCount.add(1, {
|
|
79
84
|
[Attributes.OK]: true,
|
|
80
85
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
@@ -82,7 +87,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
82
87
|
this.manaUsed.record(Math.ceil(manaUsed), {
|
|
83
88
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
84
89
|
});
|
|
85
|
-
this.
|
|
90
|
+
this.totalInstructionsExecuted.record(Math.ceil(totalInstructionsExecuted), {
|
|
86
91
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
87
92
|
});
|
|
88
93
|
this.fnDuration.record(Math.ceil(durationMs), {
|
|
@@ -100,7 +105,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
100
105
|
_fnName: string,
|
|
101
106
|
_durationMs: number,
|
|
102
107
|
_manaUsed: number,
|
|
103
|
-
|
|
108
|
+
_totalInstructionsExecuted: number,
|
|
104
109
|
) {
|
|
105
110
|
this.fnCount.add(1, {
|
|
106
111
|
[Attributes.OK]: false,
|
|
@@ -8,7 +8,7 @@ export interface ExecutorMetricsInterface {
|
|
|
8
8
|
fnName: string,
|
|
9
9
|
durationMs: number,
|
|
10
10
|
manaUsed: number,
|
|
11
|
-
|
|
11
|
+
totalInstructionsExecuted: number,
|
|
12
12
|
): void;
|
|
13
13
|
recordTxHashComputation(durationMs: number): void;
|
|
14
14
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
@@ -54,6 +54,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
54
54
|
globals,
|
|
55
55
|
/*doMerkleOperations=*/ true,
|
|
56
56
|
/*skipFeeEnforcement=*/ false,
|
|
57
|
+
/*clientInitiatedSimulation=*/ true,
|
|
57
58
|
this.metrics,
|
|
58
59
|
);
|
|
59
60
|
}
|
|
@@ -107,8 +108,8 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
107
108
|
|
|
108
109
|
await this.setFeePayerBalance(feePayer);
|
|
109
110
|
|
|
110
|
-
const txLabelWithCount = `${txLabel}
|
|
111
|
-
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}
|
|
111
|
+
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
112
|
+
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}/${txLabelWithCount}` : txLabelWithCount;
|
|
112
113
|
|
|
113
114
|
const avmResult = await this.simulator.simulate(tx, fullTxLabel);
|
|
114
115
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CONTRACT_CLASS_LOG_DATA_SIZE_IN_FIELDS,
|
|
3
2
|
DEFAULT_GAS_LIMIT,
|
|
4
3
|
DEPLOYER_CONTRACT_ADDRESS,
|
|
5
4
|
MAX_L2_GAS_PER_TX_PUBLIC_PORTION,
|
|
@@ -7,8 +6,8 @@ import {
|
|
|
7
6
|
REGISTERER_CONTRACT_ADDRESS,
|
|
8
7
|
REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE,
|
|
9
8
|
} from '@aztec/constants';
|
|
9
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
10
|
import { Fr } from '@aztec/foundation/fields';
|
|
11
|
-
import { assertLength } from '@aztec/foundation/serialize';
|
|
12
11
|
import { DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG } from '@aztec/protocol-contracts';
|
|
13
12
|
import { bufferAsFields } from '@aztec/stdlib/abi';
|
|
14
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -16,14 +15,14 @@ import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/st
|
|
|
16
15
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
17
16
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
18
17
|
import {
|
|
18
|
+
LogHash,
|
|
19
19
|
PartialPrivateTailPublicInputsForPublic,
|
|
20
20
|
PartialPrivateTailPublicInputsForRollup,
|
|
21
21
|
PrivateKernelTailCircuitPublicInputs,
|
|
22
22
|
RollupValidationRequests,
|
|
23
|
-
ScopedLogHash,
|
|
24
23
|
countAccumulatedItems,
|
|
25
24
|
} from '@aztec/stdlib/kernel';
|
|
26
|
-
import {
|
|
25
|
+
import { ContractClassLogFields, PrivateLog } from '@aztec/stdlib/logs';
|
|
27
26
|
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
28
27
|
import {
|
|
29
28
|
BlockHeader,
|
|
@@ -58,13 +57,11 @@ export function createTxForPublicCalls(
|
|
|
58
57
|
// TODO(#9269): Remove this fake nullifier method as we move away from 1st nullifier as hash.
|
|
59
58
|
forPublic.nonRevertibleAccumulatedData.nullifiers[0] = firstNullifier;
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
forPublic.nonRevertibleAccumulatedData.publicCallRequests[setupCallRequests.length - i - 1] =
|
|
64
|
-
setupCallRequests[i].request;
|
|
60
|
+
for (let i = 0; i < setupCallRequests.length; i++) {
|
|
61
|
+
forPublic.nonRevertibleAccumulatedData.publicCallRequests[i] = setupCallRequests[i].request;
|
|
65
62
|
}
|
|
66
|
-
for (let i =
|
|
67
|
-
forPublic.revertibleAccumulatedData.publicCallRequests[
|
|
63
|
+
for (let i = 0; i < appCallRequests.length; i++) {
|
|
64
|
+
forPublic.revertibleAccumulatedData.publicCallRequests[i] = appCallRequests[i].request;
|
|
68
65
|
}
|
|
69
66
|
if (teardownCallRequest) {
|
|
70
67
|
forPublic.publicTeardownCallRequest = teardownCallRequest.request;
|
|
@@ -128,18 +125,14 @@ export async function addNewContractClassToTx(
|
|
|
128
125
|
new Fr(contractClass.privateFunctionsRoot),
|
|
129
126
|
...bufferAsFields(contractClass.packedBytecode, Math.ceil(contractClass.packedBytecode.length / 31) + 1),
|
|
130
127
|
];
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
new Fr(7),
|
|
140
|
-
new Fr(contractClassLog.getEmittedLength()),
|
|
141
|
-
new Fr(REGISTERER_CONTRACT_ADDRESS),
|
|
142
|
-
]);
|
|
128
|
+
const contractAddress = new AztecAddress(new Fr(REGISTERER_CONTRACT_ADDRESS));
|
|
129
|
+
const emittedLength = contractClassLogFields.length;
|
|
130
|
+
const log = ContractClassLogFields.fromEmittedFields(contractClassLogFields);
|
|
131
|
+
|
|
132
|
+
const contractClassLogHash = LogHash.from({
|
|
133
|
+
value: await log.hash(),
|
|
134
|
+
length: emittedLength,
|
|
135
|
+
}).scope(contractAddress);
|
|
143
136
|
|
|
144
137
|
const accumulatedData = tx.data.forPublic ? tx.data.forPublic!.revertibleAccumulatedData : tx.data.forRollup!.end;
|
|
145
138
|
if (!skipNullifierInsertion) {
|
|
@@ -150,7 +143,7 @@ export async function addNewContractClassToTx(
|
|
|
150
143
|
const nextLogIndex = countAccumulatedItems(accumulatedData.contractClassLogsHashes);
|
|
151
144
|
accumulatedData.contractClassLogsHashes[nextLogIndex] = contractClassLogHash;
|
|
152
145
|
|
|
153
|
-
tx.contractClassLogs.push(
|
|
146
|
+
tx.contractClassLogs.push(log);
|
|
154
147
|
}
|
|
155
148
|
|
|
156
149
|
export async function addNewContractInstanceToTx(
|
|
@@ -170,7 +163,7 @@ export async function addNewContractInstanceToTx(
|
|
|
170
163
|
contractInstance.publicKeys.masterTaggingPublicKey.x,
|
|
171
164
|
contractInstance.publicKeys.masterTaggingPublicKey.y,
|
|
172
165
|
];
|
|
173
|
-
const
|
|
166
|
+
const logFields = [
|
|
174
167
|
DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_TAG,
|
|
175
168
|
contractInstance.address.toField(),
|
|
176
169
|
new Fr(contractInstance.version),
|
|
@@ -179,11 +172,11 @@ export async function addNewContractInstanceToTx(
|
|
|
179
172
|
contractInstance.initializationHash,
|
|
180
173
|
...publicKeysAsFields,
|
|
181
174
|
contractInstance.deployer.toField(),
|
|
182
|
-
new Fr(0),
|
|
183
|
-
new Fr(0),
|
|
184
|
-
new Fr(0),
|
|
185
175
|
];
|
|
186
|
-
const contractInstanceLog = new PrivateLog(
|
|
176
|
+
const contractInstanceLog = new PrivateLog(
|
|
177
|
+
padArrayEnd(logFields, Fr.ZERO, PRIVATE_LOG_SIZE_IN_FIELDS),
|
|
178
|
+
logFields.length,
|
|
179
|
+
);
|
|
187
180
|
|
|
188
181
|
const contractAddressNullifier = await siloNullifier(
|
|
189
182
|
AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS),
|
|
@@ -47,7 +47,10 @@ import type { PublicContractsDBInterface } from './db_interfaces.js';
|
|
|
47
47
|
* A public contracts database that forwards requests and collects AVM hints.
|
|
48
48
|
*/
|
|
49
49
|
export class HintingPublicContractsDB implements PublicContractsDBInterface {
|
|
50
|
-
constructor(
|
|
50
|
+
constructor(
|
|
51
|
+
private readonly db: PublicContractsDBInterface,
|
|
52
|
+
private hints: AvmExecutionHints,
|
|
53
|
+
) {}
|
|
51
54
|
|
|
52
55
|
public async getContractInstance(
|
|
53
56
|
address: AztecAddress,
|
|
@@ -129,7 +132,10 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
// Use create() to instantiate.
|
|
132
|
-
private constructor(
|
|
135
|
+
private constructor(
|
|
136
|
+
private db: MerkleTreeWriteOperations,
|
|
137
|
+
private hints: AvmExecutionHints,
|
|
138
|
+
) {}
|
|
133
139
|
|
|
134
140
|
// Getters.
|
|
135
141
|
public async getSiblingPath<N extends number>(treeId: MerkleTreeId, index: bigint): Promise<SiblingPath<N>> {
|
|
@@ -284,8 +290,15 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
284
290
|
|
|
285
291
|
// We need to process each leaf individually because we need the sibling path after insertion, to be able to constraint the insertion.
|
|
286
292
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/13380): This can be changed if the world state appendLeaves returns the sibling paths.
|
|
287
|
-
|
|
288
|
-
await this.appendLeafInternal(treeId,
|
|
293
|
+
if (leaves.length === 1) {
|
|
294
|
+
await this.appendLeafInternal(treeId, leaves[0]);
|
|
295
|
+
return;
|
|
296
|
+
} else {
|
|
297
|
+
// TODO(dbanks12): NON-HINTING! We skip hinting here for now because:
|
|
298
|
+
// 1. We only ever append multiple leaves (for now) when padding (all empty leaves).
|
|
299
|
+
// 2. We don't need hints per-item when padding.
|
|
300
|
+
// 3. In order to get per-item hints today, you need to append one-at-a-time (mentioned above), which is VERY slow.
|
|
301
|
+
await this.db.appendLeaves<ID>(treeId, leaves);
|
|
289
302
|
}
|
|
290
303
|
}
|
|
291
304
|
|
|
@@ -2,7 +2,7 @@ import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT
|
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import {
|
|
5
|
+
import { DateProvider, Timer, elapsed, executeTimeout } from '@aztec/foundation/timer';
|
|
6
6
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
7
7
|
import { ContractClassRegisteredEvent } from '@aztec/protocol-contracts/class-registerer';
|
|
8
8
|
import { computeFeePayerBalanceLeafSlot, computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
@@ -43,7 +43,7 @@ import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
|
43
43
|
export class PublicProcessorFactory {
|
|
44
44
|
constructor(
|
|
45
45
|
private contractDataSource: ContractDataSource,
|
|
46
|
-
private dateProvider: DateProvider,
|
|
46
|
+
private dateProvider: DateProvider = new DateProvider(),
|
|
47
47
|
protected telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
48
48
|
) {}
|
|
49
49
|
|
|
@@ -58,6 +58,7 @@ export class PublicProcessorFactory {
|
|
|
58
58
|
merkleTree: MerkleTreeWriteOperations,
|
|
59
59
|
globalVariables: GlobalVariables,
|
|
60
60
|
skipFeeEnforcement: boolean,
|
|
61
|
+
clientInitiatedSimulation: boolean = false,
|
|
61
62
|
): PublicProcessor {
|
|
62
63
|
const contractsDB = new PublicContractsDB(this.contractDataSource);
|
|
63
64
|
const publicTxSimulator = this.createPublicTxSimulator(
|
|
@@ -66,6 +67,7 @@ export class PublicProcessorFactory {
|
|
|
66
67
|
globalVariables,
|
|
67
68
|
/*doMerkleOperations=*/ true,
|
|
68
69
|
skipFeeEnforcement,
|
|
70
|
+
clientInitiatedSimulation,
|
|
69
71
|
);
|
|
70
72
|
|
|
71
73
|
return new PublicProcessor(
|
|
@@ -84,6 +86,7 @@ export class PublicProcessorFactory {
|
|
|
84
86
|
globalVariables: GlobalVariables,
|
|
85
87
|
doMerkleOperations: boolean,
|
|
86
88
|
skipFeeEnforcement: boolean,
|
|
89
|
+
clientInitiatedSimulation: boolean,
|
|
87
90
|
): PublicTxSimulator {
|
|
88
91
|
return new TelemetryPublicTxSimulator(
|
|
89
92
|
merkleTree,
|
|
@@ -91,6 +94,7 @@ export class PublicProcessorFactory {
|
|
|
91
94
|
globalVariables,
|
|
92
95
|
doMerkleOperations,
|
|
93
96
|
skipFeeEnforcement,
|
|
97
|
+
clientInitiatedSimulation,
|
|
94
98
|
this.telemetryClient,
|
|
95
99
|
);
|
|
96
100
|
}
|
|
@@ -145,10 +149,11 @@ export class PublicProcessor implements Traceable {
|
|
|
145
149
|
preprocessValidator?: TxValidator<Tx>;
|
|
146
150
|
nullifierCache?: { addNullifiers: (nullifiers: Buffer[]) => void };
|
|
147
151
|
} = {},
|
|
148
|
-
): Promise<[ProcessedTx[], FailedTx[], NestedProcessReturnValues[]]> {
|
|
152
|
+
): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[]]> {
|
|
149
153
|
const { maxTransactions, maxBlockSize, deadline, maxBlockGas } = limits;
|
|
150
154
|
const { preprocessValidator, nullifierCache } = validator;
|
|
151
155
|
const result: ProcessedTx[] = [];
|
|
156
|
+
const usedTxs: Tx[] = [];
|
|
152
157
|
const failed: FailedTx[] = [];
|
|
153
158
|
const timer = new Timer();
|
|
154
159
|
|
|
@@ -244,6 +249,7 @@ export class PublicProcessor implements Traceable {
|
|
|
244
249
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
245
250
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map(n => n.toBuffer()));
|
|
246
251
|
result.push(processedTx);
|
|
252
|
+
usedTxs.push(tx);
|
|
247
253
|
returns = returns.concat(returnValues);
|
|
248
254
|
|
|
249
255
|
totalPublicGas = totalPublicGas.add(processedTx.gasUsed.publicGas);
|
|
@@ -281,7 +287,7 @@ export class PublicProcessor implements Traceable {
|
|
|
281
287
|
totalSizeInBytes,
|
|
282
288
|
});
|
|
283
289
|
|
|
284
|
-
return [result, failed, returns];
|
|
290
|
+
return [result, failed, usedTxs, returns];
|
|
285
291
|
}
|
|
286
292
|
|
|
287
293
|
@trackSpan('PublicProcessor.processTx', async tx => ({ [Attributes.TX_HASH]: (await tx.getTxHash()).toString() }))
|
|
@@ -334,7 +340,7 @@ export class PublicProcessor implements Traceable {
|
|
|
334
340
|
padArrayEnd(processedTx.txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map(n => n.toBuffer()),
|
|
335
341
|
NULLIFIER_SUBTREE_HEIGHT,
|
|
336
342
|
);
|
|
337
|
-
} catch
|
|
343
|
+
} catch {
|
|
338
344
|
if (txValidator) {
|
|
339
345
|
// Ideally the validator has already caught this above, but just in case:
|
|
340
346
|
throw new Error(`Transaction ${processedTx.hash} invalid after processing public functions`);
|
|
@@ -34,7 +34,7 @@ export async function ammTest(tester: PublicTxSimulationTester, logger: Logger)
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
const ammConstructorResult = await tester.simulateTxWithLabel(
|
|
37
|
-
/*txLabel=*/ 'constructor',
|
|
37
|
+
/*txLabel=*/ 'AMM/constructor',
|
|
38
38
|
/*sender=*/ admin,
|
|
39
39
|
/*setupCalls=*/ [],
|
|
40
40
|
/*appCalls=*/ [
|
|
@@ -51,7 +51,7 @@ export async function ammTest(tester: PublicTxSimulationTester, logger: Logger)
|
|
|
51
51
|
|
|
52
52
|
// set the AMM as the minter for the liquidity token
|
|
53
53
|
const setMinterResult = await tester.simulateTxWithLabel(
|
|
54
|
-
/*txLabel=*/ 'set_minter',
|
|
54
|
+
/*txLabel=*/ 'AMM/set_minter',
|
|
55
55
|
/*sender=*/ admin,
|
|
56
56
|
/*setupCalls=*/ [],
|
|
57
57
|
/*appCalls=*/ [
|
|
@@ -139,7 +139,7 @@ async function addLiquidity(
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
return await tester.simulateTxWithLabel(
|
|
142
|
-
/*txLabel=*/ 'add_liquidity',
|
|
142
|
+
/*txLabel=*/ 'AMM/add_liquidity',
|
|
143
143
|
/*sender=*/ sender,
|
|
144
144
|
/*setupCalls=*/ [],
|
|
145
145
|
/*appCalls=*/ [
|
|
@@ -218,7 +218,7 @@ async function swapExactTokensForTokens(
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
return await tester.simulateTxWithLabel(
|
|
221
|
-
/*txLabel=*/ 'swap_exact_tokens_for_tokens',
|
|
221
|
+
/*txLabel=*/ 'AMM/swap_exact_tokens_for_tokens',
|
|
222
222
|
/*sender=*/ sender,
|
|
223
223
|
/*setupCalls=*/ [],
|
|
224
224
|
/*appCalls=*/ [
|
|
@@ -267,7 +267,7 @@ async function removeLiquidity(
|
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
return await tester.simulateTxWithLabel(
|
|
270
|
-
/*txLabel=*/ 'remove_liquidity',
|
|
270
|
+
/*txLabel=*/ 'AMM/remove_liquidity',
|
|
271
271
|
/*sender=*/ sender,
|
|
272
272
|
/*setupCalls=*/ [],
|
|
273
273
|
/*appCalls=*/ [
|
|
@@ -17,7 +17,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
17
17
|
|
|
18
18
|
const mintAmount = 100n;
|
|
19
19
|
const mintResult = await tester.simulateTxWithLabel(
|
|
20
|
-
/*txLabel=*/ 'mint_to_public',
|
|
20
|
+
/*txLabel=*/ 'Token/mint_to_public',
|
|
21
21
|
/*sender=*/ admin,
|
|
22
22
|
/*setupCalls=*/ [],
|
|
23
23
|
/*appCalls=*/ [
|
|
@@ -34,7 +34,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
34
34
|
const nonce = new Fr(0);
|
|
35
35
|
const transferAmount = 50n;
|
|
36
36
|
const transferResult = await tester.simulateTxWithLabel(
|
|
37
|
-
/*txLabel=*/ 'transfer_in_public',
|
|
37
|
+
/*txLabel=*/ 'Token/transfer_in_public',
|
|
38
38
|
/*sender=*/ sender,
|
|
39
39
|
/*setupCalls=*/ [],
|
|
40
40
|
/*appCalls=*/ [
|
|
@@ -50,7 +50,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
50
50
|
await checkBalance(tester, token, sender, receiver, transferAmount);
|
|
51
51
|
|
|
52
52
|
const balResult = await tester.simulateTxWithLabel(
|
|
53
|
-
/*txLabel=*/ 'balance_of_public',
|
|
53
|
+
/*txLabel=*/ 'Token/balance_of_public',
|
|
54
54
|
sender,
|
|
55
55
|
/*setupCalls=*/ [],
|
|
56
56
|
/*appCalls=*/ [
|
|
@@ -65,7 +65,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
65
65
|
expect(balResult.revertCode.isOK()).toBe(true);
|
|
66
66
|
|
|
67
67
|
const burnResult = await tester.simulateTxWithLabel(
|
|
68
|
-
/*txLabel=*/ 'burn_public',
|
|
68
|
+
/*txLabel=*/ 'Token/burn_public',
|
|
69
69
|
/*sender=*/ receiver,
|
|
70
70
|
/*setupCalls=*/ [],
|
|
71
71
|
/*appCalls=*/ [
|
|
@@ -95,7 +95,7 @@ export async function deployToken(tester: PublicTxSimulationTester, admin: Aztec
|
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
const result = await tester.simulateTxWithLabel(
|
|
98
|
-
/*txLabel=*/ 'Token
|
|
98
|
+
/*txLabel=*/ 'Token/constructor',
|
|
99
99
|
/*sender=*/ admin,
|
|
100
100
|
/*setupCalls=*/ [],
|
|
101
101
|
/*appCalls=*/ [
|
|
@@ -118,7 +118,7 @@ async function checkBalance(
|
|
|
118
118
|
expectedBalance: bigint,
|
|
119
119
|
) {
|
|
120
120
|
const balResult = await tester.simulateTxWithLabel(
|
|
121
|
-
/*txLabel=*/ 'balance_of_public',
|
|
121
|
+
/*txLabel=*/ 'Token/balance_of_public',
|
|
122
122
|
sender,
|
|
123
123
|
/*setupCalls=*/ [],
|
|
124
124
|
/*appCalls=*/ [
|