Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoS rewards based on voting info #353

Closed
Tracked by #340
tzemanovic opened this issue Aug 18, 2022 · 1 comment · Fixed by #714
Closed
Tracked by #340

PoS rewards based on voting info #353

tzemanovic opened this issue Aug 18, 2022 · 1 comment · Fixed by #714
Assignees
Milestone

Comments

@tzemanovic
Copy link
Member

Currently, in the spec for PoS reward distribution, validators receive reward proportional to only their stake. We need to take the block voting information into consideration to incentivize participation in block creation

@brentstone
Copy link
Collaborator

brentstone commented Sep 21, 2022

Voting info is received for every block, while rewards are distributed only at the end of an epoch when the last block is finalized. We also do not know how many blocks will be in the current epoch until the end of the epoch, but we will assume that each block will yield the same reward over the course of the epoch.

To accomplish this, a storage key that looks like #{PoS}/validator_set/consensus/block_reward_accumulator will hold a LazyMap<Address, Decimal> to store the accumulator value for each validator in the consensus set. At every epoch boundary, this LazyMap will be reset to be empty. For each block, the Decimal value will be incremented with the fraction of that block's reward received by each validator. At the end of the epoch, we calculate the fraction of the total inflation that goes to each validator by dividing the validator accumulator value by the number of blocks in the epoch. The reward products and other relevant objects in storage are then updated appropriately.

@cwgoes cwgoes added this to the 0.15 milestone Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants