SIMD-0149
Migrate Snapshot Serialized Epoch Stakes
TL;DR
Migrate bank snapshots to a new "epoch stakes" field in order to store additional stake state needed for calculating partitioned rewards.
Summary
Migrate bank snapshots to a new "epoch stakes" field in order to store additional stake state needed for calculating partitioned rewards.
Motivation
In order to properly support recalculating partitioned rewards (SIMD-0118) when rebooting from a snapshot in the middle of the rewards distribution period at the beginning of an epoch, additional stake state should be stored in the epoch stakes snapshot field. Since the currently used epoch stakes field doesn't support versioning, we propose migrating the snapshot format to use a new epoch stakes field which is versioned and supports storing the required stake state.
Key Changes
- Introduce support for deserializing the migrated epoch stakes field
- Enable serializing epoch stakes to the new field and phase out the old field
- Entries created during epoch boundaries which have _full_ stake account data
- Entries deserialized from the old snapshot epoch stakes field which only have stake delegation state.
- Entries deserialized from the new snapshot epoch stakes field which have full stake state.
Impact
No major impact beyond backwards compatibility concerns. Snapshots will be a few MB larger than before.
Backwards Compatibility
Snapshot changes must be made in a backwards compatible way. Handling compatibility is thoroughly discussed in the proposal above.
Security Considerations
Missing or corrupted epoch stakes entries caused by faulty snapshot migration can cause validators to fork off from the cluster or cause the cluster to lose consensus if sufficient stake is affected. Care should be taken to ensure that implementations can detect corrupted or incorrect values.