Merge PR #3269: Rename tallyresult to finaltallyresult

This commit is contained in:
Sunny Aggarwal 2019-01-10 07:02:55 -08:00 committed by Christopher Goes
parent 03bdd3f870
commit 31f61889ff
6 changed files with 24 additions and 21 deletions

View File

@ -70,6 +70,7 @@ IMPROVEMENTS
* [\#3158](https://github.com/cosmos/cosmos-sdk/pull/3158) Validate slashing genesis
* [\#3172](https://github.com/cosmos/cosmos-sdk/pull/3172) Support minimum fees in a local testnet.
* [\#3250](https://github.com/cosmos/cosmos-sdk/pull/3250) Refactor integration tests and increase coverage
* [\#2859](https://github.com/cosmos/cosmos-sdk/issues/2859) Rename `TallyResult` in gov proposals to `FinalTallyResult`
* SDK
* [\#3137](https://github.com/cosmos/cosmos-sdk/pull/3137) Add tag documentation

View File

@ -2271,7 +2271,7 @@ definitions:
type: string
proposal_status:
type: string
tally_result:
final_tally_result:
$ref: "#/definitions/TallyResult"
submit_time:
type: string

View File

@ -136,7 +136,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags {
tagValue = tags.ActionProposalRejected
}
activeProposal.SetTallyResult(tallyResults)
activeProposal.SetFinalTallyResult(tallyResults)
keeper.SetProposal(ctx, activeProposal)
keeper.RemoveFromActiveProposalQueue(ctx, activeProposal.GetVotingEndTime(), activeProposal.GetProposalID())

View File

@ -99,14 +99,14 @@ func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description
return nil
}
var proposal Proposal = &TextProposal{
ProposalID: proposalID,
Title: title,
Description: description,
ProposalType: proposalType,
Status: StatusDepositPeriod,
TallyResult: EmptyTallyResult(),
TotalDeposit: sdk.Coins{},
SubmitTime: ctx.BlockHeader().Time,
ProposalID: proposalID,
Title: title,
Description: description,
ProposalType: proposalType,
Status: StatusDepositPeriod,
FinalTallyResult: EmptyTallyResult(),
TotalDeposit: sdk.Coins{},
SubmitTime: ctx.BlockHeader().Time,
}
depositPeriod := keeper.GetDepositParams(ctx).MaxDepositPeriod

View File

@ -28,8 +28,8 @@ type Proposal interface {
GetStatus() ProposalStatus
SetStatus(ProposalStatus)
GetTallyResult() TallyResult
SetTallyResult(TallyResult)
GetFinalTallyResult() TallyResult
SetFinalTallyResult(TallyResult)
GetSubmitTime() time.Time
SetSubmitTime(time.Time)
@ -54,7 +54,7 @@ func ProposalEqual(proposalA Proposal, proposalB Proposal) bool {
proposalA.GetDescription() == proposalB.GetDescription() &&
proposalA.GetProposalType() == proposalB.GetProposalType() &&
proposalA.GetStatus() == proposalB.GetStatus() &&
proposalA.GetTallyResult().Equals(proposalB.GetTallyResult()) &&
proposalA.GetFinalTallyResult().Equals(proposalB.GetFinalTallyResult()) &&
proposalA.GetSubmitTime().Equal(proposalB.GetSubmitTime()) &&
proposalA.GetDepositEndTime().Equal(proposalB.GetDepositEndTime()) &&
proposalA.GetTotalDeposit().IsEqual(proposalB.GetTotalDeposit()) &&
@ -73,8 +73,8 @@ type TextProposal struct {
Description string `json:"description"` // Description of the proposal
ProposalType ProposalKind `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
TallyResult TallyResult `json:"tally_result"` // Result of Tallys
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
FinalTallyResult TallyResult `json:"final_tally_result"` // Result of Tallys
SubmitTime time.Time `json:"submit_time"` // Time of the block where TxGovSubmitProposal was included
DepositEndTime time.Time `json:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met
@ -98,11 +98,13 @@ func (tp TextProposal) GetProposalType() ProposalKind { return tp.P
func (tp *TextProposal) SetProposalType(proposalType ProposalKind) { tp.ProposalType = proposalType }
func (tp TextProposal) GetStatus() ProposalStatus { return tp.Status }
func (tp *TextProposal) SetStatus(status ProposalStatus) { tp.Status = status }
func (tp TextProposal) GetTallyResult() TallyResult { return tp.TallyResult }
func (tp *TextProposal) SetTallyResult(tallyResult TallyResult) { tp.TallyResult = tallyResult }
func (tp TextProposal) GetSubmitTime() time.Time { return tp.SubmitTime }
func (tp *TextProposal) SetSubmitTime(submitTime time.Time) { tp.SubmitTime = submitTime }
func (tp TextProposal) GetDepositEndTime() time.Time { return tp.DepositEndTime }
func (tp TextProposal) GetFinalTallyResult() TallyResult { return tp.FinalTallyResult }
func (tp *TextProposal) SetFinalTallyResult(tallyResult TallyResult) {
tp.FinalTallyResult = tallyResult
}
func (tp TextProposal) GetSubmitTime() time.Time { return tp.SubmitTime }
func (tp *TextProposal) SetSubmitTime(submitTime time.Time) { tp.SubmitTime = submitTime }
func (tp TextProposal) GetDepositEndTime() time.Time { return tp.DepositEndTime }
func (tp *TextProposal) SetDepositEndTime(depositEndTime time.Time) {
tp.DepositEndTime = depositEndTime
}

View File

@ -214,7 +214,7 @@ func queryTally(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Ke
if proposal.GetStatus() == StatusDepositPeriod {
tallyResult = EmptyTallyResult()
} else if proposal.GetStatus() == StatusPassed || proposal.GetStatus() == StatusRejected {
tallyResult = proposal.GetTallyResult()
tallyResult = proposal.GetFinalTallyResult()
} else {
// proposal is in voting period
_, tallyResult = tally(ctx, keeper, proposal)