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

rent: Rent exempt calculation improvement #46

Merged
merged 3 commits into from
Nov 25, 2024
Merged

rent: Rent exempt calculation improvement #46

merged 3 commits into from
Nov 25, 2024

Conversation

febo
Copy link
Owner

@febo febo commented Nov 24, 2024

Problem

Rent exempt calculation involves operations with f64 values, which are expensive to do on-chain as described in this SIMD.

Solution

We can avoid f64 operations when the rent exempt threshold is known to not have a fractional part. This PR checks whether the current rent exempt is equal to the default one (2.0) or not; when it is, the calculation of rent exempt is performed as u64.

It also adds a convenient method to access the Rent values from a bytes array.

@febo febo merged commit 2f93fd8 into main Nov 25, 2024
3 checks passed
@febo febo deleted the febo/rent branch November 25, 2024 13:48
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