@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 +16 -0
- package/importer/index.js.map +1 -1
- package/index.js +16 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -62004,6 +62004,7 @@ class Accumulate {
|
|
|
62004
62004
|
const serviceIds = accumulateData.getServiceIds();
|
|
62005
62005
|
let gasCost = common_tryAsServiceGas(0);
|
|
62006
62006
|
let currentState = inputStateUpdate;
|
|
62007
|
+
const currentManager = (inputStateUpdate.privilegedServices ?? this.state.privilegedServices).manager;
|
|
62007
62008
|
for (const serviceId of serviceIds) {
|
|
62008
62009
|
const checkpoint = AccumulationStateUpdate.copyFrom(currentState);
|
|
62009
62010
|
const { consumedGas, stateUpdate } = await this.accumulateSingleService(serviceId, accumulateData.getOperands(serviceId), accumulateData.getGasCost(serviceId), slot, entropy, currentState);
|
|
@@ -62013,6 +62014,21 @@ class Accumulate {
|
|
|
62013
62014
|
serviceStatistics.gasUsed = common_tryAsServiceGas(serviceStatistics.gasUsed + consumedGas);
|
|
62014
62015
|
statistics.set(serviceId, serviceStatistics);
|
|
62015
62016
|
currentState = stateUpdate === null ? checkpoint : stateUpdate;
|
|
62017
|
+
if (Compatibility.is(GpVersion.V0_7_0) && serviceId === currentManager) {
|
|
62018
|
+
const newV = currentState.privilegedServices?.validatorsManager;
|
|
62019
|
+
if (currentState.privilegedServices !== null && newV !== undefined && serviceIds.includes(newV)) {
|
|
62020
|
+
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+");
|
|
62021
|
+
// Since serviceIds already contains newV, this service gets accumulated twice.
|
|
62022
|
+
// To avoid double-counting, we skip stats and gas cost tracking here.
|
|
62023
|
+
// We need this accumulation to get the correct `validatorsManager`
|
|
62024
|
+
const { stateUpdate } = await this.accumulateSingleService(newV, accumulateData.getOperands(newV), accumulateData.getGasCost(newV), slot, entropy, checkpoint);
|
|
62025
|
+
const correctV = stateUpdate?.privilegedServices?.validatorsManager ?? this.state.privilegedServices.validatorsManager;
|
|
62026
|
+
currentState.privilegedServices = PrivilegedServices.create({
|
|
62027
|
+
...currentState.privilegedServices,
|
|
62028
|
+
validatorsManager: correctV,
|
|
62029
|
+
});
|
|
62030
|
+
}
|
|
62031
|
+
}
|
|
62016
62032
|
}
|
|
62017
62033
|
return {
|
|
62018
62034
|
state: currentState,
|