@typeberry/jam 0.2.0-5746fdc → 0.2.0-661fe38
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 +3 -3
- package/bootstrap-generator.mjs +39 -51
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +5425 -5357
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +152 -32
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +5962 -5741
- package/index.js.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@ Gray Paper compliance can be controlled via `GP_VERSION` environment variable.
|
|
|
14
14
|
|
|
15
15
|
- [x] 0.6.7
|
|
16
16
|
- [x] 0.7.0
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
17
|
+
- [x] 0.7.1
|
|
18
|
+
- [x] 0.7.2
|
|
19
19
|
|
|
20
20
|
JAM Prize requirements
|
|
21
21
|
|
|
@@ -75,7 +75,7 @@ $ docker run typeberry
|
|
|
75
75
|
$ docker run typeberry --config /app/configs/typeberry-dev.json --node-name my-node
|
|
76
76
|
|
|
77
77
|
# Run with environment variables (e.g., for logging)
|
|
78
|
-
$ docker run -e JAM_LOG=trace GP_VERSION=0.7.
|
|
78
|
+
$ docker run -e JAM_LOG=trace GP_VERSION=0.7.2 typeberry
|
|
79
79
|
|
|
80
80
|
# Run with volume mounts for persistent data
|
|
81
81
|
$ docker run -v $(pwd)/database:/app/database typeberry
|
package/bootstrap-generator.mjs
CHANGED
|
@@ -2869,44 +2869,40 @@ var GpVersion;
|
|
|
2869
2869
|
GpVersion["V0_6_7"] = "0.6.7";
|
|
2870
2870
|
GpVersion["V0_7_0"] = "0.7.0";
|
|
2871
2871
|
GpVersion["V0_7_1"] = "0.7.1";
|
|
2872
|
-
GpVersion["V0_7_2"] = "0.7.2
|
|
2872
|
+
GpVersion["V0_7_2"] = "0.7.2";
|
|
2873
2873
|
})(GpVersion || (GpVersion = {}));
|
|
2874
2874
|
var TestSuite;
|
|
2875
2875
|
(function (TestSuite) {
|
|
2876
2876
|
TestSuite["W3F_DAVXY"] = "w3f-davxy";
|
|
2877
2877
|
TestSuite["JAMDUNA"] = "jamduna";
|
|
2878
2878
|
})(TestSuite || (TestSuite = {}));
|
|
2879
|
+
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
2879
2880
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
2880
|
-
const DEFAULT_VERSION = GpVersion.
|
|
2881
|
+
const DEFAULT_VERSION = GpVersion.V0_7_2;
|
|
2881
2882
|
const env = typeof process === "undefined" ? {} : process.env;
|
|
2882
2883
|
let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
|
|
2883
2884
|
let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
2884
|
-
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
2885
2885
|
function parseCurrentVersion(env) {
|
|
2886
2886
|
if (env === undefined) {
|
|
2887
2887
|
return undefined;
|
|
2888
2888
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
case GpVersion.V0_7_2:
|
|
2894
|
-
return env;
|
|
2895
|
-
default:
|
|
2896
|
-
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
2889
|
+
for (const v of Object.values(GpVersion)) {
|
|
2890
|
+
if (env === v) {
|
|
2891
|
+
return v;
|
|
2892
|
+
}
|
|
2897
2893
|
}
|
|
2894
|
+
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
2898
2895
|
}
|
|
2899
2896
|
function parseCurrentSuite(env) {
|
|
2900
2897
|
if (env === undefined) {
|
|
2901
2898
|
return undefined;
|
|
2902
2899
|
}
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
default:
|
|
2908
|
-
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
2900
|
+
for (const s of Object.values(TestSuite)) {
|
|
2901
|
+
if (env === s) {
|
|
2902
|
+
return s;
|
|
2903
|
+
}
|
|
2909
2904
|
}
|
|
2905
|
+
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
2910
2906
|
}
|
|
2911
2907
|
class Compatibility {
|
|
2912
2908
|
static override(version) {
|
|
@@ -3067,6 +3063,13 @@ class WithDebug {
|
|
|
3067
3063
|
return debug_inspect(this);
|
|
3068
3064
|
}
|
|
3069
3065
|
}
|
|
3066
|
+
function lazyInspect(obj) {
|
|
3067
|
+
return {
|
|
3068
|
+
toString() {
|
|
3069
|
+
return debug_inspect(obj);
|
|
3070
|
+
},
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3070
3073
|
|
|
3071
3074
|
;// CONCATENATED MODULE: ./packages/core/utils/dev.ts
|
|
3072
3075
|
const dev_env = typeof process === "undefined" ? {} : process.env;
|
|
@@ -7355,6 +7358,8 @@ const EC_SEGMENT_SIZE = 4104;
|
|
|
7355
7358
|
* Additional data that has to be passed to the codec to correctly parse incoming bytes.
|
|
7356
7359
|
*/
|
|
7357
7360
|
class ChainSpec extends WithDebug {
|
|
7361
|
+
/** Human-readable name of the chain spec. */
|
|
7362
|
+
name;
|
|
7358
7363
|
/** Number of validators. */
|
|
7359
7364
|
validatorsCount;
|
|
7360
7365
|
/** 1/3 of number of validators */
|
|
@@ -7397,6 +7402,7 @@ class ChainSpec extends WithDebug {
|
|
|
7397
7402
|
maxLookupAnchorAge;
|
|
7398
7403
|
constructor(data) {
|
|
7399
7404
|
super();
|
|
7405
|
+
this.name = data.name;
|
|
7400
7406
|
this.validatorsCount = data.validatorsCount;
|
|
7401
7407
|
this.thirdOfValidators = numbers_tryAsU16(Math.floor(data.validatorsCount / 3));
|
|
7402
7408
|
this.validatorsSuperMajority = numbers_tryAsU16(Math.floor(data.validatorsCount / 3) * 2 + 1);
|
|
@@ -7417,6 +7423,7 @@ class ChainSpec extends WithDebug {
|
|
|
7417
7423
|
}
|
|
7418
7424
|
/** Set of values for "tiny" chain as defined in JAM test vectors. */
|
|
7419
7425
|
const tinyChainSpec = new ChainSpec({
|
|
7426
|
+
name: "tiny",
|
|
7420
7427
|
validatorsCount: numbers_tryAsU16(6),
|
|
7421
7428
|
coresCount: numbers_tryAsU16(2),
|
|
7422
7429
|
epochLength: numbers_tryAsU32(12),
|
|
@@ -7438,6 +7445,7 @@ const tinyChainSpec = new ChainSpec({
|
|
|
7438
7445
|
* Please note that only validatorsCount and epochLength are "full", the rest is copied from "tiny".
|
|
7439
7446
|
*/
|
|
7440
7447
|
const fullChainSpec = new ChainSpec({
|
|
7448
|
+
name: "full",
|
|
7441
7449
|
validatorsCount: numbers_tryAsU16(1023),
|
|
7442
7450
|
coresCount: numbers_tryAsU16(341),
|
|
7443
7451
|
epochLength: numbers_tryAsU32(600),
|
|
@@ -9013,7 +9021,6 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
9013
9021
|
|
|
9014
9022
|
|
|
9015
9023
|
|
|
9016
|
-
|
|
9017
9024
|
/** Helper function to create most used hashes in the block */
|
|
9018
9025
|
class TransitionHasher {
|
|
9019
9026
|
context;
|
|
@@ -9062,15 +9069,6 @@ class TransitionHasher {
|
|
|
9062
9069
|
const encoded = bytes_BytesBlob.blobFromParts([et.raw, ep.raw, eg.raw, ea.raw, ed.raw]);
|
|
9063
9070
|
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), extrinsicView, encoded);
|
|
9064
9071
|
}
|
|
9065
|
-
/** Creates hash for given WorkPackage */
|
|
9066
|
-
workPackage(workPackage) {
|
|
9067
|
-
return this.encode(WorkPackage.Codec, workPackage);
|
|
9068
|
-
}
|
|
9069
|
-
encode(codec, data) {
|
|
9070
|
-
// TODO [ToDr] Use already allocated encoding destination and hash bytes from some arena.
|
|
9071
|
-
const encoded = Encoder.encodeObject(codec, data, this.context);
|
|
9072
|
-
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), data, encoded);
|
|
9073
|
-
}
|
|
9074
9072
|
}
|
|
9075
9073
|
|
|
9076
9074
|
;// CONCATENATED MODULE: ./packages/jam/state/accumulation-output.ts
|
|
@@ -9105,7 +9103,7 @@ function accumulationOutputComparator(a, b) {
|
|
|
9105
9103
|
if (result > 0) {
|
|
9106
9104
|
return Ordering.Greater;
|
|
9107
9105
|
}
|
|
9108
|
-
return
|
|
9106
|
+
return a.output.compare(b.output);
|
|
9109
9107
|
}
|
|
9110
9108
|
|
|
9111
9109
|
;// CONCATENATED MODULE: ./packages/jam/block/gp-constants.ts
|
|
@@ -10131,26 +10129,6 @@ class InMemoryStateView {
|
|
|
10131
10129
|
|
|
10132
10130
|
|
|
10133
10131
|
|
|
10134
|
-
/** Dictionary entry of services that auto-accumulate every block. */
|
|
10135
|
-
class AutoAccumulate {
|
|
10136
|
-
service;
|
|
10137
|
-
gasLimit;
|
|
10138
|
-
static Codec = descriptors_codec.Class(AutoAccumulate, {
|
|
10139
|
-
service: descriptors_codec.u32.asOpaque(),
|
|
10140
|
-
gasLimit: descriptors_codec.u64.asOpaque(),
|
|
10141
|
-
});
|
|
10142
|
-
static create({ service, gasLimit }) {
|
|
10143
|
-
return new AutoAccumulate(service, gasLimit);
|
|
10144
|
-
}
|
|
10145
|
-
constructor(
|
|
10146
|
-
/** Service id that auto-accumulates. */
|
|
10147
|
-
service,
|
|
10148
|
-
/** Gas limit for auto-accumulation. */
|
|
10149
|
-
gasLimit) {
|
|
10150
|
-
this.service = service;
|
|
10151
|
-
this.gasLimit = gasLimit;
|
|
10152
|
-
}
|
|
10153
|
-
}
|
|
10154
10132
|
/**
|
|
10155
10133
|
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
10156
10134
|
*/
|
|
@@ -10168,7 +10146,9 @@ class PrivilegedServices {
|
|
|
10168
10146
|
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
10169
10147
|
? descriptors_codec.u32.asOpaque()
|
|
10170
10148
|
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
10171
|
-
autoAccumulateServices:
|
|
10149
|
+
autoAccumulateServices: descriptors_codec.dictionary(descriptors_codec.u32.asOpaque(), descriptors_codec.u64.asOpaque(), {
|
|
10150
|
+
sortKeys: (a, b) => a - b,
|
|
10151
|
+
}),
|
|
10172
10152
|
});
|
|
10173
10153
|
static create(a) {
|
|
10174
10154
|
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
@@ -10431,6 +10411,15 @@ class InMemoryService extends WithDebug {
|
|
|
10431
10411
|
}),
|
|
10432
10412
|
};
|
|
10433
10413
|
}
|
|
10414
|
+
/** Return identical `InMemoryService` which does not share any references. */
|
|
10415
|
+
clone() {
|
|
10416
|
+
return new InMemoryService(this.serviceId, {
|
|
10417
|
+
info: ServiceAccountInfo.create(this.data.info),
|
|
10418
|
+
preimages: HashDictionary.fromEntries(Array.from(this.data.preimages.entries())),
|
|
10419
|
+
lookupHistory: HashDictionary.fromEntries(Array.from(this.data.lookupHistory.entries()).map(([k, v]) => [k, v.slice()])),
|
|
10420
|
+
storage: new Map(this.data.storage.entries()),
|
|
10421
|
+
});
|
|
10422
|
+
}
|
|
10434
10423
|
/**
|
|
10435
10424
|
* Create a new in-memory service from another state service
|
|
10436
10425
|
* by copying all given entries.
|
|
@@ -10801,7 +10790,7 @@ class InMemoryState extends WithDebug {
|
|
|
10801
10790
|
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
10802
10791
|
delegator: tryAsServiceId(0),
|
|
10803
10792
|
registrar: tryAsServiceId(MAX_VALUE),
|
|
10804
|
-
autoAccumulateServices:
|
|
10793
|
+
autoAccumulateServices: new Map(),
|
|
10805
10794
|
}),
|
|
10806
10795
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
10807
10796
|
services: new Map(),
|
|
@@ -10849,7 +10838,6 @@ var PreimagesErrorCode;
|
|
|
10849
10838
|
PreimagesErrorCode["PreimagesNotSortedUnique"] = "preimages_not_sorted_unique";
|
|
10850
10839
|
PreimagesErrorCode["AccountNotFound"] = "account_not_found";
|
|
10851
10840
|
})(PreimagesErrorCode || (PreimagesErrorCode = {}));
|
|
10852
|
-
// TODO [SeKo] consider whether this module is the right place to remove expired preimages
|
|
10853
10841
|
class Preimages {
|
|
10854
10842
|
state;
|
|
10855
10843
|
blake2b;
|