@typeberry/jam 0.1.1-b537c8b → 0.1.1-e48de40
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 +132 -94
- package/block-generator/index.js.map +1 -1
- package/importer/index.js +214 -176
- package/importer/index.js.map +1 -1
- package/index.js +374 -340
- package/index.js.map +1 -1
- package/jam-network/index.js +198 -162
- package/jam-network/index.js.map +1 -1
- package/package.json +4 -2
package/block-generator/index.js
CHANGED
|
@@ -3766,6 +3766,34 @@ class WithDebug {
|
|
|
3766
3766
|
}
|
|
3767
3767
|
}
|
|
3768
3768
|
|
|
3769
|
+
;// CONCATENATED MODULE: ./packages/core/utils/dev.ts
|
|
3770
|
+
const dev_env = typeof process === "undefined" ? {} : process.env;
|
|
3771
|
+
/**
|
|
3772
|
+
* The function will produce relative path resolver that is adjusted
|
|
3773
|
+
* for package location within the workspace.
|
|
3774
|
+
*
|
|
3775
|
+
* Example:
|
|
3776
|
+
* $ npm start -w @typeberry/jam
|
|
3777
|
+
*
|
|
3778
|
+
* The above command will run `./bin/jam/index.js`, however we would
|
|
3779
|
+
* still want relative paths to be resolved according to top-level workspace
|
|
3780
|
+
* directory.
|
|
3781
|
+
*
|
|
3782
|
+
* So the caller, passes the absolute workspace path as argument and get's
|
|
3783
|
+
* a function that can properly resolve relative paths.
|
|
3784
|
+
*
|
|
3785
|
+
* NOTE: the translation happens only for development build! When
|
|
3786
|
+
* we build a single library from our project, we no longer mangle the paths.
|
|
3787
|
+
*/
|
|
3788
|
+
const workspacePathFix = dev_env.NODE_ENV === "development"
|
|
3789
|
+
? (workspacePath) => (p) => {
|
|
3790
|
+
if (p.startsWith("/")) {
|
|
3791
|
+
return p;
|
|
3792
|
+
}
|
|
3793
|
+
return `${workspacePath}/${p}`;
|
|
3794
|
+
}
|
|
3795
|
+
: () => (p) => p;
|
|
3796
|
+
|
|
3769
3797
|
;// CONCATENATED MODULE: ./packages/core/utils/opaque.ts
|
|
3770
3798
|
/**
|
|
3771
3799
|
* @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
@@ -4109,6 +4137,7 @@ function isResult(x) {
|
|
|
4109
4137
|
|
|
4110
4138
|
|
|
4111
4139
|
|
|
4140
|
+
|
|
4112
4141
|
;// CONCATENATED MODULE: ./packages/core/bytes/bitvec.ts
|
|
4113
4142
|
|
|
4114
4143
|
/**
|
|
@@ -12946,6 +12975,23 @@ function parseLevel(lvl) {
|
|
|
12946
12975
|
;// CONCATENATED MODULE: ./packages/core/logger/console.ts
|
|
12947
12976
|
// biome-ignore-all lint/suspicious/noConsole: logger
|
|
12948
12977
|
|
|
12978
|
+
function print(level, levelAndName, strings, data) {
|
|
12979
|
+
if (level < levelAndName[0]) {
|
|
12980
|
+
return;
|
|
12981
|
+
}
|
|
12982
|
+
const lvlText = Level[level].padEnd(5);
|
|
12983
|
+
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
12984
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
12985
|
+
if (level === Level.WARN) {
|
|
12986
|
+
console.warn(msg);
|
|
12987
|
+
}
|
|
12988
|
+
else if (level === Level.ERROR) {
|
|
12989
|
+
console.error(msg);
|
|
12990
|
+
}
|
|
12991
|
+
else {
|
|
12992
|
+
console.info(msg);
|
|
12993
|
+
}
|
|
12994
|
+
}
|
|
12949
12995
|
/** An optimized logger that ignores `TRACE`, `DEBUG` and `LOG` messages.
|
|
12950
12996
|
*
|
|
12951
12997
|
* Use the `create` method to instantiate the right instance of a more specialized logger.
|
|
@@ -12976,109 +13022,91 @@ class ConsoleTransport {
|
|
|
12976
13022
|
constructor(options) {
|
|
12977
13023
|
this.options = options;
|
|
12978
13024
|
}
|
|
12979
|
-
insane(
|
|
13025
|
+
insane(_levelAndName, _strings, _data) {
|
|
12980
13026
|
/* no-op */
|
|
12981
13027
|
}
|
|
12982
|
-
trace(
|
|
13028
|
+
trace(_levelAndName, _strings, _data) {
|
|
12983
13029
|
/* no-op */
|
|
12984
13030
|
}
|
|
12985
|
-
log(
|
|
13031
|
+
log(_levelAndName, _strings, _data) {
|
|
12986
13032
|
/* no-op */
|
|
12987
13033
|
}
|
|
12988
|
-
info(
|
|
13034
|
+
info(_levelAndName, _strings, _data) {
|
|
12989
13035
|
/* no-op */
|
|
12990
13036
|
}
|
|
12991
|
-
warn(
|
|
12992
|
-
|
|
12993
|
-
}
|
|
12994
|
-
error(moduleName, val) {
|
|
12995
|
-
this.push(Level.ERROR, moduleName, val);
|
|
13037
|
+
warn(levelAndName, strings, data) {
|
|
13038
|
+
print(Level.WARN, levelAndName, strings, data);
|
|
12996
13039
|
}
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
const configuredLevel = findLevel(this.options, moduleName);
|
|
13000
|
-
const lvlText = Level[level].padEnd(5);
|
|
13001
|
-
if (level < configuredLevel) {
|
|
13002
|
-
return;
|
|
13003
|
-
}
|
|
13004
|
-
const msg = `${lvlText} [${shortModule}] ${val}`;
|
|
13005
|
-
if (level === Level.WARN) {
|
|
13006
|
-
console.warn(msg);
|
|
13007
|
-
}
|
|
13008
|
-
else if (level === Level.ERROR) {
|
|
13009
|
-
console.error(msg);
|
|
13010
|
-
}
|
|
13011
|
-
else {
|
|
13012
|
-
console.info(msg);
|
|
13013
|
-
}
|
|
13040
|
+
error(levelAndName, strings, data) {
|
|
13041
|
+
print(Level.ERROR, levelAndName, strings, data);
|
|
13014
13042
|
}
|
|
13015
13043
|
}
|
|
13016
13044
|
/**
|
|
13017
13045
|
* Insane version of console logger - supports insane level.
|
|
13018
13046
|
*/
|
|
13019
13047
|
class InsaneConsoleLogger extends ConsoleTransport {
|
|
13020
|
-
insane(
|
|
13021
|
-
|
|
13048
|
+
insane(levelAndName, strings, data) {
|
|
13049
|
+
print(Level.INSANE, levelAndName, strings, data);
|
|
13022
13050
|
}
|
|
13023
|
-
trace(
|
|
13024
|
-
|
|
13051
|
+
trace(levelAndName, strings, data) {
|
|
13052
|
+
print(Level.TRACE, levelAndName, strings, data);
|
|
13025
13053
|
}
|
|
13026
|
-
log(
|
|
13027
|
-
|
|
13054
|
+
log(levelAndName, strings, data) {
|
|
13055
|
+
print(Level.LOG, levelAndName, strings, data);
|
|
13028
13056
|
}
|
|
13029
|
-
info(
|
|
13030
|
-
|
|
13057
|
+
info(levelAndName, strings, data) {
|
|
13058
|
+
print(Level.INFO, levelAndName, strings, data);
|
|
13031
13059
|
}
|
|
13032
13060
|
}
|
|
13033
13061
|
/**
|
|
13034
13062
|
* A basic version of console logger - printing everything.
|
|
13035
13063
|
*/
|
|
13036
13064
|
class TraceConsoleTransport extends ConsoleTransport {
|
|
13037
|
-
insane(
|
|
13065
|
+
insane(_levelAndName, _strings, _data) {
|
|
13038
13066
|
/* no-op */
|
|
13039
13067
|
}
|
|
13040
|
-
trace(
|
|
13041
|
-
|
|
13068
|
+
trace(levelAndName, strings, data) {
|
|
13069
|
+
print(Level.TRACE, levelAndName, strings, data);
|
|
13042
13070
|
}
|
|
13043
|
-
log(
|
|
13044
|
-
|
|
13071
|
+
log(levelAndName, strings, data) {
|
|
13072
|
+
print(Level.LOG, levelAndName, strings, data);
|
|
13045
13073
|
}
|
|
13046
|
-
info(
|
|
13047
|
-
|
|
13074
|
+
info(levelAndName, strings, data) {
|
|
13075
|
+
print(Level.INFO, levelAndName, strings, data);
|
|
13048
13076
|
}
|
|
13049
13077
|
}
|
|
13050
13078
|
/**
|
|
13051
13079
|
* An optimized version of the logger - completely ignores `TRACE` level calls.
|
|
13052
13080
|
*/
|
|
13053
13081
|
class LogConsoleTransport extends ConsoleTransport {
|
|
13054
|
-
insane(
|
|
13082
|
+
insane(_levelAndName, _strings, _data) {
|
|
13055
13083
|
/* no-op */
|
|
13056
13084
|
}
|
|
13057
|
-
trace(
|
|
13085
|
+
trace(_levelAndName, _strings, _data) {
|
|
13058
13086
|
/* no-op */
|
|
13059
13087
|
}
|
|
13060
|
-
log(
|
|
13061
|
-
|
|
13088
|
+
log(levelAndName, strings, data) {
|
|
13089
|
+
print(Level.LOG, levelAndName, strings, data);
|
|
13062
13090
|
}
|
|
13063
|
-
info(
|
|
13064
|
-
|
|
13091
|
+
info(levelAndName, strings, data) {
|
|
13092
|
+
print(Level.INFO, levelAndName, strings, data);
|
|
13065
13093
|
}
|
|
13066
13094
|
}
|
|
13067
13095
|
/**
|
|
13068
13096
|
* An optimized version of the logger - completely ignores `TRACE` & `DEBUG` level calls.
|
|
13069
13097
|
*/
|
|
13070
13098
|
class InfoConsoleTransport extends ConsoleTransport {
|
|
13071
|
-
insane(
|
|
13099
|
+
insane(_levelAndName, _strings, _data) {
|
|
13072
13100
|
/* no-op */
|
|
13073
13101
|
}
|
|
13074
|
-
trace(
|
|
13102
|
+
trace(_levelAndName, _strings, _data) {
|
|
13075
13103
|
/* no-op */
|
|
13076
13104
|
}
|
|
13077
|
-
log(
|
|
13105
|
+
log(_levelAndName, _strings, _data) {
|
|
13078
13106
|
/* no-op */
|
|
13079
13107
|
}
|
|
13080
|
-
info(
|
|
13081
|
-
|
|
13108
|
+
info(levelAndName, strings, data) {
|
|
13109
|
+
print(Level.INFO, levelAndName, strings, data);
|
|
13082
13110
|
}
|
|
13083
13111
|
}
|
|
13084
13112
|
|
|
@@ -13115,11 +13143,6 @@ class Logger {
|
|
|
13115
13143
|
const module = moduleName ?? fName;
|
|
13116
13144
|
return new Logger(module.padStart(8, " "), GLOBAL_CONFIG);
|
|
13117
13145
|
}
|
|
13118
|
-
/**
|
|
13119
|
-
* Return currently configured level for given module. */
|
|
13120
|
-
static getLevel(moduleName) {
|
|
13121
|
-
return findLevel(GLOBAL_CONFIG.options, moduleName);
|
|
13122
|
-
}
|
|
13123
13146
|
/**
|
|
13124
13147
|
* Global configuration of all loggers.
|
|
13125
13148
|
*
|
|
@@ -13150,33 +13173,46 @@ class Logger {
|
|
|
13150
13173
|
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
13151
13174
|
Logger.configureAllFromOptions(options);
|
|
13152
13175
|
}
|
|
13176
|
+
cachedLevelAndName;
|
|
13153
13177
|
constructor(moduleName, config) {
|
|
13154
13178
|
this.moduleName = moduleName;
|
|
13155
13179
|
this.config = config;
|
|
13156
13180
|
}
|
|
13181
|
+
/** Return currently configured level for given module. */
|
|
13182
|
+
getLevel() {
|
|
13183
|
+
return this.getLevelAndName()[0];
|
|
13184
|
+
}
|
|
13185
|
+
getLevelAndName() {
|
|
13186
|
+
if (this.cachedLevelAndName === undefined) {
|
|
13187
|
+
const level = findLevel(this.config.options, this.moduleName);
|
|
13188
|
+
const shortName = this.moduleName.replace(this.config.options.workingDir, "");
|
|
13189
|
+
this.cachedLevelAndName = [level, shortName];
|
|
13190
|
+
}
|
|
13191
|
+
return this.cachedLevelAndName;
|
|
13192
|
+
}
|
|
13157
13193
|
/** Log a message with `INSANE` level. */
|
|
13158
|
-
insane(
|
|
13159
|
-
this.config.transport.insane(this.
|
|
13194
|
+
insane(strings, ...data) {
|
|
13195
|
+
this.config.transport.insane(this.getLevelAndName(), strings, data);
|
|
13160
13196
|
}
|
|
13161
13197
|
/** Log a message with `TRACE` level. */
|
|
13162
|
-
trace(
|
|
13163
|
-
this.config.transport.trace(this.
|
|
13198
|
+
trace(strings, ...data) {
|
|
13199
|
+
this.config.transport.trace(this.getLevelAndName(), strings, data);
|
|
13164
13200
|
}
|
|
13165
13201
|
/** Log a message with `DEBUG`/`LOG` level. */
|
|
13166
|
-
log(
|
|
13167
|
-
this.config.transport.log(this.
|
|
13202
|
+
log(strings, ...data) {
|
|
13203
|
+
this.config.transport.log(this.getLevelAndName(), strings, data);
|
|
13168
13204
|
}
|
|
13169
13205
|
/** Log a message with `INFO` level. */
|
|
13170
|
-
info(
|
|
13171
|
-
this.config.transport.info(this.
|
|
13206
|
+
info(strings, ...data) {
|
|
13207
|
+
this.config.transport.info(this.getLevelAndName(), strings, data);
|
|
13172
13208
|
}
|
|
13173
13209
|
/** Log a message with `WARN` level. */
|
|
13174
|
-
warn(
|
|
13175
|
-
this.config.transport.warn(this.
|
|
13210
|
+
warn(strings, ...data) {
|
|
13211
|
+
this.config.transport.warn(this.getLevelAndName(), strings, data);
|
|
13176
13212
|
}
|
|
13177
13213
|
/** Log a message with `ERROR` level. */
|
|
13178
|
-
error(
|
|
13179
|
-
this.config.transport.error(this.
|
|
13214
|
+
error(strings, ...data) {
|
|
13215
|
+
this.config.transport.error(this.getLevelAndName(), strings, data);
|
|
13180
13216
|
}
|
|
13181
13217
|
}
|
|
13182
13218
|
|
|
@@ -13291,7 +13327,7 @@ class LmdbStates {
|
|
|
13291
13327
|
await Promise.all([valuesWrite, statesWrite]);
|
|
13292
13328
|
}
|
|
13293
13329
|
catch (e) {
|
|
13294
|
-
logger.error
|
|
13330
|
+
logger.error `${e}`;
|
|
13295
13331
|
return result_Result.error(StateUpdateError.Commit);
|
|
13296
13332
|
}
|
|
13297
13333
|
return result_Result.ok(result_OK);
|
|
@@ -13399,7 +13435,7 @@ class TypedPort {
|
|
|
13399
13435
|
this.dispatchPortMessage(msg);
|
|
13400
13436
|
}
|
|
13401
13437
|
catch (e) {
|
|
13402
|
-
port_logger.error
|
|
13438
|
+
port_logger.error `[${this.constructor.name}] Failed to dispatch a message: ${e}: ${msg}`;
|
|
13403
13439
|
throw e;
|
|
13404
13440
|
}
|
|
13405
13441
|
});
|
|
@@ -13473,7 +13509,7 @@ class TypedPort {
|
|
|
13473
13509
|
this.port.postMessage(msg, transferList);
|
|
13474
13510
|
}
|
|
13475
13511
|
catch (e) {
|
|
13476
|
-
port_logger.error
|
|
13512
|
+
port_logger.error `[${this.constructor.name}] Failed to post a message: ${e}: ${msg}`;
|
|
13477
13513
|
throw e;
|
|
13478
13514
|
}
|
|
13479
13515
|
}
|
|
@@ -13504,7 +13540,7 @@ class TypedPort {
|
|
|
13504
13540
|
cleanup(reason) {
|
|
13505
13541
|
// resolve all pending requests with an error.
|
|
13506
13542
|
const responseListeners = this.responseListeners.eventNames();
|
|
13507
|
-
for (const ev
|
|
13543
|
+
for (const ev of responseListeners) {
|
|
13508
13544
|
this.responseListeners.emit(ev, new Error(`port is ${reason}`));
|
|
13509
13545
|
}
|
|
13510
13546
|
}
|
|
@@ -13553,7 +13589,7 @@ class MessageChannelStateMachine {
|
|
|
13553
13589
|
this.dispatchSignal(name, data);
|
|
13554
13590
|
}
|
|
13555
13591
|
catch (e) {
|
|
13556
|
-
channel_logger.error
|
|
13592
|
+
channel_logger.error `[${this.constructor.name}] Unable to dispatch signal (${name}): ${e}. ${this.stateInfo(remoteState)}`;
|
|
13557
13593
|
throw e;
|
|
13558
13594
|
}
|
|
13559
13595
|
});
|
|
@@ -13562,7 +13598,7 @@ class MessageChannelStateMachine {
|
|
|
13562
13598
|
await this.dispatchRequest(name, data, msg);
|
|
13563
13599
|
}
|
|
13564
13600
|
catch (e) {
|
|
13565
|
-
channel_logger.error
|
|
13601
|
+
channel_logger.error `[${this.constructor.name}] Unable to dispatch request (${name}): ${e}. ${this.stateInfo(remoteState)}`;
|
|
13566
13602
|
throw e;
|
|
13567
13603
|
}
|
|
13568
13604
|
});
|
|
@@ -13648,7 +13684,7 @@ class MessageChannelStateMachine {
|
|
|
13648
13684
|
this.machine.transition(res.transitionTo.state, res.transitionTo.data);
|
|
13649
13685
|
}
|
|
13650
13686
|
if (didStateChangeInMeantime) {
|
|
13651
|
-
channel_logger.warn
|
|
13687
|
+
channel_logger.warn `Ignoring obsolete response for an old request: "${name}"`;
|
|
13652
13688
|
return;
|
|
13653
13689
|
}
|
|
13654
13690
|
return this.port.respond(prevState.stateName, msg, res.response);
|
|
@@ -13664,7 +13700,7 @@ class MessageChannelStateMachine {
|
|
|
13664
13700
|
}
|
|
13665
13701
|
}
|
|
13666
13702
|
transitionTo() {
|
|
13667
|
-
channel_logger.trace
|
|
13703
|
+
channel_logger.trace `[${this.machine.name}] transitioned to ${this.currentState()}`;
|
|
13668
13704
|
return this;
|
|
13669
13705
|
}
|
|
13670
13706
|
/**
|
|
@@ -13684,7 +13720,7 @@ class MessageChannelStateMachine {
|
|
|
13684
13720
|
await promise;
|
|
13685
13721
|
}
|
|
13686
13722
|
catch (e) {
|
|
13687
|
-
channel_logger.error
|
|
13723
|
+
channel_logger.error `${e}`;
|
|
13688
13724
|
}
|
|
13689
13725
|
return new MessageChannelStateMachine(machine, port);
|
|
13690
13726
|
}
|
|
@@ -13887,7 +13923,7 @@ class State {
|
|
|
13887
13923
|
* actions.
|
|
13888
13924
|
*/
|
|
13889
13925
|
onActivation(data) {
|
|
13890
|
-
state_logger.trace
|
|
13926
|
+
state_logger.trace `[${this.constructor.name}] Changing state to: ${this}`;
|
|
13891
13927
|
this.data = data;
|
|
13892
13928
|
}
|
|
13893
13929
|
/**
|
|
@@ -13985,7 +14021,7 @@ async function spawnWorkerGeneric(bootstrapPath, logger, mainReadyName, mainRead
|
|
|
13985
14021
|
const worker = new external_node_worker_threads_namespaceObject.Worker(bootstrapPath);
|
|
13986
14022
|
const machine = stateMachineMain(`main->${mainReadyName}`, mainReadyName, mainReadyState);
|
|
13987
14023
|
const channel = await MessageChannelStateMachine.createAndTransferChannel(machine, worker);
|
|
13988
|
-
logger.trace
|
|
14024
|
+
logger.trace `[${machine.name}] Worker spawned ${channel.currentState()}`;
|
|
13989
14025
|
return channel;
|
|
13990
14026
|
}
|
|
13991
14027
|
|
|
@@ -15563,12 +15599,14 @@ class writeable_page_WriteablePage extends MemoryPage {
|
|
|
15563
15599
|
|
|
15564
15600
|
|
|
15565
15601
|
|
|
15602
|
+
|
|
15603
|
+
|
|
15566
15604
|
var AccessType;
|
|
15567
15605
|
(function (AccessType) {
|
|
15568
15606
|
AccessType[AccessType["READ"] = 0] = "READ";
|
|
15569
15607
|
AccessType[AccessType["WRITE"] = 1] = "WRITE";
|
|
15570
15608
|
})(AccessType || (AccessType = {}));
|
|
15571
|
-
|
|
15609
|
+
const memory_logger = Logger.new(import.meta.filename, "pvm:mem");
|
|
15572
15610
|
class memory_Memory {
|
|
15573
15611
|
sbrkIndex;
|
|
15574
15612
|
virtualSbrkIndex;
|
|
@@ -15599,7 +15637,7 @@ class memory_Memory {
|
|
|
15599
15637
|
if (bytes.length === 0) {
|
|
15600
15638
|
return Result.ok(OK);
|
|
15601
15639
|
}
|
|
15602
|
-
|
|
15640
|
+
memory_logger.insane `MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`;
|
|
15603
15641
|
const pagesResult = this.getPages(address, bytes.length, AccessType.WRITE);
|
|
15604
15642
|
if (pagesResult.isError) {
|
|
15605
15643
|
return Result.error(pagesResult.error);
|
|
@@ -15666,7 +15704,7 @@ class memory_Memory {
|
|
|
15666
15704
|
currentPosition += bytesToRead;
|
|
15667
15705
|
bytesLeft -= bytesToRead;
|
|
15668
15706
|
}
|
|
15669
|
-
|
|
15707
|
+
memory_logger.insane `MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`;
|
|
15670
15708
|
return Result.ok(OK);
|
|
15671
15709
|
}
|
|
15672
15710
|
sbrk(length) {
|
|
@@ -17403,7 +17441,7 @@ class program_decoder_ProgramDecoder {
|
|
|
17403
17441
|
return Result.ok(new program_decoder_ProgramDecoder(program));
|
|
17404
17442
|
}
|
|
17405
17443
|
catch (e) {
|
|
17406
|
-
program_decoder_logger.error
|
|
17444
|
+
program_decoder_logger.error `Invalid program: ${e}`;
|
|
17407
17445
|
return Result.error(ProgramDecoderError.InvalidProgramError);
|
|
17408
17446
|
}
|
|
17409
17447
|
}
|
|
@@ -17569,7 +17607,7 @@ class interpreter_Interpreter {
|
|
|
17569
17607
|
const argsType = instructionArgumentTypeMap[currentInstruction] ?? ArgumentType.NO_ARGUMENTS;
|
|
17570
17608
|
const argsResult = this.argsDecodingResults[argsType];
|
|
17571
17609
|
this.argsDecoder.fillArgs(this.pc, argsResult);
|
|
17572
|
-
interpreter_logger.insane
|
|
17610
|
+
interpreter_logger.insane `[PC: ${this.pc}] ${Instruction[currentInstruction]}`;
|
|
17573
17611
|
if (!isValidInstruction) {
|
|
17574
17612
|
this.instructionResult.status = Result.PANIC;
|
|
17575
17613
|
}
|
|
@@ -17641,7 +17679,7 @@ class interpreter_Interpreter {
|
|
|
17641
17679
|
this.status = Status.HOST;
|
|
17642
17680
|
break;
|
|
17643
17681
|
}
|
|
17644
|
-
interpreter_logger.insane
|
|
17682
|
+
interpreter_logger.insane `[PC: ${this.pc}] Status: ${Result[this.instructionResult.status]}`;
|
|
17645
17683
|
return this.status;
|
|
17646
17684
|
}
|
|
17647
17685
|
this.pc = this.instructionResult.nextPc;
|
|
@@ -17888,7 +17926,7 @@ class host_calls_manager_HostCallsManager {
|
|
|
17888
17926
|
return `r${idx}=${value} (0x${value.toString(16)})`;
|
|
17889
17927
|
})
|
|
17890
17928
|
.join(", ");
|
|
17891
|
-
host_calls_manager_logger.insane
|
|
17929
|
+
host_calls_manager_logger.insane `[${currentServiceId}] ${context} ${name}${requested}. Gas: ${gas}. Regs: ${registerValues}.`;
|
|
17892
17930
|
}
|
|
17893
17931
|
}
|
|
17894
17932
|
class NoopMissing {
|
|
@@ -18475,7 +18513,7 @@ class MainReady extends State {
|
|
|
18475
18513
|
this.onBlock.emit(block);
|
|
18476
18514
|
}
|
|
18477
18515
|
else {
|
|
18478
|
-
state_machine_logger.error
|
|
18516
|
+
state_machine_logger.error `${this.constructor.name} got invalid signal type: ${JSON.stringify(block)}.`;
|
|
18479
18517
|
}
|
|
18480
18518
|
}
|
|
18481
18519
|
finish(channel) {
|
|
@@ -18530,12 +18568,12 @@ if (!external_node_worker_threads_namespaceObject.isMainThread) {
|
|
|
18530
18568
|
channel
|
|
18531
18569
|
.then((channel) => main(channel))
|
|
18532
18570
|
.catch((e) => {
|
|
18533
|
-
block_generator_logger.error
|
|
18571
|
+
block_generator_logger.error `${e}`;
|
|
18534
18572
|
if (e.stack !== undefined) {
|
|
18535
|
-
block_generator_logger.error
|
|
18573
|
+
block_generator_logger.error `${e.stack}`;
|
|
18536
18574
|
}
|
|
18537
18575
|
if (e.cause !== undefined) {
|
|
18538
|
-
block_generator_logger.error
|
|
18576
|
+
block_generator_logger.error `${e.cause}`;
|
|
18539
18577
|
}
|
|
18540
18578
|
});
|
|
18541
18579
|
}
|
|
@@ -18543,7 +18581,7 @@ if (!external_node_worker_threads_namespaceObject.isMainThread) {
|
|
|
18543
18581
|
* The `BlockGenerator` should periodically create new blocks and send them as signals to the main thread.
|
|
18544
18582
|
*/
|
|
18545
18583
|
async function main(channel) {
|
|
18546
|
-
block_generator_logger.info
|
|
18584
|
+
block_generator_logger.info `🎁 Block Generator running ${channel.currentState()}`;
|
|
18547
18585
|
// Await the configuration object
|
|
18548
18586
|
const ready = await channel.waitForState("ready(generator)");
|
|
18549
18587
|
const config = ready.currentState().getConfig();
|
|
@@ -18558,11 +18596,11 @@ async function main(channel) {
|
|
|
18558
18596
|
await (0,promises_namespaceObject.setTimeout)(config.chainSpec.slotDuration * 1000);
|
|
18559
18597
|
counter += 1;
|
|
18560
18598
|
const newBlock = await generator.nextEncodedBlock();
|
|
18561
|
-
block_generator_logger.trace
|
|
18599
|
+
block_generator_logger.trace `Sending block ${counter}`;
|
|
18562
18600
|
worker.sendBlock(port, newBlock);
|
|
18563
18601
|
}
|
|
18564
18602
|
});
|
|
18565
|
-
block_generator_logger.info
|
|
18603
|
+
block_generator_logger.info `Block Generator finished. Closing channel.`;
|
|
18566
18604
|
// Close the comms to gracefully close the app.
|
|
18567
18605
|
finished.currentState().close(channel);
|
|
18568
18606
|
}
|