8000 reduce staking rewards rate by MoonShiesty · Pull Request #147 · aptos-foundation/mainnet-proposals · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

reduce staking rewards rate #147

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MoonShiesty
Copy link
< 8000 /div>

AIP: AIP-119
Release:
Type: Tokenomics

Security Consideration

The PR should reduce rewards_rate by 25bps (0.25%), and leave all other variables unchanged.

Test Result

TODO

Ecosystem Impact

staking_config::staking_rate() will go from 6.79->6.54. All staking operators, and defi protocols will need to adjust to a new staking_rate()

let prev_rewards_rate = fixed_point64::create_from_rational(rewards_rate_numerator as u128, rewards_rate_denominator as u128);
let aip_monthly_rewards_rate_reduction = fixed_point64::create_from_rational(25, 10000); // 25 bps
let new_rewards_rate = prev_rewards_rate.sub(aip_monthly_rewards_rate_reduction); // subtract 25 bps from the current rewards rate
let min_rewards_rate = fixed_point64::create_from_raw_value(52628560842293);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using create_from_rational so you can pass in numerator and denominator instead of magic looking values here that are harder to review https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-stdlib/sources/fixed_point64.move#L129

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no simple way to extract the original the rewards_rate_decrease denominator or numerator

fixed64 doesn't provide this functionality either. if you know the last proposal with changed staking config, we
could use the same numerator/denominator for rewards_rate_decrease

or we could apply a bitmask to the u128 value, in my opinion create_from_raw_value for the min_rewards_rate and new_reward_rate will be less prone to errors

looking at the implementation of staking_config::reward_rate(), i agree it will be easier to simply compute the new per-epoch reward_rate, ill try to write a test to config the new rewards_rate returns the right reward_rate()

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done and added tests

let new_rewards_rate = prev_rewards_rate.sub(aip_monthly_rewards_rate_reduction); // subtract 25 bps from the current rewards rate
let min_rewards_rate = fixed_point64::create_from_raw_value(52628560842293);
let rewards_rate_period_sec = 31536000; // unchanged, 1 year
let rewards_rate_decrease_rate = fixed_point64::create_from_raw_value(276701161105643274); // unchanged
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not possible here, can you confirm the raw values from the PR as the same as the on-chain values

i also have a fork with the view functions that would allow us to just view the previous value

let aip_monthly_rewards_rate_reduction = fixed_point64::create_from_rational(25, 10000); // 25 bps
let new_rewards_rate = prev_rewards_rate.sub(aip_monthly_rewards_rate_reduction); // subtract 25 bps from the current rewards rate
let min_rewards_rate = fixed_point64::create_from_raw_value(52628560842293);
let rewards_rate_period_sec = 31536000; // unchanged, 1 year
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For any unchanged values, I'd suggest just reading current values and passing them here to make absolutely sure things don't accidentally get changed

Copy link
Author
@MoonShiesty MoonShiesty May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no view function for these values

i grabbed the magic numbers from the explorer, the only data that's exposed is rewards_rate(), and rewards_rate() is the per-epoch rate, not the yearly rate which is what we need to pass here as input

use aptos_std::fixed_point64;

fun main(proposal_id: u64) {
let framework_signer = aptos_governance::resolve_multi_step_proposal(proposal_id, @0000000000000000000000000000000000000000000000000000000000000001, vector::empty<u8>());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Use vector[] instead of vector::empty

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@MoonShiesty
Copy link
Author

@movekevin ive created a fork of aptos-core with view functions to check the results of the updating the rewards rate:

https://github.com/mirage-protocol/aptos-core.git", rev = "expose-staking-rewards-config-for-testing

ive added a sources folder with the script and tests. if you don't like having a script call an inline function, which is a bit sketchy, ive also copied the script into the folder above following the patterns of the other proposals

there's tests to make sure that the annual rewards rate is lowered by 25bps

as well as tests to make sure the other StakingRewardsConfig variables dont change

@sherry-x sherry-x requested a review from davidiw June 4, 2025 12:44
@MoonShiesty MoonShiesty requested a review from movekevin June 4, 2025 21:50
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.

2 participants
0