@typeberry/jam 0.1.1-135f62f → 0.1.1-b537c8b

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/importer/index.js CHANGED
@@ -23352,6 +23352,7 @@ class Accumulate {
23352
23352
  const serviceIds = accumulateData.getServiceIds();
23353
23353
  let gasCost = common_tryAsServiceGas(0);
23354
23354
  let currentState = inputStateUpdate;
23355
+ const currentManager = (inputStateUpdate.privilegedServices ?? this.state.privilegedServices).manager;
23355
23356
  for (const serviceId of serviceIds) {
23356
23357
  const checkpoint = AccumulationStateUpdate.copyFrom(currentState);
23357
23358
  const { consumedGas, stateUpdate } = await this.accumulateSingleService(serviceId, accumulateData.getOperands(serviceId), accumulateData.getGasCost(serviceId), slot, entropy, currentState);
@@ -23361,6 +23362,21 @@ class Accumulate {
23361
23362
  serviceStatistics.gasUsed = common_tryAsServiceGas(serviceStatistics.gasUsed + consumedGas);
23362
23363
  statistics.set(serviceId, serviceStatistics);
23363
23364
  currentState = stateUpdate === null ? checkpoint : stateUpdate;
23365
+ if (Compatibility.is(GpVersion.V0_7_0) && serviceId === currentManager) {
23366
+ const newV = currentState.privilegedServices?.validatorsManager;
23367
+ if (currentState.privilegedServices !== null && newV !== undefined && serviceIds.includes(newV)) {
23368
+ accumulate_logger.info("Entering completely incorrect code that probably reverts validatorsManager change. This is valid in 0.7.0 only and incorrect in 0.7.1+");
23369
+ // Since serviceIds already contains newV, this service gets accumulated twice.
23370
+ // To avoid double-counting, we skip stats and gas cost tracking here.
23371
+ // We need this accumulation to get the correct `validatorsManager`
23372
+ const { stateUpdate } = await this.accumulateSingleService(newV, accumulateData.getOperands(newV), accumulateData.getGasCost(newV), slot, entropy, checkpoint);
23373
+ const correctV = stateUpdate?.privilegedServices?.validatorsManager ?? this.state.privilegedServices.validatorsManager;
23374
+ currentState.privilegedServices = PrivilegedServices.create({
23375
+ ...currentState.privilegedServices,
23376
+ validatorsManager: correctV,
23377
+ });
23378
+ }
23379
+ }
23364
23380
  }
23365
23381
  return {
23366
23382
  state: currentState,