This describes the SweetWater requirements for calculation and distribution of rewards to delegators and validators. For more information on the overall approach, please see the relevant research document.
This applies to the rewards resulting from trading via infrastructure fees.
min_val
: minimum validators we need (for now, 5). This is a network parameter that can be changed through a governance vote. Full name:reward.staking.delegation.minValidators
.numberOfValidators
- the actual number of validators running the consensus (derived from running chain)totalStake
- the total number of units of the staking and governance asset (VEGA) associated to the Vega chain (but not necessarily delegated to a specific validator).compLevel
- This is a Network parameter that can be changed through a governance vote. Full name:reward.staking.delegation.competitionLevel
. Default1.1
.reward.staking.delegation.optimalStakeMultiplier
- another network parameter which together withcompLevel
control how much the validators "compete" for delegated stake.network.ersatzvalidators.reward.factor
- a decimal in[0,1]
with default of1
. It controls how much the ersatz validator(standby validator) own + delegated stake counts for reward purposes.
delegator_share
: proportion of the validator reward that goes to the delegators. The initial value is 0.883. This is a network parameter that can be changed through a governance vote. Full name:reward.staking.delegation.delegatorShare
.min_own_stake
: the minimum number of staking and governance asset (VEGA) that a validator needs to self-delegate to be eligible for rewards. Full name:reward.staking.delegation.minimumValidatorStake
.
Note: changes of any network parameters affecting these calculations will take an immediate effect (they aren't delayed until next epoch).
This applies to the network infrastructure fee pool for each asset. At the end of an epoch, payments are calculated.
As step zero: Vega keeps track of validators currently on the Ethereum multisig contract by knowing the initial state and by observing validator added
and validator removed
events emitted by the contract, see multisig ethereum contract.
If there are ethereum public keys on the multisig that do not belong to any of the current Tendermint validator nodes then the reward is zero.
The obverse case where a Tendermint validator doesn't have their signature on the multisig is dealt with in validators joining and leaving.
The reason for this drastic reduction to rewards is that if there are signatures the multisig is expecting that Vega chain isn't providing there is a danger that control of the multisig is lost.
This is to ensure that validators (all validators) have incentive to pay Ethereum gas to update the multisig signer list.
From the point of view of proof of stake rewards there are three types of nodes:
- Non-validator nodes that process transactions and can run the data node for client use but they don't determine which transactions go into blocks and they get no proof of stake rewards. Any such validator can submit a transaction to join the ersatz nodes / validator nodes set. Once they submit such transaction they become pending nodes and their performance is measured to determine their suitability. If they meet staking and performance criteria will get "promoted" to the next level.
- The ersatz validators who, from the point of view of consensus protocol are non-validator nodes but they have sufficient stake (own or delegated) and meet performance criteria. Their role is to be readily available if any of the primary (Tendermint) validators was to drop out in which case they become primary validators. They can also become primary validators if the stake composition changes sufficiently. They receive proof of stake rewards. If their performance score or amount of delegated stake drops they can be demoted to a pending non-validator node.
- The primary (Consensus forming / Tendermint) nodes (which propose and verify blocks based on delegated PoS using the Tendermint protocol). They receive proof of stake rewards.
The reward pool is split into two parts, proportional to the total own+delegated stake the primary and ersatz validators have.
Thus, if s_t = network.ersatzvalidators.reward.factor x s_e + s_p
is the total amount of own+delegated stake to both sets (with ersatz scaling taken into account), s_p
the total stake delegated to the primary / Tendermint validators and s_e x network.ersatzvalidators.reward.factor
the total stake delegated to the ersatz validators (scaled appropriately), then the primary / Tendermint pool has a fraction of s_p / s_t
of the total reward, while the ersatz pool has network.ersatzvalidators.reward.factor x s_e / s_t
(both rounded down appropriately).
The following formulas then apply to both primary and ersatz validators, where 'total available reward' and 'total delegation', total_stake and 'number_of_validators' or s_total
refer to the corresponding reward pool and the total own+delegated corresponding set of validators (i.e., s_p
or s_e
, respectively).
- First,
validatorScore
is calculated to obtain the relative weight of the validator givenstake_val
is both own and delegated tokens, that isstake_val = allDelegatedTokens + validatorsOwnTokens
. HereallDelegatedTokens
is the count of the tokens delegated to this validator. NotevalidatorScore
also depends on the other network parameters, see below where the exactvalidatorScore
function is defined. - Obtain the performance score as per validator performance specification. Update
validatorScore <- validatorScore x performance_score
. - The fraction of the total available reward that goes to a node (some of this will be for the validator , some is for their delegators) is then
nodeAmount := stakingRewardAmtForEpoch x validatorScore / sumAllValidatorScores
wheresumAllValidatorScores
is the sum of all scores achieved by the validators. Note that this is subject tomin_own_stake
criteria being met. (see below). - The amount that is for the validator to keep (subject to delay and max payout per participant) is
valAmt = nodeAmount x (1 - delegatorShare)
. - The amount to be distributed among all the parties that delegated to this validator is
allDelegatorsAmt := nodeAmount x delegatorShare x score_val / total_score
.
Each delegator should now receive delegatorTokens / (allDelegatedTokens + validatorsOwnTokens)
.
If the validator (i.e. the associated key) does not have sufficient stake self-delegated (at least the network parameter min_own_stake
), then the reward for the validator is set to zero. The corresponding amount is kept by the network, not distributed among the other validators. Note this only applies to the part of the reward attributable directly to such a validator, its delegators should still receive their rewards. If a Vega key which defines a validator delegates any amount to a different validator then the reward associated with that delegation will be paid out just like for any other delegator.
This is defined as follows:
function validatorScore(valStake) {
a = Math.max(s_minVal, s_numVal/s_compLevel)
optStake = s_total / a
penaltyFlatAmt = Math.max(0.0, valStake - optStake)
penaltyDownAmt = Math.max(0.0, valStake - optimalStakeMultiplier*optStake)
linearScore = (valStake - penaltyFlatAmt - penaltyDownAmt)/s_total
// make sure we're between 0 and 1.
linearScore = Math.min(1.0, Math.max(0.0,linearScore))
return linearScore
}
For ersatz validators, the same formula is used.
Spare key on multisig (0061-REWP-001)
- Four or more Tendermint validators with equal own+delegated stake and some ersatz validators are running.
- Reward pool is funded.
- There is a one-to-one correspondence between Tendermint validators' ethereum keys and keys on multisig.
- One of the Tendermint validators goes offline forever and is removed from the set of Tendermint validators but their key still stays on multisig (no-one updated).
- Epoch ends and multisig hasn't been updated.
- Tendermint validators get no rewards. Ersatz validators still receive rewards.
- A validator with less than
minOwnStake
tokens staked to themselves will earn 0 rewards at the end of an epoch (0061-REWP-002) - With
delegator_share
set to0
, a validator keeps 100% of their own rewards, and a delegator receives no reward (0061-REWP-003) - With
delegator_share
set to1
, a validator receives no reward, and their delegators receive a proportional amount of 100% (0061-REWP-004) - With
delegator_share
set to0.5
, a validator keeps 50% of their own reward, and their delegators receives a proportional amount of the remaining 50% (0061-REWP-005)
- A validator with less than
Rewards distribution corresponds to the signers on the multisig contract in the case that it hasn’t been updated after a validator set change (0061-REWP-006)
- Four or more Tendermint validators with equal own+delegated stake and some ersatz validators are running.
- There is a one-to-one correspondence between Tendermint validators' ethereum keys and keys on multisig.
- Reward pool is funded.
- A validator called Bob leaves the set of tendermint validators (for example, reduce own plus delegated tokens so that their score is pushed down). A validator called Alice is promoted to tendermint validator set.
- No-one updated multisig validators so we still have Bob's key on the list of multisig signer.
- Epoch ends and multisig hasn't been updated.
- All Tendermint validators get no rewards. Ersatz validators still receive rewards.
Rewards from trading fees are calculated and distributed (0061-REWP-007)
- Run Vega with at least 3 tendermint validator nodes and at least 5 ersatz validator nodes each with different self-stake and delegation.
- A market is launched with settlement asset A, infrastructure fee of
0.01 = 1%
. Market leaves opening auction and at least 10 trades occur with a total traded notable for fee purposes of at least 10000000 A. - Epoch ends.
- The reward pool from trading in asset A is at least
0.01 x 10000000 = 100000
. - Each validator and delegator receives appropriate share of the
100000
.
- Change of network parameter
reward.staking.delegation.competitionLevel
will change the level of competition of the validators (influences how much stake is be needed for all validators to reach optimal revenue) at the end of the next epoch. Default value 3.1. Minimum value 1 (inclusive). (0061-REWP-008) - Change of network parameter
reward.staking.delegation.minimumValidatorStake
will change minimum amount required of own stake a validator has. Minimum stake applies to all validators. it’s referred to as a prerequisite to being considered a validator. Validators not met with the minimum stake will not be all thrown, and in fact unless there’s someone who can replace them no one will be kicked out. If there is an ersatz ready to replace them only one will be replaced every epoch. (0061-REWP-009) - Change of the network parameter
reward.staking.delegation.optstakemultiplier
is changed to 0 (the reward curve is flat for a validator that exceeds optimal stake), to 0.5 (the reward curve goes down), and 0.1 (the reward curve goes down slightly).(0061-REWP-010) - Change of network parameter
reward.staking.delegation.delegatorShare
to 0 (no reward for delegators), 0.99, and 0.5. The share for delegators at the end of the epochs changes accordingly. (0061-REWP-011)