@typeberry/jam 0.1.2-80d53fd → 0.1.2-953c012

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
  }
@@ -58872,16 +58879,12 @@ class PartiallyUpdatedState {
58872
58879
  *
58873
58880
  * NOTE the info may be updated compared to what is in the state.
58874
58881
  *
58875
- * Takes into account newly created services as well.
58882
+ * Takes into account ejected and newly created services as well.
58876
58883
  */
58877
58884
  getServiceInfo(destination) {
58878
58885
  if (destination === null) {
58879
58886
  return null;
58880
58887
  }
58881
- const isEjected = this.stateUpdate.services.servicesRemoved.some((x) => x === destination);
58882
- if (isEjected) {
58883
- return null;
58884
- }
58885
58888
  const maybeNewService = this.stateUpdate.services.servicesUpdates.find((update) => update.serviceId === destination);
58886
58889
  if (maybeNewService !== undefined) {
58887
58890
  return maybeNewService.action.account;
@@ -61426,8 +61429,8 @@ var FetchKind;
61426
61429
 
61427
61430
 
61428
61431
  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;
61432
+ const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 9 : 11;
61433
+ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 10 : 12;
61431
61434
  /**
61432
61435
  * Return info about some account.
61433
61436
  *
@@ -61444,7 +61447,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
61444
61447
  * a = last accumulation timeslot
61445
61448
  * p = parent service
61446
61449
  *
61447
- * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
61450
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
61448
61451
  */
61449
61452
  class Info {
61450
61453
  currentServiceId;
@@ -61474,6 +61477,8 @@ class Info {
61474
61477
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
61475
61478
  // l
61476
61479
  const length = minU64(regs.get(LEN_REG), numbers_tryAsU64(valueLength - offset));
61480
+ // NOTE: casting to `Number` is safe in both places, since we are always bounded
61481
+ // by the actual `encodedInfo.length`, which is equal `96`.
61477
61482
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
61478
61483
  const writeResult = memory.storeFrom(outputStart, chunk);
61479
61484
  if (writeResult.isError) {
@@ -61493,7 +61498,7 @@ class Info {
61493
61498
  *
61494
61499
  * Used exclusively by `info` host call.
61495
61500
  *
61496
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
61501
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
61497
61502
  */
61498
61503
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
61499
61504
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),