diff --git a/docs/swagger.yml b/docs/swagger.yml index 63be8fb0..14b161cd 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -4518,6 +4518,17 @@ paths: type: string format: uint64 description: Minimum amount of tokens that can be funded per bundle. + min_funding_multiple: + type: string + format: uint64 + description: >- + Minimum ratio between the funded amount and the + amount_per_bundle. + + In other words this param ensures, that a funder provides + at least funding for + + `min_funding_multiple` bundles. description: QueryParamsResponse ... default: description: An unexpected error response. diff --git a/proto/kyve/funders/v1beta1/events.proto b/proto/kyve/funders/v1beta1/events.proto index 86e0feaf..a41f62d6 100644 --- a/proto/kyve/funders/v1beta1/events.proto +++ b/proto/kyve/funders/v1beta1/events.proto @@ -2,11 +2,22 @@ syntax = "proto3"; package kyve.funders.v1beta1; -//import "gogoproto/gogo.proto"; -//import "kyve/funders/v1beta1/params.proto"; +import "gogoproto/gogo.proto"; +import "kyve/funders/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/funders/types"; +// EventUpdateParams is an event emitted when the module parameters are updated. +// emitted_by: MsgUpdateParams +message EventUpdateParams { + // old_params is the module's old parameters. + Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} + // EventCreateFunder is an event emitted when a funder is created. // emitted_by: MsgCreateFunder message EventCreateFunder { diff --git a/proto/kyve/funders/v1beta1/params.proto b/proto/kyve/funders/v1beta1/params.proto index eb8a1b4d..df0acccc 100644 --- a/proto/kyve/funders/v1beta1/params.proto +++ b/proto/kyve/funders/v1beta1/params.proto @@ -10,4 +10,8 @@ message Params { uint64 min_funding_amount = 1; // Minimum amount of tokens that can be funded per bundle. uint64 min_funding_amount_per_bundle = 2; + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + uint64 min_funding_multiple = 3; } diff --git a/proto/kyve/funders/v1beta1/tx.proto b/proto/kyve/funders/v1beta1/tx.proto index 7539a9ee..98baf0a9 100644 --- a/proto/kyve/funders/v1beta1/tx.proto +++ b/proto/kyve/funders/v1beta1/tx.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kyve.funders.v1beta1; +import "cosmos_proto/cosmos.proto"; + option go_package = "github.com/KYVENetwork/chain/x/funders/types"; // Msg defines the Msg service. @@ -14,6 +16,10 @@ service Msg { rpc FundPool(MsgFundPool) returns (MsgFundPoolResponse); // DefundPool ... rpc DefundPool(MsgDefundPool) returns (MsgDefundPoolResponse); + + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateFunder defines a SDK message for creating a funder. @@ -81,3 +87,15 @@ message MsgDefundPool { // MsgDefundPoolResponse defines the Msg/DefundPool response type. message MsgDefundPoolResponse {} + +// MsgUpdateParams defines a SDK message for updating the module parameters. +message MsgUpdateParams { + // authority is the address of the governance account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // payload defines the x/delegation parameters to update. + string payload = 2; +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/x/funders/keeper/msg_server_update_params.go b/x/funders/keeper/msg_server_update_params.go new file mode 100644 index 00000000..0872cc62 --- /dev/null +++ b/x/funders/keeper/msg_server_update_params.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "context" + "encoding/json" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + // Delegation + "github.com/KYVENetwork/chain/x/funders/types" + // Gov + govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + oldParams := k.GetParams(ctx) + + newParams := oldParams + _ = json.Unmarshal([]byte(msg.Payload), &newParams) + k.SetParams(ctx, newParams) + + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ + OldParams: oldParams, + NewParams: newParams, + Payload: msg.Payload, + }) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/funders/keeper/msg_server_update_params_test.go b/x/funders/keeper/msg_server_update_params_test.go new file mode 100644 index 00000000..c60aaccc --- /dev/null +++ b/x/funders/keeper/msg_server_update_params_test.go @@ -0,0 +1,409 @@ +package keeper_test + +import ( + i "github.com/KYVENetwork/chain/testutil/integration" + sdk "github.com/cosmos/cosmos-sdk/types" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + // Delegation + "github.com/KYVENetwork/chain/x/funders/types" + // Gov + govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +/* + +TEST CASES - msg_server_update_params.go + +* Check default params +* Invalid authority (transaction) +* Invalid authority (proposal) +* Update every param at once +* Update no param +* Update with invalid formatted payload + +* Update min-funding-amount +* Update min-funding-amount with invalid value + +* Update min-funding-amount-per-bundle +* Update min-funding-amount-per-bundle with invalid value + +* Update min-funding-multiple +* Update min-funding-multiple with invalid value + +*/ + +var _ = Describe("msg_server_update_params.go", Ordered, func() { + s := i.NewCleanChain() + + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + + minDeposit := s.App().GovKeeper.GetParams(s.Ctx()).MinDeposit + votingPeriod := s.App().GovKeeper.GetParams(s.Ctx()).VotingPeriod + + delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) + voter := sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) + + BeforeEach(func() { + s = i.NewCleanChain() + + delegations := s.App().StakingKeeper.GetAllDelegations(s.Ctx()) + voter = sdk.MustAccAddressFromBech32(delegations[0].DelegatorAddress) + }) + + AfterEach(func() { + s.PerformValidityChecks() + }) + + It("Check default params", func() { + // ASSERT + params := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(params.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(params.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(params.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Invalid authority (transaction)", func() { + // ARRANGE + msg := &types.MsgUpdateParams{ + Authority: i.DUMMY[0], + Payload: "{}", + } + + // ACT + _, err := s.RunTx(msg) + + // ASSERT + Expect(err).To(HaveOccurred()) + }) + + It("Invalid authority (proposal)", func() { + // ARRANGE + msg := &types.MsgUpdateParams{ + Authority: i.DUMMY[0], + Payload: "{}", + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, err := s.RunTx(proposal) + + // ASSERT + Expect(err).To(HaveOccurred()) + }) + + It("Update every param at once", func() { + // ARRANGE + payload := `{ + "min_funding_amount": 2000000000, + "min_funding_amount_per_bundle": 500000, + "min_funding_multiple": 25 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(uint64(2_000_000_000))) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(uint64(500_000))) + Expect(updatedParams.MinFundingMultiple).To(Equal(uint64(25))) + }) + + It("Update no param", func() { + // ARRANGE + payload := `{}` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update with invalid formatted payload", func() { + // ARRANGE + payload := `{ + "min_funding_amount": abc, + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount", func() { + // ARRANGE + payload := `{ + "min_funding_amount": 100000000 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(uint64(100_000_000))) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount with invalid value", func() { + // ARRANGE + payload := `{ + "min_funding_amount": "invalid" + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("min-funding-amount-per-bundle", func() { + // ARRANGE + payload := `{ + "min_funding_amount_per_bundle": 300000 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(uint64(300000))) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-amount-per-bundle", func() { + // ARRANGE + payload := `{ + "min_funding_amount_per_bundle": "invalid" + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) + + It("Update min-funding-multiple", func() { + // ARRANGE + payload := `{ + "min_funding_multiple": 9 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + vote := govV1Types.NewMsgVote( + voter, 1, govV1Types.VoteOption_VOTE_OPTION_YES, "", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + _, voteErr := s.RunTx(vote) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).NotTo(HaveOccurred()) + Expect(voteErr).NotTo(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(uint64(9))) + }) + + It("Update min-funding-multiple with invalid value", func() { + // ARRANGE + payload := `{ + "min_funding_multiple": -1 + }` + + msg := &types.MsgUpdateParams{ + Authority: gov, + Payload: payload, + } + + proposal, _ := govV1Types.NewMsgSubmitProposal( + []sdk.Msg{msg}, minDeposit, i.DUMMY[0], "", "title", "summary", + ) + + // ACT + _, submitErr := s.RunTx(proposal) + + s.CommitAfter(*votingPeriod) + s.Commit() + + // ASSERT + updatedParams := s.App().FundersKeeper.GetParams(s.Ctx()) + + Expect(submitErr).To(HaveOccurred()) + + Expect(updatedParams.MinFundingAmount).To(Equal(types.DefaultMinFundingAmount)) + Expect(updatedParams.MinFundingAmountPerBundle).To(Equal(types.DefaultMinFundingAmountPerBundle)) + Expect(updatedParams.MinFundingMultiple).To(Equal(types.DefaultMinFundingMultiple)) + }) +}) diff --git a/x/funders/types/events.pb.go b/x/funders/types/events.pb.go index a67955ab..d88c886d 100644 --- a/x/funders/types/events.pb.go +++ b/x/funders/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -22,6 +23,71 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// EventUpdateParams is an event emitted when the module parameters are updated. +// emitted_by: MsgUpdateParams +type EventUpdateParams struct { + // old_params is the module's old parameters. + OldParams Params `protobuf:"bytes,1,opt,name=old_params,json=oldParams,proto3" json:"old_params"` + // new_params is the module's new parameters. + NewParams Params `protobuf:"bytes,2,opt,name=new_params,json=newParams,proto3" json:"new_params"` + // payload is the parameter updates that were performed. + Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *EventUpdateParams) Reset() { *m = EventUpdateParams{} } +func (m *EventUpdateParams) String() string { return proto.CompactTextString(m) } +func (*EventUpdateParams) ProtoMessage() {} +func (*EventUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_1cf957abd56bbcb0, []int{0} +} +func (m *EventUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateParams.Merge(m, src) +} +func (m *EventUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *EventUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_EventUpdateParams proto.InternalMessageInfo + +func (m *EventUpdateParams) GetOldParams() Params { + if m != nil { + return m.OldParams + } + return Params{} +} + +func (m *EventUpdateParams) GetNewParams() Params { + if m != nil { + return m.NewParams + } + return Params{} +} + +func (m *EventUpdateParams) GetPayload() string { + if m != nil { + return m.Payload + } + return "" +} + // EventCreateFunder is an event emitted when a funder is created. // emitted_by: MsgCreateFunder type EventCreateFunder struct { @@ -43,7 +109,7 @@ func (m *EventCreateFunder) Reset() { *m = EventCreateFunder{} } func (m *EventCreateFunder) String() string { return proto.CompactTextString(m) } func (*EventCreateFunder) ProtoMessage() {} func (*EventCreateFunder) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{0} + return fileDescriptor_1cf957abd56bbcb0, []int{1} } func (m *EventCreateFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -135,7 +201,7 @@ func (m *EventUpdateFunder) Reset() { *m = EventUpdateFunder{} } func (m *EventUpdateFunder) String() string { return proto.CompactTextString(m) } func (*EventUpdateFunder) ProtoMessage() {} func (*EventUpdateFunder) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{1} + return fileDescriptor_1cf957abd56bbcb0, []int{2} } func (m *EventUpdateFunder) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,7 +289,7 @@ func (m *EventFundPool) Reset() { *m = EventFundPool{} } func (m *EventFundPool) String() string { return proto.CompactTextString(m) } func (*EventFundPool) ProtoMessage() {} func (*EventFundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{2} + return fileDescriptor_1cf957abd56bbcb0, []int{3} } func (m *EventFundPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -295,7 +361,7 @@ func (m *EventDefundPool) Reset() { *m = EventDefundPool{} } func (m *EventDefundPool) String() string { return proto.CompactTextString(m) } func (*EventDefundPool) ProtoMessage() {} func (*EventDefundPool) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{3} + return fileDescriptor_1cf957abd56bbcb0, []int{4} } func (m *EventDefundPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -356,7 +422,7 @@ func (m *EventPoolOutOfFunds) Reset() { *m = EventPoolOutOfFunds{} } func (m *EventPoolOutOfFunds) String() string { return proto.CompactTextString(m) } func (*EventPoolOutOfFunds) ProtoMessage() {} func (*EventPoolOutOfFunds) Descriptor() ([]byte, []int) { - return fileDescriptor_1cf957abd56bbcb0, []int{4} + return fileDescriptor_1cf957abd56bbcb0, []int{5} } func (m *EventPoolOutOfFunds) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -393,6 +459,7 @@ func (m *EventPoolOutOfFunds) GetPoolId() uint64 { } func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.funders.v1beta1.EventUpdateParams") proto.RegisterType((*EventCreateFunder)(nil), "kyve.funders.v1beta1.EventCreateFunder") proto.RegisterType((*EventUpdateFunder)(nil), "kyve.funders.v1beta1.EventUpdateFunder") proto.RegisterType((*EventFundPool)(nil), "kyve.funders.v1beta1.EventFundPool") @@ -403,31 +470,86 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/events.proto", fileDescriptor_1cf957abd56bbcb0) } var fileDescriptor_1cf957abd56bbcb0 = []byte{ - // 373 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x92, 0xc1, 0x4a, 0xe3, 0x40, - 0x18, 0xc7, 0x9b, 0x6e, 0x36, 0xdd, 0x9d, 0x65, 0x29, 0xcd, 0x2e, 0xbb, 0x61, 0x0f, 0xa1, 0xdb, - 0xd3, 0xb2, 0x48, 0x42, 0xf1, 0x0d, 0xaa, 0x2d, 0x88, 0x60, 0x4b, 0x40, 0x41, 0x11, 0x4a, 0x92, - 0xf9, 0x6a, 0x87, 0xb6, 0x33, 0x61, 0xe6, 0x4b, 0x6b, 0x5f, 0xc0, 0xb3, 0xaf, 0xe3, 0x1b, 0x78, - 0xec, 0xd1, 0xa3, 0xb4, 0x2f, 0x22, 0x33, 0x89, 0xb5, 0x1e, 0xbc, 0x79, 0xf1, 0x96, 0xff, 0xfc, - 0xfe, 0x33, 0xf9, 0x7d, 0xf0, 0x91, 0xbf, 0x93, 0xe5, 0x1c, 0xc2, 0x51, 0xce, 0x29, 0x48, 0x15, - 0xce, 0xdb, 0x09, 0x60, 0xdc, 0x0e, 0x61, 0x0e, 0x1c, 0x55, 0x90, 0x49, 0x81, 0xc2, 0xfd, 0xa9, - 0x2b, 0x41, 0x59, 0x09, 0xca, 0x4a, 0xeb, 0xce, 0x22, 0x8d, 0xae, 0xae, 0x1d, 0x48, 0x88, 0x11, - 0x7a, 0x06, 0xbb, 0x1e, 0xa9, 0xc5, 0x94, 0x4a, 0x50, 0xca, 0xb3, 0x9a,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0xe5, 0x61, 0xe3, 0x57, 0x2e, 0xf6, 0xae, 0x18, 0x8e, 0xf3, 0x24, 0x48, 0xc5, 0x2c, 0x3c, 0x3e, - 0x3f, 0xeb, 0x9e, 0x00, 0x2e, 0x84, 0x9c, 0x84, 0xe9, 0x38, 0x66, 0x3c, 0xbc, 0xde, 0xee, 0x3e, - 0x2e, 0x33, 0x50, 0x89, 0x63, 0x76, 0x7e, 0xff, 0x29, 0x00, 0x00, 0xff, 0xff, 0x41, 0xe2, 0x8e, - 0xb0, 0x18, 0x03, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0x4f, 0x6b, 0xd4, 0x40, + 0x18, 0xc6, 0x37, 0x35, 0x6e, 0xdd, 0x29, 0x52, 0x1a, 0x8b, 0x86, 0x45, 0xe2, 0xba, 0xa7, 0x22, + 0x92, 0x50, 0xfd, 0x04, 0xae, 0xb6, 0x20, 0x82, 0x5d, 0x02, 0x0a, 0x8a, 0xb0, 0x4c, 0x32, 0xef, + 0x6e, 0x87, 0xcd, 0xce, 0x1b, 0x26, 0x93, 0x5d, 0xf3, 0x05, 0x3c, 0xfb, 0x5d, 0x3c, 0xf9, 0x0d, + 0x7a, 0xec, 0xd1, 0x93, 0xc8, 0xee, 0x17, 0x91, 0xf9, 0x93, 0xb6, 0x42, 0x05, 0x0f, 0x5e, 0x7a, + 0xcb, 0x33, 0xcf, 0x33, 0xcf, 0xfb, 0x7b, 0x03, 0x43, 0x1e, 0xcf, 0x9b, 0x25, 0x24, 0xd3, 0x5a, + 0x30, 0x90, 0x55, 0xb2, 0x3c, 0xcc, 0x40, 0xd1, 0xc3, 0x04, 0x96, 0x20, 0x54, 0x15, 0x97, 0x12, + 0x15, 0x06, 0xfb, 0x3a, 0x12, 0xbb, 0x48, 0xec, 0x22, 0xfd, 0xfd, 0x19, 0xce, 0xd0, 0x04, 0x12, + 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1, 0x98, 0x70, 0x66, 0xb8, 0xfd, 0xb4, 0xab, 0xe5, 0x6b, + 0x76, 0x75, 0xa1, 0xad, 0x3f, 0x17, 0xba, 0x4f, 0xba, 0x74, 0x81, 0xb5, 0x50, 0x06, 0xda, 0x4f, + 0x9d, 0x0a, 0x9e, 0x90, 0x3d, 0xfb, 0x35, 0x29, 0x41, 0x4e, 0xb2, 0x5a, 0xb0, 0xc2, 0xc2, 0xfb, + 0xe9, 0xae, 0x35, 0xc6, 0x20, 0x47, 0xe6, 0x78, 0xf8, 0x89, 0xec, 0x1a, 0x8e, 0x57, 0x30, 0xfd, + 0xff, 0x24, 0xc3, 0x98, 0xdc, 0x33, 0xed, 0xba, 0xf7, 0xa4, 0x56, 0x27, 0x53, 0xbd, 0x6e, 0xf5, + 0xd7, 0x09, 0xa3, 0xe3, 0xb3, 0x75, 0xe4, 0x9d, 0xaf, 0x23, 0xef, 0xd7, 0x3a, 0xf2, 0xbe, 0x6e, + 0xa2, 0xce, 0xf9, 0x26, 0xea, 0xfc, 0xd8, 0x44, 0x9d, 0x8f, 0x4f, 0x67, 0x5c, 0x9d, 0xd6, 0x59, + 0x9c, 0xe3, 0x22, 0x79, 0xf3, 0xe1, 0xfd, 0xd1, 0x5b, 0x50, 0x2b, 0x94, 0xf3, 0x24, 0x3f, 0xa5, + 0x5c, 0x24, 0x9f, 0x2f, 0xde, 0xa6, 0x6a, 0x4a, 0xa8, 0xb2, 0xae, 0x79, 0x93, 0xcf, 0x7f, 0x07, + 0x00, 0x00, 0xff, 0xff, 0xfe, 0x83, 0x31, 0xec, 0x07, 0x04, 0x00, 0x00, +} + +func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.NewParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.OldParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *EventCreateFunder) Marshal() (dAtA []byte, err error) { @@ -684,6 +806,23 @@ func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *EventUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OldParams.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.NewParams.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func (m *EventCreateFunder) Size() (n int) { if m == nil { return 0 @@ -809,6 +948,154 @@ func sovEvents(x uint64) (n int) { func sozEvents(x uint64) (n int) { return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *EventUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OldParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NewParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *EventCreateFunder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/funders/types/msgs.go b/x/funders/types/msgs.go new file mode 100644 index 00000000..77d512f0 --- /dev/null +++ b/x/funders/types/msgs.go @@ -0,0 +1,33 @@ +package types + +import ( + "cosmossdk.io/errors" + "encoding/json" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrap(err, "invalid authority address") + } + + params := DefaultParams() + if err := json.Unmarshal([]byte(msg.Payload), ¶ms); err != nil { + return err + } + + if err := params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/funders/types/params.go b/x/funders/types/params.go index 0a9047f1..c87c8599 100644 --- a/x/funders/types/params.go +++ b/x/funders/types/params.go @@ -7,15 +7,18 @@ import ( const ( // DefaultMinFundingAmount 1000 Kyve DefaultMinFundingAmount = uint64(1_000_000_000) - // DefaultMinFundingAmountPerBundle 1 Kyve - DefaultMinFundingAmountPerBundle = uint64(1_000_000) + // DefaultMinFundingAmountPerBundle 0.1 Kyve + DefaultMinFundingAmountPerBundle = uint64(100_000) + // DefaultMinFundingMultiple 20 + DefaultMinFundingMultiple = uint64(20) ) // NewParams creates a new Params instance -func NewParams(minFundingAmount uint64, minFundingAmountPerBundle uint64) Params { +func NewParams(minFundingAmount uint64, minFundingAmountPerBundle uint64, minFundingMultiple uint64) Params { return Params{ MinFundingAmount: minFundingAmount, MinFundingAmountPerBundle: minFundingAmountPerBundle, + MinFundingMultiple: minFundingMultiple, } } @@ -24,6 +27,7 @@ func DefaultParams() Params { return NewParams( DefaultMinFundingAmount, DefaultMinFundingAmountPerBundle, + DefaultMinFundingMultiple, ) } @@ -37,5 +41,9 @@ func (p *Params) Validate() error { return err } + if err := util.ValidateNumber(p.MinFundingAmountPerBundle); err != nil { + return err + } + return nil } diff --git a/x/funders/types/params.pb.go b/x/funders/types/params.pb.go index 89c13171..adf8da11 100644 --- a/x/funders/types/params.pb.go +++ b/x/funders/types/params.pb.go @@ -28,6 +28,10 @@ type Params struct { MinFundingAmount uint64 `protobuf:"varint,1,opt,name=min_funding_amount,json=minFundingAmount,proto3" json:"min_funding_amount,omitempty"` // Minimum amount of tokens that can be funded per bundle. MinFundingAmountPerBundle uint64 `protobuf:"varint,2,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + MinFundingMultiple uint64 `protobuf:"varint,3,opt,name=min_funding_multiple,json=minFundingMultiple,proto3" json:"min_funding_multiple,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -77,6 +81,13 @@ func (m *Params) GetMinFundingAmountPerBundle() uint64 { return 0 } +func (m *Params) GetMinFundingMultiple() uint64 { + if m != nil { + return m.MinFundingMultiple + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "kyve.funders.v1beta1.Params") } @@ -84,21 +95,23 @@ func init() { func init() { proto.RegisterFile("kyve/funders/v1beta1/params.proto", fileDescriptor_906a9a55094dc984) } var fileDescriptor_906a9a55094dc984 = []byte{ - // 215 bytes of a gzipped FileDescriptorProto + // 241 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, - 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0xaa, 0xe0, 0x62, 0x0b, 0x00, 0xab, 0x12, 0xd2, - 0xe1, 0x12, 0xca, 0xcd, 0xcc, 0x8b, 0x07, 0x29, 0xc8, 0xcc, 0x4b, 0x8f, 0x4f, 0xcc, 0xcd, 0x2f, - 0xcd, 0x2b, 0x91, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x09, 0x12, 0xc8, 0xcd, 0xcc, 0x73, 0x83, 0x48, - 0x38, 0x82, 0xc5, 0x85, 0x1c, 0xb8, 0x64, 0x31, 0x55, 0xc7, 0x17, 0xa4, 0x16, 0xc5, 0x27, 0x95, - 0xe6, 0xa5, 0xe4, 0xa4, 0x4a, 0x30, 0x81, 0x35, 0x4a, 0xa2, 0x6b, 0x0c, 0x48, 0x2d, 0x72, 0x02, - 0x2b, 0x70, 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0x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, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xbd, 0x23, 0xc3, 0x5c, 0xfd, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0x2b, 0xe0, 0x21, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0x0e, 0x11, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb6, 0xfa, 0xe0, 0x36, 0x01, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -121,6 +134,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinFundingMultiple != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingMultiple)) + i-- + dAtA[i] = 0x18 + } if m.MinFundingAmountPerBundle != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmountPerBundle)) i-- @@ -157,6 +175,9 @@ func (m *Params) Size() (n int) { if m.MinFundingAmountPerBundle != 0 { n += 1 + sovParams(uint64(m.MinFundingAmountPerBundle)) } + if m.MinFundingMultiple != 0 { + n += 1 + sovParams(uint64(m.MinFundingMultiple)) + } return n } @@ -233,6 +254,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingMultiple", wireType) + } + m.MinFundingMultiple = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingMultiple |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/funders/types/tx.pb.go b/x/funders/types/tx.pb.go index 779d0930..93061955 100644 --- a/x/funders/types/tx.pb.go +++ b/x/funders/types/tx.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -494,6 +495,98 @@ func (m *MsgDefundPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDefundPoolResponse proto.InternalMessageInfo +// MsgUpdateParams defines a SDK message for updating the module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // payload defines the x/delegation parameters to update. + Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{8} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetPayload() string { + if m != nil { + return m.Payload + } + return "" +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5145d80c2db97f3d, []int{9} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateFunder)(nil), "kyve.funders.v1beta1.MsgCreateFunder") proto.RegisterType((*MsgCreateFunderResponse)(nil), "kyve.funders.v1beta1.MsgCreateFunderResponse") @@ -503,41 +596,49 @@ func init() { proto.RegisterType((*MsgFundPoolResponse)(nil), "kyve.funders.v1beta1.MsgFundPoolResponse") proto.RegisterType((*MsgDefundPool)(nil), "kyve.funders.v1beta1.MsgDefundPool") proto.RegisterType((*MsgDefundPoolResponse)(nil), "kyve.funders.v1beta1.MsgDefundPoolResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "kyve.funders.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "kyve.funders.v1beta1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("kyve/funders/v1beta1/tx.proto", fileDescriptor_5145d80c2db97f3d) } var fileDescriptor_5145d80c2db97f3d = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x49, 0x48, 0xcb, 0x14, 0x54, 0xb1, 0x50, 0x62, 0x22, 0x61, 0x95, 0x20, 0x24, 0x3e, - 0x6d, 0x15, 0xfe, 0x41, 0x81, 0x4a, 0x08, 0x19, 0x55, 0x96, 0x40, 0xd0, 0x03, 0x91, 0xed, 0x9d, - 0xba, 0xab, 0x24, 0xbb, 0xd6, 0xee, 0xba, 0x6d, 0xee, 0xdc, 0xb8, 0xf0, 0x6f, 0xf8, 0x0b, 0x1c, - 0x7b, 0xe4, 0x88, 0x92, 0x3f, 0x82, 0xbc, 0xfe, 0xc0, 0xa9, 0x9a, 0xd2, 0x03, 0x97, 0xde, 0xfc, - 0xf6, 0xbd, 0x99, 0x37, 0x4f, 0x33, 0x32, 0xdc, 0x1b, 0x4d, 0x0f, 0xd1, 0xdb, 0xcf, 0x38, 0x45, - 0xa9, 0xbc, 0xc3, 0xad, 0x08, 0x75, 0xb8, 0xe5, 0xe9, 0x63, 0x37, 0x95, 0x42, 0x0b, 0x72, 0x3b, - 0xa7, 0xdd, 0x92, 0x76, 0x4b, 0x7a, 0xf0, 0xc3, 0x82, 0x75, 0x5f, 0x25, 0xaf, 0x24, 0x86, 0x1a, - 0x77, 0x0c, 0x49, 0x6c, 0x58, 0x89, 0x73, 0x2c, 0xa4, 0x6d, 0x6d, 0x5a, 0x8f, 0xae, 0x05, 0x15, - 0xcc, 0x99, 0x89, 0xe0, 0x6c, 0x84, 0xd2, 0xbe, 0x52, 0x30, 0x25, 0x24, 0x7d, 0x58, 0x65, 0x14, - 0xb9, 0x66, 0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xb5, 0xdc, 0xa5, 0x29, 0x3b, 0xc7, 0xe5, 0xac, - 0x35, 0x93, 0x4f, 0xb0, 0x5a, 0xaf, 0xf8, 0xfe, 0xd2, 0xd2, 0x4a, 0xd2, 0x7f, 0xfc, 0x4f, 0x49, - 0xdd, 0xf9, 0x0b, 0x40, 0x63, 0x3f, 0x0f, 0x96, 0x16, 0xfe, 0x15, 0xf5, 0x9f, 0x5e, 0x40, 0x54, - 0xf5, 0xdf, 0xde, 0xf9, 0x39, 0x73, 0xac, 0x93, 0x99, 0x63, 0xfd, 0x9e, 0x39, 0xd6, 0xf7, 0xb9, - 0xd3, 0x3a, 0x99, 0x3b, 0xad, 0x5f, 0x73, 0xa7, 0xb5, 0xf7, 0x2c, 0x61, 0xfa, 0x20, 0x8b, 0xdc, - 0x58, 0x4c, 0xbc, 0x77, 0x9f, 0x3f, 0xbe, 0x79, 0x8f, 0xfa, 0x48, 0xc8, 0x91, 0x17, 0x1f, 0x84, - 0x8c, 0x7b, 0xc7, 0xf5, 0x3f, 0x4b, 0x4f, 0x53, 0x54, 0x51, 0xd7, 0xfc, 0xaf, 0x5e, 0xfe, 0x09, - 0x00, 0x00, 0xff, 0xff, 0x13, 0xc6, 0x11, 0x5c, 0xd0, 0x04, 0x00, 0x00, + // 547 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6e, 0xd3, 0x30, + 0x18, 0x6d, 0x68, 0xe9, 0x36, 0x0f, 0x34, 0x11, 0x36, 0x9a, 0x55, 0x22, 0x1a, 0x45, 0x48, 0xfc, + 0x2d, 0xd1, 0x40, 0xe2, 0x9e, 0x02, 0x93, 0x10, 0x2a, 0xaa, 0x82, 0x40, 0xb0, 0x0b, 0x2a, 0x27, + 0xf6, 0x52, 0xab, 0x8d, 0x1d, 0xd9, 0xce, 0xb6, 0xde, 0xf3, 0x00, 0x3c, 0x0c, 0x12, 0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 0xe6, 0x47, 0xb0, 0x5c, + 0x44, 0xec, 0xce, 0xdc, 0xd2, 0x5c, 0xd2, 0x7e, 0xb0, 0x50, 0x52, 0xbc, 0xf9, 0x33, 0x00, 0xa5, + 0x7c, 0xdc, 0x9d, 0x5b, 0x78, 0x22, 0x6a, 0x3f, 0xba, 0x80, 0xe8, 0xdf, 0xfb, 0xc9, 0xa2, 0xb0, + 0xe8, 0x7e, 0xb4, 0x6c, 0xe1, 0xfd, 0x54, 0x77, 0xde, 0xdd, 0xfd, 0x31, 0xb5, 0x8d, 0xe3, 0xa9, + 0x6d, 0xfc, 0x9e, 0xda, 0xc6, 0xd7, 0x99, 0x5d, 0x3b, 0x9e, 0xd9, 0xb5, 0x5f, 0x33, 0xbb, 0xb6, + 0xf7, 0x38, 0x24, 0x72, 0x98, 0xf8, 0x4e, 0xc0, 0x22, 0xf7, 0xcd, 0xa7, 0x0f, 0xaf, 0xde, 0x62, + 0x79, 0xc8, 0xf8, 0xc8, 0x0d, 0x86, 0x90, 0x50, 0xf7, 0xa8, 0xf8, 0x69, 0xcb, 0x49, 0x8c, 0x85, + 0xdf, 0x54, 0xff, 0xdf, 0xa7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1d, 0xaa, 0xbb, 0x16, 0xd1, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -560,6 +661,9 @@ type MsgClient interface { FundPool(ctx context.Context, in *MsgFundPool, opts ...grpc.CallOption) (*MsgFundPoolResponse, error) // DefundPool ... DefundPool(ctx context.Context, in *MsgDefundPool, opts ...grpc.CallOption) (*MsgDefundPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -606,6 +710,15 @@ func (c *msgClient) DefundPool(ctx context.Context, in *MsgDefundPool, opts ...g return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/kyve.funders.v1beta1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateFunder ... @@ -616,6 +729,9 @@ type MsgServer interface { FundPool(context.Context, *MsgFundPool) (*MsgFundPoolResponse, error) // DefundPool ... DefundPool(context.Context, *MsgDefundPool) (*MsgDefundPoolResponse, error) + // UpdateParams defines a governance operation for updating the x/delegation module + // parameters. The authority is hard-coded to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -634,6 +750,9 @@ func (*UnimplementedMsgServer) FundPool(ctx context.Context, req *MsgFundPool) ( func (*UnimplementedMsgServer) DefundPool(ctx context.Context, req *MsgDefundPool) (*MsgDefundPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DefundPool not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -711,6 +830,24 @@ func _Msg_DefundPool_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kyve.funders.v1beta1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kyve.funders.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -731,6 +868,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DefundPool", Handler: _Msg_DefundPool_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kyve/funders/v1beta1/tx.proto", @@ -1043,6 +1184,66 @@ func (m *MsgDefundPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintTx(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1197,6 +1398,32 @@ func (m *MsgDefundPoolResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2146,6 +2373,170 @@ func (m *MsgDefundPoolResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0