@aztec/simulator 0.0.1-commit.d3ec352c → 0.0.1-commit.fcb71a6

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.
Files changed (213) hide show
  1. package/dest/common/errors.d.ts +2 -2
  2. package/dest/common/errors.d.ts.map +1 -1
  3. package/dest/private/acvm/deserialize.d.ts +2 -2
  4. package/dest/private/acvm/deserialize.d.ts.map +1 -1
  5. package/dest/private/acvm/deserialize.js +1 -1
  6. package/dest/private/acvm/serialize.d.ts +2 -2
  7. package/dest/private/acvm/serialize.d.ts.map +1 -1
  8. package/dest/private/acvm/serialize.js +1 -1
  9. package/dest/private/circuit_recording/circuit_recorder.d.ts +1 -1
  10. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  11. package/dest/private/circuit_recording/circuit_recorder.js +16 -15
  12. package/dest/public/avm/avm_context.d.ts +2 -2
  13. package/dest/public/avm/avm_context.d.ts.map +1 -1
  14. package/dest/public/avm/avm_contract_call_result.d.ts +2 -2
  15. package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
  16. package/dest/public/avm/avm_execution_environment.d.ts +2 -2
  17. package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
  18. package/dest/public/avm/avm_execution_environment.js +1 -1
  19. package/dest/public/avm/avm_gas.d.ts +1 -1
  20. package/dest/public/avm/avm_gas.d.ts.map +1 -1
  21. package/dest/public/avm/avm_machine_state.d.ts +2 -2
  22. package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
  23. package/dest/public/avm/avm_memory_types.d.ts +2 -2
  24. package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
  25. package/dest/public/avm/avm_memory_types.js +1 -1
  26. package/dest/public/avm/avm_simulator.d.ts +2 -2
  27. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  28. package/dest/public/avm/avm_simulator.js +1 -1
  29. package/dest/public/avm/errors.d.ts +2 -2
  30. package/dest/public/avm/errors.d.ts.map +1 -1
  31. package/dest/public/avm/fixtures/avm_simulation_tester.js +1 -1
  32. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +2 -2
  33. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
  34. package/dest/public/avm/fixtures/base_avm_simulation_tester.js +1 -1
  35. package/dest/public/avm/fixtures/initializers.d.ts +2 -2
  36. package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
  37. package/dest/public/avm/fixtures/initializers.js +1 -1
  38. package/dest/public/avm/fixtures/utils.d.ts +2 -2
  39. package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
  40. package/dest/public/avm/fixtures/utils.js +1 -1
  41. package/dest/public/avm/opcodes/arithmetic.d.ts +3 -1
  42. package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
  43. package/dest/public/avm/opcodes/arithmetic.js +11 -1
  44. package/dest/public/avm/opcodes/ec_add.js +2 -2
  45. package/dest/public/avm/opcodes/hashing.d.ts +1 -1
  46. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
  47. package/dest/public/avm/opcodes/hashing.js +9 -4
  48. package/dest/public/avm/opcodes/memory.js +1 -1
  49. package/dest/public/avm/revert_reason.d.ts +2 -2
  50. package/dest/public/avm/revert_reason.d.ts.map +1 -1
  51. package/dest/public/avm/serialization/instruction_serialization.js +1 -1
  52. package/dest/public/avm/test_utils.d.ts +2 -2
  53. package/dest/public/avm/test_utils.d.ts.map +1 -1
  54. package/dest/public/avm/test_utils.js +1 -1
  55. package/dest/public/contracts_db_checkpoint.d.ts +2 -2
  56. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -1
  57. package/dest/public/db_interfaces.d.ts +2 -2
  58. package/dest/public/db_interfaces.d.ts.map +1 -1
  59. package/dest/public/debug_fn_name.d.ts +2 -2
  60. package/dest/public/debug_fn_name.d.ts.map +1 -1
  61. package/dest/public/debug_fn_name.js +10 -3
  62. package/dest/public/fixtures/amm_test.js +2 -2
  63. package/dest/public/fixtures/bulk_test.js +4 -52
  64. package/dest/public/fixtures/custom_bytecode_tester.d.ts +28 -6
  65. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
  66. package/dest/public/fixtures/custom_bytecode_tester.js +36 -12
  67. package/dest/public/fixtures/custom_bytecode_tests.d.ts +4 -1
  68. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -1
  69. package/dest/public/fixtures/custom_bytecode_tests.js +74 -9
  70. package/dest/public/fixtures/index.d.ts +4 -2
  71. package/dest/public/fixtures/index.d.ts.map +1 -1
  72. package/dest/public/fixtures/index.js +3 -1
  73. package/dest/public/fixtures/minimal_public_tx.d.ts +2 -7
  74. package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
  75. package/dest/public/fixtures/minimal_public_tx.js +2 -12
  76. package/dest/public/fixtures/opcode_spammer.d.ts +123 -0
  77. package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -0
  78. package/dest/public/fixtures/opcode_spammer.js +1681 -0
  79. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +15 -2
  80. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  81. package/dest/public/fixtures/public_tx_simulation_tester.js +36 -8
  82. package/dest/public/fixtures/simple_contract_data_source.d.ts +2 -2
  83. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  84. package/dest/public/fixtures/token_test.js +1 -1
  85. package/dest/public/fixtures/utils.d.ts +2 -2
  86. package/dest/public/fixtures/utils.d.ts.map +1 -1
  87. package/dest/public/fixtures/utils.js +4 -3
  88. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +46 -0
  89. package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
  90. package/dest/public/fuzzing/avm_fuzzer_simulator.js +139 -0
  91. package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
  92. package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
  93. package/dest/public/fuzzing/avm_simulator_bin.js +100 -0
  94. package/dest/public/hinting_db_sources.d.ts +3 -2
  95. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  96. package/dest/public/hinting_db_sources.js +5 -2
  97. package/dest/public/index.d.ts +2 -2
  98. package/dest/public/index.d.ts.map +1 -1
  99. package/dest/public/index.js +1 -1
  100. package/dest/public/public_db_sources.d.ts +2 -2
  101. package/dest/public/public_db_sources.d.ts.map +1 -1
  102. package/dest/public/public_db_sources.js +1 -1
  103. package/dest/public/public_processor/guarded_merkle_tree.d.ts +2 -1
  104. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  105. package/dest/public/public_processor/guarded_merkle_tree.js +3 -0
  106. package/dest/public/public_processor/public_processor.d.ts +2 -2
  107. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  108. package/dest/public/public_processor/public_processor.js +23 -11
  109. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +1 -13
  110. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -1
  111. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +18 -53
  112. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +16 -1
  113. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
  114. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +41 -3
  115. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +1 -1
  116. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -1
  117. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +7 -6
  118. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +22 -0
  119. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
  120. package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
  121. package/dest/public/public_tx_simulator/factories.d.ts +13 -0
  122. package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
  123. package/dest/public/public_tx_simulator/factories.js +28 -0
  124. package/dest/public/public_tx_simulator/index.d.ts +3 -1
  125. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  126. package/dest/public/public_tx_simulator/index.js +2 -0
  127. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +2 -2
  128. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
  129. package/dest/public/public_tx_simulator/public_tx_context.d.ts +2 -2
  130. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  131. package/dest/public/public_tx_simulator/public_tx_context.js +1 -1
  132. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -2
  133. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  134. package/dest/public/public_tx_simulator/public_tx_simulator.js +5 -3
  135. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +24 -1
  136. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -1
  137. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +2 -2
  138. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
  139. package/dest/public/side_effect_trace.d.ts +2 -2
  140. package/dest/public/side_effect_trace.d.ts.map +1 -1
  141. package/dest/public/side_effect_trace.js +1 -1
  142. package/dest/public/side_effect_trace_interface.d.ts +2 -2
  143. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  144. package/dest/public/state_manager/nullifiers.d.ts +2 -2
  145. package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
  146. package/dest/public/state_manager/public_storage.d.ts +2 -2
  147. package/dest/public/state_manager/public_storage.d.ts.map +1 -1
  148. package/dest/public/state_manager/public_storage.js +1 -1
  149. package/dest/public/state_manager/state_manager.d.ts +2 -2
  150. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  151. package/dest/public/state_manager/state_manager.js +1 -1
  152. package/package.json +17 -17
  153. package/src/common/errors.ts +1 -1
  154. package/src/private/acvm/deserialize.ts +1 -1
  155. package/src/private/acvm/serialize.ts +1 -1
  156. package/src/private/circuit_recording/circuit_recorder.ts +17 -16
  157. package/src/public/avm/avm_context.ts +1 -1
  158. package/src/public/avm/avm_contract_call_result.ts +1 -1
  159. package/src/public/avm/avm_execution_environment.ts +1 -1
  160. package/src/public/avm/avm_gas.ts +3 -3
  161. package/src/public/avm/avm_machine_state.ts +1 -1
  162. package/src/public/avm/avm_memory_types.ts +1 -1
  163. package/src/public/avm/avm_simulator.ts +1 -1
  164. package/src/public/avm/errors.ts +1 -1
  165. package/src/public/avm/fixtures/avm_simulation_tester.ts +1 -1
  166. package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -1
  167. package/src/public/avm/fixtures/initializers.ts +1 -1
  168. package/src/public/avm/fixtures/utils.ts +1 -1
  169. package/src/public/avm/opcodes/arithmetic.ts +13 -1
  170. package/src/public/avm/opcodes/ec_add.ts +2 -2
  171. package/src/public/avm/opcodes/hashing.ts +10 -4
  172. package/src/public/avm/opcodes/memory.ts +1 -1
  173. package/src/public/avm/revert_reason.ts +1 -1
  174. package/src/public/avm/serialization/instruction_serialization.ts +1 -1
  175. package/src/public/avm/test_utils.ts +1 -1
  176. package/src/public/contracts_db_checkpoint.ts +1 -1
  177. package/src/public/db_interfaces.ts +1 -1
  178. package/src/public/debug_fn_name.ts +11 -4
  179. package/src/public/fixtures/amm_test.ts +2 -2
  180. package/src/public/fixtures/bulk_test.ts +7 -7
  181. package/src/public/fixtures/custom_bytecode_tester.ts +53 -19
  182. package/src/public/fixtures/custom_bytecode_tests.ts +93 -9
  183. package/src/public/fixtures/index.ts +7 -1
  184. package/src/public/fixtures/minimal_public_tx.ts +4 -13
  185. package/src/public/fixtures/opcode_spammer.ts +1638 -0
  186. package/src/public/fixtures/public_tx_simulation_tester.ts +40 -6
  187. package/src/public/fixtures/simple_contract_data_source.ts +1 -1
  188. package/src/public/fixtures/token_test.ts +1 -1
  189. package/src/public/fixtures/utils.ts +2 -3
  190. package/src/public/fuzzing/avm_fuzzer_simulator.ts +240 -0
  191. package/src/public/fuzzing/avm_simulator_bin.ts +140 -0
  192. package/src/public/hinting_db_sources.ts +6 -2
  193. package/src/public/index.ts +2 -0
  194. package/src/public/public_db_sources.ts +1 -1
  195. package/src/public/public_processor/guarded_merkle_tree.ts +4 -0
  196. package/src/public/public_processor/public_processor.ts +28 -12
  197. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +19 -60
  198. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +48 -3
  199. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +1 -1
  200. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +7 -10
  201. package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
  202. package/src/public/public_tx_simulator/factories.ts +41 -0
  203. package/src/public/public_tx_simulator/index.ts +2 -0
  204. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +1 -1
  205. package/src/public/public_tx_simulator/public_tx_context.ts +1 -1
  206. package/src/public/public_tx_simulator/public_tx_simulator.ts +14 -3
  207. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +23 -0
  208. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +1 -1
  209. package/src/public/side_effect_trace.ts +1 -1
  210. package/src/public/side_effect_trace_interface.ts +1 -1
  211. package/src/public/state_manager/nullifiers.ts +1 -1
  212. package/src/public/state_manager/public_storage.ts +1 -1
  213. package/src/public/state_manager/state_manager.ts +2 -2
@@ -2,7 +2,7 @@ import { strict as assert } from 'assert';
2
2
 
3
3
  import { TypeTag } from '../avm/avm_memory_types.js';
4
4
  import { Addressing, AddressingMode } from '../avm/opcodes/addressing_mode.js';
5
- import { CalldataCopy, Jump, Return, Set } from '../avm/opcodes/index.js';
5
+ import { Add, CalldataCopy, Jump, Return, Set } from '../avm/opcodes/index.js';
6
6
  import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
7
7
  import {
8
8
  MAX_OPCODE_VALUE,
@@ -10,7 +10,7 @@ import {
10
10
  OperandType,
11
11
  getOperandSize,
12
12
  } from '../avm/serialization/instruction_serialization.js';
13
- import { testCustomBytecode } from './custom_bytecode_tester.js';
13
+ import { deployAndExecuteCustomBytecode } from './custom_bytecode_tester.js';
14
14
  import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
15
15
 
16
16
  // First instruction resolved a base address (offset 0) which is uninitialized and therefore
@@ -28,7 +28,91 @@ export async function addressingWithBaseTagIssueTest(isIndirect: boolean, tester
28
28
  ]);
29
29
 
30
30
  const txLabel = isIndirect ? 'AddressingWithBaseTagInvalidIndirect' : 'AddressingWithBaseTagInvalidDirect';
31
- return await testCustomBytecode(bytecode, tester, txLabel);
31
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
32
+ }
33
+
34
+ // First instruction sets a value with tag U64 at offset 0. Then a CalldataCopy instruction
35
+ // uses INDIRECT addressing to read from offset 0, which should fail because the value at
36
+ // offset 0 has tag U64 (not U32), making it an invalid address tag.
37
+ export async function addressingWithIndirectTagIssueTest(tester: PublicTxSimulationTester) {
38
+ // Set a U64 value at offset 0 - this will be used as an indirect address
39
+ const addressingMode = Addressing.fromModes([
40
+ AddressingMode.INDIRECT, // First operand (cdOffset) uses indirect addressing
41
+ AddressingMode.DIRECT,
42
+ AddressingMode.DIRECT,
43
+ ]);
44
+
45
+ const bytecode = encodeToBytecode([
46
+ // Set a U64 value at offset 0 - this has the wrong tag for an address (should be U32)
47
+ new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT64, /*value=*/ 100n).as(Opcode.SET_64, Set.wireFormat64),
48
+ // Try to use indirect addressing: read from offset 0, which contains a U64 value
49
+ // This should fail because U64 is not a valid address tag (must be U32)
50
+ new CalldataCopy(/*indirect=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 1),
51
+ new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
52
+ ]);
53
+
54
+ const txLabel = 'AddressingWithIndirectTagInvalid';
55
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
56
+ }
57
+
58
+ // First instruction sets a value 10 with tag U32 at offset 1 (direct, no relative).
59
+ // Then an ADD_16 instruction uses INDIRECT addressing for the first operand (offset 1)
60
+ // and RELATIVE addressing for the second operand (offset 2). The indirect addressing
61
+ // succeeds (reads U32 value 10 from offset 1, uses it as address), but the relative
62
+ // addressing fails because the base address at offset 0 has the wrong tag (uninitialized/invalid).
63
+ export async function addressingWithIndirectThenRelativeTagIssueTest(tester: PublicTxSimulationTester) {
64
+ const addressingMode = Addressing.fromModes([
65
+ AddressingMode.INDIRECT, // First operand (aOffset) uses indirect addressing, no relative
66
+ AddressingMode.RELATIVE, // Second operand (bOffset) uses relative addressing
67
+ AddressingMode.DIRECT, // Third operand (dstOffset) uses direct addressing
68
+ ]);
69
+
70
+ const bytecode = encodeToBytecode([
71
+ // Set a U32 value 10 at offset 1 - this will be used as an indirect address
72
+ new Set(/*indirect=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT32, /*value=*/ 10).as(Opcode.SET_32, Set.wireFormat32),
73
+ // ADD_16: first operand uses indirect addressing (reads from offset 1, gets value 10, uses as address - succeeds)
74
+ // second operand uses relative addressing (tries to read base from offset 0, but offset 0 has wrong tag - fails)
75
+ new Add(/*indirect=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
76
+ Opcode.ADD_16,
77
+ Add.wireFormat16,
78
+ ),
79
+ new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
80
+ ]);
81
+
82
+ const txLabel = 'AddressingWithIndirectThenRelativeTagInvalid';
83
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
84
+ }
85
+
86
+ // First instruction sets UINT32_MAX at offset 0 (base address) with tag U32.
87
+ // Then an ADD_8 instruction uses INDIRECT_RELATIVE addressing for the first operand (offset 1)
88
+ // and INDIRECT addressing for the second operand (offset 2). The relative addressing
89
+ // for the first operand will overflow (UINT32_MAX + 1 >= MAX_MEMORY_SIZE), causing the instruction to fail.
90
+ // The second operand will also fail (indirect addressing from offset 2 which is uninitialized with tag FF).
91
+ export async function addressingWithRelativeOverflowAndIndirectTagIssueTest(tester: PublicTxSimulationTester) {
92
+ const addressingMode = Addressing.fromModes([
93
+ AddressingMode.INDIRECT_RELATIVE, // First operand (aOffset) uses both indirect and relative addressing
94
+ AddressingMode.INDIRECT, // Second operand (bOffset) uses indirect addressing only
95
+ AddressingMode.DIRECT, // Third operand (dstOffset) uses direct addressing
96
+ ]);
97
+
98
+ // UINT32_MAX = 2^32 - 1 = 4294967295
99
+ const UINT32_MAX = 0xffffffff;
100
+
101
+ const bytecode = encodeToBytecode([
102
+ // Set UINT32_MAX at offset 0 as base address - this will cause overflow when adding relative offset 1
103
+ new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ UINT32_MAX).as(
104
+ Opcode.SET_32,
105
+ Set.wireFormat32,
106
+ ),
107
+ new Add(/*indirect=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
108
+ Opcode.ADD_8,
109
+ Add.wireFormat8,
110
+ ),
111
+ new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
112
+ ]);
113
+
114
+ const txLabel = 'AddressingWithRelativeOverflowAndIndirectTagInvalid';
115
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
32
116
  }
33
117
 
34
118
  export async function pcOutOfRangeTest(tester: PublicTxSimulationTester) {
@@ -38,7 +122,7 @@ export async function pcOutOfRangeTest(tester: PublicTxSimulationTester) {
38
122
  ]);
39
123
 
40
124
  const txLabel = 'PcOutOfRange';
41
- return await testCustomBytecode(bytecode, tester, txLabel);
125
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
42
126
  }
43
127
 
44
128
  export async function invalidOpcodeTest(tester: PublicTxSimulationTester) {
@@ -57,7 +141,7 @@ export async function invalidOpcodeTest(tester: PublicTxSimulationTester) {
57
141
  bytecode[offsetReturnOpcodeByte] = MAX_OPCODE_VALUE + 1; // opcode is invalid.
58
142
 
59
143
  const txLabel = 'InvalidOpcode';
60
- return await testCustomBytecode(bytecode, tester, txLabel);
144
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
61
145
  }
62
146
 
63
147
  // Single invalid byte in the bytecode.
@@ -67,7 +151,7 @@ export async function invalidByteTest(tester: PublicTxSimulationTester) {
67
151
  const bytecode = Buffer.from([invalidOpcode]);
68
152
 
69
153
  const txLabel = 'InvalidByte';
70
- return await testCustomBytecode(bytecode, tester, txLabel);
154
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
71
155
  }
72
156
 
73
157
  // Truncate the last instruction in the bytecode.
@@ -80,7 +164,7 @@ export async function instructionTruncatedTest(tester: PublicTxSimulationTester)
80
164
  bytecode = bytecode.subarray(0, -1);
81
165
 
82
166
  const txLabel = 'InstructionTruncated';
83
- return await testCustomBytecode(bytecode, tester, txLabel);
167
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
84
168
  }
85
169
 
86
170
  // Invalid tag value byte in an instruction.
@@ -95,7 +179,7 @@ export async function invalidTagValueTest(tester: PublicTxSimulationTester) {
95
179
  bytecode[tagOffset] = TypeTag.INVALID;
96
180
 
97
181
  const txLabel = 'InvalidTagValue';
98
- return await testCustomBytecode(bytecode, tester, txLabel);
182
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
99
183
  }
100
184
 
101
185
  // Combine an invalid tag in the last instruction that is truncated.
@@ -112,7 +196,7 @@ export async function invalidTagValueAndInstructionTruncatedTest(tester: PublicT
112
196
  bytecode[tagOffset] = 0x6f; // Invalid tag value.
113
197
 
114
198
  const txLabel = 'InvalidTagValueAndInstructionTruncated';
115
- return await testCustomBytecode(bytecode, tester, txLabel);
199
+ return await deployAndExecuteCustomBytecode(bytecode, tester, txLabel);
116
200
  }
117
201
 
118
202
  /**
@@ -1,9 +1,15 @@
1
1
  export * from './public_tx_simulation_tester.js';
2
2
  export * from './utils.js';
3
3
  export * from './simple_contract_data_source.js';
4
- export { readAvmMinimalPublicTxInputsFromFile, executeAvmMinimalPublicTx } from './minimal_public_tx.js';
4
+ export { executeAvmMinimalPublicTx } from './minimal_public_tx.js';
5
5
  export { TestExecutorMetrics } from '../test_executor_metrics.js';
6
6
  export { ammTest } from './amm_test.js';
7
7
  export { bulkTest, megaBulkTest } from './bulk_test.js';
8
8
  export { tokenTest } from './token_test.js';
9
9
  export * from './custom_bytecode_tests.js';
10
+ export {
11
+ deployCustomBytecode,
12
+ executeCustomBytecode,
13
+ deployAndExecuteCustomBytecode,
14
+ } from './custom_bytecode_tester.js';
15
+ export { getSpamConfigsPerOpcode, testOpcodeSpamCase } from './opcode_spammer.js';
@@ -1,12 +1,11 @@
1
- import { AvmCircuitInputs, type PublicTxResult } from '@aztec/stdlib/avm';
1
+ import type { PublicTxResult } from '@aztec/stdlib/avm';
2
2
  import { ProtocolContracts } from '@aztec/stdlib/tx';
3
3
 
4
- import avmMinimalCircuitInputsJson from '../../../artifacts/avm_minimal_inputs.json' with { type: 'json' };
5
4
  import { TypeTag } from '../avm/avm_memory_types.js';
6
5
  import { Add, Return, Set } from '../avm/opcodes/index.js';
7
6
  import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
8
7
  import { Opcode } from '../avm/serialization/instruction_serialization.js';
9
- import { testCustomBytecode } from './custom_bytecode_tester.js';
8
+ import { deployAndExecuteCustomBytecode } from './custom_bytecode_tester.js';
10
9
  import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
11
10
 
12
11
  export async function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester): Promise<PublicTxResult> {
@@ -17,19 +16,11 @@ export async function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester
17
16
  new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2),
18
17
  ]);
19
18
 
20
- const result = await testCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');
19
+ const result = await deployAndExecuteCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');
21
20
 
22
21
  // Modify the protocol contracts to be all zeros
23
22
  result.hints!.protocolContracts = ProtocolContracts.empty();
24
- result.publicInputs.protocolContracts = ProtocolContracts.empty();
23
+ result.publicInputs!.protocolContracts = ProtocolContracts.empty();
25
24
 
26
25
  return result;
27
26
  }
28
-
29
- /**
30
- * Reads the AVM circuit inputs for the minimal public tx from a pre-generated JSON file.
31
- * @returns The AvmCircuitInputs for the minimal public tx.
32
- */
33
- export function readAvmMinimalPublicTxInputsFromFile(): AvmCircuitInputs {
34
- return AvmCircuitInputs.schema.parse(avmMinimalCircuitInputsJson);
35
- }