@@ -137,43 +137,43 @@ vote state field `pending_delegator_rewards` and added to the balance of vote
137
137
account. If either of these conditions is violated, the delegator rewards amount
138
138
MUST be burned.
139
139
140
- ### Runtime: Delegator Rewards Distribution
140
+ ### Runtime: Block Revenue Distribution
141
141
142
- When calculating stake delegation rewards for a particular completed reward
143
- epoch, construct a list of all vote accounts that were initialized at the
144
- beginning of the reward epoch and had a non-zero active stake delegation. For
145
- each vote account, retrieve its state at the end of the reward epoch and check
146
- the ` pending_delegator_rewards ` field in its vote state. Let this value be ` P ` .
147
- If ` P ` is non-zero, use it to calculate rewards for each of the stake accounts
148
- delegated to the vote account as follows:
142
+ Utilize the existing partitioned rewards distribution mechanism described in
143
+ [ SIMD-0118] to distribute block revenue rewards as well.
149
144
150
- 1 . Sum all active stake delegated to the vote account during the reward epoch
151
- epoch. Let this total be ` A ` .
145
+ #### Delegator Rewards Calculation
152
146
153
- 2 . For each individual stake account, multiply its active stake from the
154
- reward epoch by ` P ` , and divide the result by ` A ` using integer division.
155
- Discard any fractional lamports.
147
+ During the beginning of the first block of an epoch ` N ` , all pending delegator
148
+ rewards from all vote accounts with a non-zero active stake delegation during
149
+ the reward epoch ` N - 1 ` MUST be transferred by the runtime to the epoch rewards
150
+ sysvar account for distribution.
156
151
157
- After calculating all individual stake rewards, sum them to obtain ` D ` , the
158
- total distribution amount. Because of integer division, the full amount ` P ` may
159
- not be distributed so compute the amount to be burned, ` B ` , as the difference
160
- between ` P ` and ` D ` .
161
-
162
- If no blocks in the epoch following the completed reward epoch have been
163
- processed yet, subtract ` B ` from both the vote account’s lamport balance and its
164
- ` pending_delegator_rewards ` field and store the updated vote account. Finally,
165
- the burn amount ` B ` should also be deducted from the cluster capitalization.
152
+ For each actively staked vote account, retrieve its state at the end of the
153
+ reward epoch and check the ` pending_delegator_rewards ` field in its vote state.
154
+ Let this value be ` P ` . If ` P ` is non-zero, set the ` pending_delegator_rewards `
155
+ field to ` 0 ` and deduct ` P ` from the vote account's lamport balance and credit
156
+ it to the epoch rewards sysvar account's lamport balance. Then if ` P ` is
157
+ non-zero, sum all active stake delegated to the vote account during the reward
158
+ epoch epoch ` N - 1 ` . Let this total be ` A ` .
166
159
167
160
#### Individual Delegator Reward
168
161
169
- The stake reward distribution amounts for each stake account calculated above
170
- can then be used to construct a list of stake reward entries which MUST be
171
- partitioned and distributed according to [ SIMD-0118] .
162
+ For each individual stake account with an active non-zero delegation, multiply
163
+ its active stake in reward epoch ` N - 1 ` by ` P ` , and divide the result by
164
+ ` A ` using integer division to get the individual stake account's block revenue
165
+ reward distribution amount.
166
+
167
+ #### Delegator Rewards Distribution
168
+
169
+ The reward distribution amounts for each stake account can then be used to
170
+ construct a list of stake reward entries which MUST be partitioned and
171
+ distributed according to [ SIMD-0118] .
172
172
173
- When reward entries are used to distribute rewards pool funds during partitioned
174
- rewards distribution, the delegated vote account for each rewarded stake account
175
- must have its ` pending_delegator_rewards ` field and its balance deducted with
176
- the amount of rewards distributed to keep capitalization consistent.
173
+ During partitioned reward distribution in a given slot, when reward entries are
174
+ used to distribute block revenue rewards, the epoch rewards sysvar account's
175
+ lamport balance MUST be debited by the block revenue reward distribution amount
176
+ to keep capitalization consistent.
177
177
178
178
[ SIMD-0118 ] : https://github.com/solana-foundation/solana-improvement-documents/pull/118
179
179
246
246
247
247
## Backwards Compatibility
248
248
249
- A feature gate will be used to enable block reward distribution at an epoch
250
- boundary.
249
+ A feature gate will be used to enable block revenue reward distribution at an
250
+ epoch boundary.
0 commit comments