@typeberry/jam 0.0.5-6e657f4 → 0.0.5-ab52154
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/block-generator/index.js +4 -5
- package/block-generator/index.js.map +1 -1
- package/importer/index.js +8 -9
- package/importer/index.js.map +1 -1
- package/index.js +120 -116
- package/index.js.map +1 -1
- package/jam-network/index.js +2975 -2971
- package/jam-network/index.js.map +1 -1
- package/package.json +1 -1
package/importer/index.js
CHANGED
|
@@ -13395,7 +13395,6 @@ const GLOBAL_CONFIG = {
|
|
|
13395
13395
|
*/
|
|
13396
13396
|
class Logger {
|
|
13397
13397
|
moduleName;
|
|
13398
|
-
fileName;
|
|
13399
13398
|
config;
|
|
13400
13399
|
/**
|
|
13401
13400
|
* Create a new logger instance given filename and an optional module name.
|
|
@@ -13408,7 +13407,8 @@ class Logger {
|
|
|
13408
13407
|
*/
|
|
13409
13408
|
static new(fileName, moduleName) {
|
|
13410
13409
|
const fName = fileName ?? "unknown";
|
|
13411
|
-
|
|
13410
|
+
const module = moduleName ?? fName;
|
|
13411
|
+
return new Logger(module.padStart(8, " "), GLOBAL_CONFIG);
|
|
13412
13412
|
}
|
|
13413
13413
|
/**
|
|
13414
13414
|
* Return currently configured level for given module. */
|
|
@@ -13445,9 +13445,8 @@ class Logger {
|
|
|
13445
13445
|
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
13446
13446
|
Logger.configureAllFromOptions(options);
|
|
13447
13447
|
}
|
|
13448
|
-
constructor(moduleName,
|
|
13448
|
+
constructor(moduleName, config) {
|
|
13449
13449
|
this.moduleName = moduleName;
|
|
13450
|
-
this.fileName = fileName;
|
|
13451
13450
|
this.config = config;
|
|
13452
13451
|
}
|
|
13453
13452
|
/** Log a message with `INSANE` level. */
|
|
@@ -20167,14 +20166,14 @@ function compareWithEncoding(chainSpec, error, actual, expected, codec) {
|
|
|
20167
20166
|
if (actual === null || expected === null) {
|
|
20168
20167
|
// if one of them is `null`, both need to be.
|
|
20169
20168
|
if (actual !== expected) {
|
|
20170
|
-
return result_Result.error(error,
|
|
20169
|
+
return result_Result.error(error, `${SafroleErrorCode[error]} Expected: ${expected}, got: ${actual}`);
|
|
20171
20170
|
}
|
|
20172
20171
|
return result_Result.ok(result_OK);
|
|
20173
20172
|
}
|
|
20174
20173
|
// compare the literal encoding.
|
|
20175
20174
|
const encoded = encoder_Encoder.encodeObject(codec, actual, chainSpec);
|
|
20176
20175
|
if (!encoded.isEqualTo(expected.encoded())) {
|
|
20177
|
-
return result_Result.error(error,
|
|
20176
|
+
return result_Result.error(error, `${SafroleErrorCode[error]} Expected: ${expected.encoded()}, got: ${encoded}`);
|
|
20178
20177
|
}
|
|
20179
20178
|
return result_Result.ok(result_OK);
|
|
20180
20179
|
}
|
|
@@ -20253,7 +20252,7 @@ class SafroleSeal {
|
|
|
20253
20252
|
const index = timeSlot % keys.length;
|
|
20254
20253
|
const sealingKey = keys[index];
|
|
20255
20254
|
if (!sealingKey.isEqualTo(authorKey.bandersnatch)) {
|
|
20256
|
-
return result_Result.error(SafroleSealError.InvalidValidator, `Expected: ${sealingKey}, got: ${authorKey.bandersnatch}`);
|
|
20255
|
+
return result_Result.error(SafroleSealError.InvalidValidator, `Invalid Validator. Expected: ${sealingKey}, got: ${authorKey.bandersnatch}`);
|
|
20257
20256
|
}
|
|
20258
20257
|
// verify seal correctness
|
|
20259
20258
|
const payload = bytes_BytesBlob.blobFromParts(JAM_FALLBACK_SEAL, entropy.raw);
|
|
@@ -25739,7 +25738,7 @@ class ImporterReady extends State {
|
|
|
25739
25738
|
const timeSlot = headerView.timeSlotIndex.materialize();
|
|
25740
25739
|
let response;
|
|
25741
25740
|
try {
|
|
25742
|
-
const res = await this.importer.importBlock(blockView, null);
|
|
25741
|
+
const res = await this.importer.importBlock(blockView, null, config.omitSealVerification);
|
|
25743
25742
|
if (res.isOk) {
|
|
25744
25743
|
state_machine_logger.info(`🧊 Best block: #${timeSlot} (${res.ok.hash})`);
|
|
25745
25744
|
response = result_Result.ok(this.importer.getBestStateRootHash() ?? bytes_Bytes.zero(hash_HASH_SIZE).asOpaque());
|
|
@@ -25845,7 +25844,7 @@ async function main(channel) {
|
|
|
25845
25844
|
importer_logger.trace(`🧊 Already queued block: #${details.ok.data.timeSlot}.`);
|
|
25846
25845
|
return;
|
|
25847
25846
|
}
|
|
25848
|
-
importer_logger.log(`🧊 Queued block: #${details.ok.data.timeSlot}`);
|
|
25847
|
+
importer_logger.log(`🧊 Queued block: #${details.ok.data.timeSlot} (skip seal: ${config.omitSealVerification})`);
|
|
25849
25848
|
if (isProcessing) {
|
|
25850
25849
|
return;
|
|
25851
25850
|
}
|