@typeberry/jam 0.1.1-e48de40 → 0.1.2-3178190

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,6 +28244,7 @@ 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";
28247
28248
  })(GpVersion || (GpVersion = {}));
28248
28249
  var TestSuite;
28249
28250
  (function (TestSuite) {
@@ -28251,7 +28252,7 @@ var TestSuite;
28251
28252
  TestSuite["JAMDUNA"] = "jamduna";
28252
28253
  })(TestSuite || (TestSuite = {}));
28253
28254
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
28254
- const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
28255
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
28255
28256
  const env = typeof process === "undefined" ? {} : process.env;
28256
28257
  const DEFAULT_VERSION = GpVersion.V0_7_0;
28257
28258
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -28260,20 +28261,26 @@ function parseCurrentVersion(env) {
28260
28261
  if (env === undefined) {
28261
28262
  return undefined;
28262
28263
  }
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}`);
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}`);
28266
28272
  }
28267
- return version;
28268
28273
  }
28269
28274
  function parseCurrentSuite(env) {
28270
28275
  if (env === undefined)
28271
28276
  return undefined;
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)}`);
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)}`);
28275
28283
  }
28276
- return val;
28277
28284
  }
28278
28285
  class Compatibility {
28279
28286
  static override(version) {
@@ -35183,8 +35190,8 @@ function print(level, levelAndName, strings, data) {
35183
35190
  return;
35184
35191
  }
35185
35192
  const lvlText = Level[level].padEnd(5);
35186
- const val = strings.map((v, idx) => `${v}${data[idx]}`);
35187
- const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
35193
+ const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
35194
+ const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
35188
35195
  if (level === Level.WARN) {
35189
35196
  console.warn(msg);
35190
35197
  }
@@ -42020,6 +42027,17 @@ class PageRange {
42020
42027
  }
42021
42028
  return new PageRange(start, length);
42022
42029
  }
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
+ }
42023
42041
  /** Checks if a range is empty (`length === 0`) */
42024
42042
  isEmpty() {
42025
42043
  return this.length === 0;
@@ -42399,10 +42417,11 @@ class MemoryBuilder {
42399
42417
  startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
42400
42418
  `;
42401
42419
  this.ensureNotFinalized();
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)) {
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)) {
42406
42425
  throw new IncorrectSbrkIndex();
42407
42426
  }
42408
42427
  }
@@ -57573,7 +57592,7 @@ async function startNetwork(config) {
57573
57592
  }
57574
57593
 
57575
57594
  ;// CONCATENATED MODULE: ./packages/jam/node/package.json
57576
- const package_namespaceObject = {"rE":"0.1.1"};
57595
+ const package_namespaceObject = {"rE":"0.1.2"};
57577
57596
  ;// CONCATENATED MODULE: ./packages/jam/node/main.ts
57578
57597
 
57579
57598
 
@@ -58872,16 +58891,12 @@ class PartiallyUpdatedState {
58872
58891
  *
58873
58892
  * NOTE the info may be updated compared to what is in the state.
58874
58893
  *
58875
- * Takes into account newly created services as well.
58894
+ * Takes into account ejected and newly created services as well.
58876
58895
  */
58877
58896
  getServiceInfo(destination) {
58878
58897
  if (destination === null) {
58879
58898
  return null;
58880
58899
  }
58881
- const isEjected = this.stateUpdate.services.servicesRemoved.some((x) => x === destination);
58882
- if (isEjected) {
58883
- return null;
58884
- }
58885
58900
  const maybeNewService = this.stateUpdate.services.servicesUpdates.find((update) => update.serviceId === destination);
58886
58901
  if (maybeNewService !== undefined) {
58887
58902
  return maybeNewService.action.account;
@@ -61426,8 +61441,8 @@ var FetchKind;
61426
61441
 
61427
61442
 
61428
61443
  const info_IN_OUT_REG = 7;
61429
- const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 9 : 11;
61430
- const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
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;
61431
61446
  /**
61432
61447
  * Return info about some account.
61433
61448
  *
@@ -61444,7 +61459,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
61444
61459
  * a = last accumulation timeslot
61445
61460
  * p = parent service
61446
61461
  *
61447
- * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
61462
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
61448
61463
  */
61449
61464
  class Info {
61450
61465
  currentServiceId;
@@ -61474,6 +61489,8 @@ class Info {
61474
61489
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
61475
61490
  // l
61476
61491
  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`.
61477
61494
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
61478
61495
  const writeResult = memory.storeFrom(outputStart, chunk);
61479
61496
  if (writeResult.isError) {
@@ -61493,7 +61510,7 @@ class Info {
61493
61510
  *
61494
61511
  * Used exclusively by `info` host call.
61495
61512
  *
61496
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
61513
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
61497
61514
  */
61498
61515
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
61499
61516
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),
@@ -64254,7 +64271,7 @@ function readJsonBlock(file, chainSpec) {
64254
64271
  var minimist = __nccwpck_require__(8595);
64255
64272
  var minimist_default = /*#__PURE__*/__nccwpck_require__.n(minimist);
64256
64273
  ;// CONCATENATED MODULE: ./bin/jam/package.json
64257
- const jam_package_namespaceObject = {"rE":"0.1.1"};
64274
+ const jam_package_namespaceObject = {"rE":"0.1.2"};
64258
64275
  ;// CONCATENATED MODULE: ./bin/jam/args.ts
64259
64276
 
64260
64277