Co-authored-by: David Tumcharoen <david@alleslabs.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
parent
1cf2940393
commit
6b11b65b85
|
@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* (x/gov) [#19725](https://github.com/cosmos/cosmos-sdk/pull/19725) Fetch a failed proposal tally from proposal.FinalTallyResult in the gprc query.
|
||||
|
||||
## [v0.47.10](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.10) - 2024-02-27
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
@ -270,7 +270,7 @@ func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest)
|
|||
case proposal.Status == v1.StatusDepositPeriod:
|
||||
tallyResult = v1.EmptyTallyResult()
|
||||
|
||||
case proposal.Status == v1.StatusPassed || proposal.Status == v1.StatusRejected:
|
||||
case proposal.Status == v1.StatusPassed || proposal.Status == v1.StatusRejected || proposal.Status == v1.StatusFailed:
|
||||
tallyResult = *proposal.FinalTallyResult
|
||||
|
||||
default:
|
||||
|
|
|
@ -1478,6 +1478,37 @@ func (suite *KeeperTestSuite) TestGRPCQueryTallyResult() {
|
|||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"proposal status failed",
|
||||
func() {
|
||||
propTime := time.Now()
|
||||
proposal := v1.Proposal{
|
||||
Id: 1,
|
||||
Status: v1.StatusFailed,
|
||||
FinalTallyResult: &v1.TallyResult{
|
||||
YesCount: "4",
|
||||
AbstainCount: "1",
|
||||
NoCount: "0",
|
||||
NoWithVetoCount: "0",
|
||||
},
|
||||
SubmitTime: &propTime,
|
||||
VotingStartTime: &propTime,
|
||||
VotingEndTime: &propTime,
|
||||
Metadata: "proposal metadata",
|
||||
}
|
||||
suite.govKeeper.SetProposal(suite.ctx, proposal)
|
||||
|
||||
req = &v1.QueryTallyResultRequest{ProposalId: proposal.Id}
|
||||
|
||||
expTally = &v1.TallyResult{
|
||||
YesCount: "4",
|
||||
AbstainCount: "1",
|
||||
NoCount: "0",
|
||||
NoWithVetoCount: "0",
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
@ -1614,6 +1645,37 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryTallyResult() {
|
|||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"proposal status failed",
|
||||
func() {
|
||||
propTime := time.Now()
|
||||
proposal := v1.Proposal{
|
||||
Id: 1,
|
||||
Status: v1.StatusFailed,
|
||||
FinalTallyResult: &v1.TallyResult{
|
||||
YesCount: "4",
|
||||
AbstainCount: "1",
|
||||
NoCount: "0",
|
||||
NoWithVetoCount: "0",
|
||||
},
|
||||
SubmitTime: &propTime,
|
||||
VotingStartTime: &propTime,
|
||||
VotingEndTime: &propTime,
|
||||
Metadata: "proposal metadata",
|
||||
}
|
||||
suite.govKeeper.SetProposal(suite.ctx, proposal)
|
||||
|
||||
req = &v1beta1.QueryTallyResultRequest{ProposalId: proposal.Id}
|
||||
|
||||
expTally = &v1beta1.TallyResult{
|
||||
Yes: math.NewInt(4),
|
||||
Abstain: math.NewInt(1),
|
||||
No: math.NewInt(0),
|
||||
NoWithVeto: math.NewInt(0),
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
|
Loading…
Reference in New Issue