@typeberry/jam 0.1.2-3178190 → 0.1.2-753d258

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/index.js CHANGED
@@ -28244,7 +28244,6 @@ var GpVersion;
28244
28244
  GpVersion["V0_6_7"] = "0.6.7";
28245
28245
  GpVersion["V0_7_0"] = "0.7.0";
28246
28246
  GpVersion["V0_7_1"] = "0.7.1-preview";
28247
- GpVersion["V0_7_2"] = "0.7.2-preview";
28248
28247
  })(GpVersion || (GpVersion = {}));
28249
28248
  var TestSuite;
28250
28249
  (function (TestSuite) {
@@ -28252,7 +28251,7 @@ var TestSuite;
28252
28251
  TestSuite["JAMDUNA"] = "jamduna";
28253
28252
  })(TestSuite || (TestSuite = {}));
28254
28253
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
28255
- const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
28254
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
28256
28255
  const env = typeof process === "undefined" ? {} : process.env;
28257
28256
  const DEFAULT_VERSION = GpVersion.V0_7_0;
28258
28257
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -28261,26 +28260,20 @@ function parseCurrentVersion(env) {
28261
28260
  if (env === undefined) {
28262
28261
  return undefined;
28263
28262
  }
28264
- switch (env) {
28265
- case GpVersion.V0_6_7:
28266
- case GpVersion.V0_7_0:
28267
- case GpVersion.V0_7_1:
28268
- case GpVersion.V0_7_2:
28269
- return env;
28270
- default:
28271
- throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
28263
+ const version = env;
28264
+ if (!Object.values(GpVersion).includes(version)) {
28265
+ throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
28272
28266
  }
28267
+ return version;
28273
28268
  }
28274
28269
  function parseCurrentSuite(env) {
28275
28270
  if (env === undefined)
28276
28271
  return undefined;
28277
- switch (env) {
28278
- case TestSuite.W3F_DAVXY:
28279
- case TestSuite.JAMDUNA:
28280
- return env;
28281
- default:
28282
- throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
28272
+ const val = env;
28273
+ if (!Object.values(TestSuite).includes(val)) {
28274
+ throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
28283
28275
  }
28276
+ return val;
28284
28277
  }
28285
28278
  class Compatibility {
28286
28279
  static override(version) {
@@ -35190,8 +35183,8 @@ function print(level, levelAndName, strings, data) {
35190
35183
  return;
35191
35184
  }
35192
35185
  const lvlText = Level[level].padEnd(5);
35193
- const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
35194
- const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
35186
+ const val = strings.map((v, idx) => `${v}${data[idx]}`);
35187
+ const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
35195
35188
  if (level === Level.WARN) {
35196
35189
  console.warn(msg);
35197
35190
  }
@@ -42027,17 +42020,6 @@ class PageRange {
42027
42020
  }
42028
42021
  return new PageRange(start, length);
42029
42022
  }
42030
- /** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
42031
- isWrapped() {
42032
- return this.start >= this.end && !this.isEmpty();
42033
- }
42034
- /** Checks if given page number is within the range */
42035
- isInRange(page) {
42036
- if (this.isWrapped()) {
42037
- return page >= this.start || page < this.end;
42038
- }
42039
- return page >= this.start && page < this.end;
42040
- }
42041
42023
  /** Checks if a range is empty (`length === 0`) */
42042
42024
  isEmpty() {
42043
42025
  return this.length === 0;
@@ -42417,11 +42399,10 @@ class MemoryBuilder {
42417
42399
  startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
42418
42400
  `;
42419
42401
  this.ensureNotFinalized();
42420
- const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
42421
- const heapPagesRange = PageRange.fromMemoryRange(heapRange);
42422
- const initializedPageNumbers = Array.from(this.initialMemory.keys());
42423
- for (const pageNumber of initializedPageNumbers) {
42424
- if (heapPagesRange.isInRange(pageNumber)) {
42402
+ const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
42403
+ const pages = PageRange.fromMemoryRange(range);
42404
+ for (const pageNumber of pages) {
42405
+ if (this.initialMemory.has(pageNumber)) {
42425
42406
  throw new IncorrectSbrkIndex();
42426
42407
  }
42427
42408
  }
@@ -61441,8 +61422,8 @@ var FetchKind;
61441
61422
 
61442
61423
 
61443
61424
  const info_IN_OUT_REG = 7;
61444
- const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 9 : 11;
61445
- const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 10 : 12;
61425
+ const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 9 : 11;
61426
+ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
61446
61427
  /**
61447
61428
  * Return info about some account.
61448
61429
  *
@@ -61459,7 +61440,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGr
61459
61440
  * a = last accumulation timeslot
61460
61441
  * p = parent service
61461
61442
  *
61462
- * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
61443
+ * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
61463
61444
  */
61464
61445
  class Info {
61465
61446
  currentServiceId;
@@ -61489,8 +61470,6 @@ class Info {
61489
61470
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
61490
61471
  // l
61491
61472
  const length = minU64(regs.get(LEN_REG), numbers_tryAsU64(valueLength - offset));
61492
- // NOTE: casting to `Number` is safe in both places, since we are always bounded
61493
- // by the actual `encodedInfo.length`, which is equal `96`.
61494
61473
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
61495
61474
  const writeResult = memory.storeFrom(outputStart, chunk);
61496
61475
  if (writeResult.isError) {
@@ -61510,7 +61489,7 @@ class Info {
61510
61489
  *
61511
61490
  * Used exclusively by `info` host call.
61512
61491
  *
61513
- * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
61492
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
61514
61493
  */
61515
61494
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
61516
61495
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),