@typeberry/jam 0.2.0-79dc2d4 → 0.2.0-9cdd1b8
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/bootstrap-generator.mjs +15 -12
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +7447 -7388
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +6 -1
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +4964 -4900
- package/index.js.map +1 -1
- package/package.json +2 -3
package/bootstrap-generator.mjs
CHANGED
|
@@ -7358,6 +7358,8 @@ const EC_SEGMENT_SIZE = 4104;
|
|
|
7358
7358
|
* Additional data that has to be passed to the codec to correctly parse incoming bytes.
|
|
7359
7359
|
*/
|
|
7360
7360
|
class ChainSpec extends WithDebug {
|
|
7361
|
+
/** Human-readable name of the chain spec. */
|
|
7362
|
+
name;
|
|
7361
7363
|
/** Number of validators. */
|
|
7362
7364
|
validatorsCount;
|
|
7363
7365
|
/** 1/3 of number of validators */
|
|
@@ -7400,6 +7402,7 @@ class ChainSpec extends WithDebug {
|
|
|
7400
7402
|
maxLookupAnchorAge;
|
|
7401
7403
|
constructor(data) {
|
|
7402
7404
|
super();
|
|
7405
|
+
this.name = data.name;
|
|
7403
7406
|
this.validatorsCount = data.validatorsCount;
|
|
7404
7407
|
this.thirdOfValidators = numbers_tryAsU16(Math.floor(data.validatorsCount / 3));
|
|
7405
7408
|
this.validatorsSuperMajority = numbers_tryAsU16(Math.floor(data.validatorsCount / 3) * 2 + 1);
|
|
@@ -7420,6 +7423,7 @@ class ChainSpec extends WithDebug {
|
|
|
7420
7423
|
}
|
|
7421
7424
|
/** Set of values for "tiny" chain as defined in JAM test vectors. */
|
|
7422
7425
|
const tinyChainSpec = new ChainSpec({
|
|
7426
|
+
name: "tiny",
|
|
7423
7427
|
validatorsCount: numbers_tryAsU16(6),
|
|
7424
7428
|
coresCount: numbers_tryAsU16(2),
|
|
7425
7429
|
epochLength: numbers_tryAsU32(12),
|
|
@@ -7441,6 +7445,7 @@ const tinyChainSpec = new ChainSpec({
|
|
|
7441
7445
|
* Please note that only validatorsCount and epochLength are "full", the rest is copied from "tiny".
|
|
7442
7446
|
*/
|
|
7443
7447
|
const fullChainSpec = new ChainSpec({
|
|
7448
|
+
name: "full",
|
|
7444
7449
|
validatorsCount: numbers_tryAsU16(1023),
|
|
7445
7450
|
coresCount: numbers_tryAsU16(341),
|
|
7446
7451
|
epochLength: numbers_tryAsU32(600),
|
|
@@ -9016,7 +9021,6 @@ function reencodeAsView(codec, object, chainSpec) {
|
|
|
9016
9021
|
|
|
9017
9022
|
|
|
9018
9023
|
|
|
9019
|
-
|
|
9020
9024
|
/** Helper function to create most used hashes in the block */
|
|
9021
9025
|
class TransitionHasher {
|
|
9022
9026
|
context;
|
|
@@ -9065,15 +9069,6 @@ class TransitionHasher {
|
|
|
9065
9069
|
const encoded = bytes_BytesBlob.blobFromParts([et.raw, ep.raw, eg.raw, ea.raw, ed.raw]);
|
|
9066
9070
|
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), extrinsicView, encoded);
|
|
9067
9071
|
}
|
|
9068
|
-
/** Creates hash for given WorkPackage */
|
|
9069
|
-
workPackage(workPackage) {
|
|
9070
|
-
return this.encode(WorkPackage.Codec, workPackage);
|
|
9071
|
-
}
|
|
9072
|
-
encode(codec, data) {
|
|
9073
|
-
// TODO [ToDr] Use already allocated encoding destination and hash bytes from some arena.
|
|
9074
|
-
const encoded = Encoder.encodeObject(codec, data, this.context);
|
|
9075
|
-
return new WithHashAndBytes(this.blake2b.hashBytes(encoded).asOpaque(), data, encoded);
|
|
9076
|
-
}
|
|
9077
9072
|
}
|
|
9078
9073
|
|
|
9079
9074
|
;// CONCATENATED MODULE: ./packages/jam/state/accumulation-output.ts
|
|
@@ -9108,7 +9103,7 @@ function accumulationOutputComparator(a, b) {
|
|
|
9108
9103
|
if (result > 0) {
|
|
9109
9104
|
return Ordering.Greater;
|
|
9110
9105
|
}
|
|
9111
|
-
return
|
|
9106
|
+
return a.output.compare(b.output);
|
|
9112
9107
|
}
|
|
9113
9108
|
|
|
9114
9109
|
;// CONCATENATED MODULE: ./packages/jam/block/gp-constants.ts
|
|
@@ -10416,6 +10411,15 @@ class InMemoryService extends WithDebug {
|
|
|
10416
10411
|
}),
|
|
10417
10412
|
};
|
|
10418
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
|
+
}
|
|
10419
10423
|
/**
|
|
10420
10424
|
* Create a new in-memory service from another state service
|
|
10421
10425
|
* by copying all given entries.
|
|
@@ -10834,7 +10838,6 @@ var PreimagesErrorCode;
|
|
|
10834
10838
|
PreimagesErrorCode["PreimagesNotSortedUnique"] = "preimages_not_sorted_unique";
|
|
10835
10839
|
PreimagesErrorCode["AccountNotFound"] = "account_not_found";
|
|
10836
10840
|
})(PreimagesErrorCode || (PreimagesErrorCode = {}));
|
|
10837
|
-
// TODO [SeKo] consider whether this module is the right place to remove expired preimages
|
|
10838
10841
|
class Preimages {
|
|
10839
10842
|
state;
|
|
10840
10843
|
blake2b;
|