@typeberry/jam 0.1.1-b537c8b → 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/importer/index.js +2 -21
- package/importer/index.js.map +1 -1
- package/index.js +2 -21
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -62004,7 +62004,6 @@ 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;
|
|
62008
62007
|
for (const serviceId of serviceIds) {
|
|
62009
62008
|
const checkpoint = AccumulationStateUpdate.copyFrom(currentState);
|
|
62010
62009
|
const { consumedGas, stateUpdate } = await this.accumulateSingleService(serviceId, accumulateData.getOperands(serviceId), accumulateData.getGasCost(serviceId), slot, entropy, currentState);
|
|
@@ -62014,21 +62013,6 @@ class Accumulate {
|
|
|
62014
62013
|
serviceStatistics.gasUsed = common_tryAsServiceGas(serviceStatistics.gasUsed + consumedGas);
|
|
62015
62014
|
statistics.set(serviceId, serviceStatistics);
|
|
62016
62015
|
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
|
-
}
|
|
62032
62016
|
}
|
|
62033
62017
|
return {
|
|
62034
62018
|
state: currentState,
|
|
@@ -62173,14 +62157,11 @@ class DeferredTransfers {
|
|
|
62173
62157
|
async transition({ pendingTransfers, timeslot, servicesUpdate: inputServicesUpdate, entropy, }) {
|
|
62174
62158
|
// https://graypaper.fluffylabs.dev/#/7e6ff6a/187a03187a03?v=0.6.7
|
|
62175
62159
|
const transferStatistics = new Map();
|
|
62176
|
-
const services = uniquePreserveOrder(pendingTransfers.
|
|
62160
|
+
const services = uniquePreserveOrder(pendingTransfers.flatMap((x) => [x.source, x.destination]));
|
|
62177
62161
|
let currentStateUpdate = AccumulationStateUpdate.new(inputServicesUpdate);
|
|
62178
62162
|
for (const serviceId of services) {
|
|
62179
62163
|
const partiallyUpdatedState = new PartiallyUpdatedState(this.state, currentStateUpdate);
|
|
62180
|
-
|
|
62181
|
-
const transfers = pendingTransfers
|
|
62182
|
-
.filter((pendingTransfer) => pendingTransfer.destination === serviceId)
|
|
62183
|
-
.toSorted((a, b) => a.source - b.source);
|
|
62164
|
+
const transfers = pendingTransfers.filter((pendingTransfer) => pendingTransfer.destination === serviceId);
|
|
62184
62165
|
const info = partiallyUpdatedState.getServiceInfo(serviceId);
|
|
62185
62166
|
if (info === null) {
|
|
62186
62167
|
return result_Result.error(DeferredTransfersErrorCode.ServiceInfoNotExist);
|