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

fix(protocol): limit reward per gas in weight calculation #14098

Merged
merged 10 commits into from
Jul 5, 2023

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Jul 4, 2023

About

Previously a prover can set the expected rewardPerGas really small to increase his own weight while still able to receive 80% * feePerGas as the effective rewardPerGas.
With this change, a prover's effective rewardPerGas is in the range of [80%-120%] * feePerGas. This effective rewardPerGas will also be returned from ProverPool to LibProposing.

Thanks to https://github.com/hugo-blue for reporting this issue.

Also, feePerGas and rewardPerGas shall be uint32, not uint16.

Gas

Previously:

Deployment Cost Deployment Size
1680364 8425
Function Name min avg median max # calls
assignProver 15329 18128 17264 81329 463
stake 29849 73572 76569 169703 151

Now:

Deployment Cost Deployment Size
1683164 8439
Function Name min avg median max # calls
assignProver 14406 21530 19052 80406 463
stake 29672 73229 76313 169383 151

@dantaik dantaik marked this pull request as ready for review July 4, 2023 12:50
@dantaik dantaik changed the title feat(protocol): limit reward per gas in weight calculation fix(protocol): limit reward per gas in weight calculation Jul 4, 2023
adaki2004
adaki2004 previously approved these changes Jul 4, 2023
Co-authored-by: Daniel Wang <dong77@gmail.com>
@dantaik dantaik added this pull request to the merge queue Jul 5, 2023
Merged via the queue into alpha-4 with commit 05da0e7 Jul 5, 2023
@dantaik dantaik deleted the limit_reward_per_gas_in_weight branch July 5, 2023 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants