From 8c7b246124531b875d420bb116fdc9c8f1e7737b Mon Sep 17 00:00:00 2001 From: John Letey Date: Mon, 20 Mar 2023 11:05:22 +0100 Subject: [PATCH 01/18] feat(`2.2.25`): emit event when updating module params --- CHANGELOG.md | 4 + proto/kyve/bundles/v1beta1/events.proto | 13 + proto/kyve/delegation/v1beta1/events.proto | 13 + proto/kyve/global/v1beta1/events.proto | 19 + proto/kyve/stakers/v1beta1/events.proto | 14 + x/bundles/keeper/msg_server_update_params.go | 21 +- x/bundles/types/events.pb.go | 401 +++++++++++++--- .../keeper/msg_server_update_params.go | 25 +- x/delegation/types/events.pb.go | 345 ++++++++++++-- x/global/keeper/msg_server_update_params.go | 20 +- x/global/types/events.pb.go | 432 ++++++++++++++++++ x/stakers/keeper/msg_server_update_params.go | 21 +- x/stakers/types/events.pb.go | 343 ++++++++++++-- 13 files changed, 1522 insertions(+), 149 deletions(-) create mode 100644 proto/kyve/global/v1beta1/events.proto create mode 100644 x/global/types/events.pb.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 27dee1ad..ee9d9d30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ ## [Unreleased] +### Improvements + +- Emit an event when updating module parameters. + ## [v1.0.0](https://github.com/KYVENetwork/chain/releases/tag/v1.0.0) - 2023-03-10 Release for the KYVE network launch. diff --git a/proto/kyve/bundles/v1beta1/events.proto b/proto/kyve/bundles/v1beta1/events.proto index 6bc7b503..f82143f0 100644 --- a/proto/kyve/bundles/v1beta1/events.proto +++ b/proto/kyve/bundles/v1beta1/events.proto @@ -2,11 +2,24 @@ syntax = "proto3"; package kyve.bundles.v1beta1; +import "gogoproto/gogo.proto"; import "kyve/bundles/v1beta1/bundles.proto"; +import "kyve/bundles/v1beta1/params.proto"; import "kyve/bundles/v1beta1/tx.proto"; option go_package = "github.com/KYVENetwork/chain/x/bundles/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. + kyve.bundles.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.bundles.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} + // EventBundleVote is an event emitted when a protocol node votes on a bundle. // emitted_by: MsgVoteBundleProposal message EventBundleVote { diff --git a/proto/kyve/delegation/v1beta1/events.proto b/proto/kyve/delegation/v1beta1/events.proto index 13b45fbd..da13e687 100644 --- a/proto/kyve/delegation/v1beta1/events.proto +++ b/proto/kyve/delegation/v1beta1/events.proto @@ -2,10 +2,23 @@ syntax = "proto3"; package kyve.delegation.v1beta1; +import "gogoproto/gogo.proto"; import "kyve/delegation/v1beta1/delegation.proto"; +import "kyve/delegation/v1beta1/params.proto"; option go_package = "github.com/KYVENetwork/chain/x/delegation/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. + kyve.delegation.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.delegation.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} + // ---------- Delegating Events ---------- // EventDelegate is an event emitted when someone delegates to a protocol node. diff --git a/proto/kyve/global/v1beta1/events.proto b/proto/kyve/global/v1beta1/events.proto new file mode 100644 index 00000000..eab53058 --- /dev/null +++ b/proto/kyve/global/v1beta1/events.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package kyve.global.v1beta1; + +import "gogoproto/gogo.proto"; +import "kyve/global/v1beta1/global.proto"; + +option go_package = "github.com/KYVENetwork/chain/x/global/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. + kyve.global.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.global.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} diff --git a/proto/kyve/stakers/v1beta1/events.proto b/proto/kyve/stakers/v1beta1/events.proto index 3b7fba3d..47a68197 100644 --- a/proto/kyve/stakers/v1beta1/events.proto +++ b/proto/kyve/stakers/v1beta1/events.proto @@ -2,8 +2,22 @@ syntax = "proto3"; package kyve.stakers.v1beta1; +import "gogoproto/gogo.proto"; +import "kyve/stakers/v1beta1/params.proto"; + option go_package = "github.com/KYVENetwork/chain/x/stakers/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. + kyve.stakers.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.stakers.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} + // EventCreateStaker is an event emitted when a protocol node stakes in a pool. // emitted_by: MsgCreateStaker message EventCreateStaker { diff --git a/x/bundles/keeper/msg_server_update_params.go b/x/bundles/keeper/msg_server_update_params.go index 72a4cd76..00407887 100644 --- a/x/bundles/keeper/msg_server_update_params.go +++ b/x/bundles/keeper/msg_server_update_params.go @@ -5,7 +5,6 @@ import ( "encoding/json" "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" // Bundles @@ -14,17 +13,23 @@ import ( govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) +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) - params := k.GetParams(ctx) + oldParams := k.GetParams(ctx) + + newParams := oldParams + _ = json.Unmarshal([]byte(msg.Payload), &newParams) + k.SetParams(ctx, newParams) - payload := params - _ = json.Unmarshal([]byte(req.Payload), &payload) - k.SetParams(ctx, payload) + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ + OldParams: oldParams, + NewParams: newParams, + Payload: msg.Payload, + }) return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/bundles/types/events.pb.go b/x/bundles/types/events.pb.go index e5a803ee..a154c821 100644 --- a/x/bundles/types/events.pb.go +++ b/x/bundles/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/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_a02f505e55d81e92, []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 "" +} + // EventBundleVote is an event emitted when a protocol node votes on a bundle. // emitted_by: MsgVoteBundleProposal type EventBundleVote struct { @@ -39,7 +105,7 @@ func (m *EventBundleVote) Reset() { *m = EventBundleVote{} } func (m *EventBundleVote) String() string { return proto.CompactTextString(m) } func (*EventBundleVote) ProtoMessage() {} func (*EventBundleVote) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{0} + return fileDescriptor_a02f505e55d81e92, []int{1} } func (m *EventBundleVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -137,7 +203,7 @@ func (m *EventBundleProposed) Reset() { *m = EventBundleProposed{} } func (m *EventBundleProposed) String() string { return proto.CompactTextString(m) } func (*EventBundleProposed) ProtoMessage() {} func (*EventBundleProposed) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{1} + return fileDescriptor_a02f505e55d81e92, []int{2} } func (m *EventBundleProposed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -301,7 +367,7 @@ func (m *EventBundleFinalized) Reset() { *m = EventBundleFinalized{} } func (m *EventBundleFinalized) String() string { return proto.CompactTextString(m) } func (*EventBundleFinalized) ProtoMessage() {} func (*EventBundleFinalized) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{2} + return fileDescriptor_a02f505e55d81e92, []int{3} } func (m *EventBundleFinalized) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -444,7 +510,7 @@ func (m *EventClaimedUploaderRole) Reset() { *m = EventClaimedUploaderRo func (m *EventClaimedUploaderRole) String() string { return proto.CompactTextString(m) } func (*EventClaimedUploaderRole) ProtoMessage() {} func (*EventClaimedUploaderRole) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{3} + return fileDescriptor_a02f505e55d81e92, []int{4} } func (m *EventClaimedUploaderRole) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -511,7 +577,7 @@ func (m *EventSkippedUploaderRole) Reset() { *m = EventSkippedUploaderRo func (m *EventSkippedUploaderRole) String() string { return proto.CompactTextString(m) } func (*EventSkippedUploaderRole) ProtoMessage() {} func (*EventSkippedUploaderRole) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{4} + return fileDescriptor_a02f505e55d81e92, []int{5} } func (m *EventSkippedUploaderRole) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -583,7 +649,7 @@ func (m *EventPointIncreased) Reset() { *m = EventPointIncreased{} } func (m *EventPointIncreased) String() string { return proto.CompactTextString(m) } func (*EventPointIncreased) ProtoMessage() {} func (*EventPointIncreased) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{5} + return fileDescriptor_a02f505e55d81e92, []int{6} } func (m *EventPointIncreased) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -646,7 +712,7 @@ func (m *EventPointsReset) Reset() { *m = EventPointsReset{} } func (m *EventPointsReset) String() string { return proto.CompactTextString(m) } func (*EventPointsReset) ProtoMessage() {} func (*EventPointsReset) Descriptor() ([]byte, []int) { - return fileDescriptor_a02f505e55d81e92, []int{6} + return fileDescriptor_a02f505e55d81e92, []int{7} } func (m *EventPointsReset) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -690,6 +756,7 @@ func (m *EventPointsReset) GetStaker() string { } func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.bundles.v1beta1.EventUpdateParams") proto.RegisterType((*EventBundleVote)(nil), "kyve.bundles.v1beta1.EventBundleVote") proto.RegisterType((*EventBundleProposed)(nil), "kyve.bundles.v1beta1.EventBundleProposed") proto.RegisterType((*EventBundleFinalized)(nil), "kyve.bundles.v1beta1.EventBundleFinalized") @@ -702,56 +769,111 @@ func init() { func init() { proto.RegisterFile("kyve/bundles/v1beta1/events.proto", fileDescriptor_a02f505e55d81e92) } var fileDescriptor_a02f505e55d81e92 = []byte{ - // 775 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4b, 0x4f, 0x1b, 0x49, - 0x10, 0x66, 0x60, 0xf0, 0xa3, 0xfd, 0x00, 0x06, 0x76, 0x77, 0x96, 0x15, 0x5e, 0xdb, 0xab, 0xd5, - 0x5a, 0x62, 0x65, 0x0b, 0xf6, 0xb6, 0x37, 0x60, 0x41, 0x6b, 0x21, 0x45, 0x68, 0x20, 0x48, 0xc9, - 0xc5, 0x6a, 0x7b, 0x0a, 0xdc, 0xf2, 0x78, 0x7a, 0xd4, 0xdd, 0xe3, 0x07, 0xbf, 0x22, 0x52, 0x94, - 0x7f, 0x94, 0x43, 0x8e, 0x1c, 0x73, 0x4c, 0xe0, 0x8f, 0x44, 0xfd, 0x98, 0xb1, 0x43, 0x4c, 0x12, - 0x72, 0xac, 0xaf, 0xbe, 0xaa, 0xfa, 0xba, 0xbf, 0xea, 0x19, 0x54, 0x1b, 0x4c, 0x47, 0xd0, 0xea, - 0xc6, 0xa1, 0x1f, 0x00, 0x6f, 0x8d, 0xf6, 0xba, 0x20, 0xf0, 0x5e, 0x0b, 0x46, 0x10, 0x0a, 0xde, - 0x8c, 0x18, 0x15, 0xd4, 0xd9, 0x92, 0x94, 0xa6, 0xa1, 0x34, 0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0, 0x62, - 0xc6, 0x20, 0x14, 0x9d, 0x48, 0xb6, 0xe2, 0x66, 0xe1, 0x4b, 0x06, 0x55, 0xfd, 0x79, 0xfd, 0x08, - 0xad, 0xcf, 0xc6, 0x71, 0x0f, 0x38, 0x88, 0x27, 0xcf, 0x3a, 0x3c, 0x79, 0x77, 0x57, 0xb1, 0x6e, - 0xef, 0x2a, 0xd6, 0x87, 0xbb, 0x8a, 0xf5, 0xea, 0xbe, 0xb2, 0x74, 0x7b, 0x5f, 0x59, 0x7a, 0x7f, - 0x5f, 0x59, 0x7a, 0xf9, 0xf7, 0x35, 0x11, 0xfd, 0xb8, 0xdb, 0xec, 0xd1, 0x61, 0xeb, 0xf4, 0xc5, - 0xe5, 0xf1, 0x33, 0x10, 0x63, 0xca, 0x06, 0xad, 0x5e, 0x1f, 0x93, 0xb0, 0x35, 0x49, 0xff, 0x23, - 0x62, 0x1a, 0x01, 0xef, 0x66, 0xd4, 0x3f, 0xe4, 0x9f, 0x4f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb8, - 0xe3, 0xf5, 0xed, 0xc1, 0x06, 0x00, 0x00, + // 858 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xce, 0x26, 0x1b, 0x27, 0x7b, 0xfc, 0xd3, 0x64, 0x1b, 0x60, 0x09, 0xd4, 0x4d, 0x8c, 0x10, + 0x91, 0x8a, 0x6c, 0x35, 0xdc, 0x71, 0x97, 0x94, 0x56, 0x58, 0x95, 0x50, 0xb4, 0x69, 0x2b, 0xc1, + 0x8d, 0x35, 0xce, 0x9c, 0xd8, 0x23, 0xaf, 0x77, 0x46, 0x33, 0x63, 0x3b, 0xce, 0x53, 0x20, 0x21, + 0x9e, 0x84, 0x57, 0xe0, 0xa2, 0x97, 0xbd, 0xe4, 0x0a, 0x41, 0xf2, 0x22, 0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b6, 0xb9, 0xf6, 0xc3, 0x97, 0x03, 0xa6, 0x87, 0x93, 0x7e, 0xfb, 0x82, 0x8f, 0x3b, + 0xcf, 0xbf, 0x7f, 0xf5, 0xf4, 0x3b, 0xd4, 0x33, 0x2e, 0x47, 0x9d, 0x8b, 0x21, 0x61, 0x79, 0xe7, + 0xaa, 0xfc, 0xf7, 0xd3, 0x73, 0x81, 0xaa, 0x5f, 0xb1, 0xff, 0x7c, 0x5f, 0xfd, 0x15, 0x00, 0x00, + 0xff, 0xff, 0x37, 0x28, 0x51, 0xd0, 0xb0, 0x07, 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 *EventBundleVote) Marshal() (dAtA []byte, err error) { @@ -1176,6 +1298,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 *EventBundleVote) Size() (n int) { if m == nil { return 0 @@ -1392,6 +1531,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 *EventBundleVote) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/delegation/keeper/msg_server_update_params.go b/x/delegation/keeper/msg_server_update_params.go index b77b5220..712e584f 100644 --- a/x/delegation/keeper/msg_server_update_params.go +++ b/x/delegation/keeper/msg_server_update_params.go @@ -5,7 +5,6 @@ import ( "encoding/json" "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" // Delegation @@ -14,21 +13,23 @@ import ( govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -// UpdateParams is a governance message to update module-wide parameters. -// req.payload is a valid json string -// This is already checked and validated by the `types/params.go` -// Only the provided properties will be updated, the rest remains the same. -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) +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) - params := k.GetParams(ctx) + oldParams := k.GetParams(ctx) + + newParams := oldParams + _ = json.Unmarshal([]byte(msg.Payload), &newParams) + k.SetParams(ctx, newParams) - payload := params - _ = json.Unmarshal([]byte(req.Payload), &payload) - k.SetParams(ctx, payload) + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ + OldParams: oldParams, + NewParams: newParams, + Payload: msg.Payload, + }) return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/delegation/types/events.pb.go b/x/delegation/types/events.pb.go index 0092d011..78b9e598 100644 --- a/x/delegation/types/events.pb.go +++ b/x/delegation/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/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_d01988a9108a2e89, []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 "" +} + // EventDelegate is an event emitted when someone delegates to a protocol node. // emitted_by: MsgDelegate type EventDelegate struct { @@ -37,7 +103,7 @@ func (m *EventDelegate) Reset() { *m = EventDelegate{} } func (m *EventDelegate) String() string { return proto.CompactTextString(m) } func (*EventDelegate) ProtoMessage() {} func (*EventDelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_d01988a9108a2e89, []int{0} + return fileDescriptor_d01988a9108a2e89, []int{1} } func (m *EventDelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -102,7 +168,7 @@ func (m *EventUndelegate) Reset() { *m = EventUndelegate{} } func (m *EventUndelegate) String() string { return proto.CompactTextString(m) } func (*EventUndelegate) ProtoMessage() {} func (*EventUndelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_d01988a9108a2e89, []int{1} + return fileDescriptor_d01988a9108a2e89, []int{2} } func (m *EventUndelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -169,7 +235,7 @@ func (m *EventRedelegate) Reset() { *m = EventRedelegate{} } func (m *EventRedelegate) String() string { return proto.CompactTextString(m) } func (*EventRedelegate) ProtoMessage() {} func (*EventRedelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_d01988a9108a2e89, []int{2} + return fileDescriptor_d01988a9108a2e89, []int{3} } func (m *EventRedelegate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -241,7 +307,7 @@ func (m *EventWithdrawRewards) Reset() { *m = EventWithdrawRewards{} } func (m *EventWithdrawRewards) String() string { return proto.CompactTextString(m) } func (*EventWithdrawRewards) ProtoMessage() {} func (*EventWithdrawRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_d01988a9108a2e89, []int{3} + return fileDescriptor_d01988a9108a2e89, []int{4} } func (m *EventWithdrawRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -308,7 +374,7 @@ func (m *EventSlash) Reset() { *m = EventSlash{} } func (m *EventSlash) String() string { return proto.CompactTextString(m) } func (*EventSlash) ProtoMessage() {} func (*EventSlash) Descriptor() ([]byte, []int) { - return fileDescriptor_d01988a9108a2e89, []int{4} + return fileDescriptor_d01988a9108a2e89, []int{5} } func (m *EventSlash) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -366,6 +432,7 @@ func (m *EventSlash) GetSlashType() SlashType { } func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.delegation.v1beta1.EventUpdateParams") proto.RegisterType((*EventDelegate)(nil), "kyve.delegation.v1beta1.EventDelegate") proto.RegisterType((*EventUndelegate)(nil), "kyve.delegation.v1beta1.EventUndelegate") proto.RegisterType((*EventRedelegate)(nil), "kyve.delegation.v1beta1.EventRedelegate") @@ -378,30 +445,85 @@ func init() { } var fileDescriptor_d01988a9108a2e89 = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xcf, 0x4e, 0xf2, 0x40, - 0x14, 0xc5, 0x99, 0x0f, 0x02, 0x1f, 0xd7, 0xa8, 0x49, 0x63, 0xa4, 0xd1, 0xa4, 0x12, 0xe2, 0x82, - 0x55, 0x1b, 0xf4, 0x09, 0x34, 0xb2, 0x20, 0x26, 0x2e, 0x8a, 0x7f, 0x82, 0x2e, 0x70, 0x60, 0xae, - 0xb4, 0x01, 0x3a, 0xcd, 0xcc, 0x00, 0xb2, 0xf4, 0x0d, 0x5c, 0xfa, 0x48, 0x2e, 0x59, 0xba, 0x34, - 0xf0, 0x22, 0x66, 0x86, 0x12, 0xc1, 0x84, 0x44, 0x13, 0x76, 0x3d, 0x73, 0x4e, 0x7f, 0xe7, 0xde, - 0xe4, 0xc2, 0x71, 0x77, 0x3c, 0x44, 0x8f, 0x61, 0x0f, 0x3b, 0x54, 0x85, 0x3c, 0xf2, 0x86, 0x95, - 0x16, 0x2a, 0x5a, 0xf1, 0x70, 0x88, 0x91, 0x92, 0x6e, 0x2c, 0xb8, 0xe2, 0x56, 0x41, 0xa7, 0xdc, - 0xef, 0x94, 0x9b, 0xa4, 0x0e, 0xca, 0xeb, 0x7e, 0x5f, 0xca, 0x1a, 0x44, 0xa9, 0x01, 0xdb, 0x55, - 0x8d, 0xbc, 0x98, 0x1b, 0x68, 0xd9, 0x90, 0xa3, 0x8c, 0x09, 0x94, 0xd2, 0x26, 0x45, 0x52, 0xce, - 0xfb, 0x0b, 0x69, 0xed, 0x43, 0x56, 0x2a, 0xda, 0x45, 0x61, 0xff, 0x33, 0x46, 0xa2, 0x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0x39, 0xc5, 0xd3, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0xe5, 0x5e, - 0x91, 0xf5, 0x02, 0x00, 0x00, + // 443 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x4f, 0x6b, 0x13, 0x41, + 0x18, 0xc6, 0x33, 0x1a, 0x52, 0xf7, 0x2d, 0x2a, 0x2e, 0xc5, 0x86, 0x0a, 0x9b, 0x12, 0x3c, 0xe4, + 0xb4, 0x4b, 0xeb, 0x27, 0xb0, 0xb4, 0x87, 0x22, 0x88, 0x4c, 0xfc, 0x43, 0xf5, 0x10, 0x27, 0x9d, + 0xd7, 0x64, 0xc9, 0x66, 0xdf, 0x65, 0x66, 0x9a, 0x35, 0x47, 0xbf, 0x81, 0x47, 0xbf, 0x8a, 0xdf, + 0xa0, 0xc7, 0x1e, 0x3d, 0x89, 0x24, 0x5f, 0x44, 0x66, 0x66, 0x97, 0xb6, 0xc2, 0x82, 0x85, 0xdc, + 0xe6, 0x99, 0x79, 0xf6, 0xf7, 0x3c, 0x33, 0xec, 0x0b, 0xcf, 0x67, 0xcb, 0x05, 0x26, 0x12, 0x33, + 0x9c, 0x08, 0x93, 0x52, 0x9e, 0x2c, 0x0e, 0xc6, 0x68, 0xc4, 0x41, 0x82, 0x0b, 0xcc, 0x8d, 0x8e, + 0x0b, 0x45, 0x86, 0xc2, 0x5d, 0xeb, 0x8a, 0xaf, 0x5d, 0x71, 0xe5, 0xda, 0xdb, 0x99, 0xd0, 0x84, + 0x9c, 0x27, 0xb1, 0x2b, 0x6f, 0xdf, 0x1b, 0x34, 0x41, 0x6f, 0x10, 0xbc, 0xb3, 0x31, 0xbe, 0x10, + 0x4a, 0xcc, 0xab, 0xf8, 0xfe, 0x4f, 0x06, 0x4f, 0x4e, 0x6c, 0x9f, 0x77, 0x85, 0x14, 0x06, 0xdf, + 0xb8, 0xb3,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, 0xe5, 0x5d, 0xb9, 0xe1, 0x4b, 0x00, 0x6d, 0x89, 0x23, 0xb3, + 0x2c, 0xd0, 0xdd, 0xea, 0xd1, 0x61, 0xbf, 0xf1, 0xaf, 0x72, 0xe1, 0x6f, 0x97, 0x05, 0xf2, 0x40, + 0xd7, 0xcb, 0xa3, 0xd3, 0xcb, 0x55, 0xc4, 0xae, 0x56, 0x11, 0xfb, 0xb3, 0x8a, 0xd8, 0xf7, 0x75, + 0xd4, 0xba, 0x5a, 0x47, 0xad, 0x5f, 0xeb, 0xa8, 0xf5, 0x31, 0x99, 0xa4, 0x66, 0x7a, 0x31, 0x8e, + 0xcf, 0x69, 0x9e, 0xbc, 0x3a, 0x7b, 0x7f, 0xf2, 0x1a, 0x4d, 0x49, 0x6a, 0x96, 0x9c, 0x4f, 0x45, + 0x9a, 0x27, 0x5f, 0x6f, 0x8e, 0x93, 0x8d, 0xd7, 0xe3, 0x8e, 0x1b, 0xa3, 0x17, 0x7f, 0x03, 0x00, + 0x00, 0xff, 0xff, 0xa8, 0xcd, 0x73, 0x6b, 0xed, 0x03, 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 *EventDelegate) Marshal() (dAtA []byte, err error) { @@ -635,6 +757,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 *EventDelegate) Size() (n int) { if m == nil { return 0 @@ -747,6 +886,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 *EventDelegate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/global/keeper/msg_server_update_params.go b/x/global/keeper/msg_server_update_params.go index ba7d4591..4189a238 100644 --- a/x/global/keeper/msg_server_update_params.go +++ b/x/global/keeper/msg_server_update_params.go @@ -13,17 +13,23 @@ import ( govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) +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) - params := k.GetParams(ctx) + oldParams := k.GetParams(ctx) - payload := params - _ = json.Unmarshal([]byte(req.Payload), &payload) - k.SetParams(ctx, payload) + 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/global/types/events.pb.go b/x/global/types/events.pb.go new file mode 100644 index 00000000..3c6b587a --- /dev/null +++ b/x/global/types/events.pb.go @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/global/v1beta1/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// 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_e23fcddbe36854a4, []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 "" +} + +func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.global.v1beta1.EventUpdateParams") +} + +func init() { proto.RegisterFile("kyve/global/v1beta1/events.proto", fileDescriptor_e23fcddbe36854a4) } + +var fileDescriptor_e23fcddbe36854a4 = []byte{ + // 252 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0xcf, 0xc9, 0x4f, 0x4a, 0xcc, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, + 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x06, 0xa9, + 0xd0, 0x83, 0xa8, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, 0x83, + 0x58, 0x10, 0xa5, 0x52, 0x58, 0x0d, 0x83, 0xea, 0x04, 0xab, 0x50, 0xda, 0xc8, 0xc8, 0x25, 0xe8, + 0x0a, 0x32, 0x3d, 0xb4, 0x20, 0x25, 0xb1, 0x24, 0x35, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, + 0x81, 0x8b, 0x2b, 0x3f, 0x27, 0x25, 0xbe, 0x00, 0xcc, 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, + 0x92, 0xd6, 0xc3, 0x62, 0xaf, 0x1e, 0x44, 0x83, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x9c, + 0xf9, 0x39, 0x29, 0x08, 0x13, 0xf2, 0x52, 0xcb, 0x61, 0x26, 0x30, 0x11, 0x6d, 0x42, 0x5e, 0x6a, + 0x39, 0xd4, 0x04, 0x09, 0x2e, 0xf6, 0x82, 0xc4, 0xca, 0x9c, 0xfc, 0xc4, 0x14, 0x09, 0x66, 0x05, + 0x46, 0x0d, 0xce, 0x20, 0x18, 0xd7, 0xc9, 0xf5, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, + 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, + 0x18, 0xa2, 0xb4, 0xd3, 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, 0x60, 0x21, 0x51, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x01, 0x63, 0x40, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe5, 0x68, 0x7b, 0x75, 0x72, 0x01, 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 encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + 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 sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +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 skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stakers/keeper/msg_server_update_params.go b/x/stakers/keeper/msg_server_update_params.go index 0268d464..0e5e6a6a 100644 --- a/x/stakers/keeper/msg_server_update_params.go +++ b/x/stakers/keeper/msg_server_update_params.go @@ -5,7 +5,6 @@ import ( "encoding/json" "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" // Gov @@ -14,17 +13,23 @@ import ( "github.com/KYVENetwork/chain/x/stakers/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if k.authority != req.Authority { - return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) +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) - params := k.GetParams(ctx) + oldParams := k.GetParams(ctx) + + newParams := oldParams + _ = json.Unmarshal([]byte(msg.Payload), &newParams) + k.SetParams(ctx, newParams) - payload := params - _ = json.Unmarshal([]byte(req.Payload), &payload) - k.SetParams(ctx, payload) + _ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ + OldParams: oldParams, + NewParams: newParams, + Payload: msg.Payload, + }) return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/stakers/types/events.pb.go b/x/stakers/types/events.pb.go index 23c49708..0e705fb8 100644 --- a/x/stakers/types/events.pb.go +++ b/x/stakers/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/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_7a1b3dc9634155a0, []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 "" +} + // EventCreateStaker is an event emitted when a protocol node stakes in a pool. // emitted_by: MsgCreateStaker type EventCreateStaker struct { @@ -35,7 +101,7 @@ func (m *EventCreateStaker) Reset() { *m = EventCreateStaker{} } func (m *EventCreateStaker) String() string { return proto.CompactTextString(m) } func (*EventCreateStaker) ProtoMessage() {} func (*EventCreateStaker) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{0} + return fileDescriptor_7a1b3dc9634155a0, []int{1} } func (m *EventCreateStaker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -95,7 +161,7 @@ func (m *EventUpdateMetadata) Reset() { *m = EventUpdateMetadata{} } func (m *EventUpdateMetadata) String() string { return proto.CompactTextString(m) } func (*EventUpdateMetadata) ProtoMessage() {} func (*EventUpdateMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{1} + return fileDescriptor_7a1b3dc9634155a0, []int{2} } func (m *EventUpdateMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -165,7 +231,7 @@ func (m *EventUpdateCommission) Reset() { *m = EventUpdateCommission{} } func (m *EventUpdateCommission) String() string { return proto.CompactTextString(m) } func (*EventUpdateCommission) ProtoMessage() {} func (*EventUpdateCommission) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{2} + return fileDescriptor_7a1b3dc9634155a0, []int{3} } func (m *EventUpdateCommission) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -226,7 +292,7 @@ func (m *EventJoinPool) Reset() { *m = EventJoinPool{} } func (m *EventJoinPool) String() string { return proto.CompactTextString(m) } func (*EventJoinPool) ProtoMessage() {} func (*EventJoinPool) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{3} + return fileDescriptor_7a1b3dc9634155a0, []int{4} } func (m *EventJoinPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -296,7 +362,7 @@ func (m *EventLeavePool) Reset() { *m = EventLeavePool{} } func (m *EventLeavePool) String() string { return proto.CompactTextString(m) } func (*EventLeavePool) ProtoMessage() {} func (*EventLeavePool) Descriptor() ([]byte, []int) { - return fileDescriptor_7a1b3dc9634155a0, []int{4} + return fileDescriptor_7a1b3dc9634155a0, []int{5} } func (m *EventLeavePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -340,6 +406,7 @@ func (m *EventLeavePool) GetStaker() string { } func init() { + proto.RegisterType((*EventUpdateParams)(nil), "kyve.stakers.v1beta1.EventUpdateParams") proto.RegisterType((*EventCreateStaker)(nil), "kyve.stakers.v1beta1.EventCreateStaker") proto.RegisterType((*EventUpdateMetadata)(nil), "kyve.stakers.v1beta1.EventUpdateMetadata") proto.RegisterType((*EventUpdateCommission)(nil), "kyve.stakers.v1beta1.EventUpdateCommission") @@ -350,29 +417,84 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/events.proto", fileDescriptor_7a1b3dc9634155a0) } var fileDescriptor_7a1b3dc9634155a0 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcd, 0x4a, 0xeb, 0x40, - 0x14, 0xc7, 0x9b, 0xde, 0xd0, 0x72, 0x07, 0xee, 0x85, 0x9b, 0xeb, 0x47, 0x56, 0x43, 0xcd, 0xaa, - 0x0b, 0x49, 0x28, 0x3e, 0x81, 0x96, 0x0a, 0x7e, 0x4b, 0x45, 0x41, 0x37, 0x32, 0x69, 0x0e, 0xed, - 0xd0, 0x24, 0x27, 0x64, 0x4e, 0xd3, 0xf6, 0x2d, 0x7c, 0x2c, 0x97, 0x5d, 0xba, 0x94, 0xf6, 0x45, - 0x24, 0xd3, 0xb1, 0x44, 0xa1, 0x1b, 0x77, 0xf9, 0x7f, 0xf0, 0xff, 0x91, 0xe1, 0xb0, 0x83, 0xf1, - 0xbc, 0x80, 0x40, 0x91, 0x18, 0x43, 0xae, 0x82, 0xa2, 0x13, 0x02, 0x89, 0x4e, 0x00, 0x05, 0xa4, - 0xa4, 0xfc, 0x2c, 0x47, 0x42, 0x67, 0xa7, 0xac, 0xf8, 0xa6, 0xe2, 0x9b, 0x8a, 0xd7, 0x65, 0xff, - 0x7a, 0x65, 0xab, 0x9b, 0x83, 0x20, 0xb8, 0xd3, 0xa9, 0xb3, 0xc7, 0x1a, 0xeb, 0x9e, 0x6b, 0xb5, - 0xac, 0xf6, 0xef, 0xbe, 0x51, 0xa5, 0x2f, 0x12, 0x9c, 0xa4, 0xe4, 0xd6, 0x5b, 0x56, 0xdb, 0xee, - 0x1b, 0xe5, 0x4d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0x01, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x2b, - 0x0f, 0x0f, 0x53, 0x02, 0x00, 0x00, + // 429 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xdf, 0x6a, 0xd4, 0x40, + 0x14, 0xc6, 0x37, 0x6b, 0xd8, 0x65, 0x47, 0x14, 0x8c, 0x55, 0x43, 0x91, 0x58, 0x73, 0xd5, 0x0b, + 0x49, 0xa8, 0x3e, 0x41, 0xbb, 0x54, 0xf0, 0x7f, 0x89, 0x28, 0xe8, 0x4d, 0x39, 0xd9, 0x39, 0xa4, + 0xc3, 0x26, 0x73, 0x42, 0x66, 0x36, 0xe9, 0xbe, 0x85, 0xef, 0xe2, 0x4b, 0xf4, 0xb2, 0x97, 0x5e, + 0x89, 0xec, 0xbe, 0x88, 0x64, 0x32, 0x5b, 0xa3, 0x74, 0x41, 0x7a, 0x97, 0xef, 0x9c, 0x2f, 0xbf, + 0xef, 0x9b, 0x61, 0xd8, 0xd3, 0xf9, 0xb2, 0xc6, 0x58, 0x69, 0x98, 0x63, 0xa5, 0xe2, 0xfa, 0x20, + 0x45, 0x0d, 0x07, 0x31, 0xd6, 0x28, 0xb5, 0x8a, 0xca, 0x8a, 0x34, 0x79, 0x3b, 0xad, 0x25, 0xb2, + 0x96, 0xc8, 0x5a, 0x76, 0x77, 0x32, 0xca, 0xc8, 0x18, 0xe2, 0xf6, 0xab, 0xf3, 0xee, 0x5e, 0x8f, + 0x2b, 0xa1, 0x82, 0xc2, 0xe2, 0xc2, 0xef, 0x0e, 0xbb, 0x77, 0xdc, 0xf2, 0x3f, 0x95, 0x1c, 0x34, + 0x9e, 0x98, 0x9d, 0x77, 0xc8, 0x18, 0xe5, 0xfc, 0xb4, 0x73, 0xfa, 0xce, 0x9e, 0xb3, 0x7f, 0xfb, + 0xf9, 0xe3, 0xe8, 0xba, 0xe4, 0xa8, 0xf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 0x2d, 0x42, 0x8d, + 0x37, 0x8a, 0x3e, 0x7a, 0x79, 0xb1, 0x0a, 0x9c, 0xcb, 0x55, 0xe0, 0xfc, 0x5a, 0x05, 0xce, 0xb7, + 0x75, 0x30, 0xb8, 0x5c, 0x07, 0x83, 0x1f, 0xeb, 0x60, 0xf0, 0xf5, 0x59, 0x26, 0xf4, 0xd9, 0x22, + 0x8d, 0x66, 0x54, 0xc4, 0x6f, 0xbe, 0x7c, 0x3e, 0x7e, 0x8f, 0xba, 0xa1, 0x6a, 0x1e, 0xcf, 0xce, + 0x40, 0xc8, 0xf8, 0xfc, 0xea, 0x59, 0xeb, 0x65, 0x89, 0x2a, 0x1d, 0x99, 0xe7, 0xfc, 0xe2, 0x77, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x67, 0x6b, 0x55, 0x42, 0x03, 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 *EventCreateStaker) Marshal() (dAtA []byte, err error) { @@ -591,6 +713,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 *EventCreateStaker) Size() (n int) { if m == nil { return 0 @@ -694,6 +833,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 *EventCreateStaker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 25cfa952dec005a999115ec28f2705a5a225fb2a Mon Sep 17 00:00:00 2001 From: John Letey Date: Mon, 20 Mar 2023 11:14:39 +0100 Subject: [PATCH 02/18] chore(`2.2.24`): only import `x/team` keeper once --- x/team/abci.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/team/abci.go b/x/team/abci.go index 06c72bc3..0772f18c 100644 --- a/x/team/abci.go +++ b/x/team/abci.go @@ -4,17 +4,17 @@ import ( "fmt" "github.com/KYVENetwork/chain/util" - teamKeeper "github.com/KYVENetwork/chain/x/team/keeper" - "github.com/KYVENetwork/chain/x/team/types" sdk "github.com/cosmos/cosmos-sdk/types" - authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" + // Auth + authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" // Bank bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" // Mint mintKeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" // Team "github.com/KYVENetwork/chain/x/team/keeper" + "github.com/KYVENetwork/chain/x/team/types" // Upgrade upgradeKeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" ) @@ -51,7 +51,7 @@ func DistributeTeamInflation(ctx sdk.Context, bk bankKeeper.Keeper, mk mintKeepe // distribute team module rewards between vesting accounts based on their vesting progress for _, account := range tk.GetTeamVestingAccounts(ctx) { // get current vesting progress - status := teamKeeper.GetVestingStatus(account, uint64(ctx.BlockTime().Unix())) + status := keeper.GetVestingStatus(account, uint64(ctx.BlockTime().Unix())) // calculate reward share of account accountShare := sdk.NewDec(int64(status.TotalVestedAmount - account.UnlockedClaimed)).Quo(sdk.NewDec(int64(types.TEAM_ALLOCATION))) // calculate total inflation rewards for account for this block From 199a36b54648ab8bbdf5c2224e4246e628fb12cd Mon Sep 17 00:00:00 2001 From: John Letey Date: Mon, 20 Mar 2023 11:52:15 +0100 Subject: [PATCH 03/18] fix(`2.2.11`): validate msg inputs --- x/pool/types/message_fund_pool.go | 27 +++++++-------------- x/stakers/types/message_create_staker.go | 27 +++++++-------------- x/stakers/types/message_join_pool.go | 31 ++++++++++-------------- 3 files changed, 31 insertions(+), 54 deletions(-) diff --git a/x/pool/types/message_fund_pool.go b/x/pool/types/message_fund_pool.go index aae047ea..a36729ea 100644 --- a/x/pool/types/message_fund_pool.go +++ b/x/pool/types/message_fund_pool.go @@ -2,12 +2,11 @@ package types import ( "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgFundPool = "fund_pool" - var _ sdk.Msg = &MsgFundPool{} func NewMsgFundPool(creator string, id uint64, amount uint64) *MsgFundPool { @@ -18,31 +17,23 @@ func NewMsgFundPool(creator string, id uint64, amount uint64) *MsgFundPool { } } -func (msg *MsgFundPool) Route() string { - return RouterKey -} - -func (msg *MsgFundPool) Type() string { - return TypeMsgFundPool -} - func (msg *MsgFundPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) } - return []sdk.AccAddress{creator} -} -func (msg *MsgFundPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) + return []sdk.AccAddress{creator} } func (msg *MsgFundPool) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + + if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") + } + return nil } diff --git a/x/stakers/types/message_create_staker.go b/x/stakers/types/message_create_staker.go index 95ee7485..fed7e615 100644 --- a/x/stakers/types/message_create_staker.go +++ b/x/stakers/types/message_create_staker.go @@ -2,39 +2,30 @@ package types import ( "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgCreateStaker = "create_staker" - var _ sdk.Msg = &MsgCreateStaker{} -func (msg *MsgCreateStaker) Route() string { - return RouterKey -} - -func (msg *MsgCreateStaker) Type() string { - return TypeMsgCreateStaker -} - func (msg *MsgCreateStaker) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) } - return []sdk.AccAddress{creator} -} -func (msg *MsgCreateStaker) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) + return []sdk.AccAddress{creator} } func (msg *MsgCreateStaker) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + + if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") + } + return nil } diff --git a/x/stakers/types/message_join_pool.go b/x/stakers/types/message_join_pool.go index 0049914a..b4be808e 100644 --- a/x/stakers/types/message_join_pool.go +++ b/x/stakers/types/message_join_pool.go @@ -2,39 +2,34 @@ package types import ( "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgJoinPool = "join_pool" - var _ sdk.Msg = &MsgJoinPool{} -func (msg *MsgJoinPool) Route() string { - return RouterKey -} - -func (msg *MsgJoinPool) Type() string { - return TypeMsgJoinPool -} - func (msg *MsgJoinPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) } - return []sdk.AccAddress{creator} -} -func (msg *MsgJoinPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) + return []sdk.AccAddress{creator} } func (msg *MsgJoinPool) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) + } + + if _, err := sdk.AccAddressFromBech32(msg.Valaddress); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) } + + if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") + } + return nil } From 9b77d645844d2ff8a4488fe0ec9dd59e13d7c9eb Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 23 Mar 2023 09:18:13 +0100 Subject: [PATCH 04/18] fix(`2.2.19`): inefficient check order --- x/stakers/keeper/msg_server_join_pool.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/stakers/keeper/msg_server_join_pool.go b/x/stakers/keeper/msg_server_join_pool.go index 6f0c4caa..cf843ddf 100644 --- a/x/stakers/keeper/msg_server_join_pool.go +++ b/x/stakers/keeper/msg_server_join_pool.go @@ -48,6 +48,11 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ return nil, errors.Wrapf(errorsTypes.ErrInvalidRequest, types.ErrAlreadyJoinedPool.Error()) } + // Only join if it is possible + if errFreeSlot := k.ensureFreeSlot(ctx, msg.PoolId, staker.Address); errFreeSlot != nil { + return nil, errFreeSlot + } + // Every valaddress can only be used for one pool. It is not allowed // to use the same valaddress for multiple pools. (to avoid account sequence errors, // when two processes try so submit transactions simultaneously) @@ -66,11 +71,6 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ } } - // Only join if it is possible - if errFreeSlot := k.ensureFreeSlot(ctx, msg.PoolId, staker.Address); errFreeSlot != nil { - return nil, errFreeSlot - } - k.AddValaccountToPool(ctx, msg.PoolId, msg.Creator, msg.Valaddress) if err := util.TransferFromAddressToAddress(k.bankKeeper, ctx, msg.Creator, msg.Valaddress, msg.Amount); err != nil { From 6402d4e0cafcab7d0c85b57a4fa6aad999a9a96f Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 23 Mar 2023 09:25:09 +0100 Subject: [PATCH 05/18] chore(`2.2.23`): avoid implicit memory aliasing --- x/query/keeper/grpc_account_funded.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/query/keeper/grpc_account_funded.go b/x/query/keeper/grpc_account_funded.go index f5355a6e..08d2bd58 100644 --- a/x/query/keeper/grpc_account_funded.go +++ b/x/query/keeper/grpc_account_funded.go @@ -17,7 +17,9 @@ func (k Keeper) AccountFundedList(goCtx context.Context, req *types.QueryAccount ctx := sdk.UnwrapSDKContext(goCtx) var funded []types.Funded - for _, pool := range k.poolKeeper.GetAllPools(ctx) { + pools := k.poolKeeper.GetAllPools(ctx) + for i := range pools { + pool := pools[i] funded = append(funded, types.Funded{ Amount: pool.GetFunderAmount(req.Address), Pool: &types.BasicPool{ From f09b544adc9cd78e2bae43fc97b0e3f9e1f1e5f9 Mon Sep 17 00:00:00 2001 From: John Letey Date: Mon, 27 Mar 2023 10:50:08 +0200 Subject: [PATCH 06/18] refactor: switch relevant values to `sdk.Dec` (#19) --- .github/README.md | 4 +- CHANGELOG.md | 8 + app/app.go | 1 - go.mod | 100 ++--- go.sum | 365 +++++------------- proto/kyve/bundles/v1beta1/params.proto | 5 +- proto/kyve/delegation/v1beta1/params.proto | 17 +- proto/kyve/query/v1beta1/query.proto | 11 +- proto/kyve/stakers/v1beta1/events.proto | 5 +- proto/kyve/stakers/v1beta1/stakers.proto | 12 +- proto/kyve/stakers/v1beta1/tx.proto | 6 +- util/validate.go | 38 +- x/bundles/keeper/getters_params.go | 2 +- x/bundles/keeper/keeper.go | 2 - .../keeper_suite_invalid_bundles_test.go | 8 +- x/bundles/keeper/keeper_suite_points_test.go | 2 +- .../keeper/keeper_suite_stakers_leave_test.go | 9 +- .../keeper/keeper_suite_valid_bundles_test.go | 37 +- .../keeper_suite_zero_delegation_test.go | 8 +- x/bundles/keeper/logic_bundles.go | 6 +- ...ic_end_block_handle_upload_timeout_test.go | 4 +- .../keeper/msg_server_update_params_test.go | 4 +- x/bundles/types/params.go | 31 +- x/bundles/types/params.pb.go | 74 ++-- x/delegation/keeper/getters_params.go | 12 +- .../keeper/msg_server_undelegate_test.go | 11 +- .../keeper/msg_server_update_params_test.go | 12 +- x/delegation/types/params.go | 19 +- x/delegation/types/params.pb.go | 148 ++++--- x/query/types/query.pb.go | 159 ++++---- x/stakers/client/cli/tx_update_commission.go | 8 +- x/stakers/keeper/exported_functions.go | 7 +- x/stakers/keeper/getters_staker.go | 2 +- x/stakers/keeper/logic_commission.go | 2 +- .../keeper/msg_server_update_commission.go | 10 - .../msg_server_update_commission_test.go | 50 +-- x/stakers/types/errors.go | 1 - x/stakers/types/events.pb.go | 93 +++-- x/stakers/types/keys.go | 8 +- x/stakers/types/message_update_commission.go | 35 +- x/stakers/types/params.go | 4 +- x/stakers/types/stakers.pb.go | 129 +++---- x/stakers/types/tx.pb.go | 113 +++--- 43 files changed, 688 insertions(+), 894 deletions(-) diff --git a/.github/README.md b/.github/README.md index d0c3e98f..96aaa3d4 100644 --- a/.github/README.md +++ b/.github/README.md @@ -2,10 +2,10 @@ ###### v1.0.0 -The KYVE consensus layer is the backbone of the KYVE ecosystem. The layer is a +The KYVE consensus layer is the backbone of the KYVE ecosystem. This layer is a sovereign Delegated Proof of Stake network built using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) and -[Tendermint Core (BFT Consensus)](https://github.com/tendermint/tendermint). +[CometBFT (BFT Consensus)](https://github.com/cometbft/cometbft). ## Building from source diff --git a/CHANGELOG.md b/CHANGELOG.md index dc36f429..ddb40b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,19 @@ ### Improvements - Emit an event when updating module parameters. +- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Bump Cosmos SDK to [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) ([`v0.46.11-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.46.11-kyve-rc0)). +- (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Switch to CometBFT from Informal Systems' Tendermint fork. ### Bug Fixes - [#20](https://github.com/KYVENetwork/chain/pull/20) Adjust investor vesting schedules from second funding round. +### State Machine Breaking + +- (`x/bundles`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `NetworkFee` param to type `sdk.Dec`. +- (`x/delegation`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `VoteSlash`, `UploadSlash`, `TimeoutSlash` params to type `sdk.Dec`. +- (`x/stakers`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `Commission` to type `sdk.Dec`. + ## [v1.0.0](https://github.com/KYVENetwork/chain/releases/tag/v1.0.0) - 2023-03-10 Release for the KYVE network launch. diff --git a/app/app.go b/app/app.go index d5ec4ed4..5f505aec 100644 --- a/app/app.go +++ b/app/app.go @@ -448,7 +448,6 @@ func NewKYVEApp( app.PoolKeeper, app.StakersKeeper, app.DelegationKeeper, - app.UpgradeKeeper, ) // Create IBC Keepers diff --git a/go.mod b/go.mod index 2fc99cac..5456ed20 100644 --- a/go.mod +++ b/go.mod @@ -1,45 +1,45 @@ module github.com/KYVENetwork/chain -go 1.19 +go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0-beta.3 github.com/cosmos/cosmos-proto v1.0.0-alpha8 - github.com/cosmos/cosmos-sdk v0.46.10 + github.com/cosmos/cosmos-sdk v0.46.11 github.com/cosmos/gogoproto v1.4.2 github.com/cosmos/ibc-go/v6 v6.1.0 github.com/ethereum/go-ethereum v1.10.17 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 - github.com/golangci/golangci-lint v1.51.2 + github.com/golangci/golangci-lint v1.52.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/onsi/ginkgo/v2 v2.8.0 github.com/onsi/gomega v1.26.0 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.6.1 - github.com/stretchr/testify v1.8.1 - github.com/tendermint/tendermint v0.34.26 + github.com/stretchr/testify v1.8.2 + github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e - google.golang.org/grpc v1.50.1 + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 + google.golang.org/grpc v1.52.0 mvdan.cc/gofumpt v0.4.0 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.104.0 // indirect + cloud.google.com/go v0.105.0 // indirect cloud.google.com/go/compute v1.12.1 // indirect cloud.google.com/go/compute/metadata v0.2.1 // indirect - cloud.google.com/go/iam v0.4.0 // indirect - cloud.google.com/go/storage v1.23.0 // indirect + cloud.google.com/go/iam v0.7.0 // indirect + cloud.google.com/go/storage v1.27.0 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/Abirdcfly/dupword v0.0.9 // indirect - github.com/Antonboom/errname v0.1.7 // indirect - github.com/Antonboom/nilnil v0.1.1 // indirect + github.com/Abirdcfly/dupword v0.0.11 // indirect + github.com/Antonboom/errname v0.1.9 // indirect + github.com/Antonboom/nilnil v0.1.3 // indirect github.com/BurntSushi/toml v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect @@ -50,7 +50,7 @@ require ( github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/armon/go-metrics v0.4.1 // indirect - github.com/ashanbrown/forbidigo v1.4.0 // indirect + github.com/ashanbrown/forbidigo v1.5.1 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/aws/aws-sdk-go v1.40.45 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -59,18 +59,19 @@ require ( github.com/bkielbasa/cyclop v1.2.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bombsimon/wsl/v3 v3.4.0 // indirect - github.com/breml/bidichk v0.2.3 // indirect - github.com/breml/errchkjson v0.3.0 // indirect + github.com/breml/bidichk v0.2.4 // indirect + github.com/breml/errchkjson v0.3.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/butuzov/ireturn v0.1.1 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/charithe/durationcheck v0.0.9 // indirect - github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect + github.com/charithe/durationcheck v0.0.10 // indirect + github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect + github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect @@ -79,7 +80,7 @@ require ( github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.9.1 // indirect + github.com/daixiang0/gci v0.10.1 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect @@ -92,20 +93,20 @@ require ( github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect - github.com/fatih/color v1.14.1 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.6.7 // indirect + github.com/go-critic/go-critic v0.7.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-playground/validator/v10 v10.4.1 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect - github.com/go-toolsmith/astcopy v1.0.3 // indirect + github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect github.com/go-toolsmith/astfmt v1.1.0 // indirect github.com/go-toolsmith/astp v1.1.0 // indirect @@ -128,14 +129,13 @@ require ( github.com/golangci/misspell v0.4.0 // indirect github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect - github.com/google/btree v1.0.1 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect github.com/googleapis/gax-go/v2 v2.6.0 // indirect - github.com/googleapis/go-type-adapters v1.0.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect @@ -167,10 +167,10 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect - github.com/junk1tm/musttag v0.4.5 // indirect + github.com/junk1tm/musttag v0.5.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect - github.com/kkHAIKE/contextcheck v1.1.3 // indirect + github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/klauspost/compress v1.15.11 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect @@ -184,26 +184,26 @@ require ( github.com/magiconair/properties v1.8.6 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/maratori/testableexamples v1.0.0 // indirect - github.com/maratori/testpackage v1.1.0 // indirect - github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect + github.com/maratori/testpackage v1.1.1 // indirect + github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.10 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.2.5 // indirect + github.com/mgechev/revive v1.3.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moricho/tparallel v0.2.1 // indirect + github.com/moricho/tparallel v0.3.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.9.5 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.8.1 // indirect + github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.6.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect @@ -211,14 +211,14 @@ require ( github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.1.0 // indirect + github.com/polyfloyd/go-errorlint v1.4.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect - github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect + github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -238,7 +238,7 @@ require ( github.com/sivchari/containedctx v1.0.2 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect - github.com/sonatard/noctx v0.0.1 // indirect + github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -250,13 +250,14 @@ require ( github.com/subosito/gotenv v1.4.1 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect - github.com/tdakkota/asciicheck v0.1.1 // indirect + github.com/tdakkota/asciicheck v0.2.0 // indirect + github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/tidwall/btree v1.5.0 // indirect github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect - github.com/timonwong/loggercheck v0.9.3 // indirect - github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect + github.com/timonwong/loggercheck v0.9.4 // indirect + github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ulikunitz/xz v0.5.8 // indirect github.com/ultraware/funlen v0.0.3 // indirect @@ -272,18 +273,18 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect - go.uber.org/zap v1.23.0 // indirect + go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.6.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/term v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/tools v0.6.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/term v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect + golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.102.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -291,7 +292,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.2 // indirect + honnef.co/go/tools v0.4.3 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect @@ -301,13 +302,12 @@ require ( replace ( // use kyve flavored cosmos/cosmos-sdk - github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.46.10-kyve-rc0 + github.com/cosmos/cosmos-sdk => github.com/KYVENetwork/cosmos-sdk v0.46.11-kyve-rc0 // use cosmos flavored gogo/protobuf // https://github.com/cosmos/cosmos-sdk/issues/8469 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - // use informal flavored tendermint/tendermint - // https://github.com/tendermint/tendermint/issues/9972 - github.com/tendermint/tendermint => github.com/informalsystems/tendermint v0.34.26 + // use cometbft + github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27 ) diff --git a/go.sum b/go.sum index df65a45b..a25429ce 100644 --- a/go.sum +++ b/go.sum @@ -23,22 +23,8 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= -cloud.google.com/go v0.104.0 h1:gSmWO7DY1vOm0MVU6DNXM11BWHHsTUmsC5cv1fuW5X8= -cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= +cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -46,21 +32,15 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/iam v0.4.0 h1:YBYU00SCDzZJdHqVc4I5d6lsklcYIjQZa1YmEz4jlSE= -cloud.google.com/go/iam v0.4.0/go.mod h1:cbaZxyScUhxl7ZAkNWiALgihfP75wS/fUsVNaa1r3vA= +cloud.google.com/go/iam v0.7.0 h1:k4MuwOsS7zGJJ+QfZ5vBK8SgHBAvYN/23BWsiihJ1vs= +cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= +cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -71,9 +51,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -cloud.google.com/go/storage v1.23.0 h1:wWRIaDURQA8xxHguFCshYepGlrWIrbBnAmc7wfg07qY= -cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0 h1:YOO045NZI9RKfCj1c5A/ZtuuENUc8OAW+gHdGnDgyMQ= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= @@ -88,12 +67,12 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMb github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/Abirdcfly/dupword v0.0.9 h1:MxprGjKq3yDBICXDgEEsyGirIXfMYXkLNT/agPsE1tk= -github.com/Abirdcfly/dupword v0.0.9/go.mod h1:PzmHVLLZ27MvHSzV7eFmMXSFArWXZPZmfuuziuUrf2g= -github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= -github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= -github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= -github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= +github.com/Abirdcfly/dupword v0.0.11 h1:z6v8rMETchZXUIuHxYNmlUAuKuB21PeaSymTed16wgU= +github.com/Abirdcfly/dupword v0.0.11/go.mod h1:wH8mVGuf3CP5fsBTkfWwwwKTjDnVVCxtU8d8rgeVYXA= +github.com/Antonboom/errname v0.1.9 h1:BZDX4r3l4TBZxZ2o2LNrlGxSHran4d1u4veZdoORTT4= +github.com/Antonboom/errname v0.1.9/go.mod h1:nLTcJzevREuAsgTbG85UsuiWpMpAqbKD1HNZ29OzE58= +github.com/Antonboom/nilnil v0.1.3 h1:6RTbx3d2mcEu3Zwq9TowQpQMVpP75zugwOtqY1RTtcE= +github.com/Antonboom/nilnil v0.1.3/go.mod h1:iOov/7gRcXkeEU+EMGpBu2ORih3iyVEiWjeste1SJm8= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= @@ -111,8 +90,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rW github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= -github.com/KYVENetwork/cosmos-sdk v0.46.10-kyve-rc0 h1:RfEjHO9cbHizayDjDePTSU1SvU4ZTIJZaEU7WAsuMU8= -github.com/KYVENetwork/cosmos-sdk v0.46.10-kyve-rc0/go.mod h1:ZFL/yjcIZq67H8FiWoLCnnaChkXnbRRYEEhGrFq8fzE= +github.com/KYVENetwork/cosmos-sdk v0.46.11-kyve-rc0 h1:sZKzmsP+IyB6pyxex8YDxLImXk7n+Sy+jwEUT31Q64k= +github.com/KYVENetwork/cosmos-sdk v0.46.11-kyve-rc0/go.mod h1:bG4AkW9bqc8ycrryyKGQEl3YV9BY2wr6HggGq8kvcgM= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -157,8 +136,8 @@ github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJ github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/ashanbrown/forbidigo v1.4.0 h1:spdPbupaSqtWORq1Q4eHBoPBmHtwVyLKwaedbSLc5Sw= -github.com/ashanbrown/forbidigo v1.4.0/go.mod h1:IvgwB5Y4fzqSAj/WVXKWigoTkB0dzI2FBbpKWuh7ph8= +github.com/ashanbrown/forbidigo v1.5.1 h1:WXhzLjOlnuDYPYQo/eFlcFMi8X/kLfvWLYu6CSoebis= +github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= @@ -194,10 +173,10 @@ github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+Wji github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= -github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= -github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= -github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= -github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= +github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= +github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= +github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= +github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= @@ -239,10 +218,10 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= -github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 h1:cy5GCEZLUCshCGCRRUjxHrDUqkB4l5cuUt3ShEckQEo= -github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348/go.mod h1:f/miWtG3SSuTxKsNK3o58H1xl+XV6ZIfbC6p7lPPB8U= +github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= +github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= +github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= +github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -258,12 +237,6 @@ github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3h github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -271,6 +244,10 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= +github.com/cometbft/cometbft v0.34.27 h1:ri6BvmwjWR0gurYjywcBqRe4bbwc3QVs9KRcCzgh/J0= +github.com/cometbft/cometbft v0.34.27/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw= +github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= +github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -311,8 +288,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/daixiang0/gci v0.9.1 h1:jBrwBmBZTDsGsXiaCTLIe9diotp1X4X64zodFrh7l+c= -github.com/daixiang0/gci v0.9.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= +github.com/daixiang0/gci v0.10.1 h1:eheNA3ljF6SxnPD/vE4lCBusVHmV3Rs3dkKvFrJ7MR0= +github.com/daixiang0/gci v0.10.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= @@ -369,10 +346,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= @@ -385,8 +358,8 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= -github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= @@ -416,8 +389,8 @@ github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-critic/go-critic v0.6.7 h1:1evPrElnLQ2LZtJfmNDzlieDhjnq36SLgNzisx06oPM= -github.com/go-critic/go-critic v0.6.7/go.mod h1:fYZUijFdcnxgx6wPjQA2QEjIRaNCT0gO8bhexy6/QmE= +github.com/go-critic/go-critic v0.7.0 h1:tqbKzB8pqi0NsRZ+1pyU4aweAF7A7QN0Pi4Q02+rYnQ= +github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUeclsyBRwMa38v64= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -454,9 +427,8 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= -github.com/go-toolsmith/astcopy v1.0.3 h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0= -github.com/go-toolsmith/astcopy v1.0.3/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= -github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= +github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= +github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= @@ -464,7 +436,7 @@ github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsO github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= +github.com/go-toolsmith/pkgload v1.2.2 h1:0CtmHq/02QhxcF7E9N5LIFcYFsMR5rdovfqTtRKkgIk= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= @@ -508,9 +480,7 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -527,7 +497,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -542,8 +511,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.51.2 h1:yIcsT1X9ZYHdSpeWXRT1ORC/FPGSqDHbHsu9uk4FK7M= -github.com/golangci/golangci-lint v1.51.2/go.mod h1:KH9Q7/3glwpYSknxUgUyLlAv46A8fsSKo1hH2wDvkr8= +github.com/golangci/golangci-lint v1.52.1 h1:TwQtQi5dGE/uFOxYGKwddJo7T9sHsRfTUN00HZMl5Jo= +github.com/golangci/golangci-lint v1.52.1/go.mod h1:wlTh+d/oVlgZC2yCe6nlxrxNAnuhEQC0Zdygoh72Uak= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= @@ -557,8 +526,8 @@ github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSW github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -572,7 +541,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -586,7 +554,6 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -599,11 +566,6 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -611,21 +573,12 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= @@ -642,11 +595,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= -github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= @@ -746,8 +696,6 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/informalsystems/tendermint v0.34.26 h1:89XvVexAy62geGWxmDmdmmJvfindx+Su2oTuwfSWMeU= -github.com/informalsystems/tendermint v0.34.26/go.mod h1:q3uAZ/t5+MblQhFuHSd4flqaLDx7iUtWpwWbwvHAFhs= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -787,8 +735,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/junk1tm/musttag v0.4.5 h1:d+mpJ1vn6WFEVKHwkgJiIedis1u/EawKOuUTygAUtCo= -github.com/junk1tm/musttag v0.4.5/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= +github.com/junk1tm/musttag v0.5.0 h1:bV1DTdi38Hi4pG4OVWa7Kap0hi0o7EczuK6wQt9zPOM= +github.com/junk1tm/musttag v0.5.0/go.mod h1:PcR7BA+oREQYvHwgjIDmw3exJeds5JzRcvEJTfjrA0M= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -796,8 +744,8 @@ github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= -github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= +github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= +github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= @@ -858,10 +806,10 @@ github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYt github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= -github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= -github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= +github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= @@ -895,8 +843,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.2.5 h1:UF9AR8pOAuwNmhXj2odp4mxv9Nx2qUIwVz8ZsU+Mbec= -github.com/mgechev/revive v1.2.5/go.mod h1:nFOXent79jMTISAfOAasKfy0Z2Ejq0WX7Qn/KAdYopI= +github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= +github.com/mgechev/revive v1.3.1/go.mod h1:YlD6TTWl2B8A103R9KWJSPVI9DrEf+oqr15q21Ld+5I= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= @@ -926,8 +874,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= -github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= +github.com/moricho/tparallel v0.3.0 h1:8dDx3S3e+jA+xiQXC7O3dvfRTe/J+FYlTDDW01Y7z/Q= +github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= @@ -954,8 +902,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.8.1 h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuYs02q1c= -github.com/nunnatsa/ginkgolinter v0.8.1/go.mod h1:FYYLtszIdmzCH8XMaMPyxPVXZ7VCaIm55bA+gugx+14= +github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= +github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= @@ -1029,8 +977,8 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.1.0 h1:VKoEFg5yxSgJ2yFPVhxW7oGz+f8/OVcuMeNvcPIi6Eg= -github.com/polyfloyd/go-errorlint v1.1.0/go.mod h1:Uss7Bc/izYG0leCMRx3WVlrpqWedSZk7V/FUQW6VJ6U= +github.com/polyfloyd/go-errorlint v1.4.0 h1:b+sQ5HibPIAjEZwtuwU8Wz/u0dMZ7YL+bk+9yWyHVJk= +github.com/polyfloyd/go-errorlint v1.4.0/go.mod h1:qJCkPeBn+0EXkdKTrUCcuFStM2xrDKfxI3MGLXPexUs= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -1077,8 +1025,8 @@ github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZy github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1150,8 +1098,8 @@ github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl01 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= -github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= +github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= +github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= @@ -1201,16 +1149,18 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= -github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= -github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= +github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= @@ -1230,15 +1180,15 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo= github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= -github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= -github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= +github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= +github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.8.0 h1:qDzbir0xmoE+aNxGCPrn+rUSxAX+nG6vREgbbXAR81I= -github.com/tomarrell/wrapcheck/v2 v2.8.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= +github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= @@ -1302,7 +1252,6 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1319,8 +1268,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= -go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1364,8 +1313,9 @@ golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8H golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 h1:6WHiuFL9FNjg8RljAaT7FNUuKDbvMqS1i5cr2OE2sLQ= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= +golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1380,7 +1330,6 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1397,8 +1346,9 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1446,9 +1396,7 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1456,18 +1404,14 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1477,17 +1421,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1501,7 +1436,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1566,48 +1500,27 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1617,8 +1530,9 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1626,8 +1540,9 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1640,8 +1555,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1654,9 +1570,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1684,7 +1598,6 @@ golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1697,19 +1610,16 @@ golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1724,9 +1634,6 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= @@ -1736,15 +1643,13 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -1773,27 +1678,6 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= google.golang.org/api v0.102.0 h1:JxJl2qQ85fRMPNvlZY/enexbxpCjLwGhZUtgfGeQ51I= google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -1848,53 +1732,9 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1919,23 +1759,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1948,8 +1773,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk= google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1997,8 +1820,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -honnef.co/go/tools v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc= -honnef.co/go/tools v0.4.2/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= +honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= +honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= diff --git a/proto/kyve/bundles/v1beta1/params.proto b/proto/kyve/bundles/v1beta1/params.proto index e2f2d93d..b31a4d25 100644 --- a/proto/kyve/bundles/v1beta1/params.proto +++ b/proto/kyve/bundles/v1beta1/params.proto @@ -16,7 +16,10 @@ message Params { (gogoproto.nullable) = false ]; // network_fee ... - string network_fee = 3; + string network_fee = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // max_points ... uint64 max_points = 4; } diff --git a/proto/kyve/delegation/v1beta1/params.proto b/proto/kyve/delegation/v1beta1/params.proto index 1cf3053b..86ff72de 100644 --- a/proto/kyve/delegation/v1beta1/params.proto +++ b/proto/kyve/delegation/v1beta1/params.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kyve.delegation.v1beta1; +import "gogoproto/gogo.proto"; + option go_package = "github.com/KYVENetwork/chain/x/delegation/types"; // Params defines the delegation module parameters. @@ -13,9 +15,18 @@ message Params { // unbonding_delegation_time ... uint64 redelegation_max_amount = 3; // vote_slash ... - string vote_slash = 4; + string vote_slash = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // upload_slash ... - string upload_slash = 5; + string upload_slash = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // timeout_slash ... - string timeout_slash = 6; + string timeout_slash = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } diff --git a/proto/kyve/query/v1beta1/query.proto b/proto/kyve/query/v1beta1/query.proto index 88fa9dfb..04be74af 100644 --- a/proto/kyve/query/v1beta1/query.proto +++ b/proto/kyve/query/v1beta1/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package kyve.query.v1beta1; +import "gogoproto/gogo.proto"; import "kyve/pool/v1beta1/pool.proto"; option go_package = "github.com/KYVENetwork/chain/x/query/types"; @@ -94,7 +95,10 @@ message StakerMetadata { // commission is the percentage of the rewards that will // get transferred to the staker before the remaining // rewards are split across all delegators - string commission = 1; + string commission = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // moniker is a human-readable name for displaying // the staker in the UI @@ -119,7 +123,10 @@ message StakerMetadata { message CommissionChangeEntry { // commission is the new commission that will // become active once the change-time is over - string commission = 1; + string commission = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // creation_date is the UNIX-timestamp (in seconds) // of when the entry was created. diff --git a/proto/kyve/stakers/v1beta1/events.proto b/proto/kyve/stakers/v1beta1/events.proto index 47a68197..5bc47f03 100644 --- a/proto/kyve/stakers/v1beta1/events.proto +++ b/proto/kyve/stakers/v1beta1/events.proto @@ -46,7 +46,10 @@ message EventUpdateCommission { // staker is the account address of the protocol node. string staker = 1; // commission ... - string commission = 2; + string commission = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } // EventJoinPool ... diff --git a/proto/kyve/stakers/v1beta1/stakers.proto b/proto/kyve/stakers/v1beta1/stakers.proto index 66ac6513..bc7c85fd 100644 --- a/proto/kyve/stakers/v1beta1/stakers.proto +++ b/proto/kyve/stakers/v1beta1/stakers.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kyve.stakers.v1beta1; +import "gogoproto/gogo.proto"; + option go_package = "github.com/KYVENetwork/chain/x/stakers/types"; // Staker contains all metadata for a staker @@ -10,7 +12,10 @@ message Staker { // address ... string address = 1; // commission ... - string commission = 2; + string commission = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // moniker ... string moniker = 3; // website ... @@ -50,7 +55,10 @@ message CommissionChangeEntry { string staker = 2; // commission is the new commission which will // be applied after the waiting time is over. - string commission = 3; + string commission = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // creation_date is the UNIX-timestamp in seconds // when the entry was created. int64 creation_date = 4; diff --git a/proto/kyve/stakers/v1beta1/tx.proto b/proto/kyve/stakers/v1beta1/tx.proto index 729f36ae..cda550d1 100644 --- a/proto/kyve/stakers/v1beta1/tx.proto +++ b/proto/kyve/stakers/v1beta1/tx.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package kyve.stakers.v1beta1; import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/KYVENetwork/chain/x/stakers/types"; @@ -55,7 +56,10 @@ message MsgUpdateCommission { // creator ... string creator = 1; // commission ... - string commission = 2; + string commission = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } // MsgUpdateCommissionResponse ... diff --git a/util/validate.go b/util/validate.go index b218e277..3314ed3b 100644 --- a/util/validate.go +++ b/util/validate.go @@ -3,33 +3,45 @@ package util import ( "fmt" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) -func ValidateUint64(v interface{}) error { - _, ok := v.(uint64) +func ValidateDecimal(i interface{}) error { + v, ok := i.(sdk.Dec) if !ok { - return fmt.Errorf("invalid parameter type: %T", v) + return fmt.Errorf("invalid type: %T", i) + } + + if v.IsNil() || v.IsNegative() { + return fmt.Errorf("invalid decimal: %s", v) } + return nil } -func ValidatePercentage(v interface{}) error { - val, ok := v.(string) +func ValidateNumber(i interface{}) error { + v, ok := i.(uint64) if !ok { - return fmt.Errorf("invalid parameter type: %T", v) + return fmt.Errorf("invalid type: %T", i) } - parsedVal, err := sdk.NewDecFromStr(val) - if err != nil { - return fmt.Errorf("invalid decimal representation: %T", v) + if math.NewIntFromUint64(v).IsNil() || math.NewIntFromUint64(v).IsNegative() { + return fmt.Errorf("invalid number: %d", v) } - if parsedVal.LT(sdk.NewDec(0)) { - return fmt.Errorf("percentage should be greater than or equal to 0") + return nil +} + +func ValidatePercentage(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid type: %T", i) } - if parsedVal.GT(sdk.NewDec(1)) { - return fmt.Errorf("percentage should be less than or equal to 1") + + if v.IsNil() || v.IsNegative() || v.GT(sdk.OneDec()) { + return fmt.Errorf("invalid percentage: %s", v) } return nil diff --git a/x/bundles/keeper/getters_params.go b/x/bundles/keeper/getters_params.go index 825ce6c7..ffe082e3 100644 --- a/x/bundles/keeper/getters_params.go +++ b/x/bundles/keeper/getters_params.go @@ -29,7 +29,7 @@ func (k Keeper) GetStorageCost(ctx sdk.Context) (res sdk.Dec) { } // GetNetworkFee returns the NetworkFee param -func (k Keeper) GetNetworkFee(ctx sdk.Context) (res string) { +func (k Keeper) GetNetworkFee(ctx sdk.Context) (res sdk.Dec) { return k.GetParams(ctx).NetworkFee } diff --git a/x/bundles/keeper/keeper.go b/x/bundles/keeper/keeper.go index 59c40483..69d0b6cb 100644 --- a/x/bundles/keeper/keeper.go +++ b/x/bundles/keeper/keeper.go @@ -25,7 +25,6 @@ type ( poolKeeper types.PoolKeeper stakerKeeper types.StakerKeeper delegationKeeper types.DelegationKeeper - upgradeKeeper types.UpgradeKeeper } ) @@ -42,7 +41,6 @@ func NewKeeper( poolKeeper types.PoolKeeper, stakerKeeper types.StakerKeeper, delegationKeeper types.DelegationKeeper, - upgradeKeeper types.UpgradeKeeper, ) *Keeper { return &Keeper{ cdc: cdc, diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index 2bdb65b0..8dfc69c4 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -196,7 +196,7 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) // calculate uploader slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetUploadSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetUploadSlash(s.Ctx()) slashAmount := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(100*i.KYVE - slashAmount)) @@ -338,7 +338,7 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) // calculate uploader slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetUploadSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetUploadSlash(s.Ctx()) slashAmountUploader := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) slashAmountDelegator := uint64(sdk.NewDec(int64(300 * i.KYVE)).Mul(fraction).TruncateInt64()) @@ -510,7 +510,7 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) // calculate uploader slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetUploadSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetUploadSlash(s.Ctx()) slashAmountUploader := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) slashAmountDelegator1 := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) @@ -518,7 +518,7 @@ var _ = Describe("invalid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.ALICE)).To(Equal(100*i.KYVE - slashAmountDelegator1)) // calculate voter slashes - fraction, _ = sdk.NewDecFromStr(s.App().DelegationKeeper.GetVoteSlash(s.Ctx())) + fraction = s.App().DelegationKeeper.GetVoteSlash(s.Ctx()) slashAmountVoter := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) slashAmountDelegator2 := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) diff --git a/x/bundles/keeper/keeper_suite_points_test.go b/x/bundles/keeper/keeper_suite_points_test.go index 3e44a2b2..0fe53c3f 100644 --- a/x/bundles/keeper/keeper_suite_points_test.go +++ b/x/bundles/keeper/keeper_suite_points_test.go @@ -310,7 +310,7 @@ var _ = Describe("points", Ordered, func() { Expect(valaccountFound).To(BeFalse()) // check if voter got slashed - slashAmountRatio, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx())) + slashAmountRatio := s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx()) expectedBalance := 50*i.KYVE - uint64(sdk.NewDec(int64(50*i.KYVE)).Mul(slashAmountRatio).TruncateInt64()) Expect(expectedBalance).To(Equal(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1))) diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index 99707ca3..213799ba 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -218,13 +218,12 @@ var _ = Describe("stakers leave", Ordered, func() { balanceUploader := s.GetBalanceFromAddress(i.STAKER_0) totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer @@ -309,7 +308,7 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(valaccountFound).To(BeFalse()) // check if next uploader got slashed - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetUploadSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetUploadSlash(s.Ctx()) slashAmount := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(100*i.KYVE - slashAmount)) @@ -402,7 +401,7 @@ var _ = Describe("stakers leave", Ordered, func() { Expect(valaccountFound).To(BeFalse()) // check if voter got slashed - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetVoteSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetVoteSlash(s.Ctx()) slashAmount := uint64(sdk.NewDec(int64(50 * i.KYVE)).Mul(fraction).TruncateInt64()) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(Equal(50*i.KYVE - slashAmount)) diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 74188ab8..82948132 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -179,13 +179,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer @@ -295,13 +294,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward // divide with 4 because uploader only has 25% of total delegation @@ -444,13 +442,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward // assert payout transfer @@ -599,13 +596,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward // divide with 4 because uploader only has 25% of total delegation @@ -759,13 +755,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward // divide with 4 because uploader only has 25% of total delegation @@ -927,13 +922,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward // divide with 4 because uploader only has 25% of total delegation @@ -1084,7 +1078,7 @@ var _ = Describe("valid bundles", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), valaccountUploader.Staker) // calculate voter slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetVoteSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetVoteSlash(s.Ctx()) slashAmountVoter := uint64(sdk.NewDec(int64(200 * i.KYVE)).Mul(fraction).TruncateInt64()) slashAmountDelegator := uint64(sdk.NewDec(int64(100 * i.KYVE)).Mul(fraction).TruncateInt64()) @@ -1105,13 +1099,12 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) - commission, _ := sdk.NewDecFromStr(uploader.Commission) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward - uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(commission).TruncateInt64()) + uploaderPayoutReward := uint64(sdk.NewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) totalDelegationReward := totalUploaderReward - uploaderPayoutReward // divide with 4 because uploader only has 25% of total delegation diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index 432e4464..e4d2c634 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -234,7 +234,7 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_0)) // calculate voter slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetVoteSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetVoteSlash(s.Ctx()) slashAmountVoter := uint64(sdk.NewDec(int64(0 * i.KYVE)).Mul(fraction).TruncateInt64()) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1)).To(Equal(0*i.KYVE - slashAmountVoter)) @@ -385,7 +385,7 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards totalReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx()).MulInt64(100).TruncateInt64()) + pool.OperatingCost - networkFee, _ := sdk.NewDecFromStr(s.App().BundlesKeeper.GetNetworkFee(s.Ctx())) + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) treasuryReward := uint64(sdk.NewDec(int64(totalReward)).Mul(networkFee).TruncateInt64()) totalUploaderReward := totalReward - treasuryReward @@ -529,7 +529,7 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeZero()) // calculate uploader slashes - fraction, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetUploadSlash(s.Ctx())) + fraction := s.App().DelegationKeeper.GetUploadSlash(s.Ctx()) slashAmount := uint64(sdk.NewDec(int64(0 * i.KYVE)).Mul(fraction).TruncateInt64()) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(0*i.KYVE - slashAmount)) @@ -643,7 +643,7 @@ var _ = Describe("valid bundles", Ordered, func() { Expect(valaccountFound).To(BeFalse()) // check if voter got slashed - slashAmountRatio, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx())) + slashAmountRatio := s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx()) expectedBalance := 0*i.KYVE - uint64(sdk.NewDec(int64(0*i.KYVE)).Mul(slashAmountRatio).TruncateInt64()) Expect(expectedBalance).To(Equal(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1))) diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index 2d6d1691..93b84763 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -238,12 +238,8 @@ func (k Keeper) calculatePayouts(ctx sdk.Context, poolId uint64) (bundleReward t // formula for calculating the rewards bundleReward.Total = pool.OperatingCost + uint64(k.GetStorageCost(ctx).MulInt64(int64(bundleProposal.DataSize)).TruncateInt64()) - networkFee, err := sdk.NewDecFromStr(k.GetNetworkFee(ctx)) - if err != nil { - util.PanicHalt(k.upgradeKeeper, ctx, "Network Fee unparasable - "+k.GetNetworkFee(ctx)) - } // Add fee to treasury - bundleReward.Treasury = uint64(sdk.NewDec(int64(bundleReward.Total)).Mul(networkFee).TruncateInt64()) + bundleReward.Treasury = uint64(sdk.NewDec(int64(bundleReward.Total)).Mul(k.GetNetworkFee(ctx)).TruncateInt64()) // Remaining rewards to be split between staker and its delegators totalNodeReward := bundleReward.Total - bundleReward.Treasury diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index d1d97f63..06a3c019 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -537,7 +537,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(s.App().DelegationKeeper.GetDelegationOfPool(s.Ctx(), 0)).To(Equal(100 * i.KYVE)) // check if next uploader not got slashed - slashAmountRatio, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx())) + slashAmountRatio := s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx()) expectedBalance := 50*i.KYVE - uint64(sdk.NewDec(int64(50*i.KYVE)).Mul(slashAmountRatio).TruncateInt64()) Expect(expectedBalance).To(Equal(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_1, i.STAKER_1))) @@ -986,7 +986,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(s.App().DelegationKeeper.GetDelegationOfPool(s.Ctx(), 1)).To(Equal(100 * i.KYVE)) // check if next uploader not got slashed - slashAmountRatio, _ := sdk.NewDecFromStr(s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx())) + slashAmountRatio := s.App().DelegationKeeper.GetTimeoutSlash(s.Ctx()) expectedBalance := 50*i.KYVE - uint64(sdk.NewDec(int64(50*i.KYVE)).Mul(slashAmountRatio).TruncateInt64()) Expect(expectedBalance).To(Equal(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_2, i.STAKER_2))) diff --git a/x/bundles/keeper/msg_server_update_params_test.go b/x/bundles/keeper/msg_server_update_params_test.go index 3ffc04ba..9940ebf8 100644 --- a/x/bundles/keeper/msg_server_update_params_test.go +++ b/x/bundles/keeper/msg_server_update_params_test.go @@ -139,7 +139,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.UploadTimeout).To(Equal(uint64(20))) Expect(updatedParams.StorageCost).To(Equal(sdk.MustNewDecFromStr("0.05"))) - Expect(updatedParams.NetworkFee).To(Equal("0.05")) + Expect(updatedParams.NetworkFee).To(Equal(sdk.MustNewDecFromStr("0.05"))) Expect(updatedParams.MaxPoints).To(Equal(uint64(15))) }) @@ -385,7 +385,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.UploadTimeout).To(Equal(types.DefaultUploadTimeout)) Expect(updatedParams.StorageCost).To(Equal(types.DefaultStorageCost)) - Expect(updatedParams.NetworkFee).To(Equal("0.05")) + Expect(updatedParams.NetworkFee).To(Equal(sdk.MustNewDecFromStr("0.05"))) Expect(updatedParams.MaxPoints).To(Equal(types.DefaultMaxPoints)) }) diff --git a/x/bundles/types/params.go b/x/bundles/types/params.go index dc7992a4..9b3d2877 100644 --- a/x/bundles/types/params.go +++ b/x/bundles/types/params.go @@ -1,8 +1,6 @@ package types import ( - "fmt" - "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -14,7 +12,7 @@ var DefaultUploadTimeout = uint64(600) var DefaultStorageCost = sdk.MustNewDecFromStr("0.025") // DefaultNetworkFee ... -var DefaultNetworkFee = "0.01" +var DefaultNetworkFee = sdk.MustNewDecFromStr("0.01") // DefaultMaxPoints ... var DefaultMaxPoints = uint64(24) @@ -23,7 +21,7 @@ var DefaultMaxPoints = uint64(24) func NewParams( uploadTimeout uint64, storageCost sdk.Dec, - networkFee string, + networkFee sdk.Dec, maxPoints uint64, ) Params { return Params{ @@ -46,11 +44,11 @@ func DefaultParams() Params { // Validate validates the set of params func (p Params) Validate() error { - if err := util.ValidateUint64(p.UploadTimeout); err != nil { + if err := util.ValidateNumber(p.UploadTimeout); err != nil { return err } - if err := validateStorageCost(p.StorageCost); err != nil { + if err := util.ValidateDecimal(p.StorageCost); err != nil { return err } @@ -58,28 +56,9 @@ func (p Params) Validate() error { return err } - if err := util.ValidateUint64(p.MaxPoints); err != nil { + if err := util.ValidateNumber(p.MaxPoints); err != nil { return err } return nil } - -// validateStorageCost ... -func validateStorageCost(i interface{}) error { - v, ok := i.(sdk.Dec) - - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNil() { - return fmt.Errorf("invalid parameter: nil") - } - - if v.IsNegative() { - return fmt.Errorf("value cannot be negative: %s", i) - } - - return nil -} diff --git a/x/bundles/types/params.pb.go b/x/bundles/types/params.pb.go index 0a2382ff..7cff9951 100644 --- a/x/bundles/types/params.pb.go +++ b/x/bundles/types/params.pb.go @@ -31,7 +31,7 @@ type Params struct { // storage_cost ... StorageCost github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=storage_cost,json=storageCost,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"storage_cost"` // network_fee ... - NetworkFee string `protobuf:"bytes,3,opt,name=network_fee,json=networkFee,proto3" json:"network_fee,omitempty"` + NetworkFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=network_fee,json=networkFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"network_fee"` // max_points ... MaxPoints uint64 `protobuf:"varint,4,opt,name=max_points,json=maxPoints,proto3" json:"max_points,omitempty"` } @@ -76,13 +76,6 @@ func (m *Params) GetUploadTimeout() uint64 { return 0 } -func (m *Params) GetNetworkFee() string { - if m != nil { - return m.NetworkFee - } - return "" -} - func (m *Params) GetMaxPoints() uint64 { if m != nil { return m.MaxPoints @@ -97,26 +90,26 @@ func init() { func init() { proto.RegisterFile("kyve/bundles/v1beta1/params.proto", fileDescriptor_cfd3a74b72a01aaa) } var fileDescriptor_cfd3a74b72a01aaa = []byte{ - // 298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4b, 0xc3, 0x30, - 0x18, 0x86, 0x1b, 0x1d, 0x83, 0x65, 0xea, 0xa1, 0xec, 0x50, 0x04, 0xb3, 0x29, 0x28, 0x3b, 0x68, - 0xc2, 0xf0, 0x1f, 0x4c, 0xdd, 0x45, 0x90, 0x39, 0x44, 0xd0, 0x4b, 0x49, 0xbb, 0xcf, 0xae, 0x6c, - 0xe9, 0x57, 0x9a, 0x74, 0x6e, 0xff, 0xc2, 0xdf, 0xe4, 0x69, 0xc7, 0x1d, 0xc5, 0xc3, 0x90, 0xed, - 0x8f, 0x48, 0xd3, 0x22, 0x9e, 0x12, 0x1e, 0x9e, 0xef, 0xe5, 0xe5, 0xa5, 0xa7, 0xd3, 0xe5, 0x1c, - 0x44, 0x90, 0x27, 0xe3, 0x19, 0x68, 0x31, 0xef, 0x05, 0x60, 0x64, 0x4f, 0xa4, 0x32, 0x93, 0x4a, - 0xf3, 0x34, 0x43, 0x83, 0x6e, 0xab, 0x50, 0x78, 0xa5, 0xf0, 0x4a, 0x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xff, 0xff, 0xc8, 0x63, 0x93, 0xce, 0x64, 0x01, 0x00, 0x00, + // 300 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, + 0x1c, 0xc6, 0x1b, 0x1d, 0x83, 0x65, 0xea, 0xa1, 0xec, 0x50, 0x04, 0xb3, 0x29, 0x28, 0x3b, 0x68, + 0xc2, 0xf0, 0x0d, 0xa6, 0xee, 0x22, 0xe8, 0x1c, 0x22, 0xe8, 0xa5, 0xa4, 0xdd, 0xdf, 0xae, 0x6c, + 0xe9, 0xbf, 0x34, 0xe9, 0xdc, 0xde, 0xc2, 0xc7, 0xda, 0x71, 0x47, 0xf1, 0x30, 0x64, 0x7b, 0x03, + 0x9f, 0x40, 0x96, 0x16, 0xf1, 0xec, 0x29, 0xe1, 0xe3, 0x97, 0xdf, 0x47, 0x3e, 0x7a, 0x3c, 0x9e, + 0x4f, 0x41, 0x04, 0x79, 0x32, 0x9c, 0x80, 0x16, 0xd3, 0x4e, 0x00, 0x46, 0x76, 0x44, 0x2a, 0x33, + 0xa9, 0x34, 0x4f, 0x33, 0x34, 0xe8, 0x36, 0xb6, 0x08, 0x2f, 0x11, 0x5e, 0x22, 0x87, 0x8d, 0x08, + 0x23, 0xb4, 0x80, 0xd8, 0xde, 0x0a, 0xf6, 0xe4, 0x9b, 0xd0, 0x6a, 0xdf, 0x3e, 0x76, 0x4f, 0xe9, + 0x41, 0x9e, 0x4e, 0x50, 0x0e, 0x7d, 0x13, 0x2b, 0xc0, 0xdc, 0x78, 0xa4, 0x45, 0xda, 0x95, 0xc1, + 0x7e, 0x91, 0x3e, 0x16, 0xa1, 0xfb, 0x40, 0xf7, 0xb4, 0xc1, 0x4c, 0x46, 0xe0, 0x87, 0xa8, 0x8d, + 0xb7, 0xd3, 0x22, 0xed, 0x5a, 0x97, 0x2f, 0x56, 0x4d, 0xe7, 0x73, 0xd5, 0x3c, 0x8b, 0x62, 0x33, + 0xca, 0x03, 0x1e, 0xa2, 0x12, 0x21, 0x6a, 0x85, 0xba, 0x3c, 0x2e, 0xf4, 0x70, 0x2c, 0xcc, 0x3c, + 0x05, 0xcd, 0xaf, 0x21, 0x1c, 0xd4, 0x4b, 0xc7, 0x15, 0x6a, 0xe3, 0xde, 0xd3, 0x7a, 0x02, 0xe6, + 0x0d, 0xb3, 0xb1, 0xff, 0x0a, 0xe0, 0xed, 0xfe, 0xcb, 0x48, 0x4b, 0x45, 0x0f, 0xc0, 0x3d, 0xa2, + 0x54, 0xc9, 0x99, 0x9f, 0x62, 0x9c, 0x18, 0xed, 0x55, 0xec, 0x37, 0x6a, 0x4a, 0xce, 0xfa, 0x36, + 0xe8, 0xf6, 0x16, 0x6b, 0x46, 0x96, 0x6b, 0x46, 0xbe, 0xd6, 0x8c, 0xbc, 0x6f, 0x98, 0xb3, 0xdc, + 0x30, 0xe7, 0x63, 0xc3, 0x9c, 0x97, 0xf3, 0x3f, 0x65, 0xb7, 0xcf, 0x4f, 0x37, 0x77, 0x85, 0x53, + 0x84, 0x23, 0x19, 0x27, 0x62, 0xf6, 0xbb, 0xbb, 0xad, 0x0d, 0xaa, 0x76, 0xc3, 0xcb, 0x9f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x7b, 0x35, 0x55, 0xa9, 0x94, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -144,13 +137,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.NetworkFee) > 0 { - i -= len(m.NetworkFee) - copy(dAtA[i:], m.NetworkFee) - i = encodeVarintParams(dAtA, i, uint64(len(m.NetworkFee))) - i-- - dAtA[i] = 0x1a + { + size := m.NetworkFee.Size() + i -= size + if _, err := m.NetworkFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a { size := m.StorageCost.Size() i -= size @@ -191,10 +187,8 @@ func (m *Params) Size() (n int) { } l = m.StorageCost.Size() n += 1 + l + sovParams(uint64(l)) - l = len(m.NetworkFee) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } + l = m.NetworkFee.Size() + n += 1 + l + sovParams(uint64(l)) if m.MaxPoints != 0 { n += 1 + sovParams(uint64(m.MaxPoints)) } @@ -319,7 +313,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NetworkFee = string(dAtA[iNdEx:postIndex]) + if err := m.NetworkFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 0 { diff --git a/x/delegation/keeper/getters_params.go b/x/delegation/keeper/getters_params.go index 4099ba44..2c315b77 100644 --- a/x/delegation/keeper/getters_params.go +++ b/x/delegation/keeper/getters_params.go @@ -34,17 +34,17 @@ func (k Keeper) GetRedelegationMaxAmount(ctx sdk.Context) (res uint64) { } // GetVoteSlash returns the VoteSlash param -func (k Keeper) GetVoteSlash(ctx sdk.Context) (res string) { +func (k Keeper) GetVoteSlash(ctx sdk.Context) (res sdk.Dec) { return k.GetParams(ctx).VoteSlash } // GetUploadSlash returns the UploadSlash param -func (k Keeper) GetUploadSlash(ctx sdk.Context) (res string) { +func (k Keeper) GetUploadSlash(ctx sdk.Context) (res sdk.Dec) { return k.GetParams(ctx).UploadSlash } // GetTimeoutSlash returns the TimeoutSlash param -func (k Keeper) GetTimeoutSlash(ctx sdk.Context) (res string) { +func (k Keeper) GetTimeoutSlash(ctx sdk.Context) (res sdk.Dec) { return k.GetParams(ctx).TimeoutSlash } @@ -52,11 +52,11 @@ func (k Keeper) getSlashFraction(ctx sdk.Context, slashType types.SlashType) (sl // Retrieve slash fraction from params switch slashType { case types.SLASH_TYPE_TIMEOUT: - slashAmountRatio, _ = sdk.NewDecFromStr(k.GetTimeoutSlash(ctx)) + slashAmountRatio = k.GetTimeoutSlash(ctx) case types.SLASH_TYPE_VOTE: - slashAmountRatio, _ = sdk.NewDecFromStr(k.GetVoteSlash(ctx)) + slashAmountRatio = k.GetVoteSlash(ctx) case types.SLASH_TYPE_UPLOAD: - slashAmountRatio, _ = sdk.NewDecFromStr(k.GetUploadSlash(ctx)) + slashAmountRatio = k.GetUploadSlash(ctx) } return } diff --git a/x/delegation/keeper/msg_server_undelegate_test.go b/x/delegation/keeper/msg_server_undelegate_test.go index 93cabec4..7c2225c1 100644 --- a/x/delegation/keeper/msg_server_undelegate_test.go +++ b/x/delegation/keeper/msg_server_undelegate_test.go @@ -2,6 +2,7 @@ package keeper_test import ( pooltypes "github.com/KYVENetwork/chain/x/pool/types" + sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -244,7 +245,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { }) params := s.App().DelegationKeeper.GetParams(s.Ctx()) - params.UploadSlash = "0.1" + params.UploadSlash = sdk.MustNewDecFromStr("0.1") s.App().DelegationKeeper.SetParams(s.Ctx(), params) s.App().DelegationKeeper.SlashDelegators(s.Ctx(), 0, i.ALICE, types.SLASH_TYPE_UPLOAD) @@ -413,7 +414,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { // Slash 10% params := s.App().DelegationKeeper.GetParams(s.Ctx()) - params.UploadSlash = "0.1" + params.UploadSlash = sdk.MustNewDecFromStr("0.1") s.App().DelegationKeeper.SetParams(s.Ctx(), params) s.App().DelegationKeeper.SlashDelegators(s.Ctx(), 0, i.ALICE, types.SLASH_TYPE_UPLOAD) @@ -464,7 +465,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { }) params := s.App().DelegationKeeper.GetParams(s.Ctx()) - params.UploadSlash = "0.5" + params.UploadSlash = sdk.MustNewDecFromStr("0.5") s.App().DelegationKeeper.SetParams(s.Ctx(), params) s.PerformValidityChecks() @@ -512,7 +513,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { // ACT params := s.App().DelegationKeeper.GetParams(s.Ctx()) - params.UploadSlash = "0.5" + params.UploadSlash = sdk.MustNewDecFromStr("0.5") s.App().DelegationKeeper.SetParams(s.Ctx(), params) // Slash 50% twice @@ -557,7 +558,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { // ACT params := s.App().DelegationKeeper.GetParams(s.Ctx()) - params.UploadSlash = "0.5" + params.UploadSlash = sdk.MustNewDecFromStr("0.5") s.App().DelegationKeeper.SetParams(s.Ctx(), params) s.App().DelegationKeeper.SlashDelegators(s.Ctx(), 0, i.ALICE, types.SLASH_TYPE_UPLOAD) s.App().DelegationKeeper.SlashDelegators(s.Ctx(), 0, i.ALICE, types.SLASH_TYPE_UPLOAD) diff --git a/x/delegation/keeper/msg_server_update_params_test.go b/x/delegation/keeper/msg_server_update_params_test.go index caa8990c..f6a2f702 100644 --- a/x/delegation/keeper/msg_server_update_params_test.go +++ b/x/delegation/keeper/msg_server_update_params_test.go @@ -152,9 +152,9 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.UnbondingDelegationTime).To(Equal(uint64(3600))) Expect(updatedParams.RedelegationCooldown).To(Equal(uint64(3600))) Expect(updatedParams.RedelegationMaxAmount).To(Equal(uint64(1))) - Expect(updatedParams.VoteSlash).To(Equal("0.05")) - Expect(updatedParams.UploadSlash).To(Equal("0.05")) - Expect(updatedParams.TimeoutSlash).To(Equal("0.05")) + Expect(updatedParams.VoteSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) + Expect(updatedParams.UploadSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) + Expect(updatedParams.TimeoutSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) }) It("Update no param", func() { @@ -488,7 +488,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.RedelegationMaxAmount).To(Equal(types.DefaultRedelegationMaxAmount)) Expect(updatedParams.UploadSlash).To(Equal(types.DefaultUploadSlash)) Expect(updatedParams.TimeoutSlash).To(Equal(types.DefaultTimeoutSlash)) - Expect(updatedParams.VoteSlash).To(Equal("0.05")) + Expect(updatedParams.VoteSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) }) It("Update vote slash with invalid value", func() { @@ -561,7 +561,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.UnbondingDelegationTime).To(Equal(types.DefaultUnbondingDelegationTime)) Expect(updatedParams.RedelegationCooldown).To(Equal(types.DefaultRedelegationCooldown)) Expect(updatedParams.RedelegationMaxAmount).To(Equal(types.DefaultRedelegationMaxAmount)) - Expect(updatedParams.UploadSlash).To(Equal("0.05")) + Expect(updatedParams.UploadSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) Expect(updatedParams.TimeoutSlash).To(Equal(types.DefaultTimeoutSlash)) Expect(updatedParams.VoteSlash).To(Equal(types.DefaultVoteSlash)) }) @@ -636,7 +636,7 @@ var _ = Describe("msg_server_update_params.go", Ordered, func() { Expect(updatedParams.RedelegationCooldown).To(Equal(types.DefaultRedelegationCooldown)) Expect(updatedParams.RedelegationMaxAmount).To(Equal(types.DefaultRedelegationMaxAmount)) Expect(updatedParams.UploadSlash).To(Equal(types.DefaultUploadSlash)) - Expect(updatedParams.TimeoutSlash).To(Equal("0.05")) + Expect(updatedParams.TimeoutSlash).To(Equal(sdk.MustNewDecFromStr("0.05"))) Expect(updatedParams.VoteSlash).To(Equal(types.DefaultVoteSlash)) }) diff --git a/x/delegation/types/params.go b/x/delegation/types/params.go index 6cd04f4b..fe707569 100644 --- a/x/delegation/types/params.go +++ b/x/delegation/types/params.go @@ -2,6 +2,7 @@ package types import ( "github.com/KYVENetwork/chain/util" + sdk "github.com/cosmos/cosmos-sdk/types" ) // DefaultUnbondingDelegationTime ... @@ -14,22 +15,22 @@ var DefaultRedelegationCooldown = uint64(60 * 60 * 24 * 5) var DefaultRedelegationMaxAmount = uint64(5) // DefaultVoteSlash ... -var DefaultVoteSlash = "0.1" +var DefaultVoteSlash = sdk.MustNewDecFromStr("0.1") // DefaultUploadSlash ... -var DefaultUploadSlash = "0.2" +var DefaultUploadSlash = sdk.MustNewDecFromStr("0.2") // DefaultTimeoutSlash ... -var DefaultTimeoutSlash = "0.02" +var DefaultTimeoutSlash = sdk.MustNewDecFromStr("0.02") // NewParams creates a new Params instance func NewParams( unbondingDelegationTime uint64, redelegationCooldown uint64, redelegationMaxAmount uint64, - voteSlash string, - uploadSlash string, - timeoutSlash string, + voteSlash sdk.Dec, + uploadSlash sdk.Dec, + timeoutSlash sdk.Dec, ) Params { return Params{ UnbondingDelegationTime: unbondingDelegationTime, @@ -55,15 +56,15 @@ func DefaultParams() Params { // Validate validates the set of params func (p Params) Validate() error { - if err := util.ValidateUint64(p.UnbondingDelegationTime); err != nil { + if err := util.ValidateNumber(p.UnbondingDelegationTime); err != nil { return err } - if err := util.ValidateUint64(p.RedelegationCooldown); err != nil { + if err := util.ValidateNumber(p.RedelegationCooldown); err != nil { return err } - if err := util.ValidateUint64(p.RedelegationMaxAmount); err != nil { + if err := util.ValidateNumber(p.RedelegationMaxAmount); err != nil { return err } diff --git a/x/delegation/types/params.pb.go b/x/delegation/types/params.pb.go index 89fde3a9..fffc1de2 100644 --- a/x/delegation/types/params.pb.go +++ b/x/delegation/types/params.pb.go @@ -5,6 +5,8 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -31,11 +33,11 @@ type Params struct { // unbonding_delegation_time ... RedelegationMaxAmount uint64 `protobuf:"varint,3,opt,name=redelegation_max_amount,json=redelegationMaxAmount,proto3" json:"redelegation_max_amount,omitempty"` // vote_slash ... - VoteSlash string `protobuf:"bytes,4,opt,name=vote_slash,json=voteSlash,proto3" json:"vote_slash,omitempty"` + VoteSlash github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=vote_slash,json=voteSlash,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_slash"` // upload_slash ... - UploadSlash string `protobuf:"bytes,5,opt,name=upload_slash,json=uploadSlash,proto3" json:"upload_slash,omitempty"` + UploadSlash github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=upload_slash,json=uploadSlash,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"upload_slash"` // timeout_slash ... - TimeoutSlash string `protobuf:"bytes,6,opt,name=timeout_slash,json=timeoutSlash,proto3" json:"timeout_slash,omitempty"` + TimeoutSlash github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=timeout_slash,json=timeoutSlash,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"timeout_slash"` } func (m *Params) Reset() { *m = Params{} } @@ -92,27 +94,6 @@ func (m *Params) GetRedelegationMaxAmount() uint64 { return 0 } -func (m *Params) GetVoteSlash() string { - if m != nil { - return m.VoteSlash - } - return "" -} - -func (m *Params) GetUploadSlash() string { - if m != nil { - return m.UploadSlash - } - return "" -} - -func (m *Params) GetTimeoutSlash() string { - if m != nil { - return m.TimeoutSlash - } - return "" -} - func init() { proto.RegisterType((*Params)(nil), "kyve.delegation.v1beta1.Params") } @@ -122,27 +103,29 @@ func init() { } var fileDescriptor_17019e1d49c878a9 = []byte{ - // 307 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0xd1, 0xbb, 0x4e, 0xf3, 0x30, - 0x1c, 0x05, 0xf0, 0xba, 0x5f, 0xbf, 0x4a, 0x35, 0x65, 0xb1, 0x40, 0x0d, 0x03, 0x56, 0xb9, 0x0c, - 0x9d, 0x62, 0x55, 0x95, 0x18, 0xd8, 0xb8, 0x0d, 0x08, 0x81, 0x50, 0x41, 0x48, 0xb0, 0x44, 0x4e, - 0x63, 0xb5, 0x56, 0x63, 0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bb, 0x0c, 0x2d, 0xba, 0xbe, 0xff, - 0xce, 0x28, 0x5a, 0x65, 0x14, 0xfd, 0x66, 0x14, 0x7d, 0xe6, 0xb4, 0xb6, 0xca, 0x69, 0xed, 0x27, - 0xa7, 0xb5, 0x0f, 0x36, 0x96, 0x66, 0x92, 0xfa, 0xee, 0x08, 0x14, 0x7b, 0x78, 0x7f, 0xbb, 0x7b, - 0x12, 0x66, 0x0e, 0xf1, 0x94, 0x8d, 0x26, 0x5c, 0x6a, 0xb6, 0xa8, 0x5e, 0xc3, 0x2c, 0x23, 0x91, - 0xf8, 0x4d, 0x7b, 0x85, 0xc1, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0x17, 0x6d, 0x46, 0xad, - 0x01, 0x00, 0x00, + // 350 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0xd2, 0x3f, 0x4f, 0xfa, 0x40, + 0x1c, 0x06, 0xf0, 0xf6, 0x07, 0x3f, 0x12, 0x4e, 0x5c, 0x1a, 0x0c, 0xd5, 0xa1, 0x10, 0x63, 0x0c, + 0x8b, 0xbd, 0x10, 0x12, 0x07, 0x37, 0x11, 0x07, 0x63, 0x30, 0x0a, 0xc6, 0x44, 0x97, 0xe6, 0xda, + 0x5e, 0x4a, 0x43, 0x7b, 0xdf, 0xa6, 0x77, 0xe5, 0xcf, 0xbb, 0xf0, 0x65, 0xf8, 0x52, 0x18, 0x19, + 0x8d, 0x03, 0x31, 0xf0, 0x46, 0x4c, 0x8f, 0x06, 0xca, 0xca, 0xd4, 0x26, 0xcf, 0xf3, 0x7c, 0x86, + 0xbb, 0x43, 0x17, 0xa3, 0xd9, 0x98, 0x62, 0x97, 0x06, 0xd4, 0x23, 0xc2, 0x07, 0x86, 0xc7, 0x2d, + 0x9b, 0x0a, 0xd2, 0xc2, 0x11, 0x89, 0x49, 0xc8, 0xcd, 0x28, 0x06, 0x01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, 0xbe, 0x32, 0xd4, 0xc5, 0xca, 0x50, 0x7f, 0x57, 0x86, 0xfa, 0xb9, 0x36, 0x94, 0xc5, + 0xda, 0x50, 0xbe, 0xd7, 0x86, 0xf2, 0x81, 0x73, 0xde, 0xe3, 0xfb, 0xdb, 0xfd, 0x13, 0x15, 0x13, + 0x88, 0x47, 0xd8, 0x19, 0x12, 0x9f, 0xe1, 0x69, 0xfe, 0xcd, 0x48, 0xdc, 0x2e, 0xc9, 0xcb, 0x6f, + 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x45, 0xa8, 0x27, 0x47, 0x53, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -165,27 +148,36 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TimeoutSlash) > 0 { - i -= len(m.TimeoutSlash) - copy(dAtA[i:], m.TimeoutSlash) - i = encodeVarintParams(dAtA, i, uint64(len(m.TimeoutSlash))) - i-- - dAtA[i] = 0x32 + { + size := m.TimeoutSlash.Size() + i -= size + if _, err := m.TimeoutSlash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } - if len(m.UploadSlash) > 0 { - i -= len(m.UploadSlash) - copy(dAtA[i:], m.UploadSlash) - i = encodeVarintParams(dAtA, i, uint64(len(m.UploadSlash))) - i-- - dAtA[i] = 0x2a + i-- + dAtA[i] = 0x32 + { + size := m.UploadSlash.Size() + i -= size + if _, err := m.UploadSlash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } - if len(m.VoteSlash) > 0 { - i -= len(m.VoteSlash) - copy(dAtA[i:], m.VoteSlash) - i = encodeVarintParams(dAtA, i, uint64(len(m.VoteSlash))) - i-- - dAtA[i] = 0x22 + i-- + dAtA[i] = 0x2a + { + size := m.VoteSlash.Size() + i -= size + if _, err := m.VoteSlash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x22 if m.RedelegationMaxAmount != 0 { i = encodeVarintParams(dAtA, i, uint64(m.RedelegationMaxAmount)) i-- @@ -230,18 +222,12 @@ func (m *Params) Size() (n int) { if m.RedelegationMaxAmount != 0 { n += 1 + sovParams(uint64(m.RedelegationMaxAmount)) } - l = len(m.VoteSlash) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.UploadSlash) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.TimeoutSlash) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } + l = m.VoteSlash.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.UploadSlash.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.TimeoutSlash.Size() + n += 1 + l + sovParams(uint64(l)) return n } @@ -367,7 +353,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VoteSlash = string(dAtA[iNdEx:postIndex]) + if err := m.VoteSlash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 5: if wireType != 2 { @@ -399,7 +387,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UploadSlash = string(dAtA[iNdEx:postIndex]) + if err := m.UploadSlash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 6: if wireType != 2 { @@ -431,7 +421,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TimeoutSlash = string(dAtA[iNdEx:postIndex]) + if err := m.TimeoutSlash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index 775dae00..efd01080 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -6,6 +6,8 @@ package types import ( fmt "fmt" types "github.com/KYVENetwork/chain/x/pool/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -260,7 +262,7 @@ type StakerMetadata struct { // commission is the percentage of the rewards that will // get transferred to the staker before the remaining // rewards are split across all delegators - Commission string `protobuf:"bytes,1,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` // moniker is a human-readable name for displaying // the staker in the UI Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` @@ -309,13 +311,6 @@ func (m *StakerMetadata) XXX_DiscardUnknown() { var xxx_messageInfo_StakerMetadata proto.InternalMessageInfo -func (m *StakerMetadata) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - func (m *StakerMetadata) GetMoniker() string { if m != nil { return m.Moniker @@ -349,7 +344,7 @@ func (m *StakerMetadata) GetPendingCommissionChange() *CommissionChangeEntry { type CommissionChangeEntry struct { // commission is the new commission that will // become active once the change-time is over - Commission string `protobuf:"bytes,1,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` // creation_date is the UNIX-timestamp (in seconds) // of when the entry was created. CreationDate int64 `protobuf:"varint,2,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` @@ -388,13 +383,6 @@ func (m *CommissionChangeEntry) XXX_DiscardUnknown() { var xxx_messageInfo_CommissionChangeEntry proto.InternalMessageInfo -func (m *CommissionChangeEntry) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - func (m *CommissionChangeEntry) GetCreationDate() int64 { if m != nil { return m.CreationDate @@ -505,49 +493,52 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/query.proto", fileDescriptor_6b41255feae93a15) } var fileDescriptor_6b41255feae93a15 = []byte{ - // 671 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xeb, 0x24, 0x4d, 0x9b, 0xc9, 0xd7, 0xf4, 0xd3, 0x4a, 0x50, 0x17, 0x51, 0x53, 0x05, - 0xa1, 0xb6, 0x1c, 0x12, 0xb5, 0x08, 0x09, 0x71, 0xe0, 0xd0, 0xb4, 0x95, 0x10, 0x14, 0x21, 0x23, - 0x90, 0x40, 0x48, 0xd6, 0xda, 0xde, 0x26, 0xab, 0xd8, 0xbb, 0x66, 0x77, 0x9d, 0x92, 0xb7, 0xe0, - 0x51, 0x38, 0xf0, 0x10, 0x1c, 0x7b, 0x84, 0x13, 0xa8, 0x7d, 0x11, 0xb4, 0xbb, 0xb6, 0x49, 0x4a, - 0x10, 0x37, 0xcf, 0x7f, 0xfe, 0x33, 0xc9, 0xfc, 0x66, 0x6c, 0xf0, 0xc6, 0xd3, 0x09, 0xe9, 0x7f, - 0xc8, 0x89, 0x98, 0xf6, 0x27, 0xfb, 0x21, 0x51, 0x78, 0xdf, 0x46, 0xbd, 0x4c, 0x70, 0xc5, 0x11, - 0xd2, 0xf9, 0x9e, 0x55, 0x8a, 0xfc, 0xad, 0xdb, 0xa6, 0x26, 0xe3, 0x3c, 0xa9, 0x4a, 0x74, 0x60, - 0x2b, 0xba, 0x9f, 0x6b, 0xd0, 0x3a, 0xc4, 0x92, 0x46, 0x2f, 0x39, 0x4f, 0x50, 0x07, 0x6a, 0x34, - 0x76, 0x9d, 0x6d, 0x67, 0xb7, 0xe1, 0xd7, 0x68, 0x8c, 0x10, 0x34, 0x18, 0x4e, 0x89, 0x5b, 0xdb, - 0x76, 0x76, 0x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0x0f, 0x0d, 0xcd, 0xd6, 0x74, 0x6c, 0x97, 0x37, 0x3e, 0x3f, 0x42, 0xf5, 0x01, 0xf0, 0x8d, 0x15, - 0xdd, 0x84, 0x66, 0xc6, 0x29, 0x53, 0xd2, 0xfc, 0x46, 0xc3, 0x2f, 0x22, 0xb4, 0x05, 0x40, 0x65, - 0x90, 0x10, 0x3c, 0xd1, 0x87, 0xa5, 0x99, 0xae, 0xfa, 0x2d, 0x2a, 0x9f, 0x5b, 0x41, 0x4f, 0x30, - 0xc1, 0x49, 0xf9, 0x32, 0x58, 0xb6, 0x33, 0x8a, 0xde, 0x47, 0x88, 0x13, 0xcc, 0x22, 0x52, 0x5c, - 0x58, 0x19, 0x1e, 0x1e, 0x7d, 0xbd, 0xf4, 0x9c, 0x8b, 0x4b, 0xcf, 0xf9, 0x79, 0xe9, 0x39, 0x9f, - 0xae, 0xbc, 0xa5, 0x8b, 0x2b, 0x6f, 0xe9, 0xdb, 0x95, 0xb7, 0xf4, 0xee, 0xfe, 0x90, 0xaa, 0x51, - 0x1e, 0xf6, 0x22, 0x9e, 0xf6, 0x9f, 0xbd, 0x7d, 0x73, 0xfc, 0x82, 0xa8, 0x73, 0x2e, 0xc6, 0xfd, - 0x68, 0x84, 0x29, 0xeb, 0x7f, 0x2c, 0xbe, 0x85, 0x6a, 0x9a, 0x11, 0x19, 0x36, 0xcd, 0x27, 0xed, - 0xc1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0xa5, 0xc1, 0x00, 0x26, 0x05, 0x00, 0x00, + // 719 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcf, 0x6e, 0xd3, 0x4a, + 0x14, 0xc6, 0xe3, 0x24, 0x4d, 0x9b, 0x93, 0xdb, 0xf4, 0x6a, 0x74, 0xef, 0xad, 0x5b, 0xdd, 0xba, + 0x55, 0x10, 0xb4, 0x45, 0xc2, 0x51, 0x8b, 0x90, 0x10, 0x0b, 0x16, 0x4d, 0x5a, 0x09, 0x41, 0x2b, + 0x64, 0x04, 0x12, 0x6c, 0xac, 0x89, 0x3d, 0x75, 0x46, 0xb1, 0x67, 0x8c, 0x67, 0x9c, 0x92, 0x77, + 0x40, 0x82, 0x47, 0x61, 0xc1, 0x43, 0x74, 0xd9, 0x25, 0xb0, 0xa8, 0x50, 0xfb, 0x22, 0x68, 0xc6, + 0x7f, 0x48, 0x4a, 0xd8, 0xb1, 0xca, 0x9c, 0xef, 0x7c, 0x73, 0xe2, 0xf9, 0x9d, 0x33, 0x03, 0xd6, + 0x68, 0x32, 0x26, 0xdd, 0xb7, 0x29, 0x49, 0x26, 0xdd, 0xf1, 0xde, 0x80, 0x48, 0xbc, 0x97, 0x45, + 0x76, 0x9c, 0x70, 0xc9, 0x11, 0x52, 0x79, 0x3b, 0x53, 0xf2, 0xfc, 0xfa, 0x3f, 0x01, 0x0f, 0xb8, + 0x4e, 0x77, 0xd5, 0x2a, 0x73, 0xae, 0xff, 0xaf, 0x2b, 0xc5, 0x9c, 0x87, 0x65, 0x21, 0x15, 0x64, + 0xd9, 0xce, 0xa7, 0x2a, 0x34, 0x0f, 0xb0, 0xa0, 0xde, 0x73, 0xce, 0x43, 0xd4, 0x86, 0x2a, 0xf5, + 0x4d, 0x63, 0xcb, 0xd8, 0xa9, 0x3b, 0x55, 0xea, 0x23, 0x04, 0x75, 0x86, 0x23, 0x62, 0x56, 0xb7, + 0x8c, 0x9d, 0xa6, 0xa3, 0xd7, 0xc8, 0x84, 0xc5, 0x24, 0x65, 0x92, 0x46, 0xc4, 0xac, 0x69, 0xb9, + 0x08, 0x95, 0x3b, 0xe4, 0x01, 0x37, 0xeb, 0x99, 0x5b, 0xad, 0xd1, 0x6d, 0x68, 0xf3, 0x98, 0x24, + 0x58, 0x52, 0x16, 0xb8, 0x1e, 0x17, 0xd2, 0x5c, 0xd0, 0xd5, 0x97, 0x4b, 0xb5, 0x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x0b, 0x5a, 0xc5, 0x25, + 0x9a, 0x3d, 0x73, 0xf9, 0xc2, 0x38, 0xda, 0x8a, 0xfe, 0x83, 0x46, 0xcc, 0x29, 0x93, 0x42, 0xff, + 0x47, 0xdd, 0xc9, 0x23, 0xb4, 0x01, 0x40, 0x85, 0x1b, 0x12, 0x3c, 0x56, 0x93, 0xab, 0x9a, 0xb0, + 0xe4, 0x34, 0xa9, 0x78, 0x96, 0x09, 0xc8, 0x02, 0x18, 0xe3, 0xb0, 0xb8, 0x6d, 0x59, 0x33, 0xa6, + 0x14, 0xd5, 0xc0, 0x01, 0x0e, 0x31, 0xf3, 0x48, 0x3e, 0xc2, 0x45, 0x78, 0xd0, 0x3f, 0xbf, 0xb2, + 0x8c, 0x8b, 0x2b, 0xcb, 0xf8, 0x7e, 0x65, 0x19, 0x1f, 0xaf, 0xad, 0xca, 0xc5, 0xb5, 0x55, 0xf9, + 0x72, 0x6d, 0x55, 0xde, 0xdc, 0x9d, 0x22, 0xf5, 0xf4, 0xf5, 0xab, 0xc3, 0x13, 0x22, 0xcf, 0x78, + 0x32, 0xea, 0x7a, 0x43, 0x4c, 0x59, 0xf7, 0x5d, 0xfe, 0x04, 0x6b, 0x62, 0x83, 0x86, 0x7e, 0x33, + 0xef, 0xff, 0x08, 0x00, 0x00, 0xff, 0xff, 0x97, 0x7e, 0xc8, 0xa1, 0x9d, 0x05, 0x00, 0x00, } func (m *BasicPool) Marshal() (dAtA []byte, err error) { @@ -753,13 +744,16 @@ func (m *StakerMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0xa + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -788,13 +782,16 @@ func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0xa + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -951,10 +948,8 @@ func (m *StakerMetadata) Size() (n int) { } var l int _ = l - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovQuery(uint64(l)) l = len(m.Moniker) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -980,10 +975,8 @@ func (m *CommissionChangeEntry) Size() (n int) { } var l int _ = l - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovQuery(uint64(l)) if m.CreationDate != 0 { n += 1 + sovQuery(uint64(m.CreationDate)) } @@ -1569,7 +1562,9 @@ func (m *StakerMetadata) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { @@ -1783,7 +1778,9 @@ func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 0 { diff --git a/x/stakers/client/cli/tx_update_commission.go b/x/stakers/client/cli/tx_update_commission.go index 4bf925a5..9274fc34 100644 --- a/x/stakers/client/cli/tx_update_commission.go +++ b/x/stakers/client/cli/tx_update_commission.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" ) @@ -19,9 +20,14 @@ func CmdUpdateCommission() *cobra.Command { return err } + commission, err := sdk.NewDecFromStr(args[0]) + if err != nil { + return err + } + msg := types.MsgUpdateCommission{ Creator: clientCtx.GetFromAddress().String(), - Commission: args[0], + Commission: commission, } if err := msg.ValidateBasic(); err != nil { diff --git a/x/stakers/keeper/exported_functions.go b/x/stakers/keeper/exported_functions.go index d53765e6..901666d9 100644 --- a/x/stakers/keeper/exported_functions.go +++ b/x/stakers/keeper/exported_functions.go @@ -2,7 +2,6 @@ package keeper import ( "cosmossdk.io/math" - "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" // Gov @@ -41,11 +40,7 @@ func (k Keeper) GetAllStakerAddressesOfPool(ctx sdk.Context, poolId uint64) (sta // GetCommission returns the commission of a staker as a parsed sdk.Dec func (k Keeper) GetCommission(ctx sdk.Context, stakerAddress string) sdk.Dec { staker, _ := k.GetStaker(ctx, stakerAddress) - uploaderCommission, err := sdk.NewDecFromStr(staker.Commission) - if err != nil { - util.PanicHalt(k.upgradeKeeper, ctx, "Commission not parsable: "+staker.Commission) - } - return uploaderCommission + return staker.Commission } // AssertValaccountAuthorized checks if the given `valaddress` is allowed to vote in pool diff --git a/x/stakers/keeper/getters_staker.go b/x/stakers/keeper/getters_staker.go index 32d7641e..db8436c7 100644 --- a/x/stakers/keeper/getters_staker.go +++ b/x/stakers/keeper/getters_staker.go @@ -24,7 +24,7 @@ func (k Keeper) UpdateStakerMetadata(ctx sdk.Context, address string, moniker st } // UpdateStakerCommission ... -func (k Keeper) UpdateStakerCommission(ctx sdk.Context, address string, commission string) { +func (k Keeper) UpdateStakerCommission(ctx sdk.Context, address string, commission sdk.Dec) { staker, found := k.GetStaker(ctx, address) if found { staker.Commission = commission diff --git a/x/stakers/keeper/logic_commission.go b/x/stakers/keeper/logic_commission.go index 1d888adc..894ff913 100644 --- a/x/stakers/keeper/logic_commission.go +++ b/x/stakers/keeper/logic_commission.go @@ -9,7 +9,7 @@ import ( // The queue is checked in every endBlock and when the commissionChangeTime // is over the new commission will be applied to the user. // If another entry is currently in the queue it will be removed. -func (k Keeper) orderNewCommissionChange(ctx sdk.Context, staker string, commission string) { +func (k Keeper) orderNewCommissionChange(ctx sdk.Context, staker string, commission sdk.Dec) { // Remove existing queue entry queueEntry, found := k.GetCommissionChangeEntryByIndex2(ctx, staker) if found { diff --git a/x/stakers/keeper/msg_server_update_commission.go b/x/stakers/keeper/msg_server_update_commission.go index 36ae8af8..0eb30c8d 100644 --- a/x/stakers/keeper/msg_server_update_commission.go +++ b/x/stakers/keeper/msg_server_update_commission.go @@ -21,16 +21,6 @@ func (k msgServer) UpdateCommission(goCtx context.Context, msg *types.MsgUpdateC return nil, errors.Wrap(errorsTypes.ErrUnauthorized, types.ErrNoStaker.Error()) } - // Validate commission. - commission, err := sdk.NewDecFromStr(msg.Commission) - if err != nil { - return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrInvalidCommission.Error(), msg.Commission) - } - - if commission.LT(sdk.NewDec(int64(0))) || commission.GT(sdk.NewDec(int64(1))) { - return nil, errors.Wrapf(errorsTypes.ErrLogic, types.ErrInvalidCommission.Error(), msg.Commission) - } - // Insert commission change into queue k.orderNewCommissionChange(ctx, msg.Creator, msg.Commission) diff --git a/x/stakers/keeper/msg_server_update_commission_test.go b/x/stakers/keeper/msg_server_update_commission_test.go index 852a20a5..43e5ff60 100644 --- a/x/stakers/keeper/msg_server_update_commission_test.go +++ b/x/stakers/keeper/msg_server_update_commission_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -53,7 +54,7 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.5", + Commission: sdk.MustNewDecFromStr("0.5"), }) s.PerformValidityChecks() @@ -66,14 +67,14 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.CommitAfterSeconds(1) staker, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker.Commission).To(Equal("0.5")) + Expect(staker.Commission).To(Equal(sdk.MustNewDecFromStr("0.5"))) }) It("Update commission to 0% from previously default commission", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0", + Commission: sdk.ZeroDec(), }) s.PerformValidityChecks() @@ -86,14 +87,14 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.CommitAfterSeconds(1) staker, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker.Commission).To(Equal("0")) + Expect(staker.Commission).To(Equal(sdk.ZeroDec())) }) It("Update commission to 100% from previously default commission", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "1", + Commission: sdk.OneDec(), }) s.PerformValidityChecks() @@ -106,27 +107,14 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.CommitAfterSeconds(1) staker, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker.Commission).To(Equal("1")) - }) - - It("Update commission with an invalid number from previously default commission", func() { - // ACT - s.RunTxStakersError(&stakerstypes.MsgUpdateCommission{ - Creator: i.STAKER_0, - Commission: "teset", - }) - s.PerformValidityChecks() - - // ASSERT - staker, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker.Commission).To(Equal(stakerstypes.DefaultCommission)) + Expect(staker.Commission).To(Equal(sdk.OneDec())) }) It("Update commission with a negative number from previously default commission", func() { // ACT s.RunTxStakersError(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "-0.5", + Commission: sdk.MustNewDecFromStr("-0.5"), }) s.PerformValidityChecks() @@ -139,7 +127,7 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { // ACT s.RunTxStakersError(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "2", + Commission: sdk.NewDec(2), }) s.PerformValidityChecks() @@ -152,19 +140,19 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.5", + Commission: sdk.MustNewDecFromStr("0.5"), }) s.PerformValidityChecks() s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.2", + Commission: sdk.MustNewDecFromStr("0.2"), }) s.PerformValidityChecks() s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.3", + Commission: sdk.MustNewDecFromStr("0.3"), }) s.PerformValidityChecks() @@ -177,19 +165,19 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.CommitAfterSeconds(1) staker, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker.Commission).To(Equal("0.3")) + Expect(staker.Commission).To(Equal(sdk.MustNewDecFromStr("0.3"))) }) It("Update commission multiple times during the commission change time with the same value", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.5", + Commission: sdk.MustNewDecFromStr("0.5"), }) s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.2", + Commission: sdk.MustNewDecFromStr("0.2"), }) s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ @@ -220,12 +208,12 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_0, - Commission: "0.5", + Commission: sdk.MustNewDecFromStr("0.5"), }) s.RunTxStakersSuccess(&stakerstypes.MsgUpdateCommission{ Creator: i.STAKER_1, - Commission: "0.5", + Commission: sdk.MustNewDecFromStr("0.5"), }) s.PerformValidityChecks() @@ -242,9 +230,9 @@ var _ = Describe("msg_server_update_commission.go", Ordered, func() { s.CommitAfterSeconds(1) staker0, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) - Expect(staker0.Commission).To(Equal("0.5")) + Expect(staker0.Commission).To(Equal(sdk.MustNewDecFromStr("0.5"))) staker1, _ = s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_1) - Expect(staker1.Commission).To(Equal("0.5")) + Expect(staker1.Commission).To(Equal(sdk.MustNewDecFromStr("0.5"))) }) }) diff --git a/x/stakers/types/errors.go b/x/stakers/types/errors.go index f12025f8..35a19780 100644 --- a/x/stakers/types/errors.go +++ b/x/stakers/types/errors.go @@ -17,7 +17,6 @@ var ( ErrValaddressSameAsStaker = errors.Register(ModuleName, 1111, "Valaddress has same address as Valaddress") ErrCanNotJoinDisabledPool = errors.Register(ModuleName, 1112, "can not join disabled pool") - ErrInvalidCommission = errors.Register(ModuleName, 1116, "invalid commission %v") ErrPoolLeaveAlreadyInProgress = errors.Register(ModuleName, 1117, "Pool leave is already in progress") ErrValaccountUnauthorized = errors.Register(ModuleName, 1118, "valaccount unauthorized") ) diff --git a/x/stakers/types/events.pb.go b/x/stakers/types/events.pb.go index 0e705fb8..c865279a 100644 --- a/x/stakers/types/events.pb.go +++ b/x/stakers/types/events.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -224,7 +225,7 @@ type EventUpdateCommission struct { // staker is the account address of the protocol node. Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` // commission ... - Commission string `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` } func (m *EventUpdateCommission) Reset() { *m = EventUpdateCommission{} } @@ -267,13 +268,6 @@ func (m *EventUpdateCommission) GetStaker() string { return "" } -func (m *EventUpdateCommission) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - // EventJoinPool ... // emitted_by: MsgJoinPool type EventJoinPool struct { @@ -417,34 +411,36 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/events.proto", fileDescriptor_7a1b3dc9634155a0) } var fileDescriptor_7a1b3dc9634155a0 = []byte{ - // 429 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xdf, 0x6a, 0xd4, 0x40, - 0x14, 0xc6, 0x37, 0x6b, 0xd8, 0x65, 0x47, 0x14, 0x8c, 0x55, 0x43, 0x91, 0x58, 0x73, 0xd5, 0x0b, - 0x49, 0xa8, 0x3e, 0x41, 0xbb, 0x54, 0xf0, 0x7f, 0x89, 0x28, 0xe8, 0x4d, 0x39, 0xd9, 0x39, 0xa4, - 0xc3, 0x26, 0x73, 0x42, 0x66, 0x36, 0xe9, 0xbe, 0x85, 0xef, 0xe2, 0x4b, 0xf4, 0xb2, 0x97, 0x5e, - 0x89, 0xec, 0xbe, 0x88, 0x64, 0x32, 0x5b, 0xa3, 0x74, 0x41, 0x7a, 0x97, 0xef, 0x9c, 0x2f, 0xbf, - 0xef, 0x9b, 0x61, 0xd8, 0xd3, 0xf9, 0xb2, 0xc6, 0x58, 0x69, 0x98, 0x63, 0xa5, 0xe2, 0xfa, 0x20, - 0x45, 0x0d, 0x07, 0x31, 0xd6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x29, 0x15, 0x85, 0x50, 0x4a, 0x90, 0xdc, - 0x1a, 0x1c, 0x30, 0x36, 0xbb, 0x72, 0xd9, 0xec, 0xde, 0x24, 0x3c, 0x67, 0x77, 0x0c, 0xf0, 0x35, - 0x09, 0x79, 0x42, 0x94, 0x7b, 0x8f, 0xd8, 0xb8, 0x24, 0xca, 0x4f, 0x05, 0x37, 0x24, 0x37, 0x19, - 0xb5, 0xf2, 0x15, 0xef, 0x25, 0x0c, 0xff, 0x4d, 0xa8, 0x21, 0x07, 0xce, 0x2b, 0x54, 0xca, 0x9e, - 0xa1, 0x37, 0xe9, 0xdd, 0xa0, 0xfb, 0xd7, 0x0d, 0x1e, 0xb2, 0xbb, 0x26, 0xf9, 0x2d, 0x42, 0x8d, - 0x37, 0x8a, 0x3e, 0x7a, 0x79, 0xb1, 0x0a, 0x9c, 0xcb, 0x55, 0xe0, 0xfc, 0x5a, 0x05, 0xce, 0xb7, - 0x75, 0x30, 0xb8, 0x5c, 0x07, 0x83, 0x1f, 0xeb, 0x60, 0xf0, 0xf5, 0x59, 0x26, 0xf4, 0xd9, 0x22, - 0x8d, 0x66, 0x54, 0xc4, 0x6f, 0xbe, 0x7c, 0x3e, 0x7e, 0x8f, 0xba, 0xa1, 0x6a, 0x1e, 0xcf, 0xce, - 0x40, 0xc8, 0xf8, 0xfc, 0xea, 0x59, 0xeb, 0x65, 0x89, 0x2a, 0x1d, 0x99, 0xe7, 0xfc, 0xe2, 0x77, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x67, 0x6b, 0x55, 0x42, 0x03, 0x00, 0x00, + // 462 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xdf, 0x6a, 0xd4, 0x40, + 0x14, 0xc6, 0x37, 0x6b, 0xd8, 0x65, 0x8f, 0x28, 0x18, 0xab, 0x86, 0x22, 0x69, 0xcd, 0x85, 0xf4, + 0x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 0xf4, 0xac, + 0x8b, 0xa5, 0x67, 0xfd, 0x5e, 0x7a, 0xd6, 0xf7, 0x95, 0xd7, 0xb9, 0x58, 0x79, 0x9d, 0x9f, 0x2b, + 0xaf, 0xf3, 0xf5, 0x59, 0x6b, 0x14, 0xef, 0xbe, 0x7c, 0x3e, 0x3c, 0x22, 0x35, 0xe7, 0x72, 0x1a, + 0xc6, 0xa7, 0x98, 0xe4, 0xe1, 0xd9, 0xd5, 0x6f, 0xa0, 0x87, 0x32, 0xee, 0xe9, 0xcf, 0xff, 0xe5, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0xd7, 0xac, 0xc1, 0x72, 0x03, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -603,13 +599,16 @@ func (m *EventUpdateCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x12 + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Staker) > 0 { i -= len(m.Staker) copy(dAtA[i:], m.Staker) @@ -781,10 +780,8 @@ func (m *EventUpdateCommission) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovEvents(uint64(l)) return n } @@ -1351,7 +1348,9 @@ func (m *EventUpdateCommission) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/stakers/types/keys.go b/x/stakers/types/keys.go index 01295ead..0e3c4084 100644 --- a/x/stakers/types/keys.go +++ b/x/stakers/types/keys.go @@ -2,6 +2,7 @@ package types import ( "github.com/KYVENetwork/chain/util" + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( @@ -59,10 +60,9 @@ var ( QUEUE_IDENTIFIER_LEAVE QUEUE_IDENTIFIER = []byte{30, 3} ) -const ( - MaxStakers = 50 - DefaultCommission = "0.9" -) +const MaxStakers = 50 + +var DefaultCommission = sdk.MustNewDecFromStr("0.9") // StakerKey returns the store Key to retrieve a Staker from the index fields func StakerKey(staker string) []byte { diff --git a/x/stakers/types/message_update_commission.go b/x/stakers/types/message_update_commission.go index bf8dd513..e8fb1aed 100644 --- a/x/stakers/types/message_update_commission.go +++ b/x/stakers/types/message_update_commission.go @@ -2,39 +2,28 @@ package types import ( "cosmossdk.io/errors" + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgUpdateCommission = "update_commission" - var _ sdk.Msg = &MsgUpdateCommission{} -func (msg *MsgUpdateCommission) Route() string { - return RouterKey -} - -func (msg *MsgUpdateCommission) Type() string { - return TypeMsgUpdateCommission -} - +// GetSigners returns the expected signers for a MsgUpdateCommission message. func (msg *MsgUpdateCommission) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgUpdateCommission) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) + validator, _ := sdk.AccAddressFromBech32(msg.Creator) + return []sdk.AccAddress{validator} } +// ValidateBasic does a sanity check on the provided data. func (msg *MsgUpdateCommission) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) } + + if util.ValidatePercentage(msg.Commission) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid commission") + } + return nil } diff --git a/x/stakers/types/params.go b/x/stakers/types/params.go index 76a01b9b..2ecb0884 100644 --- a/x/stakers/types/params.go +++ b/x/stakers/types/params.go @@ -31,11 +31,11 @@ func DefaultParams() Params { // Validate validates the set of params func (p Params) Validate() error { - if err := util.ValidateUint64(p.CommissionChangeTime); err != nil { + if err := util.ValidateNumber(p.CommissionChangeTime); err != nil { return err } - if err := util.ValidateUint64(p.LeavePoolTime); err != nil { + if err := util.ValidateNumber(p.LeavePoolTime); err != nil { return err } diff --git a/x/stakers/types/stakers.pb.go b/x/stakers/types/stakers.pb.go index 11d4cc75..879a0ceb 100644 --- a/x/stakers/types/stakers.pb.go +++ b/x/stakers/types/stakers.pb.go @@ -5,6 +5,8 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -28,7 +30,7 @@ type Staker struct { // address ... Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // commission ... - Commission string `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` // moniker ... Moniker string `protobuf:"bytes,3,opt,name=moniker,proto3" json:"moniker,omitempty"` // website ... @@ -77,13 +79,6 @@ func (m *Staker) GetAddress() string { return "" } -func (m *Staker) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - func (m *Staker) GetMoniker() string { if m != nil { return m.Moniker @@ -204,7 +199,7 @@ type CommissionChangeEntry struct { Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` // commission is the new commission which will // be applied after the waiting time is over. - Commission string `protobuf:"bytes,3,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` // creation_date is the UNIX-timestamp in seconds // when the entry was created. CreationDate int64 `protobuf:"varint,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` @@ -257,13 +252,6 @@ func (m *CommissionChangeEntry) GetStaker() string { return "" } -func (m *CommissionChangeEntry) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - func (m *CommissionChangeEntry) GetCreationDate() int64 { if m != nil { return m.CreationDate @@ -421,34 +409,37 @@ func init() { } var fileDescriptor_d209d1a2a74d375d = []byte{ - // 429 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x9b, 0x6d, 0xb7, 0xbb, 0x7d, 0xa8, 0x87, 0x61, 0xd5, 0x80, 0x6c, 0x90, 0x7a, 0xf1, - 0x20, 0x0d, 0x8b, 0xdf, 0xc0, 0x75, 0xc5, 0x45, 0x11, 0xed, 0xc2, 0x82, 0x5e, 0xca, 0x34, 0x79, - 0x24, 0x43, 0xa7, 0xf3, 0x42, 0x66, 0x92, 0x6c, 0xc1, 0x4f, 0xe0, 0xc9, 0x83, 0x1f, 0xca, 0xe3, - 0x1e, 0x3d, 0x4a, 0xfb, 0x45, 0x64, 0x26, 0x93, 0x12, 0x11, 0x44, 0xbc, 0xe5, 0xff, 0xff, 0xcf, - 0xcb, 0xfc, 0xde, 0x9f, 0x81, 0xe9, 0x6a, 0x53, 0x63, 0xac, 0x0d, 0x5f, 0x61, 0xa9, 0xe3, 0xfa, - 0x6c, 0x89, 0x86, 0x9f, 0x75, 0x7a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9b, 0x94, 0xc8, 0x8d, - 0x20, 0xb5, 0x48, 0xb9, 0xaf, 0x6c, 0x38, 0xbf, 0xd3, 0x99, 0x2f, 0xb9, 0xc1, 0xe9, 0x67, 0xb8, - 0x67, 0xb9, 0xf0, 0x3d, 0x91, 0xfc, 0x1f, 0x88, 0x5e, 0xa9, 0xc3, 0xdf, 0x4a, 0xfd, 0xa7, 0xdb, - 0x5f, 0x03, 0x7c, 0xa8, 0xb0, 0xc2, 0x2b, 0xc3, 0x0d, 0xb2, 0x47, 0x30, 0x91, 0xd4, 0x2c, 0xfa, - 0xb7, 0x1f, 0x4b, 0x6a, 0x2e, 0x1d, 0xc0, 0x29, 0x40, 0x2e, 0xb2, 0xdc, 0xa7, 0x07, 0x2e, 0x9d, - 0x58, 0xc7, 0xc5, 0x2f, 0x5e, 0x7d, 0xdf, 0x46, 0xc1, 0xed, 0x36, 0x0a, 0x7e, 0x6e, 0xa3, 0xe0, - 0xeb, 0x2e, 0x1a, 0xdc, 0xee, 0xa2, 0xc1, 0x8f, 0x5d, 0x34, 0xf8, 0xf4, 0x2c, 0x13, 0x26, 0xaf, - 0x96, 0xb3, 0x84, 0xd6, 0xf1, 0x9b, 0x8f, 0xd7, 0x17, 0xef, 0xd0, 0x34, 0x54, 0xae, 0xe2, 0x24, - 0xe7, 0x42, 0xc5, 0x37, 0xfb, 0x67, 0x6e, 0x36, 0x05, 0xea, 0xe5, 0xd8, 0xbd, 0xee, 0xe7, 0xbf, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x34, 0x43, 0xbf, 0x03, 0x03, 0x00, 0x00, + // 475 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xdd, 0x6a, 0xd4, 0x40, + 0x14, 0xde, 0x74, 0xb7, 0xdb, 0xee, 0x41, 0xbd, 0x18, 0x56, 0x0d, 0x4a, 0x53, 0x59, 0x41, 0xbc, +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 0x7b, 0x00, 0xa9, + 0x48, 0xd2, 0x5a, 0xdd, 0xb2, 0xea, 0xc0, 0x30, 0x56, 0x3e, 0x7c, 0x7b, 0xb5, 0xf2, 0x9c, 0xeb, + 0x95, 0xe7, 0xfc, 0x5e, 0x79, 0xce, 0xb7, 0xb5, 0xd7, 0xb9, 0x5e, 0x7b, 0x9d, 0x9f, 0x6b, 0xaf, + 0xf3, 0xe5, 0x55, 0x2b, 0xba, 0xf7, 0x9f, 0x2f, 0x4e, 0xce, 0x50, 0x2f, 0xa8, 0xcc, 0x82, 0x28, + 0xe5, 0x42, 0x06, 0x97, 0xb7, 0xcb, 0x65, 0x43, 0x9c, 0xf4, 0xed, 0x9e, 0xbc, 0xf9, 0x13, 0x00, + 0x00, 0xff, 0xff, 0xbc, 0x83, 0xaf, 0xf4, 0x79, 0x03, 0x00, 0x00, } func (m *Staker) Marshal() (dAtA []byte, err error) { @@ -492,13 +483,16 @@ func (m *Staker) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintStakers(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x12 + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -591,13 +585,16 @@ func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintStakers(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x1a + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a if len(m.Staker) > 0 { i -= len(m.Staker) copy(dAtA[i:], m.Staker) @@ -712,10 +709,8 @@ func (m *Staker) Size() (n int) { if l > 0 { n += 1 + l + sovStakers(uint64(l)) } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovStakers(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) l = len(m.Moniker) if l > 0 { n += 1 + l + sovStakers(uint64(l)) @@ -770,10 +765,8 @@ func (m *CommissionChangeEntry) Size() (n int) { if l > 0 { n += 1 + l + sovStakers(uint64(l)) } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovStakers(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) if m.CreationDate != 0 { n += 1 + sovStakers(uint64(m.CreationDate)) } @@ -914,7 +907,9 @@ func (m *Staker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { @@ -1315,7 +1310,9 @@ func (m *CommissionChangeEntry) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: if wireType != 0 { diff --git a/x/stakers/types/tx.pb.go b/x/stakers/types/tx.pb.go index 5058724c..3dede3d2 100644 --- a/x/stakers/types/tx.pb.go +++ b/x/stakers/types/tx.pb.go @@ -7,6 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" @@ -235,7 +237,7 @@ type MsgUpdateCommission struct { // creator ... Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` // commission ... - Commission string `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` } func (m *MsgUpdateCommission) Reset() { *m = MsgUpdateCommission{} } @@ -278,13 +280,6 @@ func (m *MsgUpdateCommission) GetCreator() string { return "" } -func (m *MsgUpdateCommission) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - // MsgUpdateCommissionResponse ... type MsgUpdateCommissionResponse struct { } @@ -634,43 +629,46 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/tx.proto", fileDescriptor_f52b730e69b9fb06) } var fileDescriptor_f52b730e69b9fb06 = []byte{ - // 568 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0xad, 0x69, 0xd4, 0x90, 0x4b, 0xc4, 0xc3, 0x84, 0xd6, 0x71, 0x55, 0xab, 0x58, 0xaa, 0x68, - 0x11, 0xb5, 0x15, 0x90, 0xd8, 0xb7, 0x11, 0x48, 0x3c, 0x0c, 0x55, 0x2a, 0x10, 0x8f, 0x45, 0x35, - 0xb1, 0x47, 0x8e, 0x49, 0xec, 0x6b, 0x79, 0x26, 0x69, 0xf2, 0x17, 0x7c, 0x0c, 0x1f, 0xc1, 0xb2, - 0x62, 0xc5, 0x12, 0x25, 0x12, 0xdf, 0x81, 0xfc, 0x9a, 0x3c, 0x9a, 0x97, 0xd8, 0xe5, 0xcc, 0x3d, - 0xf7, 0x9c, 0x7b, 0x3d, 0x27, 0x03, 0x7b, 0xed, 0x41, 0x8f, 0x9a, 0x8c, 0x93, 0x36,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 0xa7, 0xa8, 0x47, 0x2b, 0x29, 0x42, 0xf9, - 0x2b, 0x94, 0xc6, 0xe9, 0xd3, 0x17, 0xf6, 0x09, 0x8e, 0xfa, 0x78, 0x35, 0x47, 0x88, 0x3b, 0x50, - 0x9e, 0xca, 0xdf, 0xc1, 0x8a, 0xcd, 0x53, 0xda, 0x92, 0xab, 0x9f, 0x17, 0xb4, 0xd3, 0x97, 0x3f, - 0x87, 0x9a, 0x74, 0x35, 0xd4, 0xa4, 0x3f, 0x43, 0x4d, 0xfa, 0x3e, 0xd2, 0x36, 0xae, 0x46, 0xda, - 0xc6, 0xef, 0x91, 0xb6, 0xf1, 0xe5, 0x89, 0xeb, 0xf1, 0x56, 0xb7, 0x69, 0xd8, 0xe8, 0x9b, 0x6f, - 0x3e, 0x7f, 0x7c, 0xf1, 0x8e, 0xf2, 0x4b, 0x8c, 0xda, 0xa6, 0xdd, 0x22, 0x5e, 0x60, 0xf6, 0xc5, - 0xe3, 0xcd, 0x07, 0x21, 0x65, 0xcd, 0xad, 0xe4, 0x1d, 0x7e, 0xf6, 0x2f, 0x00, 0x00, 0xff, 0xff, - 0x89, 0xab, 0x3b, 0x78, 0xd9, 0x05, 0x00, 0x00, + // 613 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xd3, 0x4c, + 0x18, 0x8d, 0xff, 0x46, 0xed, 0x9f, 0x8f, 0x8a, 0x8b, 0x09, 0xad, 0xeb, 0xaa, 0x6e, 0xb1, 0x54, + 0x68, 0x11, 0xb1, 0x15, 0x90, 0xd8, 0x37, 0x01, 0x24, 0x2e, 0xae, 0x2a, 0x57, 0x20, 0x2e, 0x8b, + 0x6a, 0x62, 0x8f, 0x1c, 0x93, 0xd8, 0x63, 0x79, 0x26, 0x69, 0xb2, 0xe2, 0x15, 0x78, 0x18, 0x1e, + 0xa2, 0xcb, 0x8a, 0x15, 0x62, 0x51, 0xa1, 0x44, 0xe2, 0x39, 0x90, 0x6f, 0x13, 0x27, 0xcd, 0x4d, + 0xac, 0xe2, 0x6f, 0xbe, 0x33, 0xe7, 0x9c, 0x99, 0x39, 0x33, 0x81, 0x9d, 0x56, 0xbf, 0x8b, 0x75, + 0xca, 0x50, 0x0b, 0x87, 0x54, 0xef, 0x56, 0x1b, 0x98, 0xa1, 0xaa, 0xce, 0x7a, 0x5a, 0x10, 0x12, + 0x46, 0xc4, 0x72, 0xd4, 0xd6, 0xd2, 0xb6, 0x96, 0xb6, 0xe5, 0x2d, 0x8b, 0x50, 0x8f, 0xd0, 0xb3, + 0x18, 0xa3, 0x27, 0x45, 0x32, 0x41, 0x2e, 0x3b, 0xc4, 0x21, 0xc9, 0x78, 0xf4, 0x95, 0x8c, 0xaa, + 0x75, 0xb8, 0x65, 0x50, 0xa7, 0x1e, 0x62, 0xc4, 0xf0, 0x69, 0x4c, 0x26, 0x4a, 0xb0, 0x66, 0x45, + 0x35, 0x09, 0x25, 0x61, 0x4f, 0x38, 0x28, 0x99, 0x59, 0x29, 0x6e, 0xc0, 0x2a, 0xf2, 0x48, 0xc7, + 0x67, 0xd2, 0x7f, 0x7b, 0xc2, 0x41, 0xd1, 0x4c, 0x2b, 0x75, 0x0b, 0x36, 0x27, 0x48, 0x4c, 0x4c, + 0x03, 0xe2, 0x53, 0xac, 0x76, 0xe0, 0x8e, 0x41, 0x9d, 0x77, 0x81, 0x8d, 0x18, 0x36, 0x30, 0x43, + 0x36, 0x62, 0x68, 0x8e, 0x82, 0x04, 0x6b, 0x1e, 0xf1, 0xdd, 0x16, 0x0e, 0x63, 0x89, 0x92, 0x99, + 0x95, 0x51, 0xe7, 0x1c, 0x37, 0xa8, 0xcb, 0xb0, 0xb4, 0x92, 0x74, 0xd2, 0x52, 0x14, 0xa1, 0xd8, + 0x26, 0x0e, 0x91, 0x8a, 0xf1, 0x70, 0xfc, 0xad, 0x6e, 0xc3, 0xd6, 0x35, 0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, 0x49, 0xcb, 0x34, 0x9f, 0x79, 0x91, 0x4c, 0xff, 0xc9, 0x9f, 0x22, 0xac, 0x18, + 0xd4, 0x11, 0x6d, 0x58, 0x1f, 0xbb, 0x04, 0xfb, 0xda, 0xb4, 0xfb, 0xa5, 0x4d, 0xc4, 0x5c, 0xae, + 0x2c, 0x05, 0xcb, 0xd4, 0xc4, 0x2f, 0x70, 0x73, 0xe2, 0x2a, 0x3c, 0x9c, 0x49, 0x30, 0x0e, 0x94, + 0xf5, 0x25, 0x81, 0x5c, 0x2b, 0x80, 0xdb, 0xd7, 0x22, 0x7e, 0xb8, 0x80, 0x64, 0x04, 0x95, 0xab, + 0x4b, 0x43, 0xb9, 0xe2, 0x07, 0xf8, 0x9f, 0x87, 0xf6, 0xfe, 0xcc, 0xe9, 0x19, 0x44, 0x3e, 0x5c, + 0x08, 0xe1, 0xcc, 0x9f, 0xa1, 0x34, 0x4a, 0x9f, 0x3a, 0x73, 0x1e, 0xc7, 0xc8, 0x8f, 0x16, 0x63, + 0x38, 0xb9, 0x0d, 0xeb, 0x63, 0xf9, 0xdb, 0x5f, 0xb0, 0xf2, 0x04, 0x36, 0xe7, 0xe8, 0xa7, 0x05, + 0xad, 0xf6, 0xf2, 0x62, 0xa0, 0x08, 0x97, 0x03, 0x45, 0xf8, 0x3d, 0x50, 0x84, 0x6f, 0x43, 0xa5, + 0x70, 0x39, 0x54, 0x0a, 0x3f, 0x87, 0x4a, 0xe1, 0xd3, 0xe3, 0xdc, 0x0b, 0xf2, 0xe6, 0xe3, 0xfb, + 0x17, 0xc7, 0x98, 0x9d, 0x93, 0xb0, 0xa5, 0x5b, 0x4d, 0xe4, 0xfa, 0x7a, 0x8f, 0xff, 0x05, 0xc4, + 0x6f, 0x49, 0x63, 0x35, 0x7e, 0xb7, 0x9f, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x5f, 0x6e, + 0x89, 0x1f, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1099,13 +1097,16 @@ func (m *MsgUpdateCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintTx(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x12 + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) @@ -1407,10 +1408,8 @@ func (m *MsgUpdateCommission) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.Commission.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1982,7 +1981,9 @@ func (m *MsgUpdateCommission) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Commission = string(dAtA[iNdEx:postIndex]) + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex From 0745e733a84400b0d4f662e34d4252377ba23523 Mon Sep 17 00:00:00 2001 From: Maximilian Breithecker <72022235+mbreithecker@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:58:26 +0200 Subject: [PATCH 07/18] fix(`2.2.7`): improve commission when creating staker (#25) Co-authored-by: John Letey --- proto/kyve/stakers/v1beta1/tx.proto | 12 +- .../cli/{tx_stake.go => tx_create_staker.go} | 15 +- x/stakers/keeper/msg_server_create_staker.go | 7 +- .../keeper/msg_server_create_staker_test.go | 13 +- x/stakers/types/keys.go | 2 +- x/stakers/types/message_create_staker.go | 8 ++ x/stakers/types/tx.pb.go | 135 ++++++++++++------ 7 files changed, 134 insertions(+), 58 deletions(-) rename x/stakers/client/cli/{tx_stake.go => tx_create_staker.go} (71%) diff --git a/proto/kyve/stakers/v1beta1/tx.proto b/proto/kyve/stakers/v1beta1/tx.proto index cda550d1..d1509d1f 100644 --- a/proto/kyve/stakers/v1beta1/tx.proto +++ b/proto/kyve/stakers/v1beta1/tx.proto @@ -25,12 +25,18 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgStakePool defines a SDK message for staking in a pool. +// MsgCreateStaker defines a SDK message for creating a staker. message MsgCreateStaker { - // creator ... + // creator is the address of the staker. string creator = 1; - // amount ... + // amount is the initial self-stake of the staker. uint64 amount = 2; + // commission is the percentage that is deducted from rewards before + // distributing the staker's delegators. + string commission = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } // MsgStakePoolResponse defines the Msg/StakePool response type. diff --git a/x/stakers/client/cli/tx_stake.go b/x/stakers/client/cli/tx_create_staker.go similarity index 71% rename from x/stakers/client/cli/tx_stake.go rename to x/stakers/client/cli/tx_create_staker.go index 310dab85..2b12fadb 100644 --- a/x/stakers/client/cli/tx_stake.go +++ b/x/stakers/client/cli/tx_create_staker.go @@ -5,29 +5,36 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cast" "github.com/spf13/cobra" ) func CmdCreateStaker() *cobra.Command { cmd := &cobra.Command{ - Use: "create-staker [amount]", + Use: "create-staker [amount] [commission]", Short: "Broadcast message create-staker", - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argAmount, err := cast.ToUint64E(args[0]) if err != nil { return err } + argCommission, err := sdk.NewDecFromStr(args[1]) + if err != nil { + return err + } + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } msg := types.MsgCreateStaker{ - Creator: clientCtx.GetFromAddress().String(), - Amount: argAmount, + Creator: clientCtx.GetFromAddress().String(), + Amount: argAmount, + Commission: argCommission, } if err := msg.ValidateBasic(); err != nil { diff --git a/x/stakers/keeper/msg_server_create_staker.go b/x/stakers/keeper/msg_server_create_staker.go index 19599dea..7bd95860 100644 --- a/x/stakers/keeper/msg_server_create_staker.go +++ b/x/stakers/keeper/msg_server_create_staker.go @@ -15,7 +15,10 @@ import ( // Every user can create a staker object with some stake. However, // only if self_delegation + delegation is large enough to join a pool the staker // is able to participate in the protocol -func (k msgServer) CreateStaker(goCtx context.Context, msg *types.MsgCreateStaker) (*types.MsgCreateStakerResponse, error) { +func (k msgServer) CreateStaker( + goCtx context.Context, + msg *types.MsgCreateStaker, +) (*types.MsgCreateStakerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // Only create new stakers @@ -26,7 +29,7 @@ func (k msgServer) CreateStaker(goCtx context.Context, msg *types.MsgCreateStake // Create and append new staker to store k.AppendStaker(ctx, types.Staker{ Address: msg.Creator, - Commission: types.DefaultCommission, + Commission: msg.Commission, }) // Perform initial self delegation diff --git a/x/stakers/keeper/msg_server_create_staker_test.go b/x/stakers/keeper/msg_server_create_staker_test.go index c8897310..cc933974 100644 --- a/x/stakers/keeper/msg_server_create_staker_test.go +++ b/x/stakers/keeper/msg_server_create_staker_test.go @@ -2,6 +2,7 @@ package keeper_test import ( delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" + sdk "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -39,8 +40,9 @@ var _ = Describe("msg_server_create_staker.go", Ordered, func() { It("Create a first new staker and delegate 100 $KYVE", func() { // ACT s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ - Creator: i.STAKER_0, - Amount: 100 * i.KYVE, + Creator: i.STAKER_0, + Amount: 100 * i.KYVE, + Commission: sdk.MustNewDecFromStr("0.2"), }) // ASSERT @@ -56,7 +58,7 @@ var _ = Describe("msg_server_create_staker.go", Ordered, func() { Expect(staker.Address).To(Equal(i.STAKER_0)) Expect(s.App().DelegationKeeper.GetDelegationAmount(s.Ctx(), i.STAKER_0)).To(Equal(100 * i.KYVE)) Expect(s.App().DelegationKeeper.GetDelegationAmountOfDelegator(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(Equal(100 * i.KYVE)) - Expect(staker.Commission).To(Equal(types.DefaultCommission)) + Expect(staker.Commission).To(Equal(sdk.MustNewDecFromStr("0.2"))) Expect(staker.Moniker).To(BeEmpty()) Expect(staker.Logo).To(BeEmpty()) @@ -68,8 +70,9 @@ var _ = Describe("msg_server_create_staker.go", Ordered, func() { It("Do an additional 50 $KYVE self delegation after staker has already delegated 100 $KYVE", func() { // ARRANGE s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{ - Creator: i.STAKER_0, - Amount: 100 * i.KYVE, + Creator: i.STAKER_0, + Amount: 100 * i.KYVE, + Commission: types.DefaultCommission, }) // ACT diff --git a/x/stakers/types/keys.go b/x/stakers/types/keys.go index 0e3c4084..d025544f 100644 --- a/x/stakers/types/keys.go +++ b/x/stakers/types/keys.go @@ -62,7 +62,7 @@ var ( const MaxStakers = 50 -var DefaultCommission = sdk.MustNewDecFromStr("0.9") +var DefaultCommission = sdk.MustNewDecFromStr("0.1") // StakerKey returns the store Key to retrieve a Staker from the index fields func StakerKey(staker string) []byte { diff --git a/x/stakers/types/message_create_staker.go b/x/stakers/types/message_create_staker.go index fed7e615..831bee31 100644 --- a/x/stakers/types/message_create_staker.go +++ b/x/stakers/types/message_create_staker.go @@ -3,6 +3,7 @@ package types import ( "cosmossdk.io/errors" "cosmossdk.io/math" + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -27,5 +28,12 @@ func (msg *MsgCreateStaker) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") } + if msg.Commission.IsNil() { + msg.Commission = DefaultCommission + } + if util.ValidatePercentage(msg.Commission) != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid commission") + } + return nil } diff --git a/x/stakers/types/tx.pb.go b/x/stakers/types/tx.pb.go index 3dede3d2..114d99e5 100644 --- a/x/stakers/types/tx.pb.go +++ b/x/stakers/types/tx.pb.go @@ -30,12 +30,15 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgStakePool defines a SDK message for staking in a pool. +// MsgCreateStaker defines a SDK message for creating a staker. type MsgCreateStaker struct { - // creator ... + // creator is the address of the staker. Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - // amount ... + // amount is the initial self-stake of the staker. Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + // commission is the percentage that is deducted from rewards before + // distributing the staker's delegators. + Commission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission"` } func (m *MsgCreateStaker) Reset() { *m = MsgCreateStaker{} } @@ -629,46 +632,46 @@ func init() { func init() { proto.RegisterFile("kyve/stakers/v1beta1/tx.proto", fileDescriptor_f52b730e69b9fb06) } var fileDescriptor_f52b730e69b9fb06 = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xd3, 0x4c, - 0x18, 0x8d, 0xff, 0x46, 0xed, 0x9f, 0x8f, 0x8a, 0x8b, 0x09, 0xad, 0xeb, 0xaa, 0x6e, 0xb1, 0x54, - 0x68, 0x11, 0xb1, 0x15, 0x90, 0xd8, 0x37, 0x01, 0x24, 0x2e, 0xae, 0x2a, 0x57, 0x20, 0x2e, 0x8b, - 0x6a, 0x62, 0x8f, 0x1c, 0x93, 0xd8, 0x63, 0x79, 0x26, 0x69, 0xb2, 0xe2, 0x15, 0x78, 0x18, 0x1e, - 0xa2, 0xcb, 0x8a, 0x15, 0x62, 0x51, 0xa1, 0x44, 0xe2, 0x39, 0x90, 0x6f, 0x13, 0x27, 0xcd, 0x4d, - 0xac, 0xe2, 0x6f, 0xbe, 0x33, 0xe7, 0x9c, 0x99, 0x39, 0x33, 0x81, 0x9d, 0x56, 0xbf, 0x8b, 0x75, - 0xca, 0x50, 0x0b, 0x87, 0x54, 0xef, 0x56, 0x1b, 0x98, 0xa1, 0xaa, 0xce, 0x7a, 0x5a, 0x10, 0x12, - 0x46, 0xc4, 0x72, 0xd4, 0xd6, 0xd2, 0xb6, 0x96, 0xb6, 0xe5, 0x2d, 0x8b, 0x50, 0x8f, 0xd0, 0xb3, - 0x18, 0xa3, 0x27, 0x45, 0x32, 0x41, 0x2e, 0x3b, 0xc4, 0x21, 0xc9, 0x78, 0xf4, 0x95, 0x8c, 0xaa, - 0x75, 0xb8, 0x65, 0x50, 0xa7, 0x1e, 0x62, 0xc4, 0xf0, 0x69, 0x4c, 0x26, 0x4a, 0xb0, 0x66, 0x45, - 0x35, 0x09, 0x25, 0x61, 0x4f, 0x38, 0x28, 0x99, 0x59, 0x29, 0x6e, 0xc0, 0x2a, 0xf2, 0x48, 0xc7, - 0x67, 0xd2, 0x7f, 0x7b, 0xc2, 0x41, 0xd1, 0x4c, 0x2b, 0x75, 0x0b, 0x36, 0x27, 0x48, 0x4c, 0x4c, - 0x03, 0xe2, 0x53, 0xac, 0x76, 0xe0, 0x8e, 0x41, 0x9d, 0x77, 0x81, 0x8d, 0x18, 0x36, 0x30, 0x43, - 0x36, 0x62, 0x68, 0x8e, 0x82, 0x04, 0x6b, 0x1e, 0xf1, 0xdd, 0x16, 0x0e, 0x63, 0x89, 0x92, 0x99, - 0x95, 0x51, 0xe7, 0x1c, 0x37, 0xa8, 0xcb, 0xb0, 0xb4, 0x92, 0x74, 0xd2, 0x52, 0x14, 0xa1, 0xd8, - 0x26, 0x0e, 0x91, 0x8a, 0xf1, 0x70, 0x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f, 0x06, 0x00, 0x00, + // 623 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0xdb, 0xa8, 0x25, 0x97, 0x8a, 0x87, 0x09, 0xad, 0xeb, 0xaa, 0x6e, 0xb1, 0x54, 0x68, + 0x11, 0xb5, 0x15, 0x90, 0xd8, 0x37, 0x05, 0x24, 0x1e, 0xae, 0x2a, 0x57, 0x20, 0x1e, 0x8b, 0x6a, + 0x62, 0x8f, 0x1c, 0x93, 0xd8, 0x63, 0x79, 0x26, 0x69, 0xb2, 0xe2, 0x17, 0x90, 0xf8, 0x15, 0x3e, + 0xa2, 0xcb, 0x8a, 0x15, 0x62, 0x51, 0xa1, 0x44, 0xe2, 0x3b, 0x90, 0x5f, 0x13, 0x27, 0xcd, 0x4b, + 0xb0, 0xb2, 0xef, 0xdc, 0x33, 0xe7, 0x9e, 0xb9, 0x3e, 0xd7, 0x03, 0x9b, 0x8d, 0x6e, 0x1b, 0xeb, + 0x94, 0xa1, 0x06, 0x0e, 0xa9, 0xde, 0xae, 0xd4, 0x30, 0x43, 0x15, 0x9d, 0x75, 0xb4, 0x20, 0x24, + 0x8c, 0x88, 0xe5, 0x28, 0xad, 0xa5, 0x69, 0x2d, 0x4d, 0xcb, 0xeb, 0x16, 0xa1, 0x1e, 0xa1, 0xa7, + 0x31, 0x46, 0x4f, 0x82, 0x64, 0x83, 0x5c, 0x76, 0x88, 0x43, 0x92, 0xf5, 0xe8, 0x2d, 0x59, 0x55, + 0xbf, 0x09, 0x70, 0xd3, 0xa0, 0xce, 0x61, 0x88, 0x11, 0xc3, 0x27, 0x31, 0x9b, 0x28, 0xc1, 0xb2, + 0x15, 0xc5, 0x24, 0x94, 0x84, 0x6d, 0x61, 0xb7, 0x64, 0x66, 0xa1, 0xb8, 0x0a, 0x4b, 0xc8, 0x23, + 0x2d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0xff, + 0x76, 0x66, 0x9c, 0x3c, 0x81, 0x4d, 0xf9, 0xf4, 0xe3, 0x8c, 0x56, 0x7d, 0x71, 0xde, 0x53, 0x84, + 0x8b, 0x9e, 0x22, 0xfc, 0xee, 0x29, 0xc2, 0xd7, 0xbe, 0x52, 0xb8, 0xe8, 0x2b, 0x85, 0x9f, 0x7d, + 0xa5, 0xf0, 0xf1, 0x51, 0xee, 0x0f, 0xf2, 0xfa, 0xc3, 0xbb, 0xe7, 0x47, 0x98, 0x9d, 0x91, 0xb0, + 0xa1, 0x5b, 0x75, 0xe4, 0xfa, 0x7a, 0x87, 0xdf, 0x29, 0xf1, 0xbf, 0xa4, 0xb6, 0x14, 0x5f, 0x04, + 0x4f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xb9, 0x9d, 0xe9, 0x70, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -965,6 +968,16 @@ func (m *MsgCreateStaker) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if m.Amount != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Amount)) i-- @@ -1352,6 +1365,8 @@ func (m *MsgCreateStaker) Size() (n int) { if m.Amount != 0 { n += 1 + sovTx(uint64(m.Amount)) } + l = m.Commission.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1591,6 +1606,40 @@ func (m *MsgCreateStaker) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", 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 + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 9e2076407963f7428a7cff05d2de831105d90f7f Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Mon, 27 Mar 2023 14:03:28 +0200 Subject: [PATCH 08/18] fix(`2.2.20`): typographical errors --- .../keeper/{grpc_account_asssets.go => grpc_account_assets.go} | 0 x/stakers/types/{message_leavel_pool.go => message_leave_pool.go} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename x/query/keeper/{grpc_account_asssets.go => grpc_account_assets.go} (100%) rename x/stakers/types/{message_leavel_pool.go => message_leave_pool.go} (100%) diff --git a/x/query/keeper/grpc_account_asssets.go b/x/query/keeper/grpc_account_assets.go similarity index 100% rename from x/query/keeper/grpc_account_asssets.go rename to x/query/keeper/grpc_account_assets.go diff --git a/x/stakers/types/message_leavel_pool.go b/x/stakers/types/message_leave_pool.go similarity index 100% rename from x/stakers/types/message_leavel_pool.go rename to x/stakers/types/message_leave_pool.go From 75508a3d06db8718c877288d968264d3b50375fb Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Mon, 27 Mar 2023 14:08:35 +0200 Subject: [PATCH 09/18] fix(`2.2.21`): remove unused function --- x/query/types/keys.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/query/types/keys.go b/x/query/types/keys.go index 7237b127..33acf9b0 100644 --- a/x/query/types/keys.go +++ b/x/query/types/keys.go @@ -13,7 +13,3 @@ const ( // MemStoreKey defines the in-memory store key MemStoreKey = "mem_query" ) - -func KeyPrefix(p string) []byte { - return []byte(p) -} From f40a82ea6fcb25a8188426381a0b298e90d842ba Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 29 Mar 2023 08:44:29 +0200 Subject: [PATCH 10/18] fix(`2.2.13`): incorrect function descriptions in comments --- util/logic_bank.go | 64 +++++++++++++++++++++++++++++++++++-------- x/query/types/keys.go | 2 +- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/util/logic_bank.go b/util/logic_bank.go index bc2337c6..7160b861 100644 --- a/util/logic_bank.go +++ b/util/logic_bank.go @@ -7,9 +7,19 @@ import ( type BankKeeper interface { SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount( + ctx sdk.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule( + ctx sdk.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error } type DistrKeeper interface { @@ -21,7 +31,13 @@ type AccountKeeper interface { } // TransferFromAddressToAddress sends tokens from the given address to a specified address. -func TransferFromAddressToAddress(bankKeeper BankKeeper, ctx sdk.Context, fromAddress string, toAddress string, amount uint64) error { +func TransferFromAddressToAddress( + bankKeeper BankKeeper, + ctx sdk.Context, + fromAddress string, + toAddress string, + amount uint64, +) error { sender, errSenderAddress := sdk.AccAddressFromBech32(fromAddress) if errSenderAddress != nil { return errSenderAddress @@ -37,8 +53,14 @@ func TransferFromAddressToAddress(bankKeeper BankKeeper, ctx sdk.Context, fromAd return err } -// TransferToAddress sends tokens from the given module to a specified address. -func TransferFromModuleToAddress(bankKeeper BankKeeper, ctx sdk.Context, module string, address string, amount uint64) error { +// TransferFromModuleToAddress sends tokens from the given module to a specified address. +func TransferFromModuleToAddress( + bankKeeper BankKeeper, + ctx sdk.Context, + module string, + address string, + amount uint64, +) error { recipient, errAddress := sdk.AccAddressFromBech32(address) if errAddress != nil { return errAddress @@ -49,8 +71,14 @@ func TransferFromModuleToAddress(bankKeeper BankKeeper, ctx sdk.Context, module return err } -// TransferToRegistry sends tokens from a specified address to the given module. -func TransferFromAddressToModule(bankKeeper BankKeeper, ctx sdk.Context, address string, module string, amount uint64) error { +// TransferFromAddressToModule sends tokens from a specified address to the given module. +func TransferFromAddressToModule( + bankKeeper BankKeeper, + ctx sdk.Context, + address string, + module string, + amount uint64, +) error { sender, errAddress := sdk.AccAddressFromBech32(address) if errAddress != nil { return errAddress @@ -61,14 +89,20 @@ func TransferFromAddressToModule(bankKeeper BankKeeper, ctx sdk.Context, address return err } -// TransferInterModule ... -func TransferFromModuleToModule(bankKeeper BankKeeper, ctx sdk.Context, fromModule string, toModule string, amount uint64) error { +// TransferFromModuleToModule sends tokens from a specified module to the given module. +func TransferFromModuleToModule( + bankKeeper BankKeeper, + ctx sdk.Context, + fromModule string, + toModule string, + amount uint64, +) error { coins := sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(amount))) err := bankKeeper.SendCoinsFromModuleToModule(ctx, fromModule, toModule, coins) return err } -// transferToTreasury sends tokens from this module to the treasury (community spend pool). +// TransferFromAddressToTreasury sends tokens from a given address to the treasury (community spend pool). func TransferFromAddressToTreasury(distrKeeper DistrKeeper, ctx sdk.Context, address string, amount uint64) error { sender, errAddress := sdk.AccAddressFromBech32(address) if errAddress != nil { @@ -83,8 +117,14 @@ func TransferFromAddressToTreasury(distrKeeper DistrKeeper, ctx sdk.Context, add return nil } -// transferToTreasury sends tokens from this module to the treasury (community spend pool). -func TransferFromModuleToTreasury(accountKeeper AccountKeeper, distrKeeper DistrKeeper, ctx sdk.Context, module string, amount uint64) error { +// TransferFromModuleToTreasury sends tokens from a module to the treasury (community spend pool). +func TransferFromModuleToTreasury( + accountKeeper AccountKeeper, + distrKeeper DistrKeeper, + ctx sdk.Context, + module string, + amount uint64, +) error { sender := accountKeeper.GetModuleAddress(module) coins := sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(amount))) diff --git a/x/query/types/keys.go b/x/query/types/keys.go index 33acf9b0..2d7ca9b4 100644 --- a/x/query/types/keys.go +++ b/x/query/types/keys.go @@ -7,7 +7,7 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - // RouterKey is the message route for slashing + // RouterKey is the message route for query RouterKey = ModuleName // MemStoreKey defines the in-memory store key From e11e8b2e22974d1887b918cc8229029d02f5c1cf Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 29 Mar 2023 09:08:50 +0200 Subject: [PATCH 11/18] chore(`2.2.11`): switch to validation helpers --- x/pool/types/message_fund_pool.go | 4 ++-- x/stakers/types/message_create_staker.go | 3 +-- x/stakers/types/message_join_pool.go | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/x/pool/types/message_fund_pool.go b/x/pool/types/message_fund_pool.go index a36729ea..2cb637fc 100644 --- a/x/pool/types/message_fund_pool.go +++ b/x/pool/types/message_fund_pool.go @@ -2,7 +2,7 @@ package types import ( "cosmossdk.io/errors" - "cosmossdk.io/math" + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -31,7 +31,7 @@ func (msg *MsgFundPool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } - if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + if util.ValidateNumber(msg.Amount) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") } diff --git a/x/stakers/types/message_create_staker.go b/x/stakers/types/message_create_staker.go index 831bee31..7947ec07 100644 --- a/x/stakers/types/message_create_staker.go +++ b/x/stakers/types/message_create_staker.go @@ -2,7 +2,6 @@ package types import ( "cosmossdk.io/errors" - "cosmossdk.io/math" "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" @@ -24,7 +23,7 @@ func (msg *MsgCreateStaker) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } - if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + if util.ValidateNumber(msg.Amount) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") } diff --git a/x/stakers/types/message_join_pool.go b/x/stakers/types/message_join_pool.go index b4be808e..20a857f9 100644 --- a/x/stakers/types/message_join_pool.go +++ b/x/stakers/types/message_join_pool.go @@ -2,7 +2,7 @@ package types import ( "cosmossdk.io/errors" - "cosmossdk.io/math" + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -27,7 +27,7 @@ func (msg *MsgJoinPool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) } - if amount := math.NewIntFromUint64(msg.Amount); amount.IsNil() || amount.IsNegative() { + if util.ValidateNumber(msg.Amount) != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid amount") } From 3a80f5f316b1efea251eb2b136d79d3a3811e414 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 29 Mar 2023 10:35:49 +0200 Subject: [PATCH 12/18] fix(`2.2.1`): use non-manipulable pseudo-random source seed --- x/bundles/keeper/logic_bundles.go | 4 +-- ...ic_end_block_handle_upload_timeout_test.go | 2 +- x/query/keeper/grpc_query_can_propose_test.go | 32 +++++++++---------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index 93b84763..0a91567d 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -1,7 +1,6 @@ package keeper import ( - "encoding/binary" "math/rand" "sort" @@ -470,8 +469,7 @@ func (k Keeper) chooseNextUploaderFromSelectedStakers(ctx sdk.Context, poolId ui } } - seed := int64(binary.BigEndian.Uint64(ctx.BlockHeader().AppHash)) - return k.getWeightedRandomChoice(_candidates, seed) + return k.getWeightedRandomChoice(_candidates, ctx.BlockHeader().Height) } // chooseNextUploaderFromAllStakers selects the next uploader based on all diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index 06a3c019..db7104eb 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -638,7 +638,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Expect(bundleProposal.StorageId).To(BeEmpty()) Expect(bundleProposal.Uploader).To(BeEmpty()) - Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_1)) + Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_0)) Expect(bundleProposal.DataSize).To(BeZero()) Expect(bundleProposal.DataHash).To(BeEmpty()) Expect(bundleProposal.BundleSize).To(BeZero()) diff --git a/x/query/keeper/grpc_query_can_propose_test.go b/x/query/keeper/grpc_query_can_propose_test.go index f9455053..85f8971e 100644 --- a/x/query/keeper/grpc_query_can_propose_test.go +++ b/x/query/keeper/grpc_query_can_propose_test.go @@ -428,8 +428,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { // ACT canPropose, err := s.App().QueryKeeper.CanPropose(sdk.WrapSDKContext(s.Ctx()), &querytypes.QueryCanProposeRequest{ PoolId: 0, - Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1, + Staker: i.STAKER_0, + Proposer: i.VALADDRESS_0, FromIndex: 100, }) @@ -442,8 +442,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(Equal(errors.Wrapf(bundletypes.ErrUploadInterval, "expected %v < %v", s.Ctx().BlockTime().Unix(), bundleProposal.UpdatedAt+pool.UploadInterval).Error())) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1, - Staker: i.STAKER_1, + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", DataSize: 100, @@ -463,15 +463,15 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { // ACT canPropose_1, err_1 := s.App().QueryKeeper.CanPropose(sdk.WrapSDKContext(s.Ctx()), &querytypes.QueryCanProposeRequest{ PoolId: 0, - Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1, + Staker: i.STAKER_0, + Proposer: i.VALADDRESS_0, FromIndex: 99, }) canPropose_2, err_2 := s.App().QueryKeeper.CanPropose(sdk.WrapSDKContext(s.Ctx()), &querytypes.QueryCanProposeRequest{ PoolId: 0, - Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1, + Staker: i.STAKER_0, + Proposer: i.VALADDRESS_0, FromIndex: 101, }) @@ -489,8 +489,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose_2.Reason).To(Equal(errors.Wrapf(bundletypes.ErrFromIndex, "expected %v received %v", pool.CurrentIndex+bundleProposal.BundleSize, 101).Error())) _, txErr_1 := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1, - Staker: i.STAKER_1, + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", DataSize: 100, @@ -506,8 +506,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(txErr_1.Error()).To(Equal(canPropose_1.Reason)) _, txErr_2 := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1, - Staker: i.STAKER_1, + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", DataSize: 100, @@ -527,8 +527,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { // ACT canPropose, err := s.App().QueryKeeper.CanPropose(sdk.WrapSDKContext(s.Ctx()), &querytypes.QueryCanProposeRequest{ PoolId: 0, - Staker: i.STAKER_1, - Proposer: i.VALADDRESS_1, + Staker: i.STAKER_0, + Proposer: i.VALADDRESS_0, FromIndex: 100, }) @@ -539,8 +539,8 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { Expect(canPropose.Reason).To(BeEmpty()) _, txErr := s.RunTx(&bundletypes.MsgSubmitBundleProposal{ - Creator: i.VALADDRESS_1, - Staker: i.STAKER_1, + Creator: i.VALADDRESS_0, + Staker: i.STAKER_0, PoolId: 0, StorageId: "test_storage_id", DataSize: 100, From 5ec247b98351a5f40a3b033ef403032db192ca49 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 29 Mar 2023 11:43:59 +0200 Subject: [PATCH 13/18] chore(`2.2.16`): validate pool parameters better --- testutil/integration/transactions.go | 7 +++ util/validate.go | 15 ++++++ x/pool/keeper/msg_server_update_pool.go | 15 +----- x/pool/keeper/msg_server_update_pool_test.go | 14 +----- x/pool/types/{msg.go => msgs.go} | 48 ++++++++++++++++++++ 5 files changed, 73 insertions(+), 26 deletions(-) rename x/pool/types/{msg.go => msgs.go} (67%) diff --git a/testutil/integration/transactions.go b/testutil/integration/transactions.go index 12a298e5..3dce58be 100644 --- a/testutil/integration/transactions.go +++ b/testutil/integration/transactions.go @@ -19,6 +19,13 @@ func (suite *KeeperTestSuite) RunTx(msg sdk.Msg) (*sdk.Result, error) { return res, nil } +func (suite *KeeperTestSuite) RunTxError(msg sdk.Msg) error { + _, err := suite.RunTx(msg) + Expect(err).To(HaveOccurred()) + + return err +} + func (suite *KeeperTestSuite) RunTxSuccess(msg sdk.Msg) *sdk.Result { result, err := suite.RunTx(msg) Expect(err).NotTo(HaveOccurred()) diff --git a/util/validate.go b/util/validate.go index 3314ed3b..cc4169d5 100644 --- a/util/validate.go +++ b/util/validate.go @@ -34,6 +34,21 @@ func ValidateNumber(i interface{}) error { return nil } +func ValidatePositiveNumber(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid type: %T", i) + } + + if math.NewIntFromUint64(v).IsNil() || + math.NewIntFromUint64(v).IsNegative() || + math.NewIntFromUint64(v).IsZero() { + return fmt.Errorf("invalid number: %d", v) + } + + return nil +} + func ValidatePercentage(i interface{}) error { v, ok := i.(sdk.Dec) if !ok { diff --git a/x/pool/keeper/msg_server_update_pool.go b/x/pool/keeper/msg_server_update_pool.go index 3803bd5a..c68d80d5 100644 --- a/x/pool/keeper/msg_server_update_pool.go +++ b/x/pool/keeper/msg_server_update_pool.go @@ -13,19 +13,6 @@ import ( govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -type Update struct { - Name *string - Runtime *string - Logo *string - Config *string - UploadInterval *uint64 - OperatingCost *uint64 - MinDelegation *uint64 - MaxBundleSize *uint64 - StorageProviderId *uint32 - CompressionId *uint32 -} - func (k msgServer) UpdatePool(goCtx context.Context, req *types.MsgUpdatePool) (*types.MsgUpdatePoolResponse, error) { if k.authority != req.Authority { return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) @@ -37,7 +24,7 @@ func (k msgServer) UpdatePool(goCtx context.Context, req *types.MsgUpdatePool) ( return nil, errors.Wrapf(errorsTypes.ErrNotFound, types.ErrPoolNotFound.Error(), req.Id) } - var update Update + var update types.PoolUpdate if err := json.Unmarshal([]byte(req.Payload), &update); err != nil { return nil, err } diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index 7833de3d..df4c66fa 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -288,23 +288,13 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { Payload: "invalid_json_payload\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"OperatingCost\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1}", } - p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) + p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) // ACT - _, submitErr := s.RunTx(&p) - _, voteErr := s.RunTx(&v) - - s.CommitAfter(*votingPeriod) + _ = s.RunTxError(&p) s.Commit() // ASSERT - proposal, _ := s.App().GovKeeper.GetProposal(s.Ctx(), 1) - - Expect(submitErr).To(Not(HaveOccurred())) - Expect(voteErr).To(Not(HaveOccurred())) - - Expect(proposal.Status).To(Equal(govV1Types.StatusFailed)) - pool, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) Expect(found).To(BeTrue()) diff --git a/x/pool/types/msg.go b/x/pool/types/msgs.go similarity index 67% rename from x/pool/types/msg.go rename to x/pool/types/msgs.go index 8bc391f0..a2f954b0 100644 --- a/x/pool/types/msg.go +++ b/x/pool/types/msgs.go @@ -1,8 +1,13 @@ package types import ( + "encoding/json" + "cosmossdk.io/errors" + + "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" + errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" ) var ( @@ -26,6 +31,18 @@ func (msg *MsgCreatePool) ValidateBasic() error { return errors.Wrap(err, "invalid authority address") } + if err := util.ValidatePositiveNumber(msg.UploadInterval); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") + } + + if err := util.ValidatePositiveNumber(msg.OperatingCost); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + } + + if err := util.ValidatePositiveNumber(msg.MinDelegation); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid minimum delegation") + } + return nil } @@ -35,12 +52,43 @@ func (msg *MsgUpdatePool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } +// PoolUpdate ... +type PoolUpdate struct { + Name *string + Runtime *string + Logo *string + Config *string + UploadInterval *uint64 + OperatingCost *uint64 + MinDelegation *uint64 + MaxBundleSize *uint64 + StorageProviderId *uint32 + CompressionId *uint32 +} + // ValidateBasic does a sanity check on the provided data. func (msg *MsgUpdatePool) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errors.Wrap(err, "invalid authority address") } + var payload PoolUpdate + if err := json.Unmarshal([]byte(msg.Payload), &payload); err != nil { + return err + } + + if err := util.ValidatePositiveNumber(*payload.UploadInterval); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") + } + + if err := util.ValidatePositiveNumber(*payload.OperatingCost); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + } + + if err := util.ValidatePositiveNumber(*payload.MinDelegation); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid minimum delegation") + } + return nil } From b7777a707bda0597878d1ed36b0e4ed90790f2ba Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 29 Mar 2023 14:59:22 +0200 Subject: [PATCH 14/18] chore(`2.2.16`): validate update msg and add more tests --- x/pool/keeper/msg_server_update_pool_test.go | 84 ++++++++++++++++++++ x/pool/types/msgs.go | 18 +++-- 2 files changed, 96 insertions(+), 6 deletions(-) diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index df4c66fa..c212e292 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -300,4 +300,88 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { Expect(found).To(BeTrue()) Expect(pool.Name).To(BeEmpty()) }) + + It("Update pool with invalid UploadInterval", func() { + // ARRANGE + msg := &types.MsgUpdatePool{ + Authority: gov, + Id: 1, + Payload: "{\"UploadInterval\": 0}", + } + + p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) + + // ACT + _ = s.RunTxError(&p) + s.Commit() + + // ASSERT + pool, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(found).To(BeTrue()) + Expect(pool.Name).To(BeEmpty()) + }) + + It("Update pool with invalid UploadInterval", func() { + // ARRANGE + msg := &types.MsgUpdatePool{ + Authority: gov, + Id: 1, + Payload: "{\"UploadInterval\": 0}", + } + + p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) + + // ACT + _ = s.RunTxError(&p) + s.Commit() + + // ASSERT + pool, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(found).To(BeTrue()) + Expect(pool.Name).To(BeEmpty()) + }) + + It("Update pool with invalid OperatingCost", func() { + // ARRANGE + msg := &types.MsgUpdatePool{ + Authority: gov, + Id: 1, + Payload: "{\"OperatingCost\": 0}", + } + + p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) + + // ACT + _ = s.RunTxError(&p) + s.Commit() + + // ASSERT + pool, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(found).To(BeTrue()) + Expect(pool.Name).To(BeEmpty()) + }) + + It("Update pool with invalid MinDelegation", func() { + // ARRANGE + msg := &types.MsgUpdatePool{ + Authority: gov, + Id: 1, + Payload: "{\"MinDelegation\": 0}", + } + + p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) + + // ACT + _ = s.RunTxError(&p) + s.Commit() + + // ASSERT + pool, found := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + Expect(found).To(BeTrue()) + Expect(pool.Name).To(BeEmpty()) + }) }) diff --git a/x/pool/types/msgs.go b/x/pool/types/msgs.go index a2f954b0..e6ecaf36 100644 --- a/x/pool/types/msgs.go +++ b/x/pool/types/msgs.go @@ -77,16 +77,22 @@ func (msg *MsgUpdatePool) ValidateBasic() error { return err } - if err := util.ValidatePositiveNumber(*payload.UploadInterval); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") + if payload.UploadInterval != nil { + if err := util.ValidatePositiveNumber(*payload.UploadInterval); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") + } } - if err := util.ValidatePositiveNumber(*payload.OperatingCost); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + if payload.OperatingCost != nil { + if err := util.ValidatePositiveNumber(*payload.OperatingCost); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid operating cost") + } } - if err := util.ValidatePositiveNumber(*payload.MinDelegation); err != nil { - return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid minimum delegation") + if payload.MinDelegation != nil { + if err := util.ValidatePositiveNumber(*payload.MinDelegation); err != nil { + return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid minimum delegation") + } } return nil From 52981ae60dff8095be43c461dac867fa9fddb3c1 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 30 Mar 2023 10:16:53 +0200 Subject: [PATCH 15/18] chore(`2.2.17`): ensure UploadTimeout and MaxPoints are positive numbers --- x/bundles/types/params.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/bundles/types/params.go b/x/bundles/types/params.go index 9b3d2877..aba3bc6e 100644 --- a/x/bundles/types/params.go +++ b/x/bundles/types/params.go @@ -44,7 +44,7 @@ func DefaultParams() Params { // Validate validates the set of params func (p Params) Validate() error { - if err := util.ValidateNumber(p.UploadTimeout); err != nil { + if err := util.ValidatePositiveNumber(p.UploadTimeout); err != nil { return err } @@ -56,7 +56,7 @@ func (p Params) Validate() error { return err } - if err := util.ValidateNumber(p.MaxPoints); err != nil { + if err := util.ValidatePositiveNumber(p.MaxPoints); err != nil { return err } From 722e25349e4edb48f1905e44377ea0cd85525f09 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 31 Mar 2023 09:10:16 +0200 Subject: [PATCH 16/18] chore: update spec files --- x/bundles/spec/05_params.md | 2 +- x/bundles/spec/06_events.md | 15 +++++++++++++++ x/delegation/spec/05_events.md | 15 +++++++++++++++ x/delegation/spec/06_params.md | 3 +++ x/stakers/spec/02_state.md | 4 ++-- x/stakers/spec/05_events.md | 20 +++++++++++++++++++- 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/x/bundles/spec/05_params.md b/x/bundles/spec/05_params.md index 60ebc75d..00257271 100644 --- a/x/bundles/spec/05_params.md +++ b/x/bundles/spec/05_params.md @@ -10,5 +10,5 @@ The bundles module contains the following parameters: |---------------|-------------------------|---------| | UploadTimeout | uint64 (time s) | 600 | | StorageCost | uint64 (tkyve per byte) | 25 | -| NetworkFee | string (%) | "0.01" | +| NetworkFee | sdk.Dec (%) | "0.01" | | MaxPoints | uint64 | 5 | diff --git a/x/bundles/spec/06_events.md b/x/bundles/spec/06_events.md index bcc2c805..a79557d4 100644 --- a/x/bundles/spec/06_events.md +++ b/x/bundles/spec/06_events.md @@ -6,6 +6,21 @@ order: 6 The bundles module contains the following events: +## EventUpdateParams + +EventUpdateParams is emitted when the parameters were changed by the governance. + +```protobuf +message EventUpdateParams { + // old_params is the module's old parameters. + kyve.bundles.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.bundles.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} +``` + ## EventBundleProposed EventBundleProposed indicates that a new bundle proposal was submitted diff --git a/x/delegation/spec/05_events.md b/x/delegation/spec/05_events.md index 20b5b405..1de68327 100644 --- a/x/delegation/spec/05_events.md +++ b/x/delegation/spec/05_events.md @@ -6,6 +6,21 @@ order: 5 The `x/delegation` module emits the following events: +## EventUpdateParams + +EventUpdateParams is emitted when the parameters were changed by the governance. + +```protobuf +message EventUpdateParams { + // old_params is the module's old parameters. + kyve.bundles.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.bundles.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} +``` + ## EndBlocker | Type | Attribute Key | Attribute Value | diff --git a/x/delegation/spec/06_params.md b/x/delegation/spec/06_params.md index 278b293a..878455bd 100644 --- a/x/delegation/spec/06_params.md +++ b/x/delegation/spec/06_params.md @@ -11,3 +11,6 @@ The `x/delegation` module relies on the following parameters: | `UnbondingDelegationTime` | uint64 (time s) | 432000 | | `RedelegationCooldown` | uint64 (time s) | 432000 | | `RedelegationMaxAmount` | uint64 (time s) | 5 | +| `VoteSlash` | sdk.Dec (%) | 0.1 | +| `UploadSlash` | sdk.Dec (%) | 0.2 | +| `TimeoutSlash` | sdk.Dec (%) | 0.02 | diff --git a/x/stakers/spec/02_state.md b/x/stakers/spec/02_state.md index ceb03135..cf918dcf 100644 --- a/x/stakers/spec/02_state.md +++ b/x/stakers/spec/02_state.md @@ -15,7 +15,7 @@ people can delegate to it and the staker can start joining pools type Staker struct { Address string // Needs to be a valid decimal representation - Commission uint64 + Commission sdk.Dec Moniker uint64 Website uint64 Logo uint64 @@ -101,7 +101,7 @@ type CommissionChangeEntry struct { Staker string // Commission is the new commission which will // be applied after the waiting time is over. - Commission String + Commission sdk.Dec // CreationDate is the UNIX-timestamp in seconds // when the entry was created. CreationDate uint64 diff --git a/x/stakers/spec/05_events.md b/x/stakers/spec/05_events.md index 9fa8007b..8ee8ebcd 100644 --- a/x/stakers/spec/05_events.md +++ b/x/stakers/spec/05_events.md @@ -6,6 +6,21 @@ order: 5 The `x/stakers` module contains the following events: +## EventUpdateParams + +EventUpdateParams is emitted when the parameters were changed by the governance. + +```protobuf +message EventUpdateParams { + // old_params is the module's old parameters. + kyve.bundles.v1beta1.Params old_params = 1 [(gogoproto.nullable) = false]; + // new_params is the module's new parameters. + kyve.bundles.v1beta1.Params new_params = 2 [(gogoproto.nullable) = false]; + // payload is the parameter updates that were performed. + string payload = 3; +} +``` + ## EventCreateStaker EventBundleProposed indicates that a new staker was created. @@ -54,7 +69,10 @@ message EventUpdateCommission { // staker is the account address of the protocol node. string staker = 1; // commission ... - string commission = 2; + string commission = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } ``` From 8ecd1ed0b6934174f38270401d238f72dc9fb3ed Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Fri, 31 Mar 2023 09:17:31 +0200 Subject: [PATCH 17/18] chore: update Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddb40b0d..9283d589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Emit an event when updating module parameters. - (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Bump Cosmos SDK to [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) ([`v0.46.11-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.46.11-kyve-rc0)). - (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Switch to CometBFT from Informal Systems' Tendermint fork. +- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups and more validations. ### Bug Fixes @@ -29,6 +30,8 @@ - (`x/bundles`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `NetworkFee` param to type `sdk.Dec`. - (`x/delegation`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `VoteSlash`, `UploadSlash`, `TimeoutSlash` params to type `sdk.Dec`. - (`x/stakers`) [#19](https://github.com/KYVENetwork/chain/pull/19) Migrate `Commission` to type `sdk.Dec`. +- (`x/bundles`) [#22](https://github.com/KYVENetwork/chain/pull/22) use non-manipulable pseudo-random source seed for uploader selection. + ## [v1.0.0](https://github.com/KYVENetwork/chain/releases/tag/v1.0.0) - 2023-03-10 From 2c6a8137a8ed3dd4c0011808c567cfd0ff707005 Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 31 Mar 2023 10:05:11 +0200 Subject: [PATCH 18/18] chore: improve changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9283d589..09574398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,10 @@ ### Improvements -- Emit an event when updating module parameters. - (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Bump Cosmos SDK to [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) ([`v0.46.11-kyve-rc0`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.46.11-kyve-rc0)). - (deps) [#21](https://github.com/KYVENetwork/chain/pull/21) Switch to CometBFT from Informal Systems' Tendermint fork. -- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups and more validations. +- [#22](https://github.com/KYVENetwork/chain/pull/22) Emit an event when updating module parameters. +- [#22](https://github.com/KYVENetwork/chain/pull/22) Various minor code improvements, cleanups, and validations. ### Bug Fixes