Skip to content

Commit 6c6cda1

Browse files
committed
amend simd-0123
1 parent 7395033 commit 6c6cda1

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

proposals/0123-block-revenue-distribution.md

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -137,43 +137,45 @@ vote state field `pending_delegator_rewards` and added to the balance of vote
137137
account. If either of these conditions is violated, the delegator rewards amount
138138
MUST be burned.
139139

140-
### Runtime: Delegator Rewards Distribution
140+
### Runtime: Block Revenue Distribution
141141

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+
At the beginning of each epoch, pending delegator rewards will be collected from
143+
actively staked vote accounts into the epoch rewards sysvar account and then
144+
distributed to stake accounts utilizing the existing partitioned rewards
145+
distribution mechanism described in [SIMD-0118].
149146

150-
1. Sum all active stake delegated to the vote account during the reward epoch
151-
epoch. Let this total be `A`.
147+
#### Delegator Rewards Calculation
152148

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.
149+
During the beginning of the first block of an epoch `N`, all pending delegator
150+
rewards from all vote accounts with a non-zero active stake delegation during
151+
the reward epoch `N - 1` MUST be transferred by the runtime to the epoch rewards
152+
sysvar account for distribution.
156153

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.
154+
For each actively staked vote account, retrieve its state at the end of the
155+
reward epoch and check the `pending_delegator_rewards` field in its vote state.
156+
Let this value be `P`. If `P` is non-zero, set the `pending_delegator_rewards`
157+
field to `0` and deduct `P` from the vote account's lamport balance and credit
158+
it to the epoch rewards sysvar account's lamport balance. Then if `P` is
159+
non-zero, sum all active stake delegated to the vote account during the reward
160+
epoch epoch `N - 1`. Let this total be `A`.
166161

167162
#### Individual Delegator Reward
168163

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].
164+
For each individual stake account with an active non-zero delegation, multiply
165+
its active stake in reward epoch `N - 1` by `P`, and divide the result by
166+
`A` using integer division to get the individual stake account's block revenue
167+
reward distribution amount.
168+
169+
#### Delegator Rewards Distribution
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].
172174

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.
175+
During partitioned reward distribution in a given slot, when reward entries are
176+
used to distribute block revenue rewards, the epoch rewards sysvar account's
177+
lamport balance MUST be debited by the block revenue reward distribution amount
178+
to keep capitalization consistent.
177179

178180
[SIMD-0118]: https://github.com/solana-foundation/solana-improvement-documents/pull/118
179181

@@ -246,5 +248,5 @@ NA
246248

247249
## Backwards Compatibility
248250

249-
A feature gate will be used to enable block reward distribution at an epoch
250-
boundary.
251+
A feature gate will be used to enable block revenue reward distribution at an
252+
epoch boundary.

0 commit comments

Comments
 (0)