Optimisations and bug fixes for state advance

This commit is reasonably performant on Prater!
This commit is contained in:
Michael Sproul
2022-02-17 14:00:57 +11:00
parent f5dae9106e
commit 1db0e32bfb
13 changed files with 171 additions and 56 deletions

View File

@@ -141,9 +141,11 @@ pub mod altair {
if participation_flag_indices.contains(&flag_index)
&& !validator_participation.has_flag(flag_index)?
{
// FIXME(sproul): add effective balance cache here?
validator_participation.add_flag(flag_index)?;
let effective_balance = state.get_validator(index)?.effective_balance;
proposer_reward_numerator.safe_add_assign(
get_base_reward(state, index, total_active_balance, spec)?
get_base_reward(effective_balance, total_active_balance, spec)?
.safe_mul(weight)?,
)?;
}