latest change
This commit is contained in:
parent
09ea8dac11
commit
9d5425b806
|
@ -50,8 +50,9 @@ const (
|
|||
type ProposalType byte
|
||||
|
||||
const (
|
||||
ProposalTypePlainText = 0x1
|
||||
ProposalTypeSoftwareUpgrade = 0x2
|
||||
ProposalTypePlainText = 0x1 // Plain text proposals
|
||||
ProposalTypeSoftwareUpgrade = 0x2 // Text proposal inducing a software upgrade
|
||||
ProposalTypeParameterChange = 0x3 // Add or change a parameter in GlobalParams store
|
||||
)
|
||||
|
||||
type ProposalStatus byte
|
||||
|
@ -156,14 +157,17 @@ And the pseudocode for the `ProposalProcessingQueue`:
|
|||
return
|
||||
|
||||
proposal = load(Governance, <proposalID|'proposal'>) // proposal is a const key
|
||||
activeProcedure = load(params, 'ActiveProcedure')
|
||||
votingProcedure = load(GlobalParams, 'VotingProcedure')
|
||||
|
||||
if (CurrentBlock == proposal.VotingStartBlock + activeProcedure.VotingPeriod && proposal.CurrentStatus == ProposalStatusActive)
|
||||
if (CurrentBlock == proposal.VotingStartBlock + votingProcedure.VotingPeriod && proposal.CurrentStatus == ProposalStatusActive)
|
||||
|
||||
// End of voting period, tally
|
||||
|
||||
ProposalProcessingQueue.pop()
|
||||
validators = stakeKeeper.getAllValidators()
|
||||
validators =
|
||||
|
||||
|
||||
Keeper.getAllValidators()
|
||||
tmpValMap := map(sdk.Address)ValidatorGovInfo
|
||||
|
||||
// Initiate mapping at 0. Validators that remain at 0 at the end of tally will be punished
|
||||
|
@ -186,14 +190,14 @@ And the pseudocode for the `ProposalProcessingQueue`:
|
|||
if (isVal)
|
||||
tmpValMap(voterAddress).Vote = vote
|
||||
|
||||
|
||||
tallyingProcedure = load(GlobalParams, 'TallyingProcedure')
|
||||
|
||||
// Slash validators that did not vote, or update tally if they voted
|
||||
for each validator in validators
|
||||
if (validator.bondHeight < CurrentBlock - activeProcedure.GracePeriod)
|
||||
if (validator.bondHeight < CurrentBlock - tallyingProcedure.GracePeriod)
|
||||
// only slash if validator entered validator set before grace period
|
||||
if (!tmpValMap(validator).HasVoted)
|
||||
slash validator by activeProcedure.GovernancePenalty
|
||||
slash validator by tallyingProcedure.GovernancePenalty
|
||||
else
|
||||
proposal.updateTally(tmpValMap(validator).Vote, (validator.TotalShares - tmpValMap(validator).Minus))
|
||||
|
||||
|
@ -201,7 +205,7 @@ And the pseudocode for the `ProposalProcessingQueue`:
|
|||
|
||||
// Check if proposal is accepted or rejected
|
||||
totalNonAbstain := proposal.YesVotes + proposal.NoVotes + proposal.NoWithVetoVotes
|
||||
if (proposal.Votes.YesVotes/totalNonAbstain > activeProcedure.Threshold AND proposal.Votes.NoWithVetoVotes/totalNonAbstain < activeProcedure.Veto)
|
||||
if (proposal.Votes.YesVotes/totalNonAbstain > tallyingProcedure.Threshold AND proposal.Votes.NoWithVetoVotes/totalNonAbstain < tallyingProcedure.Veto)
|
||||
// proposal was accepted at the end of the voting period
|
||||
// refund deposits (non-voters already punished)
|
||||
proposal.CurrentStatus = ProposalStatusAccepted
|
||||
|
|
|
@ -42,6 +42,8 @@ upon receiving txGovSubmitProposal from sender do
|
|||
// InitialDeposit is negative or null OR sender has insufficient funds
|
||||
throw
|
||||
|
||||
if (txGovSubmitProposal.Type != ProposalTypePlainText) OR (txGovSubmitProposal.Type != ProposalTypeSoftwareUpgrade)
|
||||
|
||||
sender.AtomBalance -= initialDeposit.Atoms
|
||||
|
||||
proposalID = generate new proposalID
|
||||
|
@ -59,9 +61,9 @@ upon receiving txGovSubmitProposal from sender do
|
|||
proposal.NoWithVetoVotes = 0
|
||||
proposal.AbstainVotes = 0
|
||||
|
||||
activeProcedure = load(params, 'ActiveProcedure')
|
||||
depositProcedure = load(GlobalParams, 'DepositProcedure')
|
||||
|
||||
if (initialDeposit < activeProcedure.MinDeposit)
|
||||
if (initialDeposit < depositProcedure.MinDeposit)
|
||||
// MinDeposit is not reached
|
||||
|
||||
proposal.CurrentStatus = ProposalStatusOpen
|
||||
|
@ -116,8 +118,6 @@ upon receiving txGovDeposit from sender do
|
|||
// There is no proposal for this proposalID
|
||||
throw
|
||||
|
||||
activeProcedure = load(params, 'ActiveProcedure')
|
||||
|
||||
if (txGovDeposit.Deposit.Atoms <= 0) OR (sender.AtomBalance < txGovDeposit.Deposit.Atoms) OR (proposal.CurrentStatus != ProposalStatusOpen)
|
||||
|
||||
// deposit is negative or null
|
||||
|
@ -126,7 +126,9 @@ upon receiving txGovDeposit from sender do
|
|||
|
||||
throw
|
||||
|
||||
if (CurrentBlock >= proposal.SubmitBlock + activeProcedure.MaxDepositPeriod)
|
||||
depositProcedure = load(GlobalParams, 'DepositProcedure')
|
||||
|
||||
if (CurrentBlock >= proposal.SubmitBlock + depositProcedure.MaxDepositPeriod)
|
||||
proposal.CurrentStatus = ProposalStatusClosed
|
||||
|
||||
else
|
||||
|
@ -136,7 +138,7 @@ upon receiving txGovDeposit from sender do
|
|||
proposal.Deposits.append({txGovVote.Deposit, sender})
|
||||
proposal.TotalDeposit.Plus(txGovDeposit.Deposit)
|
||||
|
||||
if (proposal.TotalDeposit >= activeProcedure.MinDeposit)
|
||||
if (proposal.TotalDeposit >= depositProcedure.MinDeposit)
|
||||
// MinDeposit is reached, vote opens
|
||||
|
||||
proposal.VotingStartBlock = CurrentBlock
|
||||
|
|
Loading…
Reference in New Issue