@typeberry/jam 0.1.1-135f62f → 0.1.1-4a6ffa9

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
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import './sourcemap-register.cjs';import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE_lmdb__ from "lmdb";
3
4
  /******/ var __webpack_modules__ = ({
@@ -28434,6 +28435,34 @@ class WithDebug {
28434
28435
  }
28435
28436
  }
28436
28437
 
28438
+ ;// CONCATENATED MODULE: ./packages/core/utils/dev.ts
28439
+ const dev_env = typeof process === "undefined" ? {} : process.env;
28440
+ /**
28441
+ * The function will produce relative path resolver that is adjusted
28442
+ * for package location within the workspace.
28443
+ *
28444
+ * Example:
28445
+ * $ npm start -w @typeberry/jam
28446
+ *
28447
+ * The above command will run `./bin/jam/index.js`, however we would
28448
+ * still want relative paths to be resolved according to top-level workspace
28449
+ * directory.
28450
+ *
28451
+ * So the caller, passes the absolute workspace path as argument and get's
28452
+ * a function that can properly resolve relative paths.
28453
+ *
28454
+ * NOTE: the translation happens only for development build! When
28455
+ * we build a single library from our project, we no longer mangle the paths.
28456
+ */
28457
+ const workspacePathFix = dev_env.NODE_ENV === "development"
28458
+ ? (workspacePath) => (p) => {
28459
+ if (p.startsWith("/")) {
28460
+ return p;
28461
+ }
28462
+ return `${workspacePath}/${p}`;
28463
+ }
28464
+ : () => (p) => p;
28465
+
28437
28466
  ;// CONCATENATED MODULE: ./packages/core/utils/opaque.ts
28438
28467
  /**
28439
28468
  * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
@@ -28777,6 +28806,7 @@ function isResult(x) {
28777
28806
 
28778
28807
 
28779
28808
 
28809
+
28780
28810
  ;// CONCATENATED MODULE: ./packages/core/bytes/bitvec.ts
28781
28811
 
28782
28812
  /**
@@ -62004,6 +62034,7 @@ class Accumulate {
62004
62034
  const serviceIds = accumulateData.getServiceIds();
62005
62035
  let gasCost = common_tryAsServiceGas(0);
62006
62036
  let currentState = inputStateUpdate;
62037
+ const currentManager = (inputStateUpdate.privilegedServices ?? this.state.privilegedServices).manager;
62007
62038
  for (const serviceId of serviceIds) {
62008
62039
  const checkpoint = AccumulationStateUpdate.copyFrom(currentState);
62009
62040
  const { consumedGas, stateUpdate } = await this.accumulateSingleService(serviceId, accumulateData.getOperands(serviceId), accumulateData.getGasCost(serviceId), slot, entropy, currentState);
@@ -62013,6 +62044,21 @@ class Accumulate {
62013
62044
  serviceStatistics.gasUsed = common_tryAsServiceGas(serviceStatistics.gasUsed + consumedGas);
62014
62045
  statistics.set(serviceId, serviceStatistics);
62015
62046
  currentState = stateUpdate === null ? checkpoint : stateUpdate;
62047
+ if (Compatibility.is(GpVersion.V0_7_0) && serviceId === currentManager) {
62048
+ const newV = currentState.privilegedServices?.validatorsManager;
62049
+ if (currentState.privilegedServices !== null && newV !== undefined && serviceIds.includes(newV)) {
62050
+ accumulate_logger.info("Entering completely incorrect code that probably reverts validatorsManager change. This is valid in 0.7.0 only and incorrect in 0.7.1+");
62051
+ // Since serviceIds already contains newV, this service gets accumulated twice.
62052
+ // To avoid double-counting, we skip stats and gas cost tracking here.
62053
+ // We need this accumulation to get the correct `validatorsManager`
62054
+ const { stateUpdate } = await this.accumulateSingleService(newV, accumulateData.getOperands(newV), accumulateData.getGasCost(newV), slot, entropy, checkpoint);
62055
+ const correctV = stateUpdate?.privilegedServices?.validatorsManager ?? this.state.privilegedServices.validatorsManager;
62056
+ currentState.privilegedServices = PrivilegedServices.create({
62057
+ ...currentState.privilegedServices,
62058
+ validatorsManager: correctV,
62059
+ });
62060
+ }
62061
+ }
62016
62062
  }
62017
62063
  return {
62018
62064
  state: currentState,
@@ -64359,6 +64405,7 @@ function parseFuzzVersion(v) {
64359
64405
 
64360
64406
 
64361
64407
 
64408
+
64362
64409
  const prepareConfigFile = (args) => {
64363
64410
  const nodeConfig = loadConfig(args.args.configPath);
64364
64411
  const nodeName = args.command === Command.Dev ? `${args.args.nodeName}-${args.args.index}` : args.args.nodeName;
@@ -64385,14 +64432,8 @@ const prepareConfigFile = (args) => {
64385
64432
  };
64386
64433
  if (import.meta.url === (0,external_node_url_namespaceObject.pathToFileURL)(process.argv[1]).href) {
64387
64434
  Logger.configureAll(process.env.JAM_LOG ?? "", Level.LOG);
64388
- const relPath = `${import.meta.dirname}/../..`;
64389
- const withRelPath = (p) => {
64390
- if (p.startsWith("/")) {
64391
- return p;
64392
- }
64393
- return `${relPath}/${p}`;
64394
- };
64395
64435
  let args;
64436
+ const withRelPath = workspacePathFix(`${import.meta.dirname}/../..`);
64396
64437
  try {
64397
64438
  const parsed = parseArgs(process.argv.slice(2), withRelPath);
64398
64439
  if (parsed === null) {