@typeberry/jam 0.1.1-127cc86 → 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/block-generator/index.js +29 -0
- package/block-generator/index.js.map +1 -1
- package/importer/index.js +50 -2
- package/importer/index.js.map +1 -1
- package/index.js +53 -9
- package/index.js.map +1 -1
- package/jam-network/index.js +29 -0
- package/jam-network/index.js.map +1 -1
- package/package.json +4 -2
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,
|
|
@@ -62157,11 +62203,14 @@ class DeferredTransfers {
|
|
|
62157
62203
|
async transition({ pendingTransfers, timeslot, servicesUpdate: inputServicesUpdate, entropy, }) {
|
|
62158
62204
|
// https://graypaper.fluffylabs.dev/#/7e6ff6a/187a03187a03?v=0.6.7
|
|
62159
62205
|
const transferStatistics = new Map();
|
|
62160
|
-
const services = uniquePreserveOrder(pendingTransfers.
|
|
62206
|
+
const services = uniquePreserveOrder(pendingTransfers.map((x) => x.destination));
|
|
62161
62207
|
let currentStateUpdate = AccumulationStateUpdate.new(inputServicesUpdate);
|
|
62162
62208
|
for (const serviceId of services) {
|
|
62163
62209
|
const partiallyUpdatedState = new PartiallyUpdatedState(this.state, currentStateUpdate);
|
|
62164
|
-
|
|
62210
|
+
// https://graypaper.fluffylabs.dev/#/38c4e62/18750318ae03?v=0.7.0
|
|
62211
|
+
const transfers = pendingTransfers
|
|
62212
|
+
.filter((pendingTransfer) => pendingTransfer.destination === serviceId)
|
|
62213
|
+
.toSorted((a, b) => a.source - b.source);
|
|
62165
62214
|
const info = partiallyUpdatedState.getServiceInfo(serviceId);
|
|
62166
62215
|
if (info === null) {
|
|
62167
62216
|
return result_Result.error(DeferredTransfersErrorCode.ServiceInfoNotExist);
|
|
@@ -64356,6 +64405,7 @@ function parseFuzzVersion(v) {
|
|
|
64356
64405
|
|
|
64357
64406
|
|
|
64358
64407
|
|
|
64408
|
+
|
|
64359
64409
|
const prepareConfigFile = (args) => {
|
|
64360
64410
|
const nodeConfig = loadConfig(args.args.configPath);
|
|
64361
64411
|
const nodeName = args.command === Command.Dev ? `${args.args.nodeName}-${args.args.index}` : args.args.nodeName;
|
|
@@ -64382,14 +64432,8 @@ const prepareConfigFile = (args) => {
|
|
|
64382
64432
|
};
|
|
64383
64433
|
if (import.meta.url === (0,external_node_url_namespaceObject.pathToFileURL)(process.argv[1]).href) {
|
|
64384
64434
|
Logger.configureAll(process.env.JAM_LOG ?? "", Level.LOG);
|
|
64385
|
-
const relPath = `${import.meta.dirname}/../..`;
|
|
64386
|
-
const withRelPath = (p) => {
|
|
64387
|
-
if (p.startsWith("/")) {
|
|
64388
|
-
return p;
|
|
64389
|
-
}
|
|
64390
|
-
return `${relPath}/${p}`;
|
|
64391
|
-
};
|
|
64392
64435
|
let args;
|
|
64436
|
+
const withRelPath = workspacePathFix(`${import.meta.dirname}/../..`);
|
|
64393
64437
|
try {
|
|
64394
64438
|
const parsed = parseArgs(process.argv.slice(2), withRelPath);
|
|
64395
64439
|
if (parsed === null) {
|