@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/importer/index.js
CHANGED
|
@@ -23352,7 +23352,6 @@ 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;
|
|
23356
23355
|
for (const serviceId of serviceIds) {
|
|
23357
23356
|
const checkpoint = AccumulationStateUpdate.copyFrom(currentState);
|
|
23358
23357
|
const { consumedGas, stateUpdate } = await this.accumulateSingleService(serviceId, accumulateData.getOperands(serviceId), accumulateData.getGasCost(serviceId), slot, entropy, currentState);
|
|
@@ -23362,21 +23361,6 @@ class Accumulate {
|
|
|
23362
23361
|
serviceStatistics.gasUsed = common_tryAsServiceGas(serviceStatistics.gasUsed + consumedGas);
|
|
23363
23362
|
statistics.set(serviceId, serviceStatistics);
|
|
23364
23363
|
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
|
-
}
|
|
23380
23364
|
}
|
|
23381
23365
|
return {
|
|
23382
23366
|
state: currentState,
|
|
@@ -23521,14 +23505,11 @@ class DeferredTransfers {
|
|
|
23521
23505
|
async transition({ pendingTransfers, timeslot, servicesUpdate: inputServicesUpdate, entropy, }) {
|
|
23522
23506
|
// https://graypaper.fluffylabs.dev/#/7e6ff6a/187a03187a03?v=0.6.7
|
|
23523
23507
|
const transferStatistics = new Map();
|
|
23524
|
-
const services = uniquePreserveOrder(pendingTransfers.
|
|
23508
|
+
const services = uniquePreserveOrder(pendingTransfers.flatMap((x) => [x.source, x.destination]));
|
|
23525
23509
|
let currentStateUpdate = AccumulationStateUpdate.new(inputServicesUpdate);
|
|
23526
23510
|
for (const serviceId of services) {
|
|
23527
23511
|
const partiallyUpdatedState = new PartiallyUpdatedState(this.state, currentStateUpdate);
|
|
23528
|
-
|
|
23529
|
-
const transfers = pendingTransfers
|
|
23530
|
-
.filter((pendingTransfer) => pendingTransfer.destination === serviceId)
|
|
23531
|
-
.toSorted((a, b) => a.source - b.source);
|
|
23512
|
+
const transfers = pendingTransfers.filter((pendingTransfer) => pendingTransfer.destination === serviceId);
|
|
23532
23513
|
const info = partiallyUpdatedState.getServiceInfo(serviceId);
|
|
23533
23514
|
if (info === null) {
|
|
23534
23515
|
return result_Result.error(DeferredTransfersErrorCode.ServiceInfoNotExist);
|