@aztec/simulator 4.0.0-nightly.20260111 → 4.0.0-nightly.20260113

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 (67) hide show
  1. package/dest/public/avm/opcodes/accrued_substate.d.ts +15 -15
  2. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
  3. package/dest/public/avm/opcodes/accrued_substate.js +28 -28
  4. package/dest/public/avm/opcodes/arithmetic.js +1 -1
  5. package/dest/public/avm/opcodes/bitwise.d.ts +3 -3
  6. package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
  7. package/dest/public/avm/opcodes/bitwise.js +5 -5
  8. package/dest/public/avm/opcodes/comparators.js +1 -1
  9. package/dest/public/avm/opcodes/contract.d.ts +3 -3
  10. package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
  11. package/dest/public/avm/opcodes/contract.js +4 -4
  12. package/dest/public/avm/opcodes/control_flow.d.ts +3 -3
  13. package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
  14. package/dest/public/avm/opcodes/control_flow.js +4 -4
  15. package/dest/public/avm/opcodes/conversion.d.ts +3 -3
  16. package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
  17. package/dest/public/avm/opcodes/conversion.js +4 -4
  18. package/dest/public/avm/opcodes/ec_add.d.ts +3 -3
  19. package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
  20. package/dest/public/avm/opcodes/ec_add.js +4 -4
  21. package/dest/public/avm/opcodes/environment_getters.d.ts +3 -3
  22. package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
  23. package/dest/public/avm/opcodes/environment_getters.js +4 -4
  24. package/dest/public/avm/opcodes/external_calls.d.ts +9 -9
  25. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
  26. package/dest/public/avm/opcodes/external_calls.js +16 -16
  27. package/dest/public/avm/opcodes/hashing.d.ts +7 -7
  28. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
  29. package/dest/public/avm/opcodes/hashing.js +12 -12
  30. package/dest/public/avm/opcodes/instruction_impl.d.ts +4 -4
  31. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
  32. package/dest/public/avm/opcodes/instruction_impl.js +4 -4
  33. package/dest/public/avm/opcodes/memory.d.ts +13 -13
  34. package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
  35. package/dest/public/avm/opcodes/memory.js +24 -24
  36. package/dest/public/avm/opcodes/misc.d.ts +3 -3
  37. package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
  38. package/dest/public/avm/opcodes/misc.js +4 -4
  39. package/dest/public/avm/opcodes/storage.d.ts +5 -5
  40. package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
  41. package/dest/public/avm/opcodes/storage.js +9 -9
  42. package/dest/public/fixtures/custom_bytecode_tests.d.ts +1 -1
  43. package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -1
  44. package/dest/public/fixtures/custom_bytecode_tests.js +18 -18
  45. package/dest/public/fixtures/minimal_public_tx.js +2 -2
  46. package/dest/public/fixtures/opcode_spammer.d.ts +1 -1
  47. package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -1
  48. package/dest/public/fixtures/opcode_spammer.js +76 -76
  49. package/package.json +16 -16
  50. package/src/public/avm/opcodes/accrued_substate.ts +14 -14
  51. package/src/public/avm/opcodes/arithmetic.ts +1 -1
  52. package/src/public/avm/opcodes/bitwise.ts +3 -3
  53. package/src/public/avm/opcodes/comparators.ts +1 -1
  54. package/src/public/avm/opcodes/contract.ts +3 -3
  55. package/src/public/avm/opcodes/control_flow.ts +2 -2
  56. package/src/public/avm/opcodes/conversion.ts +3 -3
  57. package/src/public/avm/opcodes/ec_add.ts +2 -2
  58. package/src/public/avm/opcodes/environment_getters.ts +3 -3
  59. package/src/public/avm/opcodes/external_calls.ts +9 -9
  60. package/src/public/avm/opcodes/hashing.ts +6 -6
  61. package/src/public/avm/opcodes/instruction_impl.ts +2 -2
  62. package/src/public/avm/opcodes/memory.ts +18 -18
  63. package/src/public/avm/opcodes/misc.ts +2 -2
  64. package/src/public/avm/opcodes/storage.ts +7 -7
  65. package/src/public/fixtures/custom_bytecode_tests.ts +27 -18
  66. package/src/public/fixtures/minimal_public_tx.ts +2 -2
  67. package/src/public/fixtures/opcode_spammer.ts +164 -77
@@ -23,8 +23,8 @@ export async function addressingWithBaseTagIssueTest(isIndirect: boolean, tester
23
23
  ]);
24
24
 
25
25
  const bytecode = encodeToBytecode([
26
- new CalldataCopy(/*indirect=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 0),
27
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
26
+ new CalldataCopy(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 0),
27
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
28
28
  ]);
29
29
 
30
30
  const txLabel = isIndirect ? 'AddressingWithBaseTagInvalidIndirect' : 'AddressingWithBaseTagInvalidDirect';
@@ -44,11 +44,14 @@ export async function addressingWithIndirectTagIssueTest(tester: PublicTxSimulat
44
44
 
45
45
  const bytecode = encodeToBytecode([
46
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),
47
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT64, /*value=*/ 100n).as(
48
+ Opcode.SET_64,
49
+ Set.wireFormat64,
50
+ ),
48
51
  // Try to use indirect addressing: read from offset 0, which contains a U64 value
49
52
  // 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),
53
+ new CalldataCopy(/*addressing_mode=*/ addressingMode.toWire(), /*copySize=*/ 1, /*cdOffset=*/ 0, /*dstOffset=*/ 1),
54
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
52
55
  ]);
53
56
 
54
57
  const txLabel = 'AddressingWithIndirectTagInvalid';
@@ -69,14 +72,17 @@ export async function addressingWithIndirectThenRelativeTagIssueTest(tester: Pub
69
72
 
70
73
  const bytecode = encodeToBytecode([
71
74
  // 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),
75
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 1, TypeTag.UINT32, /*value=*/ 10).as(
76
+ Opcode.SET_32,
77
+ Set.wireFormat32,
78
+ ),
73
79
  // ADD_16: first operand uses indirect addressing (reads from offset 1, gets value 10, uses as address - succeeds)
74
80
  // 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(
81
+ new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
76
82
  Opcode.ADD_16,
77
83
  Add.wireFormat16,
78
84
  ),
79
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
85
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
80
86
  ]);
81
87
 
82
88
  const txLabel = 'AddressingWithIndirectThenRelativeTagInvalid';
@@ -100,15 +106,15 @@ export async function addressingWithRelativeOverflowAndIndirectTagIssueTest(test
100
106
 
101
107
  const bytecode = encodeToBytecode([
102
108
  // 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(
109
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ UINT32_MAX).as(
104
110
  Opcode.SET_32,
105
111
  Set.wireFormat32,
106
112
  ),
107
- new Add(/*indirect=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
113
+ new Add(/*addressing_mode=*/ addressingMode.toWire(), /*aOffset=*/ 1, /*bOffset=*/ 2, /*dstOffset=*/ 3).as(
108
114
  Opcode.ADD_8,
109
115
  Add.wireFormat8,
110
116
  ),
111
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
117
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
112
118
  ]);
113
119
 
114
120
  const txLabel = 'AddressingWithRelativeOverflowAndIndirectTagInvalid';
@@ -118,7 +124,7 @@ export async function addressingWithRelativeOverflowAndIndirectTagIssueTest(test
118
124
  export async function pcOutOfRangeTest(tester: PublicTxSimulationTester) {
119
125
  const bytecode = encodeToBytecode([
120
126
  new Jump(/*jumpOffset=*/ 123), // Jump to out-of-range pc offset.
121
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
127
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
122
128
  ]);
123
129
 
124
130
  const txLabel = 'PcOutOfRange';
@@ -127,14 +133,14 @@ export async function pcOutOfRangeTest(tester: PublicTxSimulationTester) {
127
133
 
128
134
  export async function invalidOpcodeTest(tester: PublicTxSimulationTester) {
129
135
  let bytecode = encodeToBytecode([
130
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
136
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
131
137
  ]);
132
138
 
133
139
  const offsetReturnOpcodeByte = bytecode.length;
134
140
 
135
141
  bytecode = Buffer.concat([
136
142
  bytecode,
137
- encodeToBytecode([new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)]),
143
+ encodeToBytecode([new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0)]),
138
144
  ]);
139
145
 
140
146
  // Manipulate the Return opcode to make the opcode invalid (out of range).
@@ -157,7 +163,7 @@ export async function invalidByteTest(tester: PublicTxSimulationTester) {
157
163
  // Truncate the last instruction in the bytecode.
158
164
  export async function instructionTruncatedTest(tester: PublicTxSimulationTester) {
159
165
  let bytecode = encodeToBytecode([
160
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
166
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
161
167
  ]);
162
168
 
163
169
  // Truncate the bytecode.
@@ -170,8 +176,8 @@ export async function instructionTruncatedTest(tester: PublicTxSimulationTester)
170
176
  // Invalid tag value byte in an instruction.
171
177
  export async function invalidTagValueTest(tester: PublicTxSimulationTester) {
172
178
  const bytecode = encodeToBytecode([
173
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
174
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
179
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT32, /*value=*/ 0).as(Opcode.SET_8, Set.wireFormat8),
180
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 0),
175
181
  ]);
176
182
 
177
183
  const tagOffset = getTagOffsetInInstruction(Set.wireFormat8);
@@ -186,7 +192,10 @@ export async function invalidTagValueTest(tester: PublicTxSimulationTester) {
186
192
  export async function invalidTagValueAndInstructionTruncatedTest(tester: PublicTxSimulationTester) {
187
193
  let bytecode = encodeToBytecode([
188
194
  // Important: value argument must be a bigint otherwise a type error will be thrown.
189
- new Set(/*indirect=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT128, /*value=*/ 0n).as(Opcode.SET_128, Set.wireFormat128),
195
+ new Set(/*addressing_mode=*/ 0, /*dstOffset=*/ 0, TypeTag.UINT128, /*value=*/ 0n).as(
196
+ Opcode.SET_128,
197
+ Set.wireFormat128,
198
+ ),
190
199
  ]);
191
200
 
192
201
  // Truncate the bytecode.
@@ -12,8 +12,8 @@ export async function executeAvmMinimalPublicTx(tester: PublicTxSimulationTester
12
12
  const minimalBytecode = encodeToBytecode([
13
13
  new Set(/*indirect*/ 0, /*dstOffset*/ 0, TypeTag.UINT32, /*value*/ 1).as(Opcode.SET_8, Set.wireFormat8),
14
14
  new Set(/*indirect*/ 0, /*dstOffset*/ 1, TypeTag.UINT32, /*value*/ 2).as(Opcode.SET_8, Set.wireFormat8),
15
- new Add(/*indirect=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
16
- new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2),
15
+ new Add(/*addressing_mode=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
16
+ new Return(/*addressing_mode=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2),
17
17
  ]);
18
18
 
19
19
  const result = await deployAndExecuteCustomBytecode(minimalBytecode, tester, 'MinimalTx', 'AvmMinimalContract');