From 090bc90e38fa1b367b4f9a646de934d521c93755 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 31 Aug 2024 09:48:31 +0200 Subject: [PATCH 1/4] chore: Align service params with other params implementation --- Makefile | 5 + api/poktroll/service/params.pulsar.go | 129 +- api/poktroll/service/tx.pulsar.go | 1327 ++++++++++++++++- api/poktroll/service/tx_grpc.pb.go | 38 + config.yml | 4 +- e2e/tests/parse_params_test.go | 27 +- e2e/tests/reset_params_test.go | 9 + e2e/tests/update_params.feature | 13 + e2e/tests/update_params_test.go | 4 +- proto/poktroll/service/params.proto | 3 +- proto/poktroll/service/tx.proto | 23 + .../authz/dao_genesis_authorizations.json | 45 + .../params/service_add_service_fee.json | 15 + tools/scripts/params/service_all.json | 16 + x/service/keeper/msg_server_add_service.go | 15 +- .../keeper/msg_server_add_service_test.go | 13 +- x/service/keeper/msg_server_update_param.go | 50 + .../keeper/msg_server_update_param_test.go | 42 + x/service/types/errors.go | 2 + x/service/types/genesis.go | 2 +- x/service/types/genesis_test.go | 5 +- x/service/types/message_update_param.go | 63 + x/service/types/message_update_params.go | 2 +- x/service/types/params.go | 58 +- x/service/types/params.pb.go | 76 +- x/service/types/tx.pb.go | 639 +++++++- 26 files changed, 2411 insertions(+), 214 deletions(-) create mode 100644 tools/scripts/params/service_add_service_fee.json create mode 100644 tools/scripts/params/service_all.json create mode 100644 x/service/keeper/msg_server_update_param.go create mode 100644 x/service/keeper/msg_server_update_param_test.go create mode 100644 x/service/types/message_update_param.go diff --git a/Makefile b/Makefile index 4f10bd069..5ef85ede3 100644 --- a/Makefile +++ b/Makefile @@ -954,6 +954,11 @@ params_update_shared_proof_window_open_offset_blocks: ## Update the shared modul params_update_shared_proof_window_close_offset_blocks: ## Update the shared module proof_window_close_offset_blocks param poktrolld tx authz exec ./tools/scripts/params/shared_proof_window_close_offset_blocks.json $(PARAM_FLAGS) +.PHONY: params_update_service_add_service_fee +params_update_service_add_service_fee: ## Update the service module add_service_fee param + poktrolld tx authz exec ./tools/scripts/params/service_add_service_fee.json $(PARAM_FLAGS) + + .PHONY: params_query_all params_query_all: check_jq ## Query the params from all available modules @for module in $(MODULES); do \ diff --git a/api/poktroll/service/params.pulsar.go b/api/poktroll/service/params.pulsar.go index 58bd48af1..97a819494 100644 --- a/api/poktroll/service/params.pulsar.go +++ b/api/poktroll/service/params.pulsar.go @@ -3,6 +3,7 @@ package service import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -90,8 +91,8 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.AddServiceFee != uint64(0) { - value := protoreflect.ValueOfUint64(x.AddServiceFee) + if x.AddServiceFee != nil { + value := protoreflect.ValueOfMessage(x.AddServiceFee.ProtoReflect()) if !f(fd_Params_add_service_fee, value) { return } @@ -112,7 +113,7 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - return x.AddServiceFee != uint64(0) + return x.AddServiceFee != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -130,7 +131,7 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - x.AddServiceFee = uint64(0) + x.AddServiceFee = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -149,7 +150,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro switch descriptor.FullName() { case "poktroll.service.Params.add_service_fee": value := x.AddServiceFee - return protoreflect.ValueOfUint64(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -171,7 +172,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - x.AddServiceFee = value.Uint() + x.AddServiceFee = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -193,7 +194,10 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - panic(fmt.Errorf("field add_service_fee of message poktroll.service.Params is not mutable")) + if x.AddServiceFee == nil { + x.AddServiceFee = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.AddServiceFee.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -208,7 +212,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - return protoreflect.ValueOfUint64(uint64(0)) + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -278,8 +283,9 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.AddServiceFee != 0 { - n += 1 + runtime.Sov(uint64(x.AddServiceFee)) + if x.AddServiceFee != nil { + l = options.Size(x.AddServiceFee) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -310,10 +316,19 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.AddServiceFee != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.AddServiceFee)) + if x.AddServiceFee != nil { + encoded, err := options.Marshal(x.AddServiceFee) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -365,10 +380,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) } - x.AddServiceFee = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -378,11 +393,28 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.AddServiceFee |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.AddServiceFee == nil { + x.AddServiceFee = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AddServiceFee); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -440,7 +472,7 @@ type Params struct { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` + AddServiceFee *v1beta1.Coin `protobuf:"bytes,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` } func (x *Params) Reset() { @@ -463,11 +495,11 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_service_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetAddServiceFee() uint64 { +func (x *Params) GetAddServiceFee() *v1beta1.Coin { if x != nil { return x.AddServiceFee } - return 0 + return nil } var File_poktroll_service_params_proto protoreflect.FileDescriptor @@ -478,27 +510,30 @@ var file_poktroll_service_params_proto_rawDesc = []byte{ 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x55, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2d, - 0xea, 0xde, 0x1f, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x66, 0x65, 0x65, 0xf2, 0xde, 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, - 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, - 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x78, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0xa7, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, - 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x70, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x2d, 0xea, 0xde, 0x1f, 0x0f, 0x61, + 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0xf2, 0xde, + 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, + 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -515,14 +550,16 @@ func file_poktroll_service_params_proto_rawDescGZIP() []byte { var file_poktroll_service_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_service_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.service.Params + (*Params)(nil), // 0: poktroll.service.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_service_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.service.Params.add_service_fee:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_service_params_proto_init() } diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go index 1947dc7bc..f93986818 100644 --- a/api/poktroll/service/tx.pulsar.go +++ b/api/poktroll/service/tx.pulsar.go @@ -3,6 +3,7 @@ package service import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" @@ -872,6 +873,1043 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParam = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) + +type fastReflection_MsgUpdateParam MsgUpdateParam + +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) +} + +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} + +type fastReflection_MsgUpdateParam_messageType struct{} + +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) +} +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParam) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParam_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParam_authority, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_MsgUpdateParam_name, value) { + return + } + } + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.service.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.service.MsgUpdateParam.name": + x.Name = "" + case "poktroll.service.MsgUpdateParam.as_coin": + x.AsType = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.service.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.service.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + case "poktroll.service.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.service.MsgUpdateParam is not mutable")) + case "poktroll.service.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.service.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.service.MsgUpdateParam.as_type": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParam", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParam) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParam) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x4a + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParamResponse") + fd_MsgUpdateParamResponse_params = md_MsgUpdateParamResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamResponse)(nil) + +type fastReflection_MsgUpdateParamResponse MsgUpdateParamResponse + +func (x *MsgUpdateParamResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(x) +} + +func (x *MsgUpdateParamResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamResponse_messageType fastReflection_MsgUpdateParamResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamResponse_messageType{} + +type fastReflection_MsgUpdateParamResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(nil) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParamResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParamResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + var ( md_MsgAddService protoreflect.MessageDescriptor fd_MsgAddService_owner_address protoreflect.FieldDescriptor @@ -894,7 +1932,7 @@ func (x *MsgAddService) ProtoReflect() protoreflect.Message { } func (x *MsgAddService) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_service_tx_proto_msgTypes[2] + mi := &file_poktroll_service_tx_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1389,7 +2427,7 @@ func (x *MsgAddServiceResponse) ProtoReflect() protoreflect.Message { } func (x *MsgAddServiceResponse) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_service_tx_proto_msgTypes[3] + mi := &file_poktroll_service_tx_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1815,6 +2853,118 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_service_tx_proto_rawDescGZIP(), []int{1} } +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParam) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParam.ProtoReflect.Descriptor instead. +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgUpdateParam) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParam) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if x != nil { + return x.AsType + } + return nil +} + +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *MsgUpdateParamResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. @@ -1831,7 +2981,7 @@ type MsgAddService struct { func (x *MsgAddService) Reset() { *x = MsgAddService{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_service_tx_proto_msgTypes[2] + mi := &file_poktroll_service_tx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1845,7 +2995,7 @@ func (*MsgAddService) ProtoMessage() {} // Deprecated: Use MsgAddService.ProtoReflect.Descriptor instead. func (*MsgAddService) Descriptor() ([]byte, []int) { - return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{4} } func (x *MsgAddService) GetOwnerAddress() string { @@ -1871,7 +3021,7 @@ type MsgAddServiceResponse struct { func (x *MsgAddServiceResponse) Reset() { *x = MsgAddServiceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_service_tx_proto_msgTypes[3] + mi := &file_poktroll_service_tx_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1885,7 +3035,7 @@ func (*MsgAddServiceResponse) ProtoMessage() {} // Deprecated: Use MsgAddServiceResponse.ProtoReflect.Descriptor instead. func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { - return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{5} } var File_poktroll_service_tx_proto protoreflect.FileDescriptor @@ -1895,6 +3045,8 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x63, 0x65, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, @@ -1917,41 +3069,64 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x12, - 0x82, 0xe7, 0xb0, 0x2a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x65, 0x22, 0xba, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, + 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, + 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x22, 0x4a, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9c, 0x01, 0x0a, + 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, + 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x12, 0x82, 0xe7, 0xb0, 0x2a, 0x0d, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, + 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9d, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, + 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, + 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1966,27 +3141,34 @@ func file_poktroll_service_tx_proto_rawDescGZIP() []byte { return file_poktroll_service_tx_proto_rawDescData } -var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_service_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.service.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.service.MsgUpdateParamsResponse - (*MsgAddService)(nil), // 2: poktroll.service.MsgAddService - (*MsgAddServiceResponse)(nil), // 3: poktroll.service.MsgAddServiceResponse - (*Params)(nil), // 4: poktroll.service.Params - (*shared.Service)(nil), // 5: poktroll.shared.Service + (*MsgUpdateParam)(nil), // 2: poktroll.service.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 3: poktroll.service.MsgUpdateParamResponse + (*MsgAddService)(nil), // 4: poktroll.service.MsgAddService + (*MsgAddServiceResponse)(nil), // 5: poktroll.service.MsgAddServiceResponse + (*Params)(nil), // 6: poktroll.service.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*shared.Service)(nil), // 8: poktroll.shared.Service } var file_poktroll_service_tx_proto_depIdxs = []int32{ - 4, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params - 5, // 1: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service - 0, // 2: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams - 2, // 3: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService - 1, // 4: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse - 3, // 5: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params + 7, // 1: poktroll.service.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 6, // 2: poktroll.service.MsgUpdateParamResponse.params:type_name -> poktroll.service.Params + 8, // 3: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service + 0, // 4: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams + 2, // 5: poktroll.service.Msg.UpdateParam:input_type -> poktroll.service.MsgUpdateParam + 4, // 6: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService + 1, // 7: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse + 3, // 8: poktroll.service.Msg.UpdateParam:output_type -> poktroll.service.MsgUpdateParamResponse + 5, // 9: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_poktroll_service_tx_proto_init() } @@ -2021,7 +3203,7 @@ func file_poktroll_service_tx_proto_init() { } } file_poktroll_service_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAddService); i { + switch v := v.(*MsgUpdateParam); i { case 0: return &v.state case 1: @@ -2033,6 +3215,30 @@ func file_poktroll_service_tx_proto_init() { } } file_poktroll_service_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgAddServiceResponse); i { case 0: return &v.state @@ -2045,13 +3251,16 @@ func file_poktroll_service_tx_proto_init() { } } } + file_poktroll_service_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_service_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/service/tx_grpc.pb.go b/api/poktroll/service/tx_grpc.pb.go index 97b8b635a..45f7d6418 100644 --- a/api/poktroll/service/tx_grpc.pb.go +++ b/api/poktroll/service/tx_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion8 const ( Msg_UpdateParams_FullMethodName = "/poktroll.service.Msg/UpdateParams" + Msg_UpdateParam_FullMethodName = "/poktroll.service.Msg/UpdateParam" Msg_AddService_FullMethodName = "/poktroll.service.Msg/AddService" ) @@ -32,6 +33,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) } @@ -53,6 +55,16 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgAddServiceResponse) @@ -72,6 +84,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) mustEmbedUnimplementedMsgServer() } @@ -83,6 +96,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (UnimplementedMsgServer) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented") } @@ -117,6 +133,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParam_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAddService) if err := dec(in); err != nil { @@ -146,6 +180,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, { MethodName: "AddService", Handler: _Msg_AddService_Handler, diff --git a/config.yml b/config.yml index 188eef958..5f5acb398 100644 --- a/config.yml +++ b/config.yml @@ -216,7 +216,9 @@ genesis: denom: upokt service: params: - add_service_fee: "1000000000" + add_service_fee: + amount: "1000000000" + denom: upokt serviceList: - id: anvil name: "anvil" diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index af6571fb5..c51d0395a 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -213,7 +213,7 @@ func (s *suite) newServiceMsgUpdateParams(params paramsMap) cosmostypes.Msg { s.Logf("paramName: %s, value: %v", paramName, paramValue.value) switch paramName { case servicetypes.ParamAddServiceFee: - msgUpdateParams.Params.AddServiceFee = uint64(paramValue.value.(int64)) + msgUpdateParams.Params.AddServiceFee = paramValue.value.(*cosmostypes.Coin) default: s.Fatalf("ERROR: unexpected %q type param name %q", paramValue.typeStr, paramName) } @@ -238,6 +238,8 @@ func (s *suite) newMsgUpdateParam( msg = s.newProofMsgUpdateParam(authority, param) case sharedtypes.ModuleName: msg = s.newSharedMsgUpdateParam(authority, param) + case servicetypes.ModuleName: + msg = s.newServiceMsgUpdateParam(authority, param) default: err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) s.Fatal(err) @@ -280,7 +282,7 @@ func (s *suite) newTokenomicsMsgUpdateParam(authority string, param paramAny) (m }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) } return msg @@ -329,7 +331,7 @@ func (s *suite) newProofMsgUpdateParam(authority string, param paramAny) (msg pr }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, prooftypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, prooftypes.ModuleName) } return msg @@ -362,7 +364,24 @@ func (s *suite) newSharedMsgUpdateParam(authority string, param paramAny) (msg p }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, sharedtypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, sharedtypes.ModuleName) + } + + return msg +} + +func (s *suite) newServiceMsgUpdateParam(authority string, param paramAny) (msg proto.Message) { + switch param.typeStr { + case "coin": + msg = proto.Message(&servicetypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &servicetypes.MsgUpdateParam_AsCoin{ + AsCoin: param.value.(*cosmostypes.Coin), + }, + }) + default: + s.Fatalf("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) } return msg diff --git a/e2e/tests/reset_params_test.go b/e2e/tests/reset_params_test.go index 80c9376e8..404ecd176 100644 --- a/e2e/tests/reset_params_test.go +++ b/e2e/tests/reset_params_test.go @@ -10,6 +10,7 @@ import ( apptypes "github.com/pokt-network/poktroll/x/application/types" gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" @@ -39,6 +40,7 @@ func (s *suite) allModulesMsgUpdateParamsToDefaultsAny() []*codectypes.Any { s.msgUpdateParamsToDefaultsAny(prooftypes.ModuleName), s.msgUpdateParamsToDefaultsAny(tokenomicstypes.ModuleName), s.msgUpdateParamsToDefaultsAny(sharedtypes.ModuleName), + s.msgUpdateParamsToDefaultsAny(servicetypes.ModuleName), } } @@ -95,6 +97,13 @@ func (s *suite) msgUpdateParamsToDefaultsAny(moduleName string) *codectypes.Any Params: sharedtypes.DefaultParams(), }, ) + case servicetypes.ModuleName: + anyMsg, err = codectypes.NewAnyWithValue( + &servicetypes.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(s.granterName).String(), + Params: servicetypes.DefaultParams(), + }, + ) default: s.Fatalf("ERROR: unknown module name: %s", moduleName) } diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index 32297eaac..4ae05c22e 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -62,6 +62,18 @@ Feature: Params Namespace | application_unbonding_period_sessions | 5 | int64 | Then all "shared" module params should be updated + + # NB: If you are reading this and any module has parameters that + # are not being updated in this test, please update the test. + Scenario: An authorized user updates all "service" module params + Given the user has the pocketd binary installed + And all "service" module params are set to their default values + And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "/poktroll.service.MsgUpdateParams" message exists + When the "pnf" account sends an authz exec message to update all "service" module params + | name | value | type | + | add_service_fee | 1000000001 | coin | + Then all "service" module params should be updated + # NB: If you are reading this and any module has parameters that # are not being updated in this test, please update the test. Scenario Outline: An authorized user updates individual module params @@ -88,6 +100,7 @@ Feature: Params Namespace | shared | /poktroll.shared.MsgUpdateParam | proof_window_close_offset_blocks | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | supplier_unbonding_period_sessions | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | application_unbonding_period_sessions | 5 | int64 | + | service | /poktroll.service.MsgUpdateParam | add_service_fee | 1000000001 | coin | Scenario: An unauthorized user cannot update individual module params Given the user has the pocketd binary installed diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index ddc4762e7..dd317d027 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -19,6 +19,7 @@ import ( "github.com/pokt-network/poktroll/api/poktroll/application" "github.com/pokt-network/poktroll/api/poktroll/gateway" "github.com/pokt-network/poktroll/api/poktroll/proof" + "github.com/pokt-network/poktroll/api/poktroll/service" "github.com/pokt-network/poktroll/api/poktroll/session" "github.com/pokt-network/poktroll/api/poktroll/shared" "github.com/pokt-network/poktroll/api/poktroll/supplier" @@ -55,6 +56,7 @@ var allModuleMsgUpdateParamTypes = []string{ shared.Msg_UpdateParams_FullMethodName, supplier.Msg_UpdateParams_FullMethodName, tokenomics.Msg_UpdateParams_FullMethodName, + service.Msg_UpdateParams_FullMethodName, } func init() { @@ -458,7 +460,7 @@ func (s *suite) assertExpectedModuleParamsUpdated(moduleName string) { }, ) case servicetypes.ModuleName: - addServiceFee := uint64(s.expectedModuleParams[moduleName][servicetypes.ParamAddServiceFee].value.(int64)) + addServiceFee := s.expectedModuleParams[moduleName][servicetypes.ParamAddServiceFee].value.(*cosmostypes.Coin) assertUpdatedParams(s, []byte(res.Stdout), &servicetypes.QueryParamsResponse{ diff --git a/proto/poktroll/service/params.proto b/proto/poktroll/service/params.proto index 111ee5c6f..83c61448e 100644 --- a/proto/poktroll/service/params.proto +++ b/proto/poktroll/service/params.proto @@ -5,6 +5,7 @@ option go_package = "github.com/pokt-network/poktroll/x/service/types"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters for the module. @@ -15,5 +16,5 @@ message Params { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - uint64 add_service_fee = 1 [(gogoproto.jsontag) = "add_service_fee", (gogoproto.moretags) = "yaml:\"add_service_fee\""]; + cosmos.base.v1beta1.Coin add_service_fee = 1 [(gogoproto.jsontag) = "add_service_fee", (gogoproto.moretags) = "yaml:\"add_service_fee\""]; } \ No newline at end of file diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto index e9ef6634c..66c11f691 100644 --- a/proto/poktroll/service/tx.proto +++ b/proto/poktroll/service/tx.proto @@ -4,6 +4,7 @@ package poktroll.service; option go_package = "github.com/pokt-network/poktroll/x/service/types"; import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -19,6 +20,7 @@ service Msg { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); rpc AddService (MsgAddService ) returns (MsgAddServiceResponse ); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -39,6 +41,27 @@ message MsgUpdateParams { // MsgUpdateParams message. message MsgUpdateParamsResponse {} +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + string name = 2; + oneof as_type { + cosmos.base.v1beta1.Coin as_coin = 9 [(gogoproto.jsontag) = "as_coin"]; + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +message MsgUpdateParamResponse { + Params params = 1; +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 6ca483cec..9bc539937 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -71,6 +71,51 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.service.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.session.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.gateway.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.application.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.supplier.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", diff --git a/tools/scripts/params/service_add_service_fee.json b/tools/scripts/params/service_add_service_fee.json new file mode 100644 index 000000000..bfe444683 --- /dev/null +++ b/tools/scripts/params/service_add_service_fee.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.service.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "add_service_fee", + "as_coin": { + "denom": "upokt", + "amount": "1000000000" + } + } + ] + } +} diff --git a/tools/scripts/params/service_all.json b/tools/scripts/params/service_all.json new file mode 100644 index 000000000..9a1f3f682 --- /dev/null +++ b/tools/scripts/params/service_all.json @@ -0,0 +1,16 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.service.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "add_service_fee": { + "denom": "upokt", + "amount": "1000000000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index 4df23b94b..6df0bb60c 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/telemetry" @@ -72,23 +71,23 @@ func (k msgServer) AddService( // Check the balance of upokt is enough to cover the AddServiceFee. accBalance := accCoins.AmountOf("upokt") - addServiceFee := math.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) - if accBalance.LTE(addServiceFee) { + addServiceFee := k.GetParams(ctx).AddServiceFee + if accBalance.LTE(addServiceFee.Amount) { logger.Error(fmt.Sprintf("%s doesn't have enough funds to add service: %v", serviceOwnerAddr, err)) return nil, types.ErrServiceNotEnoughFunds.Wrapf( - "account has %d uPOKT, but the service fee is %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + "account has %s, but the service fee is %s", + accBalance, k.GetParams(ctx).AddServiceFee, ) } // Deduct the service fee from the actor's balance. - serviceFee := sdk.Coins{sdk.NewCoin("upokt", addServiceFee)} + serviceFee := sdk.NewCoins(*addServiceFee) err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, serviceOwnerAddr, types.ModuleName, serviceFee) if err != nil { logger.Error(fmt.Sprintf("Failed to deduct service fee from actor's balance: %v", err)) return nil, types.ErrServiceFailedToDeductFee.Wrapf( - "account has %d uPOKT, failed to deduct %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + "account has %s, failed to deduct %s", + accBalance, k.GetParams(ctx).AddServiceFee, ) } diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index 962689710..e798c31d1 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -5,6 +5,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/service/keeper" @@ -13,7 +14,7 @@ import ( ) // oneUPOKTGreaterThanFee is 1 upokt more than the AddServiceFee -const oneUPOKTGreaterThanFee = types.DefaultAddServiceFee + 1 +var oneUPOKTGreaterThanFee = types.DefaultAddServiceFee.Amount.Uint64() + 1 func TestMsgServer_AddService(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) @@ -39,7 +40,7 @@ func TestMsgServer_AddService(t *testing.T) { } // Mock adding a balance to the account - keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) // Add the service to the store _, err := srv.AddService(ctx, &types.MsgAddService{ @@ -64,7 +65,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "valid - service added successfully", setup: func(t *testing.T) { // Add 10000000001 upokt to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) }, address: newServiceOwnerAddr, service: newService, @@ -153,7 +154,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - insufficient upokt balance", setup: func(t *testing.T) { // Add 999999999 upokt to the account (one less than AddServiceFee) - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee-2) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee-2) }, address: newServiceOwnerAddr, service: newService, @@ -163,7 +164,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - account has exactly AddServiceFee", setup: func(t *testing.T) { // Add the exact fee in upokt to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", types.DefaultAddServiceFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, types.DefaultAddServiceFee.Amount.Uint64()) }, address: newServiceOwnerAddr, service: newService, @@ -173,7 +174,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - sufficient balance of different denom", setup: func(t *testing.T) { // Adds 10000000001 wrong coins to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "not_upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) }, address: newServiceOwnerAddr, service: newService, diff --git a/x/service/keeper/msg_server_update_param.go b/x/service/keeper/msg_server_update_param.go new file mode 100644 index 000000000..d2d224dba --- /dev/null +++ b/x/service/keeper/msg_server_update_param.go @@ -0,0 +1,50 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/service/types" +) + +// UpdateParam updates a single parameter in the service module and returns +// all active parameters. +func (k msgServer) UpdateParam( + ctx context.Context, + msg *types.MsgUpdateParam, +) (*types.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + if k.GetAuthority() != msg.Authority { + return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + params := k.GetParams(ctx) + + switch msg.Name { + case types.ParamAddServiceFee: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) + if !ok { + return nil, types.ErrServiceParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + addServiceFee := value.AsCoin + + if err := types.ValidateAddServiceFee(addServiceFee); err != nil { + return nil, err + } + + params.AddServiceFee = addServiceFee + default: + return nil, types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil +} diff --git a/x/service/keeper/msg_server_update_param_test.go b/x/service/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..74c038d20 --- /dev/null +++ b/x/service/keeper/msg_server_update_param_test.go @@ -0,0 +1,42 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +func TestMsgUpdateParam_UpdateAddServiceFee(t *testing.T) { + expectedAddServiceFee := &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(1000000001)} + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := servicetypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, expectedAddServiceFee, defaultParams.AddServiceFee) + + // Update the add service fee parameter + updateParamMsg := &servicetypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: servicetypes.ParamAddServiceFee, + AsType: &servicetypes.MsgUpdateParam_AsCoin{AsCoin: expectedAddServiceFee}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.AddServiceFee, res.Params.AddServiceFee) + require.Equal(t, expectedAddServiceFee, res.Params.AddServiceFee) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "AddServiceFee") +} diff --git a/x/service/types/errors.go b/x/service/types/errors.go index d0c52965a..4163d22ff 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -20,4 +20,6 @@ var ( ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") ErrServiceInvalidComputeUnitsPerRelay = sdkerrors.Register(ModuleName, 1112, "invalid compute units per relay") ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") + ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") + ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") ) diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go index 4c324a41f..b8d040cb5 100644 --- a/x/service/types/genesis.go +++ b/x/service/types/genesis.go @@ -31,5 +31,5 @@ func (gs GenesisState) Validate() error { } // this line is used by starport scaffolding # genesis/types/validate - return gs.Params.Validate() + return gs.Params.ValidateBasic() } diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index d6abdd42d..aa90380bc 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -3,8 +3,11 @@ package types_test import ( "testing" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -70,7 +73,7 @@ func TestGenesisState_Validate(t *testing.T) { desc: "invalid - invalid add service fee parameter (below minimum)", genState: &types.GenesisState{ Params: types.Params{ - AddServiceFee: 999999, // 0.999999 POKT + AddServiceFee: &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(999999)}, // 0.999999 POKT }, ServiceList: []sharedtypes.Service{ *svc1, *svc2, diff --git a/x/service/types/message_update_param.go b/x/service/types/message_update_param.go new file mode 100644 index 000000000..04c7db8f6 --- /dev/null +++ b/x/service/types/message_update_param.go @@ -0,0 +1,63 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParam)(nil) + +// NewMsgUpdateParam creates a new MsgUpdateParam instance for a single +// governance parameter update. +func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdateParam, error) { + var valueAsType isMsgUpdateParam_AsType + + switch v := value.(type) { + case *sdk.Coin: + valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} + default: + return nil, fmt.Errorf("unexpected param value type: %T", value) + } + + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: valueAsType, + }, nil +} + +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures +// the parameter name is supported and the parameter type matches the expected type for +// a given parameter name. +func (msg *MsgUpdateParam) ValidateBasic() error { + // Validate the address + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return ErrServiceInvalidAddress.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) + } + + // Parameter value cannot be nil. + if msg.AsType == nil { + return ErrServiceParamInvalid.Wrap("missing param AsType") + } + + // Parameter name must be supported by this module. + switch msg.Name { + case ParamAddServiceFee: + return msg.paramTypeIsCoin() + default: + return ErrServiceParamNameInvalid.Wrapf("unsupported param %q", msg.Name) + } +} + +// paramTypeIsCoin checks if the parameter type is *cosmostypes.Coin, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsCoin); !ok { + return ErrServiceParamInvalid.Wrapf( + "invalid type for param %q expected %T, got %T", + msg.Name, &MsgUpdateParam_AsCoin{}, + msg.AsType, + ) + } + return nil +} diff --git a/x/service/types/message_update_params.go b/x/service/types/message_update_params.go index 77a83ff59..ebc6f120b 100644 --- a/x/service/types/message_update_params.go +++ b/x/service/types/message_update_params.go @@ -13,7 +13,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return sdkerrors.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { + if err := m.Params.ValidateBasic(); err != nil { return err } diff --git a/x/service/types/params.go b/x/service/types/params.go index f4a921df3..24042f18e 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -1,23 +1,22 @@ package types import ( - "fmt" - + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/pokt-network/poktroll/app/volatile" ) // DefaultAddServiceFee is the default value for the add service fee // parameter in the genesis state of the service module. // TODO_BETA: Revisit default param values for service fee -const ( - ParamAddServiceFee = "add_service_fee" - DefaultAddServiceFee = 1000000000 // 1000 POKT -) - var ( _ paramtypes.ParamSet = (*Params)(nil) - KeyAddServiceFee = []byte("AddServiceFee") + KeyAddServiceFee = []byte("AddServiceFee") + ParamAddServiceFee = "add_service_fee" + // TODO_TECHDEBT: Determine a sensible default value for the proof submission fee. + DefaultAddServiceFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000000)) ) // ParamKeyTable the param key table for launch module @@ -26,7 +25,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams(addServiceFee uint64) Params { +func NewParams(addServiceFee *cosmostypes.Coin) Params { return Params{ AddServiceFee: addServiceFee, } @@ -35,39 +34,48 @@ func NewParams(addServiceFee uint64) Params { // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams( - DefaultAddServiceFee, + &DefaultAddServiceFee, ) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, validateAddServiceFee), + paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, ValidateAddServiceFee), } } -// Validate validates the set of params -func (p Params) Validate() error { - // TODO_MAINNET: Look into better validation - if p.AddServiceFee < DefaultAddServiceFee { - return ErrServiceInvalidServiceFee.Wrapf( - "AddServiceFee param %d uPOKT: got %d", - DefaultAddServiceFee, - p.AddServiceFee, - ) +// ValidateBasic validates the set of params +func (p Params) ValidateBasic() error { + if err := ValidateAddServiceFee(p.AddServiceFee); err != nil { + return err } return nil } // validateAddServiceFee validates the AddServiceFee param -func validateAddServiceFee(v interface{}) error { - addServiceFee, ok := v.(uint64) +func ValidateAddServiceFee(v interface{}) error { + addServiceFeeCoin, ok := v.(*cosmostypes.Coin) if !ok { - return fmt.Errorf("invalid parameter type: %T", v) + return ErrServiceInvalidServiceFee.Wrapf("invalid parameter type: %T", v) + } + + if addServiceFeeCoin == nil { + return ErrServiceInvalidServiceFee.Wrap("missing proof_submission_fee") + } + + if addServiceFeeCoin.Denom != volatile.DenomuPOKT { + return ErrServiceInvalidServiceFee.Wrapf("invalid coin denom: %s", addServiceFeeCoin.Denom) } - // TODO_BETA: implement validation - _ = addServiceFee + // TODO_MAINNET: Look into better validation + if addServiceFeeCoin.Amount.LT(DefaultAddServiceFee.Amount) { + return ErrServiceInvalidServiceFee.Wrapf( + "AddServiceFee param is below minimum value %s: got %s", + DefaultAddServiceFee, + addServiceFeeCoin, + ) + } return nil } diff --git a/x/service/types/params.pb.go b/x/service/types/params.pb.go index 11b435089..a75cd0199 100644 --- a/x/service/types/params.pb.go +++ b/x/service/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -29,7 +30,7 @@ type Params struct { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee" yaml:"add_service_fee"` + AddServiceFee *types.Coin `protobuf:"bytes,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee" yaml:"add_service_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -65,11 +66,11 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetAddServiceFee() uint64 { +func (m *Params) GetAddServiceFee() *types.Coin { if m != nil { return m.AddServiceFee } - return 0 + return nil } func init() { @@ -79,22 +80,24 @@ func init() { func init() { proto.RegisterFile("poktroll/service/params.proto", fileDescriptor_69b5d0104478b383) } var fileDescriptor_69b5d0104478b383 = []byte{ - // 229 bytes of a gzipped FileDescriptorProto + // 272 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xeb, 0x41, 0xa5, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x9a, 0x19, 0xb9, 0xd8, 0x02, 0xc0, 0x66, - 0x09, 0x85, 0x72, 0xf1, 0x27, 0xa6, 0xa4, 0xc4, 0x43, 0x8d, 0x88, 0x4f, 0x4b, 0x4d, 0x95, 0x60, - 0x54, 0x60, 0xd4, 0x60, 0x71, 0xd2, 0x7d, 0x75, 0x4f, 0x1e, 0x5d, 0xea, 0xd3, 0x3d, 0x79, 0xb1, - 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x34, 0x09, 0xa5, 0x20, 0xde, 0xc4, 0x94, 0x94, 0x60, 0x88, - 0x80, 0x5b, 0x6a, 0xaa, 0x95, 0xd2, 0x8b, 0x05, 0xf2, 0x8c, 0x5d, 0xcf, 0x37, 0x68, 0x49, 0xc2, - 0x3d, 0x51, 0x01, 0xf7, 0x06, 0xc4, 0x6a, 0x27, 0xaf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, - 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, - 0x96, 0x63, 0x88, 0x32, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, - 0xe9, 0xd7, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0xc7, 0x62, 0x58, 0x49, 0x65, 0x41, - 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x63, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x98, 0xe5, - 0x13, 0x34, 0x01, 0x00, 0x00, + 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xe5, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, + 0x93, 0x12, 0x8b, 0x53, 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, 0x33, + 0xf3, 0x20, 0xf2, 0x4a, 0xf3, 0x18, 0xb9, 0xd8, 0x02, 0xc0, 0x76, 0x09, 0x15, 0x70, 0xf1, 0x27, + 0xa6, 0xa4, 0xc4, 0x43, 0xad, 0x88, 0x4f, 0x4b, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, + 0x92, 0xd4, 0x83, 0x18, 0xa2, 0x07, 0x32, 0x44, 0x0f, 0x6a, 0x88, 0x9e, 0x73, 0x7e, 0x66, 0x9e, + 0x93, 0xee, 0xab, 0x7b, 0xf2, 0xe8, 0xba, 0x3e, 0xdd, 0x93, 0x17, 0xab, 0x4c, 0xcc, 0xcd, 0xb1, + 0x52, 0x42, 0x93, 0x50, 0x0a, 0xe2, 0x4d, 0x4c, 0x49, 0x09, 0x86, 0x08, 0xb8, 0xa5, 0xa6, 0x5a, + 0x29, 0xbd, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x24, 0xdc, 0xff, 0x15, 0xf0, 0x10, + 0x80, 0xb8, 0xca, 0xc9, 0xeb, 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, 0x0c, + 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0xfa, 0x75, 0xf3, 0x52, + 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0xb1, 0x18, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0xf6, 0xb3, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xb7, 0xa6, 0x23, 0x6f, 0x01, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -116,7 +119,7 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } - if this.AddServiceFee != that1.AddServiceFee { + if !this.AddServiceFee.Equal(that1.AddServiceFee) { return false } return true @@ -141,10 +144,17 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.AddServiceFee != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.AddServiceFee)) + if m.AddServiceFee != nil { + { + size, err := m.AddServiceFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -166,8 +176,9 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.AddServiceFee != 0 { - n += 1 + sovParams(uint64(m.AddServiceFee)) + if m.AddServiceFee != nil { + l = m.AddServiceFee.Size() + n += 1 + l + sovParams(uint64(l)) } return n } @@ -208,10 +219,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) } - m.AddServiceFee = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -221,11 +232,28 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AddServiceFee |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AddServiceFee == nil { + m.AddServiceFee = &types.Coin{} + } + if err := m.AddServiceFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/service/types/tx.pb.go b/x/service/types/tx.pb.go index cc1c369db..68963a560 100644 --- a/x/service/types/tx.pb.go +++ b/x/service/types/tx.pb.go @@ -7,12 +7,13 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/pokt-network/poktroll/x/shared/types" + types1 "github.com/pokt-network/poktroll/x/shared/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -126,20 +127,158 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to AsType: + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } +func (m *MsgUpdateParam) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParam) ProtoMessage() {} +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return fileDescriptor_31ba9559706e649e, []int{2} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParam.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 *MsgUpdateParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParam.Merge(m, src) +} +func (m *MsgUpdateParam) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParam) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParam.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if m != nil { + return m.AsType + } + return nil +} + +func (m *MsgUpdateParam) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParam) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } +func (m *MsgUpdateParamResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamResponse) ProtoMessage() {} +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_31ba9559706e649e, []int{3} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamResponse.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 *MsgUpdateParamResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamResponse.Merge(m, src) +} +func (m *MsgUpdateParamResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo + +func (m *MsgUpdateParamResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. // TODO_BETA: Add Champions / Sources once its fully defined. type MsgAddService struct { - OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` - Service types.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + Service types1.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` } func (m *MsgAddService) Reset() { *m = MsgAddService{} } func (m *MsgAddService) String() string { return proto.CompactTextString(m) } func (*MsgAddService) ProtoMessage() {} func (*MsgAddService) Descriptor() ([]byte, []int) { - return fileDescriptor_31ba9559706e649e, []int{2} + return fileDescriptor_31ba9559706e649e, []int{4} } func (m *MsgAddService) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -175,11 +314,11 @@ func (m *MsgAddService) GetOwnerAddress() string { return "" } -func (m *MsgAddService) GetService() types.Service { +func (m *MsgAddService) GetService() types1.Service { if m != nil { return m.Service } - return types.Service{} + return types1.Service{} } type MsgAddServiceResponse struct { @@ -189,7 +328,7 @@ func (m *MsgAddServiceResponse) Reset() { *m = MsgAddServiceResponse{} } func (m *MsgAddServiceResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddServiceResponse) ProtoMessage() {} func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_31ba9559706e649e, []int{3} + return fileDescriptor_31ba9559706e649e, []int{5} } func (m *MsgAddServiceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -221,6 +360,8 @@ var xxx_messageInfo_MsgAddServiceResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.service.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.service.MsgUpdateParamsResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.service.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.service.MsgUpdateParamResponse") proto.RegisterType((*MsgAddService)(nil), "poktroll.service.MsgAddService") proto.RegisterType((*MsgAddServiceResponse)(nil), "poktroll.service.MsgAddServiceResponse") } @@ -228,35 +369,43 @@ func init() { func init() { proto.RegisterFile("poktroll/service/tx.proto", fileDescriptor_31ba9559706e649e) } var fileDescriptor_31ba9559706e649e = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xc8, 0xcf, 0x2e, - 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0xa9, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xe9, 0x41, 0xa5, 0xa4, 0x04, 0x13, 0x73, - 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x78, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0xb1, - 0x7e, 0x6e, 0x71, 0xba, 0x7e, 0x99, 0x21, 0x88, 0x82, 0x4a, 0x48, 0x42, 0x24, 0xe2, 0xc1, 0x3c, - 0x7d, 0x08, 0x07, 0x2a, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x11, 0x07, 0xb1, 0xa0, 0xa2, 0xb2, - 0x18, 0x2e, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xc6, 0x94, 0xce, 0x48, 0x2c, 0x4a, 0x4d, 0x81, - 0xa9, 0x82, 0x48, 0x2b, 0xed, 0x65, 0xe4, 0xe2, 0xf7, 0x2d, 0x4e, 0x0f, 0x2d, 0x48, 0x49, 0x2c, - 0x49, 0x0d, 0x00, 0x6b, 0x14, 0x32, 0xe3, 0xe2, 0x4c, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, 0x2c, - 0xa9, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0xea, 0x18, - 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x84, 0x52, - 0x21, 0x6b, 0x2e, 0x36, 0x88, 0xd5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x12, 0x7a, 0xe8, - 0x21, 0xa1, 0x07, 0xb1, 0xc1, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, - 0x06, 0x41, 0xb5, 0x58, 0x99, 0x36, 0x3d, 0xdf, 0xa0, 0x85, 0x30, 0xac, 0xeb, 0xf9, 0x06, 0x2d, - 0x25, 0xb8, 0xd3, 0x2b, 0xe0, 0x7e, 0x43, 0x73, 0xab, 0x92, 0x24, 0x97, 0x38, 0x9a, 0x50, 0x50, - 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd2, 0x1c, 0x46, 0x2e, 0x5e, 0xdf, 0xe2, 0x74, 0xc7, - 0x94, 0x94, 0x60, 0x88, 0x66, 0x21, 0x5b, 0x2e, 0xde, 0xfc, 0xf2, 0xbc, 0xd4, 0xa2, 0xf8, 0x44, - 0x88, 0x17, 0x08, 0x7a, 0x8e, 0x07, 0xac, 0x1c, 0x2a, 0x26, 0x64, 0xc1, 0xc5, 0x0e, 0x75, 0x06, - 0x16, 0x0f, 0x82, 0x03, 0x57, 0x0f, 0x6a, 0x93, 0x13, 0x0b, 0xc8, 0x83, 0x41, 0x30, 0xe5, 0x56, - 0x42, 0x20, 0xcf, 0xa1, 0xda, 0xad, 0x24, 0xce, 0x25, 0x8a, 0xe2, 0x3a, 0x98, 0xbb, 0x8d, 0x0e, - 0x31, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0xc5, 0x70, 0xf1, 0xa0, 0x44, 0x8b, 0x22, 0x66, 0x70, - 0xa2, 0x79, 0x5d, 0x4a, 0x93, 0xa0, 0x12, 0x98, 0x2d, 0x42, 0x61, 0x5c, 0x5c, 0x48, 0x21, 0x23, - 0x8f, 0x55, 0x23, 0x42, 0x81, 0x94, 0x3a, 0x01, 0x05, 0x30, 0x73, 0xa5, 0x58, 0x1b, 0x40, 0xd1, - 0xea, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x33, 0x75, 0xf3, 0x52, 0x4b, 0xca, - 0xf3, 0x8b, 0xb2, 0xf5, 0xb1, 0xc4, 0x76, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xa9, - 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x24, 0x8c, 0x9b, 0xaa, 0x74, 0x03, 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0xd4, 0xda, 0xb2, 0x93, 0xb6, 0xea, 0x52, 0x4d, 0xb2, 0xe0, 0x26, 0xee, 0xc5, 0x18, + 0xe8, 0x6e, 0x53, 0x51, 0x24, 0xe2, 0x21, 0xeb, 0x45, 0x0a, 0x01, 0xd9, 0xa2, 0xa0, 0x08, 0x61, + 0x92, 0x1d, 0x36, 0x4b, 0xbb, 0x3b, 0xcb, 0xce, 0x34, 0x6d, 0x6f, 0xe2, 0xd1, 0x93, 0x7f, 0x80, + 0xde, 0x3d, 0xe6, 0xe0, 0x49, 0xf0, 0xde, 0x63, 0xf1, 0xe4, 0xa9, 0x48, 0x72, 0x08, 0xf8, 0x57, + 0xc8, 0xcc, 0xce, 0x26, 0xdd, 0x24, 0x18, 0xf0, 0x92, 0xcc, 0xbc, 0xef, 0x7b, 0x3f, 0xbe, 0xf7, + 0xde, 0x2c, 0x2c, 0x45, 0xe4, 0x90, 0xc5, 0xe4, 0xe8, 0xc8, 0xa2, 0x38, 0xee, 0xfb, 0x5d, 0x6c, + 0xb1, 0x53, 0x33, 0x8a, 0x09, 0x23, 0xea, 0xcd, 0x14, 0x32, 0x25, 0xa4, 0xdd, 0x42, 0x81, 0x1f, + 0x12, 0x4b, 0xfc, 0x26, 0x24, 0x4d, 0xef, 0x12, 0x1a, 0x10, 0x6a, 0x75, 0x10, 0xc5, 0x56, 0xbf, + 0xde, 0xc1, 0x0c, 0xd5, 0xad, 0x2e, 0xf1, 0x43, 0x89, 0x17, 0x24, 0x1e, 0x50, 0xcf, 0xea, 0xd7, + 0xf9, 0x9f, 0x04, 0x4a, 0x09, 0xd0, 0x16, 0x37, 0x2b, 0xb9, 0x48, 0x68, 0xdb, 0x23, 0x1e, 0x49, + 0xec, 0xfc, 0x24, 0xad, 0x77, 0xe7, 0x2a, 0x8d, 0x50, 0x8c, 0x02, 0x3a, 0x0f, 0xf7, 0x50, 0x8c, + 0xdd, 0x94, 0x95, 0xc0, 0xc6, 0x0f, 0x00, 0x6f, 0xb4, 0xa8, 0xf7, 0x2a, 0x72, 0x11, 0xc3, 0x2f, + 0x85, 0xa3, 0xfa, 0x18, 0x2a, 0xe8, 0x98, 0xf5, 0x48, 0xec, 0xb3, 0xb3, 0x22, 0xa8, 0x80, 0xaa, + 0x62, 0x17, 0x7f, 0x7e, 0xdb, 0xd9, 0x96, 0xc5, 0x34, 0x5d, 0x37, 0xc6, 0x94, 0x1e, 0xb0, 0xd8, + 0x0f, 0x3d, 0x67, 0x4a, 0x55, 0x9f, 0xc2, 0xb5, 0x24, 0x75, 0x71, 0xa5, 0x02, 0xaa, 0xf9, 0xbd, + 0xa2, 0x39, 0xdb, 0x29, 0x33, 0xc9, 0x60, 0x2b, 0xe7, 0x97, 0xe5, 0xdc, 0xd7, 0xf1, 0xa0, 0x06, + 0x1c, 0xe9, 0xd2, 0x78, 0xf4, 0x61, 0x3c, 0xa8, 0x4d, 0x83, 0x7d, 0x1c, 0x0f, 0x6a, 0xc6, 0xa4, + 0xf4, 0xd3, 0x89, 0xb6, 0x99, 0x5a, 0x8d, 0x12, 0x2c, 0xcc, 0x98, 0x1c, 0x4c, 0x23, 0x12, 0x52, + 0x6c, 0x7c, 0x07, 0x70, 0x2b, 0x8b, 0xfd, 0xb7, 0x32, 0x15, 0xae, 0x86, 0x28, 0xc0, 0x42, 0x97, + 0xe2, 0x88, 0xb3, 0xda, 0x84, 0xeb, 0x88, 0xb6, 0xf9, 0x48, 0x8b, 0x8a, 0x90, 0x5b, 0x32, 0x65, + 0x18, 0x3e, 0x73, 0x53, 0xce, 0xdc, 0x7c, 0x4e, 0xfc, 0xd0, 0xce, 0xff, 0xb9, 0x2c, 0xa7, 0xec, + 0x17, 0x39, 0x67, 0x0d, 0x51, 0x6e, 0x6e, 0x6c, 0x65, 0x35, 0xdb, 0x8a, 0x08, 0xc9, 0xce, 0x22, + 0x6c, 0xec, 0xc3, 0x3b, 0xd9, 0xda, 0x53, 0x59, 0xea, 0xee, 0xa4, 0xcb, 0xe0, 0xdf, 0x5d, 0x4e, + 0x5b, 0x6b, 0x7c, 0x06, 0x70, 0xb3, 0x45, 0xbd, 0xa6, 0xeb, 0x1e, 0x24, 0x04, 0xf5, 0x19, 0xdc, + 0x24, 0x27, 0x21, 0x8e, 0xdb, 0x28, 0x51, 0xbc, 0xb4, 0x17, 0x1b, 0x82, 0x2e, 0x6d, 0xea, 0x13, + 0xb8, 0x2e, 0x53, 0x2d, 0x98, 0xb4, 0xd8, 0x32, 0x53, 0x66, 0xb2, 0x57, 0xf9, 0xa4, 0x9d, 0x94, + 0xde, 0x50, 0xb9, 0xe2, 0x6c, 0x6e, 0xa3, 0x00, 0x6f, 0x67, 0xaa, 0x4b, 0x95, 0xee, 0x7d, 0x59, + 0x81, 0xd7, 0x5a, 0xd4, 0x53, 0xdf, 0xc1, 0x8d, 0xcc, 0x7e, 0xde, 0x9b, 0x57, 0x3c, 0xb3, 0x03, + 0xda, 0x83, 0xa5, 0x94, 0x49, 0x3f, 0xdf, 0xc0, 0xfc, 0xd5, 0x15, 0xa9, 0x2c, 0xf3, 0xd4, 0xaa, + 0xcb, 0x18, 0x93, 0xd0, 0xaf, 0x21, 0xbc, 0xd2, 0xf4, 0xf2, 0x42, 0xbf, 0x29, 0x41, 0xbb, 0xbf, + 0x84, 0x90, 0xc6, 0xd5, 0xae, 0xbf, 0xe7, 0x4f, 0xc7, 0xde, 0x3f, 0x1f, 0xea, 0xe0, 0x62, 0xa8, + 0x83, 0xdf, 0x43, 0x1d, 0x7c, 0x1a, 0xe9, 0xb9, 0x8b, 0x91, 0x9e, 0xfb, 0x35, 0xd2, 0x73, 0x6f, + 0x77, 0x3d, 0x9f, 0xf5, 0x8e, 0x3b, 0x66, 0x97, 0x04, 0x16, 0x8f, 0xb9, 0x13, 0x62, 0x76, 0x42, + 0xe2, 0x43, 0x6b, 0xc1, 0x8b, 0xe2, 0xeb, 0x46, 0x3b, 0x6b, 0xe2, 0x73, 0xf0, 0xf0, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe1, 0xee, 0xe1, 0xeb, 0xf8, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -274,6 +423,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) } @@ -294,6 +444,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, "/poktroll.service.Msg/UpdateParam", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) { out := new(MsgAddServiceResponse) err := c.cc.Invoke(ctx, "/poktroll.service.Msg/AddService", in, out, opts...) @@ -308,6 +467,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) } @@ -318,6 +478,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) UpdateParam(ctx context.Context, req *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (*UnimplementedMsgServer) AddService(ctx context.Context, req *MsgAddService) (*MsgAddServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented") } @@ -344,6 +507,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.service.Msg/UpdateParam", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAddService) if err := dec(in); err != nil { @@ -370,6 +551,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, { MethodName: "AddService", Handler: _Msg_AddService_Handler, @@ -442,6 +627,108 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUpdateParam) 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 *MsgUpdateParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AsType != nil { + { + size := m.AsType.Size() + i -= size + if _, err := m.AsType.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + return len(dAtA) - i, nil +} +func (m *MsgUpdateParamResponse) 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 *MsgUpdateParamResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgAddService) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -540,6 +827,51 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgUpdateParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AsType != nil { + n += m.AsType.Size() + } + return n +} + +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgAddService) Size() (n int) { if m == nil { return 0 @@ -735,6 +1067,241 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgAddService) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From f1eda32a80f23436b54724469d24f657adf3377d Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 31 Aug 2024 09:48:31 +0200 Subject: [PATCH 2/4] chore: Align service params with other params implementation --- Makefile | 5 + api/poktroll/service/params.pulsar.go | 129 +- api/poktroll/service/tx.pulsar.go | 1327 ++++++++++++++++- api/poktroll/service/tx_grpc.pb.go | 38 + config.yml | 4 +- e2e/tests/parse_params_test.go | 27 +- e2e/tests/reset_params_test.go | 9 + e2e/tests/update_params.feature | 13 + e2e/tests/update_params_test.go | 4 +- proto/poktroll/service/params.proto | 3 +- proto/poktroll/service/tx.proto | 23 + .../authz/dao_genesis_authorizations.json | 45 + .../params/service_add_service_fee.json | 15 + tools/scripts/params/service_all.json | 16 + x/service/keeper/msg_server_add_service.go | 15 +- .../keeper/msg_server_add_service_test.go | 13 +- x/service/keeper/msg_server_update_param.go | 50 + .../keeper/msg_server_update_param_test.go | 42 + x/service/types/errors.go | 2 + x/service/types/genesis.go | 2 +- x/service/types/genesis_test.go | 5 +- x/service/types/message_update_param.go | 63 + x/service/types/message_update_params.go | 2 +- x/service/types/params.go | 58 +- x/service/types/params.pb.go | 76 +- x/service/types/tx.pb.go | 639 +++++++- 26 files changed, 2411 insertions(+), 214 deletions(-) create mode 100644 tools/scripts/params/service_add_service_fee.json create mode 100644 tools/scripts/params/service_all.json create mode 100644 x/service/keeper/msg_server_update_param.go create mode 100644 x/service/keeper/msg_server_update_param_test.go create mode 100644 x/service/types/message_update_param.go diff --git a/Makefile b/Makefile index 4f10bd069..5ef85ede3 100644 --- a/Makefile +++ b/Makefile @@ -954,6 +954,11 @@ params_update_shared_proof_window_open_offset_blocks: ## Update the shared modul params_update_shared_proof_window_close_offset_blocks: ## Update the shared module proof_window_close_offset_blocks param poktrolld tx authz exec ./tools/scripts/params/shared_proof_window_close_offset_blocks.json $(PARAM_FLAGS) +.PHONY: params_update_service_add_service_fee +params_update_service_add_service_fee: ## Update the service module add_service_fee param + poktrolld tx authz exec ./tools/scripts/params/service_add_service_fee.json $(PARAM_FLAGS) + + .PHONY: params_query_all params_query_all: check_jq ## Query the params from all available modules @for module in $(MODULES); do \ diff --git a/api/poktroll/service/params.pulsar.go b/api/poktroll/service/params.pulsar.go index 58bd48af1..97a819494 100644 --- a/api/poktroll/service/params.pulsar.go +++ b/api/poktroll/service/params.pulsar.go @@ -3,6 +3,7 @@ package service import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -90,8 +91,8 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.AddServiceFee != uint64(0) { - value := protoreflect.ValueOfUint64(x.AddServiceFee) + if x.AddServiceFee != nil { + value := protoreflect.ValueOfMessage(x.AddServiceFee.ProtoReflect()) if !f(fd_Params_add_service_fee, value) { return } @@ -112,7 +113,7 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - return x.AddServiceFee != uint64(0) + return x.AddServiceFee != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -130,7 +131,7 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - x.AddServiceFee = uint64(0) + x.AddServiceFee = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -149,7 +150,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro switch descriptor.FullName() { case "poktroll.service.Params.add_service_fee": value := x.AddServiceFee - return protoreflect.ValueOfUint64(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -171,7 +172,7 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - x.AddServiceFee = value.Uint() + x.AddServiceFee = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -193,7 +194,10 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - panic(fmt.Errorf("field add_service_fee of message poktroll.service.Params is not mutable")) + if x.AddServiceFee == nil { + x.AddServiceFee = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.AddServiceFee.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -208,7 +212,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.service.Params.add_service_fee": - return protoreflect.ValueOfUint64(uint64(0)) + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) @@ -278,8 +283,9 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.AddServiceFee != 0 { - n += 1 + runtime.Sov(uint64(x.AddServiceFee)) + if x.AddServiceFee != nil { + l = options.Size(x.AddServiceFee) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -310,10 +316,19 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.AddServiceFee != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.AddServiceFee)) + if x.AddServiceFee != nil { + encoded, err := options.Marshal(x.AddServiceFee) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -365,10 +380,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) } - x.AddServiceFee = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -378,11 +393,28 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.AddServiceFee |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.AddServiceFee == nil { + x.AddServiceFee = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AddServiceFee); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -440,7 +472,7 @@ type Params struct { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` + AddServiceFee *v1beta1.Coin `protobuf:"bytes,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` } func (x *Params) Reset() { @@ -463,11 +495,11 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_service_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetAddServiceFee() uint64 { +func (x *Params) GetAddServiceFee() *v1beta1.Coin { if x != nil { return x.AddServiceFee } - return 0 + return nil } var File_poktroll_service_params_proto protoreflect.FileDescriptor @@ -478,27 +510,30 @@ var file_poktroll_service_params_proto_rawDesc = []byte{ 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x55, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2d, - 0xea, 0xde, 0x1f, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x66, 0x65, 0x65, 0xf2, 0xde, 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, - 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, - 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x78, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0xa7, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, - 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x70, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x2d, 0xea, 0xde, 0x1f, 0x0f, 0x61, + 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0xf2, 0xde, + 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, + 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -515,14 +550,16 @@ func file_poktroll_service_params_proto_rawDescGZIP() []byte { var file_poktroll_service_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_service_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.service.Params + (*Params)(nil), // 0: poktroll.service.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_service_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.service.Params.add_service_fee:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_service_params_proto_init() } diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go index 1947dc7bc..f93986818 100644 --- a/api/poktroll/service/tx.pulsar.go +++ b/api/poktroll/service/tx.pulsar.go @@ -3,6 +3,7 @@ package service import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" @@ -872,6 +873,1043 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParam = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) + +type fastReflection_MsgUpdateParam MsgUpdateParam + +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) +} + +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} + +type fastReflection_MsgUpdateParam_messageType struct{} + +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) +} +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParam) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParam_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParam_authority, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_MsgUpdateParam_name, value) { + return + } + } + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.service.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.service.MsgUpdateParam.name": + x.Name = "" + case "poktroll.service.MsgUpdateParam.as_coin": + x.AsType = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.service.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.service.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + case "poktroll.service.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.service.MsgUpdateParam is not mutable")) + case "poktroll.service.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.service.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.service.MsgUpdateParam.as_type": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParam", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParam) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParam) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x4a + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParamResponse") + fd_MsgUpdateParamResponse_params = md_MsgUpdateParamResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamResponse)(nil) + +type fastReflection_MsgUpdateParamResponse MsgUpdateParamResponse + +func (x *MsgUpdateParamResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(x) +} + +func (x *MsgUpdateParamResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamResponse_messageType fastReflection_MsgUpdateParamResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamResponse_messageType{} + +type fastReflection_MsgUpdateParamResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(nil) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParamResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParamResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParamResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + var ( md_MsgAddService protoreflect.MessageDescriptor fd_MsgAddService_owner_address protoreflect.FieldDescriptor @@ -894,7 +1932,7 @@ func (x *MsgAddService) ProtoReflect() protoreflect.Message { } func (x *MsgAddService) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_service_tx_proto_msgTypes[2] + mi := &file_poktroll_service_tx_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1389,7 +2427,7 @@ func (x *MsgAddServiceResponse) ProtoReflect() protoreflect.Message { } func (x *MsgAddServiceResponse) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_service_tx_proto_msgTypes[3] + mi := &file_poktroll_service_tx_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1815,6 +2853,118 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_service_tx_proto_rawDescGZIP(), []int{1} } +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParam) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParam.ProtoReflect.Descriptor instead. +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgUpdateParam) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParam) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if x != nil { + return x.AsType + } + return nil +} + +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *MsgUpdateParamResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. @@ -1831,7 +2981,7 @@ type MsgAddService struct { func (x *MsgAddService) Reset() { *x = MsgAddService{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_service_tx_proto_msgTypes[2] + mi := &file_poktroll_service_tx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1845,7 +2995,7 @@ func (*MsgAddService) ProtoMessage() {} // Deprecated: Use MsgAddService.ProtoReflect.Descriptor instead. func (*MsgAddService) Descriptor() ([]byte, []int) { - return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{4} } func (x *MsgAddService) GetOwnerAddress() string { @@ -1871,7 +3021,7 @@ type MsgAddServiceResponse struct { func (x *MsgAddServiceResponse) Reset() { *x = MsgAddServiceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_service_tx_proto_msgTypes[3] + mi := &file_poktroll_service_tx_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1885,7 +3035,7 @@ func (*MsgAddServiceResponse) ProtoMessage() {} // Deprecated: Use MsgAddServiceResponse.ProtoReflect.Descriptor instead. func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { - return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{5} } var File_poktroll_service_tx_proto protoreflect.FileDescriptor @@ -1895,6 +3045,8 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x63, 0x65, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, @@ -1917,41 +3069,64 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x12, - 0x82, 0xe7, 0xb0, 0x2a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x65, 0x22, 0xba, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, + 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, + 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x22, 0x4a, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9c, 0x01, 0x0a, + 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, + 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x12, 0x82, 0xe7, 0xb0, 0x2a, 0x0d, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, + 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9d, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, + 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, + 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, + 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1966,27 +3141,34 @@ func file_poktroll_service_tx_proto_rawDescGZIP() []byte { return file_poktroll_service_tx_proto_rawDescData } -var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_service_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.service.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.service.MsgUpdateParamsResponse - (*MsgAddService)(nil), // 2: poktroll.service.MsgAddService - (*MsgAddServiceResponse)(nil), // 3: poktroll.service.MsgAddServiceResponse - (*Params)(nil), // 4: poktroll.service.Params - (*shared.Service)(nil), // 5: poktroll.shared.Service + (*MsgUpdateParam)(nil), // 2: poktroll.service.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 3: poktroll.service.MsgUpdateParamResponse + (*MsgAddService)(nil), // 4: poktroll.service.MsgAddService + (*MsgAddServiceResponse)(nil), // 5: poktroll.service.MsgAddServiceResponse + (*Params)(nil), // 6: poktroll.service.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*shared.Service)(nil), // 8: poktroll.shared.Service } var file_poktroll_service_tx_proto_depIdxs = []int32{ - 4, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params - 5, // 1: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service - 0, // 2: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams - 2, // 3: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService - 1, // 4: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse - 3, // 5: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params + 7, // 1: poktroll.service.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 6, // 2: poktroll.service.MsgUpdateParamResponse.params:type_name -> poktroll.service.Params + 8, // 3: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service + 0, // 4: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams + 2, // 5: poktroll.service.Msg.UpdateParam:input_type -> poktroll.service.MsgUpdateParam + 4, // 6: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService + 1, // 7: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse + 3, // 8: poktroll.service.Msg.UpdateParam:output_type -> poktroll.service.MsgUpdateParamResponse + 5, // 9: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_poktroll_service_tx_proto_init() } @@ -2021,7 +3203,7 @@ func file_poktroll_service_tx_proto_init() { } } file_poktroll_service_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAddService); i { + switch v := v.(*MsgUpdateParam); i { case 0: return &v.state case 1: @@ -2033,6 +3215,30 @@ func file_poktroll_service_tx_proto_init() { } } file_poktroll_service_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgAddServiceResponse); i { case 0: return &v.state @@ -2045,13 +3251,16 @@ func file_poktroll_service_tx_proto_init() { } } } + file_poktroll_service_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_service_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/service/tx_grpc.pb.go b/api/poktroll/service/tx_grpc.pb.go index 97b8b635a..45f7d6418 100644 --- a/api/poktroll/service/tx_grpc.pb.go +++ b/api/poktroll/service/tx_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion8 const ( Msg_UpdateParams_FullMethodName = "/poktroll.service.Msg/UpdateParams" + Msg_UpdateParam_FullMethodName = "/poktroll.service.Msg/UpdateParam" Msg_AddService_FullMethodName = "/poktroll.service.Msg/AddService" ) @@ -32,6 +33,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) } @@ -53,6 +55,16 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MsgAddServiceResponse) @@ -72,6 +84,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) mustEmbedUnimplementedMsgServer() } @@ -83,6 +96,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (UnimplementedMsgServer) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented") } @@ -117,6 +133,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParam_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAddService) if err := dec(in); err != nil { @@ -146,6 +180,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, { MethodName: "AddService", Handler: _Msg_AddService_Handler, diff --git a/config.yml b/config.yml index 188eef958..5f5acb398 100644 --- a/config.yml +++ b/config.yml @@ -216,7 +216,9 @@ genesis: denom: upokt service: params: - add_service_fee: "1000000000" + add_service_fee: + amount: "1000000000" + denom: upokt serviceList: - id: anvil name: "anvil" diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index af6571fb5..c51d0395a 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -213,7 +213,7 @@ func (s *suite) newServiceMsgUpdateParams(params paramsMap) cosmostypes.Msg { s.Logf("paramName: %s, value: %v", paramName, paramValue.value) switch paramName { case servicetypes.ParamAddServiceFee: - msgUpdateParams.Params.AddServiceFee = uint64(paramValue.value.(int64)) + msgUpdateParams.Params.AddServiceFee = paramValue.value.(*cosmostypes.Coin) default: s.Fatalf("ERROR: unexpected %q type param name %q", paramValue.typeStr, paramName) } @@ -238,6 +238,8 @@ func (s *suite) newMsgUpdateParam( msg = s.newProofMsgUpdateParam(authority, param) case sharedtypes.ModuleName: msg = s.newSharedMsgUpdateParam(authority, param) + case servicetypes.ModuleName: + msg = s.newServiceMsgUpdateParam(authority, param) default: err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) s.Fatal(err) @@ -280,7 +282,7 @@ func (s *suite) newTokenomicsMsgUpdateParam(authority string, param paramAny) (m }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) } return msg @@ -329,7 +331,7 @@ func (s *suite) newProofMsgUpdateParam(authority string, param paramAny) (msg pr }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, prooftypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, prooftypes.ModuleName) } return msg @@ -362,7 +364,24 @@ func (s *suite) newSharedMsgUpdateParam(authority string, param paramAny) (msg p }, }) default: - s.Fatal("unexpected param type %q for %s module", param.typeStr, sharedtypes.ModuleName) + s.Fatalf("unexpected param type %q for %s module", param.typeStr, sharedtypes.ModuleName) + } + + return msg +} + +func (s *suite) newServiceMsgUpdateParam(authority string, param paramAny) (msg proto.Message) { + switch param.typeStr { + case "coin": + msg = proto.Message(&servicetypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &servicetypes.MsgUpdateParam_AsCoin{ + AsCoin: param.value.(*cosmostypes.Coin), + }, + }) + default: + s.Fatalf("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) } return msg diff --git a/e2e/tests/reset_params_test.go b/e2e/tests/reset_params_test.go index 80c9376e8..404ecd176 100644 --- a/e2e/tests/reset_params_test.go +++ b/e2e/tests/reset_params_test.go @@ -10,6 +10,7 @@ import ( apptypes "github.com/pokt-network/poktroll/x/application/types" gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" @@ -39,6 +40,7 @@ func (s *suite) allModulesMsgUpdateParamsToDefaultsAny() []*codectypes.Any { s.msgUpdateParamsToDefaultsAny(prooftypes.ModuleName), s.msgUpdateParamsToDefaultsAny(tokenomicstypes.ModuleName), s.msgUpdateParamsToDefaultsAny(sharedtypes.ModuleName), + s.msgUpdateParamsToDefaultsAny(servicetypes.ModuleName), } } @@ -95,6 +97,13 @@ func (s *suite) msgUpdateParamsToDefaultsAny(moduleName string) *codectypes.Any Params: sharedtypes.DefaultParams(), }, ) + case servicetypes.ModuleName: + anyMsg, err = codectypes.NewAnyWithValue( + &servicetypes.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(s.granterName).String(), + Params: servicetypes.DefaultParams(), + }, + ) default: s.Fatalf("ERROR: unknown module name: %s", moduleName) } diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index 32297eaac..4ae05c22e 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -62,6 +62,18 @@ Feature: Params Namespace | application_unbonding_period_sessions | 5 | int64 | Then all "shared" module params should be updated + + # NB: If you are reading this and any module has parameters that + # are not being updated in this test, please update the test. + Scenario: An authorized user updates all "service" module params + Given the user has the pocketd binary installed + And all "service" module params are set to their default values + And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "/poktroll.service.MsgUpdateParams" message exists + When the "pnf" account sends an authz exec message to update all "service" module params + | name | value | type | + | add_service_fee | 1000000001 | coin | + Then all "service" module params should be updated + # NB: If you are reading this and any module has parameters that # are not being updated in this test, please update the test. Scenario Outline: An authorized user updates individual module params @@ -88,6 +100,7 @@ Feature: Params Namespace | shared | /poktroll.shared.MsgUpdateParam | proof_window_close_offset_blocks | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | supplier_unbonding_period_sessions | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | application_unbonding_period_sessions | 5 | int64 | + | service | /poktroll.service.MsgUpdateParam | add_service_fee | 1000000001 | coin | Scenario: An unauthorized user cannot update individual module params Given the user has the pocketd binary installed diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index ddc4762e7..dd317d027 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -19,6 +19,7 @@ import ( "github.com/pokt-network/poktroll/api/poktroll/application" "github.com/pokt-network/poktroll/api/poktroll/gateway" "github.com/pokt-network/poktroll/api/poktroll/proof" + "github.com/pokt-network/poktroll/api/poktroll/service" "github.com/pokt-network/poktroll/api/poktroll/session" "github.com/pokt-network/poktroll/api/poktroll/shared" "github.com/pokt-network/poktroll/api/poktroll/supplier" @@ -55,6 +56,7 @@ var allModuleMsgUpdateParamTypes = []string{ shared.Msg_UpdateParams_FullMethodName, supplier.Msg_UpdateParams_FullMethodName, tokenomics.Msg_UpdateParams_FullMethodName, + service.Msg_UpdateParams_FullMethodName, } func init() { @@ -458,7 +460,7 @@ func (s *suite) assertExpectedModuleParamsUpdated(moduleName string) { }, ) case servicetypes.ModuleName: - addServiceFee := uint64(s.expectedModuleParams[moduleName][servicetypes.ParamAddServiceFee].value.(int64)) + addServiceFee := s.expectedModuleParams[moduleName][servicetypes.ParamAddServiceFee].value.(*cosmostypes.Coin) assertUpdatedParams(s, []byte(res.Stdout), &servicetypes.QueryParamsResponse{ diff --git a/proto/poktroll/service/params.proto b/proto/poktroll/service/params.proto index 111ee5c6f..83c61448e 100644 --- a/proto/poktroll/service/params.proto +++ b/proto/poktroll/service/params.proto @@ -5,6 +5,7 @@ option go_package = "github.com/pokt-network/poktroll/x/service/types"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters for the module. @@ -15,5 +16,5 @@ message Params { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - uint64 add_service_fee = 1 [(gogoproto.jsontag) = "add_service_fee", (gogoproto.moretags) = "yaml:\"add_service_fee\""]; + cosmos.base.v1beta1.Coin add_service_fee = 1 [(gogoproto.jsontag) = "add_service_fee", (gogoproto.moretags) = "yaml:\"add_service_fee\""]; } \ No newline at end of file diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto index e9ef6634c..66c11f691 100644 --- a/proto/poktroll/service/tx.proto +++ b/proto/poktroll/service/tx.proto @@ -4,6 +4,7 @@ package poktroll.service; option go_package = "github.com/pokt-network/poktroll/x/service/types"; import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -19,6 +20,7 @@ service Msg { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); rpc AddService (MsgAddService ) returns (MsgAddServiceResponse ); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -39,6 +41,27 @@ message MsgUpdateParams { // MsgUpdateParams message. message MsgUpdateParamsResponse {} +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + string name = 2; + oneof as_type { + cosmos.base.v1beta1.Coin as_coin = 9 [(gogoproto.jsontag) = "as_coin"]; + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +message MsgUpdateParamResponse { + Params params = 1; +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 6ca483cec..9bc539937 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -71,6 +71,51 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.service.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.session.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.gateway.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.application.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.supplier.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", diff --git a/tools/scripts/params/service_add_service_fee.json b/tools/scripts/params/service_add_service_fee.json new file mode 100644 index 000000000..bfe444683 --- /dev/null +++ b/tools/scripts/params/service_add_service_fee.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.service.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "add_service_fee", + "as_coin": { + "denom": "upokt", + "amount": "1000000000" + } + } + ] + } +} diff --git a/tools/scripts/params/service_all.json b/tools/scripts/params/service_all.json new file mode 100644 index 000000000..9a1f3f682 --- /dev/null +++ b/tools/scripts/params/service_all.json @@ -0,0 +1,16 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.service.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "add_service_fee": { + "denom": "upokt", + "amount": "1000000000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index 4df23b94b..6df0bb60c 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/telemetry" @@ -72,23 +71,23 @@ func (k msgServer) AddService( // Check the balance of upokt is enough to cover the AddServiceFee. accBalance := accCoins.AmountOf("upokt") - addServiceFee := math.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) - if accBalance.LTE(addServiceFee) { + addServiceFee := k.GetParams(ctx).AddServiceFee + if accBalance.LTE(addServiceFee.Amount) { logger.Error(fmt.Sprintf("%s doesn't have enough funds to add service: %v", serviceOwnerAddr, err)) return nil, types.ErrServiceNotEnoughFunds.Wrapf( - "account has %d uPOKT, but the service fee is %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + "account has %s, but the service fee is %s", + accBalance, k.GetParams(ctx).AddServiceFee, ) } // Deduct the service fee from the actor's balance. - serviceFee := sdk.Coins{sdk.NewCoin("upokt", addServiceFee)} + serviceFee := sdk.NewCoins(*addServiceFee) err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, serviceOwnerAddr, types.ModuleName, serviceFee) if err != nil { logger.Error(fmt.Sprintf("Failed to deduct service fee from actor's balance: %v", err)) return nil, types.ErrServiceFailedToDeductFee.Wrapf( - "account has %d uPOKT, failed to deduct %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + "account has %s, failed to deduct %s", + accBalance, k.GetParams(ctx).AddServiceFee, ) } diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index 962689710..e798c31d1 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -5,6 +5,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/service/keeper" @@ -13,7 +14,7 @@ import ( ) // oneUPOKTGreaterThanFee is 1 upokt more than the AddServiceFee -const oneUPOKTGreaterThanFee = types.DefaultAddServiceFee + 1 +var oneUPOKTGreaterThanFee = types.DefaultAddServiceFee.Amount.Uint64() + 1 func TestMsgServer_AddService(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) @@ -39,7 +40,7 @@ func TestMsgServer_AddService(t *testing.T) { } // Mock adding a balance to the account - keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) // Add the service to the store _, err := srv.AddService(ctx, &types.MsgAddService{ @@ -64,7 +65,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "valid - service added successfully", setup: func(t *testing.T) { // Add 10000000001 upokt to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) }, address: newServiceOwnerAddr, service: newService, @@ -153,7 +154,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - insufficient upokt balance", setup: func(t *testing.T) { // Add 999999999 upokt to the account (one less than AddServiceFee) - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee-2) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee-2) }, address: newServiceOwnerAddr, service: newService, @@ -163,7 +164,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - account has exactly AddServiceFee", setup: func(t *testing.T) { // Add the exact fee in upokt to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", types.DefaultAddServiceFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, types.DefaultAddServiceFee.Amount.Uint64()) }, address: newServiceOwnerAddr, service: newService, @@ -173,7 +174,7 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - sufficient balance of different denom", setup: func(t *testing.T) { // Adds 10000000001 wrong coins to the account - keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "not_upokt", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) }, address: newServiceOwnerAddr, service: newService, diff --git a/x/service/keeper/msg_server_update_param.go b/x/service/keeper/msg_server_update_param.go new file mode 100644 index 000000000..d2d224dba --- /dev/null +++ b/x/service/keeper/msg_server_update_param.go @@ -0,0 +1,50 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/service/types" +) + +// UpdateParam updates a single parameter in the service module and returns +// all active parameters. +func (k msgServer) UpdateParam( + ctx context.Context, + msg *types.MsgUpdateParam, +) (*types.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + if k.GetAuthority() != msg.Authority { + return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + params := k.GetParams(ctx) + + switch msg.Name { + case types.ParamAddServiceFee: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) + if !ok { + return nil, types.ErrServiceParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + addServiceFee := value.AsCoin + + if err := types.ValidateAddServiceFee(addServiceFee); err != nil { + return nil, err + } + + params.AddServiceFee = addServiceFee + default: + return nil, types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil +} diff --git a/x/service/keeper/msg_server_update_param_test.go b/x/service/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..74c038d20 --- /dev/null +++ b/x/service/keeper/msg_server_update_param_test.go @@ -0,0 +1,42 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +func TestMsgUpdateParam_UpdateAddServiceFee(t *testing.T) { + expectedAddServiceFee := &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(1000000001)} + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := servicetypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, expectedAddServiceFee, defaultParams.AddServiceFee) + + // Update the add service fee parameter + updateParamMsg := &servicetypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: servicetypes.ParamAddServiceFee, + AsType: &servicetypes.MsgUpdateParam_AsCoin{AsCoin: expectedAddServiceFee}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.AddServiceFee, res.Params.AddServiceFee) + require.Equal(t, expectedAddServiceFee, res.Params.AddServiceFee) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "AddServiceFee") +} diff --git a/x/service/types/errors.go b/x/service/types/errors.go index d0c52965a..4163d22ff 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -20,4 +20,6 @@ var ( ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") ErrServiceInvalidComputeUnitsPerRelay = sdkerrors.Register(ModuleName, 1112, "invalid compute units per relay") ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") + ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") + ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") ) diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go index 4c324a41f..b8d040cb5 100644 --- a/x/service/types/genesis.go +++ b/x/service/types/genesis.go @@ -31,5 +31,5 @@ func (gs GenesisState) Validate() error { } // this line is used by starport scaffolding # genesis/types/validate - return gs.Params.Validate() + return gs.Params.ValidateBasic() } diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index d6abdd42d..aa90380bc 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -3,8 +3,11 @@ package types_test import ( "testing" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -70,7 +73,7 @@ func TestGenesisState_Validate(t *testing.T) { desc: "invalid - invalid add service fee parameter (below minimum)", genState: &types.GenesisState{ Params: types.Params{ - AddServiceFee: 999999, // 0.999999 POKT + AddServiceFee: &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(999999)}, // 0.999999 POKT }, ServiceList: []sharedtypes.Service{ *svc1, *svc2, diff --git a/x/service/types/message_update_param.go b/x/service/types/message_update_param.go new file mode 100644 index 000000000..04c7db8f6 --- /dev/null +++ b/x/service/types/message_update_param.go @@ -0,0 +1,63 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParam)(nil) + +// NewMsgUpdateParam creates a new MsgUpdateParam instance for a single +// governance parameter update. +func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdateParam, error) { + var valueAsType isMsgUpdateParam_AsType + + switch v := value.(type) { + case *sdk.Coin: + valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} + default: + return nil, fmt.Errorf("unexpected param value type: %T", value) + } + + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: valueAsType, + }, nil +} + +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures +// the parameter name is supported and the parameter type matches the expected type for +// a given parameter name. +func (msg *MsgUpdateParam) ValidateBasic() error { + // Validate the address + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return ErrServiceInvalidAddress.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) + } + + // Parameter value cannot be nil. + if msg.AsType == nil { + return ErrServiceParamInvalid.Wrap("missing param AsType") + } + + // Parameter name must be supported by this module. + switch msg.Name { + case ParamAddServiceFee: + return msg.paramTypeIsCoin() + default: + return ErrServiceParamNameInvalid.Wrapf("unsupported param %q", msg.Name) + } +} + +// paramTypeIsCoin checks if the parameter type is *cosmostypes.Coin, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsCoin); !ok { + return ErrServiceParamInvalid.Wrapf( + "invalid type for param %q expected %T, got %T", + msg.Name, &MsgUpdateParam_AsCoin{}, + msg.AsType, + ) + } + return nil +} diff --git a/x/service/types/message_update_params.go b/x/service/types/message_update_params.go index 77a83ff59..ebc6f120b 100644 --- a/x/service/types/message_update_params.go +++ b/x/service/types/message_update_params.go @@ -13,7 +13,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return sdkerrors.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { + if err := m.Params.ValidateBasic(); err != nil { return err } diff --git a/x/service/types/params.go b/x/service/types/params.go index f4a921df3..996fb9b5c 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -1,23 +1,22 @@ package types import ( - "fmt" - + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/pokt-network/poktroll/app/volatile" ) // DefaultAddServiceFee is the default value for the add service fee // parameter in the genesis state of the service module. // TODO_BETA: Revisit default param values for service fee -const ( - ParamAddServiceFee = "add_service_fee" - DefaultAddServiceFee = 1000000000 // 1000 POKT -) - var ( _ paramtypes.ParamSet = (*Params)(nil) - KeyAddServiceFee = []byte("AddServiceFee") + KeyAddServiceFee = []byte("AddServiceFee") + ParamAddServiceFee = "add_service_fee" + // TODO_TECHDEBT: Determine a sensible default value for the add service fee. + DefaultAddServiceFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000000)) ) // ParamKeyTable the param key table for launch module @@ -26,7 +25,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams(addServiceFee uint64) Params { +func NewParams(addServiceFee *cosmostypes.Coin) Params { return Params{ AddServiceFee: addServiceFee, } @@ -35,39 +34,48 @@ func NewParams(addServiceFee uint64) Params { // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams( - DefaultAddServiceFee, + &DefaultAddServiceFee, ) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, validateAddServiceFee), + paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, ValidateAddServiceFee), } } -// Validate validates the set of params -func (p Params) Validate() error { - // TODO_MAINNET: Look into better validation - if p.AddServiceFee < DefaultAddServiceFee { - return ErrServiceInvalidServiceFee.Wrapf( - "AddServiceFee param %d uPOKT: got %d", - DefaultAddServiceFee, - p.AddServiceFee, - ) +// ValidateBasic validates the set of params +func (p Params) ValidateBasic() error { + if err := ValidateAddServiceFee(p.AddServiceFee); err != nil { + return err } return nil } // validateAddServiceFee validates the AddServiceFee param -func validateAddServiceFee(v interface{}) error { - addServiceFee, ok := v.(uint64) +func ValidateAddServiceFee(v interface{}) error { + addServiceFeeCoin, ok := v.(*cosmostypes.Coin) if !ok { - return fmt.Errorf("invalid parameter type: %T", v) + return ErrServiceInvalidServiceFee.Wrapf("invalid parameter type: %T", v) + } + + if addServiceFeeCoin == nil { + return ErrServiceInvalidServiceFee.Wrap("missing proof_submission_fee") + } + + if addServiceFeeCoin.Denom != volatile.DenomuPOKT { + return ErrServiceInvalidServiceFee.Wrapf("invalid coin denom: %s", addServiceFeeCoin.Denom) } - // TODO_BETA: implement validation - _ = addServiceFee + // TODO_MAINNET: Look into better validation + if addServiceFeeCoin.Amount.LT(DefaultAddServiceFee.Amount) { + return ErrServiceInvalidServiceFee.Wrapf( + "AddServiceFee param is below minimum value %s: got %s", + DefaultAddServiceFee, + addServiceFeeCoin, + ) + } return nil } diff --git a/x/service/types/params.pb.go b/x/service/types/params.pb.go index 11b435089..a75cd0199 100644 --- a/x/service/types/params.pb.go +++ b/x/service/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -29,7 +30,7 @@ type Params struct { // The amount of uPOKT required to add a new service. // This will be deducted from the signer's account balance, // and transferred to the pocket network foundation. - AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee" yaml:"add_service_fee"` + AddServiceFee *types.Coin `protobuf:"bytes,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee" yaml:"add_service_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -65,11 +66,11 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetAddServiceFee() uint64 { +func (m *Params) GetAddServiceFee() *types.Coin { if m != nil { return m.AddServiceFee } - return 0 + return nil } func init() { @@ -79,22 +80,24 @@ func init() { func init() { proto.RegisterFile("poktroll/service/params.proto", fileDescriptor_69b5d0104478b383) } var fileDescriptor_69b5d0104478b383 = []byte{ - // 229 bytes of a gzipped FileDescriptorProto + // 272 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xeb, 0x41, 0xa5, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x9a, 0x19, 0xb9, 0xd8, 0x02, 0xc0, 0x66, - 0x09, 0x85, 0x72, 0xf1, 0x27, 0xa6, 0xa4, 0xc4, 0x43, 0x8d, 0x88, 0x4f, 0x4b, 0x4d, 0x95, 0x60, - 0x54, 0x60, 0xd4, 0x60, 0x71, 0xd2, 0x7d, 0x75, 0x4f, 0x1e, 0x5d, 0xea, 0xd3, 0x3d, 0x79, 0xb1, - 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x34, 0x09, 0xa5, 0x20, 0xde, 0xc4, 0x94, 0x94, 0x60, 0x88, - 0x80, 0x5b, 0x6a, 0xaa, 0x95, 0xd2, 0x8b, 0x05, 0xf2, 0x8c, 0x5d, 0xcf, 0x37, 0x68, 0x49, 0xc2, - 0x3d, 0x51, 0x01, 0xf7, 0x06, 0xc4, 0x6a, 0x27, 0xaf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, - 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, - 0x96, 0x63, 0x88, 0x32, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, - 0xe9, 0xd7, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0xc7, 0x62, 0x58, 0x49, 0x65, 0x41, - 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x63, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x98, 0xe5, - 0x13, 0x34, 0x01, 0x00, 0x00, + 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xe5, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, + 0x93, 0x12, 0x8b, 0x53, 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, 0x33, + 0xf3, 0x20, 0xf2, 0x4a, 0xf3, 0x18, 0xb9, 0xd8, 0x02, 0xc0, 0x76, 0x09, 0x15, 0x70, 0xf1, 0x27, + 0xa6, 0xa4, 0xc4, 0x43, 0xad, 0x88, 0x4f, 0x4b, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, + 0x92, 0xd4, 0x83, 0x18, 0xa2, 0x07, 0x32, 0x44, 0x0f, 0x6a, 0x88, 0x9e, 0x73, 0x7e, 0x66, 0x9e, + 0x93, 0xee, 0xab, 0x7b, 0xf2, 0xe8, 0xba, 0x3e, 0xdd, 0x93, 0x17, 0xab, 0x4c, 0xcc, 0xcd, 0xb1, + 0x52, 0x42, 0x93, 0x50, 0x0a, 0xe2, 0x4d, 0x4c, 0x49, 0x09, 0x86, 0x08, 0xb8, 0xa5, 0xa6, 0x5a, + 0x29, 0xbd, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x24, 0xdc, 0xff, 0x15, 0xf0, 0x10, + 0x80, 0xb8, 0xca, 0xc9, 0xeb, 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, 0x0c, + 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0xfa, 0x75, 0xf3, 0x52, + 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0xb1, 0x18, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0xf6, 0xb3, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xb7, 0xa6, 0x23, 0x6f, 0x01, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -116,7 +119,7 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } - if this.AddServiceFee != that1.AddServiceFee { + if !this.AddServiceFee.Equal(that1.AddServiceFee) { return false } return true @@ -141,10 +144,17 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.AddServiceFee != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.AddServiceFee)) + if m.AddServiceFee != nil { + { + size, err := m.AddServiceFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -166,8 +176,9 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.AddServiceFee != 0 { - n += 1 + sovParams(uint64(m.AddServiceFee)) + if m.AddServiceFee != nil { + l = m.AddServiceFee.Size() + n += 1 + l + sovParams(uint64(l)) } return n } @@ -208,10 +219,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) } - m.AddServiceFee = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -221,11 +232,28 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AddServiceFee |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AddServiceFee == nil { + m.AddServiceFee = &types.Coin{} + } + if err := m.AddServiceFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/service/types/tx.pb.go b/x/service/types/tx.pb.go index cc1c369db..68963a560 100644 --- a/x/service/types/tx.pb.go +++ b/x/service/types/tx.pb.go @@ -7,12 +7,13 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/pokt-network/poktroll/x/shared/types" + types1 "github.com/pokt-network/poktroll/x/shared/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -126,20 +127,158 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The (name, as_type) tuple must match the corresponding name and type as + // specified in the `Params` message in `proof/params.proto.` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to AsType: + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } +func (m *MsgUpdateParam) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParam) ProtoMessage() {} +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return fileDescriptor_31ba9559706e649e, []int{2} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParam.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 *MsgUpdateParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParam.Merge(m, src) +} +func (m *MsgUpdateParam) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParam) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParam.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if m != nil { + return m.AsType + } + return nil +} + +func (m *MsgUpdateParam) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParam) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } +func (m *MsgUpdateParamResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamResponse) ProtoMessage() {} +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_31ba9559706e649e, []int{3} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamResponse.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 *MsgUpdateParamResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamResponse.Merge(m, src) +} +func (m *MsgUpdateParamResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo + +func (m *MsgUpdateParamResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + // MsgAddService defines a message for adding a new message to the network. // Services can be added by any actor in the network making them truly // permissionless. // TODO_BETA: Add Champions / Sources once its fully defined. type MsgAddService struct { - OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` - Service types.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + Service types1.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` } func (m *MsgAddService) Reset() { *m = MsgAddService{} } func (m *MsgAddService) String() string { return proto.CompactTextString(m) } func (*MsgAddService) ProtoMessage() {} func (*MsgAddService) Descriptor() ([]byte, []int) { - return fileDescriptor_31ba9559706e649e, []int{2} + return fileDescriptor_31ba9559706e649e, []int{4} } func (m *MsgAddService) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -175,11 +314,11 @@ func (m *MsgAddService) GetOwnerAddress() string { return "" } -func (m *MsgAddService) GetService() types.Service { +func (m *MsgAddService) GetService() types1.Service { if m != nil { return m.Service } - return types.Service{} + return types1.Service{} } type MsgAddServiceResponse struct { @@ -189,7 +328,7 @@ func (m *MsgAddServiceResponse) Reset() { *m = MsgAddServiceResponse{} } func (m *MsgAddServiceResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddServiceResponse) ProtoMessage() {} func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_31ba9559706e649e, []int{3} + return fileDescriptor_31ba9559706e649e, []int{5} } func (m *MsgAddServiceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -221,6 +360,8 @@ var xxx_messageInfo_MsgAddServiceResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.service.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.service.MsgUpdateParamsResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.service.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.service.MsgUpdateParamResponse") proto.RegisterType((*MsgAddService)(nil), "poktroll.service.MsgAddService") proto.RegisterType((*MsgAddServiceResponse)(nil), "poktroll.service.MsgAddServiceResponse") } @@ -228,35 +369,43 @@ func init() { func init() { proto.RegisterFile("poktroll/service/tx.proto", fileDescriptor_31ba9559706e649e) } var fileDescriptor_31ba9559706e649e = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xc8, 0xcf, 0x2e, - 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0xa9, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xe9, 0x41, 0xa5, 0xa4, 0x04, 0x13, 0x73, - 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x78, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0xb1, - 0x7e, 0x6e, 0x71, 0xba, 0x7e, 0x99, 0x21, 0x88, 0x82, 0x4a, 0x48, 0x42, 0x24, 0xe2, 0xc1, 0x3c, - 0x7d, 0x08, 0x07, 0x2a, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x11, 0x07, 0xb1, 0xa0, 0xa2, 0xb2, - 0x18, 0x2e, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xc6, 0x94, 0xce, 0x48, 0x2c, 0x4a, 0x4d, 0x81, - 0xa9, 0x82, 0x48, 0x2b, 0xed, 0x65, 0xe4, 0xe2, 0xf7, 0x2d, 0x4e, 0x0f, 0x2d, 0x48, 0x49, 0x2c, - 0x49, 0x0d, 0x00, 0x6b, 0x14, 0x32, 0xe3, 0xe2, 0x4c, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, 0x2c, - 0xa9, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0xea, 0x18, - 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x84, 0x52, - 0x21, 0x6b, 0x2e, 0x36, 0x88, 0xd5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x12, 0x7a, 0xe8, - 0x21, 0xa1, 0x07, 0xb1, 0xc1, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, - 0x06, 0x41, 0xb5, 0x58, 0x99, 0x36, 0x3d, 0xdf, 0xa0, 0x85, 0x30, 0xac, 0xeb, 0xf9, 0x06, 0x2d, - 0x25, 0xb8, 0xd3, 0x2b, 0xe0, 0x7e, 0x43, 0x73, 0xab, 0x92, 0x24, 0x97, 0x38, 0x9a, 0x50, 0x50, - 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd2, 0x1c, 0x46, 0x2e, 0x5e, 0xdf, 0xe2, 0x74, 0xc7, - 0x94, 0x94, 0x60, 0x88, 0x66, 0x21, 0x5b, 0x2e, 0xde, 0xfc, 0xf2, 0xbc, 0xd4, 0xa2, 0xf8, 0x44, - 0x88, 0x17, 0x08, 0x7a, 0x8e, 0x07, 0xac, 0x1c, 0x2a, 0x26, 0x64, 0xc1, 0xc5, 0x0e, 0x75, 0x06, - 0x16, 0x0f, 0x82, 0x03, 0x57, 0x0f, 0x6a, 0x93, 0x13, 0x0b, 0xc8, 0x83, 0x41, 0x30, 0xe5, 0x56, - 0x42, 0x20, 0xcf, 0xa1, 0xda, 0xad, 0x24, 0xce, 0x25, 0x8a, 0xe2, 0x3a, 0x98, 0xbb, 0x8d, 0x0e, - 0x31, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0xc5, 0x70, 0xf1, 0xa0, 0x44, 0x8b, 0x22, 0x66, 0x70, - 0xa2, 0x79, 0x5d, 0x4a, 0x93, 0xa0, 0x12, 0x98, 0x2d, 0x42, 0x61, 0x5c, 0x5c, 0x48, 0x21, 0x23, - 0x8f, 0x55, 0x23, 0x42, 0x81, 0x94, 0x3a, 0x01, 0x05, 0x30, 0x73, 0xa5, 0x58, 0x1b, 0x40, 0xd1, - 0xea, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x33, 0x75, 0xf3, 0x52, 0x4b, 0xca, - 0xf3, 0x8b, 0xb2, 0xf5, 0xb1, 0xc4, 0x76, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xa9, - 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x24, 0x8c, 0x9b, 0xaa, 0x74, 0x03, 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0xd4, 0xda, 0xb2, 0x93, 0xb6, 0xea, 0x52, 0x4d, 0xb2, 0xe0, 0x26, 0xee, 0xc5, 0x18, + 0xe8, 0x6e, 0x53, 0x51, 0x24, 0xe2, 0x21, 0xeb, 0x45, 0x0a, 0x01, 0xd9, 0xa2, 0xa0, 0x08, 0x61, + 0x92, 0x1d, 0x36, 0x4b, 0xbb, 0x3b, 0xcb, 0xce, 0x34, 0x6d, 0x6f, 0xe2, 0xd1, 0x93, 0x7f, 0x80, + 0xde, 0x3d, 0xe6, 0xe0, 0x49, 0xf0, 0xde, 0x63, 0xf1, 0xe4, 0xa9, 0x48, 0x72, 0x08, 0xf8, 0x57, + 0xc8, 0xcc, 0xce, 0x26, 0xdd, 0x24, 0x18, 0xf0, 0x92, 0xcc, 0xbc, 0xef, 0x7b, 0x3f, 0xbe, 0xf7, + 0xde, 0x2c, 0x2c, 0x45, 0xe4, 0x90, 0xc5, 0xe4, 0xe8, 0xc8, 0xa2, 0x38, 0xee, 0xfb, 0x5d, 0x6c, + 0xb1, 0x53, 0x33, 0x8a, 0x09, 0x23, 0xea, 0xcd, 0x14, 0x32, 0x25, 0xa4, 0xdd, 0x42, 0x81, 0x1f, + 0x12, 0x4b, 0xfc, 0x26, 0x24, 0x4d, 0xef, 0x12, 0x1a, 0x10, 0x6a, 0x75, 0x10, 0xc5, 0x56, 0xbf, + 0xde, 0xc1, 0x0c, 0xd5, 0xad, 0x2e, 0xf1, 0x43, 0x89, 0x17, 0x24, 0x1e, 0x50, 0xcf, 0xea, 0xd7, + 0xf9, 0x9f, 0x04, 0x4a, 0x09, 0xd0, 0x16, 0x37, 0x2b, 0xb9, 0x48, 0x68, 0xdb, 0x23, 0x1e, 0x49, + 0xec, 0xfc, 0x24, 0xad, 0x77, 0xe7, 0x2a, 0x8d, 0x50, 0x8c, 0x02, 0x3a, 0x0f, 0xf7, 0x50, 0x8c, + 0xdd, 0x94, 0x95, 0xc0, 0xc6, 0x0f, 0x00, 0x6f, 0xb4, 0xa8, 0xf7, 0x2a, 0x72, 0x11, 0xc3, 0x2f, + 0x85, 0xa3, 0xfa, 0x18, 0x2a, 0xe8, 0x98, 0xf5, 0x48, 0xec, 0xb3, 0xb3, 0x22, 0xa8, 0x80, 0xaa, + 0x62, 0x17, 0x7f, 0x7e, 0xdb, 0xd9, 0x96, 0xc5, 0x34, 0x5d, 0x37, 0xc6, 0x94, 0x1e, 0xb0, 0xd8, + 0x0f, 0x3d, 0x67, 0x4a, 0x55, 0x9f, 0xc2, 0xb5, 0x24, 0x75, 0x71, 0xa5, 0x02, 0xaa, 0xf9, 0xbd, + 0xa2, 0x39, 0xdb, 0x29, 0x33, 0xc9, 0x60, 0x2b, 0xe7, 0x97, 0xe5, 0xdc, 0xd7, 0xf1, 0xa0, 0x06, + 0x1c, 0xe9, 0xd2, 0x78, 0xf4, 0x61, 0x3c, 0xa8, 0x4d, 0x83, 0x7d, 0x1c, 0x0f, 0x6a, 0xc6, 0xa4, + 0xf4, 0xd3, 0x89, 0xb6, 0x99, 0x5a, 0x8d, 0x12, 0x2c, 0xcc, 0x98, 0x1c, 0x4c, 0x23, 0x12, 0x52, + 0x6c, 0x7c, 0x07, 0x70, 0x2b, 0x8b, 0xfd, 0xb7, 0x32, 0x15, 0xae, 0x86, 0x28, 0xc0, 0x42, 0x97, + 0xe2, 0x88, 0xb3, 0xda, 0x84, 0xeb, 0x88, 0xb6, 0xf9, 0x48, 0x8b, 0x8a, 0x90, 0x5b, 0x32, 0x65, + 0x18, 0x3e, 0x73, 0x53, 0xce, 0xdc, 0x7c, 0x4e, 0xfc, 0xd0, 0xce, 0xff, 0xb9, 0x2c, 0xa7, 0xec, + 0x17, 0x39, 0x67, 0x0d, 0x51, 0x6e, 0x6e, 0x6c, 0x65, 0x35, 0xdb, 0x8a, 0x08, 0xc9, 0xce, 0x22, + 0x6c, 0xec, 0xc3, 0x3b, 0xd9, 0xda, 0x53, 0x59, 0xea, 0xee, 0xa4, 0xcb, 0xe0, 0xdf, 0x5d, 0x4e, + 0x5b, 0x6b, 0x7c, 0x06, 0x70, 0xb3, 0x45, 0xbd, 0xa6, 0xeb, 0x1e, 0x24, 0x04, 0xf5, 0x19, 0xdc, + 0x24, 0x27, 0x21, 0x8e, 0xdb, 0x28, 0x51, 0xbc, 0xb4, 0x17, 0x1b, 0x82, 0x2e, 0x6d, 0xea, 0x13, + 0xb8, 0x2e, 0x53, 0x2d, 0x98, 0xb4, 0xd8, 0x32, 0x53, 0x66, 0xb2, 0x57, 0xf9, 0xa4, 0x9d, 0x94, + 0xde, 0x50, 0xb9, 0xe2, 0x6c, 0x6e, 0xa3, 0x00, 0x6f, 0x67, 0xaa, 0x4b, 0x95, 0xee, 0x7d, 0x59, + 0x81, 0xd7, 0x5a, 0xd4, 0x53, 0xdf, 0xc1, 0x8d, 0xcc, 0x7e, 0xde, 0x9b, 0x57, 0x3c, 0xb3, 0x03, + 0xda, 0x83, 0xa5, 0x94, 0x49, 0x3f, 0xdf, 0xc0, 0xfc, 0xd5, 0x15, 0xa9, 0x2c, 0xf3, 0xd4, 0xaa, + 0xcb, 0x18, 0x93, 0xd0, 0xaf, 0x21, 0xbc, 0xd2, 0xf4, 0xf2, 0x42, 0xbf, 0x29, 0x41, 0xbb, 0xbf, + 0x84, 0x90, 0xc6, 0xd5, 0xae, 0xbf, 0xe7, 0x4f, 0xc7, 0xde, 0x3f, 0x1f, 0xea, 0xe0, 0x62, 0xa8, + 0x83, 0xdf, 0x43, 0x1d, 0x7c, 0x1a, 0xe9, 0xb9, 0x8b, 0x91, 0x9e, 0xfb, 0x35, 0xd2, 0x73, 0x6f, + 0x77, 0x3d, 0x9f, 0xf5, 0x8e, 0x3b, 0x66, 0x97, 0x04, 0x16, 0x8f, 0xb9, 0x13, 0x62, 0x76, 0x42, + 0xe2, 0x43, 0x6b, 0xc1, 0x8b, 0xe2, 0xeb, 0x46, 0x3b, 0x6b, 0xe2, 0x73, 0xf0, 0xf0, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe1, 0xee, 0xe1, 0xeb, 0xf8, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -274,6 +423,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) } @@ -294,6 +444,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, "/poktroll.service.Msg/UpdateParam", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) { out := new(MsgAddServiceResponse) err := c.cc.Invoke(ctx, "/poktroll.service.Msg/AddService", in, out, opts...) @@ -308,6 +467,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) } @@ -318,6 +478,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) UpdateParam(ctx context.Context, req *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (*UnimplementedMsgServer) AddService(ctx context.Context, req *MsgAddService) (*MsgAddServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented") } @@ -344,6 +507,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.service.Msg/UpdateParam", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAddService) if err := dec(in); err != nil { @@ -370,6 +551,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, { MethodName: "AddService", Handler: _Msg_AddService_Handler, @@ -442,6 +627,108 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUpdateParam) 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 *MsgUpdateParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AsType != nil { + { + size := m.AsType.Size() + i -= size + if _, err := m.AsType.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + return len(dAtA) - i, nil +} +func (m *MsgUpdateParamResponse) 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 *MsgUpdateParamResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgAddService) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -540,6 +827,51 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgUpdateParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AsType != nil { + n += m.AsType.Size() + } + return n +} + +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgAddService) Size() (n int) { if m == nil { return 0 @@ -735,6 +1067,241 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgAddService) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 601cf22442819fd2387f446d1a24bb754413d1bd Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 31 Aug 2024 09:56:29 +0200 Subject: [PATCH 3/4] feat: Add proof submission fee gov. param --- Makefile | 4 + api/poktroll/proof/params.pulsar.go | 138 +++++++++++++++--- config.yml | 3 + e2e/tests/parse_params_test.go | 2 + e2e/tests/update_params.feature | 2 + e2e/tests/update_params_test.go | 5 + proto/poktroll/proof/params.proto | 6 + tools/scripts/params/proof_all.json | 4 + .../params/proof_proof_submission_fee.json | 15 ++ x/proof/keeper/msg_server_update_param.go | 12 ++ .../keeper/msg_server_update_param_test.go | 27 ++++ x/proof/keeper/msg_update_params_test.go | 1 + x/proof/keeper/params_test.go | 47 ++++++ x/proof/types/message_update_param.go | 4 + x/proof/types/params.go | 44 ++++++ x/proof/types/params.pb.go | 123 ++++++++++++---- x/service/types/params.go | 2 +- 17 files changed, 391 insertions(+), 48 deletions(-) create mode 100644 tools/scripts/params/proof_proof_submission_fee.json diff --git a/Makefile b/Makefile index 5ef85ede3..954f63a73 100644 --- a/Makefile +++ b/Makefile @@ -925,6 +925,10 @@ params_update_proof_proof_requirement_threshold: ## Update the proof module proo params_update_proof_proof_missing_penalty: ## Update the proof module proof_missing_penalty param poktrolld tx authz exec ./tools/scripts/params/proof_proof_missing_penalty.json $(PARAM_FLAGS) +.PHONY: params_update_proof_proof_submission_fee +params_update_proof_proof_submission_fee: ## Update the proof module proof_submission_fee param + poktrolld tx authz exec ./tools/scripts/params/proof_proof_submission_fee.json $(PARAM_FLAGS) + ### Shared Module Params ### .PHONY: params_update_shared_all params_update_shared_all: ## Update the session module params diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go index b8162ea2b..560dfe873 100644 --- a/api/poktroll/proof/params.pulsar.go +++ b/api/poktroll/proof/params.pulsar.go @@ -23,6 +23,7 @@ var ( fd_Params_proof_request_probability protoreflect.FieldDescriptor fd_Params_proof_requirement_threshold protoreflect.FieldDescriptor fd_Params_proof_missing_penalty protoreflect.FieldDescriptor + fd_Params_proof_submission_fee protoreflect.FieldDescriptor ) func init() { @@ -32,6 +33,7 @@ func init() { fd_Params_proof_request_probability = md_Params.Fields().ByName("proof_request_probability") fd_Params_proof_requirement_threshold = md_Params.Fields().ByName("proof_requirement_threshold") fd_Params_proof_missing_penalty = md_Params.Fields().ByName("proof_missing_penalty") + fd_Params_proof_submission_fee = md_Params.Fields().ByName("proof_submission_fee") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -123,6 +125,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.ProofSubmissionFee != nil { + value := protoreflect.ValueOfMessage(x.ProofSubmissionFee.ProtoReflect()) + if !f(fd_Params_proof_submission_fee, value) { + return + } + } } // Has reports whether a field is populated. @@ -146,6 +154,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.ProofRequirementThreshold != uint64(0) case "poktroll.proof.Params.proof_missing_penalty": return x.ProofMissingPenalty != nil + case "poktroll.proof.Params.proof_submission_fee": + return x.ProofSubmissionFee != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -170,6 +180,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.ProofRequirementThreshold = uint64(0) case "poktroll.proof.Params.proof_missing_penalty": x.ProofMissingPenalty = nil + case "poktroll.proof.Params.proof_submission_fee": + x.ProofSubmissionFee = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -198,6 +210,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "poktroll.proof.Params.proof_missing_penalty": value := x.ProofMissingPenalty return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + value := x.ProofSubmissionFee + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -226,6 +241,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.ProofRequirementThreshold = value.Uint() case "poktroll.proof.Params.proof_missing_penalty": x.ProofMissingPenalty = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.Params.proof_submission_fee": + x.ProofSubmissionFee = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -251,6 +268,11 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore x.ProofMissingPenalty = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.ProofMissingPenalty.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + if x.ProofSubmissionFee == nil { + x.ProofSubmissionFee = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ProofSubmissionFee.ProtoReflect()) case "poktroll.proof.Params.relay_difficulty_target_hash": panic(fmt.Errorf("field relay_difficulty_target_hash of message poktroll.proof.Params is not mutable")) case "poktroll.proof.Params.proof_request_probability": @@ -279,6 +301,9 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor case "poktroll.proof.Params.proof_missing_penalty": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.Params.proof_submission_fee": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) @@ -362,6 +387,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { l = options.Size(x.ProofMissingPenalty) n += 1 + l + runtime.Sov(uint64(l)) } + if x.ProofSubmissionFee != nil { + l = options.Size(x.ProofSubmissionFee) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -391,6 +420,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ProofSubmissionFee != nil { + encoded, err := options.Marshal(x.ProofSubmissionFee) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } if x.ProofMissingPenalty != nil { encoded, err := options.Marshal(x.ProofMissingPenalty) if err != nil { @@ -572,6 +615,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofSubmissionFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ProofSubmissionFee == nil { + x.ProofSubmissionFee = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ProofSubmissionFee); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -643,6 +722,11 @@ type Params struct { // when a proof is required (either via proof_requirement_threshold or proof_missing_penalty) // but is not provided. ProofMissingPenalty *v1beta1.Coin `protobuf:"bytes,4,opt,name=proof_missing_penalty,json=proofMissingPenalty,proto3" json:"proof_missing_penalty,omitempty"` + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming the network with non-required proofs. + ProofSubmissionFee *v1beta1.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee,omitempty"` } func (x *Params) Reset() { @@ -693,6 +777,13 @@ func (x *Params) GetProofMissingPenalty() *v1beta1.Coin { return nil } +func (x *Params) GetProofSubmissionFee() *v1beta1.Coin { + if x != nil { + return x.ProofSubmissionFee + } + return nil +} + var File_poktroll_proof_params_proto protoreflect.FileDescriptor var file_poktroll_proof_params_proto_rawDesc = []byte{ @@ -703,7 +794,7 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x61, 0x0a, 0x1c, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x20, 0xea, 0xde, 0x1f, 0x1c, 0x72, 0x65, 0x6c, @@ -728,20 +819,26 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4d, 0x69, 0x73, 0x73, - 0x69, 0x6e, 0x67, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, - 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9b, 0x01, 0x0a, - 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x69, 0x6e, 0x67, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x14, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, + 0x65, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, + 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x52, 0x12, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x65, + 0x65, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, + 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, + 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -763,11 +860,12 @@ var file_poktroll_proof_params_proto_goTypes = []interface{}{ } var file_poktroll_proof_params_proto_depIdxs = []int32{ 1, // 0: poktroll.proof.Params.proof_missing_penalty:type_name -> cosmos.base.v1beta1.Coin - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 1, // 1: poktroll.proof.Params.proof_submission_fee:type_name -> cosmos.base.v1beta1.Coin + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_poktroll_proof_params_proto_init() } diff --git a/config.yml b/config.yml index 5f5acb398..8a9eabb3f 100644 --- a/config.yml +++ b/config.yml @@ -239,6 +239,9 @@ genesis: proof_missing_penalty: amount: "320" denom: upokt + proof_submission_fee: + amount: "1000000" + denom: upokt shared: params: num_blocks_per_session: 10 diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index c51d0395a..e33e1e423 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -141,6 +141,8 @@ func (s *suite) newProofMsgUpdateParams(params paramsMap) cosmostypes.Msg { msgUpdateParams.Params.ProofRequirementThreshold = uint64(paramValue.value.(int64)) case prooftypes.ParamProofMissingPenalty: msgUpdateParams.Params.ProofMissingPenalty = paramValue.value.(*cosmostypes.Coin) + case prooftypes.ParamProofSubmissionFee: + msgUpdateParams.Params.ProofSubmissionFee = paramValue.value.(*cosmostypes.Coin) default: s.Fatalf("ERROR: unexpected %q type param name %q", paramValue.typeStr, paramName) } diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index 4ae05c22e..f0df8beaa 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -42,6 +42,7 @@ Feature: Params Namespace | proof_request_probability | 0.1 | float | | proof_requirement_threshold | 100 | int64 | | proof_missing_penalty | 500 | coin | + | proof_submission_fee | 5000000 | coin | Then all "proof" module params should be updated # NB: If you are reading this and the proof module has parameters @@ -92,6 +93,7 @@ Feature: Params Namespace | proof | /poktroll.proof.MsgUpdateParam | proof_request_probability | 0.1 | float | | proof | /poktroll.proof.MsgUpdateParam | proof_requirement_threshold | 100 | int64 | | proof | /poktroll.proof.MsgUpdateParam | proof_missing_penalty | 500 | coin | + | proof | /poktroll.proof.MsgUpdateParam | proof_submission_fee | 5000000 | coin | | shared | /poktroll.shared.MsgUpdateParam | num_blocks_per_session | 5 | int64 | | shared | /poktroll.shared.MsgUpdateParam | grace_period_end_offset_blocks | 2 | int64 | | shared | /poktroll.shared.MsgUpdateParam | claim_window_open_offset_blocks | 2 | int64 | diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index dd317d027..c13b1dfc6 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -393,6 +393,11 @@ func (s *suite) assertExpectedModuleParamsUpdated(moduleName string) { params.ProofMissingPenalty = proofMissingPenalty.value.(*cosmostypes.Coin) } + proofSubmissionFee, ok := paramsMap[prooftypes.ParamProofSubmissionFee] + if ok { + params.ProofSubmissionFee = proofSubmissionFee.value.(*cosmostypes.Coin) + } + assertUpdatedParams(s, []byte(res.Stdout), &prooftypes.QueryParamsResponse{ diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index 8f8042d95..00ffd15a2 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -33,6 +33,12 @@ message Params { // but is not provided. cosmos.base.v1beta1.Coin proof_missing_penalty = 4 [(gogoproto.jsontag) = "proof_missing_penalty"]; + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming the network with non-required proofs. + cosmos.base.v1beta1.Coin proof_submission_fee = 5 [(gogoproto.jsontag) = "proof_submission_fee"]; + // IMPORTANT: Make sure to update all related files if you're modifying or adding a new parameter. // Try the following grep to find all related places: `grep -r compute_units_to_tokens_multiplier` // TODO_IMPROVE: Look into an opportunity to use an enum to avoid using strings throughout the codebase. diff --git a/tools/scripts/params/proof_all.json b/tools/scripts/params/proof_all.json index 66e3a5396..97fc0e2dd 100644 --- a/tools/scripts/params/proof_all.json +++ b/tools/scripts/params/proof_all.json @@ -11,6 +11,10 @@ "proof_missing_penalty": { "amount": "320", "denom": "upokt" + }, + "proof_submission_fee": { + "amount": "1000000", + "denom": "upokt" } } } diff --git a/tools/scripts/params/proof_proof_submission_fee.json b/tools/scripts/params/proof_proof_submission_fee.json new file mode 100644 index 000000000..95d98fb62 --- /dev/null +++ b/tools/scripts/params/proof_proof_submission_fee.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.proof.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "proof_submission_fee", + "as_coin": { + "denom": "upokt", + "amount": "1000000" + } + } + ] + } +} diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index 6b941068d..1f1c2d112 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -71,6 +71,18 @@ func (k msgServer) UpdateParam( } params.ProofMissingPenalty = proofMissingPenalty + case types.ParamProofSubmissionFee: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) + if !ok { + return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + proofSubmissionFee := value.AsCoin + + if err := types.ValidateProofSubmissionFee(proofSubmissionFee); err != nil { + return nil, err + } + + params.ProofSubmissionFee = proofSubmissionFee default: return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index 243de80ea..d32eead82 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -122,3 +122,30 @@ func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofMissingPenalty") } + +func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { + expectedProofSubmissionFee := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000001)) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := prooftypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, expectedProofSubmissionFee, defaultParams.ProofSubmissionFee) + + // Update the proof request probability + updateParamMsg := &prooftypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: prooftypes.ParamProofSubmissionFee, + AsType: &prooftypes.MsgUpdateParam_AsCoin{AsCoin: &expectedProofSubmissionFee}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.ProofSubmissionFee, res.Params.ProofSubmissionFee) + require.Equal(t, &expectedProofSubmissionFee, res.Params.ProofSubmissionFee) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofSubmissionFee") +} diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index f5ce27e29..0b0b8931d 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -43,6 +43,7 @@ func TestMsgUpdateParams(t *testing.T) { Authority: k.GetAuthority(), Params: types.Params{ ProofMissingPenalty: &types.DefaultProofMissingPenalty, + ProofSubmissionFee: &types.DefaultProofSubmissionFee, RelayDifficultyTargetHash: types.DefaultRelayDifficultyTargetHash, }, }, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 6c281b639..8632dbac9 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -164,3 +164,50 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { }) } } + +func TestParams_ValidateProofSubmissionFee(t *testing.T) { + invalidDenomCoin := cosmostypes.NewCoin("invalid_denom", math.NewInt(1)) + + tests := []struct { + desc string + proofSubmissionFee any + expectedErr error + }{ + { + desc: "invalid type", + proofSubmissionFee: int64(-1), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid parameter type: int64"), + }, + { + desc: "invalid denomination", + proofSubmissionFee: &invalidDenomCoin, + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + }, + { + desc: "missing", + proofSubmissionFee: nil, + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid parameter type: "), + }, + { + desc: "missing (typed)", + proofSubmissionFee: (*cosmostypes.Coin)(nil), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("missing proof_submission_fee"), + }, + { + desc: "valid", + proofSubmissionFee: &prooftypes.DefaultProofSubmissionFee, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := prooftypes.ValidateProofSubmissionFee(tt.proofSubmissionFee) + if tt.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), tt.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index b9a0b4621..cc261973b 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -20,6 +20,8 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v} case []byte: valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v} + case *sdk.Coin: + valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} default: return nil, fmt.Errorf("unexpected param value type: %T", value) } @@ -55,6 +57,8 @@ func (msg *MsgUpdateParam) ValidateBasic() error { return msg.paramTypeIsInt64() case ParamProofMissingPenalty: return msg.paramTypeIsCoin() + case ParamProofSubmissionFee: + return msg.paramTypeIsCoin() default: return ErrProofParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 218831ba2..b896308a0 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -33,6 +33,11 @@ var ( KeyProofMissingPenalty = []byte("ProofMissingPenalty") ParamProofMissingPenalty = "proof_missing_penalty" DefaultProofMissingPenalty = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(320)) // See: https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md + + KeyProofSubmissionFee = []byte("ProofSubmissionFee") + ParamProofSubmissionFee = "proof_submission_fee" + // TODO_TECHDEBT: Determine a sensible default value for the proof submission fee. + DefaultProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000)) ) // ParamKeyTable the param key table for launch module @@ -46,12 +51,14 @@ func NewParams( proofRequestProbability float32, proofRequirementThreshold uint64, proofMissingPenalty *cosmostypes.Coin, + proofSubmissionFee *cosmostypes.Coin, ) Params { return Params{ RelayDifficultyTargetHash: relayDifficultyTargetHash, ProofRequestProbability: proofRequestProbability, ProofRequirementThreshold: proofRequirementThreshold, ProofMissingPenalty: proofMissingPenalty, + ProofSubmissionFee: proofSubmissionFee, } } @@ -62,6 +69,7 @@ func DefaultParams() Params { DefaultProofRequestProbability, DefaultProofRequirementThreshold, &DefaultProofMissingPenalty, + &DefaultProofSubmissionFee, ) } @@ -88,6 +96,11 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { &p.ProofMissingPenalty, ValidateProofMissingPenalty, ), + paramtypes.NewParamSetPair( + KeyProofSubmissionFee, + &p.ProofSubmissionFee, + ValidateProofSubmissionFee, + ), } } @@ -110,6 +123,10 @@ func (params *Params) ValidateBasic() error { return err } + if err := ValidateProofSubmissionFee(params.ProofSubmissionFee); err != nil { + return err + } + return nil } @@ -177,3 +194,30 @@ func ValidateProofMissingPenalty(v interface{}) error { return nil } + +// ValidateProofSubmission validates the ProofSubmissionFee param. +// NB: The argument is an interface type to satisfy the ParamSetPair function signature. +func ValidateProofSubmissionFee(v interface{}) error { + submissionFeeCoin, ok := v.(*cosmostypes.Coin) + if !ok { + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + } + + if submissionFeeCoin == nil { + return ErrProofParamInvalid.Wrap("missing proof_submission_fee") + } + + if submissionFeeCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", submissionFeeCoin.Denom) + } + + if submissionFeeCoin.Amount.LT(DefaultProofSubmissionFee.Amount) { + return ErrProofParamInvalid.Wrapf( + "ProofSubmissionFee param is below minimum value %s: got %s", + DefaultProofSubmissionFee, + submissionFeeCoin, + ) + } + + return nil +} diff --git a/x/proof/types/params.pb.go b/x/proof/types/params.pb.go index a82615004..1c614807f 100644 --- a/x/proof/types/params.pb.go +++ b/x/proof/types/params.pb.go @@ -46,6 +46,11 @@ type Params struct { // when a proof is required (either via proof_requirement_threshold or proof_missing_penalty) // but is not provided. ProofMissingPenalty *types.Coin `protobuf:"bytes,4,opt,name=proof_missing_penalty,json=proofMissingPenalty,proto3" json:"proof_missing_penalty"` + // proof_submission_fee is the number of tokens (uPOKT) which should be paid by + // the supplier operator when submitting a proof. + // This is needed to account for the cost of storing proofs on-chain and prevent + // spamming the network with non-required proofs. + ProofSubmissionFee *types.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -109,6 +114,13 @@ func (m *Params) GetProofMissingPenalty() *types.Coin { return nil } +func (m *Params) GetProofSubmissionFee() *types.Coin { + if m != nil { + return m.ProofSubmissionFee + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.proof.Params") } @@ -116,33 +128,35 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/params.proto", fileDescriptor_2ad689ad5bf3a2d7) } var fileDescriptor_2ad689ad5bf3a2d7 = []byte{ - // 405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x8e, 0xd4, 0x30, - 0x14, 0x86, 0xc7, 0xbb, 0xab, 0x2d, 0x02, 0x42, 0x22, 0x80, 0x36, 0xd9, 0x85, 0x24, 0xa2, 0x8a, - 0x90, 0xb0, 0xb5, 0xd0, 0x51, 0x06, 0x8a, 0x6d, 0x90, 0x46, 0xd1, 0x36, 0xd0, 0x58, 0x4e, 0xd6, - 0x93, 0x58, 0x93, 0xe4, 0x05, 0xdb, 0x03, 0xe4, 0x0a, 0x54, 0x1c, 0x81, 0x23, 0x20, 0x71, 0x09, - 0xca, 0x29, 0xa9, 0x22, 0x34, 0x53, 0x80, 0x72, 0x0a, 0x34, 0x76, 0x66, 0xa6, 0x00, 0xa6, 0xb1, - 0x9e, 0xfe, 0xef, 0xff, 0x9f, 0xad, 0xe7, 0xe7, 0x5c, 0xb4, 0x30, 0xd7, 0x12, 0xaa, 0x8a, 0xb4, - 0x12, 0x60, 0x46, 0x5a, 0x26, 0x59, 0xad, 0x70, 0x2b, 0x41, 0x83, 0x7b, 0x67, 0x0b, 0xb1, 0x81, - 0xe7, 0x77, 0x59, 0x2d, 0x1a, 0x20, 0xe6, 0xb4, 0x96, 0xf3, 0xfb, 0x05, 0x14, 0x60, 0x4a, 0xb2, - 0xa9, 0x46, 0x35, 0xc8, 0x41, 0xd5, 0xa0, 0x48, 0xc6, 0x14, 0x27, 0xef, 0x2f, 0x33, 0xae, 0xd9, - 0x25, 0xc9, 0x41, 0x34, 0x96, 0x3f, 0xfe, 0x76, 0xec, 0x9c, 0x4e, 0xcd, 0x4d, 0x2e, 0x73, 0x1e, - 0x4a, 0x5e, 0xb1, 0x8e, 0xde, 0x88, 0xd9, 0x4c, 0xe4, 0x8b, 0x4a, 0x77, 0x54, 0x33, 0x59, 0x70, - 0x4d, 0x4b, 0xa6, 0x4a, 0x0f, 0x45, 0x28, 0xbe, 0x9d, 0x44, 0x43, 0x1f, 0x1e, 0xf4, 0xa5, 0xbe, - 0xa1, 0xaf, 0x76, 0xf0, 0xda, 0xb0, 0x2b, 0xa6, 0x4a, 0xf7, 0x8d, 0xe3, 0x9b, 0xf7, 0x53, 0xc9, - 0xdf, 0x2d, 0xb8, 0xd2, 0xb4, 0x95, 0x90, 0xb1, 0x4c, 0x54, 0x42, 0x77, 0xde, 0x51, 0x84, 0xe2, - 0xa3, 0xe4, 0xd1, 0xd0, 0x87, 0xff, 0x37, 0xa5, 0x67, 0x06, 0xa5, 0x96, 0x4c, 0xf7, 0xc0, 0xa5, - 0xce, 0xc5, 0x3e, 0x25, 0x24, 0xaf, 0x79, 0xa3, 0xa9, 0x2e, 0x25, 0x57, 0x25, 0x54, 0x37, 0xde, - 0x71, 0x84, 0xe2, 0x93, 0x24, 0x1c, 0xfa, 0xf0, 0x90, 0x2d, 0xf5, 0x77, 0xed, 0x47, 0x76, 0xbd, - 0x45, 0x6e, 0xe9, 0x3c, 0xb0, 0xc9, 0x5a, 0x28, 0x25, 0x9a, 0x82, 0xb6, 0xbc, 0x61, 0x95, 0xee, - 0xbc, 0x93, 0x08, 0xc5, 0xb7, 0x9e, 0xf9, 0xd8, 0x4e, 0x1a, 0x6f, 0x26, 0x8d, 0xc7, 0x49, 0xe3, - 0x97, 0x20, 0x9a, 0xc4, 0x1f, 0xfa, 0xf0, 0xdf, 0xd9, 0xf4, 0x9e, 0x91, 0x5f, 0x5b, 0x75, 0x6a, - 0xc5, 0x17, 0xd1, 0xef, 0x2f, 0x21, 0xfa, 0xf4, 0xeb, 0xeb, 0x93, 0xb3, 0xdd, 0x4a, 0x7c, 0x1c, - 0x97, 0xc2, 0x7e, 0x55, 0x72, 0xf5, 0x7d, 0x15, 0xa0, 0xe5, 0x2a, 0x40, 0x3f, 0x57, 0x01, 0xfa, - 0xbc, 0x0e, 0x26, 0xcb, 0x75, 0x30, 0xf9, 0xb1, 0x0e, 0x26, 0x6f, 0x71, 0x21, 0x74, 0xb9, 0xc8, - 0x70, 0x0e, 0x35, 0xd9, 0xa4, 0x9f, 0x36, 0x5c, 0x7f, 0x00, 0x39, 0x27, 0x7f, 0xb5, 0xd2, 0x5d, - 0xcb, 0x55, 0x76, 0x6a, 0xd6, 0xe0, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xe3, 0x17, - 0x08, 0x7e, 0x02, 0x00, 0x00, + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x6e, 0xd4, 0x40, + 0x10, 0x86, 0x6f, 0xc3, 0x91, 0xc2, 0x20, 0x24, 0x4c, 0x50, 0xec, 0x04, 0x6c, 0x8b, 0xea, 0x84, + 0x84, 0x57, 0x81, 0x8e, 0xd2, 0x20, 0x94, 0x06, 0xe9, 0x64, 0xd2, 0x40, 0xb3, 0x5a, 0x5f, 0xe6, + 0xec, 0x55, 0x6c, 0x8f, 0xd9, 0xdd, 0x03, 0xfc, 0x0a, 0x54, 0xd4, 0x54, 0x3c, 0x02, 0x8f, 0x41, + 0x99, 0x92, 0xca, 0x42, 0x77, 0x05, 0xc8, 0x4f, 0x81, 0x6e, 0xf7, 0xe2, 0x14, 0x84, 0x4b, 0x63, + 0xad, 0xfe, 0xef, 0xff, 0x67, 0xac, 0xd1, 0xef, 0x1c, 0x36, 0x78, 0xa6, 0x25, 0x96, 0x25, 0x6d, + 0x24, 0xe2, 0x9c, 0x36, 0x5c, 0xf2, 0x4a, 0xc5, 0x8d, 0x44, 0x8d, 0xee, 0x9d, 0x0b, 0x18, 0x1b, + 0x78, 0x70, 0x97, 0x57, 0xa2, 0x46, 0x6a, 0xbe, 0xd6, 0x72, 0xb0, 0x97, 0x63, 0x8e, 0xe6, 0x49, + 0xd7, 0xaf, 0x8d, 0x1a, 0xcc, 0x50, 0x55, 0xa8, 0x68, 0xc6, 0x15, 0xd0, 0x0f, 0x47, 0x19, 0x68, + 0x7e, 0x44, 0x67, 0x28, 0x6a, 0xcb, 0x1f, 0x7d, 0x1d, 0x3b, 0xbb, 0x53, 0xb3, 0xc9, 0xe5, 0xce, + 0x03, 0x09, 0x25, 0x6f, 0xd9, 0xa9, 0x98, 0xcf, 0xc5, 0x6c, 0x51, 0xea, 0x96, 0x69, 0x2e, 0x73, + 0xd0, 0xac, 0xe0, 0xaa, 0xf0, 0x48, 0x44, 0x26, 0xb7, 0x93, 0xa8, 0xef, 0xc2, 0xad, 0xbe, 0xd4, + 0x37, 0xf4, 0xe5, 0x00, 0x4f, 0x0c, 0x3b, 0xe6, 0xaa, 0x70, 0xdf, 0x3a, 0xbe, 0xf9, 0x7f, 0x26, + 0xe1, 0xfd, 0x02, 0x94, 0x66, 0x8d, 0xc4, 0x8c, 0x67, 0xa2, 0x14, 0xba, 0xf5, 0x76, 0x22, 0x32, + 0xd9, 0x49, 0x1e, 0xf6, 0x5d, 0xf8, 0x7f, 0x53, 0xba, 0x6f, 0x50, 0x6a, 0xc9, 0xf4, 0x12, 0xb8, + 0xcc, 0x39, 0xbc, 0x4c, 0x09, 0x09, 0x15, 0xd4, 0x9a, 0xe9, 0x42, 0x82, 0x2a, 0xb0, 0x3c, 0xf5, + 0x6e, 0x44, 0x64, 0x32, 0x4e, 0xc2, 0xbe, 0x0b, 0xb7, 0xd9, 0x52, 0x7f, 0x18, 0xbf, 0x61, 0x27, + 0x17, 0xc8, 0x2d, 0x9c, 0xfb, 0x36, 0x59, 0x09, 0xa5, 0x44, 0x9d, 0xb3, 0x06, 0x6a, 0x5e, 0xea, + 0xd6, 0x1b, 0x47, 0x64, 0x72, 0xeb, 0xa9, 0x1f, 0xdb, 0x4b, 0xc7, 0xeb, 0x4b, 0xc7, 0x9b, 0x4b, + 0xc7, 0x2f, 0x50, 0xd4, 0x89, 0xdf, 0x77, 0xe1, 0xd5, 0xd9, 0xf4, 0x9e, 0x91, 0x5f, 0x5b, 0x75, + 0x6a, 0x45, 0x17, 0x9c, 0x3d, 0xeb, 0x56, 0x8b, 0xcc, 0x04, 0xb0, 0x66, 0x73, 0x00, 0xef, 0xe6, + 0x75, 0x8b, 0xbc, 0xbe, 0x0b, 0xaf, 0x8c, 0xa6, 0xae, 0x51, 0xdf, 0x0c, 0xe2, 0x2b, 0x80, 0xe7, + 0xd1, 0x9f, 0x6f, 0x21, 0xf9, 0xfc, 0xfb, 0xfb, 0xe3, 0xfd, 0xa1, 0x79, 0x9f, 0x36, 0xdd, 0xb3, + 0x8d, 0x48, 0x8e, 0x7f, 0x2c, 0x03, 0x72, 0xbe, 0x0c, 0xc8, 0xaf, 0x65, 0x40, 0xbe, 0xac, 0x82, + 0xd1, 0xf9, 0x2a, 0x18, 0xfd, 0x5c, 0x05, 0xa3, 0x77, 0x71, 0x2e, 0x74, 0xb1, 0xc8, 0xe2, 0x19, + 0x56, 0x74, 0x9d, 0x7e, 0x52, 0x83, 0xfe, 0x88, 0xf2, 0x8c, 0xfe, 0x33, 0x4a, 0xb7, 0x0d, 0xa8, + 0x6c, 0xd7, 0xb4, 0xed, 0xd9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x5f, 0xff, 0xb6, 0xe5, + 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -176,6 +190,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.ProofMissingPenalty.Equal(that1.ProofMissingPenalty) { return false } + if !this.ProofSubmissionFee.Equal(that1.ProofSubmissionFee) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -198,6 +215,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProofSubmissionFee != nil { + { + size, err := m.ProofSubmissionFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if m.ProofMissingPenalty != nil { { size, err := m.ProofMissingPenalty.MarshalToSizedBuffer(dAtA[:i]) @@ -262,6 +291,10 @@ func (m *Params) Size() (n int) { l = m.ProofMissingPenalty.Size() n += 1 + l + sovParams(uint64(l)) } + if m.ProofSubmissionFee != nil { + l = m.ProofSubmissionFee.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -400,6 +433,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofSubmissionFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProofSubmissionFee == nil { + m.ProofSubmissionFee = &types.Coin{} + } + if err := m.ProofSubmissionFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/service/types/params.go b/x/service/types/params.go index 24042f18e..996fb9b5c 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -15,7 +15,7 @@ var ( KeyAddServiceFee = []byte("AddServiceFee") ParamAddServiceFee = "add_service_fee" - // TODO_TECHDEBT: Determine a sensible default value for the proof submission fee. + // TODO_TECHDEBT: Determine a sensible default value for the add service fee. DefaultAddServiceFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000000)) ) From 733d5b445a054c46f2eeb67c37720b4ac67b515c Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Fri, 6 Sep 2024 00:59:52 +0200 Subject: [PATCH 4/4] test: Add below minimum test --- api/poktroll/proof/params.pulsar.go | 2 +- proto/poktroll/proof/params.proto | 2 +- x/proof/keeper/msg_update_params_test.go | 2 +- x/proof/keeper/params_test.go | 14 +++++++++++++- x/proof/types/params.go | 11 ++++++----- x/proof/types/params.pb.go | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go index ba10f672b..27f3273c8 100644 --- a/api/poktroll/proof/params.pulsar.go +++ b/api/poktroll/proof/params.pulsar.go @@ -725,7 +725,7 @@ type Params struct { // proof_submission_fee is the number of tokens (uPOKT) which should be paid by // the supplier operator when submitting a proof. // This is needed to account for the cost of storing proofs on-chain and prevent - // spamming the network with non-required proofs. + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. ProofSubmissionFee *v1beta1.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee,omitempty"` } diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index 93edeb073..a92205188 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -37,7 +37,7 @@ message Params { // proof_submission_fee is the number of tokens (uPOKT) which should be paid by // the supplier operator when submitting a proof. // This is needed to account for the cost of storing proofs on-chain and prevent - // spamming the network with non-required proofs. + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. cosmos.base.v1beta1.Coin proof_submission_fee = 5 [(gogoproto.jsontag) = "proof_submission_fee"]; // IMPORTANT: Make sure to update all related files if you're modifying or adding a new parameter. diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index 0b0b8931d..f50570c46 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -43,7 +43,7 @@ func TestMsgUpdateParams(t *testing.T) { Authority: k.GetAuthority(), Params: types.Params{ ProofMissingPenalty: &types.DefaultProofMissingPenalty, - ProofSubmissionFee: &types.DefaultProofSubmissionFee, + ProofSubmissionFee: &types.MinProofSubmissionFee, RelayDifficultyTargetHash: types.DefaultRelayDifficultyTargetHash, }, }, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 8632dbac9..a22a99a41 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -7,6 +7,7 @@ import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) @@ -167,6 +168,8 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { func TestParams_ValidateProofSubmissionFee(t *testing.T) { invalidDenomCoin := cosmostypes.NewCoin("invalid_denom", math.NewInt(1)) + belowMinProofSubmissionFee := prooftypes.MinProofSubmissionFee. + Sub(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1))) tests := []struct { desc string @@ -193,9 +196,18 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { proofSubmissionFee: (*cosmostypes.Coin)(nil), expectedErr: prooftypes.ErrProofParamInvalid.Wrap("missing proof_submission_fee"), }, + { + desc: "below minimum", + proofSubmissionFee: &belowMinProofSubmissionFee, + expectedErr: prooftypes.ErrProofParamInvalid.Wrapf( + "ProofSubmissionFee param is below minimum value %s: got %s", + prooftypes.MinProofSubmissionFee, + belowMinProofSubmissionFee, + ), + }, { desc: "valid", - proofSubmissionFee: &prooftypes.DefaultProofSubmissionFee, + proofSubmissionFee: &prooftypes.MinProofSubmissionFee, }, } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index b896308a0..b6da6324c 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -36,8 +36,9 @@ var ( KeyProofSubmissionFee = []byte("ProofSubmissionFee") ParamProofSubmissionFee = "proof_submission_fee" - // TODO_TECHDEBT: Determine a sensible default value for the proof submission fee. - DefaultProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000)) + // TODO_MAINNET: Determine a sensible default value for the proof submission fee. + // MinProofSubmissionFee is the default and minimum fee for submitting a proof. + MinProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000)) ) // ParamKeyTable the param key table for launch module @@ -69,7 +70,7 @@ func DefaultParams() Params { DefaultProofRequestProbability, DefaultProofRequirementThreshold, &DefaultProofMissingPenalty, - &DefaultProofSubmissionFee, + &MinProofSubmissionFee, ) } @@ -211,10 +212,10 @@ func ValidateProofSubmissionFee(v interface{}) error { return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", submissionFeeCoin.Denom) } - if submissionFeeCoin.Amount.LT(DefaultProofSubmissionFee.Amount) { + if submissionFeeCoin.Amount.LT(MinProofSubmissionFee.Amount) { return ErrProofParamInvalid.Wrapf( "ProofSubmissionFee param is below minimum value %s: got %s", - DefaultProofSubmissionFee, + MinProofSubmissionFee, submissionFeeCoin, ) } diff --git a/x/proof/types/params.pb.go b/x/proof/types/params.pb.go index ccab310b8..12994f2f5 100644 --- a/x/proof/types/params.pb.go +++ b/x/proof/types/params.pb.go @@ -49,7 +49,7 @@ type Params struct { // proof_submission_fee is the number of tokens (uPOKT) which should be paid by // the supplier operator when submitting a proof. // This is needed to account for the cost of storing proofs on-chain and prevent - // spamming the network with non-required proofs. + // spamming (i.e. sybil bloat attacks) the network with non-required proofs. ProofSubmissionFee *types.Coin `protobuf:"bytes,5,opt,name=proof_submission_fee,json=proofSubmissionFee,proto3" json:"proof_submission_fee"` }