@typeberry/jam 0.5.1-b2fd1d5 → 0.5.1-eb84786
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 +17 -0
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +25 -4
- package/bootstrap-importer.mjs.map +1 -1
- package/index.js +49 -19
- package/index.js.map +1 -1
- package/package.json +1 -1
package/bootstrap-generator.mjs
CHANGED
|
@@ -14907,6 +14907,8 @@ class bandersnatch_wasm_BandernsatchWasm {
|
|
|
14907
14907
|
|
|
14908
14908
|
|
|
14909
14909
|
|
|
14910
|
+
|
|
14911
|
+
const safrole_logger = Logger.new(import.meta.filename, "safrole");
|
|
14910
14912
|
const safrole_VALIDATOR_META_BYTES = 128;
|
|
14911
14913
|
const ticketComparator = (a, b) => bytes_bytesBlobComparator(a.id, b.id);
|
|
14912
14914
|
var SafroleErrorCode;
|
|
@@ -14994,6 +14996,14 @@ class safrole_Safrole {
|
|
|
14994
14996
|
async prepareValidatorKeysForNextEpoch(postOffenders) {
|
|
14995
14997
|
const stateEpoch = Math.floor(this.state.timeslot / this.chainSpec.epochLength);
|
|
14996
14998
|
const nextEpochStart = (stateEpoch + 1) * this.chainSpec.epochLength;
|
|
14999
|
+
/**
|
|
15000
|
+
* In real life, this would occur around ~2840,
|
|
15001
|
+
* but this scenario appears in tests, so we need to handle it.
|
|
15002
|
+
*/
|
|
15003
|
+
if (nextEpochStart >= 2 ** 32) {
|
|
15004
|
+
safrole_logger.warn `Timeslot overflow imminent, cannot prepare validator keys for next epoch.`;
|
|
15005
|
+
return result_Result.ok(null);
|
|
15006
|
+
}
|
|
14997
15007
|
return await this.getValidatorKeys(common_tryAsTimeSlot(nextEpochStart), postOffenders);
|
|
14998
15008
|
}
|
|
14999
15009
|
async getValidatorKeys(timeslot, postOffenders) {
|
|
@@ -20768,6 +20778,7 @@ class Provide {
|
|
|
20768
20778
|
}
|
|
20769
20779
|
const result = this.partialState.providePreimage(serviceId, preimage);
|
|
20770
20780
|
logger_logger.trace `[${this.currentServiceId}] PROVIDE(${serviceId}, ${preimage.toStringTruncated()}) <- ${result_resultToString(result)}`;
|
|
20781
|
+
logger_logger.insane `[${this.currentServiceId}] PROVIDE(${serviceId}, ${preimage}) <- ${result_resultToString(result)}`;
|
|
20771
20782
|
if (result.isOk) {
|
|
20772
20783
|
regs.set(provide_IN_OUT_REG, results_HostCallResult.OK);
|
|
20773
20784
|
return;
|
|
@@ -21251,6 +21262,7 @@ class Fetch {
|
|
|
21251
21262
|
return PvmExecution.Panic;
|
|
21252
21263
|
}
|
|
21253
21264
|
logger.trace `[${this.currentServiceId}] FETCH(${kind}) <- ${value?.toStringTruncated()}`;
|
|
21265
|
+
logger.insane `[${this.currentServiceId}] FETCH(${kind}) <- ${value}`;
|
|
21254
21266
|
// write result
|
|
21255
21267
|
regs.set(fetch_IN_OUT_REG, value === null ? HostCallResult.NONE : valueLength);
|
|
21256
21268
|
}
|
|
@@ -21550,6 +21562,7 @@ class Lookup {
|
|
|
21550
21562
|
// v
|
|
21551
21563
|
const preImage = this.account.lookup(serviceId, preImageHash);
|
|
21552
21564
|
logger.trace `[${this.currentServiceId}] LOOKUP(${serviceId}, ${preImageHash}) <- ${preImage?.toStringTruncated() ?? "<missing>"}...`;
|
|
21565
|
+
logger.insane `[${this.currentServiceId}] LOOKUP(${serviceId}, ${preImageHash}) <- ${preImage ?? "<missing>"}`;
|
|
21553
21566
|
const preImageLength = preImage === null ? tryAsU64(0) : tryAsU64(preImage.raw.length);
|
|
21554
21567
|
const preimageBlobOffset = regs.get(10);
|
|
21555
21568
|
const lengthToWrite = regs.get(11);
|
|
@@ -21656,6 +21669,7 @@ class Read {
|
|
|
21656
21669
|
}
|
|
21657
21670
|
if (chunk.length > 0) {
|
|
21658
21671
|
logger.trace `[${this.currentServiceId}] READ(${serviceId}, ${rawKey}) <- ${BytesBlob.blobFrom(chunk).toStringTruncated()}`;
|
|
21672
|
+
logger.insane `[${this.currentServiceId}] READ(${serviceId}, ${rawKey}) <- ${BytesBlob.blobFrom(chunk)}`;
|
|
21659
21673
|
}
|
|
21660
21674
|
else {
|
|
21661
21675
|
// just a query for length of stored data
|
|
@@ -21721,6 +21735,7 @@ class Write {
|
|
|
21721
21735
|
// a
|
|
21722
21736
|
const result = this.account.write(storageKey, maybeValue);
|
|
21723
21737
|
logger.trace `[${this.currentServiceId}] WRITE(${storageKey}, ${maybeValue?.toStringTruncated() ?? "remove"}) <- ${resultToString(result)}`;
|
|
21738
|
+
logger.insane `[${this.currentServiceId}] WRITE(${storageKey}, ${maybeValue ?? "remove"}) <- ${resultToString(result)}`;
|
|
21724
21739
|
if (result.isError) {
|
|
21725
21740
|
regs.set(write_IN_OUT_REG, HostCallResult.FULL);
|
|
21726
21741
|
return;
|
|
@@ -21782,6 +21797,7 @@ class Export {
|
|
|
21782
21797
|
// attempt to export a segment and fail if it's above the maximum.
|
|
21783
21798
|
const segmentExported = this.refine.exportSegment(segment);
|
|
21784
21799
|
logger.trace `[${this.currentServiceId}] EXPORT(${segment.toStringTruncated()}) <- ${resultToString(segmentExported)}`;
|
|
21800
|
+
logger.insane `[${this.currentServiceId}] EXPORT(${segment}) <- ${resultToString(segmentExported)}`;
|
|
21785
21801
|
if (segmentExported.isOk) {
|
|
21786
21802
|
regs.set(export_IN_OUT_REG, tryAsU64(segmentExported.ok));
|
|
21787
21803
|
}
|
|
@@ -22025,6 +22041,7 @@ class Machine {
|
|
|
22025
22041
|
// NOTE: Highly unlikely, but machineId could potentially collide with HOST_CALL_RESULT.
|
|
22026
22042
|
const machinInitResult = await this.refine.machineInit(code, entrypoint);
|
|
22027
22043
|
logger.trace `[${this.currentServiceId}] MACHINE(${code.toStringTruncated()}, ${entrypoint}) <- ${resultToString(machinInitResult)}`;
|
|
22044
|
+
logger.insane `[${this.currentServiceId}] MACHINE(${code}, ${entrypoint}) <- ${resultToString(machinInitResult)}`;
|
|
22028
22045
|
if (machinInitResult.isError) {
|
|
22029
22046
|
regs.set(machine_IN_OUT_REG, HostCallResult.HUH);
|
|
22030
22047
|
}
|