Draft: Allow anyone to propose protocol and prevent activation of not revealed protocol
This MR modifies the voting process by splitting the submit proposal
operation
into two : propose protocol
and upvote proposal
and adding a new voting
period reveal
. It also modify the shell to retrieve a protocol from current
running protocol before trying to fetch it from the distributed db.
By doing so we prevent the activation of a protocol where the source have never been reveal to the shell. It also allow anyone to propose a new protocol, not only delegate.
this MR is based on !109, first commit is c63e5464
8264a883)
proposal (A proposal is
type t = {
period : Voting_period_repr.index;
protocol : Protocol.t option;
source : Signature.Public_key_hash.t;
}
Where period
is the voting period where this proposal have been submitted,
protocol
the source protocol and source
the contract that submitted it.
8264a883)
storage: (a new storage module Proposal
is created, it has the following sub storage
-
Proposed : Proposal_repr.t Protocol_hash.Map.t
: contains protocol hash proposed during the proposals period. This proposal does not contains the source of the protocol. -
Current : Protocol_hash.t * (Proposal_repr.t option)
: contains current protocol under voting/testing period. This proposal has to have the protocol source revealed during the reveal period. -
Winner: Protocol_hash.t -> Proposal_repr.t
: contains protocols that won the voting process. All proposals here have the protocol source.
710df7a5, c409a663, 6736fa67)
operation (-
source : Signature.Public_key_hash.t; hash : Protocol_hash.t; period : Voting_period_repr.index; }```
and the corresponding command tezos-client propose protocol <protocol_hash> for <contract_alias>
.
-
source : Signature.Public_key_hash.t; period : Voting_period_repr.index; proposals : Protocol_hash.t list; }```
This operation is just a rename to the previous Proposals
operation.
and the corresponding command tezos-client upvote proposals for <delegate> <proposal1> <proposal2> ...
-
period : Voting_period_repr.index; proposal : Protocol_hash.t; protocol : Protocol.t; }```
and the corresponding command tezos-client reveal protocol <src_dir> of proposal <proposal> for <contract_alias>
dad4a525, 7f5d2ca5)
constant (In order for the reveal
operation to be injected into the block and be send to
other nodes the following constant had to be increased :
Distributed_db_message.operation_max_size = 2mb
Constants_repr.max_operation_data_length = 2mb
Main voting operation size = 2mb
710df7a5, 89f9c372, c409a663, 6736fa67)
voting process (The voting process is modified as follow
- Proposals period (710df7a5, 89f9c372, c409a663)
- Any contract can propose a protocol with the
Propose
operation. This operation burn a fee of 256 Tez. To propose a protocol only the hash of the protocol have to be submitted. The source of the protocol have to be reveal in the next period. - Delegate can upvote a proposal using the
Upvote_proposals
operation. only 20Upvote_proposals
operation (as previously) is allowed by delegate. This operation verify that the proposal has already been proposed earlier and will fail otherwise. - When the period finish the wining proposal is added to the
Storage.Proposal.current
.
- Any contract can propose a protocol with the
- Reveal period (6736fa67)
- Any contract can reveal the current proposal with
Reveal_protocol
operation. This operation can only be submitted once and as soon as the proposal as been revealed we go to the next period.
- Any contract can reveal the current proposal with
The rest of the voting process remains unchanged.
e30d0640, fb1bbe6d)
environment modification (The environment have been modified so that protocols have to implement a new
function with the following signature : val reveal_protocol : context -> Block_header.shell_header -> Protocol_hash.t -> Protocol.t option tzresult Lwt.t
9414c4e3)
shell (When the Shell does not know a protocol it will first try to retrieve it from the current running protocol before fetching it from the distributed db.
f3760da6, 58909fd7)
small improvment (- remove the use of mutable var in client and refactor error logic of upvote_proposal (58909fd7, b3734aff)
- use a map
delegate -> Protocol_hash.Set.t
instead of a(delegate, Protocol_hash.t) set
for upvote storage (f3760da6)
todo :
-
rebase when review is finished