snarkvm_synthesizer::vm

Function staking_rewards

Source
pub fn staking_rewards<N: Network>(
    stakers: &IndexMap<Address<N>, (Address<N>, u64)>,
    committee: &Committee<N>,
    block_reward: u64,
) -> IndexMap<Address<N>, (Address<N>, u64)>
Expand description

Returns the updated stakers reflecting the staking rewards for the given committee, block reward, and validator commission rates.

The staking reward for validators is defined as: block_reward * stake / total_stake + commission_to_recieve. The commission to receive for validators is defined as: block_reward * (total_stake_delegated / total_stake) * (rate / 100).

The staking reward for delegators is defined as: block_reward * stake / total_stake - commission_to_pay. The commission to pay for delegators is defined as: block_reward * (stake / total_stake) * (rate / 100)

This method ensures that stakers who are bonded to validators with more than 25% of the total stake will not receive a staking reward. In addition, this method ensures delegators who have less than 10,000 credits are not eligible for a staking reward.

The choice of 25% is to ensure at least 4 validators are operational at any given time. Our security model tolerates Byzantines behavior by validators staking up to f stake, where f = max{m: integer | m < N/3}, N being the total amount staked. Therefore, 1 Byzantine validator out of 4 equal-staked validators will be tolerated.