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