@typeberry/jam 0.5.1-7188620 → 0.5.1-8c7de26

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.
@@ -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) {