Mavryk_raw_protocol_001_PtAtLas.Vote_storage
Manages all the voting related storage in Storage.Vote.
val get_delegate_proposal_count :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
int Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
get_delegate_proposal_count ctxt proposer
returns the number of proposals already made by proposer
in the current voting cycle.
This number of proposals, aka count
, has its own storage bucket.
val set_delegate_proposal_count :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
int ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Lwt.t
set_delegate_proposal_count ctxt proposer count
sets proposer
's number of submitted proposals to count
.
More precisely, the relevant storage bucket is allocated and initialized to count
if it didn't exist; otherwise it is simply updated.
val has_proposed :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t ->
bool Mavryk_protocol_environment_001_PtAtLas.Lwt.t
has_proposed ctxt proposer proposal
indicates whether the proposer
has already proposed the proposal
.
val add_proposal :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Lwt.t
add_proposal ctxt proposer proposal
records the submission of proposal
by proposer
.
val get_proposals :
Raw_context.t ->
int64 Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.Map.t
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Computes for each proposal how many delegates proposed it.
val clear_proposals :
Raw_context.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val ballots_zero : ballots
All vote counts set to zero.
val ballots_encoding :
ballots Mavryk_protocol_environment_001_PtAtLas.Data_encoding.t
Encoding for ballots
.
val pp_ballots :
Mavryk_protocol_environment_001_PtAtLas.Format.formatter ->
ballots ->
unit
Pretty printer for ballots
.
val has_recorded_ballot :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t ->
bool Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val record_ballot :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t ->
Vote_repr.ballot ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Records a vote for a delegate, returns a Error (Storage_error Existing_key)
if the vote was already registered
val get_ballots :
Raw_context.t ->
ballots Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Computes the sum of the current ballots weighted by stake.
val get_ballot_list :
Raw_context.t ->
(Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t
* Vote_repr.ballot)
list
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val clear_ballots :
Raw_context.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val listings_encoding :
(Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t * int64)
list
Mavryk_protocol_environment_001_PtAtLas.Data_encoding.t
val update_listings :
Raw_context.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Populates !Storage.Vote.Listings
using the currently existing staking power and sets `Voting_power_in_listings`. Inactive delegates or delegates without the minimal required stake are not included in the listings.
val in_listings :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t ->
bool Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Verifies the presence of a delegate in the listing.
val get_listings :
Raw_context.t ->
(Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t * int64)
list
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
type delegate_info = {
voting_power : Mavryk_protocol_environment_001_PtAtLas.Int64.t option;
current_ballot : Vote_repr.ballot option;
current_proposals : Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t
list;
remaining_proposals : int;
}
val pp_delegate_info :
Mavryk_protocol_environment_001_PtAtLas.Format.formatter ->
delegate_info ->
unit
val delegate_info_encoding :
delegate_info Mavryk_protocol_environment_001_PtAtLas.Data_encoding.t
val get_voting_power_free :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
int64 Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Returns the voting power of a delegate from the voting power listings. This function does not account for gas cost.
val get_voting_power :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
(Raw_context.t * int64)
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Same as get_voting_power_free
but consumes gas.
val get_current_voting_power_free :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.public_key_hash ->
int64 Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Same as get_voting_power_free
but computes the voting power based on the current stake of the delegate instead of reading it from the vote listings.
val get_total_voting_power_free :
Raw_context.t ->
int64 Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Returns the sum of all voting power in the listings, without accounting for gas cost.
val get_total_voting_power :
Raw_context.t ->
(Raw_context.t * int64)
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Returns the sum of all voting power in the listings.
val get_current_quorum :
Raw_context.t ->
int32 Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val get_participation_ema :
Raw_context.t ->
int32 Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val set_participation_ema :
Raw_context.t ->
int32 ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val current_proposal_exists :
Raw_context.t ->
bool Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Indicates whether there is a current proposal in the storage.
val get_current_proposal :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Retrieves the current proposal.
val find_current_proposal :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t option
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Retrieves the current proposal.
val init_current_proposal :
Raw_context.t ->
Mavryk_protocol_environment_001_PtAtLas.Protocol_hash.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Registers a current proposal.
val clear_current_proposal :
Raw_context.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Removes the current proposal. Does nothing if there was no current proposal.
val init :
Raw_context.t ->
start_position:Mavryk_protocol_environment_001_PtAtLas.Int32.t ->
Raw_context.t Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
Sets the initial quorum to 80% and period kind to proposal.