@typeberry/jam 0.2.0-5746fdc → 0.2.0-663eeb1
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 +42 -53
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +5457 -5366
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +155 -34
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +5994 -5750
- 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;
|
|
@@ -3615,12 +3618,13 @@ class bytes_BytesBlob {
|
|
|
3615
3618
|
}
|
|
3616
3619
|
/** Display a hex-encoded version of this byte blob, but truncated if it's large. */
|
|
3617
3620
|
toStringTruncated() {
|
|
3621
|
+
const bytes = `${this.raw.length} ${this.raw.length === 1 ? "byte" : "bytes"}`;
|
|
3618
3622
|
if (this.raw.length > 32) {
|
|
3619
3623
|
const start = bytesToHexString(this.raw.subarray(0, 16));
|
|
3620
3624
|
const end = bytesToHexString(this.raw.subarray(this.raw.length - 16));
|
|
3621
|
-
return `${start}...${end.substring(2)} (${
|
|
3625
|
+
return `${start}...${end.substring(2)} (${bytes})`;
|
|
3622
3626
|
}
|
|
3623
|
-
return this.toString()
|
|
3627
|
+
return `${this.toString()} (${bytes})`;
|
|
3624
3628
|
}
|
|
3625
3629
|
toJSON() {
|
|
3626
3630
|
return this.toString();
|
|
@@ -7355,6 +7359,8 @@ const EC_SEGMENT_SIZE = 4104;
|
|
|
7355
7359
|
* Additional data that has to be passed to the codec to correctly parse incoming bytes.
|
|
7356
7360
|
*/
|
|
7357
7361
|
class ChainSpec extends WithDebug {
|
|
7362
|
+
/** Human-readable name of the chain spec. */
|
|
7363
|
+
name;
|
|
7358
7364
|
/** Number of validators. */
|
|
7359
7365
|
validatorsCount;
|
|
7360
7366
|
/** 1/3 of number of validators */
|
|
@@ -7397,6 +7403,7 @@ class ChainSpec extends WithDebug {
|
|
|
7397
7403
|
maxLookupAnchorAge;
|
|
7398
7404
|
constructor(data) {
|
|
7399
7405
|
super();
|
|
7406
|
+
this.name = data.name;
|
|
7400
7407
|
this.validatorsCount = data.validatorsCount;
|
|
7401
7408
|
this.thirdOfValidators = numbers_tryAsU16(Math.floor(data.validatorsCount / 3));
|
|
7402
7409
|
this.validatorsSuperMajority = numbers_tryAsU16(Math.floor(data.validatorsCount / 3) * 2 + 1);
|
|
@@ -7417,6 +7424,7 @@ class ChainSpec extends WithDebug {
|
|
|
7417
7424
|
}
|
|
7418
7425
|
/** Set of values for "tiny" chain as defined in JAM test vectors. */
|
|
7419
7426
|
const tinyChainSpec = new ChainSpec({
|
|
7427
|
+
name: "tiny",
|
|
7420
7428
|
validatorsCount: numbers_tryAsU16(6),
|
|
7421
7429
|
coresCount: numbers_tryAsU16(2),
|
|
7422
7430
|
epochLength: numbers_tryAsU32(12),
|
|
@@ -7438,6 +7446,7 @@ const tinyChainSpec = new ChainSpec({
|
|
|
7438
7446
|
* Please note that only validatorsCount and epochLength are "full", the rest is copied from "tiny".
|
|
7439
7447
|
*/
|
|
7440
7448
|
const fullChainSpec = new ChainSpec({
|
|
7449
|
+
name: "full",
|
|
7441
7450
|
validatorsCount: numbers_tryAsU16(1023),
|
|
7442
7451
|
coresCount: numbers_tryAsU16(341),
|
|
7443
7452
|
epochLength: numbers_tryAsU32(600),
|
|
@@ -9013,7 +9022,6 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
9013
9022
|
|
|
9014
9023
|
|
|
9015
9024
|
|
|
9016
|
-
|
|
9017
9025
|
/** Helper function to create most used hashes in the block */
|
|
9018
9026
|
class TransitionHasher {
|
|
9019
9027
|
context;
|
|
@@ -9062,15 +9070,6 @@ class TransitionHasher {
|
|
|
9062
9070
|
const encoded = bytes_BytesBlob.blobFromParts([et.raw, ep.raw, eg.raw, ea.raw, ed.raw]);
|
|
9063
9071
|
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), extrinsicView, encoded);
|
|
9064
9072
|
}
|
|
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
9073
|
}
|
|
9075
9074
|
|
|
9076
9075
|
;// CONCATENATED MODULE: ./packages/jam/state/accumulation-output.ts
|
|
@@ -9105,7 +9104,7 @@ function accumulationOutputComparator(a, b) {
|
|
|
9105
9104
|
if (result > 0) {
|
|
9106
9105
|
return Ordering.Greater;
|
|
9107
9106
|
}
|
|
9108
|
-
return
|
|
9107
|
+
return a.output.compare(b.output);
|
|
9109
9108
|
}
|
|
9110
9109
|
|
|
9111
9110
|
;// CONCATENATED MODULE: ./packages/jam/block/gp-constants.ts
|
|
@@ -10131,26 +10130,6 @@ class InMemoryStateView {
|
|
|
10131
10130
|
|
|
10132
10131
|
|
|
10133
10132
|
|
|
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
10133
|
/**
|
|
10155
10134
|
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
10156
10135
|
*/
|
|
@@ -10168,7 +10147,9 @@ class PrivilegedServices {
|
|
|
10168
10147
|
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
10169
10148
|
? descriptors_codec.u32.asOpaque()
|
|
10170
10149
|
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
10171
|
-
autoAccumulateServices:
|
|
10150
|
+
autoAccumulateServices: descriptors_codec.dictionary(descriptors_codec.u32.asOpaque(), descriptors_codec.u64.asOpaque(), {
|
|
10151
|
+
sortKeys: (a, b) => a - b,
|
|
10152
|
+
}),
|
|
10172
10153
|
});
|
|
10173
10154
|
static create(a) {
|
|
10174
10155
|
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
@@ -10431,6 +10412,15 @@ class InMemoryService extends WithDebug {
|
|
|
10431
10412
|
}),
|
|
10432
10413
|
};
|
|
10433
10414
|
}
|
|
10415
|
+
/** Return identical `InMemoryService` which does not share any references. */
|
|
10416
|
+
clone() {
|
|
10417
|
+
return new InMemoryService(this.serviceId, {
|
|
10418
|
+
info: ServiceAccountInfo.create(this.data.info),
|
|
10419
|
+
preimages: HashDictionary.fromEntries(Array.from(this.data.preimages.entries())),
|
|
10420
|
+
lookupHistory: HashDictionary.fromEntries(Array.from(this.data.lookupHistory.entries()).map(([k, v]) => [k, v.slice()])),
|
|
10421
|
+
storage: new Map(this.data.storage.entries()),
|
|
10422
|
+
});
|
|
10423
|
+
}
|
|
10434
10424
|
/**
|
|
10435
10425
|
* Create a new in-memory service from another state service
|
|
10436
10426
|
* by copying all given entries.
|
|
@@ -10801,7 +10791,7 @@ class InMemoryState extends WithDebug {
|
|
|
10801
10791
|
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
10802
10792
|
delegator: tryAsServiceId(0),
|
|
10803
10793
|
registrar: tryAsServiceId(MAX_VALUE),
|
|
10804
|
-
autoAccumulateServices:
|
|
10794
|
+
autoAccumulateServices: new Map(),
|
|
10805
10795
|
}),
|
|
10806
10796
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
10807
10797
|
services: new Map(),
|
|
@@ -10849,7 +10839,6 @@ var PreimagesErrorCode;
|
|
|
10849
10839
|
PreimagesErrorCode["PreimagesNotSortedUnique"] = "preimages_not_sorted_unique";
|
|
10850
10840
|
PreimagesErrorCode["AccountNotFound"] = "account_not_found";
|
|
10851
10841
|
})(PreimagesErrorCode || (PreimagesErrorCode = {}));
|
|
10852
|
-
// TODO [SeKo] consider whether this module is the right place to remove expired preimages
|
|
10853
10842
|
class Preimages {
|
|
10854
10843
|
state;
|
|
10855
10844
|
blake2b;
|