@typeberry/jam 0.1.2-8c85275 → 0.1.2-b7cae5d

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) {
@@ -22769,8 +22776,8 @@ var FetchKind;
22769
22776
 
22770
22777
 
22771
22778
  const info_IN_OUT_REG = 7;
22772
- const OFFSET_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 9 : 11;
22773
- 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;
22774
22781
  /**
22775
22782
  * Return info about some account.
22776
22783
  *
@@ -22787,7 +22794,7 @@ const LEN_REG = Compatibility.isSuite(TestSuite.W3F_DAVXY) ? 10 : 12;
22787
22794
  * a = last accumulation timeslot
22788
22795
  * p = parent service
22789
22796
  *
22790
- * https://graypaper.fluffylabs.dev/#/38c4e62/338302338302?v=0.7.0
22797
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/333b00333b00?v=0.7.2
22791
22798
  */
22792
22799
  class Info {
22793
22800
  currentServiceId;
@@ -22817,6 +22824,8 @@ class Info {
22817
22824
  const offset = minU64(regs.get(OFFSET_REG), valueLength);
22818
22825
  // l
22819
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`.
22820
22829
  const chunk = encodedInfo.raw.subarray(Number(offset), Number(offset + length));
22821
22830
  const writeResult = memory.storeFrom(outputStart, chunk);
22822
22831
  if (writeResult.isError) {
@@ -22836,7 +22845,7 @@ class Info {
22836
22845
  *
22837
22846
  * Used exclusively by `info` host call.
22838
22847
  *
22839
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/337602337602?v=0.6.7
22848
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/33920033b500?v=0.7.2
22840
22849
  */
22841
22850
  const codecServiceAccountInfoWithThresholdBalance = descriptors_codec.object({
22842
22851
  codeHash: descriptors_codec.bytes(hash_HASH_SIZE),