Proto: split `Delegate_storage`
This is a new version of the !5054 (closed), which I split in two parts, because that MR was quite large. (The remaining commits are in !5961 (merged).) I mainly tried to clean up the history. In particular now the first commit does not contain any further changes besides the split (this was probably the case at some point in !5054 (closed), but this property got lost during review and rebasing).
Below is a slightly updated description of the initial MR.
The file delegate_storage.ml a bit harsh to grasp. It is a huge file: ~1000 lines. The MR splits this file in multiple files, with separate concerns to guide the understanding. Note that there are already smaller files like delegate_activation_storage.ml responsible for only one or two keys in the store (for instance delegate_activation_storage.ml manages Storage.Contract.Delegate_last_cycle_before_deactivation and Storage.Contract.Inactive_delegate).
Here is the proposed split, and the storage tables that they handle:
-
delegate_storage.mlStorage.DelegatesStorage.Contract.Frozen_deposits_limit
-
delegate_missed_endorsements_storage.mlStorage.Contract.Missed_endorsement
-
delegate_slashed_deposits_storage.mlStorage.Slashed_deposits
-
delegate_sampler.mlStorage.Delegate_sampler_state
delegate_cycles.ml
The MR also contains further related minor refactoring, which simplify some interfaces, for instance:
-
Proto: remove
freeze_deposits_do_not_call_except_for_migrationThis function is only called once in the whole protocol code. I suggest to inline it for avoiding incorrect usage. Besides, the name is a bit misleading, the function is only used while migrating from genesis, which is more a chain initialization that a protocol migration.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) - [n/a] Document any change to the user interface, including configuration parameters (see node configuration)
- [n/a] Provide automatic testing (see the testing guide).
- [n/a] For new features and bug fixes, add an item in the appropriate changelog (
docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR