@typeberry/jam 0.5.7-f0cc874 → 0.5.8-0dea783
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 +27 -1
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +1 -1
- package/bootstrap-network.mjs +1 -1
- package/index.js +27 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/bootstrap-generator.mjs
CHANGED
|
@@ -6259,7 +6259,7 @@ function seeThrough(v) {
|
|
|
6259
6259
|
}
|
|
6260
6260
|
|
|
6261
6261
|
;// CONCATENATED MODULE: ./packages/core/utils/package.json
|
|
6262
|
-
const package_namespaceObject = {"rE":"0.5.
|
|
6262
|
+
const package_namespaceObject = {"rE":"0.5.8"};
|
|
6263
6263
|
;// CONCATENATED MODULE: ./packages/core/utils/result.ts
|
|
6264
6264
|
|
|
6265
6265
|
/**
|
|
@@ -28475,7 +28475,15 @@ async function main(config, comms, networkingComms) {
|
|
|
28475
28475
|
ed25519Secret: secrets.ed25519,
|
|
28476
28476
|
ed25519Public: await deriveEd25519PublicKey(secrets.ed25519),
|
|
28477
28477
|
})));
|
|
28478
|
+
const initialHash = blocks.getBestHeaderHash();
|
|
28479
|
+
const initialState = states.getState(initialHash);
|
|
28478
28480
|
main_logger.info `Block authorship validator keys: ${keys.map(({ bandersnatchPublic }, index) => `\n ${index}: ${bandersnatchPublic.toString()}`)}`;
|
|
28481
|
+
if (initialState !== null) {
|
|
28482
|
+
const initialKeys = await getSealingKeySeries(startTimeSlot % chainSpec.epochLength === 0, startTimeSlot, initialState);
|
|
28483
|
+
if (initialKeys.isOk) {
|
|
28484
|
+
logEpochBlockCreation(tryAsEpoch(Math.floor(startTimeSlot / chainSpec.epochLength)), initialKeys.ok);
|
|
28485
|
+
}
|
|
28486
|
+
}
|
|
28479
28487
|
function getTime() {
|
|
28480
28488
|
const currentTime = process.hrtime.bigint() / 1000000n;
|
|
28481
28489
|
const timeFromStart = currentTime - startTime;
|
|
@@ -28511,6 +28519,21 @@ async function main(config, comms, networkingComms) {
|
|
|
28511
28519
|
const currentEpoch = Math.floor(currentTimeslot / chainSpec.epochLength);
|
|
28512
28520
|
return currentEpoch > lastEpoch;
|
|
28513
28521
|
}
|
|
28522
|
+
function logEpochBlockCreation(epoch, sealingKeySeries) {
|
|
28523
|
+
let isCreating = false;
|
|
28524
|
+
const epochStart = epoch * chainSpec.epochLength;
|
|
28525
|
+
const epochEnd = epochStart + chainSpec.epochLength;
|
|
28526
|
+
for (let slot = epochStart; slot < epochEnd; slot++) {
|
|
28527
|
+
const key = getKeyForCurrentSlot(sealingKeySeries, keys, common_tryAsTimeSlot(slot));
|
|
28528
|
+
if (key !== null) {
|
|
28529
|
+
isCreating = true;
|
|
28530
|
+
main_logger.info `[EPOCH ${epoch}] Validator ${key.bandersnatchPublic.toString()} will author block at slot ${slot}`;
|
|
28531
|
+
}
|
|
28532
|
+
}
|
|
28533
|
+
if (isCreating === false) {
|
|
28534
|
+
main_logger.info `[EPOCH ${epoch}] No blocks to author for this epoch.`;
|
|
28535
|
+
}
|
|
28536
|
+
}
|
|
28514
28537
|
async function getSealingKeySeries(isNewEpoch, timeSlot, state) {
|
|
28515
28538
|
if (isNewEpoch) {
|
|
28516
28539
|
const safrole = new safrole_Safrole(chainSpec, blake2bHasher, state);
|
|
@@ -28579,6 +28602,9 @@ async function main(config, comms, networkingComms) {
|
|
|
28579
28602
|
if (selingKeySeriesResult.isError) {
|
|
28580
28603
|
continue;
|
|
28581
28604
|
}
|
|
28605
|
+
if (isNewEpoch) {
|
|
28606
|
+
logEpochBlockCreation(epoch, selingKeySeriesResult.ok);
|
|
28607
|
+
}
|
|
28582
28608
|
const key = getKeyForCurrentSlot(selingKeySeriesResult.ok, keys, timeSlot);
|
|
28583
28609
|
if (key !== null && currentValidatorData !== undefined) {
|
|
28584
28610
|
const validatorIndex = getValidatorIndex(key, currentValidatorData);
|