Skip to content
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

Set syavar rent_epoch at new update time #3398

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HaoranYi
Copy link

@HaoranYi HaoranYi commented Oct 31, 2024

Problem

When we create new sysvar, we make sure that it is rent exempt. But we don't set it rent_epoch to RENT_EXEMPT_EPOCH. Instead, we are relying on rent collection code to do that.
In the future, after we skip the rewrite, we will also disable rent collection. Therefore, we can't rely on the rent collection code to set rent_epoch.

In this PR, we set rent_epoch to RENT_EXEMPT_EPOCH at the time of new sysvar update time.

Note that this won't affect existing sysvars since they have already all have rent_epoch set to u64::MAX. But it is a "must-have" for disable rent collection code.

A quick scan of all sysvars on mainnet shows that all of them are rent exempt and have rent_epoch set to RENT_EXEMPT_EPOCH.

sysvar account: SysvarStakeHistory1111111111111111111111111 18446744073709551615 114979200
sysvar account: SysvarRecentB1ockHashes11111111111111111111 18446744073709551615 42706560
sysvar account: SysvarS1otHistory11111111111111111111111111 18446744073709551615 913326000
sysvar account: SysvarS1otHashes111111111111111111111111111 18446744073709551615 143487360
sysvar account: SysvarC1ock11111111111111111111111111111111 18446744073709551615 1169280
sysvar account: SysvarEpochSchedu1e111111111111111111111111 18446744073709551615 1120560
sysvar account: SysvarFees111111111111111111111111111111111 18446744073709551615 946560
sysvar account: SysvarLastRestartS1ot1111111111111111111111 18446744073709551615 946560
sysvar account: SysvarRent111111111111111111111111111111111 18446744073709551615 1009200
sysvar account: SysvarRewards111111111111111111111111111111 18446744073709551615 1002240

Summary of Changes

  • Set syavar rent_epoch at init time
  • Fix tests

Fixes #

@HaoranYi HaoranYi changed the title syavar rent_epoch syavar rent_epoch (wip) Oct 31, 2024
@HaoranYi HaoranYi marked this pull request as draft October 31, 2024 00:52
@HaoranYi HaoranYi changed the title syavar rent_epoch (wip) Set syavar rent_epoch at init Oct 31, 2024
@HaoranYi HaoranYi changed the title Set syavar rent_epoch at init Set syavar rent_epoch at new update time Oct 31, 2024
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.

1 participant