Skip to content

Apply the lamports-per-byte feature gates to the rent sysvar - #431

Merged
Aursen merged 2 commits into
LiteSVM:masterfrom
plutohan:plutohan/issue-430-lamports-per-byte
Oct 9, 2026
Merged

Aursen merged 2 commits into
LiteSVM:masterfrom
plutohan:plutohan/issue-430-lamports-per-byte

Conversation

@plutohan

@plutohan plutohan commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Closes #430.

#423 added the SIMD-0437 set_lamports_per_byte_to_* feature IDs to the mainnet set, but set_sysvars still wrote Rent with the pre-reduction value, so the rent-exempt minimum was out of step with mainnet.

set_sysvars now mirrors Agave: it walks the five reduction gates (6333, 5080, 2575, 1322, 696) and takes the last active one, then lets the SIMD-0438 set_lamports_per_byte_to_6960 safeguard override the result. The existing deprecate_rent_exemption_threshold handling is unchanged. With the bundled mainnet feature set this yields 5080 lamports per byte, so one node test that asserted the old minimum balance moves from 1,746,960 to 1,275,080 lamports for 123 bytes.

Tests cover the mainnet default, each earlier gate when the later ones are inactive, no gate at all, activating a gate that is not yet in the mainnet set, the 6960 reset, and the legacy representation without the threshold feature. Changelog entry under Changed.

Comment thread crates/litesvm/src/lib.rs
Comment on lines +650 to +656
if self
.feature_set
.is_active(&agave_feature_set::set_lamports_per_byte_to_6960::id())
{
rent_account.lamports_per_byte =
agave_feature_set::set_lamports_per_byte_to_6960::LAMPORTS_PER_BYTE;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm curious, why is this one separate from the rest? What makes this feature different?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It mirrors how agave applies them in Bank::apply_feature_activations (https://github.com/anza-xyz/agave/blob/521aa0997c848ba2e9f1db43046c1f1480790e5b/runtime/src/bank.rs#L6418-L6460). The five SIMD-0437 gates are one ordered list where the latest activation wins, and the SIMD-0438 gate sits after that list because it is the safeguard that resets the value to 6960 and has to override any 0437 gate active at the same time. Appending it as a sixth element would give the same result here, but only by position, so I kept the override explicit like agave does. Happy to fold it into the list with a comment if you prefer the shorter form.

@Aursen
Aursen force-pushed the plutohan/issue-430-lamports-per-byte branch from 44bc688 to d4bf5c3 Compare October 9, 2026 02:48
@Aursen
Aursen merged commit 46178fc into LiteSVM:master Oct 9, 2026
23 checks passed
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.

Implement set_lamports_per_byte_to_* features

3 participants