Skip to content

Commit

Permalink
pull in functional change that was needed to test electra devnet5 tests
Browse files Browse the repository at this point in the history
change from Consensys#8908

Signed-off-by: Paul Harris <[email protected]>
  • Loading branch information
rolfyone committed Dec 17, 2024
1 parent 37ba826 commit 77385ea
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,18 @@ public void processPendingConsolidations(final MutableBeaconState state) {
break;
}

final UInt64 activeBalance =
stateAccessorsElectra.getActiveBalance(state, pendingConsolidation.getSourceIndex());
// Calculate the consolidated balance
final UInt64 sourceEffectiveBalance =
state
.getBalances()
.get(pendingConsolidation.getSourceIndex())
.get()
.min(sourceValidator.getEffectiveBalance());
// Move active balance to target. Excess balance is withdrawable.
beaconStateMutators.decreaseBalance(
state, pendingConsolidation.getSourceIndex(), activeBalance);
state, pendingConsolidation.getSourceIndex(), sourceEffectiveBalance);
beaconStateMutators.increaseBalance(
state, pendingConsolidation.getTargetIndex(), activeBalance);
state, pendingConsolidation.getTargetIndex(), sourceEffectiveBalance);

nextPendingBalanceConsolidation++;
}
Expand Down

0 comments on commit 77385ea

Please sign in to comment.