mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 03:30:38 +00:00
Fix proposer reward calculations
Aggregate the value before applying the balance increase as done in Prysm. The previous incremental additions resulted in different reward burn behavior because of truncation in the math.
This commit is contained in:
parent
05feeaec2a
commit
a7adb9c813
@ -47,18 +47,19 @@ pub fn process_sync_aggregate<T: EthSpec>(
|
||||
// Apply participant and proposer rewards
|
||||
let committee_indices = state.get_sync_committee_indices(¤t_sync_committee)?;
|
||||
|
||||
let mut earned_proposer_reward = 0;
|
||||
for (participant_index, participation_bit) in committee_indices
|
||||
.into_iter()
|
||||
.zip(aggregate.sync_committee_bits.iter())
|
||||
{
|
||||
if participation_bit {
|
||||
increase_balance(state, participant_index, participant_reward, spec, true)?;
|
||||
increase_balance(state, proposer_index as usize, proposer_reward, spec, true)?;
|
||||
earned_proposer_reward += proposer_reward;
|
||||
} else {
|
||||
decrease_balance(state, participant_index, participant_reward)?;
|
||||
}
|
||||
}
|
||||
|
||||
increase_balance(state, proposer_index as usize, earned_proposer_reward, spec, true)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user