@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/importer/index.js CHANGED
@@ -4245,6 +4245,7 @@ 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";
4248
4249
  })(GpVersion || (GpVersion = {}));
4249
4250
  var TestSuite;
4250
4251
  (function (TestSuite) {
@@ -4252,7 +4253,7 @@ var TestSuite;
4252
4253
  TestSuite["JAMDUNA"] = "jamduna";
4253
4254
  })(TestSuite || (TestSuite = {}));
4254
4255
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
4255
- const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
4256
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
4256
4257
  const env = typeof process === "undefined" ? {} : process.env;
4257
4258
  const DEFAULT_VERSION = GpVersion.V0_7_0;
4258
4259
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -4261,20 +4262,26 @@ function parseCurrentVersion(env) {
4261
4262
  if (env === undefined) {
4262
4263
  return undefined;
4263
4264
  }
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}`);
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}`);
4267
4273
  }
4268
- return version;
4269
4274
  }
4270
4275
  function parseCurrentSuite(env) {
4271
4276
  if (env === undefined)
4272
4277
  return undefined;
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)}`);
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)}`);
4276
4284
  }
4277
- return val;
4278
4285
  }
4279
4286
  class Compatibility {
4280
4287
  static override(version) {
@@ -13406,8 +13413,8 @@ function print(level, levelAndName, strings, data) {
13406
13413
  return;
13407
13414
  }
13408
13415
  const lvlText = Level[level].padEnd(5);
13409
- const val = strings.map((v, idx) => `${v}${data[idx]}`);
13410
- const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
13416
+ const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
13417
+ const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
13411
13418
  if (level === Level.WARN) {
13412
13419
  console.warn(msg);
13413
13420
  }
@@ -20219,16 +20226,12 @@ class PartiallyUpdatedState {
20219
20226
  *
20220
20227
  * NOTE the info may be updated compared to what is in the state.
20221
20228
  *
20222
- * Takes into account newly created services as well.
20229
+ * Takes into account ejected and newly created services as well.
20223
20230
  */
20224
20231
  getServiceInfo(destination) {
20225
20232
  if (destination === null) {
20226
20233
  return null;
20227
20234
  }
20228
- const isEjected = this.stateUpdate.services.servicesRemoved.some((x) => x === destination);
20229
- if (isEjected) {
20230
- return null;
20231
- }
20232
20235
  const maybeNewService = this.stateUpdate.services.servicesUpdates.find((update) => update.serviceId === destination);
20233
20236
  if (maybeNewService !== undefined) {
20234
20237
  return maybeNewService.action.account;
@@ -22773,8 +22776,8 @@ var FetchKind;
22773
22776
 
22774
22777
 
22775
22778
  const info_IN_OUT_REG = 7;
22776
- const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 9 : 11;
22777
- const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
22779
+ const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 9 : 11;
22780
+ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 10 : 12;
22778
22781
  /**
22779
22782
  * Return info about some account.
22780
22783
  *
@@ -22791,7 +22794,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
22791
22794
  * a = last accumulation timeslot
22792
22795
  * p = parent service
22793
22796
  *
22794
- * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
22797
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
22795
22798
  */
22796
22799
  class Info {
22797
22800
  currentServiceId;
@@ -22821,6 +22824,8 @@ class Info {
22821
22824
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
22822
22825
  // l
22823
22826
  const length = minU64(regs.get(LEN_REG), numbers_tryAsU64(valueLength - offset));
22827
+ // NOTE: casting to `Number` is safe in both places, since we are always bounded
22828
+ // by the actual `encodedInfo.length`, which is equal `96`.
22824
22829
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
22825
22830
  const writeResult = memory.storeFrom(outputStart, chunk);
22826
22831
  if (writeResult.isError) {
@@ -22840,7 +22845,7 @@ class Info {
22840
22845
  *
22841
22846
  * Used exclusively by `info` host call.
22842
22847
  *
22843
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
22848
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
22844
22849
  */
22845
22850
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
22846
22851
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),