Proto: refactor `Delegate_storage`
This is part 2 of the old "Split delegate storage". It contains in particular a simplification of Delegate.registered and a refactoring Delegate_storage.set.
Here is the original description of some of the commits.
-
Proto: move
set_activeintoStake_storageIt merges
Delegate_storage.set_activeintoStake_storage.set_active. The functions inDelegate_storagedo not require access to the part ofStoragefor whichDelegate_storageis responsible. Merging the two functions simplifies the interfaces and avoids having three distinctset_activefunctions. -
Proto: simplify
Delegate.registeredThe function
Contract_delegate_storage.registeredis based on an invariant ensured byDelegate_storage(i.e. a delegate is always self-delegated), so it's better to move the function. Then, we simplify the function implementation by requiring only one read access into the context. EZ: see comments !5054 (comment 922878720) and !5054 (comment 950770494) and !5054 (comment 959818217) for more info -
Proto: merge
Seed.cycle_endintoDelegate.cycle_endThis is to enforce a little bit more the following comment in
seed_storage.ml:(* NB: the clearing of past seeds is done elsewhere by the caller *). -
Proto: introduce
Alpha_context.Contract.DelegateMove the functions
Alpha_context.Delegate.{init,set,find}intoAlpha_context.Contract.Delegate. These functions basically handle the field 'delegate' of a contract. They do not handle storage related to a given delegate, like other function inAlpha_context.Delegate.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) - [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