-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Track effectiveBalance as small number #2981
Comments
NOTE! if (EFFECTIVE_BALANCE_INCREMENT !== 1e9) {
throw Error(`Lodestar assumes EFFECTIVE_BALANCE_INCREMENT = 1e9`)
} Otherwise if it's not too complicated we could compute effectiveBalances as the multiple of EFFECTIVE_BALANCE_INCREMENT, regardless of what it is. Most of the logic in state transition function computes the ratio of effectiveBalance to the effectiveBalance sum so EFFECTIVE_BALANCE_INCREMENT is factored out. In that case we should ensure that (safetyBuffer =~ 1.5 for example)
|
if Anyway in node, when we want effectiveBalance as number, it means double, not integer. So let's think about it as a number < 32, not an integer < 32. I also want to track |
Sounds good then, let's compute at ETH, regardless of EFFECTIVE_BALANCE_INCREMENT value |
Is your feature request related to a problem? Please describe.
We should use number whenever possible as BigInt calculation is about x250 times slower as analysed by @dapplion
Describe the solution you'd like
epochProcess.ts
, totalActiveStake, prevEpochUnslashedStake and currEpochUnslashedTargetStake could also be tracked as number since they are sum of effectiveBalancescomputeBaseRewardPerIncrement(), processEffectiveBalanceUpdates()
EFFECTIVE_BALANCE_INCREMENT
and this constant (1e9) is not likely to be changedThis should speed up
beforeProcessEpoch()
and some other calculations a lot since we don't have to deal with BigInt() thereThe text was updated successfully, but these errors were encountered: