Skip to content

Develop to Main #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 22, 2025
Merged

Develop to Main #285

merged 20 commits into from
Apr 22, 2025

Conversation

AlexanderLukin
Copy link
Contributor

No description provided.

AlexanderLukin and others added 20 commits February 13, 2025 03:15
There was a bug in the accounting of sync committees. One validator
could participate in the same sync committee multiple times under
different committee indexes. Previously in the code, there was an
implicit assumption that a validator can be presented in a sync
committee of the particular block only one time. This led to an
incorrect accounting of sync committees and incorrect calculation of
validator rewards for participation in sync committees.

For example, in the 5-th Pectra devnet, the validator 8568
https://dora.pectra-devnet-5.ethpandaops.io/validator/0x9617f22db51844882a8115ee19613cf7a6211107a878aefc61111ad650304f0557aa10f977c38b9b978349c5eaf8ecc2
proposed a slot 179518
https://dora.pectra-devnet-5.ethpandaops.io/slot/179518
in the epoch 5609
https://dora.pectra-devnet-5.ethpandaops.io/epoch/5609
The sync committee for epoch 5609 contains validators with indexes 1298,
2561, 4326, 8113, and 9377 two times. Rewards for participation of these
validators in the sync committee for the second time were not taken into
account. So, when slot 179518 is proposed, EVM calculated rewards for
proposing this slot incorrectly.

Now the bug is fixed. The `sync_meta` field of the
`ValidatorDutySummary` structure was extended to contain several synced
blocks if a validator participate in the same committee multiple times.
Also, the calculation of the percentage of sync committee participation
and the calculation of rewards for sync committee participation have
been updated.
The `summaryValidator` object in the `check` method of `SyncService`
might be null. In this case, addressing the `is_sync` property of this
variable caused an error. Now this bug is fixed.
Add intermediate variables to the `sync_percent` calculation formula.
Remove unnecessary variables from the "Rewards & Penalties" dashboard.
Add a new `CL_API_MAX_SLOT_DEEP_COUNT` env variable that specifies a
maximum number of slots that the app uses to find a not missed
consensus-layer slot.

Previously, this number was hard-coded in the appropriate constant in
the `ConsensusProviderService`. As after the Pectra hardfork on Holeksy
blocks became proposed significantly more rarely than usual, it became
possible not to have any proposed blocks in the closest 32 slots, and
so, the app gave up trying to find the closed proposed block and threw
the error.

Now it is possible to configure this depth for cases like we see now on
Holesky and extend this depth to any necessary value. So the app can
look deeper into the slots chain and find the next (or previous)
proposed block.

Also, some minor refactoring has been done in the
`ConsensusProviderService` and fixed incorrect numbers in the error
message that is shown when the app cannot find the closest proposed
block. Previously in case of such errors, the error message always
looked like "Error when trying to get next not missed block header. From
N to N" because of the recursive call.
…ky-workflows

Workflows adjustments for hoodi/holesky deployments
…t-deep-count

feat: configurable max slot deep count
The current calculation algorithm of missed rewards for attestations is
working incorrectly for validators with a max effective balance greater
than 32. As a result of this calculation, the value of the missed
attestation reward for such validators might be negative. The attempt to
store a negative value of missed attestation reward to the DB causes
failures that lead to a complete inability to update the
"validators_summary" table and loss of data about all validators in the
epoch where this calculation error happened.

The calculation of missed attestation rewards for 0x02 validators is
temporarily disabled until we understand better how to calculate missed
attestation rewards for all types of validators.
…ds-calculation

fix: missed rewards for attestations
Proper fix for missed attestations rewards calculation.

In the previous version of the missed rewards calculation algorithm,
there was a hard assumption that the effective balance of any validator
must be 32 ETH. After Pectra hardfork this assumption is no longer
valid. So, now to calculate the "perfect" attestation rewards that a
validator could earn if it fully executes all attestation duties the
algorithm should use the actual validator effective balance, not 32.

This PR makes the rewards calculation algorithm use the actual validator
balance in missed rewards calculation and also extracts some common
multiplications to new variables.
Move the `getRewards` function call out of the cycle.
…ds-calculation-3

fix: missed rewards for attestations - 2
Exclude validators with the "pending_initialized" status from the reward
calculation.

There was an error with the reward calculation for some validators on
Hoodi testnet on the epoch when the Pectra hardfork was activated
(2048).

At the time of the hadrfork, many validators of the "Attestant (BVI)
Limited" node operator were waiting for the activation. Most of these
validators had the status "pending_queued" at the last epoch before the
hardfork (2047). All validators with this status had 32 ETH on their
balance. On the epoch 2048 (Pectra hardfork activation epoch), some of
these validators changed their status from "pending_queued" to
"pending_initialized" (for example, validators with indexes from 1073611
to 1074310) and their balance became zero.

To calculate reward calculation error EVM compares all the rewards
calculated by EVM algorithms with the validators' balance change. As in
the previous epoch balance of many validators was 32, and in the next
epoch it became zero, it led to an incorrect reward calculation error.

To avoid this kind of issue in the future, validators with the
"pending_initialized" status are now excluded from the rewards
calculation. As these validators are not active anyway and don't
participate in validator duties, no rewards or penalties can be applied
to them.
…zed-validators-from-rewards-calculation

fix: exclude pending initialized validators
@AlexanderLukin AlexanderLukin requested a review from dputko April 21, 2025 13:59
@AlexanderLukin AlexanderLukin merged commit d0d7335 into main Apr 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants