Skip to content

svm: Remove SVMRentCollector, use Rent directly #6782

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

Merged
merged 4 commits into from
Aug 4, 2025

Conversation

joncinque
Copy link

Problem

Now that rent collection is a thing of the past, we should remove the concepts of rent collection and rent epoch. Unfortunately, there's a lot of code around rent collection in the SVM.

Summary of changes

A few parts:

  • Stop using RentCollector in SVM, use Rent instead
  • Rename svm-rent-collector to svm-rent-calculator
  • Remove the SVMRentCollector trait
  • Remove the rent collector wrapper in runtime, which does the same thing, except submits metrics, which shouldn't be needed

@joncinque joncinque requested a review from buffalojoec June 30, 2025 21:24
@joncinque joncinque requested a review from a team as a code owner June 30, 2025 21:24
@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@5cad63d). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6782   +/-   ##
=========================================
  Coverage          ?    82.8%           
=========================================
  Files             ?      801           
  Lines             ?   363391           
  Branches          ?        0           
=========================================
  Hits              ?   300971           
  Misses            ?    62420           
  Partials          ?        0           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Choose a reason for hiding this comment

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

All of these free functions were originally on the SVMRentCollector trait, which enabled consumers of SVM to override them and implement custom rent behavior. We should make sure nobody depends on this capability before removing it.

I wonder if it's better to just phase out the concept of "transitioning" and ultimately the RentState::RentPaying variant as well, since SVM no longer needs rent-paying evaluation logic, as per #6622.

Copy link
Author

Choose a reason for hiding this comment

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

GitHub doesn't seem to report anything: https://github.com/search?q=%22impl+SVMRentCollector%22&type=code

But I can do a PR first to deprecate the trait, backport it to v2.3, and then put this PR back in. What do you think?

As for the transition function, it makes sense to remove it since it should always return true.

For the other free functions, I can move them into solana-svm, since they're only used by solana-runtime and solana-svm. How does that sound?

Choose a reason for hiding this comment

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

Actually, what do you think about just folding the whole crate into a rent_calculator module within SVM? I only see the functions and RentState used in runtime & SVM.

Copy link
Author

Choose a reason for hiding this comment

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

You got it, done! There were a lot of functions removed since the creation of this PR, so I had to remove changed functions during the rebase

Copy link
Author

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Sorry for the lateness on this, thanks for the comments!

Copy link
Author

Choose a reason for hiding this comment

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

GitHub doesn't seem to report anything: https://github.com/search?q=%22impl+SVMRentCollector%22&type=code

But I can do a PR first to deprecate the trait, backport it to v2.3, and then put this PR back in. What do you think?

As for the transition function, it makes sense to remove it since it should always return true.

For the other free functions, I can move them into solana-svm, since they're only used by solana-runtime and solana-svm. How does that sound?

Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Changes look good to me, but let's consider just collapsing the entire crate into solana-svm, as per discussion.

#### Problem

Now that rent collection is a thing of the past, we should remove the
concepts of rent collection and rent epoch. Unfortunately, there's a lot
of code around rent collection in the SVM.

#### Summary of changes

A few parts:

* Stop using RentCollector in SVM, use Rent instead
* Rename svm-rent-collector to svm-rent-calculator
* Remove the SVMRentCollector trait
* Remove the rent collector wrapper in runtime, which does the same
  thing, except submits metrics, which shouldn't be needed
@joncinque joncinque merged commit 6fbbaf6 into anza-xyz:master Aug 4, 2025
53 checks passed
@joncinque joncinque deleted the no-rc-svm branch August 4, 2025 15:05
joncinque added a commit that referenced this pull request Aug 12, 2025
* rent-collector: Inline struct and const, remove dep

#### Problem

As outlined in anza-xyz/solana-sdk#226, the
RentCollector is no longer needed, and with #6782, it's needed even
less.

#### Summary of changes

Inline the `RentCollector` struct into `solana-runtime` with the few
functions needed. This changes the frozen-abi hash because the type
now comes from a different crate.

The only other usage was the `RENT_EXEMPT_RENT_EPOCH` constant, which is
used in svm and accounts-db. Since there's no good common crate that
both of these use, I inlined the const in both places, along with a test
to make sure they don't diverge.

Finally, remove solana-rent-collector usage everywhere.

* Make `RentCollector` crate-private, expose rent() directly

* Revert "Make `RentCollector` crate-private, expose rent() directly"

This reverts commit 101c5bf.

* Put accidentally removed comment back in post-rebase

* Also remove it from snapshot_package.rs
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.

3 participants