feat(cli): cancel gov proposal by proposer before voting period ends (#13010)

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Marko <marbar3778@yahoo.com>
Closes https://github.com/cosmos/cosmos-sdk/issues/11554
This commit is contained in:
Sai Kumar 2023-01-20 18:37:09 +05:30 committed by GitHub
parent c8f2f1d594
commit a4cf8e8c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 3440 additions and 413 deletions

View File

@ -63,6 +63,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/bank) [#11981](https://github.com/cosmos/cosmos-sdk/pull/11981) Create the `SetSendEnabled` endpoint for managing the bank's SendEnabled settings.
* (x/auth) [#13210](https://github.com/cosmos/cosmos-sdk/pull/13210) Add `Query/AccountInfo` endpoint for simplified access to basic account info.
* (x/consensus) [#12905](https://github.com/cosmos/cosmos-sdk/pull/12905) Create a new `x/consensus` module that is now responsible for maintaining Tendermint consensus parameters instead of `x/param`. Legacy types remain in order to facilitate parameter migration from the deprecated `x/params`. App developers should ensure that they execute `baseapp.MigrateParams` during their chain upgrade. These legacy types will be removed in a future release.
* (x/gov) [#13010](https://github.com/cosmos/cosmos-sdk/pull/13010) Add `cancel-proposal` feature to proposals. Now proposers can cancel the proposal prior to the proposal's voting period end time.
* (client/tx) [#13670](https://github.com/cosmos/cosmos-sdk/pull/13670) Add validation in `BuildUnsignedTx` to prevent simple inclusion of valid mnemonics
* [#13473](https://github.com/cosmos/cosmos-sdk/pull/13473) ADR-038: Go plugin system proposal
* [#14356](https://github.com/cosmos/cosmos-sdk/pull/14356) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s).
@ -215,9 +216,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/gov) [#13160](https://github.com/cosmos/cosmos-sdk/pull/13160) Remove custom marshaling of proposl and voteoption.
* (types) [#13430](https://github.com/cosmos/cosmos-sdk/pull/13430) Remove unused code `ResponseCheckTx` and `ResponseDeliverTx`
* (store) [#13529](https://github.com/cosmos/cosmos-sdk/pull/13529) Add method `LatestVersion` to `MultiStore` interface, add method `SetQueryMultiStore` to baesapp to support alternative `MultiStore` implementation for query service.
* (pruning) [#13609](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning package to be under store package
* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to
extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new
* (pruning) [#13609](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning package to be under store package.
* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to
extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new
`cosmossdk.io/core/appmodule.AppModule` API.
* (signing) [#13701](https://github.com/cosmos/cosmos-sdk/pull/) Add `context.Context` as an argument `x/auth/signing.VerifySignature`.
* (x/group) [#13876](https://github.com/cosmos/cosmos-sdk/pull/13876) Add `GetMinExecutionPeriod` method on DecisionPolicy interface.

View File

@ -173,6 +173,45 @@ By default, the new `MinInitialDepositRatio` parameter is set to zero during mig
feature is disabled. If chains wish to utilize the minimum proposal deposits at time of submission, the migration logic needs to be
modified to set the new parameter to the desired value.
##### New Proposal.Proposer field
The `Proposal` proto has been updated with proposer field. For proposal state migraton developers can call `v4.AddProposerAddressToProposal` in their upgrade handler to update all existing proposal and make them compatible and this migration is optional.
> This migration is optional, if chain wants to cancel previous proposals which are active (deposit or voting period) they can do this proposals state migration.
```go
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
v4 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v4"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)
func (app SimApp) RegisterUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(UpgradeName,
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// this migration is optional
// add proposal ids with proposers which are active (deposit or voting period)
proposals := make(map[uint64]string)
proposals[1] = "cosmos1luyncewxk4lm24k6gqy8y5dxkj0klr4tu0lmnj" ...
v4.AddProposerAddressToProposal(ctx, sdk.NewKVStoreKey(v4.ModuleName), app.appCodec, proposals)
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
})
}
```
##### New Feature: Cancelling Proposals
The `gov` module has been updated to support the ability to cancel governance proposals. When a proposal is canceled, all the deposits of the proposal are either burnt or sent to `ProposalCancelDest` address. The deposits burn rate will be determined by a new parameter called `ProposalCancelRatio` parameter.
```
1. deposits * proposal_cancel_ratio will be burned or sent to `ProposalCancelDest` address , if `ProposalCancelDest` is empty then deposits will be burned.
2. deposits * (1 - proposal_cancel_ratio) will be sent to depositors.
```
By default, the new `ProposalCancelRatio` parameter is set to 0.5 during migration and `ProposalCancelDest` is set to empty string (i.e. burnt).
#### `x/consensus`
Introducing a new `x/consensus` module to handle managing Tendermint consensus

View File

@ -5370,6 +5370,8 @@ var (
fd_Params_threshold protoreflect.FieldDescriptor
fd_Params_veto_threshold protoreflect.FieldDescriptor
fd_Params_min_initial_deposit_ratio protoreflect.FieldDescriptor
fd_Params_proposal_cancel_ratio protoreflect.FieldDescriptor
fd_Params_proposal_cancel_dest protoreflect.FieldDescriptor
)
func init() {
@ -5382,6 +5384,8 @@ func init() {
fd_Params_threshold = md_Params.Fields().ByName("threshold")
fd_Params_veto_threshold = md_Params.Fields().ByName("veto_threshold")
fd_Params_min_initial_deposit_ratio = md_Params.Fields().ByName("min_initial_deposit_ratio")
fd_Params_proposal_cancel_ratio = md_Params.Fields().ByName("proposal_cancel_ratio")
fd_Params_proposal_cancel_dest = md_Params.Fields().ByName("proposal_cancel_dest")
}
var _ protoreflect.Message = (*fastReflection_Params)(nil)
@ -5491,6 +5495,18 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.ProposalCancelRatio != "" {
value := protoreflect.ValueOfString(x.ProposalCancelRatio)
if !f(fd_Params_proposal_cancel_ratio, value) {
return
}
}
if x.ProposalCancelDest != "" {
value := protoreflect.ValueOfString(x.ProposalCancelDest)
if !f(fd_Params_proposal_cancel_dest, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -5520,6 +5536,10 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool {
return x.VetoThreshold != ""
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
return x.MinInitialDepositRatio != ""
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
return x.ProposalCancelRatio != ""
case "cosmos.gov.v1.Params.proposal_cancel_dest":
return x.ProposalCancelDest != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5550,6 +5570,10 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) {
x.VetoThreshold = ""
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
x.MinInitialDepositRatio = ""
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
x.ProposalCancelRatio = ""
case "cosmos.gov.v1.Params.proposal_cancel_dest":
x.ProposalCancelDest = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5590,6 +5614,12 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
value := x.MinInitialDepositRatio
return protoreflect.ValueOfString(value)
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
value := x.ProposalCancelRatio
return protoreflect.ValueOfString(value)
case "cosmos.gov.v1.Params.proposal_cancel_dest":
value := x.ProposalCancelDest
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5626,6 +5656,10 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto
x.VetoThreshold = value.Interface().(string)
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
x.MinInitialDepositRatio = value.Interface().(string)
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
x.ProposalCancelRatio = value.Interface().(string)
case "cosmos.gov.v1.Params.proposal_cancel_dest":
x.ProposalCancelDest = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5670,6 +5704,10 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore
panic(fmt.Errorf("field veto_threshold of message cosmos.gov.v1.Params is not mutable"))
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
panic(fmt.Errorf("field min_initial_deposit_ratio of message cosmos.gov.v1.Params is not mutable"))
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
panic(fmt.Errorf("field proposal_cancel_ratio of message cosmos.gov.v1.Params is not mutable"))
case "cosmos.gov.v1.Params.proposal_cancel_dest":
panic(fmt.Errorf("field proposal_cancel_dest of message cosmos.gov.v1.Params is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5700,6 +5738,10 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor
return protoreflect.ValueOfString("")
case "cosmos.gov.v1.Params.min_initial_deposit_ratio":
return protoreflect.ValueOfString("")
case "cosmos.gov.v1.Params.proposal_cancel_ratio":
return protoreflect.ValueOfString("")
case "cosmos.gov.v1.Params.proposal_cancel_dest":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params"))
@ -5799,6 +5841,14 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.ProposalCancelRatio)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.ProposalCancelDest)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -5828,6 +5878,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.ProposalCancelDest) > 0 {
i -= len(x.ProposalCancelDest)
copy(dAtA[i:], x.ProposalCancelDest)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProposalCancelDest)))
i--
dAtA[i] = 0x4a
}
if len(x.ProposalCancelRatio) > 0 {
i -= len(x.ProposalCancelRatio)
copy(dAtA[i:], x.ProposalCancelRatio)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProposalCancelRatio)))
i--
dAtA[i] = 0x42
}
if len(x.MinInitialDepositRatio) > 0 {
i -= len(x.MinInitialDepositRatio)
copy(dAtA[i:], x.MinInitialDepositRatio)
@ -6183,6 +6247,70 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
x.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposalCancelRatio", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.ProposalCancelRatio = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposalCancelDest", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.ProposalCancelDest = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -6914,6 +7042,15 @@ type Params struct {
VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"`
// The ratio representing the proportion of the deposit value that must be paid at proposal submission.
MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"`
// The cancel ratio which will not be returned back to the depositors when a proposal is cancelled.
//
// Since: cosmos-sdk 0.48
ProposalCancelRatio string `protobuf:"bytes,8,opt,name=proposal_cancel_ratio,json=proposalCancelRatio,proto3" json:"proposal_cancel_ratio,omitempty"`
// The address which will receive (proposal_cancel_ratio * deposit) proposal deposits.
// If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned.
//
// Since: cosmos-sdk 0.48
ProposalCancelDest string `protobuf:"bytes,9,opt,name=proposal_cancel_dest,json=proposalCancelDest,proto3" json:"proposal_cancel_dest,omitempty"`
}
func (x *Params) Reset() {
@ -6985,6 +7122,20 @@ func (x *Params) GetMinInitialDepositRatio() string {
return ""
}
func (x *Params) GetProposalCancelRatio() string {
if x != nil {
return x.ProposalCancelRatio
}
return ""
}
func (x *Params) GetProposalCancelDest() string {
if x != nil {
return x.ProposalCancelDest
}
return ""
}
var File_cosmos_gov_v1_gov_proto protoreflect.FileDescriptor
var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{
@ -7118,7 +7269,7 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{
0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x44, 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f,
0x6c, 0x64, 0x22, 0xbc, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a,
0x6c, 0x64, 0x22, 0xcc, 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a,
0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65,
0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8,
@ -7146,7 +7297,16 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{
0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x6d, 0x69, 0x6e, 0x49, 0x6e,
0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x61, 0x74, 0x69,
0x6f, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x6f, 0x12, 0x42, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x63, 0x61,
0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63,
0x52, 0x13, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c,
0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x4a, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61,
0x6c, 0x5f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x18, 0x09, 0x20,
0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x70,
0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x65, 0x73,
0x74, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a,
0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53,

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,10 @@ type MsgClient interface {
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// CancelProposal defines a method to cancel governance proposal
//
// Since: cosmos-sdk 0.48
CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error)
}
type msgClient struct {
@ -102,6 +106,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil
}
func (c *msgClient) CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error) {
out := new(MsgCancelProposalResponse)
err := c.cc.Invoke(ctx, "/cosmos.gov.v1.Msg/CancelProposal", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -122,6 +135,10 @@ type MsgServer interface {
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// CancelProposal defines a method to cancel governance proposal
//
// Since: cosmos-sdk 0.48
CancelProposal(context.Context, *MsgCancelProposal) (*MsgCancelProposalResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -147,6 +164,9 @@ func (UnimplementedMsgServer) Deposit(context.Context, *MsgDeposit) (*MsgDeposit
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) CancelProposal(context.Context, *MsgCancelProposal) (*MsgCancelProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelProposal not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -268,6 +288,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_CancelProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCancelProposal)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CancelProposal(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.gov.v1.Msg/CancelProposal",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CancelProposal(ctx, req.(*MsgCancelProposal))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -299,6 +337,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "CancelProposal",
Handler: _Msg_CancelProposal_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/gov/v1/tx.proto",

View File

@ -208,4 +208,15 @@ message Params {
// The ratio representing the proportion of the deposit value that must be paid at proposal submission.
string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec"];
// The cancel ratio which will not be returned back to the depositors when a proposal is cancelled.
//
// Since: cosmos-sdk 0.48
string proposal_cancel_ratio = 8 [(cosmos_proto.scalar) = "cosmos.Dec"];
// The address which will receive (proposal_cancel_ratio * deposit) proposal deposits.
// If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned.
//
// Since: cosmos-sdk 0.48
string proposal_cancel_dest = 9 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

View File

@ -9,6 +9,7 @@ import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1";
@ -37,6 +38,11 @@ service Msg {
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// CancelProposal defines a method to cancel governance proposal
//
// Since: cosmos-sdk 0.48
rpc CancelProposal(MsgCancelProposal) returns (MsgCancelProposalResponse);
}
// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary
@ -170,3 +176,25 @@ message MsgUpdateParams {
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgCancelProposal is the Msg/CancelProposal request type.
//
// Since: cosmos-sdk 0.48
message MsgCancelProposal {
option (cosmos.msg.v1.signer) = "proposer";
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string proposer = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgCancelProposalResponse defines the response structure for executing a
// MsgCancelProposal message.
//
// Since: cosmos-sdk 0.48
message MsgCancelProposalResponse {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
// canceled_time is the time when proposal is canceled.
google.protobuf.Timestamp canceled_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// canceled_height defines the block height at which the proposal is canceled.
uint64 canceled_height = 3;
}

View File

@ -357,7 +357,7 @@ func NewSimApp(
*/
govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.AccountKeeper, app.BankKeeper,
app.StakingKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
// Set legacy router for backwards compatibility with gov v1beta1

View File

@ -27,6 +27,9 @@ func (app SimApp) RegisterUpgradeHandlers() {
// dedicated x/consensus module.
baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper)
// Note: this migration is optional,
// You can include x/gov proposal migration documented at [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md)
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
},
)

View File

@ -19,6 +19,7 @@ import (
"github.com/cosmos/cosmos-sdk/types"
qtypes "github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/version"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
_ "github.com/cosmos/cosmos-sdk/x/gov"
)

View File

@ -77,7 +77,7 @@ func (s *E2ETestSuite) TestGetProposalsGRPC() {
"valid request",
fmt.Sprintf("%s/cosmos/gov/v1/proposals", val.APIAddress),
map[string]string{},
3,
4,
false,
},
{

View File

@ -23,7 +23,7 @@ func (s *E2ETestSuite) TestCmdParams() {
{
"json output",
[]string{fmt.Sprintf("--%s=json", flags.FlagOutput)},
`{"voting_params":{"voting_period":"172800s"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800s"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800s","voting_period":"172800s","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","min_initial_deposit_ratio":"0.000000000000000000"}}`,
`{"voting_params":{"voting_period":"172800s"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800s"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800s","voting_period":"172800s","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_ratio":"0.500000000000000000","proposal_cancel_dest":""}}`,
},
{
"text output",
@ -40,6 +40,8 @@ params:
- amount: "10000000"
denom: stake
min_initial_deposit_ratio: "0.000000000000000000"
proposal_cancel_dest: ""
proposal_cancel_ratio: "0.500000000000000000"
quorum: "0.334000000000000000"
threshold: "0.500000000000000000"
veto_threshold: "0.334000000000000000"
@ -306,7 +308,7 @@ func (s *E2ETestSuite) TestCmdGetProposals() {
var proposals v1.QueryProposalsResponse
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &proposals), out.String())
s.Require().Len(proposals.Proposals, 3)
s.Require().Greater(len(proposals.Proposals), 0)
}
})
}

View File

@ -14,6 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/gov/client/cli"
govclitestutil "github.com/cosmos/cosmos-sdk/x/gov/client/testutil"
"github.com/cosmos/cosmos-sdk/x/gov/types"
@ -41,36 +42,51 @@ func (s *E2ETestSuite) SetupSuite() {
s.Require().NoError(s.network.WaitForNextBlock())
val := s.network.Validators[0]
clientCtx := val.ClientCtx
var resp sdk.TxResponse
// create a proposal with deposit
_, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
out, err := govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
"Text Proposal 1", "Where is the title!?", v1beta1.ProposalTypeText,
fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens).String()))
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
// vote for proposal
_, err = govclitestutil.MsgVote(val.ClientCtx, val.Address.String(), "1", "yes")
out, err = govclitestutil.MsgVote(val.ClientCtx, val.Address.String(), "1", "yes")
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
// create a proposal without deposit
_, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
"Text Proposal 2", "Where is the title!?", v1beta1.ProposalTypeText)
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
// create a proposal3 with deposit
_, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
"Text Proposal 3", "Where is the title!?", v1beta1.ProposalTypeText,
fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens).String()))
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
// create a proposal4 with deposit to check the cancel proposal cli tx
out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(),
"Text Proposal 4", "Where is the title!?", v1beta1.ProposalTypeText,
fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens).String()))
s.Require().NoError(err)
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
// vote for proposal3 as val
_, err = govclitestutil.MsgVote(val.ClientCtx, val.Address.String(), "3", "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05")
out, err = govclitestutil.MsgVote(val.ClientCtx, val.Address.String(), "3", "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05")
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0))
}
func (s *E2ETestSuite) TearDownSuite() {
@ -260,6 +276,118 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() {
}
}
func (s *E2ETestSuite) TestNewCmdCancelProposal() {
val := s.network.Validators[0]
val2 := sdk.AccAddress("invalid_acc_addr")
testCases := []struct {
name string
args []string
expectErr bool
expectedCode uint32
}{
{
"without proposal id",
[]string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
true, 0,
},
{
"invalid proposal id",
[]string{
"asdasd",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
true, 0,
},
{
"valid proposal-id but invalid proposer",
[]string{
"4",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val2),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
true, 0,
},
{
"valid proposer",
[]string{
"4",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 0,
},
{
"proposal not exists after cancel",
[]string{
"4",
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
},
false, 17,
},
}
for _, tc := range testCases {
var resp sdk.TxResponse
s.Run(tc.name, func() {
cmd := cli.NewCmdCancelProposal()
clientCtx := val.ClientCtx
var balRes banktypes.QueryAllBalancesResponse
var newBalance banktypes.QueryAllBalancesResponse
if !tc.expectErr && tc.expectedCode == 0 {
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address)
s.Require().NoError(err)
err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &balRes)
s.Require().NoError(err)
}
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
if tc.expectErr {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode))
if !tc.expectErr && tc.expectedCode == 0 {
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address)
s.Require().NoError(err)
err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &newBalance)
s.Require().NoError(err)
remainingAmount := v1.DefaultMinDepositTokens.Mul(
v1.DefaultProposalCancelRatio.Mul(sdk.MustNewDecFromStr("100")).TruncateInt(),
).Quo(sdk.NewIntFromUint64(100))
// new balance = old balance + remaining amount from proposal deposit - txFee (cancel proposal)
txFee := sdk.NewInt(10)
s.Require().True(
newBalance.Balances.AmountOf(s.network.Config.BondDenom).Equal(
balRes.Balances.AmountOf(s.network.Config.BondDenom).Add(remainingAmount).Sub(txFee),
),
)
}
}
})
}
}
func (s *E2ETestSuite) TestNewCmdDeposit() {
val := s.network.Validators[0]

View File

@ -22,7 +22,7 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/types"
@ -106,7 +106,7 @@ func TestImportExportQueues(t *testing.T) {
genesisState[banktypes.ModuleName] = s1.cdc.MustMarshalJSON(bankGenState)
genesisState[types.ModuleName] = s1.cdc.MustMarshalJSON(govGenState)
genesisState[stakingtypes.ModuleName] = s1.cdc.MustMarshalJSON(stakingGenState)
genesisState[distributiontypes.ModuleName] = s1.cdc.MustMarshalJSON(distributionGenState)
genesisState[disttypes.ModuleName] = s1.cdc.MustMarshalJSON(distributionGenState)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
assert.NilError(t, err)

View File

@ -10,6 +10,7 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/gov/types"
_ "github.com/cosmos/cosmos-sdk/x/mint"
)
@ -23,6 +24,7 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
configurator.StakingModule(),
configurator.BankModule(),
configurator.GovModule(),
configurator.DistributionModule(),
configurator.ConsensusModule(),
),
&accountKeeper,

View File

@ -22,6 +22,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
"github.com/cosmos/cosmos-sdk/x/bank/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
_ "github.com/cosmos/cosmos-sdk/x/gov"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
_ "github.com/cosmos/cosmos-sdk/x/params"
@ -89,9 +91,10 @@ var (
)
type suite struct {
BankKeeper bankkeeper.Keeper
AccountKeeper types.AccountKeeper
App *runtime.App
BankKeeper bankkeeper.Keeper
AccountKeeper types.AccountKeeper
DistributionKeeper distrkeeper.Keeper
App *runtime.App
}
func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) suite {
@ -113,8 +116,9 @@ func createTestSuite(t *testing.T, genesisAccounts []authtypes.GenesisAccount) s
configurator.ConsensusModule(),
configurator.BankModule(),
configurator.GovModule(),
configurator.DistributionModule(),
),
startupCfg, &res.BankKeeper, &res.AccountKeeper)
startupCfg, &res.BankKeeper, &res.AccountKeeper, &res.DistributionKeeper)
res.App = app

View File

@ -12,7 +12,7 @@ import (
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/types"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
)
@ -402,7 +402,7 @@ func getModuleAccounts(ak types.AccountKeeper, ctx sdk.Context, moduleAccCount i
moduleAccounts := make([]simtypes.Account, moduleAccCount)
for i := 0; i < moduleAccCount; i++ {
acc := ak.GetModuleAccount(ctx, distributiontypes.ModuleName)
acc := ak.GetModuleAccount(ctx, disttypes.ModuleName)
mAcc := simtypes.Account{
Address: acc.GetAddress(),
PrivKey: nil,

View File

@ -862,16 +862,27 @@ Example Output:
```bash
deposit_params:
max_deposit_period: "172800000000000"
max_deposit_period: 172800s
min_deposit:
- amount: "10000000"
denom: stake
params:
max_deposit_period: 172800s
min_deposit:
- amount: "10000000"
denom: stake
min_initial_deposit_ratio: "0.000000000000000000"
proposal_cancel_burn_rate: "0.500000000000000000"
quorum: "0.334000000000000000"
threshold: "0.500000000000000000"
veto_threshold: "0.334000000000000000"
voting_period: 172800s
tally_params:
quorum: "0.334000000000000000"
threshold: "0.500000000000000000"
veto_threshold: "0.334000000000000000"
voting_params:
voting_period: "172800000000000"
voting_period: 172800s
```
##### proposal
@ -1213,6 +1224,19 @@ Example (`software-upgrade`):
simd tx gov submit-legacy-proposal software-upgrade v2 --title="Test Proposal" --description="testing, testing, 1, 2, 3" --upgrade-height 1000000 --from cosmos1..
```
#### cancel-proposal
Once proposal is canceled, from the deposits of proposal `deposits * proposal_cancel_ratio` will be burned or sent to `ProposalCancelDest` address , if `ProposalCancelDest` is empty then deposits will be burned. The `remaining deposits` will be sent to depositers.
```bash
simd tx gov cancel-proposal [proposal-id] [flags]
```
Example:
```bash
simd tx gov cancel-proposal 1 --from cosmos1...
```
##### vote
The `vote` command allows users to submit a vote for a given governance proposal.

View File

@ -15,8 +15,7 @@ import (
func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
logger := keeper.Logger(ctx)
logger := ctx.Logger().With("module", "x/"+types.ModuleName)
// delete dead proposals from store and returns theirs deposits.
// A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase.
keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1.Proposal) bool {

View File

@ -299,6 +299,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
app.BeginBlock(abci.RequestBeginBlock{Header: header})
valAddr := sdk.ValAddress(addrs[0])
proposer := addrs[0]
createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10})
staking.EndBlocker(ctx, suite.StakingKeeper)
@ -307,7 +308,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
require.NotNil(t, macc)
initialModuleAccCoins := suite.BankKeeper.GetAllBalances(ctx, macc.GetAddress())
proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "title", "summary", addrs[0])
proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "title", "summary", proposer)
require.NoError(t, err)
proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10))}
@ -351,12 +352,13 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
app.BeginBlock(abci.RequestBeginBlock{Header: header})
valAddr := sdk.ValAddress(addrs[0])
proposer := addrs[0]
createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10})
staking.EndBlocker(ctx, suite.StakingKeeper)
msg := banktypes.NewMsgSend(authtypes.NewModuleAddress(types.ModuleName), addrs[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000))))
proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "", "Bank Msg Send", "send message", addrs[0])
proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "", "title", "summary", proposer)
require.NoError(t, err)
proposalCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10)))

View File

@ -71,6 +71,7 @@ func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command {
NewCmdWeightedVote(),
NewCmdSubmitProposal(),
NewCmdDraftProposal(),
NewCmdCancelProposal(),
// Deprecated
cmdSubmitLegacyProp,
@ -138,6 +139,36 @@ Where proposal.json contains:
return cmd
}
// NewCmdCancelProposal implements submitting a cancel proposal transaction command.
func NewCmdCancelProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "cancel-proposal [proposal-id]",
Short: "Cancel governance proposal before the voting period ends. Must be signed by the proposal creator.",
Args: cobra.ExactArgs(1),
Example: fmt.Sprintf(`$ %s tx gov cancel-proposal 1 --from mykey`, version.AppName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
// validate that the proposal id is a uint
proposalID, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
return fmt.Errorf("proposal-id %s not a valid uint, please input a valid proposal-id", args[0])
}
// Get proposer address
from := clientCtx.GetFromAddress()
msg := v1.NewMsgCancelProposal(proposalID, from.String())
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}
// NewCmdSubmitLegacyProposal implements submitting a proposal transaction command.
// Deprecated: please use NewCmdSubmitProposal instead.
func NewCmdSubmitLegacyProposal() *cobra.Command {

View File

@ -19,6 +19,8 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
@ -98,11 +100,12 @@ var pubkeys = []cryptotypes.PubKey{
}
type suite struct {
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
GovKeeper *keeper.Keeper
StakingKeeper *stakingkeeper.Keeper
App *runtime.App
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
GovKeeper *keeper.Keeper
StakingKeeper *stakingkeeper.Keeper
DistributionKeeper distrkeeper.Keeper
App *runtime.App
}
func createTestSuite(t *testing.T) suite {
@ -116,9 +119,10 @@ func createTestSuite(t *testing.T) suite {
configurator.BankModule(),
configurator.GovModule(),
configurator.ConsensusModule(),
configurator.DistributionModule(),
),
simtestutil.DefaultStartUpConfig(),
&res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper,
&res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.DistributionKeeper, &res.StakingKeeper,
)
require.NoError(t, err)

View File

@ -17,6 +17,7 @@ import (
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil"
"github.com/cosmos/cosmos-sdk/x/gov/types"
@ -28,6 +29,7 @@ import (
var (
_, _, addr = testdata.KeyTestPubAddr()
govAcct = authtypes.NewModuleAddress(types.ModuleName)
distAcct = authtypes.NewModuleAddress(disttypes.ModuleName)
TestProposal = getTestProposal()
)
@ -50,6 +52,7 @@ func setupGovKeeper(t *testing.T) (
*govtestutil.MockAccountKeeper,
*govtestutil.MockBankKeeper,
*govtestutil.MockStakingKeeper,
*govtestutil.MockDistributionKeeper,
moduletestutil.TestEncodingConfig,
sdk.Context,
) {
@ -70,9 +73,12 @@ func setupGovKeeper(t *testing.T) (
acctKeeper := govtestutil.NewMockAccountKeeper(ctrl)
bankKeeper := govtestutil.NewMockBankKeeper(ctrl)
stakingKeeper := govtestutil.NewMockStakingKeeper(ctrl)
distributionKeeper := govtestutil.NewMockDistributionKeeper(ctrl)
acctKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(govAcct).AnyTimes()
acctKeeper.EXPECT().GetModuleAddress(disttypes.ModuleName).Return(distAcct).AnyTimes()
acctKeeper.EXPECT().GetModuleAccount(gomock.Any(), types.ModuleName).Return(authtypes.NewEmptyModuleAccount(types.ModuleName)).AnyTimes()
trackMockBalances(bankKeeper)
trackMockBalances(bankKeeper, distributionKeeper)
stakingKeeper.EXPECT().TokensFromConsensusPower(ctx, gomock.Any()).DoAndReturn(func(ctx sdk.Context, power int64) math.Int {
return sdk.TokensFromConsensusPower(power, math.NewIntFromUint64(1000000))
}).AnyTimes()
@ -80,9 +86,10 @@ func setupGovKeeper(t *testing.T) (
stakingKeeper.EXPECT().IterateBondedValidatorsByPower(gomock.Any(), gomock.Any()).AnyTimes()
stakingKeeper.EXPECT().IterateDelegations(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()).Return(math.NewInt(10000000)).AnyTimes()
distributionKeeper.EXPECT().FundCommunityPool(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
// Gov keeper initializations
govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, msr, types.DefaultConfig(), govAcct.String())
govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, msr, types.DefaultConfig(), govAcct.String())
govKeeper.SetProposalID(ctx, 1)
govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too.
govRouter.AddRoute(types.RouterKey, v1beta1.ProposalHandler)
@ -94,13 +101,14 @@ func setupGovKeeper(t *testing.T) (
v1.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper))
banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs.
return govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx
return govKeeper, acctKeeper, bankKeeper, stakingKeeper, distributionKeeper, encCfg, ctx
}
// trackMockBalances sets up expected calls on the Mock BankKeeper, and also
// locally tracks accounts balances (not modules balances).
func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper) {
func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper, distributionKeeper *govtestutil.MockDistributionKeeper) {
balances := make(map[string]sdk.Coins)
balances[distAcct.String()] = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(0)))
// We don't track module account balances.
bankKeeper.EXPECT().MintCoins(gomock.Any(), minttypes.ModuleName, gomock.Any()).AnyTimes()
@ -123,4 +131,25 @@ func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper) {
bankKeeper.EXPECT().GetAllBalances(gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, addr sdk.AccAddress) sdk.Coins {
return balances[addr.String()]
}).AnyTimes()
bankKeeper.EXPECT().GetBalance(gomock.Any(), gomock.Any(), sdk.DefaultBondDenom).DoAndReturn(func(_ sdk.Context, addr sdk.AccAddress, _ string) sdk.Coin {
balances := balances[addr.String()]
for _, balance := range balances {
if balance.Denom == sdk.DefaultBondDenom {
return balance
}
}
return sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(0))
}).AnyTimes()
distributionKeeper.EXPECT().FundCommunityPool(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, coins sdk.Coins, sender sdk.AccAddress) error {
// sender balance
newBalance, negative := balances[sender.String()].SafeSub(coins...)
if negative {
return fmt.Errorf("not enough balance")
}
balances[sender.String()] = newBalance
// receiver balance
balances[distAcct.String()] = balances[distAcct.String()].Add(coins...)
return nil
}).AnyTimes()
}

View File

@ -6,6 +6,7 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
)
@ -163,6 +164,77 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd
return activatedVotingPeriod, nil
}
// ChargeDeposit will charge proposal cancellation fee (deposits * proposal_cancel_burn_rate) and
// send to a destAddress if defined or burn otherwise.
// Remaining funds are send back to the depositor.
func (keeper Keeper) ChargeDeposit(ctx sdk.Context, proposalID uint64, destAddress, proposalCancelRate string) error {
store := ctx.KVStore(keeper.storeKey)
rate := sdk.MustNewDecFromStr(proposalCancelRate)
var cancellationCharges sdk.Coins
for _, deposits := range keeper.GetDeposits(ctx, proposalID) {
depositerAddress := sdk.MustAccAddressFromBech32(deposits.Depositor)
var remainingAmount sdk.Coins
for _, deposit := range deposits.Amount {
burnAmount := sdk.NewDecFromInt(deposit.Amount).Mul(rate).TruncateInt()
// remaining amount = deposits amount - burn amount
remainingAmount = remainingAmount.Add(
sdk.NewCoin(
deposit.Denom,
deposit.Amount.Sub(burnAmount),
),
)
cancellationCharges = cancellationCharges.Add(
sdk.NewCoin(
deposit.Denom,
burnAmount,
),
)
}
if !remainingAmount.IsZero() {
err := keeper.bankKeeper.SendCoinsFromModuleToAccount(
ctx, types.ModuleName, depositerAddress, remainingAmount,
)
if err != nil {
return err
}
}
}
// burn the cancellation fee or sent the cancellation charges to destination address.
if !cancellationCharges.IsZero() {
// get the distribution module account address
distributionAddress := keeper.authKeeper.GetModuleAddress(disttypes.ModuleName)
switch {
case len(destAddress) == 0:
// burn the cancellation charges from deposits
err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, cancellationCharges)
if err != nil {
return err
}
case distributionAddress.String() == destAddress:
err := keeper.distrkeeper.FundCommunityPool(ctx, cancellationCharges, keeper.ModuleAccountAddress())
if err != nil {
return err
}
default:
destAccAddress := sdk.MustAccAddressFromBech32(destAddress)
err := keeper.bankKeeper.SendCoinsFromModuleToAccount(
ctx, types.ModuleName, destAccAddress, cancellationCharges,
)
if err != nil {
return err
}
}
}
store.Delete(types.DepositsKey(proposalID))
return nil
}
// RefundAndDeleteDeposits refunds and deletes all the deposits on a specific proposal.
func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) {
store := ctx.KVStore(keeper.storeKey)

View File

@ -1,12 +1,16 @@
package keeper_test
import (
"fmt"
"testing"
"cosmossdk.io/math"
"github.com/stretchr/testify/require"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
)
@ -16,12 +20,12 @@ const (
)
func TestDeposits(t *testing.T) {
govKeeper, _, bankKeeper, stakingKeeper, _, ctx := setupGovKeeper(t)
trackMockBalances(bankKeeper)
govKeeper, _, bankKeeper, stakingKeeper, distKeeper, _, ctx := setupGovKeeper(t)
trackMockBalances(bankKeeper, distKeeper)
TestAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000))
tp := TestProposal
proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", TestAddrs[0])
proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0])
require.NoError(t, err)
proposalID := proposal.Id
@ -105,7 +109,7 @@ func TestDeposits(t *testing.T) {
require.Equal(t, addr1Initial, bankKeeper.GetAllBalances(ctx, TestAddrs[1]))
// Test delete and burn deposits
proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "description", TestAddrs[0])
proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0])
require.NoError(t, err)
proposalID = proposal.Id
_, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake)
@ -193,7 +197,7 @@ func TestValidateInitialDeposit(t *testing.T) {
for name, tc := range testcases {
t.Run(name, func(t *testing.T) {
govKeeper, _, _, _, _, ctx := setupGovKeeper(t)
govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t)
params := v1.DefaultParams()
params.MinDeposit = tc.minDeposit
@ -211,3 +215,106 @@ func TestValidateInitialDeposit(t *testing.T) {
})
}
}
func TestChargeDeposit(t *testing.T) {
testCases := []struct {
name string
proposalCancelRatio string
proposalCancelDestAddress string
expectError bool
}{
{
name: "Success: CancelRatio=0",
proposalCancelRatio: "0",
proposalCancelDestAddress: "",
expectError: false,
},
{
name: "Success: CancelRatio=0.5",
proposalCancelRatio: "0.5",
proposalCancelDestAddress: "",
expectError: false,
},
{
name: "Success: CancelRatio=1",
proposalCancelRatio: "1",
proposalCancelDestAddress: "",
expectError: false,
},
}
for _, tc := range testCases {
for i := 0; i < 3; i++ {
testName := func(i int) string {
if i == 0 {
return fmt.Sprintf("%s and dest address is %s", tc.name, "nil")
} else if i == 1 {
return fmt.Sprintf("%s and dest address is normal address", tc.name)
}
return fmt.Sprintf("%s and dest address is community address", tc.name)
}
t.Run(testName(i), func(t *testing.T) {
govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t)
params := v1.DefaultParams()
params.ProposalCancelRatio = tc.proposalCancelRatio
TestAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000000))
switch i {
case 0:
// no dest address for cancel proposal, total cancellation charges will be burned
params.ProposalCancelDest = ""
case 1:
// normal account address for proposal cancel dest address
params.ProposalCancelDest = TestAddrs[1].String()
default:
// community address for proposal cancel dest address
params.ProposalCancelDest = authtypes.NewModuleAddress(disttypes.ModuleName).String()
}
err := govKeeper.SetParams(ctx, params)
require.NoError(t, err)
tp := TestProposal
proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0])
require.NoError(t, err)
proposalID := proposal.Id
// deposit to proposal
fiveStake := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, stakingKeeper.TokensFromConsensusPower(ctx, 300)))
_, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fiveStake)
require.NoError(t, err)
// get balances of dest address
var prevBalance sdk.Coin
if len(params.ProposalCancelDest) != 0 {
accAddr := sdk.MustAccAddressFromBech32(params.ProposalCancelDest)
prevBalance = bankKeeper.GetBalance(ctx, accAddr, sdk.DefaultBondDenom)
}
// get the deposits
allDeposits := govKeeper.GetDeposits(ctx, proposalID)
// charge cancellation charges for cancel proposal
err = govKeeper.ChargeDeposit(ctx, proposalID, TestAddrs[0].String(), params.ProposalCancelRatio)
if tc.expectError {
require.Error(t, err)
return
}
require.NoError(t, err)
if len(params.ProposalCancelDest) != 0 {
accAddr := sdk.MustAccAddressFromBech32(params.ProposalCancelDest)
newBalanceAfterCancelProposal := bankKeeper.GetBalance(ctx, accAddr, sdk.DefaultBondDenom)
cancellationCharges := math.NewInt(0)
for _, deposits := range allDeposits {
for _, deposit := range deposits.Amount {
burnAmount := sdk.NewDecFromInt(deposit.Amount).Mul(sdk.MustNewDecFromStr(params.MinInitialDepositRatio)).TruncateInt()
cancellationCharges = cancellationCharges.Add(burnAmount)
}
}
require.True(t, newBalanceAfterCancelProposal.Equal(prevBalance.Add(sdk.NewCoin(sdk.DefaultBondDenom, cancellationCharges))))
}
})
}
}
}

View File

@ -17,7 +17,7 @@ import (
func (suite *KeeperTestSuite) TestGRPCQueryProposal() {
suite.reset()
ctx, queryClient := suite.ctx, suite.queryClient
ctx, queryClient, addrs := suite.ctx, suite.queryClient, suite.addrs
var (
req *v1.QueryProposalRequest
@ -57,7 +57,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() {
testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal")
msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String())
suite.Require().NoError(err)
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
suite.Require().NotEmpty(submittedProposal)
@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() {
func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() {
suite.reset()
ctx, queryClient := suite.ctx, suite.legacyQueryClient
ctx, queryClient, addrs := suite.ctx, suite.legacyQueryClient, suite.addrs
var (
req *v1beta1.QueryProposalRequest
@ -127,7 +127,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() {
testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal")
msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String())
suite.Require().NoError(err)
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
suite.Require().NotEmpty(submittedProposal)
@ -188,7 +188,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
testProposal := []sdk.Msg{
v1.NewMsgVote(govAddress, uint64(i), v1.OptionYes, ""),
}
proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "title", "summary", addrs[0])
suite.Require().NotEmpty(proposal)
suite.Require().NoError(err)
testProposals = append(testProposals, &proposal)
@ -305,7 +305,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() {
func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposals() {
suite.reset()
ctx, queryClient := suite.ctx, suite.legacyQueryClient
ctx, queryClient, addrs := suite.ctx, suite.legacyQueryClient, suite.addrs
var req *v1beta1.QueryProposalsRequest
@ -321,7 +321,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposals() {
testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal")
msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String())
suite.Require().NoError(err)
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
suite.Require().NotEmpty(submittedProposal)
},
@ -402,7 +402,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() {
"no votes present",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1.QueryVoteRequest{
@ -516,7 +516,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVote() {
"no votes present",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1beta1.QueryVoteRequest{
@ -622,7 +622,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() {
"create a proposal and get votes",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1.QueryVotesRequest{
@ -724,7 +724,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVotes() {
"create a proposal and get votes",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1beta1.QueryVotesRequest{
@ -1009,7 +1009,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() {
"no deposits proposal",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
suite.Require().NotNil(proposal)
@ -1110,7 +1110,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposit() {
"no deposits proposal",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
suite.Require().NotNil(proposal)
@ -1200,7 +1200,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() {
"create a proposal and get deposits",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1.QueryDepositsRequest{
@ -1295,7 +1295,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposits() {
"create a proposal and get deposits",
func() {
var err error
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "summary", addrs[0])
proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0])
suite.Require().NoError(err)
req = &v1beta1.QueryDepositsRequest{

View File

@ -47,7 +47,7 @@ func (h *MockGovHooksReceiver) AfterProposalVotingPeriodEnded(ctx sdk.Context, p
func TestHooks(t *testing.T) {
minDeposit := v1.DefaultParams().MinDeposit
govKeeper, _, bankKeeper, stakingKeeper, _, ctx := setupGovKeeper(t)
govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t)
addrs := simtestutil.AddTestAddrs(bankKeeper, stakingKeeper, ctx, 1, minDeposit[0].Amount)
govHooksReceiver := MockGovHooksReceiver{}

View File

@ -17,8 +17,9 @@ import (
// Keeper defines the governance module Keeper
type Keeper struct {
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
distrkeeper types.DistributionKeeper
// The reference to the DelegationSet and ValidatorSet to get information about validators and delegators
sk types.StakingKeeper
@ -59,7 +60,7 @@ func (k Keeper) GetAuthority() string {
// CONTRACT: the parameter Subspace must have the param key table already initialized
func NewKeeper(
cdc codec.BinaryCodec, key storetypes.StoreKey, authKeeper types.AccountKeeper,
bankKeeper types.BankKeeper, sk types.StakingKeeper,
bankKeeper types.BankKeeper, sk types.StakingKeeper, distrkeeper types.DistributionKeeper,
router *baseapp.MsgServiceRouter, config types.Config, authority string,
) *Keeper {
// ensure governance module account is set
@ -77,14 +78,15 @@ func NewKeeper(
}
return &Keeper{
storeKey: key,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
sk: sk,
cdc: cdc,
router: router,
config: config,
authority: authority,
storeKey: key,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
distrkeeper: distrkeeper,
sk: sk,
cdc: cdc,
router: router,
config: config,
authority: authority,
}
}
@ -218,6 +220,11 @@ func (k Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time
return store.Iterator(types.InactiveProposalQueuePrefix, storetypes.PrefixEndBytes(types.InactiveProposalByTimeKey(endTime)))
}
// ModuleAccountAddress returns gov module account address
func (k Keeper) ModuleAccountAddress() sdk.AccAddress {
return k.authKeeper.GetModuleAddress(types.ModuleName)
}
// assertMetadataLength returns an error if given metadata length
// is greater than a pre-defined MaxMetadataLen.
func (k Keeper) assertMetadataLength(metadata string) error {

View File

@ -27,6 +27,7 @@ type KeeperTestSuite struct {
acctKeeper *govtestutil.MockAccountKeeper
bankKeeper *govtestutil.MockBankKeeper
stakingKeeper *govtestutil.MockStakingKeeper
distKeeper *govtestutil.MockDistributionKeeper
queryClient v1.QueryClient
legacyQueryClient v1beta1.QueryClient
addrs []sdk.AccAddress
@ -39,7 +40,7 @@ func (suite *KeeperTestSuite) SetupSuite() {
}
func (suite *KeeperTestSuite) reset() {
govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx := setupGovKeeper(suite.T())
govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, encCfg, ctx := setupGovKeeper(suite.T())
// Populate the gov account with some coins, as the TestProposal we have
// is a MsgSend from the gov account.
@ -61,6 +62,7 @@ func (suite *KeeperTestSuite) reset() {
suite.acctKeeper = acctKeeper
suite.bankKeeper = bankKeeper
suite.stakingKeeper = stakingKeeper
suite.distKeeper = distKeeper
suite.cdc = encCfg.Codec
suite.queryClient = queryClient
suite.legacyQueryClient = legacyQueryClient
@ -71,7 +73,7 @@ func (suite *KeeperTestSuite) reset() {
}
func TestIncrementProposalNumber(t *testing.T) {
govKeeper, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled
govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled
tp := TestProposal
_, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"))
@ -91,7 +93,7 @@ func TestIncrementProposalNumber(t *testing.T) {
}
func TestProposalQueues(t *testing.T) {
govKeeper, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled
govKeeper, _, _, _, _, _, ctx := setupGovKeeper(t) //nolint:dogsled
// create test proposals
tp := TestProposal

View File

@ -37,12 +37,12 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
return nil, err
}
proposalMsgs, err := msg.GetMsgs()
proposer, err := sdk.AccAddressFromBech32(msg.GetProposer())
if err != nil {
return nil, err
}
proposer, err := sdk.AccAddressFromBech32(msg.GetProposer())
proposalMsgs, err := msg.GetMsgs()
if err != nil {
return nil, err
}
@ -83,6 +83,33 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
}, nil
}
// CancelProposals implements the MsgServer.CancelProposal method.
func (k msgServer) CancelProposal(goCtx context.Context, msg *v1.MsgCancelProposal) (*v1.MsgCancelProposalResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
_, err := sdk.AccAddressFromBech32(msg.Proposer)
if err != nil {
return nil, err
}
if err := k.Keeper.CancelProposal(ctx, msg.ProposalId, msg.Proposer); err != nil {
return nil, err
}
ctx.EventManager().EmitEvent(
sdk.NewEvent(
govtypes.EventTypeCancelProposal,
sdk.NewAttribute(sdk.AttributeKeySender, msg.Proposer),
sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprint(msg.ProposalId)),
),
)
return &v1.MsgCancelProposalResponse{
ProposalId: msg.ProposalId,
CanceledTime: ctx.BlockTime(),
CanceledHeight: uint64(ctx.BlockHeight()),
}, nil
}
// ExecLegacyContent implements the MsgServer.ExecLegacyContent method.
func (k msgServer) ExecLegacyContent(goCtx context.Context, msg *v1.MsgExecLegacyContent) (*v1.MsgExecLegacyContentResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

View File

@ -132,6 +132,74 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() {
}
}
func (suite *KeeperTestSuite) TestCancelProposalReq() {
govAcct := suite.govKeeper.GetGovernanceAccount(suite.ctx).GetAddress()
addrs := suite.addrs
proposer := addrs[0]
coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100)))
bankMsg := &banktypes.MsgSend{
FromAddress: govAcct.String(),
ToAddress: proposer.String(),
Amount: coins,
}
msg, err := v1.NewMsgSubmitProposal(
[]sdk.Msg{bankMsg},
coins,
proposer.String(), "",
"title", "summary",
)
suite.Require().NoError(err)
res, err := suite.msgSrvr.SubmitProposal(suite.ctx, msg)
suite.Require().NoError(err)
suite.Require().NotNil(res.ProposalId)
proposalID := res.ProposalId
cases := map[string]struct {
preRun func() uint64
expErr bool
proposalID uint64
depositor sdk.AccAddress
}{
"wrong proposal id": {
preRun: func() uint64 {
return 0
},
depositor: proposer,
expErr: true,
},
"valid proposal but invalid proposer": {
preRun: func() uint64 {
return proposalID
},
depositor: addrs[1],
expErr: true,
},
"all good": {
preRun: func() uint64 {
return proposalID
},
depositor: proposer,
expErr: false,
},
}
for name, tc := range cases {
suite.Run(name, func() {
proposalID := tc.preRun()
cancelProposalReq := v1.NewMsgCancelProposal(proposalID, tc.depositor.String())
_, err := suite.msgSrvr.CancelProposal(suite.ctx, cancelProposalReq)
if tc.expErr {
suite.Require().Error(err)
} else {
suite.Require().NoError(err)
}
})
}
}
func (suite *KeeperTestSuite) TestVoteReq() {
suite.reset()
govAcct := suite.govKeeper.GetGovernanceAccount(suite.ctx).GetAddress()

View File

@ -108,6 +108,57 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat
return proposal, nil
}
// CancelProposal will cancel proposal before the voting period ends
func (keeper Keeper) CancelProposal(ctx sdk.Context, proposalID uint64, proposer string) error {
proposal, ok := keeper.GetProposal(ctx, proposalID)
if !ok {
return sdkerrors.Wrapf(types.ErrProposalNotFound, "proposal_id %d", proposalID)
}
// Checking proposal have proposer or not because old proposal doesn't have proposer field,
// https://github.com/cosmos/cosmos-sdk/blob/v0.46.2/proto/cosmos/gov/v1/gov.proto#L43
if proposal.Proposer == "" {
return types.ErrInvalidProposal.Wrapf("proposal %d doesn't have proposer %s, so cannot be canceled", proposalID, proposer)
}
// Check creator of the proposal
if proposal.Proposer != proposer {
return types.ErrInvalidProposer.Wrapf("invalid proposer %s", proposer)
}
// Check if proposal is active or not
if (proposal.Status != v1.StatusDepositPeriod) && (proposal.Status != v1.StatusVotingPeriod) {
return types.ErrInvalidProposal.Wrap("proposal should be in the deposit or voting period")
}
// Check proposal voting period is ended.
if proposal.VotingEndTime != nil && proposal.VotingEndTime.Before(ctx.BlockTime()) {
return types.ErrVotingPeriodEnded.Wrapf("voting period is already ended for this proposal %d", proposalID)
}
// burn the (deposits * proposal_cancel_rate) amount or sent to cancellation destination address.
// and deposits * (1 - proposal_cancel_rate) will be sent to depositors.
params := keeper.GetParams(ctx)
err := keeper.ChargeDeposit(ctx, proposal.Id, params.ProposalCancelDest, params.ProposalCancelRatio)
if err != nil {
return err
}
if proposal.VotingStartTime != nil {
keeper.deleteVotes(ctx, proposal.Id)
}
keeper.DeleteProposal(ctx, proposal.Id)
keeper.Logger(ctx).Info(
"proposal is canceled by proposer",
"proposal", proposal.Id,
"proposer", proposal.Proposer,
)
return nil
}
// GetProposal gets a proposal from store by ProposalID.
// Panics if can't unmarshal the proposal.
func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposal, bool) {

View File

@ -160,6 +160,79 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() {
}
}
func (suite *KeeperTestSuite) TestCancelProposal() {
govAcct := suite.govKeeper.GetGovernanceAccount(suite.ctx).GetAddress().String()
tp := v1beta1.TextProposal{Title: "title", Description: "description"}
prop, err := v1.NewLegacyContent(&tp, govAcct)
suite.Require().NoError(err)
proposalResp, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[0])
suite.Require().NoError(err)
proposalID := proposalResp.Id
proposal2Resp, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[1])
proposal2ID := proposal2Resp.Id
makeProposalPass := func() {
proposal2, ok := suite.govKeeper.GetProposal(suite.ctx, proposal2ID)
suite.Require().True(ok)
proposal2.Status = v1.ProposalStatus_PROPOSAL_STATUS_PASSED
suite.govKeeper.SetProposal(suite.ctx, proposal2)
}
testCases := []struct {
name string
proposalID uint64
proposer string
expectedErr bool
}{
{
name: "without proposer",
proposalID: 1,
proposer: "",
expectedErr: true,
},
{
name: "invalid proposal id",
proposalID: 1,
proposer: string(suite.addrs[0]),
expectedErr: true,
},
{
name: "valid proposalID but invalid proposer",
proposalID: proposalID,
proposer: suite.addrs[1].String(),
expectedErr: true,
},
{
name: "valid proposalID but invalid proposal which has already passed",
proposalID: proposal2ID,
proposer: suite.addrs[1].String(),
expectedErr: true,
},
{
name: "valid proposer and proposal id",
proposalID: proposalID,
proposer: suite.addrs[0].String(),
expectedErr: false,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
if tc.proposalID == proposal2ID {
// making proposal status pass
makeProposalPass()
}
err = suite.govKeeper.CancelProposal(suite.ctx, tc.proposalID, tc.proposer)
if tc.expectedErr {
suite.Require().Error(err)
} else {
suite.Require().NoError(err)
}
})
}
}
func TestMigrateProposalMessages(t *testing.T) {
content := v1beta1.NewTextProposal("Test", "description")
contentMsg, err := v1.NewLegacyContent(content, sdk.AccAddress("test1").String())

View File

@ -118,6 +118,12 @@ func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vo
}
}
// deleteVotes deletes the all votes from a given proposalID.
func (keeper Keeper) deleteVotes(ctx sdk.Context, proposalID uint64) {
store := ctx.KVStore(keeper.storeKey)
store.Delete(types.VotesKey(proposalID))
}
// deleteVote deletes a vote from a given proposalID and voter from the store
func (keeper Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) {
store := ctx.KVStore(keeper.storeKey)

View File

@ -11,7 +11,7 @@ import (
)
func TestVotes(t *testing.T) {
govKeeper, _, bankKeeper, stakingKeeper, _, ctx := setupGovKeeper(t)
govKeeper, _, bankKeeper, stakingKeeper, _, _, ctx := setupGovKeeper(t)
addrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10000000))
tp := TestProposal

View File

@ -19,6 +19,8 @@ func MigrateJSON(oldState *v1.GenesisState) (*v1.GenesisState, error) {
oldState.TallyParams.Threshold,
oldState.TallyParams.VetoThreshold,
v1.DefaultParams().MinInitialDepositRatio,
v1.DefaultParams().ProposalCancelRatio,
v1.DefaultParams().ProposalCancelDest,
)
return &v1.GenesisState{

View File

@ -67,6 +67,8 @@ func TestMigrateJSON(t *testing.T) {
}
],
"min_initial_deposit_ratio": "0.000000000000000000",
"proposal_cancel_dest": "",
"proposal_cancel_ratio": "0.500000000000000000",
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto_threshold": "0.334000000000000000",

View File

@ -28,6 +28,8 @@ func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace
tp.Threshold,
tp.VetoThreshold,
sdk.ZeroDec().String(),
sdk.ZeroDec().String(),
"",
)
bz, err := cdc.Marshal(&params)

View File

@ -0,0 +1,61 @@
package v5
import (
"fmt"
"sort"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
)
// AddProposerAddressToProposal will add proposer to proposal
// and set to the store. This function is optional, and only needed
// if you wish that migrated proposals be cancellable.
func AddProposerAddressToProposal(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, proposals map[uint64]string) error {
proposalIDs := make([]uint64, 0, len(proposals))
for proposalID := range proposals {
proposalIDs = append(proposalIDs, proposalID)
}
// sort the proposalIDs
sort.Slice(proposalIDs, func(i, j int) bool { return proposalIDs[i] < proposalIDs[j] })
store := ctx.KVStore(storeKey)
for _, proposalID := range proposalIDs {
if len(proposals[proposalID]) == 0 {
return fmt.Errorf("found missing proposer for proposal ID: %d", proposalID)
}
if _, err := sdk.AccAddressFromBech32(proposals[proposalID]); err != nil {
return fmt.Errorf("invalid proposer address : %s", proposals[proposalID])
}
bz := store.Get(types.ProposalKey(proposalID))
var proposal govv1.Proposal
if err := cdc.Unmarshal(bz, &proposal); err != nil {
panic(err)
}
// Check if proposal is active
if proposal.Status != govv1.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD &&
proposal.Status != govv1.ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD {
return fmt.Errorf("invalid proposal : %s, proposal not active", proposals[proposalID])
}
proposal.Proposer = proposals[proposalID]
// set the new proposal with proposer
bz, err := cdc.Marshal(&proposal)
if err != nil {
panic(err)
}
store.Set(types.ProposalKey(proposal.Id), bz)
}
return nil
}

View File

@ -170,9 +170,10 @@ type GovInputs struct {
ModuleKey depinject.OwnModuleKey
MsgServiceRouter *baseapp.MsgServiceRouter
AccountKeeper govtypes.AccountKeeper
BankKeeper govtypes.BankKeeper
StakingKeeper govtypes.StakingKeeper
AccountKeeper govtypes.AccountKeeper
BankKeeper govtypes.BankKeeper
StakingKeeper govtypes.StakingKeeper
DistributionKeeper govtypes.DistributionKeeper
// LegacySubspace is used solely for migration of x/params managed parameters
LegacySubspace govtypes.ParamSubspace
@ -205,6 +206,7 @@ func ProvideModule(in GovInputs) GovOutputs {
in.AccountKeeper,
in.BankKeeper,
in.StakingKeeper,
in.DistributionKeeper,
in.MsgServiceRouter,
defaultConfig,
authority.String(),

View File

@ -24,6 +24,7 @@ const (
TallyParamsQuorum = "tally_params_quorum"
TallyParamsThreshold = "tally_params_threshold"
TallyParamsVeto = "tally_params_veto"
ProposalCancelRate = "proposal_cancel_rate"
)
// GenDepositParamsDepositPeriod returns randomized DepositParamsDepositPeriod
@ -41,6 +42,11 @@ func GenDepositMinInitialDepositRatio(r *rand.Rand) sdk.Dec {
return sdk.NewDec(int64(simulation.RandIntBetween(r, 0, 99))).Quo(sdk.NewDec(100))
}
// GenProposalCancelRate returns randomized ProposalCancelRate
func GenProposalCancelRate(r *rand.Rand) sdk.Dec {
return sdk.NewDec(int64(simulation.RandIntBetween(r, 0, 99))).Quo(sdk.NewDec(100))
}
// GenVotingParamsVotingPeriod returns randomized VotingParamsVotingPeriod
func GenVotingParamsVotingPeriod(r *rand.Rand) time.Duration {
return time.Duration(simulation.RandIntBetween(r, 1, 2*60*60*24*2)) * time.Second
@ -83,6 +89,12 @@ func RandomizedGenState(simState *module.SimulationState) {
func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) },
)
var proposalCancelRate sdk.Dec
simState.AppParams.GetOrGenerate(
simState.Cdc, ProposalCancelRate, &proposalCancelRate, simState.Rand,
func(r *rand.Rand) { proposalCancelRate = GenProposalCancelRate(r) },
)
var votingPeriod time.Duration
simState.AppParams.GetOrGenerate(
simState.Cdc, VotingParamsVotingPeriod, &votingPeriod, simState.Rand,
@ -109,7 +121,7 @@ func RandomizedGenState(simState *module.SimulationState) {
govGenesis := v1.NewGenesisState(
startingProposalID,
v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), veto.String(), minInitialDepositRatio.String()),
v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), veto.String(), minInitialDepositRatio.String(), proposalCancelRate.String(), ""),
)
bz, err := json.MarshalIndent(&govGenesis, "", " ")

View File

@ -44,15 +44,15 @@ func TestRandomizedGenState(t *testing.T) {
simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &govGenesis)
const (
tallyQuorum = "0.400000000000000000"
tallyThreshold = "0.539000000000000000"
tallyVetoThreshold = "0.314000000000000000"
tallyQuorum = "0.375000000000000000"
tallyThreshold = "0.478000000000000000"
tallyVetoThreshold = "0.324000000000000000"
minInitialDepositDec = "0.590000000000000000"
)
require.Equal(t, "905stake", govGenesis.Params.MinDeposit[0].String())
require.Equal(t, "77h26m10s", govGenesis.Params.MaxDepositPeriod.String())
require.Equal(t, float64(275567), govGenesis.Params.VotingPeriod.Seconds())
require.Equal(t, float64(135894), govGenesis.Params.VotingPeriod.Seconds())
require.Equal(t, tallyQuorum, govGenesis.Params.Quorum)
require.Equal(t, tallyThreshold, govGenesis.Params.Threshold)
require.Equal(t, tallyVetoThreshold, govGenesis.Params.VetoThreshold)

View File

@ -25,28 +25,32 @@ var (
TypeMsgVote = sdk.MsgTypeURL(&v1.MsgVote{})
TypeMsgVoteWeighted = sdk.MsgTypeURL(&v1.MsgVoteWeighted{})
TypeMsgSubmitProposal = sdk.MsgTypeURL(&v1.MsgSubmitProposal{})
TypeMsgCancelProposal = sdk.MsgTypeURL(&v1.MsgCancelProposal{})
)
// Simulation operation weights constants
//
//nolint:gosec // these are not hard-coded credentials.
const (
OpWeightMsgDeposit = "op_weight_msg_deposit"
OpWeightMsgVote = "op_weight_msg_vote"
OpWeightMsgVoteWeighted = "op_weight_msg_weighted_vote"
OpWeightMsgDeposit = "op_weight_msg_deposit"
OpWeightMsgVote = "op_weight_msg_vote"
OpWeightMsgVoteWeighted = "op_weight_msg_weighted_vote"
OpWeightMsgCancelProposal = "op_weight_msg_cancel_proposal"
DefaultWeightMsgDeposit = 100
DefaultWeightMsgVote = 67
DefaultWeightMsgVoteWeighted = 33
DefaultWeightTextProposal = 5
DefaultWeightMsgDeposit = 100
DefaultWeightMsgVote = 67
DefaultWeightMsgVoteWeighted = 33
DefaultWeightTextProposal = 5
DefaultWeightMsgCancelProposal = 5
)
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, wContents []simtypes.WeightedProposalContent) simulation.WeightedOperations {
var (
weightMsgDeposit int
weightMsgVote int
weightMsgVoteWeighted int
weightMsgDeposit int
weightMsgVote int
weightMsgVoteWeighted int
weightMsgCancelProposal int
)
appParams.GetOrGenerate(cdc, OpWeightMsgDeposit, &weightMsgDeposit, nil,
@ -67,6 +71,12 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty
},
)
appParams.GetOrGenerate(cdc, OpWeightMsgCancelProposal, &weightMsgCancelProposal, nil,
func(_ *rand.Rand) {
weightMsgCancelProposal = DefaultWeightMsgCancelProposal
},
)
// generate the weighted operations for the proposal contents
var wProposalOps simulation.WeightedOperations
@ -98,6 +108,10 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty
weightMsgVoteWeighted,
SimulateMsgVoteWeighted(ak, bk, k),
),
simulation.NewWeightedOperation(
weightMsgCancelProposal,
SimulateMsgCancelProposal(ak, bk, k),
),
}
return append(wProposalOps, wGovOps...)
@ -379,6 +393,46 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe
}
}
// SimulateMsgCancelProposal generates a MsgCancelProposal.
func SimulateMsgCancelProposal(ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,
accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount := accs[0]
proposal := randomProposal(r, k, ctx)
if proposal == nil {
return simtypes.NoOpMsg(types.ModuleName, TypeMsgCancelProposal, "no proposals found"), nil, nil
}
if proposal.Proposer != simAccount.Address.String() {
return simtypes.NoOpMsg(types.ModuleName, TypeMsgCancelProposal, "invalid proposer"), nil, nil
}
account := ak.GetAccount(ctx, simAccount.Address)
spendable := bk.SpendableCoins(ctx, account.GetAddress())
msg := v1.NewMsgCancelProposal(proposal.Id, account.GetAddress().String())
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
Cdc: nil,
Msg: msg,
MsgType: msg.Type(),
Context: ctx,
SimAccount: simAccount,
AccountKeeper: ak,
Bankkeeper: bk,
ModuleName: types.ModuleName,
CoinsSpentInMsg: spendable,
}
return simulation.GenAndDeliverTxWithRandFees(txCtx)
}
}
// Pick a random deposit with a random denomination with a
// deposit amount between (0, min(balance, minDepositAmount))
// This is to simulate multiple users depositing to get the
@ -434,6 +488,16 @@ func randomDeposit(
return sdk.Coins{sdk.NewCoin(denom, amount)}, false, nil
}
// randomProposal
func randomProposal(r *rand.Rand, k *keeper.Keeper, ctx sdk.Context) *v1.Proposal {
proposals := k.GetProposals(ctx)
if len(proposals) == 0 {
return nil
}
randomIndex := r.Intn(len(proposals))
return proposals[randomIndex]
}
// Pick a random proposal ID between the initial proposal ID
// (defined in gov GenesisState) and the latest proposal ID
// that matches a given Status.

View File

@ -23,6 +23,8 @@ import (
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/distribution"
dk "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec"
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/simulation"
@ -95,6 +97,7 @@ func TestWeightedOperations(t *testing.T) {
{simulation.DefaultWeightMsgDeposit, types.ModuleName, simulation.TypeMsgDeposit},
{simulation.DefaultWeightMsgVote, types.ModuleName, simulation.TypeMsgVote},
{simulation.DefaultWeightMsgVoteWeighted, types.ModuleName, simulation.TypeMsgVoteWeighted},
{simulation.DefaultWeightMsgCancelProposal, types.ModuleName, simulation.TypeMsgCancelProposal},
}
for i, w := range weightesOps {
@ -143,6 +146,51 @@ func TestSimulateMsgSubmitProposal(t *testing.T) {
require.Equal(t, simulation.TypeMsgSubmitProposal, msg.Type())
}
// TestSimulateMsgCancelProposal tests the normal scenario of a valid message of type TypeMsgCancelProposal.
// Abnormal scenarios, where errors occur, are not tested here.
func TestSimulateMsgCancelProposal(t *testing.T) {
suite, ctx := createTestSuite(t, false)
app := suite.App
blockTime := time.Now().UTC()
ctx = ctx.WithBlockTime(blockTime)
// setup 3 accounts
s := rand.NewSource(1)
r := rand.New(s)
accounts := getTestingAccounts(t, r, suite.AccountKeeper, suite.BankKeeper, suite.StakingKeeper, ctx, 3)
// setup a proposal
proposer := accounts[0].Address
content := v1beta1.NewTextProposal("Test", "description")
contentMsg, err := v1.NewLegacyContent(content, suite.GovKeeper.GetGovernanceAccount(ctx).GetAddress().String())
require.NoError(t, err)
submitTime := ctx.BlockHeader().Time
depositPeriod := suite.GovKeeper.GetParams(ctx).MaxDepositPeriod
proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, "", submitTime, submitTime.Add(*depositPeriod), "title", "summary", proposer)
require.NoError(t, err)
suite.GovKeeper.SetProposal(ctx, proposal)
// begin a new block
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash, Time: blockTime}})
// execute operation
op := simulation.SimulateMsgCancelProposal(suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper)
operationMsg, _, err := op(r, app.BaseApp, ctx, accounts, "")
require.NoError(t, err)
var msg v1.MsgCancelProposal
err = govcodec.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)
require.NoError(t, err)
require.True(t, operationMsg.OK)
require.Equal(t, uint64(1), msg.ProposalId)
require.Equal(t, proposer.String(), msg.Proposer)
require.Equal(t, "gov", msg.Route())
require.Equal(t, simulation.TypeMsgCancelProposal, msg.Type())
}
// TestSimulateMsgDeposit tests the normal scenario of a valid message of type TypeMsgDeposit.
// Abnormal scenarios, where errors occur, are not tested here.
func TestSimulateMsgDeposit(t *testing.T) {
@ -280,12 +328,13 @@ func TestSimulateMsgVoteWeighted(t *testing.T) {
}
type suite struct {
cdc codec.Codec
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
GovKeeper *keeper.Keeper
StakingKeeper *stakingkeeper.Keeper
App *runtime.App
cdc codec.Codec
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
GovKeeper *keeper.Keeper
StakingKeeper *stakingkeeper.Keeper
DistributionKeeper dk.Keeper
App *runtime.App
}
// returns context and an app with updated mint keeper
@ -299,8 +348,9 @@ func createTestSuite(t *testing.T, isCheckTx bool) (suite, sdk.Context) {
configurator.BankModule(),
configurator.StakingModule(),
configurator.ConsensusModule(),
configurator.DistributionModule(),
configurator.GovModule(),
), &res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.cdc)
), &res.AccountKeeper, &res.BankKeeper, &res.GovKeeper, &res.StakingKeeper, &res.DistributionKeeper, &res.cdc)
require.NoError(t, err)
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})

View File

@ -32,3 +32,8 @@ type StakingKeeper interface {
BondDenom(ctx sdk.Context) string
TokensFromConsensusPower(ctx sdk.Context, power int64) math.Int
}
// DistributionKeeper defines the expected distribution keeper
type DistributionKeeper interface {
FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

View File

@ -1020,3 +1020,40 @@ func (mr *MockStakingKeeperMockRecorder) TotalBondedTokens(arg0 interface{}) *go
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalBondedTokens", reflect.TypeOf((*MockStakingKeeper)(nil).TotalBondedTokens), arg0)
}
// MockDistributionKeeper is a mock of DistributionKeeper interface.
type MockDistributionKeeper struct {
ctrl *gomock.Controller
recorder *MockDistributionKeeperMockRecorder
}
// MockDistributionKeeperMockRecorder is the mock recorder for MockDistributionKeeper.
type MockDistributionKeeperMockRecorder struct {
mock *MockDistributionKeeper
}
// NewMockDistributionKeeper creates a new mock instance.
func NewMockDistributionKeeper(ctrl *gomock.Controller) *MockDistributionKeeper {
mock := &MockDistributionKeeper{ctrl: ctrl}
mock.recorder = &MockDistributionKeeperMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockDistributionKeeper) EXPECT() *MockDistributionKeeperMockRecorder {
return m.recorder
}
// FundCommunityPool mocks base method.
func (m *MockDistributionKeeper) FundCommunityPool(ctx types.Context, amount types.Coins, sender types.AccAddress) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FundCommunityPool", ctx, amount, sender)
ret0, _ := ret[0].(error)
return ret0
}
// FundCommunityPool indicates an expected call of FundCommunityPool.
func (mr *MockDistributionKeeperMockRecorder) FundCommunityPool(ctx, amount, sender interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundCommunityPool", reflect.TypeOf((*MockDistributionKeeper)(nil).FundCommunityPool), ctx, amount, sender)
}

View File

@ -22,4 +22,9 @@ var (
ErrInvalidSignalMsg = sdkerrors.Register(ModuleName, 14, "signal message is invalid")
ErrMetadataTooLong = sdkerrors.Register(ModuleName, 15, "metadata too long")
ErrMinDepositTooSmall = sdkerrors.Register(ModuleName, 16, "minimum deposit is too small")
ErrProposalNotFound = sdkerrors.Register(ModuleName, 17, "proposal is not found")
ErrInvalidProposer = sdkerrors.Register(ModuleName, 18, "invalid proposer")
ErrNoDeposits = sdkerrors.Register(ModuleName, 19, "no deposits found")
ErrVotingPeriodEnded = sdkerrors.Register(ModuleName, 20, "voting period already ended")
ErrInvalidProposal = sdkerrors.Register(ModuleName, 21, "invalid proposal")
)

View File

@ -8,6 +8,7 @@ const (
EventTypeInactiveProposal = "inactive_proposal"
EventTypeActiveProposal = "active_proposal"
EventTypeSignalProposal = "signal_proposal"
EventTypeCancelProposal = "cancel_proposal"
AttributeKeyProposalResult = "proposal_result"
AttributeKeyOption = "option"
@ -18,7 +19,9 @@ const (
AttributeValueProposalPassed = "proposal_passed" // met vote quorum
AttributeValueProposalRejected = "proposal_rejected" // didn't meet vote quorum
AttributeValueProposalFailed = "proposal_failed" // error on proposal handler
AttributeKeyProposalType = "proposal_type"
AttributeSignalTitle = "signal_title"
AttributeSignalDescription = "signal_description"
AttributeValueProposalCanceled = "proposal_canceled" // error on proposal handler
AttributeKeyProposalType = "proposal_type"
AttributeSignalTitle = "signal_title"
AttributeSignalDescription = "signal_description"
)

View File

@ -27,6 +27,11 @@ type StakingKeeper interface {
)
}
// DistributionKeeper defines the expected distribution keeper (noalias)
type DistributionKeeper interface {
FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}
// AccountKeeper defines the expected account keeper (noalias)
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) sdk.AccountI

View File

@ -739,6 +739,15 @@ type Params struct {
VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"`
// The ratio representing the proportion of the deposit value that must be paid at proposal submission.
MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"`
// The cancel ratio which will not be returned back to the depositors when a proposal is cancelled.
//
// Since: cosmos-sdk 0.48
ProposalCancelRatio string `protobuf:"bytes,8,opt,name=proposal_cancel_ratio,json=proposalCancelRatio,proto3" json:"proposal_cancel_ratio,omitempty"`
// The address which will receive (proposal_cancel_ratio * deposit) proposal deposits.
// If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned.
//
// Since: cosmos-sdk 0.48
ProposalCancelDest string `protobuf:"bytes,9,opt,name=proposal_cancel_dest,json=proposalCancelDest,proto3" json:"proposal_cancel_dest,omitempty"`
}
func (m *Params) Reset() { *m = Params{} }
@ -823,6 +832,20 @@ func (m *Params) GetMinInitialDepositRatio() string {
return ""
}
func (m *Params) GetProposalCancelRatio() string {
if m != nil {
return m.ProposalCancelRatio
}
return ""
}
func (m *Params) GetProposalCancelDest() string {
if m != nil {
return m.ProposalCancelDest
}
return ""
}
func init() {
proto.RegisterEnum("cosmos.gov.v1.VoteOption", VoteOption_name, VoteOption_value)
proto.RegisterEnum("cosmos.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value)
@ -840,83 +863,86 @@ func init() {
func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) }
var fileDescriptor_e05cb1c0d030febb = []byte{
// 1212 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x3f, 0x73, 0x13, 0x47,
0x14, 0xf7, 0x49, 0x27, 0x59, 0x7e, 0xb2, 0x84, 0x58, 0x1c, 0x38, 0x1b, 0x90, 0x8c, 0x26, 0xc3,
0x38, 0xfc, 0x91, 0x62, 0x08, 0x69, 0x48, 0x23, 0x5b, 0x47, 0x38, 0x86, 0x58, 0x9a, 0xd3, 0x61,
0x86, 0x34, 0x37, 0x6b, 0xdf, 0x22, 0xed, 0x44, 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,
0x45, 0x6f, 0xb8, 0x57, 0xdb, 0x67, 0xbe, 0x7a, 0x9b, 0xaa, 0xbf, 0xeb, 0xdc, 0xfb, 0xa6, 0xfe,
0x54, 0xbe, 0xb7, 0xc5, 0x78, 0x40, 0x78, 0xf4, 0x98, 0xce, 0xca, 0x16, 0xbd, 0xf9, 0x5f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x31, 0x0a, 0x72, 0x23, 0x8d, 0x0b, 0x00, 0x00,
// 1252 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x73, 0xd3, 0x46,
0x14, 0x8e, 0x6c, 0xd9, 0x71, 0x9e, 0x63, 0x63, 0x96, 0x00, 0x4a, 0x00, 0x3b, 0x78, 0x3a, 0x4c,
0xca, 0x0f, 0xbb, 0x81, 0xd2, 0x0b, 0xbd, 0xd8, 0xb1, 0x28, 0xca, 0xd0, 0xd8, 0x23, 0x8b, 0x30,
0xf4, 0xa2, 0x51, 0xac, 0xc5, 0xd9, 0xa9, 0xa5, 0x75, 0xb5, 0x6b, 0x83, 0xff, 0x84, 0xde, 0x38,
0x76, 0x7a, 0xea, 0xb1, 0xc7, 0x1e, 0x98, 0xde, 0x7b, 0xe3, 0xd0, 0xe9, 0x30, 0x5c, 0xda, 0x5e,
0x68, 0x07, 0x0e, 0x9d, 0xe1, 0xaf, 0xe8, 0x68, 0xb5, 0x8a, 0x1d, 0xc5, 0x6d, 0x02, 0x17, 0x5b,
0x7a, 0xef, 0xfb, 0xbe, 0x7d, 0xfb, 0x7e, 0xac, 0x16, 0xce, 0xf7, 0x28, 0xf3, 0x28, 0xab, 0xf7,
0xe9, 0xb8, 0x3e, 0xde, 0x0c, 0xff, 0x6a, 0xc3, 0x80, 0x72, 0x8a, 0x0a, 0x91, 0xa3, 0x16, 0x5a,
0xc6, 0x9b, 0x6b, 0x65, 0x89, 0xdb, 0x73, 0x18, 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df, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0xd0, 0x44, 0x5e,
0x1d, 0x0c, 0x00, 0x00,
}
func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) {
@ -1395,6 +1421,20 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.ProposalCancelDest) > 0 {
i -= len(m.ProposalCancelDest)
copy(dAtA[i:], m.ProposalCancelDest)
i = encodeVarintGov(dAtA, i, uint64(len(m.ProposalCancelDest)))
i--
dAtA[i] = 0x4a
}
if len(m.ProposalCancelRatio) > 0 {
i -= len(m.ProposalCancelRatio)
copy(dAtA[i:], m.ProposalCancelRatio)
i = encodeVarintGov(dAtA, i, uint64(len(m.ProposalCancelRatio)))
i--
dAtA[i] = 0x42
}
if len(m.MinInitialDepositRatio) > 0 {
i -= len(m.MinInitialDepositRatio)
copy(dAtA[i:], m.MinInitialDepositRatio)
@ -1712,6 +1752,14 @@ func (m *Params) Size() (n int) {
if l > 0 {
n += 1 + l + sovGov(uint64(l))
}
l = len(m.ProposalCancelRatio)
if l > 0 {
n += 1 + l + sovGov(uint64(l))
}
l = len(m.ProposalCancelDest)
if l > 0 {
n += 1 + l + sovGov(uint64(l))
}
return n
}
@ -3381,6 +3429,70 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposalCancelRatio", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGov
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGov
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGov
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProposalCancelRatio = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposalCancelDest", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGov
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGov
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGov
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProposalCancelDest = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGov(dAtA[iNdEx:])

View File

@ -15,8 +15,8 @@ import (
)
var (
_, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}
_, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{}
_, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{}
_, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{}
)
// NewMsgSubmitProposal creates a new MsgSubmitProposal.
@ -309,3 +309,40 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
authority, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{authority}
}
// NewMsgCancelProposal creates a new MsgCancelProposal instance
//
//nolint:interfacer
func NewMsgCancelProposal(proposalID uint64, proposer string) *MsgCancelProposal {
return &MsgCancelProposal{
ProposalId: proposalID,
Proposer: proposer,
}
}
// Route implements Msg
func (msg MsgCancelProposal) Route() string { return types.RouterKey }
// Type implements Msg
func (msg MsgCancelProposal) Type() string { return sdk.MsgTypeURL(&msg) }
// ValidateBasic implements Msg
func (msg MsgCancelProposal) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Proposer); err != nil {
return sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err)
}
return nil
}
// GetSignBytes implements Msg
func (msg MsgCancelProposal) GetSignBytes() []byte {
bz := codec.ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}
// GetSigners implements Msg
func (msg MsgCancelProposal) GetSigners() []sdk.AccAddress {
proposer, _ := sdk.AccAddressFromBech32(msg.Proposer)
return []sdk.AccAddress{proposer}
}

View File

@ -16,11 +16,13 @@ const (
// Default governance params
var (
DefaultMinDepositTokens = sdk.NewInt(10000000)
DefaultQuorum = sdk.NewDecWithPrec(334, 3)
DefaultThreshold = sdk.NewDecWithPrec(5, 1)
DefaultVetoThreshold = sdk.NewDecWithPrec(334, 3)
DefaultMinInitialDepositRatio = sdk.ZeroDec()
DefaultMinDepositTokens = sdk.NewInt(10000000)
DefaultQuorum = sdk.NewDecWithPrec(334, 3)
DefaultThreshold = sdk.NewDecWithPrec(5, 1)
DefaultVetoThreshold = sdk.NewDecWithPrec(334, 3)
DefaultMinInitialDepositRatio = sdk.ZeroDec()
DefaultProposalCancelRatio = sdk.MustNewDecFromStr("0.5")
DefaultProposalCancelDestAddress = ""
)
// Deprecated: NewDepositParams creates a new DepositParams object
@ -50,7 +52,7 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams {
// NewParams creates a new Params instance with given values.
func NewParams(
minDeposit sdk.Coins, maxDepositPeriod time.Duration, votingPeriod time.Duration,
quorum string, threshold string, vetoThreshold string, minInitialDepositRatio string,
quorum, threshold, vetoThreshold, minInitialDepositRatio, proposalCancelRatio, proposalCancelDest string,
) Params {
return Params{
MinDeposit: minDeposit,
@ -60,6 +62,8 @@ func NewParams(
Threshold: threshold,
VetoThreshold: vetoThreshold,
MinInitialDepositRatio: minInitialDepositRatio,
ProposalCancelRatio: proposalCancelRatio,
ProposalCancelDest: proposalCancelDest,
}
}
@ -73,6 +77,8 @@ func DefaultParams() Params {
DefaultThreshold.String(),
DefaultVetoThreshold.String(),
DefaultMinInitialDepositRatio.String(),
DefaultProposalCancelRatio.String(),
DefaultProposalCancelDestAddress,
)
}
@ -131,5 +137,34 @@ func (p Params) ValidateBasic() error {
return fmt.Errorf("voting period must be positive: %s", p.VotingPeriod)
}
minInitialDepositRatio, err := sdk.NewDecFromStr(p.MinInitialDepositRatio)
if err != nil {
return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err)
}
if minInitialDepositRatio.IsNegative() {
return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio)
}
if minInitialDepositRatio.GT(math.LegacyOneDec()) {
return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio)
}
proposalCancelRate, err := sdk.NewDecFromStr(p.ProposalCancelRatio)
if err != nil {
return fmt.Errorf("invalid burn rate of cancel proposal: %w", err)
}
if proposalCancelRate.IsNegative() {
return fmt.Errorf("burn rate of cancel proposal must be positive: %s", proposalCancelRate)
}
if proposalCancelRate.GT(math.LegacyOneDec()) {
return fmt.Errorf("burn rate of cancel proposal is too large: %s", proposalCancelRate)
}
if len(p.ProposalCancelDest) != 0 {
_, err := sdk.AccAddressFromBech32(p.ProposalCancelDest)
if err != nil {
return fmt.Errorf("deposits destination address is invalid: %s", p.ProposalCancelDest)
}
}
return nil
}

View File

@ -14,18 +14,22 @@ import (
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
math_bits "math/bits"
time "time"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@ -688,6 +692,127 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
// MsgCancelProposal is the Msg/CancelProposal request type.
//
// Since: cosmos-sdk 0.48
type MsgCancelProposal struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"`
Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"`
}
func (m *MsgCancelProposal) Reset() { *m = MsgCancelProposal{} }
func (m *MsgCancelProposal) String() string { return proto.CompactTextString(m) }
func (*MsgCancelProposal) ProtoMessage() {}
func (*MsgCancelProposal) Descriptor() ([]byte, []int) {
return fileDescriptor_9ff8f4a63b6fc9a9, []int{12}
}
func (m *MsgCancelProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCancelProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCancelProposal.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCancelProposal) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCancelProposal.Merge(m, src)
}
func (m *MsgCancelProposal) XXX_Size() int {
return m.Size()
}
func (m *MsgCancelProposal) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCancelProposal.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCancelProposal proto.InternalMessageInfo
func (m *MsgCancelProposal) GetProposalId() uint64 {
if m != nil {
return m.ProposalId
}
return 0
}
func (m *MsgCancelProposal) GetProposer() string {
if m != nil {
return m.Proposer
}
return ""
}
// MsgCancelProposalResponse defines the response structure for executing a
// MsgCancelProposal message.
//
// Since: cosmos-sdk 0.48
type MsgCancelProposalResponse struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"`
// canceled_time is the time when proposal is canceled.
CanceledTime time.Time `protobuf:"bytes,2,opt,name=canceled_time,json=canceledTime,proto3,stdtime" json:"canceled_time"`
// canceled_height defines the block height at which the proposal is canceled.
CanceledHeight uint64 `protobuf:"varint,3,opt,name=canceled_height,json=canceledHeight,proto3" json:"canceled_height,omitempty"`
}
func (m *MsgCancelProposalResponse) Reset() { *m = MsgCancelProposalResponse{} }
func (m *MsgCancelProposalResponse) String() string { return proto.CompactTextString(m) }
func (*MsgCancelProposalResponse) ProtoMessage() {}
func (*MsgCancelProposalResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_9ff8f4a63b6fc9a9, []int{13}
}
func (m *MsgCancelProposalResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCancelProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCancelProposalResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCancelProposalResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCancelProposalResponse.Merge(m, src)
}
func (m *MsgCancelProposalResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgCancelProposalResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCancelProposalResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCancelProposalResponse proto.InternalMessageInfo
func (m *MsgCancelProposalResponse) GetProposalId() uint64 {
if m != nil {
return m.ProposalId
}
return 0
}
func (m *MsgCancelProposalResponse) GetCanceledTime() time.Time {
if m != nil {
return m.CanceledTime
}
return time.Time{}
}
func (m *MsgCancelProposalResponse) GetCanceledHeight() uint64 {
if m != nil {
return m.CanceledHeight
}
return 0
}
func init() {
proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1.MsgSubmitProposal")
proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1.MsgSubmitProposalResponse")
@ -701,69 +826,79 @@ func init() {
proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1.MsgDepositResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.gov.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.gov.v1.MsgUpdateParamsResponse")
proto.RegisterType((*MsgCancelProposal)(nil), "cosmos.gov.v1.MsgCancelProposal")
proto.RegisterType((*MsgCancelProposalResponse)(nil), "cosmos.gov.v1.MsgCancelProposalResponse")
}
func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) }
var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{
// 908 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45,
0x14, 0xce, 0xe6, 0x87, 0xdd, 0xbc, 0x40, 0xaa, 0x8c, 0xdc, 0x76, 0xbd, 0x2a, 0x9b, 0x74, 0x8b,
0x50, 0x94, 0x90, 0x5d, 0x1c, 0x68, 0x85, 0x4c, 0x85, 0x54, 0x97, 0x0a, 0x21, 0x61, 0xa8, 0x5c,
0x51, 0x24, 0x84, 0x14, 0x8d, 0xbd, 0xc3, 0x64, 0x45, 0x76, 0x67, 0xb5, 0x33, 0xb6, 0xe2, 0x1b,
0xe2, 0xd8, 0x13, 0x7f, 0x06, 0xc7, 0x1c, 0x7a, 0xeb, 0x3f, 0x50, 0x38, 0x55, 0x9c, 0x38, 0x55,
0x28, 0x11, 0x44, 0xe2, 0x9f, 0x00, 0xcd, 0x8f, 0x5d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 0x8c, 0x06, 0xc7, 0xe3,
0xb3, 0x1a, 0x9c, 0x35, 0x05, 0xce, 0xca, 0x0f, 0x72, 0xce, 0x5a, 0x0f, 0x5f, 0x9c, 0xba, 0xd6,
0xcb, 0x53, 0xd7, 0xfa, 0xe3, 0xd4, 0xb5, 0x7e, 0x3a, 0x73, 0x17, 0x5e, 0x9e, 0xb9, 0x0b, 0xbf,
0x9f, 0xb9, 0x0b, 0xdf, 0xec, 0xd2, 0x48, 0x1c, 0xf6, 0xbb, 0x7e, 0x8f, 0xc5, 0xe6, 0xef, 0x4d,
0x50, 0x1a, 0x3c, 0x31, 0x4c, 0x09, 0x97, 0x7f, 0xa6, 0x2a, 0xea, 0x7b, 0xf7, 0xfe, 0xbf, 0x01,
0x00, 0x00, 0xff, 0xff, 0xc2, 0x00, 0x8f, 0x53, 0x8c, 0x09, 0x00, 0x00,
// 1027 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6f, 0x1b, 0x45,
0x14, 0xcf, 0x26, 0x8e, 0x9d, 0x4c, 0x9a, 0x44, 0x59, 0xb9, 0xed, 0x7a, 0x55, 0xd6, 0xe9, 0x16,
0x41, 0x94, 0x90, 0x5d, 0x1c, 0x68, 0x85, 0x4c, 0x85, 0x54, 0x87, 0x0a, 0x2a, 0x61, 0xa8, 0xb6,
0x50, 0x24, 0x84, 0x14, 0x8d, 0xbd, 0xc3, 0x66, 0x85, 0x77, 0x67, 0xe5, 0x19, 0x5b, 0xf1, 0x0d,
0x71, 0xec, 0xa9, 0x7f, 0x06, 0xc7, 0x1c, 0x7a, 0xeb, 0x89, 0x5b, 0xe1, 0x54, 0x71, 0xe2, 0x14,
0x50, 0x22, 0x08, 0xe2, 0x9f, 0x00, 0xcd, 0xc7, 0xae, 0xf7, 0x2b, 0x1f, 0x70, 0xe8, 0xc5, 0xda,
0x79, 0xef, 0xf7, 0xde, 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x26, 0x14, 0x5c,
0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -794,6 +929,10 @@ type MsgClient interface {
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// CancelProposal defines a method to cancel governance proposal
//
// Since: cosmos-sdk 0.48
CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error)
}
type msgClient struct {
@ -858,6 +997,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil
}
func (c *msgClient) CancelProposal(ctx context.Context, in *MsgCancelProposal, opts ...grpc.CallOption) (*MsgCancelProposalResponse, error) {
out := new(MsgCancelProposalResponse)
err := c.cc.Invoke(ctx, "/cosmos.gov.v1.Msg/CancelProposal", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// SubmitProposal defines a method to create new proposal given the messages.
@ -876,6 +1024,10 @@ type MsgServer interface {
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// CancelProposal defines a method to cancel governance proposal
//
// Since: cosmos-sdk 0.48
CancelProposal(context.Context, *MsgCancelProposal) (*MsgCancelProposalResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -900,6 +1052,9 @@ func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*M
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (*UnimplementedMsgServer) CancelProposal(ctx context.Context, req *MsgCancelProposal) (*MsgCancelProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelProposal not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -1013,6 +1168,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_CancelProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCancelProposal)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CancelProposal(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.gov.v1.Msg/CancelProposal",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CancelProposal(ctx, req.(*MsgCancelProposal))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.gov.v1.Msg",
HandlerType: (*MsgServer)(nil),
@ -1041,6 +1214,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "CancelProposal",
Handler: _Msg_CancelProposal_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/gov/v1/tx.proto",
@ -1502,6 +1679,82 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil
}
func (m *MsgCancelProposal) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCancelProposal) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCancelProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Proposer) > 0 {
i -= len(m.Proposer)
copy(dAtA[i:], m.Proposer)
i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer)))
i--
dAtA[i] = 0x12
}
if m.ProposalId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ProposalId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *MsgCancelProposalResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCancelProposalResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCancelProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.CanceledHeight != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.CanceledHeight))
i--
dAtA[i] = 0x18
}
n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CanceledTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CanceledTime):])
if err3 != nil {
return 0, err3
}
i -= n3
i = encodeVarintTx(dAtA, i, uint64(n3))
i--
dAtA[i] = 0x12
if m.ProposalId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ProposalId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -1710,6 +1963,39 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
return n
}
func (m *MsgCancelProposal) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ProposalId != 0 {
n += 1 + sovTx(uint64(m.ProposalId))
}
l = len(m.Proposer)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgCancelProposalResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ProposalId != 0 {
n += 1 + sovTx(uint64(m.ProposalId))
}
l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CanceledTime)
n += 1 + l + sovTx(uint64(l))
if m.CanceledHeight != 0 {
n += 1 + sovTx(uint64(m.CanceledHeight))
}
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -2968,6 +3254,228 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgCancelProposal) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCancelProposal: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCancelProposal: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
}
m.ProposalId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ProposalId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Proposer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgCancelProposalResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCancelProposalResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCancelProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
}
m.ProposalId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ProposalId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CanceledTime", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CanceledTime, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CanceledHeight", wireType)
}
m.CanceledHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CanceledHeight |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0