@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/importer/index.js CHANGED
@@ -4245,7 +4245,6 @@ var GpVersion;
4245
4245
  GpVersion["V0_6_7"] = "0.6.7";
4246
4246
  GpVersion["V0_7_0"] = "0.7.0";
4247
4247
  GpVersion["V0_7_1"] = "0.7.1-preview";
4248
- GpVersion["V0_7_2"] = "0.7.2-preview";
4249
4248
  })(GpVersion || (GpVersion = {}));
4250
4249
  var TestSuite;
4251
4250
  (function (TestSuite) {
@@ -4253,7 +4252,7 @@ var TestSuite;
4253
4252
  TestSuite["JAMDUNA"] = "jamduna";
4254
4253
  })(TestSuite || (TestSuite = {}));
4255
4254
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
4256
- const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
4255
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
4257
4256
  const env = typeof process === "undefined" ? {} : process.env;
4258
4257
  const DEFAULT_VERSION = GpVersion.V0_7_0;
4259
4258
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -4262,26 +4261,20 @@ function parseCurrentVersion(env) {
4262
4261
  if (env === undefined) {
4263
4262
  return undefined;
4264
4263
  }
4265
- switch (env) {
4266
- case GpVersion.V0_6_7:
4267
- case GpVersion.V0_7_0:
4268
- case GpVersion.V0_7_1:
4269
- case GpVersion.V0_7_2:
4270
- return env;
4271
- default:
4272
- throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
4264
+ const version = env;
4265
+ if (!Object.values(GpVersion).includes(version)) {
4266
+ throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
4273
4267
  }
4268
+ return version;
4274
4269
  }
4275
4270
  function parseCurrentSuite(env) {
4276
4271
  if (env === undefined)
4277
4272
  return undefined;
4278
- switch (env) {
4279
- case TestSuite.W3F_DAVXY:
4280
- case TestSuite.JAMDUNA:
4281
- return env;
4282
- default:
4283
- throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
4273
+ const val = env;
4274
+ if (!Object.values(TestSuite).includes(val)) {
4275
+ throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
4284
4276
  }
4277
+ return val;
4285
4278
  }
4286
4279
  class Compatibility {
4287
4280
  static override(version) {
@@ -13413,8 +13406,8 @@ function print(level, levelAndName, strings, data) {
13413
13406
  return;
13414
13407
  }
13415
13408
  const lvlText = Level[level].padEnd(5);
13416
- const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
13417
- const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
13409
+ const val = strings.map((v, idx) => `${v}${data[idx]}`);
13410
+ const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
13418
13411
  if (level === Level.WARN) {
13419
13412
  console.warn(msg);
13420
13413
  }
@@ -15939,17 +15932,6 @@ class PageRange {
15939
15932
  }
15940
15933
  return new PageRange(start, length);
15941
15934
  }
15942
- /** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
15943
- isWrapped() {
15944
- return this.start >= this.end && !this.isEmpty();
15945
- }
15946
- /** Checks if given page number is within the range */
15947
- isInRange(page) {
15948
- if (this.isWrapped()) {
15949
- return page >= this.start || page < this.end;
15950
- }
15951
- return page >= this.start && page < this.end;
15952
- }
15953
15935
  /** Checks if a range is empty (`length === 0`) */
15954
15936
  isEmpty() {
15955
15937
  return this.length === 0;
@@ -16329,11 +16311,10 @@ class MemoryBuilder {
16329
16311
  startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
16330
16312
  `;
16331
16313
  this.ensureNotFinalized();
16332
- const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
16333
- const heapPagesRange = PageRange.fromMemoryRange(heapRange);
16334
- const initializedPageNumbers = Array.from(this.initialMemory.keys());
16335
- for (const pageNumber of initializedPageNumbers) {
16336
- if (heapPagesRange.isInRange(pageNumber)) {
16314
+ const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
16315
+ const pages = PageRange.fromMemoryRange(range);
16316
+ for (const pageNumber of pages) {
16317
+ if (this.initialMemory.has(pageNumber)) {
16337
16318
  throw new IncorrectSbrkIndex();
16338
16319
  }
16339
16320
  }
@@ -22788,8 +22769,8 @@ var FetchKind;
22788
22769
 
22789
22770
 
22790
22771
  const info_IN_OUT_REG = 7;
22791
- const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 9 : 11;
22792
- const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 10 : 12;
22772
+ const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 9 : 11;
22773
+ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
22793
22774
  /**
22794
22775
  * Return info about some account.
22795
22776
  *
@@ -22806,7 +22787,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGr
22806
22787
  * a = last accumulation timeslot
22807
22788
  * p = parent service
22808
22789
  *
22809
- * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
22790
+ * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
22810
22791
  */
22811
22792
  class Info {
22812
22793
  currentServiceId;
@@ -22836,8 +22817,6 @@ class Info {
22836
22817
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
22837
22818
  // l
22838
22819
  const length = minU64(regs.get(LEN_REG), numbers_tryAsU64(valueLength - offset));
22839
- // NOTE: casting to `Number` is safe in both places, since we are always bounded
22840
- // by the actual `encodedInfo.length`, which is equal `96`.
22841
22820
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
22842
22821
  const writeResult = memory.storeFrom(outputStart, chunk);
22843
22822
  if (writeResult.isError) {
@@ -22857,7 +22836,7 @@ class Info {
22857
22836
  *
22858
22837
  * Used exclusively by `info` host call.
22859
22838
  *
22860
- * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
22839
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
22861
22840
  */
22862
22841
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
22863
22842
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),