Proto: prepare `per_block_vote` to allow multiple toggle votes
This MR is extracted from !5106 (closed) and depends on !5167 (merged).
This refactor the liquidity-baking-toggle-vote
to easily add new toggle vote. An example can be found in !5106 (closed), see g.b.fefe/tezos@57888f0e
In the process, this MR add a non-mandatory option --liquidity-baking-toggle-vote
to tezos-client bake for ...
.
Description
The MR is split in three parts, that can probably be reviewed and merged independently.
Liquidity_baking_repr
Refactor We first extract from Liquidity_baking_repr
the type of toggle vote (e.g. LB_pass
, ...) and the EMA code, they are moved in their onw module.
Patches:
-
Proto/Per_block_vote: introduce Toggle_vote_repr
-
Proto/Per_block_vote: introduce Toggle_vote_ema_repr
Prepare the protocol for new toggle votes
We then modify storage for allowing multiple vote, and update the record types for block header, block metadata and parametric constant, to replace the ad-hoc field for liquidity_baking
by a record toggle_votes
that can later be extended. This refactoring does not change the block binary representation.
Proto/Per_block_vote: prepare storage for multiple vote
Proto/Per_block_vote: prepare block metadata for multiple vote
Proto/Per_block_vote: prepare constants for multiple vote
Proto/Per_block_vote: prepare block header for multiple vote
Proto/Per_block_vote: update testsuite
Prepare the baker
We then modify the baker code.
Tests/Python: share toggle vote arguments
Baker: prepare "Per_block_vote_file" for multiple votes
Baker: prepare CLI for multiple votes
Baker: add toggle votes options to "bake for"