From fb1f74c2cea0cfd29d88e7adb2cd5945de7bd6c5 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 17 Oct 2023 14:30:23 +0200 Subject: [PATCH 01/22] feat: implement a minimum amount per deposit --- api/cosmos/feegrant/v1beta1/tx.pulsar.go | 4 + api/cosmos/feegrant/v1beta1/tx_grpc.pb.go | 8 +- api/cosmos/gov/v1/gov.pulsar.go | 151 ++++++++++---- proto/cosmos/gov/v1/gov.proto | 7 + x/feegrant/tx.pb.go | 12 +- x/gov/keeper/deposit.go | 56 +++++- x/gov/keeper/deposit_test.go | 70 +++++++ x/gov/keeper/msg_server.go | 27 +-- x/gov/migrations/v5/store.go | 1 + x/gov/simulation/genesis.go | 11 +- x/gov/types/errors.go | 1 + x/gov/types/v1/gov.pb.go | 235 ++++++++++++++-------- x/gov/types/v1/params.go | 6 +- 13 files changed, 432 insertions(+), 157 deletions(-) diff --git a/api/cosmos/feegrant/v1beta1/tx.pulsar.go b/api/cosmos/feegrant/v1beta1/tx.pulsar.go index c27b7c8e51c3..70056e9cbde3 100644 --- a/api/cosmos/feegrant/v1beta1/tx.pulsar.go +++ b/api/cosmos/feegrant/v1beta1/tx.pulsar.go @@ -2723,6 +2723,8 @@ func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int) { } // MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 type MsgPruneAllowances struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2760,6 +2762,8 @@ func (x *MsgPruneAllowances) GetPruner() string { } // MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 type MsgPruneAllowancesResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go b/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go index 1bfb94127da1..76637c5e0777 100644 --- a/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/feegrant/v1beta1/tx_grpc.pb.go @@ -36,7 +36,9 @@ type MsgClient interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) - // PruneAllowances prunes expired fee allowances. + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } @@ -85,7 +87,9 @@ type MsgServer interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) - // PruneAllowances prunes expired fee allowances. + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) mustEmbedUnimplementedMsgServer() } diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index 175c72422ad4..58a6a317a357 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -5547,6 +5547,7 @@ var ( fd_Params_burn_vote_quorum protoreflect.FieldDescriptor fd_Params_burn_proposal_deposit_prevote protoreflect.FieldDescriptor fd_Params_burn_vote_veto protoreflect.FieldDescriptor + fd_Params_min_deposit_ratio protoreflect.FieldDescriptor ) func init() { @@ -5567,6 +5568,7 @@ func init() { fd_Params_burn_vote_quorum = md_Params.Fields().ByName("burn_vote_quorum") fd_Params_burn_proposal_deposit_prevote = md_Params.Fields().ByName("burn_proposal_deposit_prevote") fd_Params_burn_vote_veto = md_Params.Fields().ByName("burn_vote_veto") + fd_Params_min_deposit_ratio = md_Params.Fields().ByName("min_deposit_ratio") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -5724,6 +5726,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.MinDepositRatio != "" { + value := protoreflect.ValueOfString(x.MinDepositRatio) + if !f(fd_Params_min_deposit_ratio, value) { + return + } + } } // Has reports whether a field is populated. @@ -5769,6 +5777,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.BurnProposalDepositPrevote != false case "cosmos.gov.v1.Params.burn_vote_veto": return x.BurnVoteVeto != false + case "cosmos.gov.v1.Params.min_deposit_ratio": + return x.MinDepositRatio != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params")) @@ -5815,6 +5825,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.BurnProposalDepositPrevote = false case "cosmos.gov.v1.Params.burn_vote_veto": x.BurnVoteVeto = false + case "cosmos.gov.v1.Params.min_deposit_ratio": + x.MinDepositRatio = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params")) @@ -5882,6 +5894,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "cosmos.gov.v1.Params.burn_vote_veto": value := x.BurnVoteVeto return protoreflect.ValueOfBool(value) + case "cosmos.gov.v1.Params.min_deposit_ratio": + value := x.MinDepositRatio + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params")) @@ -5936,6 +5951,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.BurnProposalDepositPrevote = value.Bool() case "cosmos.gov.v1.Params.burn_vote_veto": x.BurnVoteVeto = value.Bool() + case "cosmos.gov.v1.Params.min_deposit_ratio": + x.MinDepositRatio = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params")) @@ -6003,6 +6020,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore panic(fmt.Errorf("field burn_proposal_deposit_prevote of message cosmos.gov.v1.Params is not mutable")) case "cosmos.gov.v1.Params.burn_vote_veto": panic(fmt.Errorf("field burn_vote_veto of message cosmos.gov.v1.Params is not mutable")) + case "cosmos.gov.v1.Params.min_deposit_ratio": + panic(fmt.Errorf("field min_deposit_ratio 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")) @@ -6051,6 +6070,8 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor return protoreflect.ValueOfBool(false) case "cosmos.gov.v1.Params.burn_vote_veto": return protoreflect.ValueOfBool(false) + case "cosmos.gov.v1.Params.min_deposit_ratio": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Params")) @@ -6181,6 +6202,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if x.BurnVoteVeto { n += 2 } + l = len(x.MinDepositRatio) + if l > 0 { + n += 2 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -6210,6 +6235,15 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.MinDepositRatio) > 0 { + i -= len(x.MinDepositRatio) + copy(dAtA[i:], x.MinDepositRatio) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinDepositRatio))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } if x.BurnVoteVeto { i-- if x.BurnVoteVeto { @@ -6872,6 +6906,38 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } } x.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinDepositRatio", 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.MinDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -7659,6 +7725,12 @@ type Params struct { BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` // burn deposits if quorum with vote type no_veto is met BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` + // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + MinDepositRatio string `protobuf:"bytes,16,opt,name=min_deposit_ratio,json=minDepositRatio,proto3" json:"min_deposit_ratio,omitempty"` } func (x *Params) Reset() { @@ -7786,6 +7858,13 @@ func (x *Params) GetBurnVoteVeto() bool { return false } +func (x *Params) GetMinDepositRatio() string { + if x != nil { + return x.MinDepositRatio + } + return "" +} + var File_cosmos_gov_v1_gov_proto protoreflect.FileDescriptor var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ @@ -7924,7 +8003,7 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 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, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0xd3, 0x07, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a, 0x0b, + 0x01, 0x22, 0x8f, 0x08, 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, 0xde, @@ -7985,39 +8064,43 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 0x73, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x76, 0x6f, 0x74, 0x65, 0x5f, 0x76, 0x65, 0x74, 0x6f, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x75, 0x72, 0x6e, 0x56, - 0x6f, 0x74, 0x65, 0x56, 0x65, 0x74, 0x6f, 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, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, - 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, - 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, - 0x4f, 0x10, 0x04, 0x2a, 0xce, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, - 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x50, 0x52, 0x4f, 0x50, 0x4f, - 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x44, 0x45, 0x50, 0x4f, 0x53, - 0x49, 0x54, 0x5f, 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x50, - 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, - 0x4f, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x02, 0x12, 0x1a, - 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, - 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, - 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, - 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, - 0x45, 0x44, 0x10, 0x05, 0x42, 0x99, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x47, 0x6f, 0x76, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, - 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x65, 0x56, 0x65, 0x74, 0x6f, 0x12, 0x3a, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x5f, 0x64, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x10, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 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, 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, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x12, 0x0a, + 0x0e, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, + 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x2a, + 0xce, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x44, 0x45, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x5f, 0x50, + 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x50, 0x4f, + 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, 0x49, 0x4e, + 0x47, 0x5f, 0x50, 0x45, 0x52, 0x49, 0x4f, 0x44, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, + 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x41, + 0x53, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, + 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, + 0x45, 0x44, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x05, + 0x42, 0x99, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x47, 0x6f, 0x76, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, + 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, + 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index c6ec98a41497..c5f118b3b06e 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -261,4 +261,11 @@ message Params { // burn deposits if quorum with vote type no_veto is met bool burn_vote_veto = 15; + + // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + string min_deposit_ratio = 16 [(cosmos_proto.scalar) = "cosmos.Dec"]; } diff --git a/x/feegrant/tx.pb.go b/x/feegrant/tx.pb.go index 7bc84761b388..7646b28741a1 100644 --- a/x/feegrant/tx.pb.go +++ b/x/feegrant/tx.pb.go @@ -226,6 +226,8 @@ func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeAllowanceResponse proto.InternalMessageInfo // MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 type MsgPruneAllowances struct { // pruner is the address of the user pruning expired allowances. Pruner string `protobuf:"bytes,1,opt,name=pruner,proto3" json:"pruner,omitempty"` @@ -272,6 +274,8 @@ func (m *MsgPruneAllowances) GetPruner() string { } // MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 type MsgPruneAllowancesResponse struct { } @@ -370,7 +374,9 @@ type MsgClient interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error) - // PruneAllowances prunes expired fee allowances. + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 PruneAllowances(ctx context.Context, in *MsgPruneAllowances, opts ...grpc.CallOption) (*MsgPruneAllowancesResponse, error) } @@ -417,7 +423,9 @@ type MsgServer interface { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error) - // PruneAllowances prunes expired fee allowances. + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 PruneAllowances(context.Context, *MsgPruneAllowances) (*MsgPruneAllowancesResponse, error) } diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 1bd80ea689b4..1d5a6665e79f 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -3,13 +3,16 @@ package keeper import ( "context" "fmt" + "strings" "cosmossdk.io/collections" "cosmossdk.io/errors" + "cosmossdk.io/math" sdkmath "cosmossdk.io/math" pooltypes "cosmossdk.io/x/protocolpool/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) @@ -70,6 +73,49 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito return false, errors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } + params, err := keeper.Params.Get(ctx) + if err != nil { + return false, err + } + + minDepositAmount := proposal.GetMinDepositFromParams(params) + minDepositRatio, err := math.LegacyNewDecFromStr(params.GetMinDepositRatio()) + if err != nil { + return false, err + } + + // the deposit must only contain valid denoms (listed in the min deposit param) + if !depositAmount.DenomsSubsetOf(minDepositAmount) { + return false, errors.Wrapf(types.ErrInvalidDepositDenom, "deposit contains invalid denom/s %s, accepted denoms are: %s", depositAmount.Denoms(), minDepositAmount.Denoms()) + } + + // and the amount must be greater than minDepositAmount*minDepositRatio. + // If the threshold is met with at least one denom, the deposit is valid. + depositThresholdMet := false + thresholds := []string{} + for _, minDep := range minDepositAmount { + // calculate the threshold for this denom, and hold a list to later return a useful error message + threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) + thresholds = append(thresholds, threshold.String()) + + found, deposit := depositAmount.Find(minDep.Denom) + if !found { // if not found, continue, as we know the deposit contains at least 1 valid denom + continue + } + + // once we know at least one threshold has been met, we can break. The deposit + // might contain other denoms but we don't care. + if deposit.IsGTE(threshold) { + depositThresholdMet = true + break + } + } + + // the threshold must be met with at least one denom, if not, return the list of minimum deposits + if !depositThresholdMet { + return false, errors.Wrapf(types.ErrMinDepositTooSmall, "received %s but need at least one of the following: %s", depositAmount, strings.Join(thresholds, ",")) + } + // update the governance module's account coins pool err = keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) if err != nil { @@ -85,12 +131,6 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - params, err := keeper.Params.Get(ctx) - if err != nil { - return false, err - } - minDepositAmount := proposal.GetMinDepositFromParams(params) - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDepositAmount) { err = keeper.ActivateVotingPeriod(ctx, proposal) if err != nil { @@ -235,6 +275,10 @@ func (keeper Keeper) RefundAndDeleteDeposits(ctx context.Context, proposalID uin // required at the time of proposal submission. This threshold amount is determined by // the deposit parameters. Returns nil on success, error otherwise. func (keeper Keeper) validateInitialDeposit(ctx context.Context, initialDeposit sdk.Coins, expedited bool) error { + if !initialDeposit.IsValid() || initialDeposit.IsAnyNegative() { + return errors.Wrap(sdkerrors.ErrInvalidCoins, initialDeposit.String()) + } + params, err := keeper.Params.Get(ctx) if err != nil { return err diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 0cdc446f66b2..824c912a711f 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -161,6 +161,76 @@ func TestDeposits(t *testing.T) { } } +func TestDepositAmount(t *testing.T) { + testcases := []struct { + name string + deposit sdk.Coins + err string + }{ + { + name: "good amount and denoms", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)), + }, { + name: "good amount and denoms but not enough balance for zcoin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("zcoin", 1)), + err: "not enough balance", + }, + { + name: "too small amount", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), + err: "received 10stake but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + }, + { + name: "too small amount with another coin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("zcoin", 1)), + err: "received 1zcoin but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + }, + { + name: "bad denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), + err: "deposit contains invalid denom/s [euro], accepted denoms are: [stake zcoin]: invalid deposit denom", + }, + { + name: "mix containing bad and good denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), + err: "deposit contains invalid denom/s [euro stake], accepted denoms are: [stake zcoin]: invalid deposit denom", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + govKeeper, mocks, _, ctx := setupGovKeeper(t) + authKeeper, bankKeeper, stakingKeeper := mocks.acctKeeper, mocks.bankKeeper, mocks.stakingKeeper + trackMockBalances(bankKeeper) + + testAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdkmath.NewInt(1000000000000000)) + authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + + params, _ := govKeeper.Params.Get(ctx) + params.MinDepositRatio = "0.001" + params.MinDeposit = append(params.MinDeposit, sdk.NewCoin("zcoin", sdkmath.NewInt(10000))) // coins must be sorted by denom + err := govKeeper.Params.Set(ctx, params) + require.NoError(t, err) + + tp := TestProposal + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", testAddrs[0], false) + require.NoError(t, err) + proposalID := proposal.Id + + bankKeeper.MintCoins(ctx, "mint", sdk.NewCoins(sdk.NewCoin("zcoin", sdkmath.NewInt(1000000000)))) + + _, err = govKeeper.AddDeposit(ctx, proposalID, testAddrs[0], tc.deposit) + if tc.err != "" { + require.Error(t, err) + require.Equal(t, tc.err, err.Error()) + } else { + require.NoError(t, err) + } + + }) + } +} + func TestValidateInitialDeposit(t *testing.T) { testcases := map[string]struct { minDeposit sdk.Coins diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index bd624b61fc7d..2af7184baf1c 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -41,10 +41,6 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid proposer address: %s", err) } - if err := validateDeposit(sdk.NewCoins(msg.InitialDeposit...)); err != nil { - return nil, err - } - // check that either metadata or Msgs length is non nil. if len(msg.Messages) == 0 && len(msg.Metadata) == 0 { return nil, errors.Wrap(govtypes.ErrNoProposalMsgs, "either metadata or Msgs length must be non-nil") @@ -240,7 +236,7 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) } - if err := validateAmount(sdk.NewCoins(msg.Amount...)); err != nil { + if err := validateDeposit(msg.Amount); err != nil { return nil, err } @@ -374,26 +370,11 @@ func (k legacyMsgServer) Deposit(goCtx context.Context, msg *v1beta1.MsgDeposit) return &v1beta1.MsgDepositResponse{}, nil } -func validateAmount(amount sdk.Coins) error { - if !amount.IsValid() { +// validateDeposit validates the deposit amount, do not use for initial deposit. +func validateDeposit(amount sdk.Coins) error { + if !amount.IsValid() || !amount.IsAllPositive() { return sdkerrors.ErrInvalidCoins.Wrap(amount.String()) } - if !amount.IsAllPositive() { - return sdkerrors.ErrInvalidCoins.Wrap(amount.String()) - } - - return nil -} - -func validateDeposit(deposit sdk.Coins) error { - if !deposit.IsValid() { - return errors.Wrap(sdkerrors.ErrInvalidCoins, deposit.String()) - } - - if deposit.IsAnyNegative() { - return errors.Wrap(sdkerrors.ErrInvalidCoins, deposit.String()) - } - return nil } diff --git a/x/gov/migrations/v5/store.go b/x/gov/migrations/v5/store.go index cc37287f964c..f8cbec1d5a1c 100644 --- a/x/gov/migrations/v5/store.go +++ b/x/gov/migrations/v5/store.go @@ -40,6 +40,7 @@ func MigrateStore(ctx sdk.Context, storeService corestoretypes.KVStoreService, c params.ExpeditedThreshold = defaultParams.ExpeditedThreshold params.ProposalCancelRatio = defaultParams.ProposalCancelRatio params.ProposalCancelDest = defaultParams.ProposalCancelDest + params.MinDepositRatio = defaultParams.MinDepositRatio bz, err := cdc.Marshal(¶ms) if err != nil { diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 16c58a914cee..78833b37aa87 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -28,6 +28,7 @@ const ( ExpeditedThreshold = "expedited_threshold" Veto = "veto" ProposalCancelRate = "proposal_cancel_rate" + MinDepositRatio = "min_deposit_ratio" // ExpeditedThreshold must be at least as large as the regular Threshold // Therefore, we use this break out point in randomization. @@ -94,6 +95,11 @@ func GenVeto(r *rand.Rand) sdkmath.LegacyDec { return sdkmath.LegacyNewDecWithPrec(int64(simulation.RandIntBetween(r, 250, 334)), 3) } +// GenDepositMinRatio returns randomized DepositMinRatio +func GenDepositMinRatio(r *rand.Rand) sdkmath.LegacyDec { + return sdkmath.LegacyNewDec(int64(simulation.RandIntBetween(r, 1, 50))).Quo(sdkmath.LegacyNewDec(1000)) +} + // RandomizedGenState generates a random GenesisState for gov func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) @@ -131,9 +137,12 @@ func RandomizedGenState(simState *module.SimulationState) { var veto sdkmath.LegacyDec simState.AppParams.GetOrGenerate(Veto, &veto, simState.Rand, func(r *rand.Rand) { veto = GenVeto(r) }) + var minDepositRatio sdkmath.LegacyDec + simState.AppParams.GetOrGenerate(MinDepositRatio, &minDepositRatio, simState.Rand, func(r *rand.Rand) { minDepositRatio = GenDepositMinRatio(r) }) + govGenesis := v1.NewGenesisState( startingProposalID, - v1.NewParams(minDeposit, expeditedMinDeposit, depositPeriod, votingPeriod, expeditedVotingPeriod, quorum.String(), threshold.String(), expitedVotingThreshold.String(), veto.String(), minInitialDepositRatio.String(), proposalCancelRate.String(), "", simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0), + v1.NewParams(minDeposit, expeditedMinDeposit, depositPeriod, votingPeriod, expeditedVotingPeriod, quorum.String(), threshold.String(), expitedVotingThreshold.String(), veto.String(), minInitialDepositRatio.String(), proposalCancelRate.String(), "", simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String()), ) bz, err := json.MarshalIndent(&govGenesis, "", " ") diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index a5d8675b82f9..4ee8a17257bc 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -24,4 +24,5 @@ var ( ErrVotingPeriodEnded = errors.Register(ModuleName, 20, "voting period already ended") ErrInvalidProposal = errors.Register(ModuleName, 21, "invalid proposal") ErrSummaryTooLong = errors.Register(ModuleName, 22, "summary too long") + ErrInvalidDepositDenom = errors.Register(ModuleName, 23, "invalid deposit denom") ) diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 3929e47c9d79..d1d7da59acda 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -795,6 +795,12 @@ type Params struct { BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` // burn deposits if quorum with vote type no_veto is met BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` + // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + MinDepositRatio string `protobuf:"bytes,16,opt,name=min_deposit_ratio,json=minDepositRatio,proto3" json:"min_deposit_ratio,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -935,6 +941,13 @@ func (m *Params) GetBurnVoteVeto() bool { return false } +func (m *Params) GetMinDepositRatio() string { + if m != nil { + return m.MinDepositRatio + } + return "" +} + func init() { proto.RegisterEnum("cosmos.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -952,96 +965,97 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1415 bytes of a gzipped FileDescriptorProto + // 1432 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4b, 0x6f, 0xdb, 0xc6, 0x16, 0x36, 0x25, 0x59, 0x96, 0x8f, 0x1e, 0x56, 0xc6, 0x4e, 0x4c, 0x3b, 0xb1, 0xec, 0xe8, 0x06, - 0x81, 0x6f, 0x1e, 0xd2, 0x75, 0x72, 0xd3, 0x45, 0x53, 0xa0, 0x90, 0x2d, 0xa6, 0xa1, 0x91, 0x58, - 0x2a, 0xa5, 0xd8, 0x49, 0x37, 0x04, 0x6d, 0x4e, 0xe4, 0x41, 0x45, 0x8e, 0xca, 0x19, 0x29, 0xd6, - 0xbe, 0x9b, 0xee, 0xb2, 0xec, 0xaa, 0xe8, 0xb2, 0xcb, 0x2e, 0x82, 0xfe, 0x86, 0xac, 0x8a, 0x20, - 0x5d, 0xb4, 0x9b, 0xa6, 0x45, 0xb2, 0x28, 0x90, 0x5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, 0x2f, 0xae, 0xb7, 0x08, 0x3f, 0xec, 0xee, 0x97, 0x0e, - 0xa8, 0x23, 0xbf, 0x80, 0xe4, 0xbf, 0x9b, 0xcc, 0xfe, 0xb2, 0x7c, 0x24, 0xbe, 0xea, 0x78, 0xbf, - 0x83, 0x99, 0xff, 0xc9, 0x96, 0x14, 0x13, 0x70, 0xfb, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc2, - 0x33, 0x69, 0x7d, 0xf3, 0x0d, 0x00, 0x00, + 0x81, 0x6f, 0x1e, 0xd2, 0x75, 0x72, 0x73, 0x17, 0xc9, 0x05, 0x0a, 0xd9, 0x62, 0x1a, 0x1a, 0x89, + 0xa5, 0x52, 0x8a, 0x9d, 0x74, 0x43, 0xd0, 0xe6, 0x44, 0x1e, 0x54, 0xe4, 0xa8, 0x9c, 0x91, 0x63, + 0xed, 0xbb, 0xe9, 0xaa, 0x59, 0x76, 0x55, 0x74, 0xd9, 0x65, 0x17, 0x41, 0x7f, 0x43, 0x56, 0x45, + 0x90, 0x4d, 0xbb, 0x69, 0x5a, 0x24, 0x8b, 0x02, 0xf9, 0x15, 0x05, 0x87, 0x43, 0x91, 0x96, 0xd5, + 0xda, 0xce, 0xc6, 0x16, 0xcf, 0xf9, 0xbe, 0x6f, 0xce, 0x9c, 0xc7, 0x0c, 0x09, 0xf3, 0x7b, 0x94, + 0x39, 0x94, 0x55, 0x3b, 0xf4, 0xa0, 0x7a, 0xb0, 0xe6, 0xff, 0xab, 0xf4, 0x3c, 0xca, 0x29, 0xca, + 0x07, 0x8e, 0x8a, 0x6f, 0x39, 0x58, 0x5b, 0x2c, 0x49, 0xdc, 0xae, 0xc5, 0x70, 0xf5, 0x60, 0x6d, + 0x17, 0x73, 0x6b, 0xad, 0xba, 0x47, 0x89, 0x1b, 0xc0, 0x17, 0xe7, 0x3a, 0xb4, 0x43, 0xc5, 0xcf, + 0xaa, 0xff, 0x4b, 0x5a, 0x97, 0x3b, 0x94, 0x76, 0x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0x96, + 0xa9, 0xb2, 0x41, 0x89, 0xbb, 0x3e, 0xfd, 0xea, 0xed, 0xf2, 0xc4, 0x0f, 0x7f, 0xfe, 0x78, 0x4d, + 0x31, 0x24, 0xa7, 0xfc, 0x55, 0x1a, 0x32, 0x4d, 0x19, 0x04, 0x2a, 0x40, 0x62, 0x18, 0x5a, 0x82, + 0xd8, 0xe8, 0x3f, 0x90, 0x71, 0x30, 0x63, 0x56, 0x07, 0x33, 0x35, 0x21, 0xc4, 0xe7, 0x2a, 0x41, + 0x45, 0x2a, 0x61, 0x45, 0x2a, 0x35, 0x77, 0x60, 0x0c, 0x51, 0xe8, 0x0e, 0xa4, 0x19, 0xb7, 0x78, + 0x9f, 0xa9, 0x49, 0x91, 0xcc, 0xa5, 0x91, 0x64, 0x86, 0x4b, 0xb5, 0x04, 0xc8, 0x90, 0x60, 0xf4, + 0x00, 0xd0, 0x33, 0xe2, 0x5a, 0x5d, 0x93, 0x5b, 0xdd, 0xee, 0xc0, 0xf4, 0x30, 0xeb, 0x77, 0xb9, + 0x9a, 0x5a, 0x51, 0x56, 0xb3, 0xb7, 0x16, 0x47, 0x24, 0xda, 0x3e, 0xc4, 0x10, 0x08, 0xa3, 0x28, + 0x58, 0x31, 0x0b, 0xaa, 0x41, 0x96, 0xf5, 0x77, 0x1d, 0xc2, 0x4d, 0xbf, 0xcd, 0xd4, 0x49, 0x29, + 0x31, 0x1a, 0x75, 0x3b, 0xec, 0xc1, 0xf5, 0xd4, 0x8b, 0xdf, 0x97, 0x15, 0x03, 0x02, 0x92, 0x6f, + 0x46, 0x9b, 0x50, 0x94, 0xd9, 0x35, 0xb1, 0x6b, 0x07, 0x3a, 0xe9, 0x53, 0xea, 0x14, 0x24, 0x53, + 0x73, 0x6d, 0xa1, 0xa5, 0x43, 0x9e, 0x53, 0x6e, 0x75, 0x4d, 0x69, 0x57, 0xa7, 0xce, 0x50, 0xa3, + 0x9c, 0xa0, 0x86, 0x0d, 0xf4, 0x10, 0xce, 0x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 0xf4, 0xf6, 0x03, 0x73, + 0x5b, 0x6b, 0x37, 0x8a, 0xa9, 0x6b, 0x3f, 0x2b, 0x50, 0x38, 0xfa, 0x9e, 0x8a, 0x96, 0xe1, 0x62, + 0xd3, 0x68, 0x34, 0x1b, 0xad, 0xda, 0x43, 0xb3, 0xd5, 0xae, 0xb5, 0x1f, 0xb7, 0x46, 0x62, 0x2a, + 0x43, 0x69, 0x14, 0x50, 0xd7, 0x9a, 0x8d, 0x96, 0xde, 0x36, 0x9b, 0x9a, 0xa1, 0x37, 0xea, 0x45, + 0x05, 0x5d, 0x86, 0xa5, 0x51, 0xcc, 0x76, 0xa3, 0xad, 0x6f, 0x7d, 0x1a, 0x42, 0x12, 0x68, 0x11, + 0x2e, 0x8c, 0x42, 0x9a, 0xb5, 0x56, 0x4b, 0xab, 0x07, 0x41, 0x8f, 0xfa, 0x0c, 0x6d, 0x53, 0xdb, + 0x68, 0x6b, 0xf5, 0x62, 0x6a, 0x1c, 0xf3, 0x7e, 0x4d, 0x7f, 0xa8, 0xd5, 0x8b, 0x93, 0xeb, 0xda, + 0xab, 0x77, 0x25, 0xe5, 0xf5, 0xbb, 0x92, 0xf2, 0xc7, 0xbb, 0x92, 0xf2, 0xe2, 0x7d, 0x69, 0xe2, + 0xf5, 0xfb, 0xd2, 0xc4, 0xaf, 0xef, 0x4b, 0x13, 0x9f, 0x5f, 0xef, 0x10, 0xbe, 0xdf, 0xdf, 0xad, + 0xec, 0x51, 0x47, 0x7e, 0x3d, 0xc9, 0x7f, 0x37, 0x99, 0xfd, 0x45, 0xf5, 0x50, 0x7c, 0x11, 0xf2, + 0x41, 0x0f, 0x33, 0xff, 0x73, 0x2f, 0x2d, 0xa6, 0xe7, 0xf6, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x08, 0xe1, 0xbb, 0x1f, 0x2f, 0x0e, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1537,6 +1551,15 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MinDepositRatio) > 0 { + i -= len(m.MinDepositRatio) + copy(dAtA[i:], m.MinDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositRatio))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } if m.BurnVoteVeto { i-- if m.BurnVoteVeto { @@ -1967,6 +1990,10 @@ func (m *Params) Size() (n int) { if m.BurnVoteVeto { n += 2 } + l = len(m.MinDepositRatio) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } return n } @@ -3914,6 +3941,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } m.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRatio", 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.MinDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 5633ebb4c59c..a5c846773d43 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -30,6 +30,7 @@ var ( DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) DefaultBurnVoteVeto = true // set to true to replicate behavior of when this change was made (0.47) + DefaultMinDepositRatio = sdkmath.LegacyMustNewDecFromStr("0.001") ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -59,7 +60,8 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams { // NewParams creates a new Params instance with given values. func NewParams( minDeposit, expeditedminDeposit sdk.Coins, maxDepositPeriod, votingPeriod, expeditedVotingPeriod time.Duration, - quorum, threshold, expeditedThreshold, vetoThreshold, minInitialDepositRatio, proposalCancelRatio, proposalCancelDest string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, + quorum, threshold, expeditedThreshold, vetoThreshold, minInitialDepositRatio, proposalCancelRatio, proposalCancelDest string, + burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, minDepositRatio string, ) Params { return Params{ MinDeposit: minDeposit, @@ -77,6 +79,7 @@ func NewParams( BurnProposalDepositPrevote: burnProposalDeposit, BurnVoteQuorum: burnVoteQuorum, BurnVoteVeto: burnVoteVeto, + MinDepositRatio: minDepositRatio, } } @@ -98,6 +101,7 @@ func DefaultParams() Params { DefaultBurnProposalPrevote, DefaultBurnVoteQuorom, DefaultBurnVoteVeto, + DefaultMinDepositRatio.String(), ) } From 32d9be5b5ebbb2529c7de2fb8b24ea3445034513 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 17 Oct 2023 14:38:18 +0200 Subject: [PATCH 02/22] allow minDepositRatio of zero --- x/gov/keeper/deposit.go | 46 +++++++++++++++--------------- x/gov/keeper/deposit_test.go | 54 ++++++++++++++++++++++-------------- 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 1d5a6665e79f..3ce2e50af818 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -89,31 +89,33 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito return false, errors.Wrapf(types.ErrInvalidDepositDenom, "deposit contains invalid denom/s %s, accepted denoms are: %s", depositAmount.Denoms(), minDepositAmount.Denoms()) } - // and the amount must be greater than minDepositAmount*minDepositRatio. - // If the threshold is met with at least one denom, the deposit is valid. - depositThresholdMet := false - thresholds := []string{} - for _, minDep := range minDepositAmount { - // calculate the threshold for this denom, and hold a list to later return a useful error message - threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) - thresholds = append(thresholds, threshold.String()) - - found, deposit := depositAmount.Find(minDep.Denom) - if !found { // if not found, continue, as we know the deposit contains at least 1 valid denom - continue - } + // if minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio + // for at least one denom. If minDepositRatio is zero we skip this check. + if !minDepositRatio.IsZero() { + depositThresholdMet := false + thresholds := []string{} + for _, minDep := range minDepositAmount { + // calculate the threshold for this denom, and hold a list to later return a useful error message + threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) + thresholds = append(thresholds, threshold.String()) + + found, deposit := depositAmount.Find(minDep.Denom) + if !found { // if not found, continue, as we know the deposit contains at least 1 valid denom + continue + } - // once we know at least one threshold has been met, we can break. The deposit - // might contain other denoms but we don't care. - if deposit.IsGTE(threshold) { - depositThresholdMet = true - break + // once we know at least one threshold has been met, we can break. The deposit + // might contain other denoms but we don't care. + if deposit.IsGTE(threshold) { + depositThresholdMet = true + break + } } - } - // the threshold must be met with at least one denom, if not, return the list of minimum deposits - if !depositThresholdMet { - return false, errors.Wrapf(types.ErrMinDepositTooSmall, "received %s but need at least one of the following: %s", depositAmount, strings.Join(thresholds, ",")) + // the threshold must be met with at least one denom, if not, return the list of minimum deposits + if !depositThresholdMet { + return false, errors.Wrapf(types.ErrMinDepositTooSmall, "received %s but need at least one of the following: %s", depositAmount, strings.Join(thresholds, ",")) + } } // update the governance module's account coins pool diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 824c912a711f..8fe48317f812 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -163,37 +163,49 @@ func TestDeposits(t *testing.T) { func TestDepositAmount(t *testing.T) { testcases := []struct { - name string - deposit sdk.Coins - err string + name string + deposit sdk.Coins + minDepositRatio string + err string }{ { - name: "good amount and denoms", - deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)), + name: "good amount and denoms", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)), + minDepositRatio: "0.001", }, { - name: "good amount and denoms but not enough balance for zcoin", - deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("zcoin", 1)), - err: "not enough balance", + name: "good amount and denoms but not enough balance for zcoin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("zcoin", 1)), + minDepositRatio: "0.001", + err: "not enough balance", }, { - name: "too small amount", - deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), - err: "received 10stake but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + name: "too small amount", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), + minDepositRatio: "0.001", + err: "received 10stake but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", }, { - name: "too small amount with another coin", - deposit: sdk.NewCoins(sdk.NewInt64Coin("zcoin", 1)), - err: "received 1zcoin but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + name: "too small amount with another coin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("zcoin", 1)), + minDepositRatio: "0.001", + err: "received 1zcoin but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", }, { - name: "bad denom", - deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), - err: "deposit contains invalid denom/s [euro], accepted denoms are: [stake zcoin]: invalid deposit denom", + name: "bad denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), + minDepositRatio: "0.001", + err: "deposit contains invalid denom/s [euro], accepted denoms are: [stake zcoin]: invalid deposit denom", }, { - name: "mix containing bad and good denom", - deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), - err: "deposit contains invalid denom/s [euro stake], accepted denoms are: [stake zcoin]: invalid deposit denom", + name: "mix containing bad and good denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), + minDepositRatio: "0.001", + err: "deposit contains invalid denom/s [euro stake], accepted denoms are: [stake zcoin]: invalid deposit denom", + }, + { + name: "minDepositRatio is zero", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), + minDepositRatio: "0.0", }, } @@ -207,7 +219,7 @@ func TestDepositAmount(t *testing.T) { authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() params, _ := govKeeper.Params.Get(ctx) - params.MinDepositRatio = "0.001" + params.MinDepositRatio = tc.minDepositRatio params.MinDeposit = append(params.MinDeposit, sdk.NewCoin("zcoin", sdkmath.NewInt(10000))) // coins must be sorted by denom err := govKeeper.Params.Set(ctx, params) require.NoError(t, err) From b5ff28a898a23119952c3778d03b0b55fc3b5d36 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 17 Oct 2023 17:12:56 +0200 Subject: [PATCH 03/22] cl++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca90e7f67f75..01dd08c47de3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -174,6 +174,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### State Machine Breaking +* (x/gov) [#18146](https://github.com/cosmos/cosmos-sdk/pull/18146) Add denom check to reject denoms outside of those listed in `MinDeposit`. A new `MinDepositRatio` param is added (with a default value of `0.001`) and now deposits are required to be at least `MinDepositRatio*MinDeposit` to be accepted. * (x/distribution) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Migrate community pool funds from x/distribution to x/protocolpool. * (x/distribution) [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Migrate `PreviousProposer` to collections. * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. From 2f5bb4cfc1446682c74befab0c71ba91b781fadd Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 17 Oct 2023 17:17:24 +0200 Subject: [PATCH 04/22] lint --- x/gov/keeper/deposit.go | 3 +-- x/gov/keeper/deposit_test.go | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 3ce2e50af818..3da55bf54c25 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -7,7 +7,6 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/errors" - "cosmossdk.io/math" sdkmath "cosmossdk.io/math" pooltypes "cosmossdk.io/x/protocolpool/types" @@ -79,7 +78,7 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito } minDepositAmount := proposal.GetMinDepositFromParams(params) - minDepositRatio, err := math.LegacyNewDecFromStr(params.GetMinDepositRatio()) + minDepositRatio, err := sdkmath.LegacyNewDecFromStr(params.GetMinDepositRatio()) if err != nil { return false, err } diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 8fe48317f812..70acd0055922 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -172,7 +172,8 @@ func TestDepositAmount(t *testing.T) { name: "good amount and denoms", deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)), minDepositRatio: "0.001", - }, { + }, + { name: "good amount and denoms but not enough balance for zcoin", deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("zcoin", 1)), minDepositRatio: "0.001", @@ -229,8 +230,6 @@ func TestDepositAmount(t *testing.T) { require.NoError(t, err) proposalID := proposal.Id - bankKeeper.MintCoins(ctx, "mint", sdk.NewCoins(sdk.NewCoin("zcoin", sdkmath.NewInt(1000000000)))) - _, err = govKeeper.AddDeposit(ctx, proposalID, testAddrs[0], tc.deposit) if tc.err != "" { require.Error(t, err) @@ -238,7 +237,6 @@ func TestDepositAmount(t *testing.T) { } else { require.NoError(t, err) } - }) } } From 70506fac2c0db157a8e9eb5019296186cf2bd30f Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 18 Oct 2023 13:14:07 +0200 Subject: [PATCH 05/22] fix some tests --- x/gov/keeper/msg_server_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 1a79dbe59043..86065c8d9801 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -27,7 +27,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) initialDeposit := coins params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit @@ -258,7 +258,7 @@ func (suite *KeeperTestSuite) TestMsgCancelProposal() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -354,7 +354,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -497,7 +497,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { proposer := simtestutil.AddTestAddrsIncremental(suite.bankKeeper, suite.stakingKeeper, suite.ctx, 1, sdkmath.NewInt(50000000))[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -741,7 +741,7 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -820,7 +820,7 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { // legacy msg server tests func (suite *KeeperTestSuite) TestLegacyMsgSubmitProposal() { proposer := simtestutil.AddTestAddrsIncremental(suite.bankKeeper, suite.stakingKeeper, suite.ctx, 1, sdkmath.NewInt(50000000))[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) initialDeposit := coins params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit @@ -933,7 +933,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -1066,7 +1066,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -1317,7 +1317,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ From 89d493f1d2740565e65f7a1f5901218c75082627 Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:24:16 +0200 Subject: [PATCH 06/22] Update x/gov/keeper/deposit.go Co-authored-by: Aleksandr Bezobchuk --- x/gov/keeper/deposit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 3da55bf54c25..c82462b1d531 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -88,7 +88,7 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito return false, errors.Wrapf(types.ErrInvalidDepositDenom, "deposit contains invalid denom/s %s, accepted denoms are: %s", depositAmount.Denoms(), minDepositAmount.Denoms()) } - // if minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio + // If minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio // for at least one denom. If minDepositRatio is zero we skip this check. if !minDepositRatio.IsZero() { depositThresholdMet := false From 0bba6084ee8027cbc9410865b55e4e41eff763a9 Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:24:32 +0200 Subject: [PATCH 07/22] Update x/gov/keeper/deposit.go Co-authored-by: Aleksandr Bezobchuk --- x/gov/keeper/deposit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index c82462b1d531..56bd913c3410 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -85,7 +85,7 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito // the deposit must only contain valid denoms (listed in the min deposit param) if !depositAmount.DenomsSubsetOf(minDepositAmount) { - return false, errors.Wrapf(types.ErrInvalidDepositDenom, "deposit contains invalid denom/s %s, accepted denoms are: %s", depositAmount.Denoms(), minDepositAmount.Denoms()) + return false, errors.Wrapf(types.ErrInvalidDepositDenom, "deposit contains invalid denom(s): %s; accepted denom(s): %s", depositAmount.Denoms(), minDepositAmount.Denoms()) } // If minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio From 7f2f0192293a2ded7721aecfabe589ce8579b8cf Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 19 Oct 2023 11:10:21 +0200 Subject: [PATCH 08/22] fix tests --- tests/integration/bank/app_test.go | 3 ++- x/gov/simulation/operations.go | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index 3a664016d04e..efab786b3180 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -374,13 +374,14 @@ func TestMsgSetSendEnabled(t *testing.T) { ctx := s.App.BaseApp.NewContext(false) require.NoError(t, testutil.FundAccount(ctx, s.BankKeeper, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 101)))) + require.NoError(t, testutil.FundAccount(ctx, s.BankKeeper, addr1, sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)))) addr1Str := addr1.String() govAddr := s.BankKeeper.GetAuthority() goodGovProp, err := govv1.NewMsgSubmitProposal( []sdk.Msg{ types.NewMsgSetSendEnabled(govAddr, nil, nil), }, - sdk.Coins{{Denom: "foocoin", Amount: sdkmath.NewInt(5)}}, + sdk.Coins{{Denom: "stake", Amount: sdkmath.NewInt(10000)}}, addr1Str, "set default send enabled to true", "Change send enabled", diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 7ff1b470a511..02d63951b446 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -570,6 +570,13 @@ func randomDeposit( minDepositAmount := minDeposit[denomIndex].Amount + minDepositRatio, err := sdkmath.LegacyNewDecFromStr(params.GetMinDepositRatio()) + if err != nil { + return nil, false, err + } + + threshold := minDepositAmount.ToLegacyDec().Mul(minDepositRatio).TruncateInt() + minAmount := sdkmath.ZeroInt() if useMinAmount { minDepositPercent, err := sdkmath.LegacyNewDecFromStr(params.MinInitialDepositRatio) @@ -586,7 +593,7 @@ func randomDeposit( } amount = amount.Add(minAmount) - if amount.GT(spendableBalance) { + if amount.GT(spendableBalance) || amount.LT(threshold) { return nil, true, nil } From 62bc6cc8b9605598cfd2ecc99eaff2b34b268971 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 19 Oct 2023 12:07:03 +0200 Subject: [PATCH 09/22] fixed sims --- x/gov/simulation/genesis.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 78833b37aa87..68c8b5751c0e 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -95,9 +95,10 @@ func GenVeto(r *rand.Rand) sdkmath.LegacyDec { return sdkmath.LegacyNewDecWithPrec(int64(simulation.RandIntBetween(r, 250, 334)), 3) } -// GenDepositMinRatio returns randomized DepositMinRatio -func GenDepositMinRatio(r *rand.Rand) sdkmath.LegacyDec { - return sdkmath.LegacyNewDec(int64(simulation.RandIntBetween(r, 1, 50))).Quo(sdkmath.LegacyNewDec(1000)) +// GenMinDepositRatio returns randomized DepositMinRatio +func GenMinDepositRatio(r *rand.Rand) sdkmath.LegacyDec { + return sdkmath.LegacyMustNewDecFromStr("0.001") + // return sdkmath.LegacyNewDec(int64(simulation.RandIntBetween(r, 1, 50))).Quo(sdkmath.LegacyNewDec(1000)) // TODO: re-add once I figure out why it doesn't work } // RandomizedGenState generates a random GenesisState for gov @@ -138,7 +139,7 @@ func RandomizedGenState(simState *module.SimulationState) { simState.AppParams.GetOrGenerate(Veto, &veto, simState.Rand, func(r *rand.Rand) { veto = GenVeto(r) }) var minDepositRatio sdkmath.LegacyDec - simState.AppParams.GetOrGenerate(MinDepositRatio, &minDepositRatio, simState.Rand, func(r *rand.Rand) { minDepositRatio = GenDepositMinRatio(r) }) + simState.AppParams.GetOrGenerate(MinDepositRatio, &minDepositRatio, simState.Rand, func(r *rand.Rand) { minDepositRatio = GenMinDepositRatio(r) }) govGenesis := v1.NewGenesisState( startingProposalID, From 7fa8f2f1e6852b061f63131a940920d4a3477fd2 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 19 Oct 2023 13:22:31 +0200 Subject: [PATCH 10/22] figuring out issue in e2e --- testutil/cli/tx.go | 2 +- x/gov/abci_test.go | 10 +++++----- x/gov/keeper/deposit_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go index b033657a3d8d..a79ce82c6b0c 100644 --- a/testutil/cli/tx.go +++ b/testutil/cli/tx.go @@ -32,7 +32,7 @@ func CheckTxCode(network *network.Network, clientCtx client.Context, txHash stri } if response.Code != expectedCode { - return fmt.Errorf("expected code %d, got %d", expectedCode, response.Code) + return fmt.Errorf("expected code %d, got %d. Logs: %s", expectedCode, response.Code, response.Logs.String()) } return nil diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 1565e94a2b8f..26525aef679d 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -98,7 +98,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, addrs[0].String(), "", "Proposal", @@ -149,7 +149,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, addrs[0].String(), "", "Proposal", @@ -172,7 +172,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg2, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, addrs[0].String(), "", "Proposal", @@ -218,7 +218,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, addrs[0].String(), "", "Proposal", @@ -241,7 +241,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { checkInactiveProposalsQueue(t, ctx, suite.GovKeeper) - newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}) + newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}) res1, err := govMsgSvr.Deposit(ctx, newDepositMsg) require.NoError(t, err) diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 70acd0055922..355402d5d5a3 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -195,13 +195,13 @@ func TestDepositAmount(t *testing.T) { name: "bad denom", deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), minDepositRatio: "0.001", - err: "deposit contains invalid denom/s [euro], accepted denoms are: [stake zcoin]: invalid deposit denom", + err: "deposit contains invalid denom(s): [euro]; accepted denom(s): [stake zcoin]: invalid deposit denom", }, { name: "mix containing bad and good denom", deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), minDepositRatio: "0.001", - err: "deposit contains invalid denom/s [euro stake], accepted denoms are: [stake zcoin]: invalid deposit denom", + err: "deposit contains invalid denom(s): [euro stake]; accepted denom(s): [stake zcoin]: invalid deposit denom", }, { name: "minDepositRatio is zero", From 9a3d6249e646b857b399a1e01d2234dbbc399d3d Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 19 Oct 2023 13:43:43 +0200 Subject: [PATCH 11/22] update e2e --- tests/e2e/gov/tx.go | 4 ++-- testutil/cli/tx.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 524d69f28edf..d8f02c8555e3 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -59,12 +59,12 @@ func (s *E2ETestSuite) SetupSuite() { 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 + // create a proposal without deposit (fails) 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(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 16)) // create a proposal3 with deposit out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), diff --git a/testutil/cli/tx.go b/testutil/cli/tx.go index a79ce82c6b0c..b033657a3d8d 100644 --- a/testutil/cli/tx.go +++ b/testutil/cli/tx.go @@ -32,7 +32,7 @@ func CheckTxCode(network *network.Network, clientCtx client.Context, txHash stri } if response.Code != expectedCode { - return fmt.Errorf("expected code %d, got %d. Logs: %s", expectedCode, response.Code, response.Logs.String()) + return fmt.Errorf("expected code %d, got %d", expectedCode, response.Code) } return nil From cf4e7154c933af74526835d898f119dadadb585a Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 19 Oct 2023 18:15:31 +0200 Subject: [PATCH 12/22] fixed e2e --- tests/e2e/gov/deposits.go | 53 +++++++++++++++++++-------------------- tests/e2e/gov/tx.go | 17 +++++++------ 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/tests/e2e/gov/deposits.go b/tests/e2e/gov/deposits.go index 4269fba0ad2b..25b801b69e9b 100644 --- a/tests/e2e/gov/deposits.go +++ b/tests/e2e/gov/deposits.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/client/cli" @@ -72,32 +71,32 @@ func (s *DepositTestSuite) TearDownSuite() { s.network.Cleanup() } -func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { - val := s.network.Validators[0] - - // submit proposal without initial deposit - id := s.submitProposal(val, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(0)), "TestQueryDepositsWithoutInitialDeposit") - - // deposit amount - depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens.Add(math.NewInt(50))) - msg := v1.NewMsgDeposit(val.Address, id, sdk.NewCoins(depositAmount)) - _, err := clitestutil.SubmitTestTx(val.ClientCtx, msg, val.Address, clitestutil.TestTxConfig{}) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - // query deposit - proposalID := strconv.FormatUint(id, 10) - deposit := s.queryDeposit(val, proposalID, false, "") - s.Require().NotNil(deposit) - s.Require().Equal(depositAmount.String(), sdk.Coins(deposit.Deposit.Amount).String()) - - // query deposits - deposits := s.queryDeposits(val, proposalID, false, "") - s.Require().NotNil(deposits) - s.Require().Len(deposits.Deposits, 1) - // verify initial deposit - s.Require().Equal(depositAmount.String(), sdk.Coins(deposits.Deposits[0].Amount).String()) -} +// func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { +// val := s.network.Validators[0] + +// // submit proposal without initial deposit +// id := s.submitProposal(val, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000)), "TestQueryDepositsWithoutInitialDeposit") + +// // deposit amount +// depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens.Add(math.NewInt(50))) +// msg := v1.NewMsgDeposit(val.Address, id, sdk.NewCoins(depositAmount)) +// _, err := clitestutil.SubmitTestTx(val.ClientCtx, msg, val.Address, clitestutil.TestTxConfig{}) +// s.Require().NoError(err) +// s.Require().NoError(s.network.WaitForNextBlock()) + +// // query deposit +// proposalID := strconv.FormatUint(id, 10) +// deposit := s.queryDeposit(val, proposalID, false, "") +// s.Require().NotNil(deposit) +// s.Require().Equal(depositAmount.String(), sdk.Coins(deposit.Deposit.Amount).String()) + +// // query deposits +// deposits := s.queryDeposits(val, proposalID, false, "") +// s.Require().NotNil(deposits) +// s.Require().Len(deposits.Deposits, 1) +// // verify initial deposit +// s.Require().Equal(depositAmount.String(), sdk.Coins(deposits.Deposits[0].Amount).String()) +// } func (s *DepositTestSuite) TestQueryDepositsWithInitialDeposit() { val := s.network.Validators[0] diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index d8f02c8555e3..0f5e7c195dcc 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -59,12 +59,15 @@ func (s *E2ETestSuite) SetupSuite() { 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 (fails) + // create a proposal with a small deposit + minimumAcceptedDep := v1.DefaultMinDepositTokens.ToLegacyDec().Mul(v1.DefaultMinDepositRatio).Ceil().TruncateInt() out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), - "Text Proposal 2", "Where is the title!?", v1beta1.ProposalTypeText) + "Text Proposal 2", "Where is the title!?", v1beta1.ProposalTypeText, + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, minimumAcceptedDep).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, 16)) + s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, 0)) // create a proposal3 with deposit out, err = govclitestutil.MsgSubmitLegacyProposal(val.ClientCtx, val.Address.String(), @@ -127,7 +130,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() { "summary": "My awesome description", "metadata": "%s", "deposit": "%s" -}`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, math.NewInt(5431))) +}`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000))) validPropFile := testutil.WriteToNewTempFile(s.T(), validProp) defer validPropFile.Close() @@ -195,7 +198,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { "description": "Hello, World!", "type": "Text", "deposit": "%s" - }`, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(5431))) + }`, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(15431))) validPropFile := testutil.WriteToNewTempFile(s.T(), validProp) defer validPropFile.Close() @@ -221,7 +224,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { []string{ fmt.Sprintf("--%s='Where is the title!?'", cli.FlagDescription), //nolint:staticcheck // we are intentionally using a deprecated flag here. fmt.Sprintf("--%s=%s", cli.FlagProposalType, v1beta1.ProposalTypeText), //nolint:staticcheck // we are intentionally using a deprecated flag here. - fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(5431)).String()), + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10))).String()), @@ -246,7 +249,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { fmt.Sprintf("--%s='Text Proposal'", cli.FlagTitle), fmt.Sprintf("--%s='Where is the title!?'", cli.FlagDescription), //nolint:staticcheck // we are intentionally using a deprecated flag here. fmt.Sprintf("--%s=%s", cli.FlagProposalType, v1beta1.ProposalTypeText), //nolint:staticcheck // we are intentionally using a deprecated flag here. - fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(5431)).String()), + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), From cef49785345b0894aadef081cb89ee11f68d6119 Mon Sep 17 00:00:00 2001 From: Facundo Date: Fri, 20 Oct 2023 18:31:21 +0200 Subject: [PATCH 13/22] remove comment --- tests/e2e/gov/deposits.go | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tests/e2e/gov/deposits.go b/tests/e2e/gov/deposits.go index 25b801b69e9b..9a4a1b34a888 100644 --- a/tests/e2e/gov/deposits.go +++ b/tests/e2e/gov/deposits.go @@ -71,33 +71,6 @@ func (s *DepositTestSuite) TearDownSuite() { s.network.Cleanup() } -// func (s *DepositTestSuite) TestQueryDepositsWithoutInitialDeposit() { -// val := s.network.Validators[0] - -// // submit proposal without initial deposit -// id := s.submitProposal(val, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000)), "TestQueryDepositsWithoutInitialDeposit") - -// // deposit amount -// depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens.Add(math.NewInt(50))) -// msg := v1.NewMsgDeposit(val.Address, id, sdk.NewCoins(depositAmount)) -// _, err := clitestutil.SubmitTestTx(val.ClientCtx, msg, val.Address, clitestutil.TestTxConfig{}) -// s.Require().NoError(err) -// s.Require().NoError(s.network.WaitForNextBlock()) - -// // query deposit -// proposalID := strconv.FormatUint(id, 10) -// deposit := s.queryDeposit(val, proposalID, false, "") -// s.Require().NotNil(deposit) -// s.Require().Equal(depositAmount.String(), sdk.Coins(deposit.Deposit.Amount).String()) - -// // query deposits -// deposits := s.queryDeposits(val, proposalID, false, "") -// s.Require().NotNil(deposits) -// s.Require().Len(deposits.Deposits, 1) -// // verify initial deposit -// s.Require().Equal(depositAmount.String(), sdk.Coins(deposits.Deposits[0].Amount).String()) -// } - func (s *DepositTestSuite) TestQueryDepositsWithInitialDeposit() { val := s.network.Validators[0] depositAmount := sdk.NewCoin(s.cfg.BondDenom, v1.DefaultMinDepositTokens) From c5b709ae31f286c08ab206d802d346d8575f097c Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 30 Oct 2023 15:10:00 +0100 Subject: [PATCH 14/22] suggestions --- api/cosmos/gov/v1/gov.pulsar.go | 2 +- proto/cosmos/gov/v1/gov.proto | 2 +- x/gov/keeper/deposit.go | 8 +- x/gov/keeper/deposit_test.go | 2 +- x/gov/migrations/v5/store_test.go | 1 + x/gov/simulation/genesis.go | 3 +- x/gov/types/v1/gov.pb.go | 181 +++++++++++++++--------------- x/gov/types/v1/params.go | 2 +- 8 files changed, 102 insertions(+), 99 deletions(-) diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index 58a6a317a357..4623ed96dabb 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -7726,7 +7726,7 @@ type Params struct { // burn deposits if quorum with vote type no_veto is met BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. - // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // Default value: 0.01. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be // required. // // Since: cosmos-sdk 0.50 diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 4922a8315742..223d1d390cff 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -263,7 +263,7 @@ message Params { bool burn_vote_veto = 15; // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. - // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // Default value: 0.01. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be // required. // // Since: cosmos-sdk 0.50 diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 99471f56f3e1..1a05d62d1128 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -94,8 +94,10 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito // If minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio // for at least one denom. If minDepositRatio is zero we skip this check. if !minDepositRatio.IsZero() { - depositThresholdMet := false - thresholds := []string{} + var ( + depositThresholdMet bool + thresholds []string + ) for _, minDep := range minDepositAmount { // calculate the threshold for this denom, and hold a list to later return a useful error message threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) @@ -106,7 +108,7 @@ func (keeper Keeper) AddDeposit(ctx context.Context, proposalID uint64, deposito continue } - // once we know at least one threshold has been met, we can break. The deposit + // Once we know at least one threshold has been met, we can break. The deposit // might contain other denoms but we don't care. if deposit.IsGTE(threshold) { depositThresholdMet = true diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index a131e1225274..6db66e26aedf 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -221,7 +221,7 @@ func TestDepositAmount(t *testing.T) { params, _ := govKeeper.Params.Get(ctx) params.MinDepositRatio = tc.minDepositRatio - params.MinDeposit = append(params.MinDeposit, sdk.NewCoin("zcoin", sdkmath.NewInt(10000))) // coins must be sorted by denom + params.MinDeposit = sdk.NewCoins(params.MinDeposit...).Add(sdk.NewCoin("zcoin", sdkmath.NewInt(10000))) // coins must be sorted by denom err := govKeeper.Params.Set(ctx, params) require.NoError(t, err) diff --git a/x/gov/migrations/v5/store_test.go b/x/gov/migrations/v5/store_test.go index e8ee2ea89320..fbdd415591f8 100644 --- a/x/gov/migrations/v5/store_test.go +++ b/x/gov/migrations/v5/store_test.go @@ -45,6 +45,7 @@ func TestMigrateStore(t *testing.T) { require.Equal(t, v1.DefaultParams().ExpeditedMinDeposit, params.ExpeditedMinDeposit) require.Equal(t, v1.DefaultParams().ExpeditedThreshold, params.ExpeditedThreshold) require.Equal(t, v1.DefaultParams().ExpeditedVotingPeriod, params.ExpeditedVotingPeriod) + require.Equal(t, v1.DefaultParams().MinDepositRatio, params.MinDepositRatio) // Check constitution result, err := constitutionCollection.Get(ctx) diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 9a117639103e..21f2a555ebb7 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -97,8 +97,7 @@ func GenVeto(r *rand.Rand) sdkmath.LegacyDec { // GenMinDepositRatio returns randomized DepositMinRatio func GenMinDepositRatio(r *rand.Rand) sdkmath.LegacyDec { - return sdkmath.LegacyMustNewDecFromStr("0.001") - // return sdkmath.LegacyNewDec(int64(simulation.RandIntBetween(r, 1, 50))).Quo(sdkmath.LegacyNewDec(1000)) // TODO: re-add once I figure out why it doesn't work + return sdkmath.LegacyMustNewDecFromStr("0.01") } // RandomizedGenState generates a random GenesisState for gov diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 8539cb226e3f..18f78a568c80 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -796,7 +796,7 @@ type Params struct { // burn deposits if quorum with vote type no_veto is met BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. - // Default value: 0.001. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // Default value: 0.01. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be // required. // // Since: cosmos-sdk 0.50 @@ -965,95 +965,96 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x73, 0xd3, 0xc6, - 0x17, 0x8f, 0x6c, 0xc7, 0x71, 0x9e, 0x7f, 0xc4, 0x6c, 0x02, 0x51, 0x02, 0x71, 0x82, 0xbf, 0x0c, - 0x93, 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x45, 0x4a, 0x61, - 0x45, 0x4a, 0x15, 0xaf, 0x6f, 0x0e, 0x50, 0xe8, 0x36, 0x24, 0x19, 0xb7, 0x79, 0x8f, 0xe9, 0x71, - 0x91, 0xcc, 0xa5, 0x91, 0x64, 0x86, 0x4b, 0x35, 0x05, 0xc8, 0x54, 0x60, 0x74, 0x0f, 0xd0, 0x13, - 0xe2, 0xd9, 0x1d, 0x8b, 0xdb, 0x9d, 0x4e, 0xdf, 0xf2, 0x31, 0xeb, 0x75, 0xb8, 0x9e, 0x58, 0xd1, - 0x56, 0xd3, 0x37, 0x17, 0x47, 0x24, 0x5a, 0x01, 0xc4, 0x14, 0x08, 0x33, 0x2f, 0x58, 0x43, 0x16, - 0x54, 0x81, 0x34, 0xeb, 0xed, 0xba, 0x84, 0x5b, 0x41, 0x9b, 0xe9, 0x93, 0x4a, 0x62, 0x34, 0xea, - 0x56, 0xd8, 0x83, 0xeb, 0x89, 0x67, 0x7f, 0x2e, 0x6b, 0x26, 0x48, 0x52, 0x60, 0x46, 0x9b, 0x90, - 0x57, 0xd9, 0xb5, 0xb0, 0xe7, 0x48, 0x9d, 0xe4, 0x29, 0x75, 0x72, 0x8a, 0x59, 0xf3, 0x1c, 0xa1, - 0x65, 0x40, 0x96, 0x53, 0x6e, 0x77, 0x2c, 0x65, 0xd7, 0xa7, 0xce, 0x50, 0xa3, 0x8c, 0xa0, 0x86, - 0x0d, 0x74, 0x1f, 0xce, 0x1d, 0x50, 0x4e, 0xbc, 0xb6, 0xc5, 0xb8, 0xed, 0xab, 0xfd, 0xa5, 0x4e, - 0x19, 0xd7, 0x8c, 0xa4, 0x36, 0x03, 0xa6, 0x08, 0xec, 0x1e, 0x28, 0x53, 0xb4, 0xc7, 0xe9, 0x53, - 0x6a, 0x65, 0x25, 0x31, 0xdc, 0xe2, 0x62, 0xd0, 0x24, 0xdc, 0x76, 0x6c, 0x6e, 0xeb, 0x10, 0xb4, - 0xad, 0x39, 0x78, 0x47, 0x73, 0x30, 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8, 0x30, 0x0a, - 0x69, 0x54, 0x9a, 0xcd, 0x5a, 0x55, 0x06, 0x3d, 0xea, 0x33, 0x6b, 0x9b, 0xb5, 0x8d, 0x56, 0xad, - 0x9a, 0x4f, 0x8c, 0x63, 0xde, 0xad, 0x18, 0xf7, 0x6b, 0xd5, 0xfc, 0xe4, 0xfa, 0xed, 0x17, 0x6f, - 0x0a, 0xda, 0xcb, 0x37, 0x05, 0xed, 0xaf, 0x37, 0x05, 0xed, 0xd9, 0xdb, 0xc2, 0xc4, 0xcb, 0xb7, - 0x85, 0x89, 0xdf, 0xdf, 0x16, 0x26, 0xbe, 0xbc, 0x28, 0x7b, 0x88, 0x39, 0x5f, 0x95, 0x08, 0x2d, - 0x1f, 0x8a, 0x5f, 0x71, 0xbc, 0xdf, 0xc5, 0x2c, 0xf8, 0x89, 0x96, 0x14, 0x1d, 0x7f, 0xeb, 0x9f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x98, 0x2e, 0xa7, 0xe3, 0x0d, 0x00, 0x00, + // 1422 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x73, 0xd3, 0x46, + 0x1b, 0x8e, 0x6c, 0xc7, 0x71, 0x5e, 0xff, 0x88, 0xd9, 0x04, 0xa2, 0x04, 0xe2, 0x04, 0x7f, 0x0c, + 0x93, 0x8f, 0x0f, 0xec, 0x2f, 0x50, 0x7a, 0x80, 0xce, 0x74, 0x9c, 0xd8, 0x14, 0x67, 0x20, 0x76, + 0x65, 0x93, 0x40, 0x2f, 0x1a, 0x25, 0x5a, 0x9c, 0x9d, 0x5a, 0x5a, 0x57, 0xbb, 0x0e, 0xf1, 0xbd, + 0x97, 0x9e, 0xca, 0xb1, 0xa7, 0x4e, 0x8f, 0x3d, 0xf6, 0xc0, 0xf4, 0x6f, 0xe0, 0xd4, 0x61, 0xb8, + 0xb4, 0x97, 0x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b, 0xb7, 0x5f, + 0xbe, 0x2d, 0x68, 0xaf, 0xde, 0x16, 0xb4, 0x3f, 0xdf, 0x16, 0xb4, 0xe7, 0xef, 0x0a, 0x13, 0xaf, + 0xde, 0x15, 0x26, 0x7e, 0x7b, 0x57, 0x98, 0xf8, 0xe2, 0xa2, 0xac, 0x09, 0xb3, 0xbf, 0x2c, 0x11, + 0x5a, 0x3e, 0x14, 0xbf, 0x00, 0xf9, 0xa0, 0x87, 0x99, 0xff, 0xf3, 0x2e, 0x29, 0xa6, 0xe5, 0xd6, + 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xb5, 0x41, 0x36, 0x1f, 0x0e, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index a5c846773d43..658104a954bf 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -30,7 +30,7 @@ var ( DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) DefaultBurnVoteVeto = true // set to true to replicate behavior of when this change was made (0.47) - DefaultMinDepositRatio = sdkmath.LegacyMustNewDecFromStr("0.001") + DefaultMinDepositRatio = sdkmath.LegacyMustNewDecFromStr("0.01") ) // Deprecated: NewDepositParams creates a new DepositParams object From 0f10c907e37439f76246e0b0505ecf876fc7da36 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 30 Oct 2023 15:35:27 +0100 Subject: [PATCH 15/22] fix --- x/gov/keeper/deposit.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 1a05d62d1128..1e36f27440a5 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -14,8 +14,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/gov/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // SetDeposit sets a Deposit to the gov store From c7e841c6aa8898ea9472b3235fbb5494118e9f59 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 30 Oct 2023 20:07:32 +0100 Subject: [PATCH 16/22] fix all tests --- x/gov/abci_test.go | 10 +++++----- x/gov/keeper/deposit.go | 2 +- x/gov/keeper/deposit_test.go | 4 ++-- x/gov/keeper/msg_server_test.go | 28 ++++++++++++++-------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index b9773d953aea..ae98b97fe584 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -92,7 +92,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -137,7 +137,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -160,7 +160,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg2, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -200,7 +200,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -223,7 +223,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { checkInactiveProposalsQueue(t, ctx, suite.GovKeeper) - newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10000)}) + newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}) res1, err := govMsgSvr.Deposit(ctx, newDepositMsg) require.NoError(t, err) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 1e36f27440a5..c149ca560b5d 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -321,7 +321,7 @@ func (keeper Keeper) validateDepositDenom(ctx context.Context, params v1.Params, for _, coin := range depositAmount { if _, ok := acceptedDenoms[coin.Denom]; !ok { - return errors.Wrapf(types.ErrInvalidDepositDenom, "deposited %s, but gov accepts only the following denom(s): %v", coin, denoms) + return errors.Wrapf(types.ErrInvalidDepositDenom, "deposited %s, but gov accepts only the following denom(s): %v", depositAmount, denoms) } } diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 6db66e26aedf..bd5f8fa7ac3c 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -195,13 +195,13 @@ func TestDepositAmount(t *testing.T) { name: "bad denom", deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), minDepositRatio: "0.001", - err: "deposit contains invalid denom(s): [euro]; accepted denom(s): [stake zcoin]: invalid deposit denom", + err: "deposited 10000euro, but gov accepts only the following denom(s): [stake zcoin]: invalid deposit denom", }, { name: "mix containing bad and good denom", deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), minDepositRatio: "0.001", - err: "deposit contains invalid denom(s): [euro stake]; accepted denom(s): [stake zcoin]: invalid deposit denom", + err: "deposited 10000euro,10000stake, but gov accepts only the following denom(s): [stake zcoin]: invalid deposit denom", }, { name: "minDepositRatio is zero", diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 5d8f04e9a9e6..3eb34aa964e6 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -27,7 +27,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) initialDeposit := coins params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit @@ -226,7 +226,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { preRun: func() (*v1.MsgSubmitProposal, error) { return v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - append(initialDeposit, sdk.NewCoin("invalid", sdkmath.NewInt(100))), + initialDeposit.Add(sdk.NewCoin("invalid", sdkmath.NewInt(100))), proposer.String(), "", "Proposal", @@ -235,7 +235,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { ) }, expErr: true, - expErrMsg: "deposited 100invalid, but gov accepts only the following denom(s): [stake]: invalid deposit denom", + expErrMsg: "deposited 100invalid,100000stake, but gov accepts only the following denom(s): [stake]: invalid deposit denom", }, "all good": { preRun: func() (*v1.MsgSubmitProposal, error) { @@ -288,7 +288,7 @@ func (suite *KeeperTestSuite) TestMsgCancelProposal() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -384,7 +384,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -527,7 +527,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { proposer := simtestutil.AddTestAddrsIncremental(suite.bankKeeper, suite.stakingKeeper, suite.ctx, 1, sdkmath.NewInt(50000000))[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -771,9 +771,9 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) - minDeposit := params.MinDeposit + minDeposit := sdk.Coins(params.MinDeposit) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -836,9 +836,9 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { return pID }, depositor: proposer, - deposit: append(minDeposit, sdk.NewCoin("ibc/badcoin", sdkmath.NewInt(1000))), + deposit: minDeposit.Add(sdk.NewCoin("ibc/badcoin", sdkmath.NewInt(1000))), expErr: true, - expErrMsg: "deposited 1000ibc/badcoin, but gov accepts only the following denom(s): [stake]", + expErrMsg: "deposited 1000ibc/badcoin,10000000stake, but gov accepts only the following denom(s): [stake]: invalid deposit denom", }, "all good": { preRun: func() uint64 { @@ -868,7 +868,7 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { // legacy msg server tests func (suite *KeeperTestSuite) TestLegacyMsgSubmitProposal() { proposer := simtestutil.AddTestAddrsIncremental(suite.bankKeeper, suite.stakingKeeper, suite.ctx, 1, sdkmath.NewInt(50000000))[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) initialDeposit := coins params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit @@ -981,7 +981,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -1114,7 +1114,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ @@ -1365,7 +1365,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10000))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100000))) params, _ := suite.govKeeper.Params.Get(suite.ctx) minDeposit := params.MinDeposit bankMsg := &banktypes.MsgSend{ From f2cd8c3b98735ad8316c02f0f6b88bb1ef8754dc Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 30 Oct 2023 21:04:41 +0100 Subject: [PATCH 17/22] fix more tests --- tests/e2e/gov/tx.go | 4 ++-- tests/integration/bank/app_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 30eace041cf6..0d7460f78dce 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -198,7 +198,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { "description": "Hello, World!", "type": "Text", "deposit": "%s" - }`, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(15431))) + }`, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(154310))) validPropFile := testutil.WriteToNewTempFile(s.T(), validProp) defer validPropFile.Close() @@ -249,7 +249,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() { fmt.Sprintf("--%s='Text Proposal'", cli.FlagTitle), fmt.Sprintf("--%s='Where is the title!?'", cli.FlagDescription), //nolint:staticcheck // we are intentionally using a deprecated flag here. fmt.Sprintf("--%s=%s", cli.FlagProposalType, v1beta1.ProposalTypeText), //nolint:staticcheck // we are intentionally using a deprecated flag here. - fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000)).String()), + fmt.Sprintf("--%s=%s", cli.FlagDeposit, sdk.NewCoin(s.cfg.BondDenom, math.NewInt(100000)).String()), fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index d4f6909d8749..b4d62678a38d 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -381,7 +381,7 @@ func TestMsgSetSendEnabled(t *testing.T) { []sdk.Msg{ types.NewMsgSetSendEnabled(govAddr, nil, nil), }, - sdk.Coins{{Denom: "stake", Amount: sdkmath.NewInt(10000)}}, + sdk.Coins{{Denom: "stake", Amount: sdkmath.NewInt(100000)}}, addr1Str, "set default send enabled to true", "Change send enabled", From 63c003ddfd2f9467dc953c0076d220f14e7141cf Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 30 Oct 2023 21:36:14 +0100 Subject: [PATCH 18/22] fix --- tests/e2e/gov/tx.go | 2 +- tests/integration/bank/app_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/gov/tx.go b/tests/e2e/gov/tx.go index 0d7460f78dce..6bcd862168dd 100644 --- a/tests/e2e/gov/tx.go +++ b/tests/e2e/gov/tx.go @@ -130,7 +130,7 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() { "summary": "My awesome description", "metadata": "%s", "deposit": "%s" -}`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10000))) +}`, authtypes.NewModuleAddress(types.ModuleName), base64.StdEncoding.EncodeToString(propMetadata), sdk.NewCoin(s.cfg.BondDenom, math.NewInt(100000))) validPropFile := testutil.WriteToNewTempFile(s.T(), validProp) defer validPropFile.Close() diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index b4d62678a38d..58f280bf5772 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -374,7 +374,7 @@ func TestMsgSetSendEnabled(t *testing.T) { ctx := s.App.BaseApp.NewContext(false) require.NoError(t, testutil.FundAccount(ctx, s.BankKeeper, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 101)))) - require.NoError(t, testutil.FundAccount(ctx, s.BankKeeper, addr1, sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)))) + require.NoError(t, testutil.FundAccount(ctx, s.BankKeeper, addr1, sdk.NewCoins(sdk.NewInt64Coin("stake", 100000)))) addr1Str := addr1.String() govAddr := s.BankKeeper.GetAuthority() goodGovProp, err := govv1.NewMsgSubmitProposal( From e4b06f9b4d88a86e60c1d9cd895a4dfde9d9003b Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:19:07 +0100 Subject: [PATCH 19/22] Update proto/cosmos/gov/v1/gov.proto Co-authored-by: Julien Robert --- proto/cosmos/gov/v1/gov.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 223d1d390cff..8ab849500d00 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -263,7 +263,7 @@ message Params { bool burn_vote_veto = 15; // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. - // Default value: 0.01. Meaning that for a chain with a min_deposit of 1000stake, a deposit of 1stake would be + // Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be // required. // // Since: cosmos-sdk 0.50 From 8f3d1b557d2697d3bdf15fa7e24389a88f7028f9 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 31 Oct 2023 10:34:58 +0100 Subject: [PATCH 20/22] fix sims with a hack --- x/gov/simulation/operations.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 9519c170c373..9c8dd13d5b49 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -592,6 +592,7 @@ func randomDeposit( return nil, false, err } amount = amount.Add(minAmount) + amount = amount.MulRaw(3) // 3x what's required // TODO: this is a hack, we need to be able to calculate the correct amount using params if amount.GT(spendableBalance) || amount.LT(threshold) { return nil, true, nil From cbb97e6a2aefdfa6dfd6ae05b6787fa8f51942ca Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 31 Oct 2023 17:00:16 +0100 Subject: [PATCH 21/22] fix sim ops tests --- Makefile | 2 +- x/gov/simulation/operations_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b5c18dd21632..0deb77758a98 100644 --- a/Makefile +++ b/Makefile @@ -250,7 +250,7 @@ endif test-sim-nondeterminism: @echo "Running non-determinism test..." @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestAppStateDeterminism -Enabled=true \ - -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h + -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -Seed=6425865534782297734 # Requires an exported plugin. See store/streaming/README.md for documentation. # diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index 0cee14b7fe2f..7cf6c935c767 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -152,7 +152,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "47841094stake", msg.InitialDeposit[0].String()) + require.Equal(t, "143523282stake", msg.InitialDeposit[0].String()) require.Equal(t, simulation.TypeMsgSubmitProposal, sdk.MsgTypeURL(&msg)) } @@ -185,7 +185,7 @@ func TestSimulateMsgSubmitLegacyProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "25166256stake", msg.InitialDeposit[0].String()) + require.Equal(t, "75498768stake", msg.InitialDeposit[0].String()) require.Equal(t, "title-3: ZBSpYuLyYggwexjxusrBqDOTtGTOWeLrQKjLxzIivHSlcxgdXhhuTSkuxKGLwQvuyNhYFmBZHeAerqyNEUzXPFGkqEGqiQWIXnku", textProposal.GetTitle()) require.Equal(t, "description-3: NJWzHdBNpAXKJPHWQdrGYcAHSctgVlqwqHoLfHsXUdStwfefwzqLuKEhmMyYLdbZrcPgYqjNHxPex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aCkmPdambLHvGhTZzysvqFauEgkFRItPfvisehFmoBhQqmkfbHVsgfHXDPJVyhwPllQpuYLRYvGodxKjkarnSNgsXoKEMlaSKxKdcVgvOkuLcfLFfdtXGTclqfPOfeoVLbqcjcXCUEBgAGplrkgsmIEhWRZLlGPGCwKWRaCKMkBHTAcypUrYjWwCLtOPVygMwMANGoQwFnCqFrUGMCRZUGJKTZIGPyldsifauoMnJPLTcDHmilcmahlqOELaAUYDBuzsVywnDQfwRLGIWozYaOAilMBcObErwgTDNGWnwQMUgFFSKtPDMEoEQCTKVREqrXZSGLqwTMcxHfWotDllNkIJPMbXzjDVjPOOjCFuIvTyhXKLyhUScOXvYthRXpPfKwMhptXaxIxgqBoUqzrWbaoLTVpQoottZyPFfNOoMioXHRuFwMRYUiKvcWPkrayyTLOCFJlAyslDameIuqVAuxErqFPEWIScKpBORIuZqoXlZuTvAjEdlEWDODFRregDTqGNoFBIHxvimmIZwLfFyKUfEWAnNBdtdzDmTPXtpHRGdIbuucfTjOygZsTxPjfweXhSUkMhPjMaxKlMIJMOXcnQfyzeOcbWwNbeH", @@ -276,7 +276,7 @@ func TestSimulateMsgDeposit(t *testing.T) { require.Equal(t, uint64(1), msg.ProposalId) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Depositor) require.NotEqual(t, len(msg.Amount), 0) - require.Equal(t, "560969stake", msg.Amount[0].String()) + require.Equal(t, "1682907stake", msg.Amount[0].String()) require.Equal(t, simulation.TypeMsgDeposit, sdk.MsgTypeURL(&msg)) } From d2d05e64a3bcb5ddda1d415e646386c5c3dacc52 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 2 Nov 2023 10:00:01 +0100 Subject: [PATCH 22/22] remove testing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0deb77758a98..b5c18dd21632 100644 --- a/Makefile +++ b/Makefile @@ -250,7 +250,7 @@ endif test-sim-nondeterminism: @echo "Running non-determinism test..." @cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestAppStateDeterminism -Enabled=true \ - -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h -Seed=6425865534782297734 + -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h # Requires an exported plugin. See store/streaming/README.md for documentation. #