@fluffylabs/anan-as 1.2.0-ef04361 → 1.3.0-1ebcf8f

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 (85) hide show
  1. package/dist/bin/index.js +138 -5
  2. package/dist/bin/src/fuzz.js +2 -2
  3. package/dist/bin/src/test-json.js +2 -6
  4. package/dist/bin/src/trace-parse.js +1 -0
  5. package/dist/bin/src/trace-replay.js +14 -9
  6. package/dist/bin/src/tracer.js +16 -13
  7. package/dist/bin/src/utils.js +2 -2
  8. package/dist/build/compiler-inline.js +1 -1
  9. package/dist/build/compiler.d.ts +17 -13
  10. package/dist/build/compiler.js +13 -21
  11. package/dist/build/compiler.wasm +0 -0
  12. package/dist/build/debug-inline.js +1 -1
  13. package/dist/build/debug-raw-inline.js +1 -1
  14. package/dist/build/debug-raw.d.ts +34 -32
  15. package/dist/build/debug-raw.js +62 -69
  16. package/dist/build/debug-raw.wasm +0 -0
  17. package/dist/build/debug.d.ts +34 -32
  18. package/dist/build/debug.js +63 -70
  19. package/dist/build/debug.wasm +0 -0
  20. package/dist/build/js/assembly/api-debugger.d.ts +4 -4
  21. package/dist/build/js/assembly/api-debugger.js +6 -6
  22. package/dist/build/js/assembly/api-internal.d.ts +1 -1
  23. package/dist/build/js/assembly/api-internal.js +2 -3
  24. package/dist/build/js/assembly/api-types.d.ts +4 -4
  25. package/dist/build/js/assembly/api-types.js +3 -4
  26. package/dist/build/js/assembly/api-utils.d.ts +14 -6
  27. package/dist/build/js/assembly/api-utils.js +28 -13
  28. package/dist/build/js/assembly/arguments.d.ts +4 -4
  29. package/dist/build/js/assembly/arguments.js +10 -10
  30. package/dist/build/js/assembly/gas.d.ts +8 -13
  31. package/dist/build/js/assembly/gas.js +17 -7
  32. package/dist/build/js/assembly/instructions/bit.js +22 -22
  33. package/dist/build/js/assembly/instructions/branch.js +56 -56
  34. package/dist/build/js/assembly/instructions/jump.js +10 -10
  35. package/dist/build/js/assembly/instructions/load.js +41 -41
  36. package/dist/build/js/assembly/instructions/logic.js +20 -20
  37. package/dist/build/js/assembly/instructions/math.js +105 -105
  38. package/dist/build/js/assembly/instructions/misc.js +10 -10
  39. package/dist/build/js/assembly/instructions/mov.js +16 -16
  40. package/dist/build/js/assembly/instructions/outcome.d.ts +7 -7
  41. package/dist/build/js/assembly/instructions/outcome.js +63 -38
  42. package/dist/build/js/assembly/instructions/rot.js +18 -18
  43. package/dist/build/js/assembly/instructions/set.js +18 -18
  44. package/dist/build/js/assembly/instructions/shift.js +59 -59
  45. package/dist/build/js/assembly/instructions/store.js +29 -29
  46. package/dist/build/js/assembly/instructions/utils.d.ts +6 -4
  47. package/dist/build/js/assembly/instructions/utils.js +32 -16
  48. package/dist/build/js/assembly/instructions.d.ts +2 -3
  49. package/dist/build/js/assembly/instructions.js +4 -4
  50. package/dist/build/js/assembly/interpreter.d.ts +0 -1
  51. package/dist/build/js/assembly/interpreter.js +30 -38
  52. package/dist/build/js/assembly/math.d.ts +6 -8
  53. package/dist/build/js/assembly/math.js +21 -13
  54. package/dist/build/js/assembly/memory-page.d.ts +2 -4
  55. package/dist/build/js/assembly/memory-page.js +13 -7
  56. package/dist/build/js/assembly/memory.d.ts +1 -0
  57. package/dist/build/js/assembly/memory.js +119 -23
  58. package/dist/build/js/assembly/portable.js +1 -0
  59. package/dist/build/js/assembly/program-build.js +4 -4
  60. package/dist/build/js/assembly/program.d.ts +15 -8
  61. package/dist/build/js/assembly/program.js +95 -39
  62. package/dist/build/js/assembly/spi.d.ts +1 -1
  63. package/dist/build/js/assembly/spi.js +2 -2
  64. package/dist/build/js/portable/bootstrap.js +1 -0
  65. package/dist/build/js/portable-bundle.js +829 -641
  66. package/dist/build/release-inline.js +1 -1
  67. package/dist/build/release-mini-inline.js +1 -1
  68. package/dist/build/release-mini.d.ts +34 -32
  69. package/dist/build/release-mini.js +63 -70
  70. package/dist/build/release-mini.wasm +0 -0
  71. package/dist/build/release-stub-inline.js +1 -1
  72. package/dist/build/release-stub.d.ts +34 -32
  73. package/dist/build/release-stub.js +63 -70
  74. package/dist/build/release-stub.wasm +0 -0
  75. package/dist/build/release.d.ts +34 -32
  76. package/dist/build/release.js +63 -70
  77. package/dist/build/release.wasm +0 -0
  78. package/dist/build/test-inline.js +1 -1
  79. package/dist/build/test.wasm +0 -0
  80. package/dist/test/test-gas-cost.js +2 -3
  81. package/dist/test/test-trace-format.js +166 -0
  82. package/dist/test/test-w3f-common.js +1 -2
  83. package/package.json +14 -10
  84. package/dist/build/js/assembly/gas-costs.d.ts +0 -6
  85. package/dist/build/js/assembly/gas-costs.js +0 -39
@@ -11,7 +11,7 @@ export declare const __rtti_base: number;
11
11
  * @param p `assembly/program/Program`
12
12
  * @returns `~lib/string/String`
13
13
  */
14
- export declare function getAssembly(p: __Internref28): string;
14
+ export declare function getAssembly(p: __Internref35): string;
15
15
  /**
16
16
  * assembly/program-build/wrapAsProgram
17
17
  * @param bytecode `~lib/typedarray/Uint8Array`
@@ -22,29 +22,32 @@ export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
22
22
  * assembly/api-debugger/resetJAM
23
23
  * @param program `~lib/array/Array<u8>`
24
24
  * @param pc `u32`
25
- * @param initialGas `i64`
25
+ * @param initialGas `u64`
26
26
  * @param args `~lib/array/Array<u8>`
27
27
  * @param hasMetadata `bool`
28
+ * @param useBlockGas `bool`
28
29
  */
29
- export declare function resetJAM(program: Array<number>, pc: number, initialGas: bigint, args: Array<number>, hasMetadata?: boolean): void;
30
+ export declare function resetJAM(program: Array<number>, pc: number, initialGas: bigint, args: Array<number>, hasMetadata?: boolean, useBlockGas?: boolean): void;
30
31
  /**
31
32
  * assembly/api-debugger/resetGeneric
32
33
  * @param program `~lib/array/Array<u8>`
33
34
  * @param flatRegisters `~lib/array/Array<u8>`
34
- * @param initialGas `i64`
35
+ * @param initialGas `u64`
35
36
  * @param hasMetadata `bool`
37
+ * @param useBlockGas `bool`
36
38
  */
37
- export declare function resetGeneric(program: Array<number>, flatRegisters: Array<number>, initialGas: bigint, hasMetadata?: boolean): void;
39
+ export declare function resetGeneric(program: Array<number>, flatRegisters: Array<number>, initialGas: bigint, hasMetadata?: boolean, useBlockGas?: boolean): void;
38
40
  /**
39
41
  * assembly/api-debugger/resetGenericWithMemory
40
42
  * @param program `~lib/array/Array<u8>`
41
43
  * @param flatRegisters `~lib/array/Array<u8>`
42
44
  * @param pageMap `~lib/typedarray/Uint8Array`
43
45
  * @param chunks `~lib/typedarray/Uint8Array`
44
- * @param initialGas `i64`
46
+ * @param initialGas `u64`
45
47
  * @param hasMetadata `bool`
48
+ * @param useBlockGas `bool`
46
49
  */
47
- export declare function resetGenericWithMemory(program: Array<number>, flatRegisters: Array<number>, pageMap: Uint8Array, chunks: Uint8Array, initialGas: bigint, hasMetadata?: boolean): void;
50
+ export declare function resetGenericWithMemory(program: Array<number>, flatRegisters: Array<number>, pageMap: Uint8Array, chunks: Uint8Array, initialGas: bigint, hasMetadata?: boolean, useBlockGas?: boolean): void;
48
51
  /**
49
52
  * assembly/api-debugger/nextStep
50
53
  * @returns `bool`
@@ -83,7 +86,7 @@ export declare function getExitArg(): number;
83
86
  export declare function getGasLeft(): bigint;
84
87
  /**
85
88
  * assembly/api-debugger/setGasLeft
86
- * @param gas `i64`
89
+ * @param gas `u64`
87
90
  */
88
91
  export declare function setGasLeft(gas: bigint): void;
89
92
  /**
@@ -137,13 +140,13 @@ export declare enum HasMetadata {
137
140
  No,
138
141
  }
139
142
  /**
140
- * assembly/api-utils/getGasCosts
143
+ * assembly/api-utils/getBlockGasCosts
141
144
  * @param input `~lib/array/Array<u8>`
142
145
  * @param kind `i32`
143
146
  * @param withMetadata `i32`
144
- * @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
147
+ * @returns `~lib/array/Array<assembly/api-utils/BlockGasCost>`
145
148
  */
146
- export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record53<never>>;
149
+ export declare function getBlockGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record58<never>>;
147
150
  /**
148
151
  * assembly/api-utils/disassemble
149
152
  * @param input `~lib/array/Array<u8>`
@@ -162,33 +165,32 @@ export declare function disassemble(input: Array<number>, kind: number, withMeta
162
165
  * @param initialMemory `~lib/array/Array<assembly/api-types/InitialChunk>`
163
166
  * @param args `~lib/array/Array<u8>`
164
167
  * @param preallocateMemoryPages `u32`
168
+ * @param useBlockGas `bool`
165
169
  * @returns `assembly/spi/StandardProgram`
166
170
  */
167
- export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record49<undefined>>, initialMemory: Array<__Record51<undefined>>, args: Array<number>, preallocateMemoryPages: number): __Internref45;
171
+ export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record54<undefined>>, initialMemory: Array<__Record56<undefined>>, args: Array<number>, preallocateMemoryPages: number, useBlockGas: boolean): __Internref51;
168
172
  /**
169
173
  * assembly/api-utils/runProgram
170
174
  * @param program `assembly/spi/StandardProgram`
171
175
  * @param initialGas `i64`
172
176
  * @param programCounter `u32`
173
177
  * @param logs `bool`
174
- * @param useSbrkGas `bool`
175
178
  * @param dumpMemory `bool`
176
179
  * @returns `assembly/api-types/VmOutput`
177
180
  */
178
- export declare function runProgram(program: __Internref45, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean, dumpMemory?: boolean): __Record58<never>;
181
+ export declare function runProgram(program: __Internref51, initialGas?: bigint, programCounter?: number, logs?: boolean, dumpMemory?: boolean): __Record62<never>;
179
182
  /**
180
183
  * assembly/api-utils/pvmStart
181
184
  * @param program `assembly/spi/StandardProgram`
182
- * @param useSbrkGas `bool`
183
185
  * @returns `u32`
184
186
  */
185
- export declare function pvmStart(program: __Internref45, useSbrkGas?: boolean): number;
187
+ export declare function pvmStart(program: __Internref51): number;
186
188
  /**
187
189
  * assembly/api-utils/pvmDestroy
188
190
  * @param pvmId `u32`
189
191
  * @returns `assembly/api-types/VmOutput | null`
190
192
  */
191
- export declare function pvmDestroy(pvmId: number): __Record58<never> | null;
193
+ export declare function pvmDestroy(pvmId: number): __Record62<never> | null;
192
194
  /**
193
195
  * assembly/api-utils/pvmSetRegisters
194
196
  * @param pvmId `u32`
@@ -221,26 +223,26 @@ export declare function pvmWriteMemory(pvmId: number, address: number, data: Uin
221
223
  /**
222
224
  * assembly/api-utils/pvmResume
223
225
  * @param pvmId `u32`
224
- * @param gas `i64`
226
+ * @param gas `u64`
225
227
  * @param pc `u32`
226
228
  * @param logs `bool`
227
229
  * @returns `assembly/api-types/VmPause | null`
228
230
  */
229
- export declare function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record64<never> | null;
231
+ export declare function pvmResume(pvmId: number, gas: bigint, pc: number, logs?: boolean): __Record68<never> | null;
230
232
  /** assembly/program/Program */
231
- declare class __Internref28 extends Number {
232
- private __nominal28: symbol;
233
+ declare class __Internref35 extends Number {
234
+ private __nominal35: symbol;
233
235
  private __nominal0: symbol;
234
236
  }
235
- /** assembly/gas-costs/BlockGasCost */
236
- declare interface __Record53<TOmittable> {
237
+ /** assembly/api-utils/BlockGasCost */
238
+ declare interface __Record58<TOmittable> {
237
239
  /** @type `u32` */
238
240
  pc: number | TOmittable;
239
241
  /** @type `u64` */
240
242
  gas: bigint | TOmittable;
241
243
  }
242
244
  /** assembly/api-types/InitialPage */
243
- declare interface __Record49<TOmittable> {
245
+ declare interface __Record54<TOmittable> {
244
246
  /** @type `u32` */
245
247
  address: number | TOmittable;
246
248
  /** @type `u32` */
@@ -249,36 +251,36 @@ declare interface __Record49<TOmittable> {
249
251
  access: number | TOmittable;
250
252
  }
251
253
  /** assembly/api-types/InitialChunk */
252
- declare interface __Record51<TOmittable> {
254
+ declare interface __Record56<TOmittable> {
253
255
  /** @type `u32` */
254
256
  address: number | TOmittable;
255
257
  /** @type `~lib/array/Array<u8>` */
256
258
  data: Array<number>;
257
259
  }
258
260
  /** assembly/spi/StandardProgram */
259
- declare class __Internref45 extends Number {
260
- private __nominal45: symbol;
261
+ declare class __Internref51 extends Number {
262
+ private __nominal51: symbol;
261
263
  private __nominal0: symbol;
262
264
  }
263
265
  /** assembly/api-types/VmOutput */
264
- declare interface __Record58<TOmittable> {
266
+ declare interface __Record62<TOmittable> {
265
267
  /** @type `i32` */
266
268
  status: number | TOmittable;
267
269
  /** @type `u32` */
268
270
  exitCode: number | TOmittable;
269
271
  /** @type `u32` */
270
272
  pc: number | TOmittable;
271
- /** @type `i64` */
273
+ /** @type `u64` */
272
274
  gas: bigint | TOmittable;
273
275
  /** @type `~lib/array/Array<u8>` */
274
276
  result: Array<number>;
275
277
  /** @type `~lib/array/Array<u64>` */
276
278
  registers: Array<bigint>;
277
279
  /** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
278
- memory: Array<__Record51<never>>;
280
+ memory: Array<__Record56<never>>;
279
281
  }
280
282
  /** assembly/api-types/VmPause */
281
- declare interface __Record64<TOmittable> {
283
+ declare interface __Record68<TOmittable> {
282
284
  /** @type `i32` */
283
285
  status: number | TOmittable;
284
286
  /** @type `u32` */
@@ -287,7 +289,7 @@ declare interface __Record64<TOmittable> {
287
289
  pc: number | TOmittable;
288
290
  /** @type `u32` */
289
291
  nextPc: number | TOmittable;
290
- /** @type `i64` */
292
+ /** @type `u64` */
291
293
  gas: bigint | TOmittable;
292
294
  /** @type `~lib/array/Array<u64>` */
293
295
  registers: Array<bigint>;
@@ -29,46 +29,49 @@ async function instantiate(module, imports = {}) {
29
29
  },
30
30
  wrapAsProgram(bytecode) {
31
31
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
32
- bytecode = __lowerTypedArray(Uint8Array, 12, 0, bytecode) || __notnull();
32
+ bytecode = __lowerTypedArray(Uint8Array, 15, 0, bytecode) || __notnull();
33
33
  return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
34
34
  },
35
- resetJAM(program, pc, initialGas, args, hasMetadata) {
36
- // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, i64, ~lib/array/Array<u8>, bool?) => void
37
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
35
+ resetJAM(program, pc, initialGas, args, hasMetadata, useBlockGas) {
36
+ // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, u64, ~lib/array/Array<u8>, bool?, bool?) => void
37
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
38
38
  initialGas = initialGas || 0n;
39
- args = __lowerArray(__setU8, 7, 0, args) || __notnull();
39
+ args = __lowerArray(__setU8, 32, 0, args) || __notnull();
40
40
  hasMetadata = hasMetadata ? 1 : 0;
41
+ useBlockGas = useBlockGas ? 1 : 0;
41
42
  try {
42
43
  exports.__setArgumentsLength(arguments.length);
43
- exports.resetJAM(program, pc, initialGas, args, hasMetadata);
44
+ exports.resetJAM(program, pc, initialGas, args, hasMetadata, useBlockGas);
44
45
  } finally {
45
46
  __release(program);
46
47
  }
47
48
  },
48
- resetGeneric(program, flatRegisters, initialGas, hasMetadata) {
49
- // assembly/api-debugger/resetGeneric(~lib/array/Array<u8>, ~lib/array/Array<u8>, i64, bool?) => void
50
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
51
- flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
49
+ resetGeneric(program, flatRegisters, initialGas, hasMetadata, useBlockGas) {
50
+ // assembly/api-debugger/resetGeneric(~lib/array/Array<u8>, ~lib/array/Array<u8>, u64, bool?, bool?) => void
51
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
52
+ flatRegisters = __lowerArray(__setU8, 32, 0, flatRegisters) || __notnull();
52
53
  initialGas = initialGas || 0n;
53
54
  hasMetadata = hasMetadata ? 1 : 0;
55
+ useBlockGas = useBlockGas ? 1 : 0;
54
56
  try {
55
57
  exports.__setArgumentsLength(arguments.length);
56
- exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
58
+ exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata, useBlockGas);
57
59
  } finally {
58
60
  __release(program);
59
61
  }
60
62
  },
61
- resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata) {
62
- // assembly/api-debugger/resetGenericWithMemory(~lib/array/Array<u8>, ~lib/array/Array<u8>, ~lib/typedarray/Uint8Array, ~lib/typedarray/Uint8Array, i64, bool?) => void
63
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
64
- flatRegisters = __retain(__lowerArray(__setU8, 7, 0, flatRegisters) || __notnull());
65
- pageMap = __retain(__lowerTypedArray(Uint8Array, 12, 0, pageMap) || __notnull());
66
- chunks = __lowerTypedArray(Uint8Array, 12, 0, chunks) || __notnull();
63
+ resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata, useBlockGas) {
64
+ // assembly/api-debugger/resetGenericWithMemory(~lib/array/Array<u8>, ~lib/array/Array<u8>, ~lib/typedarray/Uint8Array, ~lib/typedarray/Uint8Array, u64, bool?, bool?) => void
65
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
66
+ flatRegisters = __retain(__lowerArray(__setU8, 32, 0, flatRegisters) || __notnull());
67
+ pageMap = __retain(__lowerTypedArray(Uint8Array, 15, 0, pageMap) || __notnull());
68
+ chunks = __lowerTypedArray(Uint8Array, 15, 0, chunks) || __notnull();
67
69
  initialGas = initialGas || 0n;
68
70
  hasMetadata = hasMetadata ? 1 : 0;
71
+ useBlockGas = useBlockGas ? 1 : 0;
69
72
  try {
70
73
  exports.__setArgumentsLength(arguments.length);
71
- exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
74
+ exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata, useBlockGas);
72
75
  } finally {
73
76
  __release(program);
74
77
  __release(flatRegisters);
@@ -92,7 +95,7 @@ async function instantiate(module, imports = {}) {
92
95
  return exports.getExitArg() >>> 0;
93
96
  },
94
97
  setGasLeft(gas) {
95
- // assembly/api-debugger/setGasLeft(i64) => void
98
+ // assembly/api-debugger/setGasLeft(u64) => void
96
99
  gas = gas || 0n;
97
100
  exports.setGasLeft(gas);
98
101
  },
@@ -102,7 +105,7 @@ async function instantiate(module, imports = {}) {
102
105
  },
103
106
  setRegisters(flatRegisters) {
104
107
  // assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
105
- flatRegisters = __lowerArray(__setU8, 7, 0, flatRegisters) || __notnull();
108
+ flatRegisters = __lowerArray(__setU8, 32, 0, flatRegisters) || __notnull();
106
109
  exports.setRegisters(flatRegisters);
107
110
  },
108
111
  getPageDump(index) {
@@ -119,7 +122,7 @@ async function instantiate(module, imports = {}) {
119
122
  },
120
123
  setMemory(address, data) {
121
124
  // assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
122
- data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
125
+ data = __lowerTypedArray(Uint8Array, 15, 0, data) || __notnull();
123
126
  return exports.setMemory(address, data) != 0;
124
127
  },
125
128
  InputKind: (values => (
@@ -134,25 +137,26 @@ async function instantiate(module, imports = {}) {
134
137
  values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
135
138
  values
136
139
  ))({}),
137
- getGasCosts(input, kind, withMetadata) {
138
- // assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
139
- input = __lowerArray(__setU8, 7, 0, input) || __notnull();
140
- return __liftArray(pointer => __liftRecord53(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
140
+ getBlockGasCosts(input, kind, withMetadata) {
141
+ // assembly/api-utils/getBlockGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/api-utils/BlockGasCost>
142
+ input = __lowerArray(__setU8, 32, 0, input) || __notnull();
143
+ return __liftArray(pointer => __liftRecord58(__getU32(pointer)), 2, exports.getBlockGasCosts(input, kind, withMetadata) >>> 0);
141
144
  },
142
145
  disassemble(input, kind, withMetadata) {
143
146
  // assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
144
- input = __lowerArray(__setU8, 7, 0, input) || __notnull();
147
+ input = __lowerArray(__setU8, 32, 0, input) || __notnull();
145
148
  return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
146
149
  },
147
- prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) {
148
- // assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>, ~lib/array/Array<u8>, u32) => assembly/spi/StandardProgram
149
- program = __retain(__lowerArray(__setU8, 7, 0, program) || __notnull());
150
- initialRegisters = __retain(__lowerArray(__setU64, 55, 3, initialRegisters) || __notnull());
151
- initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord49(value) || __notnull()); }, 50, 2, initialPageMap) || __notnull());
152
- initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord51(value) || __notnull()); }, 52, 2, initialMemory) || __notnull());
153
- args = __lowerArray(__setU8, 7, 0, args) || __notnull();
150
+ prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages, useBlockGas) {
151
+ // assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>, ~lib/array/Array<u8>, u32, bool) => assembly/spi/StandardProgram
152
+ program = __retain(__lowerArray(__setU8, 32, 0, program) || __notnull());
153
+ initialRegisters = __retain(__lowerArray(__setU64, 60, 3, initialRegisters) || __notnull());
154
+ initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord54(value) || __notnull()); }, 55, 2, initialPageMap) || __notnull());
155
+ initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord56(value) || __notnull()); }, 57, 2, initialMemory) || __notnull());
156
+ args = __lowerArray(__setU8, 32, 0, args) || __notnull();
157
+ useBlockGas = useBlockGas ? 1 : 0;
154
158
  try {
155
- return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages) >>> 0);
159
+ return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args, preallocateMemoryPages, useBlockGas) >>> 0);
156
160
  } finally {
157
161
  __release(program);
158
162
  __release(initialRegisters);
@@ -160,30 +164,27 @@ async function instantiate(module, imports = {}) {
160
164
  __release(initialMemory);
161
165
  }
162
166
  },
163
- runProgram(program, initialGas, programCounter, logs, useSbrkGas, dumpMemory) {
164
- // assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?, bool?) => assembly/api-types/VmOutput
167
+ runProgram(program, initialGas, programCounter, logs, dumpMemory) {
168
+ // assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?) => assembly/api-types/VmOutput
165
169
  program = __lowerInternref(program) || __notnull();
166
170
  initialGas = initialGas || 0n;
167
171
  logs = logs ? 1 : 0;
168
- useSbrkGas = useSbrkGas ? 1 : 0;
169
172
  dumpMemory = dumpMemory ? 1 : 0;
170
173
  exports.__setArgumentsLength(arguments.length);
171
- return __liftRecord58(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas, dumpMemory) >>> 0);
174
+ return __liftRecord62(exports.runProgram(program, initialGas, programCounter, logs, dumpMemory) >>> 0);
172
175
  },
173
- pvmStart(program, useSbrkGas) {
174
- // assembly/api-utils/pvmStart(assembly/spi/StandardProgram, bool?) => u32
176
+ pvmStart(program) {
177
+ // assembly/api-utils/pvmStart(assembly/spi/StandardProgram) => u32
175
178
  program = __lowerInternref(program) || __notnull();
176
- useSbrkGas = useSbrkGas ? 1 : 0;
177
- exports.__setArgumentsLength(arguments.length);
178
- return exports.pvmStart(program, useSbrkGas) >>> 0;
179
+ return exports.pvmStart(program) >>> 0;
179
180
  },
180
181
  pvmDestroy(pvmId) {
181
182
  // assembly/api-utils/pvmDestroy(u32) => assembly/api-types/VmOutput | null
182
- return __liftRecord58(exports.pvmDestroy(pvmId) >>> 0);
183
+ return __liftRecord62(exports.pvmDestroy(pvmId) >>> 0);
183
184
  },
184
185
  pvmSetRegisters(pvmId, registers) {
185
186
  // assembly/api-utils/pvmSetRegisters(u32, ~lib/array/Array<u64>) => void
186
- registers = __lowerArray(__setU64, 55, 3, registers) || __notnull();
187
+ registers = __lowerArray(__setU64, 60, 3, registers) || __notnull();
187
188
  exports.pvmSetRegisters(pvmId, registers);
188
189
  },
189
190
  pvmReadMemory(pvmId, address, length) {
@@ -196,19 +197,19 @@ async function instantiate(module, imports = {}) {
196
197
  },
197
198
  pvmWriteMemory(pvmId, address, data) {
198
199
  // assembly/api-utils/pvmWriteMemory(u32, u32, ~lib/typedarray/Uint8Array) => bool
199
- data = __lowerTypedArray(Uint8Array, 12, 0, data) || __notnull();
200
+ data = __lowerTypedArray(Uint8Array, 15, 0, data) || __notnull();
200
201
  return exports.pvmWriteMemory(pvmId, address, data) != 0;
201
202
  },
202
203
  pvmResume(pvmId, gas, pc, logs) {
203
- // assembly/api-utils/pvmResume(u32, i64, u32, bool?) => assembly/api-types/VmPause | null
204
+ // assembly/api-utils/pvmResume(u32, u64, u32, bool?) => assembly/api-types/VmPause | null
204
205
  gas = gas || 0n;
205
206
  logs = logs ? 1 : 0;
206
207
  exports.__setArgumentsLength(arguments.length);
207
- return __liftRecord64(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
208
+ return __liftRecord68(exports.pvmResume(pvmId, gas, pc, logs) >>> 0);
208
209
  },
209
210
  }, exports);
210
- function __liftRecord53(pointer) {
211
- // assembly/gas-costs/BlockGasCost
211
+ function __liftRecord58(pointer) {
212
+ // assembly/api-utils/BlockGasCost
212
213
  // Hint: Opt-out from lifting as a record by providing an empty constructor
213
214
  if (!pointer) return null;
214
215
  return {
@@ -216,28 +217,28 @@ async function instantiate(module, imports = {}) {
216
217
  gas: __getU64(pointer + 8),
217
218
  };
218
219
  }
219
- function __lowerRecord49(value) {
220
+ function __lowerRecord54(value) {
220
221
  // assembly/api-types/InitialPage
221
222
  // Hint: Opt-out from lowering as a record by providing an empty constructor
222
223
  if (value == null) return 0;
223
- const pointer = exports.__pin(exports.__new(12, 49));
224
+ const pointer = exports.__pin(exports.__new(12, 54));
224
225
  __setU32(pointer + 0, value.address);
225
226
  __setU32(pointer + 4, value.length);
226
227
  __setU32(pointer + 8, value.access);
227
228
  exports.__unpin(pointer);
228
229
  return pointer;
229
230
  }
230
- function __lowerRecord51(value) {
231
+ function __lowerRecord56(value) {
231
232
  // assembly/api-types/InitialChunk
232
233
  // Hint: Opt-out from lowering as a record by providing an empty constructor
233
234
  if (value == null) return 0;
234
- const pointer = exports.__pin(exports.__new(8, 51));
235
+ const pointer = exports.__pin(exports.__new(8, 56));
235
236
  __setU32(pointer + 0, value.address);
236
- __setU32(pointer + 4, __lowerArray(__setU8, 7, 0, value.data) || __notnull());
237
+ __setU32(pointer + 4, __lowerArray(__setU8, 32, 0, value.data) || __notnull());
237
238
  exports.__unpin(pointer);
238
239
  return pointer;
239
240
  }
240
- function __liftRecord51(pointer) {
241
+ function __liftRecord56(pointer) {
241
242
  // assembly/api-types/InitialChunk
242
243
  // Hint: Opt-out from lifting as a record by providing an empty constructor
243
244
  if (!pointer) return null;
@@ -246,7 +247,7 @@ async function instantiate(module, imports = {}) {
246
247
  data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
247
248
  };
248
249
  }
249
- function __liftRecord58(pointer) {
250
+ function __liftRecord62(pointer) {
250
251
  // assembly/api-types/VmOutput
251
252
  // Hint: Opt-out from lifting as a record by providing an empty constructor
252
253
  if (!pointer) return null;
@@ -254,13 +255,13 @@ async function instantiate(module, imports = {}) {
254
255
  status: __getI32(pointer + 0),
255
256
  exitCode: __getU32(pointer + 4),
256
257
  pc: __getU32(pointer + 8),
257
- gas: __getI64(pointer + 16),
258
+ gas: __getU64(pointer + 16),
258
259
  result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
259
260
  registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 28)),
260
- memory: __liftArray(pointer => __liftRecord51(__getU32(pointer)), 2, __getU32(pointer + 32)),
261
+ memory: __liftArray(pointer => __liftRecord56(__getU32(pointer)), 2, __getU32(pointer + 32)),
261
262
  };
262
263
  }
263
- function __liftRecord64(pointer) {
264
+ function __liftRecord68(pointer) {
264
265
  // assembly/api-types/VmPause
265
266
  // Hint: Opt-out from lifting as a record by providing an empty constructor
266
267
  if (!pointer) return null;
@@ -269,7 +270,7 @@ async function instantiate(module, imports = {}) {
269
270
  exitCode: __getU32(pointer + 4),
270
271
  pc: __getU32(pointer + 8),
271
272
  nextPc: __getU32(pointer + 12),
272
- gas: __getI64(pointer + 16),
273
+ gas: __getU64(pointer + 16),
273
274
  registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 24)),
274
275
  };
275
276
  }
@@ -411,14 +412,6 @@ async function instantiate(module, imports = {}) {
411
412
  return __dataview.getUint32(pointer, true);
412
413
  }
413
414
  }
414
- function __getI64(pointer) {
415
- try {
416
- return __dataview.getBigInt64(pointer, true);
417
- } catch {
418
- __dataview = new DataView(memory.buffer);
419
- return __dataview.getBigInt64(pointer, true);
420
- }
421
- }
422
415
  function __getU64(pointer) {
423
416
  try {
424
417
  return __dataview.getBigUint64(pointer, true);
@@ -457,7 +450,7 @@ export const {
457
450
  setMemory,
458
451
  InputKind,
459
452
  HasMetadata,
460
- getGasCosts,
453
+ getBlockGasCosts,
461
454
  disassemble,
462
455
  prepareProgram,
463
456
  runProgram,
Binary file