From 4dc234dd9e00b23ff2951712772ddebe7c05cb94 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Tue, 8 Oct 2024 09:08:29 +1300 Subject: [PATCH] Added warning re validatorStatuses cache --- .../statetransition/epoch/AbstractEpochProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/statetransition/epoch/AbstractEpochProcessor.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/statetransition/epoch/AbstractEpochProcessor.java index a86908ae8e9..0efe8a1ea4d 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/statetransition/epoch/AbstractEpochProcessor.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/statetransition/epoch/AbstractEpochProcessor.java @@ -104,6 +104,16 @@ public BeaconState processEpoch(final BeaconState preState) throws EpochProcessi protected void processEpoch(final BeaconState preState, final MutableBeaconState state) throws EpochProcessingException { + /* + WARNING: After Electra, it is possible that the validator set is updated within epoch processing + (process_pending_deposits). This means that the validator set in the state can get out of sync with + our validatorStatuses cache. This is not a problem for the current epoch processing, but it can cause + undesired side effects in the future. + + Up until Electra, the only function that uses validatorStatuses after process_pending_deposits is + process_effective_balance_updates, and in this particular case it is ok that we don't have the new validators + in validatorStatuses. + */ final ValidatorStatuses validatorStatuses = validatorStatusFactory.createValidatorStatuses(preState);