Skip to content

Conversation

@joncinque
Copy link
Collaborator

Problem

Rent is gone, and SIMD-0194 will deprecate the exemption threshold, but the field still exists in the actual sysvar on-chain.

Summary of changes

Remove all deprecated code related to collecting rent, and use the new default values for Rent after SIMD-0194.

To go with this, avoid floating point math in minimum_balance(), which was one of the of motivations for the change in the first place.

Add a test to make sure the old and new calcs are the same.

Closes #275

#### Problem

Rent is gone, and SIMD-0194 will deprecate the exemption threshold, but
the field still exists in the actual sysvar on-chain.

#### Summary of changes

Remove all deprecated code related to collecting rent, and use the new
default values for Rent after SIMD-0194.

To go with this, avoid floating point math in `minimum_balance()`, which
was one of the of motivations for the change in the first place.

Add a test to make sure the old and new calcs are the same.
@joncinque joncinque requested a review from febo December 5, 2025 00:28
@joncinque joncinque added the breaking PR contains breaking changes label Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

pbkdf2 = { version = "0.11.0", default-features = false }
proc-macro2 = "1.0.93"
proptest = "1.6"
proptest = "1.9"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This upgrade is just to make things easier once #461 lands

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

rent/src/lib.rs Outdated
let bytes = data_len as u64;
(((ACCOUNT_STORAGE_OVERHEAD + bytes) * self.lamports_per_byte_year) as f64
* self.exemption_threshold) as u64
if self.unused_exemption_threshold == DEFAULT_EXEMPTION_THRESHOLD {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Currently this is only avoiding the f64 operation when the threshold is 1.0. Wonder if it would be better to also include the current case (threshold equal to 2.0), so we get the benefit before SIMD-0194 lands.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My initial implementation actually had that, and then I reverted it 😅 I'll put it back in, and we can remove it once the SIMD is live, it's a good point. It also lets us (more) safely remove all float logic

febo
febo previously approved these changes Dec 5, 2025
Copy link
Contributor

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks great – just left a question.

@febo
Copy link
Contributor

febo commented Dec 5, 2025

We might need to update the ABI diggest on GenesisConfig since it includes a Rent field.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@joncinque
Copy link
Collaborator Author

Ok, this should be good for another look!

Copy link
Contributor

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks great!

@joncinque
Copy link
Collaborator Author

I'm going to hold off on merging this for roughly 10 days, then we can merge, publish, and update agave accordingly

CASABECI

This comment was marked as spam.

@CASABECI

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking PR contains breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants