-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
rent collector improvments #6888
rent collector improvments #6888
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6888 +/- ##
========================================
- Coverage 78.7% 73.1% -5.7%
========================================
Files 222 222
Lines 42939 46215 +3276
========================================
- Hits 33829 33817 -12
- Misses 9110 12398 +3288 |
sdk/src/rent.rs
Outdated
@@ -26,12 +28,16 @@ pub const DEFAULT_EXEMPTION_THRESHOLD: f64 = 2.0; | |||
/// default amount of rent to burn, as a fraction of std::u8::MAX | |||
pub const DEFAULT_BURN_PERCENT: u8 = ((50usize * std::u8::MAX as usize) / 100usize) as u8; | |||
|
|||
/// default base rent | |||
pub const DEFAULT_BASE_RENT_PER_YEAR: u64 = 0; |
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.
What if we expressed this in terms of DEFAULT_LAMPORTS_PER_BYTE_YEAR? Say the base account overhead is whatever the current size of the Account structure currently is * DEFAULT_LAMPORTS_PER_BYTE_YEAR
. That'll still be zero currently so no functional change to this PR
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.
@mvines We decided to detach this from current size of the Account structure right? Otherwise, we need to do hard fork in case size changes in future.
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. I was just suggesting we use the current size of the Account structure as the value we hard code here (rather than randomly picking a value)
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.
@mvines hmm. This could work out. But, do you think hard coding it is a good idea compared to keeping it as default, and allowing us to overwrite it in future via gensis?
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 just mean this:
-pub const DEFAULT_BASE_RENT_PER_YEAR: u64 = 0;
+pub const DEFAULT_BASE_RENT_PER_YEAR: u64 = 128 * DEFAULT_LAMPORTS_PER_BYTE_YEAR;
128 seems is approximately the current Account size.
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.
maybe that's too much for a base rent 🤷♂
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.
ahh, I misunderstood. Cool, this works.
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.
@mvines done.
hmm. On visualising, this design is less intuitive, instead we could do this:
|
if you take approach 1), there are 2 variables that need to change in order to turn on rent... approach 2) means you only have to change lamports_per_byte_year |
this is what I meant. the old test had an implicit "1" in the calculation that I've pulled out for more clarity |
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.
lgtm
Pull request has been modified.
4aaf911
to
17e2aa2
Compare
17e2aa2
to
e9ca59a
Compare
Problem
.update
is called, which is in-efficientSummary of Changes
Fixes #6864
tag: @mvines @aeyakovenko @rob-solana