Merge branch 'unstable' into deneb-free-blobs

This commit is contained in:
Jimmy Chen
2023-07-24 20:55:27 +10:00
14 changed files with 543 additions and 74 deletions

View File

@@ -17,3 +17,15 @@ pub fn get_base_reward<T: EthSpec>(
.safe_div(spec.base_rewards_per_epoch)
.map_err(Into::into)
}
pub fn get_base_reward_from_effective_balance<T: EthSpec>(
effective_balance: u64,
total_active_balance: u64,
spec: &ChainSpec,
) -> Result<u64, BeaconStateError> {
effective_balance
.safe_mul(spec.base_reward_factor)?
.safe_div(total_active_balance.integer_sqrt())?
.safe_div(spec.base_rewards_per_epoch)
.map_err(Into::into)
}