@typeberry/jam 0.2.0-c96e8ef → 0.2.0-ca77d76
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 +55 -53
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +6029 -5287
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +169 -33
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +4592 -3675
- package/index.js.map +1 -1
- package/package.json +1 -1
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),
|
|
@@ -7453,10 +7462,23 @@ const fullChainSpec = new ChainSpec({
|
|
|
7453
7462
|
maxLookupAnchorAge: numbers_tryAsU32(14_400),
|
|
7454
7463
|
});
|
|
7455
7464
|
|
|
7465
|
+
;// CONCATENATED MODULE: ./packages/jam/config/pvm-backend.ts
|
|
7466
|
+
/** Implemented PVM Backends names in THE SAME ORDER as enum. */
|
|
7467
|
+
const PvmBackendNames = (/* unused pure expression or super */ null && (["built-in", "ananas"]));
|
|
7468
|
+
/** Implemented PVM Backends to choose from. */
|
|
7469
|
+
var PvmBackend;
|
|
7470
|
+
(function (PvmBackend) {
|
|
7471
|
+
/** Built-in aka. Typeberry 🫐 interpreter. */
|
|
7472
|
+
PvmBackend[PvmBackend["BuiltIn"] = 0] = "BuiltIn";
|
|
7473
|
+
/** Ananas 🍍 interpreter. */
|
|
7474
|
+
PvmBackend[PvmBackend["Ananas"] = 1] = "Ananas";
|
|
7475
|
+
})(PvmBackend || (PvmBackend = {}));
|
|
7476
|
+
|
|
7456
7477
|
;// CONCATENATED MODULE: ./packages/jam/config/index.ts
|
|
7457
7478
|
|
|
7458
7479
|
|
|
7459
7480
|
|
|
7481
|
+
|
|
7460
7482
|
;// CONCATENATED MODULE: ./packages/jam/block/codec.ts
|
|
7461
7483
|
|
|
7462
7484
|
|
|
@@ -9000,7 +9022,6 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
9000
9022
|
|
|
9001
9023
|
|
|
9002
9024
|
|
|
9003
|
-
|
|
9004
9025
|
/** Helper function to create most used hashes in the block */
|
|
9005
9026
|
class TransitionHasher {
|
|
9006
9027
|
context;
|
|
@@ -9049,15 +9070,6 @@ class TransitionHasher {
|
|
|
9049
9070
|
const encoded = bytes_BytesBlob.blobFromParts([et.raw, ep.raw, eg.raw, ea.raw, ed.raw]);
|
|
9050
9071
|
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), extrinsicView, encoded);
|
|
9051
9072
|
}
|
|
9052
|
-
/** Creates hash for given WorkPackage */
|
|
9053
|
-
workPackage(workPackage) {
|
|
9054
|
-
return this.encode(WorkPackage.Codec, workPackage);
|
|
9055
|
-
}
|
|
9056
|
-
encode(codec, data) {
|
|
9057
|
-
// TODO [ToDr] Use already allocated encoding destination and hash bytes from some arena.
|
|
9058
|
-
const encoded = Encoder.encodeObject(codec, data, this.context);
|
|
9059
|
-
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), data, encoded);
|
|
9060
|
-
}
|
|
9061
9073
|
}
|
|
9062
9074
|
|
|
9063
9075
|
;// CONCATENATED MODULE: ./packages/jam/state/accumulation-output.ts
|
|
@@ -9092,7 +9104,7 @@ function accumulationOutputComparator(a, b) {
|
|
|
9092
9104
|
if (result > 0) {
|
|
9093
9105
|
return Ordering.Greater;
|
|
9094
9106
|
}
|
|
9095
|
-
return
|
|
9107
|
+
return a.output.compare(b.output);
|
|
9096
9108
|
}
|
|
9097
9109
|
|
|
9098
9110
|
;// CONCATENATED MODULE: ./packages/jam/block/gp-constants.ts
|
|
@@ -10118,26 +10130,6 @@ class InMemoryStateView {
|
|
|
10118
10130
|
|
|
10119
10131
|
|
|
10120
10132
|
|
|
10121
|
-
/** Dictionary entry of services that auto-accumulate every block. */
|
|
10122
|
-
class AutoAccumulate {
|
|
10123
|
-
service;
|
|
10124
|
-
gasLimit;
|
|
10125
|
-
static Codec = descriptors_codec.Class(AutoAccumulate, {
|
|
10126
|
-
service: descriptors_codec.u32.asOpaque(),
|
|
10127
|
-
gasLimit: descriptors_codec.u64.asOpaque(),
|
|
10128
|
-
});
|
|
10129
|
-
static create({ service, gasLimit }) {
|
|
10130
|
-
return new AutoAccumulate(service, gasLimit);
|
|
10131
|
-
}
|
|
10132
|
-
constructor(
|
|
10133
|
-
/** Service id that auto-accumulates. */
|
|
10134
|
-
service,
|
|
10135
|
-
/** Gas limit for auto-accumulation. */
|
|
10136
|
-
gasLimit) {
|
|
10137
|
-
this.service = service;
|
|
10138
|
-
this.gasLimit = gasLimit;
|
|
10139
|
-
}
|
|
10140
|
-
}
|
|
10141
10133
|
/**
|
|
10142
10134
|
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
10143
10135
|
*/
|
|
@@ -10155,7 +10147,9 @@ class PrivilegedServices {
|
|
|
10155
10147
|
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
10156
10148
|
? descriptors_codec.u32.asOpaque()
|
|
10157
10149
|
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
10158
|
-
autoAccumulateServices:
|
|
10150
|
+
autoAccumulateServices: descriptors_codec.dictionary(descriptors_codec.u32.asOpaque(), descriptors_codec.u64.asOpaque(), {
|
|
10151
|
+
sortKeys: (a, b) => a - b,
|
|
10152
|
+
}),
|
|
10159
10153
|
});
|
|
10160
10154
|
static create(a) {
|
|
10161
10155
|
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
@@ -10418,6 +10412,15 @@ class InMemoryService extends WithDebug {
|
|
|
10418
10412
|
}),
|
|
10419
10413
|
};
|
|
10420
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
|
+
}
|
|
10421
10424
|
/**
|
|
10422
10425
|
* Create a new in-memory service from another state service
|
|
10423
10426
|
* by copying all given entries.
|
|
@@ -10788,7 +10791,7 @@ class InMemoryState extends WithDebug {
|
|
|
10788
10791
|
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
10789
10792
|
delegator: tryAsServiceId(0),
|
|
10790
10793
|
registrar: tryAsServiceId(MAX_VALUE),
|
|
10791
|
-
autoAccumulateServices:
|
|
10794
|
+
autoAccumulateServices: new Map(),
|
|
10792
10795
|
}),
|
|
10793
10796
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
10794
10797
|
services: new Map(),
|
|
@@ -10836,7 +10839,6 @@ var PreimagesErrorCode;
|
|
|
10836
10839
|
PreimagesErrorCode["PreimagesNotSortedUnique"] = "preimages_not_sorted_unique";
|
|
10837
10840
|
PreimagesErrorCode["AccountNotFound"] = "account_not_found";
|
|
10838
10841
|
})(PreimagesErrorCode || (PreimagesErrorCode = {}));
|
|
10839
|
-
// TODO [SeKo] consider whether this module is the right place to remove expired preimages
|
|
10840
10842
|
class Preimages {
|
|
10841
10843
|
state;
|
|
10842
10844
|
blake2b;
|