Skip to content

Store effective stake in stake state #86

@jstarry

Description

@jstarry

In the epochs following a stake activation, the amount of stake that becomes effective is limited to the total cluster stake warmup rate (currently 9%). This means that if the total cluster activating stake in an epoch is more than 9% of the current total cluster effective stake in that epoch, all stake accounts that are not fully effective yet will only be partially effective. This continues epoch after epoch until the amount of activating stake no longer exceeds 9% of the effective stake. The possibility of this situations means that determining the effective stake of an individual delegation requires looking at the "stake history" sysvar which records cluster activating and effective stake for each recent epoch. This extra complexity is burdensome to the runtime, the stake program itself, as well as end-users and protocols which want to determine effective stake at the current epoch.

The runtime already updates all stake accounts at epoch boundaries as part of partitioned epoch rewards distribution. I think we should consider storing the computed effective stake in each stake account to avoid the complexity of recomputing this value. However, one of the drawbacks of relying on partitioned rewards distribution is that stake accounts won't have their effective stake updated until the rewards distribution is complete (could take a few hundred blocks). Offchain clients would need to check the epoch rewards sysvar to know whether rewards distribution has completed yet. This same issue applies to determining the post-inflation rewards stake balance for each epoch.

After the per-delegation warmup rate field was deprecated in solana-labs/solana#32723, we have 8 unused bytes in each delegated stake account. I think we should repurpose those bytes to store the current effective staked lamports.

Metadata

Metadata

Assignees

No one assigned

    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