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_active
intoStake_storage
It merges
Delegate_storage.set_active
intoStake_storage.set_active
. The functions inDelegate_storage
do not require access to the part ofStorage
for whichDelegate_storage
is responsible. Merging the two functions simplifies the interfaces and avoids having three distinctset_active
functions. -
Proto: simplify
Delegate.registered
The function
Contract_delegate_storage.registered
is 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_end
intoDelegate.cycle_end
This 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.Delegate
Move 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.rst
for the protocol and the environment,CHANGES.rst
at the root of the repository for everything else). -
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR