-
Notifications
You must be signed in to change notification settings - Fork 86
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
feat: relative treasury inflation #1740
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see anything weird. Good job here William! I left mostly (super) NITs and some questions.
last_update: std::time::SystemTime::now() | ||
.duration_since(std::time::UNIX_EPOCH) | ||
.expect("SystemTime before UNIX EPOCH!") | ||
.as_secs(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would mean that each node using this genesis will have a different configuration (different time machines). Is it ok or should they have the exact initial configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thats the implication. However, this only affects new networks, i.e. either Development if it needs to be reset or otherwise local ones. Therefore, it shouldn't have an impact. If we make it static, the first treasury inflation reward will huge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you're using the system clock, not the clock used on-chain (that changed each block by 12 secs). I guess we're okay with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point but it should be fine here. It only affects the first treasury reward and should never affect live chains/production.
@@ -1,6 +1,6 @@ | |||
use cfg_primitives::CFG; | |||
use cfg_types::tokens::CurrencyId; | |||
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller}; | |||
use frame_benchmarking::v2::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the benchmarking version!
+ Member | ||
+ FixedPointNumberExtension | ||
+ TypeInfo | ||
+ MaybeSerializeDeserialize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super NIT.
- I think
MaybeSerializeDeserialize
is not needed. TypeInfo
is already inside ofParameter
Co-authored-by: Luis Enrique Muñoz Martín <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if Frederik wants to also review this, but LGTM!
Description
Fixes #1495
The current treasury inflation is based on absolute numbers and thus diverging from the annual 3% on which the community decided both for Altair (-> RFC) as well as Centrifuge (-> CP6). This PR fills this gap by switching to a relative treasury inflation. As a result, all three runtimes have the exact same block rewards configuration now except for different collator reward amounts.
Now
Inside
pallet-block-rewards
, the annual treasury inflation rate is stored. On each new session, collators receive their reward. Moreover, the treasury is funded with the proration based on the configured rate and session duration in seconds:Before
Before, the rewards configuration revolved around an absolute
total_amount
per session which was first distributed to the collators and the remainder minted into the treasury, if configured in the runtime (true for Centrifuge, false for Altair). For Altair, we also need to burn 15,752,730 AIR (equivalent of annual Treasury block rewards) which can be batched with the runtime upgrade proposalChecklist: