-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
The attestation reward calculations in AttestationsDelta overflow when validators have large effective balances.
Expected Behaviour
Attestation reward calculations should handle large validator effective balances without integer overflow, producing mathematically correct results.
Current Behaviour
The multiplication exceeds uint64 limits before division occurs.
Has this worked before in a previous version?
As far as I know, it has not.
🔬 Minimal Reproduction
As an example, the overflow can be reproduced by running a network with 1024 validators each with an effective balance of 10M eth (10000000000000000 gwei), with the other consensus configuration parameters set to the mainnet default.
These conditions result in the following calculation for attDelta.HeadReward
.
(200000000 * 14 * (10240000000000000000 / 1000000000)) / (10240000000 * 64)
The numerator silently overflows as it exceeds the uint64 max value, and returns a mathematically incorrect head reward.
Error
Platform(s)
Mac (Apple Silicon)
What version of Prysm are you running? (Which release)
v6.0.4
Anything else relevant (validator index / public key)?
No response