From 702eb3aa21b561ed5fa47ba1e0f67a74392ef2fa Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 14 May 2024 11:46:01 +0200 Subject: [PATCH] fix: additional epoch calculation logic for consolidation churn (#6770) Fix the chunk limit logic --- packages/state-transition/src/util/epoch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/state-transition/src/util/epoch.ts b/packages/state-transition/src/util/epoch.ts index 67837780dca..b9b911137fd 100644 --- a/packages/state-transition/src/util/epoch.ts +++ b/packages/state-transition/src/util/epoch.ts @@ -83,7 +83,7 @@ export function computeConsolidationEpochAndUpdateChurn( // Consolidation doesn't fit in the current earliest epoch. if (consolidationBalance > consolidationBalanceToConsume) { const balanceToProcess = Number(consolidationBalance) - consolidationBalanceToConsume; - const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochConsolidationChurn + 1)); + const additionalEpochs = Math.floor((balanceToProcess - 1) / perEpochConsolidationChurn) + 1; earliestConsolidationEpoch += additionalEpochs; consolidationBalanceToConsume += additionalEpochs * perEpochConsolidationChurn; }