@@ -137,43 +137,44 @@ 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: Partitioned Rewards Calculation
141
+
142
+ During the beginning of the first block of each epoch, all pending delegator
143
+ rewards from active vote accounts MUST be transferred to the epoch rewards
144
+ sysvar account for distribution. Active vote accounts are any vote accounts that
145
+ were initialized at the beginning of the reward epoch and had a non-zero
146
+ active stake delegation. For each vote account, retrieve its state at the end of
147
+ the reward epoch and check the ` pending_delegator_rewards ` field in its vote
148
+ state. Let this value be ` P ` . If ` P ` is non-zero, set the
149
+ ` pending_delegator_rewards ` field to ` 0 ` and deduct ` P ` from the vote account's
150
+ lamport balance and credit it to the epoch rewards sysvar account.
151
+
152
+ ### Runtime: Partitioned Rewards Distribution
153
+
154
+ Utilize the existing partitioned rewards distribution mechanism described in
155
+ [ SIMD-0118] to distribute block revenue rewards as well.
141
156
142
157
When calculating stake delegation rewards for a particular completed reward
143
158
epoch, construct a list of all vote accounts that were initialized at the
144
159
beginning of the reward epoch and had a non-zero active stake delegation. For
145
160
each vote account, retrieve its state at the end of the reward epoch and check
146
161
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:
149
-
150
- 1 . Sum all active stake delegated to the vote account during the reward epoch
151
- epoch. Let this total be ` A ` .
152
-
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.
156
-
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.
162
+ Then if ` P ` is non-zero, sum all active stake delegated to the vote account
163
+ during the reward epoch epoch. Let this total be ` A ` .
166
164
167
165
#### Individual Delegator Reward
168
166
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] .
167
+ For each individual stake account, multiply its active stake from the reward
168
+ epoch by ` P ` , and divide the result by ` A ` using integer division to get the
169
+ block revenue reward distribution amount.
170
+
171
+ The reward distribution amounts for each stake account can then be used to
172
+ construct a list of stake reward entries which MUST be partitioned and
173
+ distributed according to [ SIMD-0118] .
172
174
173
175
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.
176
+ rewards distribution, the epoch rewards sysvar balance should be debited to keep
177
+ capitalization consistent.
177
178
178
179
[ SIMD-0118 ] : https://github.com/solana-foundation/solana-improvement-documents/pull/118
179
180
0 commit comments