Skip to content

review and fix Rent usage for rent decrease #283

@2501babe

Description

@2501babe

solana-foundation/solana-improvement-documents#437 lowers rent requirements to 1/10 what they are today, and solana-foundation/solana-improvement-documents#392 defines a mechanism to increase rent after these decreases, up to a maximum of the present level

this poses two problems for stake accounts:

  • Meta carries a rent_exempt_reserve field set on initialization. this is treated as if equivalent to minimum_balance() and so we must normalize our uses to prepare for when they diverge
  • lamports in stake accounts may either be "delegation" or "free" (undelegated), and only "free" lamports may be used for rent-exemption. if rent is lowered, a stake account is created, and then rent is increased, this distinction breaks down, and some amount of delegation may also be required for rent exemption. breaking such a fundamental invariant may have surprising, distressing, and potentially catastrophic consequences, as we regularly take arbitrary sums and differences of delegation, rent exemption, and total lamports that rely on lamports - delegation - rent >= 0

the plan is to fix the notional rent-exempt reserve (and maybe rename it in a future breaking update...) at the current rent price. i considered alternatively removing this field from Meta and always using current rent, coping with the fact that rent + delegation > lamports would be an allowed state, but this seems a much wider-ranging and dangerous change, especially because lamports can be freely added to and removed from an active stake account

just kidding. the plan is to fix our usage of Rent in bpf stake, double check the stake pools and solana cli, and otherwise do nothing

we will lean on minimum delegation to ensure the stake account lamport floor is high enough in light of rent reduction. having a higher minimum delegation also allows us more freedom if we need to mark down delegations due to rent increases

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions