Skip to content

Commit

Permalink
fix: fix the devnet2 bug of invalid stateroot calc post consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Aug 9, 2024
1 parent 73b2112 commit e88a1e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/state-transition/src/util/electra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ export function switchToCompoundingValidator(state: CachedBeaconStateElectra, in
const validator = state.validators.get(index);

if (hasEth1WithdrawalCredential(validator.withdrawalCredentials)) {
validator.withdrawalCredentials[0] = COMPOUNDING_WITHDRAWAL_PREFIX;
// directly modifying the byte leads to ssz missing the modification resulting into
// wrong root compute, although slicing can be avoided but anyway this is not going
// to be a hot path so its better to clean slice and avoid side effects
const newWithdrawalCredentials = validator.withdrawalCredentials.slice();
newWithdrawalCredentials[0] = COMPOUNDING_WITHDRAWAL_PREFIX;
validator.withdrawalCredentials = newWithdrawalCredentials;
queueExcessActiveBalance(state, index);
}
}
Expand Down

0 comments on commit e88a1e3

Please sign in to comment.