@typeberry/jam 0.1.2-753d258 → 0.1.2-7ebe1f6

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/README.md CHANGED
@@ -15,6 +15,7 @@ Gray Paper compliance can be controlled via `GP_VERSION` environment variable.
15
15
  - [x] 0.6.7
16
16
  - [x] 0.7.0
17
17
  - [ ] 0.7.1 (partial)
18
+ - [ ] 0.7.2 (partial)
18
19
 
19
20
  JAM Prize requirements
20
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-generator.mjs","mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;ACJA;AACA;AACA;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;ACAA;AACA;;;;AEDA;AACA;AACA;AACA","sources":["../external module \"tsx/esm/api\"",".././workers/block-generator/bootstrap-generator.mjs","../webpack/bootstrap","../webpack/runtime/async module","../webpack/runtime/define property getters","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/compat","../webpack/before-startup","../webpack/startup","../webpack/after-startup"],"sourcesContent":["var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nmodule.exports = x({ [\"tsImport\"]: () => (__WEBPACK_EXTERNAL_MODULE_tsx_esm_api_3a632928__.tsImport) });","import { tsImport } from \"tsx/esm/api\";\n\nawait tsImport(\"./index.ts\", import.meta.url);\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","var webpackQueues = typeof Symbol === \"function\" ? Symbol(\"webpack queues\") : \"__webpack_queues__\";\nvar webpackExports = typeof Symbol === \"function\" ? Symbol(\"webpack exports\") : \"__webpack_exports__\";\nvar webpackError = typeof Symbol === \"function\" ? Symbol(\"webpack error\") : \"__webpack_error__\";\nvar resolveQueue = (queue) => {\n\tif(queue && queue.d < 1) {\n\t\tqueue.d = 1;\n\t\tqueue.forEach((fn) => (fn.r--));\n\t\tqueue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));\n\t}\n}\nvar wrapDeps = (deps) => (deps.map((dep) => {\n\tif(dep !== null && typeof dep === \"object\") {\n\t\tif(dep[webpackQueues]) return dep;\n\t\tif(dep.then) {\n\t\t\tvar queue = [];\n\t\t\tqueue.d = 0;\n\t\t\tdep.then((r) => {\n\t\t\t\tobj[webpackExports] = r;\n\t\t\t\tresolveQueue(queue);\n\t\t\t}, (e) => {\n\t\t\t\tobj[webpackError] = e;\n\t\t\t\tresolveQueue(queue);\n\t\t\t});\n\t\t\tvar obj = {};\n\t\t\tobj[webpackQueues] = (fn) => (fn(queue));\n\t\t\treturn obj;\n\t\t}\n\t}\n\tvar ret = {};\n\tret[webpackQueues] = x => {};\n\tret[webpackExports] = dep;\n\treturn ret;\n}));\n__webpack_require__.a = (module, body, hasAwait) => {\n\tvar queue;\n\thasAwait && ((queue = []).d = -1);\n\tvar depQueues = new Set();\n\tvar exports = module.exports;\n\tvar currentDeps;\n\tvar outerResolve;\n\tvar reject;\n\tvar promise = new Promise((resolve, rej) => {\n\t\treject = rej;\n\t\touterResolve = resolve;\n\t});\n\tpromise[webpackExports] = exports;\n\tpromise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise[\"catch\"](x => {}));\n\tmodule.exports = promise;\n\tbody((deps) => {\n\t\tcurrentDeps = wrapDeps(deps);\n\t\tvar fn;\n\t\tvar getResult = () => (currentDeps.map((d) => {\n\t\t\tif(d[webpackError]) throw d[webpackError];\n\t\t\treturn d[webpackExports];\n\t\t}))\n\t\tvar promise = new Promise((resolve) => {\n\t\t\tfn = () => (resolve(getResult));\n\t\t\tfn.r = 0;\n\t\t\tvar fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));\n\t\t\tcurrentDeps.map((dep) => (dep[webpackQueues](fnQueue)));\n\t\t});\n\t\treturn fn.r ? promise : getResult();\n\t}, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));\n\tqueue && queue.d < 0 && (queue.d = 0);\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\\/\\/\\/\\w:/) ? 1 : 0, -1) + \"/\";","","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(305);\n",""],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"bootstrap-generator.mjs","mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;ACJA;AACA;AACA;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;ACAA;AACA;;;;AEDA;AACA;AACA;AACA","sources":["../external module \"tsx/esm/api\"",".././packages/workers/block-generator/bootstrap-generator.mjs","../webpack/bootstrap","../webpack/runtime/async module","../webpack/runtime/define property getters","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/compat","../webpack/before-startup","../webpack/startup","../webpack/after-startup"],"sourcesContent":["var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nmodule.exports = x({ [\"tsImport\"]: () => (__WEBPACK_EXTERNAL_MODULE_tsx_esm_api_3a632928__.tsImport) });","import { tsImport } from \"tsx/esm/api\";\n\nawait tsImport(\"./index.ts\", import.meta.url);\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","var webpackQueues = typeof Symbol === \"function\" ? Symbol(\"webpack queues\") : \"__webpack_queues__\";\nvar webpackExports = typeof Symbol === \"function\" ? Symbol(\"webpack exports\") : \"__webpack_exports__\";\nvar webpackError = typeof Symbol === \"function\" ? Symbol(\"webpack error\") : \"__webpack_error__\";\nvar resolveQueue = (queue) => {\n\tif(queue && queue.d < 1) {\n\t\tqueue.d = 1;\n\t\tqueue.forEach((fn) => (fn.r--));\n\t\tqueue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));\n\t}\n}\nvar wrapDeps = (deps) => (deps.map((dep) => {\n\tif(dep !== null && typeof dep === \"object\") {\n\t\tif(dep[webpackQueues]) return dep;\n\t\tif(dep.then) {\n\t\t\tvar queue = [];\n\t\t\tqueue.d = 0;\n\t\t\tdep.then((r) => {\n\t\t\t\tobj[webpackExports] = r;\n\t\t\t\tresolveQueue(queue);\n\t\t\t}, (e) => {\n\t\t\t\tobj[webpackError] = e;\n\t\t\t\tresolveQueue(queue);\n\t\t\t});\n\t\t\tvar obj = {};\n\t\t\tobj[webpackQueues] = (fn) => (fn(queue));\n\t\t\treturn obj;\n\t\t}\n\t}\n\tvar ret = {};\n\tret[webpackQueues] = x => {};\n\tret[webpackExports] = dep;\n\treturn ret;\n}));\n__webpack_require__.a = (module, body, hasAwait) => {\n\tvar queue;\n\thasAwait && ((queue = []).d = -1);\n\tvar depQueues = new Set();\n\tvar exports = module.exports;\n\tvar currentDeps;\n\tvar outerResolve;\n\tvar reject;\n\tvar promise = new Promise((resolve, rej) => {\n\t\treject = rej;\n\t\touterResolve = resolve;\n\t});\n\tpromise[webpackExports] = exports;\n\tpromise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise[\"catch\"](x => {}));\n\tmodule.exports = promise;\n\tbody((deps) => {\n\t\tcurrentDeps = wrapDeps(deps);\n\t\tvar fn;\n\t\tvar getResult = () => (currentDeps.map((d) => {\n\t\t\tif(d[webpackError]) throw d[webpackError];\n\t\t\treturn d[webpackExports];\n\t\t}))\n\t\tvar promise = new Promise((resolve) => {\n\t\t\tfn = () => (resolve(getResult));\n\t\t\tfn.r = 0;\n\t\t\tvar fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));\n\t\t\tcurrentDeps.map((dep) => (dep[webpackQueues](fnQueue)));\n\t\t});\n\t\treturn fn.r ? promise : getResult();\n\t}, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));\n\tqueue && queue.d < 0 && (queue.d = 0);\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","\nif (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\\/\\/\\/\\w:/) ? 1 : 0, -1) + \"/\";","","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(305);\n",""],"names":[],"sourceRoot":""}
@@ -3575,6 +3575,7 @@ var GpVersion;
3575
3575
  GpVersion["V0_6_7"] = "0.6.7";
3576
3576
  GpVersion["V0_7_0"] = "0.7.0";
3577
3577
  GpVersion["V0_7_1"] = "0.7.1-preview";
3578
+ GpVersion["V0_7_2"] = "0.7.2-preview";
3578
3579
  })(GpVersion || (GpVersion = {}));
3579
3580
  var TestSuite;
3580
3581
  (function (TestSuite) {
@@ -3582,7 +3583,7 @@ var TestSuite;
3582
3583
  TestSuite["JAMDUNA"] = "jamduna";
3583
3584
  })(TestSuite || (TestSuite = {}));
3584
3585
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
3585
- const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
3586
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
3586
3587
  const env = typeof process === "undefined" ? {} : process.env;
3587
3588
  const DEFAULT_VERSION = GpVersion.V0_7_0;
3588
3589
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -3591,20 +3592,26 @@ function parseCurrentVersion(env) {
3591
3592
  if (env === undefined) {
3592
3593
  return undefined;
3593
3594
  }
3594
- const version = env;
3595
- if (!Object.values(GpVersion).includes(version)) {
3596
- throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
3595
+ switch (env) {
3596
+ case GpVersion.V0_6_7:
3597
+ case GpVersion.V0_7_0:
3598
+ case GpVersion.V0_7_1:
3599
+ case GpVersion.V0_7_2:
3600
+ return env;
3601
+ default:
3602
+ throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
3597
3603
  }
3598
- return version;
3599
3604
  }
3600
3605
  function parseCurrentSuite(env) {
3601
3606
  if (env === undefined)
3602
3607
  return undefined;
3603
- const val = env;
3604
- if (!Object.values(TestSuite).includes(val)) {
3605
- throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
3608
+ switch (env) {
3609
+ case TestSuite.W3F_DAVXY:
3610
+ case TestSuite.JAMDUNA:
3611
+ return env;
3612
+ default:
3613
+ throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
3606
3614
  }
3607
- return val;
3608
3615
  }
3609
3616
  class Compatibility {
3610
3617
  static override(version) {
@@ -7963,6 +7970,45 @@ const assurancesExtrinsicCodec = codecWithContext((context) => {
7963
7970
  }, AssurancesExtrinsicBounds);
7964
7971
  });
7965
7972
 
7973
+ ;// CONCATENATED MODULE: ./packages/jam/block/common.ts
7974
+
7975
+
7976
+
7977
+
7978
+ /** Attempt to convert a number into `TimeSlot`. */
7979
+ const common_tryAsTimeSlot = (v) => opaque_asOpaqueType(numbers_tryAsU32(v));
7980
+ /** Attempt to convert a number into `ValidatorIndex`. */
7981
+ const tryAsValidatorIndex = (v) => opaque_asOpaqueType(numbers_tryAsU16(v));
7982
+ /** Attempt to convert a number into `ServiceId`. */
7983
+ const common_tryAsServiceId = (v) => opaque_asOpaqueType(numbers_tryAsU32(v));
7984
+ const common_tryAsServiceGas = (v) => opaque_asOpaqueType(numbers_tryAsU64(v));
7985
+ /** Attempt to convert a number into `CoreIndex`. */
7986
+ const common_tryAsCoreIndex = (v) => opaque_asOpaqueType(numbers_tryAsU16(v));
7987
+ /** Attempt to convert a number into `Epoch`. */
7988
+ const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
7989
+ function tryAsPerValidator(array, spec) {
7990
+ debug_check `
7991
+ ${array.length === spec.validatorsCount}
7992
+ Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
7993
+ `;
7994
+ return sized_array_asKnownSize(array);
7995
+ }
7996
+ const codecPerValidator = (val) => codecWithContext((context) => {
7997
+ return codecKnownSizeArray(val, {
7998
+ fixedLength: context.validatorsCount,
7999
+ });
8000
+ });
8001
+ function tryAsPerEpochBlock(array, spec) {
8002
+ debug_check `
8003
+ ${array.length === spec.epochLength}
8004
+ Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
8005
+ `;
8006
+ return sized_array_asKnownSize(array);
8007
+ }
8008
+ const codecPerEpochBlock = (val) => codecWithContext((context) => {
8009
+ return codecKnownSizeArray(val, { fixedLength: context.epochLength });
8010
+ });
8011
+
7966
8012
  ;// CONCATENATED MODULE: ./packages/jam/block/disputes.ts
7967
8013
 
7968
8014
 
@@ -8152,45 +8198,6 @@ class DisputesExtrinsic extends WithDebug {
8152
8198
  }
8153
8199
  }
8154
8200
 
8155
- ;// CONCATENATED MODULE: ./packages/jam/block/common.ts
8156
-
8157
-
8158
-
8159
-
8160
- /** Attempt to convert a number into `TimeSlot`. */
8161
- const tryAsTimeSlot = (v) => opaque_asOpaqueType(numbers_tryAsU32(v));
8162
- /** Attempt to convert a number into `ValidatorIndex`. */
8163
- const tryAsValidatorIndex = (v) => opaque_asOpaqueType(numbers_tryAsU16(v));
8164
- /** Attempt to convert a number into `ServiceId`. */
8165
- const common_tryAsServiceId = (v) => opaque_asOpaqueType(numbers_tryAsU32(v));
8166
- const common_tryAsServiceGas = (v) => opaque_asOpaqueType(numbers_tryAsU64(v));
8167
- /** Attempt to convert a number into `CoreIndex`. */
8168
- const common_tryAsCoreIndex = (v) => opaque_asOpaqueType(numbers_tryAsU16(v));
8169
- /** Attempt to convert a number into `Epoch`. */
8170
- const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
8171
- function tryAsPerValidator(array, spec) {
8172
- debug_check `
8173
- ${array.length === spec.validatorsCount}
8174
- Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
8175
- `;
8176
- return sized_array_asKnownSize(array);
8177
- }
8178
- const codecPerValidator = (val) => codecWithContext((context) => {
8179
- return codecKnownSizeArray(val, {
8180
- fixedLength: context.validatorsCount,
8181
- });
8182
- });
8183
- function tryAsPerEpochBlock(array, spec) {
8184
- debug_check `
8185
- ${array.length === spec.epochLength}
8186
- Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
8187
- `;
8188
- return sized_array_asKnownSize(array);
8189
- }
8190
- const codecPerEpochBlock = (val) => codecWithContext((context) => {
8191
- return codecKnownSizeArray(val, { fixedLength: context.epochLength });
8192
- });
8193
-
8194
8201
  ;// CONCATENATED MODULE: ./packages/jam/block/refine-context.ts
8195
8202
 
8196
8203
 
@@ -9089,8 +9096,8 @@ const legacyDescriptor = {
9089
9096
  *
9090
9097
  * https://graypaper.fluffylabs.dev/#/579bd12/0c66000c7200
9091
9098
  */
9092
- class Header extends WithDebug {
9093
- static Codec = descriptors_codec.Class(Header, Compatibility.isLessThan(GpVersion.V0_7_0)
9099
+ class header_Header extends WithDebug {
9100
+ static Codec = descriptors_codec.Class(header_Header, Compatibility.isLessThan(GpVersion.V0_7_0)
9094
9101
  ? legacyDescriptor
9095
9102
  : {
9096
9103
  parentHeaderHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
@@ -9105,7 +9112,7 @@ class Header extends WithDebug {
9105
9112
  seal: descriptors_codec.bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
9106
9113
  });
9107
9114
  static create(h) {
9108
- return Object.assign(Header.empty(), h);
9115
+ return Object.assign(header_Header.empty(), h);
9109
9116
  }
9110
9117
  /**
9111
9118
  * `H_p`: Hash of the parent header.
@@ -9118,7 +9125,7 @@ class Header extends WithDebug {
9118
9125
  /** `H_x`: The hash of block extrinsic. */
9119
9126
  extrinsicHash = bytes_Bytes.zero(hash_HASH_SIZE).asOpaque();
9120
9127
  /** `H_t`: JAM time-slot index. */
9121
- timeSlotIndex = tryAsTimeSlot(0);
9128
+ timeSlotIndex = common_tryAsTimeSlot(0);
9122
9129
  /**
9123
9130
  * `H_e`: Key and entropy relevant to the following epoch in case the ticket
9124
9131
  * contest does not complete adequately.
@@ -9146,7 +9153,7 @@ class Header extends WithDebug {
9146
9153
  }
9147
9154
  /** Create an empty header with some dummy values. */
9148
9155
  static empty() {
9149
- return new Header();
9156
+ return new header_Header();
9150
9157
  }
9151
9158
  }
9152
9159
  /**
@@ -9159,7 +9166,7 @@ class Header extends WithDebug {
9159
9166
  class HeaderViewWithHash extends WithHash {
9160
9167
  static Codec = descriptors_codec.Class(HeaderViewWithHash, {
9161
9168
  hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
9162
- data: Header.Codec.View,
9169
+ data: header_Header.Codec.View,
9163
9170
  });
9164
9171
  static create({ hash, data }) {
9165
9172
  return new WithHash(hash, data);
@@ -9207,6 +9214,8 @@ const preimagesExtrinsicCodec = descriptors_codec.sequenceVarLen(Preimage.Codec)
9207
9214
 
9208
9215
 
9209
9216
 
9217
+
9218
+
9210
9219
  /**
9211
9220
  * Extrinsic part of the block - the input data being external to the system.
9212
9221
  *
@@ -9274,7 +9283,7 @@ class Block extends WithDebug {
9274
9283
  header;
9275
9284
  extrinsic;
9276
9285
  static Codec = descriptors_codec.Class(Block, {
9277
- header: Header.Codec,
9286
+ header: header_Header.Codec,
9278
9287
  extrinsic: Extrinsic.Codec,
9279
9288
  });
9280
9289
  static create({ header, extrinsic }) {
@@ -9290,6 +9299,24 @@ class Block extends WithDebug {
9290
9299
  this.extrinsic = extrinsic;
9291
9300
  }
9292
9301
  }
9302
+ function emptyBlock(slot = tryAsTimeSlot(0)) {
9303
+ const header = Header.empty();
9304
+ header.timeSlotIndex = slot;
9305
+ return Block.create({
9306
+ header,
9307
+ extrinsic: Extrinsic.create({
9308
+ tickets: asKnownSize([]),
9309
+ preimages: [],
9310
+ assurances: asKnownSize([]),
9311
+ guarantees: asKnownSize([]),
9312
+ disputes: {
9313
+ verdicts: [],
9314
+ culprits: [],
9315
+ faults: [],
9316
+ },
9317
+ }),
9318
+ });
9319
+ }
9293
9320
 
9294
9321
  ;// CONCATENATED MODULE: ./packages/jam/block/index.ts
9295
9322
 
@@ -9371,7 +9398,7 @@ class LmdbBlocks {
9371
9398
  if (data === undefined) {
9372
9399
  return null;
9373
9400
  }
9374
- return decoder_Decoder.decodeObject(Header.Codec.View, data, this.chainSpec);
9401
+ return decoder_Decoder.decodeObject(header_Header.Codec.View, data, this.chainSpec);
9375
9402
  }
9376
9403
  getExtrinsic(hash) {
9377
9404
  const data = this.extrinsics.get(hash.raw);
@@ -10213,8 +10240,8 @@ class ServiceAccountInfo extends WithDebug {
10213
10240
  storageUtilisationBytes: descriptors_codec.u64,
10214
10241
  gratisStorage: descriptors_codec.u64,
10215
10242
  storageUtilisationCount: descriptors_codec.u32,
10216
- created: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
10217
- lastAccumulation: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
10243
+ created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
10244
+ lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
10218
10245
  parentService: descriptors_codec.u32.convert((x) => x, common_tryAsServiceId),
10219
10246
  });
10220
10247
  static create(a) {
@@ -11152,7 +11179,7 @@ class InMemoryState extends WithDebug {
11152
11179
  wonkySet: SortedSet.fromSortedArray(hashComparator, []),
11153
11180
  punishSet: SortedSet.fromSortedArray(hashComparator, []),
11154
11181
  }),
11155
- timeslot: tryAsTimeSlot(0),
11182
+ timeslot: common_tryAsTimeSlot(0),
11156
11183
  entropy: sized_array_FixedSizeArray.fill(() => bytes_Bytes.zero(hash_HASH_SIZE).asOpaque(), ENTROPY_ENTRIES),
11157
11184
  authPools: tryAsPerCore(Array.from({ length: spec.coresCount }, () => sized_array_asKnownSize([])), spec),
11158
11185
  authQueues: tryAsPerCore(Array.from({ length: spec.coresCount }, () => sized_array_FixedSizeArray.fill(() => bytes_Bytes.zero(hash_HASH_SIZE).asOpaque(), AUTHORIZATION_QUEUE_SIZE)), spec),
@@ -11583,7 +11610,7 @@ class SerializedService {
11583
11610
  if (rawSlots === undefined) {
11584
11611
  return null;
11585
11612
  }
11586
- return tryAsLookupHistorySlots(rawSlots.map(tryAsTimeSlot));
11613
+ return tryAsLookupHistorySlots(rawSlots.map(common_tryAsTimeSlot));
11587
11614
  }
11588
11615
  }
11589
11616
 
@@ -12980,8 +13007,8 @@ function print(level, levelAndName, strings, data) {
12980
13007
  return;
12981
13008
  }
12982
13009
  const lvlText = Level[level].padEnd(5);
12983
- const val = strings.map((v, idx) => `${v}${data[idx]}`);
12984
- const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
13010
+ const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
13011
+ const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
12985
13012
  if (level === Level.WARN) {
12986
13013
  console.warn(msg);
12987
13014
  }
@@ -13952,7 +13979,7 @@ class State {
13952
13979
 
13953
13980
 
13954
13981
 
13955
- ;// CONCATENATED MODULE: ./workers/generic/finished.ts
13982
+ ;// CONCATENATED MODULE: ./packages/workers/generic/finished.ts
13956
13983
 
13957
13984
  class Finished extends State {
13958
13985
  constructor() {
@@ -13968,7 +13995,7 @@ class Finished extends State {
13968
13995
  }
13969
13996
  }
13970
13997
 
13971
- ;// CONCATENATED MODULE: ./workers/generic/main-init.ts
13998
+ ;// CONCATENATED MODULE: ./packages/workers/generic/main-init.ts
13972
13999
 
13973
14000
 
13974
14001
  function stateMachineMain(name, readyName, ready) {
@@ -13991,7 +14018,7 @@ class MainInit extends State {
13991
14018
  }
13992
14019
  }
13993
14020
 
13994
- ;// CONCATENATED MODULE: ./workers/generic/worker-init.ts
14021
+ ;// CONCATENATED MODULE: ./packages/workers/generic/worker-init.ts
13995
14022
 
13996
14023
  class WorkerInit extends State {
13997
14024
  workerReadyName;
@@ -14013,7 +14040,7 @@ class WorkerInit extends State {
14013
14040
  }
14014
14041
  }
14015
14042
 
14016
- ;// CONCATENATED MODULE: ./workers/generic/worker-spawn.ts
14043
+ ;// CONCATENATED MODULE: ./packages/workers/generic/worker-spawn.ts
14017
14044
 
14018
14045
 
14019
14046
 
@@ -14025,7 +14052,7 @@ async function spawnWorkerGeneric(bootstrapPath, logger, mainReadyName, mainRead
14025
14052
  return channel;
14026
14053
  }
14027
14054
 
14028
- ;// CONCATENATED MODULE: ./workers/generic/index.ts
14055
+ ;// CONCATENATED MODULE: ./packages/workers/generic/index.ts
14029
14056
 
14030
14057
 
14031
14058
 
@@ -15471,6 +15498,17 @@ class page_range_PageRange {
15471
15498
  }
15472
15499
  return new page_range_PageRange(start, length);
15473
15500
  }
15501
+ /** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
15502
+ isWrapped() {
15503
+ return this.start >= this.end && !this.isEmpty();
15504
+ }
15505
+ /** Checks if given page number is within the range */
15506
+ isInRange(page) {
15507
+ if (this.isWrapped()) {
15508
+ return page >= this.start || page < this.end;
15509
+ }
15510
+ return page >= this.start && page < this.end;
15511
+ }
15474
15512
  /** Checks if a range is empty (`length === 0`) */
15475
15513
  isEmpty() {
15476
15514
  return this.length === 0;
@@ -15850,10 +15888,11 @@ class memory_builder_MemoryBuilder {
15850
15888
  startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
15851
15889
  `;
15852
15890
  this.ensureNotFinalized();
15853
- const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
15854
- const pages = PageRange.fromMemoryRange(range);
15855
- for (const pageNumber of pages) {
15856
- if (this.initialMemory.has(pageNumber)) {
15891
+ const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
15892
+ const heapPagesRange = PageRange.fromMemoryRange(heapRange);
15893
+ const initializedPageNumbers = Array.from(this.initialMemory.keys());
15894
+ for (const pageNumber of initializedPageNumbers) {
15895
+ if (heapPagesRange.isInRange(pageNumber)) {
15857
15896
  throw new IncorrectSbrkIndex();
15858
15897
  }
15859
15898
  }
@@ -18370,7 +18409,7 @@ class PvmExecutor {
18370
18409
 
18371
18410
 
18372
18411
 
18373
- ;// CONCATENATED MODULE: ./workers/block-generator/generator.ts
18412
+ ;// CONCATENATED MODULE: ./packages/workers/block-generator/generator.ts
18374
18413
 
18375
18414
 
18376
18415
 
@@ -18461,11 +18500,11 @@ class Generator {
18461
18500
  e.i32(newTimeSlot);
18462
18501
  e.i16(validatorId);
18463
18502
  // create header
18464
- const header = Header.create({
18503
+ const header = header_Header.create({
18465
18504
  parentHeaderHash,
18466
18505
  priorStateRoot: await stateRoot,
18467
18506
  extrinsicHash,
18468
- timeSlotIndex: tryAsTimeSlot(newTimeSlot),
18507
+ timeSlotIndex: common_tryAsTimeSlot(newTimeSlot),
18469
18508
  epochMarker: null,
18470
18509
  ticketsMarker: null,
18471
18510
  offendersMarker: [],
@@ -18476,15 +18515,15 @@ class Generator {
18476
18515
  // TODO [MaSo] IDK if this is ok to update it here.
18477
18516
  // This function utility is to create a block
18478
18517
  // not to update any logic.
18479
- const encoded = encoder_Encoder.encodeObject(Header.Codec, header, this.chainSpec);
18480
- const headerView = decoder_Decoder.decodeObject(Header.Codec.View, encoded, this.chainSpec);
18518
+ const encoded = encoder_Encoder.encodeObject(header_Header.Codec, header, this.chainSpec);
18519
+ const headerView = decoder_Decoder.decodeObject(header_Header.Codec.View, encoded, this.chainSpec);
18481
18520
  this.lastHeaderHash = hasher.header(headerView).hash;
18482
18521
  this.lastHeader = header;
18483
18522
  return Block.create({ header, extrinsic });
18484
18523
  }
18485
18524
  }
18486
18525
 
18487
- ;// CONCATENATED MODULE: ./workers/block-generator/state-machine.ts
18526
+ ;// CONCATENATED MODULE: ./packages/workers/block-generator/state-machine.ts
18488
18527
 
18489
18528
 
18490
18529
 
@@ -18549,7 +18588,7 @@ class GeneratorReady extends State {
18549
18588
  }
18550
18589
  }
18551
18590
 
18552
- ;// CONCATENATED MODULE: ./workers/block-generator/index.ts
18591
+ ;// CONCATENATED MODULE: ./packages/workers/block-generator/index.ts
18553
18592
 
18554
18593
 
18555
18594