diff --git a/.prompts/test_suggestions.prompt b/.prompts/test_suggestions.prompt new file mode 100644 index 000000000..b5eeb78e3 --- /dev/null +++ b/.prompts/test_suggestions.prompt @@ -0,0 +1,15 @@ +temperature: 0.5 +maxTokens: 4096 +--- + +You are a principal software engineer. + + +{{{ input }}} + +You have been provided two files: +1. A source code file +2. A unit test file + +Please provide a list of unit test names/descriptions that you believe +are still missing. Do not actually implement them. \ No newline at end of file diff --git a/.prompts/unit_tests.prompt b/.prompts/unit_tests.prompt new file mode 100644 index 000000000..e089d6441 --- /dev/null +++ b/.prompts/unit_tests.prompt @@ -0,0 +1,17 @@ +temperature: 0.5 +maxTokens: 4096 +--- + +You are a principal software engineer. + + +{{{ input }}} + +Write unit tests for the code selected., following each of these instructions: +- Follow the best and latests practices of golang +- Where appropriate use `github.com/stretchr/testify/require` +- If necessary, create a tests struct to iterate over: `tests := []struct { +- Include at least 2 edge cases and 5 core cases +- The tests should be complete and sophisticated +- Give the tests just as chat output, don't edit any file +- Just give the code, no need for an explanation \ No newline at end of file diff --git a/Makefile b/Makefile index 20391630a..01d9ad9a4 100644 --- a/Makefile +++ b/Makefile @@ -380,6 +380,10 @@ test_e2e_session: test_e2e_env ## Run only the E2E suite that exercises the sess test_e2e_settlement: test_e2e_env ## Run only the E2E suite that exercises the session & tokenomics settlement go test -v ./e2e/tests/... -tags=e2e,test --features-path=0_settlement.feature +.PHONY: test_e2e_params +test_e2e_params: test_e2e_env ## Run only the E2E suite that exercises parameter updates for all modules + go test -v ./e2e/tests/... -tags=e2e,test --features-path=update_params.feature + .PHONY: test_load_relays_stress test_load_relays_stress: ## Run the stress test for E2E relays on non-ephemeral chains go test -v -count=1 ./load-testing/tests/... \ diff --git a/api/poktroll/tokenomics/genesis.pulsar.go b/api/poktroll/tokenomics/genesis.pulsar.go index be0862e09..8c7e27c60 100644 --- a/api/poktroll/tokenomics/genesis.pulsar.go +++ b/api/poktroll/tokenomics/genesis.pulsar.go @@ -14,15 +14,68 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*RelayMiningDifficulty +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(RelayMiningDifficulty) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_relayMiningDifficultyList protoreflect.FieldDescriptor ) func init() { file_poktroll_tokenomics_genesis_proto_init() md_GenesisState = File_poktroll_tokenomics_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_relayMiningDifficultyList = md_GenesisState.Fields().ByName("relayMiningDifficultyList") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -96,6 +149,12 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.RelayMiningDifficultyList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.RelayMiningDifficultyList}) + if !f(fd_GenesisState_relayMiningDifficultyList, value) { + return + } + } } // Has reports whether a field is populated. @@ -113,6 +172,8 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": return x.Params != nil + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + return len(x.RelayMiningDifficultyList) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -131,6 +192,8 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": x.Params = nil + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + x.RelayMiningDifficultyList = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -150,6 +213,12 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.tokenomics.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + if len(x.RelayMiningDifficultyList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.RelayMiningDifficultyList} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -172,6 +241,10 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": x.Params = value.Message().Interface().(*Params) + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.RelayMiningDifficultyList = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -197,6 +270,12 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + if x.RelayMiningDifficultyList == nil { + x.RelayMiningDifficultyList = []*RelayMiningDifficulty{} + } + value := &_GenesisState_2_list{list: &x.RelayMiningDifficultyList} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -213,6 +292,9 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.tokenomics.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": + list := []*RelayMiningDifficulty{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -286,6 +368,12 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } + if len(x.RelayMiningDifficultyList) > 0 { + for _, e := range x.RelayMiningDifficultyList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -315,6 +403,22 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.RelayMiningDifficultyList) > 0 { + for iNdEx := len(x.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.RelayMiningDifficultyList[iNdEx]) + 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] = 0x12 + } + } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -414,6 +518,40 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", 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 + } + x.RelayMiningDifficultyList = append(x.RelayMiningDifficultyList, &RelayMiningDifficulty{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficultyList[len(x.RelayMiningDifficultyList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -469,7 +607,8 @@ type GenesisState struct { unknownFields protoimpl.UnknownFields // params defines all the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + RelayMiningDifficultyList []*RelayMiningDifficulty `protobuf:"bytes,2,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList,omitempty"` } func (x *GenesisState) Reset() { @@ -499,6 +638,13 @@ func (x *GenesisState) GetParams() *Params { return nil } +func (x *GenesisState) GetRelayMiningDifficultyList() []*RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficultyList + } + return nil +} + var File_poktroll_tokenomics_genesis_proto protoreflect.FileDescriptor var file_poktroll_tokenomics_genesis_proto_rawDesc = []byte{ @@ -510,24 +656,34 @@ var file_poktroll_tokenomics_genesis_proto_rawDesc = []byte{ 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x4e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0xba, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, - 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, - 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x6f, 0x1a, 0x31, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, + 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, + 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x6e, 0x0a, 0x19, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, + 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, + 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x19, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xba, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, + 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -544,16 +700,18 @@ func file_poktroll_tokenomics_genesis_proto_rawDescGZIP() []byte { var file_poktroll_tokenomics_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_tokenomics_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: poktroll.tokenomics.GenesisState - (*Params)(nil), // 1: poktroll.tokenomics.Params + (*GenesisState)(nil), // 0: poktroll.tokenomics.GenesisState + (*Params)(nil), // 1: poktroll.tokenomics.Params + (*RelayMiningDifficulty)(nil), // 2: poktroll.tokenomics.RelayMiningDifficulty } var file_poktroll_tokenomics_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.tokenomics.GenesisState.params:type_name -> poktroll.tokenomics.Params - 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 + 2, // 1: poktroll.tokenomics.GenesisState.relayMiningDifficultyList:type_name -> poktroll.tokenomics.RelayMiningDifficulty + 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_tokenomics_genesis_proto_init() } @@ -562,6 +720,7 @@ func file_poktroll_tokenomics_genesis_proto_init() { return } file_poktroll_tokenomics_params_proto_init() + file_poktroll_tokenomics_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_tokenomics_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/tokenomics/query.pulsar.go b/api/poktroll/tokenomics/query.pulsar.go index e55219bc1..b3abf4133 100644 --- a/api/poktroll/tokenomics/query.pulsar.go +++ b/api/poktroll/tokenomics/query.pulsar.go @@ -3,7 +3,10 @@ package tokenomics import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -806,6 +809,1869 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } } +var ( + md_QueryGetRelayMiningDifficultyRequest protoreflect.MessageDescriptor + fd_QueryGetRelayMiningDifficultyRequest_serviceId protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryGetRelayMiningDifficultyRequest = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyRequest") + fd_QueryGetRelayMiningDifficultyRequest_serviceId = md_QueryGetRelayMiningDifficultyRequest.Fields().ByName("serviceId") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) + +type fastReflection_QueryGetRelayMiningDifficultyRequest QueryGetRelayMiningDifficultyRequest + +func (x *QueryGetRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(x) +} + +func (x *QueryGetRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_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_QueryGetRelayMiningDifficultyRequest_messageType fastReflection_QueryGetRelayMiningDifficultyRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyRequest_messageType{} + +type fastReflection_QueryGetRelayMiningDifficultyRequest_messageType struct{} + +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) +} +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyRequest) +} +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyRequest +} + +// 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_QueryGetRelayMiningDifficultyRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetRelayMiningDifficultyRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetRelayMiningDifficultyRequest)(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_QueryGetRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_QueryGetRelayMiningDifficultyRequest_serviceId, 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_QueryGetRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + return x.ServiceId != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + x.ServiceId = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + value := x.ServiceId + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + x.ServiceId = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + panic(fmt.Errorf("field serviceId of message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest 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_QueryGetRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest", 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_QueryGetRelayMiningDifficultyRequest) 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_QueryGetRelayMiningDifficultyRequest) 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_QueryGetRelayMiningDifficultyRequest) 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_QueryGetRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) + 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.ServiceId) + if l > 0 { + 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().(*QueryGetRelayMiningDifficultyRequest) + 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 len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + 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().(*QueryGetRelayMiningDifficultyRequest) + 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: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: 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 ServiceId", 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.ServiceId = string(dAtA[iNdEx:postIndex]) + 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_QueryGetRelayMiningDifficultyResponse protoreflect.MessageDescriptor + fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryGetRelayMiningDifficultyResponse = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyResponse") + fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryGetRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) + +type fastReflection_QueryGetRelayMiningDifficultyResponse QueryGetRelayMiningDifficultyResponse + +func (x *QueryGetRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(x) +} + +func (x *QueryGetRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_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_QueryGetRelayMiningDifficultyResponse_messageType fastReflection_QueryGetRelayMiningDifficultyResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyResponse_messageType{} + +type fastReflection_QueryGetRelayMiningDifficultyResponse_messageType struct{} + +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) +} +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyResponse) +} +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyResponse +} + +// 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_QueryGetRelayMiningDifficultyResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetRelayMiningDifficultyResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetRelayMiningDifficultyResponse)(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_QueryGetRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RelayMiningDifficulty != nil { + value := protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) + if !f(fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty, 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_QueryGetRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + return x.RelayMiningDifficulty != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + value := x.RelayMiningDifficulty + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = value.Message().Interface().(*RelayMiningDifficulty) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + if x.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = new(RelayMiningDifficulty) + } + return protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + m := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse 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_QueryGetRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse", 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_QueryGetRelayMiningDifficultyResponse) 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_QueryGetRelayMiningDifficultyResponse) 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_QueryGetRelayMiningDifficultyResponse) 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_QueryGetRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) + 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.RelayMiningDifficulty != nil { + l = options.Size(x.RelayMiningDifficulty) + 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().(*QueryGetRelayMiningDifficultyResponse) + 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.RelayMiningDifficulty != nil { + encoded, err := options.Marshal(x.RelayMiningDifficulty) + 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().(*QueryGetRelayMiningDifficultyResponse) + 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: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: 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 RelayMiningDifficulty", 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.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = &RelayMiningDifficulty{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty); 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_QueryAllRelayMiningDifficultyRequest protoreflect.MessageDescriptor + fd_QueryAllRelayMiningDifficultyRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryAllRelayMiningDifficultyRequest = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyRequest") + fd_QueryAllRelayMiningDifficultyRequest_pagination = md_QueryAllRelayMiningDifficultyRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) + +type fastReflection_QueryAllRelayMiningDifficultyRequest QueryAllRelayMiningDifficultyRequest + +func (x *QueryAllRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(x) +} + +func (x *QueryAllRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[4] + 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_QueryAllRelayMiningDifficultyRequest_messageType fastReflection_QueryAllRelayMiningDifficultyRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyRequest_messageType{} + +type fastReflection_QueryAllRelayMiningDifficultyRequest_messageType struct{} + +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) +} +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyRequest) +} +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyRequest +} + +// 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_QueryAllRelayMiningDifficultyRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllRelayMiningDifficultyRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllRelayMiningDifficultyRequest)(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_QueryAllRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllRelayMiningDifficultyRequest_pagination, 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_QueryAllRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest 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_QueryAllRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest", 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_QueryAllRelayMiningDifficultyRequest) 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_QueryAllRelayMiningDifficultyRequest) 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_QueryAllRelayMiningDifficultyRequest) 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_QueryAllRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) + 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.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryAllRelayMiningDifficultyRequest) + 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.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + 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().(*QueryAllRelayMiningDifficultyRequest) + 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: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: 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 Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); 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 _ protoreflect.List = (*_QueryAllRelayMiningDifficultyResponse_1_list)(nil) + +type _QueryAllRelayMiningDifficultyResponse_1_list struct { + list *[]*RelayMiningDifficulty +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) AppendMutable() protoreflect.Value { + v := new(RelayMiningDifficulty) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) NewElement() protoreflect.Value { + v := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllRelayMiningDifficultyResponse protoreflect.MessageDescriptor + fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor + fd_QueryAllRelayMiningDifficultyResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryAllRelayMiningDifficultyResponse = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyResponse") + fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") + fd_QueryAllRelayMiningDifficultyResponse_pagination = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) + +type fastReflection_QueryAllRelayMiningDifficultyResponse QueryAllRelayMiningDifficultyResponse + +func (x *QueryAllRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(x) +} + +func (x *QueryAllRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[5] + 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_QueryAllRelayMiningDifficultyResponse_messageType fastReflection_QueryAllRelayMiningDifficultyResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyResponse_messageType{} + +type fastReflection_QueryAllRelayMiningDifficultyResponse_messageType struct{} + +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) +} +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyResponse) +} +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyResponse +} + +// 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_QueryAllRelayMiningDifficultyResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllRelayMiningDifficultyResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllRelayMiningDifficultyResponse)(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_QueryAllRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.RelayMiningDifficulty) != 0 { + value := protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty}) + if !f(fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllRelayMiningDifficultyResponse_pagination, 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_QueryAllRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + return len(x.RelayMiningDifficulty) != 0 + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = nil + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + if len(x.RelayMiningDifficulty) == 0 { + return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{}) + } + listValue := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} + return protoreflect.ValueOfList(listValue) + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + lv := value.List() + clv := lv.(*_QueryAllRelayMiningDifficultyResponse_1_list) + x.RelayMiningDifficulty = *clv.list + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + if x.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = []*RelayMiningDifficulty{} + } + value := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} + return protoreflect.ValueOfList(value) + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + list := []*RelayMiningDifficulty{} + return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &list}) + case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse 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_QueryAllRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse", 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_QueryAllRelayMiningDifficultyResponse) 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_QueryAllRelayMiningDifficultyResponse) 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_QueryAllRelayMiningDifficultyResponse) 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_QueryAllRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.RelayMiningDifficulty) > 0 { + for _, e := range x.RelayMiningDifficulty { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryAllRelayMiningDifficultyResponse) + 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.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + 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] = 0x12 + } + if len(x.RelayMiningDifficulty) > 0 { + for iNdEx := len(x.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.RelayMiningDifficulty[iNdEx]) + 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().(*QueryAllRelayMiningDifficultyResponse) + 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: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: 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 RelayMiningDifficulty", 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 + } + x.RelayMiningDifficulty = append(x.RelayMiningDifficulty, &RelayMiningDifficulty{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty[len(x.RelayMiningDifficulty)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); 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, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -883,6 +2749,154 @@ func (x *QueryParamsResponse) GetParams() *Params { return nil } +type QueryGetRelayMiningDifficultyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` +} + +func (x *QueryGetRelayMiningDifficultyRequest) Reset() { + *x = QueryGetRelayMiningDifficultyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetRelayMiningDifficultyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. +func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +type QueryGetRelayMiningDifficultyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelayMiningDifficulty *RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` +} + +func (x *QueryGetRelayMiningDifficultyResponse) Reset() { + *x = QueryGetRelayMiningDifficultyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetRelayMiningDifficultyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. +func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() *RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficulty + } + return nil +} + +type QueryAllRelayMiningDifficultyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllRelayMiningDifficultyRequest) Reset() { + *x = QueryAllRelayMiningDifficultyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllRelayMiningDifficultyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. +func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllRelayMiningDifficultyRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllRelayMiningDifficultyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelayMiningDifficulty []*RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllRelayMiningDifficultyResponse) Reset() { + *x = QueryAllRelayMiningDifficultyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllRelayMiningDifficultyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. +func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []*RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficulty + } + return nil +} + +func (x *QueryAllRelayMiningDifficultyResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + var File_poktroll_tokenomics_query_proto protoreflect.FileDescriptor var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ @@ -893,38 +2907,109 @@ var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ 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, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x97, 0x01, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x31, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x44, 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, + 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x8f, 0x01, 0x0a, + 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, + 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, + 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, + 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22, 0x6e, + 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, + 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd8, + 0x01, 0x0a, 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, + 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, + 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xce, 0x04, 0x0a, 0x05, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, + 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0xdd, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, + 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x39, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x47, 0x12, 0x45, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, + 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x2f, 0x7b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x49, 0x64, 0x7d, 0x12, 0xd4, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, + 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x41, 0x6c, 0x6c, + 0x12, 0x39, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, + 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, + 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x12, + 0x39, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, + 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, + 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -939,21 +3024,36 @@ func file_poktroll_tokenomics_query_proto_rawDescGZIP() []byte { return file_poktroll_tokenomics_query_proto_rawDescData } -var file_poktroll_tokenomics_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_tokenomics_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_tokenomics_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.tokenomics.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.tokenomics.QueryParamsResponse - (*Params)(nil), // 2: poktroll.tokenomics.Params + (*QueryParamsRequest)(nil), // 0: poktroll.tokenomics.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.tokenomics.QueryParamsResponse + (*QueryGetRelayMiningDifficultyRequest)(nil), // 2: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest + (*QueryGetRelayMiningDifficultyResponse)(nil), // 3: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse + (*QueryAllRelayMiningDifficultyRequest)(nil), // 4: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest + (*QueryAllRelayMiningDifficultyResponse)(nil), // 5: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse + (*Params)(nil), // 6: poktroll.tokenomics.Params + (*RelayMiningDifficulty)(nil), // 7: poktroll.tokenomics.RelayMiningDifficulty + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_tokenomics_query_proto_depIdxs = []int32{ - 2, // 0: poktroll.tokenomics.QueryParamsResponse.params:type_name -> poktroll.tokenomics.Params - 0, // 1: poktroll.tokenomics.Query.Params:input_type -> poktroll.tokenomics.QueryParamsRequest - 1, // 2: poktroll.tokenomics.Query.Params:output_type -> poktroll.tokenomics.QueryParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] 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 + 6, // 0: poktroll.tokenomics.QueryParamsResponse.params:type_name -> poktroll.tokenomics.Params + 7, // 1: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.tokenomics.RelayMiningDifficulty + 8, // 2: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.tokenomics.RelayMiningDifficulty + 9, // 4: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.tokenomics.Query.Params:input_type -> poktroll.tokenomics.QueryParamsRequest + 2, // 6: poktroll.tokenomics.Query.RelayMiningDifficulty:input_type -> poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest + 4, // 7: poktroll.tokenomics.Query.RelayMiningDifficultyAll:input_type -> poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest + 1, // 8: poktroll.tokenomics.Query.Params:output_type -> poktroll.tokenomics.QueryParamsResponse + 3, // 9: poktroll.tokenomics.Query.RelayMiningDifficulty:output_type -> poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse + 5, // 10: poktroll.tokenomics.Query.RelayMiningDifficultyAll:output_type -> poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_tokenomics_query_proto_init() } @@ -962,6 +3062,7 @@ func file_poktroll_tokenomics_query_proto_init() { return } file_poktroll_tokenomics_params_proto_init() + file_poktroll_tokenomics_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_tokenomics_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { @@ -987,6 +3088,54 @@ func file_poktroll_tokenomics_query_proto_init() { return nil } } + file_poktroll_tokenomics_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetRelayMiningDifficultyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_tokenomics_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetRelayMiningDifficultyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_tokenomics_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllRelayMiningDifficultyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_tokenomics_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllRelayMiningDifficultyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -994,7 +3143,7 @@ func file_poktroll_tokenomics_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_tokenomics_query_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/tokenomics/query_grpc.pb.go b/api/poktroll/tokenomics/query_grpc.pb.go index deecd528b..fb5c4bc7c 100644 --- a/api/poktroll/tokenomics/query_grpc.pb.go +++ b/api/poktroll/tokenomics/query_grpc.pb.go @@ -19,7 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Query_Params_FullMethodName = "/poktroll.tokenomics.Query/Params" + Query_Params_FullMethodName = "/poktroll.tokenomics.Query/Params" + Query_RelayMiningDifficulty_FullMethodName = "/poktroll.tokenomics.Query/RelayMiningDifficulty" + Query_RelayMiningDifficultyAll_FullMethodName = "/poktroll.tokenomics.Query/RelayMiningDifficultyAll" ) // QueryClient is the client API for Query service. @@ -28,6 +30,9 @@ const ( type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -47,12 +52,33 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { + out := new(QueryGetRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, Query_RelayMiningDifficulty_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { + out := new(QueryAllRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, Query_RelayMiningDifficultyAll_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) mustEmbedUnimplementedQueryServer() } @@ -63,6 +89,12 @@ type UnimplementedQueryServer struct { func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (UnimplementedQueryServer) RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") +} +func (UnimplementedQueryServer) RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -94,6 +126,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficulty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_RelayMiningDifficulty_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_RelayMiningDifficultyAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -105,6 +173,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "RelayMiningDifficulty", + Handler: _Query_RelayMiningDifficulty_Handler, + }, + { + MethodName: "RelayMiningDifficultyAll", + Handler: _Query_RelayMiningDifficultyAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/tokenomics/query.proto", diff --git a/api/poktroll/tokenomics/relay_mining_difficulty.pulsar.go b/api/poktroll/tokenomics/relay_mining_difficulty.pulsar.go new file mode 100644 index 000000000..f0c614cda --- /dev/null +++ b/api/poktroll/tokenomics/relay_mining_difficulty.pulsar.go @@ -0,0 +1,774 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenomics + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_RelayMiningDifficulty protoreflect.MessageDescriptor + fd_RelayMiningDifficulty_service_id protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_block_height protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_num_relays_ema protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_target_hash protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_relay_mining_difficulty_proto_init() + md_RelayMiningDifficulty = File_poktroll_tokenomics_relay_mining_difficulty_proto.Messages().ByName("RelayMiningDifficulty") + fd_RelayMiningDifficulty_service_id = md_RelayMiningDifficulty.Fields().ByName("service_id") + fd_RelayMiningDifficulty_block_height = md_RelayMiningDifficulty.Fields().ByName("block_height") + fd_RelayMiningDifficulty_num_relays_ema = md_RelayMiningDifficulty.Fields().ByName("num_relays_ema") + fd_RelayMiningDifficulty_target_hash = md_RelayMiningDifficulty.Fields().ByName("target_hash") +} + +var _ protoreflect.Message = (*fastReflection_RelayMiningDifficulty)(nil) + +type fastReflection_RelayMiningDifficulty RelayMiningDifficulty + +func (x *RelayMiningDifficulty) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayMiningDifficulty)(x) +} + +func (x *RelayMiningDifficulty) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_relay_mining_difficulty_proto_msgTypes[0] + 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_RelayMiningDifficulty_messageType fastReflection_RelayMiningDifficulty_messageType +var _ protoreflect.MessageType = fastReflection_RelayMiningDifficulty_messageType{} + +type fastReflection_RelayMiningDifficulty_messageType struct{} + +func (x fastReflection_RelayMiningDifficulty_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayMiningDifficulty)(nil) +} +func (x fastReflection_RelayMiningDifficulty_messageType) New() protoreflect.Message { + return new(fastReflection_RelayMiningDifficulty) +} +func (x fastReflection_RelayMiningDifficulty_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayMiningDifficulty +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayMiningDifficulty) Descriptor() protoreflect.MessageDescriptor { + return md_RelayMiningDifficulty +} + +// 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_RelayMiningDifficulty) Type() protoreflect.MessageType { + return _fastReflection_RelayMiningDifficulty_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayMiningDifficulty) New() protoreflect.Message { + return new(fastReflection_RelayMiningDifficulty) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayMiningDifficulty) Interface() protoreflect.ProtoMessage { + return (*RelayMiningDifficulty)(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_RelayMiningDifficulty) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_RelayMiningDifficulty_service_id, value) { + return + } + } + if x.BlockHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockHeight) + if !f(fd_RelayMiningDifficulty_block_height, value) { + return + } + } + if x.NumRelaysEma != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelaysEma) + if !f(fd_RelayMiningDifficulty_num_relays_ema, value) { + return + } + } + if len(x.TargetHash) != 0 { + value := protoreflect.ValueOfBytes(x.TargetHash) + if !f(fd_RelayMiningDifficulty_target_hash, 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_RelayMiningDifficulty) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + return x.ServiceId != "" + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + return x.BlockHeight != int64(0) + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + return x.NumRelaysEma != uint64(0) + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + return len(x.TargetHash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + x.ServiceId = "" + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + x.BlockHeight = int64(0) + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + x.NumRelaysEma = uint64(0) + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + x.TargetHash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + value := x.ServiceId + return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + value := x.BlockHeight + return protoreflect.ValueOfInt64(value) + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + value := x.NumRelaysEma + return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + value := x.TargetHash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + x.ServiceId = value.Interface().(string) + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + x.BlockHeight = value.Int() + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + x.NumRelaysEma = value.Uint() + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + x.TargetHash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + panic(fmt.Errorf("field service_id of message poktroll.tokenomics.RelayMiningDifficulty is not mutable")) + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + panic(fmt.Errorf("field block_height of message poktroll.tokenomics.RelayMiningDifficulty is not mutable")) + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + panic(fmt.Errorf("field num_relays_ema of message poktroll.tokenomics.RelayMiningDifficulty is not mutable")) + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + panic(fmt.Errorf("field target_hash of message poktroll.tokenomics.RelayMiningDifficulty is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.RelayMiningDifficulty.service_id": + return protoreflect.ValueOfString("") + case "poktroll.tokenomics.RelayMiningDifficulty.block_height": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.tokenomics.RelayMiningDifficulty.num_relays_ema": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.RelayMiningDifficulty.target_hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.tokenomics.RelayMiningDifficulty 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_RelayMiningDifficulty) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.RelayMiningDifficulty", 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_RelayMiningDifficulty) 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_RelayMiningDifficulty) 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_RelayMiningDifficulty) 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_RelayMiningDifficulty) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayMiningDifficulty) + 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.ServiceId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.BlockHeight)) + } + if x.NumRelaysEma != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelaysEma)) + } + l = len(x.TargetHash) + if l > 0 { + 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().(*RelayMiningDifficulty) + 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 len(x.TargetHash) > 0 { + i -= len(x.TargetHash) + copy(dAtA[i:], x.TargetHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TargetHash))) + i-- + dAtA[i] = 0x22 + } + if x.NumRelaysEma != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelaysEma)) + i-- + dAtA[i] = 0x18 + } + if x.BlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + 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().(*RelayMiningDifficulty) + 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: RelayMiningDifficulty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayMiningDifficulty: 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 ServiceId", 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.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + x.BlockHeight = 0 + 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++ + x.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelaysEma", wireType) + } + x.NumRelaysEma = 0 + 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++ + x.NumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TargetHash", wireType) + } + var byteLen 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++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + 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.TargetHash = append(x.TargetHash[:0], dAtA[iNdEx:postIndex]...) + if x.TargetHash == nil { + x.TargetHash = []byte{} + } + 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, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/relay_mining_difficulty.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// RelayMiningDifficulty is a message used to store the on-chain Relay Mining +// difficulty associated with a specific service ID. +type RelayMiningDifficulty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The service ID the the relay mining difficulty is associated with. + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + // The block height at which this relay mining difficulty was computed. + // This is needed to determine how much time has passed since the last time + // the exponential moving average was computed. + BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // The exponential moving average of the number of relays for this service. + NumRelaysEma uint64 `protobuf:"varint,3,opt,name=num_relays_ema,json=numRelaysEma,proto3" json:"num_relays_ema,omitempty"` + // The target hash determining the difficulty to mine relays for this service. + // For example, if we use sha256 to hash the (RelayRequest,ReqlayResponse) tuple, + // and the difficulty has 4 leading zero bits, then the target hash would be: + // 0b0000111... (until 32 bytes are filled up). + TargetHash []byte `protobuf:"bytes,4,opt,name=target_hash,json=targetHash,proto3" json:"target_hash,omitempty"` +} + +func (x *RelayMiningDifficulty) Reset() { + *x = RelayMiningDifficulty{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_relay_mining_difficulty_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayMiningDifficulty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayMiningDifficulty) ProtoMessage() {} + +// Deprecated: Use RelayMiningDifficulty.ProtoReflect.Descriptor instead. +func (*RelayMiningDifficulty) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescGZIP(), []int{0} +} + +func (x *RelayMiningDifficulty) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *RelayMiningDifficulty) GetBlockHeight() int64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +func (x *RelayMiningDifficulty) GetNumRelaysEma() uint64 { + if x != nil { + return x.NumRelaysEma + } + return 0 +} + +func (x *RelayMiningDifficulty) GetTargetHash() []byte { + if x != nil { + return x.TargetHash + } + return nil +} + +var File_poktroll_tokenomics_relay_mining_difficulty_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDesc = []byte{ + 0x0a, 0x31, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, + 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, + 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x42, 0xc8, 0x01, 0x0a, 0x17, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x1a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, + 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, + 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescData = file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDesc +) + +func file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescData) + }) + return file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDescData +} + +var file_poktroll_tokenomics_relay_mining_difficulty_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_tokenomics_relay_mining_difficulty_proto_goTypes = []interface{}{ + (*RelayMiningDifficulty)(nil), // 0: poktroll.tokenomics.RelayMiningDifficulty +} +var file_poktroll_tokenomics_relay_mining_difficulty_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 +} + +func init() { file_poktroll_tokenomics_relay_mining_difficulty_proto_init() } +func file_poktroll_tokenomics_relay_mining_difficulty_proto_init() { + if File_poktroll_tokenomics_relay_mining_difficulty_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_relay_mining_difficulty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayMiningDifficulty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_tokenomics_relay_mining_difficulty_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_relay_mining_difficulty_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_relay_mining_difficulty_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_relay_mining_difficulty_proto = out.File + file_poktroll_tokenomics_relay_mining_difficulty_proto_rawDesc = nil + file_poktroll_tokenomics_relay_mining_difficulty_proto_goTypes = nil + file_poktroll_tokenomics_relay_mining_difficulty_proto_depIdxs = nil +} diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index b7a43547d..57499f3a2 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -1,14 +1,16 @@ Feature: Params Namespace # TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. - Scenario: An unauthorized user cannot update a module params - Given the user has the pocketd binary installed - And all "tokenomics" 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.tokenomics.MsgUpdateParams" message exists - When the "unauthorized" account sends an authz exec message to update all "tokenomics" module params - | name | value | type | - | compute_units_to_tokens_multiplier | 666 | int64 | - Then all "tokenomics" module params should be set to their default values + Background: + + Scenario: An unauthorized user cannot update a module params + Given the user has the pocketd binary installed + And all "tokenomics" 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.tokenomics.MsgUpdateParams" message exists + When the "unauthorized" account sends an authz exec message to update all "tokenomics" module params + | name | value | type | + | compute_units_to_tokens_multiplier | 666 | int64 | + Then all "tokenomics" module params should be set to their default values # NB: If you are reading this and the tokenomics module has parameters # that are not being updated in this test, please update the test. diff --git a/load-testing/tests/relays_stress_helpers_test.go b/load-testing/tests/relays_stress_helpers_test.go index 7461c4a05..8acb4dc42 100644 --- a/load-testing/tests/relays_stress_helpers_test.go +++ b/load-testing/tests/relays_stress_helpers_test.go @@ -173,9 +173,9 @@ func (s *relaysSuite) mapSessionInfoForLoadTestDurationFn( sessionInfo := &sessionInfoNotif{ blockHeight: blockHeight, - sessionNumber: shared.GetDefaultSessionNumber(blockHeight), - sessionStartBlockHeight: shared.GetDefaultSessionStartHeight(blockHeight), - sessionEndBlockHeight: shared.GetDefaultSessionEndHeight(blockHeight), + sessionNumber: shared.GetSessionNumberWithDefaultParams(blockHeight), + sessionStartBlockHeight: shared.GetSessionStartHeightWithDefaultParams(blockHeight), + sessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(blockHeight), } infoLogger := logger.Info(). @@ -720,7 +720,7 @@ func (plan *actorLoadTestIncrementPlan) shouldIncrementActorCount( return false } - initialSessionNumber := shared.GetDefaultSessionNumber(startBlockHeight) + initialSessionNumber := shared.GetSessionNumberWithDefaultParams(startBlockHeight) // TODO_TECHDEBT(#21): replace with gov param query when available. actorSessionIncRate := plan.blocksPerIncrement / shared.NumBlocksPerSession nextSessionNumber := sessionInfo.sessionNumber + 1 - initialSessionNumber @@ -746,7 +746,7 @@ func (plan *actorLoadTestIncrementPlan) shouldIncrementSupplierCount( return false } - initialSessionNumber := shared.GetDefaultSessionNumber(startBlockHeight) + initialSessionNumber := shared.GetSessionNumberWithDefaultParams(startBlockHeight) // TODO_TECHDEBT(#21): replace with gov param query when available. supplierSessionIncRate := plan.blocksPerIncrement / shared.NumBlocksPerSession nextSessionNumber := sessionInfo.sessionNumber + 1 - initialSessionNumber diff --git a/proto/poktroll/tokenomics/genesis.proto b/proto/poktroll/tokenomics/genesis.proto index 03f190e28..51a9f4be1 100644 --- a/proto/poktroll/tokenomics/genesis.proto +++ b/proto/poktroll/tokenomics/genesis.proto @@ -1,15 +1,19 @@ syntax = "proto3"; + package poktroll.tokenomics; option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; - import "poktroll/tokenomics/params.proto"; +import "poktroll/tokenomics/relay_mining_difficulty.proto"; // GenesisState defines the tokenomics module's genesis state. message GenesisState { + // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated RelayMiningDifficulty relayMiningDifficultyList = 2 [(gogoproto.nullable) = false] ; } + diff --git a/proto/poktroll/tokenomics/query.proto b/proto/poktroll/tokenomics/query.proto index 9c3df7a62..31b0277ca 100644 --- a/proto/poktroll/tokenomics/query.proto +++ b/proto/poktroll/tokenomics/query.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.tokenomics; option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; @@ -6,22 +7,56 @@ option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "poktroll/tokenomics/params.proto"; +import "poktroll/tokenomics/relay_mining_difficulty.proto"; // Query defines the gRPC querier service. service Query { + // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params"; + } -} + // Queries a list of RelayMiningDifficulty items. + rpc RelayMiningDifficulty (QueryGetRelayMiningDifficultyRequest) returns (QueryGetRelayMiningDifficultyResponse) { + option (google.api.http).get = "/pokt-network/poktroll/tokenomics/relay_mining_difficulty/{serviceId}"; + + } + rpc RelayMiningDifficultyAll (QueryAllRelayMiningDifficultyRequest) returns (QueryAllRelayMiningDifficultyResponse) { + option (google.api.http).get = "/pokt-network/poktroll/tokenomics/relay_mining_difficulty"; + + } +} // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { + // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} \ No newline at end of file +} + +message QueryGetRelayMiningDifficultyRequest { + string serviceId = 1; +} + +message QueryGetRelayMiningDifficultyResponse { + RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllRelayMiningDifficultyRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllRelayMiningDifficultyResponse { + repeated RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/tokenomics/relay_mining_difficulty.proto b/proto/poktroll/tokenomics/relay_mining_difficulty.proto new file mode 100644 index 000000000..599e881ad --- /dev/null +++ b/proto/poktroll/tokenomics/relay_mining_difficulty.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package poktroll.tokenomics; + +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + +// RelayMiningDifficulty is a message used to store the on-chain Relay Mining +// difficulty associated with a specific service ID. +message RelayMiningDifficulty { + // The service ID the the relay mining difficulty is associated with. + string service_id = 1; + + // The block height at which this relay mining difficulty was computed. + // This is needed to determine how much time has passed since the last time + // the exponential moving average was computed. + int64 block_height = 2; + + // The exponential moving average of the number of relays for this service. + uint64 num_relays_ema = 3; + + // The target hash determining the difficulty to mine relays for this service. + // For example, if we use sha256 to hash the (RelayRequest,ReqlayResponse) tuple, + // and the difficulty has 4 leading zero bits, then the target hash would be: + // 0b0000111... (until 32 bytes are filled up). + bytes target_hash = 4; + + // TODO_BLOCKER_BETA(@Olshansk): Add a `hash_algorithm` field either in this + // structure or elsewhere so we can support changing it over time. There should + // be one source of truth, somewhere on chain, to stay in sync with the SMT + // configuration. +} diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go index 55a3ed501..6680497d3 100644 --- a/testutil/keeper/application.go +++ b/testutil/keeper/application.go @@ -77,7 +77,7 @@ func ApplicationKeeper(t testing.TB) (keeper.Keeper, context.Context) { AnyTimes() mockSharedKeeper.EXPECT().GetSessionEndHeight(gomock.Any(), gomock.Any()). DoAndReturn(func(_ context.Context, queryHeight int64) int64 { - return shared.GetDefaultSessionEndHeight(queryHeight) + return shared.GetSessionEndHeightWithDefaultParams(queryHeight) }). AnyTimes() diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 227e5ef2a..6b8e8f17e 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -66,7 +66,15 @@ type TokenomicsModuleKeepers struct { // and tokenomics keepers during construction of the aggregation. type TokenomicsKeepersOpt func(context.Context, *TokenomicsModuleKeepers) context.Context -func TokenomicsKeeper(t testing.TB) ( +func TokenomicsKeeper(t testing.TB) (tokenomicsKeeper tokenomicskeeper.Keeper, ctx context.Context) { + t.Helper() + k, ctx, _, _ := TokenomicsKeeperWithActorAddrs(t) + return k, ctx +} + +// TODO_TECHDEBT: Have the callers use the keepers to find `appAddr` and `supplierAddr` +// rather than returning them explicitly. +func TokenomicsKeeperWithActorAddrs(t testing.TB) ( tokenomicsKeeper tokenomicskeeper.Keeper, ctx context.Context, appAddr string, diff --git a/testutil/testclient/testqueryclients/sessionquerier.go b/testutil/testclient/testqueryclients/sessionquerier.go index 5d9b00f33..f9a30cbe0 100644 --- a/testutil/testclient/testqueryclients/sessionquerier.go +++ b/testutil/testclient/testqueryclients/sessionquerier.go @@ -80,11 +80,11 @@ func AddToExistingSessions( Service: &sharedtypes.Service{Id: serviceId}, ApplicationAddress: appAddress, SessionId: sessionId, - SessionStartBlockHeight: shared.GetDefaultSessionStartHeight(blockHeight), - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(blockHeight), + SessionStartBlockHeight: shared.GetSessionStartHeightWithDefaultParams(blockHeight), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(blockHeight), }, NumBlocksPerSession: shared.NumBlocksPerSession, - SessionNumber: shared.GetDefaultSessionNumber(blockHeight), + SessionNumber: shared.GetSessionNumberWithDefaultParams(blockHeight), SessionId: sessionId, Suppliers: []*sharedtypes.Supplier{}, } diff --git a/testutil/testproxy/relayerproxy.go b/testutil/testproxy/relayerproxy.go index fae4aa1c3..21071e88c 100644 --- a/testutil/testproxy/relayerproxy.go +++ b/testutil/testproxy/relayerproxy.go @@ -414,8 +414,8 @@ func GenerateRelayRequest( ApplicationAddress: appAddress, SessionId: string(sessionId[:]), Service: &sharedtypes.Service{Id: serviceId}, - SessionStartBlockHeight: shared.GetDefaultSessionStartHeight(blockHeight), - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(blockHeight), + SessionStartBlockHeight: shared.GetSessionStartHeightWithDefaultParams(blockHeight), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(blockHeight), }, // The returned relay is unsigned and must be signed elsewhere for functionality Signature: []byte(""), diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go index 21f069e47..c9714bef0 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway_test.go @@ -317,7 +317,7 @@ func TestMsgServer_UndelegateFromGateway_DelegationIsActiveUntilNextSession(t *t // Verify that the gateway is added to the pending undelegation list with the // right sessionEndHeight as the map key. - sessionEndHeight := uint64(shared.GetDefaultSessionEndHeight(undelegationHeight)) + sessionEndHeight := uint64(shared.GetSessionEndHeightWithDefaultParams(undelegationHeight)) require.Contains(t, app.PendingUndelegations[sessionEndHeight].GatewayAddresses, pendingUndelegateFromAddr, @@ -385,7 +385,7 @@ func TestMsgServer_UndelegateFromGateway_DelegationIsPrunedAfterRetentionPeriod( // Verify that the the pending undelegation map no longer contains the // sessionEndHeight key. - sessionEndHeight := uint64(shared.GetDefaultSessionEndHeight(undelegationHeight)) + sessionEndHeight := uint64(shared.GetSessionEndHeightWithDefaultParams(undelegationHeight)) require.Empty(t, app.PendingUndelegations[sessionEndHeight]) // Verify that the reconstructed delegatee gateway list can no longer include @@ -424,7 +424,7 @@ func TestMsgServer_UndelegateFromGateway_RedelegationAfterUndelegationAtTheSameS // Verify that the gateway is also present in the pending undelegation list with the // right sessionEndHeight as the map key. - sessionEndHeight := uint64(shared.GetDefaultSessionEndHeight(undelegationHeight)) + sessionEndHeight := uint64(shared.GetSessionEndHeightWithDefaultParams(undelegationHeight)) require.Contains(t, app.PendingUndelegations[sessionEndHeight].GatewayAddresses, gatewayAddrToRedelegate, @@ -534,15 +534,15 @@ func createAppStakeDelegateAndUndelegate( // getUndelegationPruningBlockHeight returns the block height at which undelegations // should be pruned for a given undlegation block height. func getUndelegationPruningBlockHeight(blockHeight int64) (pruningHeihgt int64) { - nextSessionStartHeight := shared.GetDefaultSessionEndHeight(blockHeight) + 1 + nextSessionStartHeight := shared.GetSessionEndHeightWithDefaultParams(blockHeight) + 1 - return nextSessionStartHeight + getDefaultNumBlocksUndelegationRetention() + return nextSessionStartHeight + getNumBlocksUndelegationRetentionWithDefaultParams() } -// getNumBlocksUndelegationRetention returns the number of blocks for which -// undelegations should be kept before being pruned, given the default shared +// getNumBlocksUndelegationRetentionWithDefaultParams returns the number of blocks for +// which undelegations should be kept before being pruned, given the default shared // module parameters. -func getDefaultNumBlocksUndelegationRetention() int64 { +func getNumBlocksUndelegationRetentionWithDefaultParams() int64 { sharedParams := sharedtypes.DefaultParams() return keeper.GetNumBlocksUndelegationRetention(&sharedParams) } diff --git a/x/proof/keeper/msg_server_create_claim_test.go b/x/proof/keeper/msg_server_create_claim_test.go index bb6a303ae..170f6cbd1 100644 --- a/x/proof/keeper/msg_server_create_claim_test.go +++ b/x/proof/keeper/msg_server_create_claim_test.go @@ -300,7 +300,7 @@ func newTestClaimMsg( Service: service, SessionId: sessionId, SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(sessionStartHeight), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(sessionStartHeight), }, merkleRoot, ) diff --git a/x/proof/keeper/proof_test.go b/x/proof/keeper/proof_test.go index 82aab9aa3..13c578f82 100644 --- a/x/proof/keeper/proof_test.go +++ b/x/proof/keeper/proof_test.go @@ -37,7 +37,7 @@ func createNProofs(keeper keeper.Keeper, ctx context.Context, n int) []types.Pro Service: &sharedtypes.Service{Id: testServiceId}, SessionId: fmt.Sprintf("session-%d", i), SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, ClosestMerkleProof: nil, } diff --git a/x/proof/module/helpers_test.go b/x/proof/module/helpers_test.go index 8e4ae15a9..3e2dd6045 100644 --- a/x/proof/module/helpers_test.go +++ b/x/proof/module/helpers_test.go @@ -130,7 +130,7 @@ func networkWithClaimObjects( claim := createClaim( t, net, ctx, supplierAcct.Address.String(), - shared.GetDefaultSessionStartHeight(blockHeight), + shared.GetSessionStartHeightWithDefaultParams(blockHeight), appAcct.Address.String(), ) claims = append(claims, *claim) @@ -160,7 +160,7 @@ func encodeSessionHeader( Service: &sharedtypes.Service{Id: testServiceId}, SessionId: sessionId, SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(sessionStartHeight), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(sessionStartHeight), } cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) sessionHeaderBz := cdc.MustMarshalJSON(sessionHeader) @@ -210,7 +210,7 @@ func createClaim( Service: &sharedtypes.Service{Id: testServiceId}, SessionId: sessionId, SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(sessionStartHeight), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(sessionStartHeight), }, RootHash: rootHash, } diff --git a/x/proof/types/message_submit_proof_test.go b/x/proof/types/message_submit_proof_test.go index a3737a176..00558bb93 100644 --- a/x/proof/types/message_submit_proof_test.go +++ b/x/proof/types/message_submit_proof_test.go @@ -30,7 +30,7 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { Service: testService, SessionId: "mock_session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, Proof: testClosestMerkleProof, }, @@ -49,7 +49,7 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { Service: testService, SessionId: "mock_session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, Proof: testClosestMerkleProof, }, @@ -68,7 +68,7 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { Service: &sharedtypes.Service{Id: ""}, SessionId: "mock_session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, Proof: testClosestMerkleProof, }, @@ -83,7 +83,7 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { Service: testService, SessionId: "mock_session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, Proof: testClosestMerkleProof, }, diff --git a/x/shared/keeper/session.go b/x/shared/keeper/session.go index fd4d29f09..c0d414c5f 100644 --- a/x/shared/keeper/session.go +++ b/x/shared/keeper/session.go @@ -6,8 +6,8 @@ import ( "github.com/pokt-network/poktroll/x/shared" ) -// GetSessionStartHeight returns the block height at which the session starts given -// the passed shared on-chain parameters. +// GetSessionStartHeight returns the block height at which the session containing +// queryHeight starts, given the current shared on-chain parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions start at blocks 1, 5, 9, etc. func (k Keeper) GetSessionStartHeight(ctx context.Context, queryHeight int64) int64 { @@ -15,8 +15,8 @@ func (k Keeper) GetSessionStartHeight(ctx context.Context, queryHeight int64) in return shared.GetSessionStartHeight(&sharedParams, queryHeight) } -// GetSessionEndHeight returns the block height at which the session ends -// given the passed shared on-chain parameters. +// GetSessionEndHeight returns the block height at which the session containing +// queryHeight ends, given the current shared on-chain parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions end at blocks 4, 8, 11, etc. func (k Keeper) GetSessionEndHeight(ctx context.Context, queryHeight int64) int64 { @@ -24,8 +24,8 @@ func (k Keeper) GetSessionEndHeight(ctx context.Context, queryHeight int64) int6 return shared.GetSessionEndHeight(&sharedParams, queryHeight) } -// GetSessionNumber returns the session number given the block height given the passed -// shared on-chain parameters. +// GetSessionNumber returns the session number for the session containing queryHeight, +// given the current shared on-chain parameters. // Returns session number 0 if the block height is not a consensus produced block. // Returns session number 1 for block 1 to block NumBlocksPerSession - 1 (inclusive). // i.e. If NubBlocksPerSession == 4, session == 1 for [1, 4], session == 2 for [5, 8], etc. diff --git a/x/shared/session.go b/x/shared/session.go index 17b1346da..ece8bfc5e 100644 --- a/x/shared/session.go +++ b/x/shared/session.go @@ -16,19 +16,20 @@ const NumBlocksPerSession = 4 // governance parameter is implemented. const SessionGracePeriodBlocks = 4 -// GetDefaultSessionStartHeight returns the block height at which the session starts -// given the default shared on-chain parameters. +// GetSessionStartHeightWithDefaultParams returns the block height at which the +// session containing queryHeight starts, given the default shared on-chain +// parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions start at blocks 1, 5, 9, etc. // // TODO_TECHDEBT(#517): Move this function to shared testutils. -func GetDefaultSessionStartHeight(queryHeight int64) int64 { +func GetSessionStartHeightWithDefaultParams(queryHeight int64) int64 { sharedParams := sharedtypes.DefaultParams() return GetSessionStartHeight(&sharedParams, queryHeight) } -// GetSessionStartHeight returns the block height at which the session starts given -// the passed shared on-chain parameters. +// GetSessionStartHeight returns the block height at which the session containing +// queryHeight starts, given the passed shared on-chain parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions start at blocks 1, 5, 9, etc. func GetSessionStartHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64 { @@ -43,19 +44,19 @@ func GetSessionStartHeight(sharedParams *sharedtypes.Params, queryHeight int64) return queryHeight - ((queryHeight - 1) % numBlocksPerSession) } -// GetDefaultSessionEndHeight returns the block height at which the session ends, -// given the default shared on-chain parameters. +// GetSessionEndHeightWithDefaultParams returns the block height at which the session +// containing queryHeight ends, given the default shared on-chain parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions end at blocks 4, 8, 11, etc. // // TODO_TECHDEBT(#517): Move this function to shared testutils. -func GetDefaultSessionEndHeight(queryHeight int64) int64 { +func GetSessionEndHeightWithDefaultParams(queryHeight int64) int64 { sharedParams := sharedtypes.DefaultParams() return GetSessionEndHeight(&sharedParams, queryHeight) } -// GetSessionEndHeight returns the block height at which the session ends -// given the passed shared on-chain parameters. +// GetSessionEndHeight returns the block height at which the session containing +// queryHeight ends, given the passed shared on-chain parameters. // Returns 0 if the block height is not a consensus produced block. // Example: If NumBlocksPerSession == 4, sessions end at blocks 4, 8, 11, etc. func GetSessionEndHeight(sharedParams *sharedtypes.Params, queryHeight int64) int64 { @@ -68,19 +69,20 @@ func GetSessionEndHeight(sharedParams *sharedtypes.Params, queryHeight int64) in return GetSessionStartHeight(sharedParams, queryHeight) + numBlocksPerSession - 1 } -// GetDefaultSessionNumber returns the session number given the block height given the -// default on-chain shared parameters. +// GetSessionNumberWithDefaultParams returns the session number of the session +// containing queryHeight, given the default on-chain shared parameters. // Returns session number 0 if the block height is not a consensus produced block. // Returns session number 1 for block 1 to block NumBlocksPerSession - 1 (inclusive). // i.e. If NubBlocksPerSession == 4, session == 1 for [1, 4], session == 2 for [5, 8], etc. // // TODO_TECHDEBT(#517): Move this function to shared testutils. -func GetDefaultSessionNumber(queryHeight int64) int64 { +func GetSessionNumberWithDefaultParams(queryHeight int64) int64 { sharedParams := sharedtypes.DefaultParams() return GetSessionNumber(&sharedParams, queryHeight) } -// GetSessionNumber returns the session number given the block height given the passed +// GetSessionNumber returns the session number of the session containing queryHeight, +// given the passed on-chain shared parameters. // shared on-chain parameters. // Returns session number 0 if the block height is not a consensus produced block. // Returns session number 1 for block 1 to block NumBlocksPerSession - 1 (inclusive). diff --git a/x/tokenomics/keeper/keeper_test.go b/x/tokenomics/keeper/keeper_test.go index 94bf6a37b..6103694a6 100644 --- a/x/tokenomics/keeper/keeper_test.go +++ b/x/tokenomics/keeper/keeper_test.go @@ -60,7 +60,7 @@ func (s *TestSuite) SetupTest() { Service: &sharedtypes.Service{Id: testServiceId}, SessionId: "session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, RootHash: smstRootWithSum(69), } diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go index 2990f89d1..9329a3b79 100644 --- a/x/tokenomics/keeper/msg_server_test.go +++ b/x/tokenomics/keeper/msg_server_test.go @@ -14,7 +14,7 @@ import ( func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { t.Helper() - k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + k, ctx, _, _ := testkeeper.TokenomicsKeeperWithActorAddrs(t) return k, keeper.NewMsgServerImpl(k), ctx } diff --git a/x/tokenomics/keeper/msg_update_params_test.go b/x/tokenomics/keeper/msg_update_params_test.go index c1b53c902..71f3f1436 100644 --- a/x/tokenomics/keeper/msg_update_params_test.go +++ b/x/tokenomics/keeper/msg_update_params_test.go @@ -92,7 +92,7 @@ func TestMsgUpdateParams(t *testing.T) { } func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { - tokenomicsKeeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + tokenomicsKeeper, ctx, _, _ := testkeeper.TokenomicsKeeperWithActorAddrs(t) srv := keeper.NewMsgServerImpl(tokenomicsKeeper) // Set the default params diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go index 9d4daf427..34381a7f3 100644 --- a/x/tokenomics/keeper/query_params_test.go +++ b/x/tokenomics/keeper/query_params_test.go @@ -10,7 +10,7 @@ import ( ) func TestGetParams(t *testing.T) { - k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + k, ctx, _, _ := testkeeper.TokenomicsKeeperWithActorAddrs(t) // TODO_INVESTIGATE(#394): Params tests don't assert initial state. params := types.DefaultParams() @@ -20,7 +20,7 @@ func TestGetParams(t *testing.T) { } func TestParamsQuery(t *testing.T) { - keeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + keeper, ctx, _, _ := testkeeper.TokenomicsKeeperWithActorAddrs(t) params := types.DefaultParams() require.NoError(t, keeper.SetParams(ctx, params)) diff --git a/x/tokenomics/keeper/query_relay_mining_difficulty.go b/x/tokenomics/keeper/query_relay_mining_difficulty.go new file mode 100644 index 000000000..6b7b2f36d --- /dev/null +++ b/x/tokenomics/keeper/query_relay_mining_difficulty.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var relayMiningDifficulties []types.RelayMiningDifficulty + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + relayMiningDifficultyStore := prefix.NewStore(store, types.KeyPrefix(types.RelayMiningDifficultyKeyPrefix)) + + pageRes, err := query.Paginate(relayMiningDifficultyStore, req.Pagination, func(key []byte, value []byte) error { + var relayMiningDifficulty types.RelayMiningDifficulty + if err := k.cdc.Unmarshal(value, &relayMiningDifficulty); err != nil { + return err + } + + relayMiningDifficulties = append(relayMiningDifficulties, relayMiningDifficulty) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllRelayMiningDifficultyResponse{RelayMiningDifficulty: relayMiningDifficulties, Pagination: pageRes}, nil +} + +func (k Keeper) RelayMiningDifficulty(ctx context.Context, req *types.QueryGetRelayMiningDifficultyRequest) (*types.QueryGetRelayMiningDifficultyResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + difficulty, found := k.GetRelayMiningDifficulty( + ctx, + req.ServiceId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetRelayMiningDifficultyResponse{RelayMiningDifficulty: difficulty}, nil +} diff --git a/x/tokenomics/keeper/query_relay_mining_difficulty_test.go b/x/tokenomics/keeper/query_relay_mining_difficulty_test.go new file mode 100644 index 000000000..7146cfdb3 --- /dev/null +++ b/x/tokenomics/keeper/query_relay_mining_difficulty_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestRelayMiningDifficultyQuerySingle(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + msgs := createNRelayMiningDifficulty(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetRelayMiningDifficultyRequest + response *types.QueryGetRelayMiningDifficultyResponse + expectedErr error + }{ + { + desc: "First", + request: &types.QueryGetRelayMiningDifficultyRequest{ + ServiceId: msgs[0].ServiceId, + }, + response: &types.QueryGetRelayMiningDifficultyResponse{RelayMiningDifficulty: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetRelayMiningDifficultyRequest{ + ServiceId: msgs[1].ServiceId, + }, + response: &types.QueryGetRelayMiningDifficultyResponse{RelayMiningDifficulty: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetRelayMiningDifficultyRequest{ + ServiceId: strconv.Itoa(100000), + }, + expectedErr: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.RelayMiningDifficulty(ctx, tc.request) + if tc.expectedErr != nil { + require.ErrorIs(t, err, tc.expectedErr) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestRelayMiningDifficultyQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + msgs := createNRelayMiningDifficulty(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllRelayMiningDifficultyRequest { + return &types.QueryAllRelayMiningDifficultyRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.RelayMiningDifficultyAll(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RelayMiningDifficulty), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RelayMiningDifficulty), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.RelayMiningDifficultyAll(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RelayMiningDifficulty), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RelayMiningDifficulty), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.RelayMiningDifficultyAll(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.RelayMiningDifficulty), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.RelayMiningDifficultyAll(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/tokenomics/keeper/relay_mining_difficulty.go b/x/tokenomics/keeper/relay_mining_difficulty.go new file mode 100644 index 000000000..efb9210bd --- /dev/null +++ b/x/tokenomics/keeper/relay_mining_difficulty.go @@ -0,0 +1,83 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// SetRelayMiningDifficulty set a specific relayMiningDifficulty in the store from its index +func (k Keeper) SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty types.RelayMiningDifficulty) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.RelayMiningDifficultyKeyPrefix)) + difficultyBz := k.cdc.MustMarshal(&relayMiningDifficulty) + store.Set(types.RelayMiningDifficultyKey( + relayMiningDifficulty.ServiceId, + ), difficultyBz) +} + +// GetRelayMiningDifficulty returns a relayMiningDifficulty from its index +func (k Keeper) GetRelayMiningDifficulty( + ctx context.Context, + serviceId string, + +) (difficulty types.RelayMiningDifficulty, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.RelayMiningDifficultyKeyPrefix)) + + difficultyBz := store.Get(types.RelayMiningDifficultyKey( + serviceId, + )) + if difficultyBz == nil { + difficulty.ServiceId = serviceId + return difficulty, false + } + + k.cdc.MustUnmarshal(difficultyBz, &difficulty) + return difficulty, true +} + +// RemoveRelayMiningDifficulty removes a relayMiningDifficulty from the store +func (k Keeper) RemoveRelayMiningDifficulty( + ctx context.Context, + serviceId string, +) { + logger := k.Logger().With("method", "RemoveRelayMiningDifficulty") + + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.RelayMiningDifficultyKeyPrefix)) + difficultyKey := types.RelayMiningDifficultyKey( + serviceId, + ) + + if !store.Has(difficultyKey) { + logger.Warn(fmt.Sprintf("trying to delete a non-existing relayMiningDifficulty for service: %s", serviceId)) + return + } + + store.Delete(types.RelayMiningDifficultyKey( + serviceId, + )) +} + +// GetAllRelayMiningDifficulty returns all relayMiningDifficulty +func (k Keeper) GetAllRelayMiningDifficulty(ctx context.Context) (list []types.RelayMiningDifficulty) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.RelayMiningDifficultyKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.RelayMiningDifficulty + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/tokenomics/keeper/relay_mining_difficulty_test.go b/x/tokenomics/keeper/relay_mining_difficulty_test.go new file mode 100644 index 000000000..3644fe4c8 --- /dev/null +++ b/x/tokenomics/keeper/relay_mining_difficulty_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "context" + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNRelayMiningDifficulty(keeper keeper.Keeper, ctx context.Context, n int) []types.RelayMiningDifficulty { + difficulties := make([]types.RelayMiningDifficulty, n) + for idx := range difficulties { + difficulties[idx].ServiceId = strconv.Itoa(idx) + + keeper.SetRelayMiningDifficulty(ctx, difficulties[idx]) + } + return difficulties +} + +func TestRelayMiningDifficultyGet(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) + for _, difficulty := range difficulties { + rst, found := keeper.GetRelayMiningDifficulty(ctx, + difficulty.ServiceId, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&difficulty), + nullify.Fill(&rst), + ) + } +} +func TestRelayMiningDifficultyRemove(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) + for _, difficulty := range difficulties { + keeper.RemoveRelayMiningDifficulty(ctx, + difficulty.ServiceId, + ) + _, found := keeper.GetRelayMiningDifficulty(ctx, + difficulty.ServiceId, + ) + require.False(t, found) + } +} + +func TestRelayMiningDifficultyGetAll(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(difficulties), + nullify.Fill(keeper.GetAllRelayMiningDifficulty(ctx)), + ) +} diff --git a/x/tokenomics/keeper/settle_session_accounting_test.go b/x/tokenomics/keeper/settle_session_accounting_test.go index bf5f7142f..e1f65471b 100644 --- a/x/tokenomics/keeper/settle_session_accounting_test.go +++ b/x/tokenomics/keeper/settle_session_accounting_test.go @@ -52,7 +52,7 @@ func TestSettleSessionAccounting_HandleAppGoingIntoDebt(t *testing.T) { }, SessionId: "session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, RootHash: smstRootWithSum(appStake.Amount.Uint64() + 1), // More than the app stake } @@ -80,7 +80,7 @@ func TestSettleSessionAccounting_AppStakeTooLow(t *testing.T) { } func TestSettleSessionAccounting_AppNotFound(t *testing.T) { - keeper, ctx, _, supplierAddr := testkeeper.TokenomicsKeeper(t) + keeper, ctx, _, supplierAddr := testkeeper.TokenomicsKeeperWithActorAddrs(t) // The base claim whose root will be customized for testing purposes claim := prooftypes.Claim{ @@ -93,7 +93,7 @@ func TestSettleSessionAccounting_AppNotFound(t *testing.T) { }, SessionId: "session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, RootHash: smstRootWithSum(42), } @@ -104,7 +104,7 @@ func TestSettleSessionAccounting_AppNotFound(t *testing.T) { } func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { - keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) + keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeperWithActorAddrs(t) // Define test cases tests := []struct { @@ -189,7 +189,7 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { } func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { - keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) + keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeperWithActorAddrs(t) // Define test cases tests := []struct { @@ -297,7 +297,7 @@ func baseClaim(appAddr, supplierAddr string, sum uint64) prooftypes.Claim { }, SessionId: "session_id", SessionStartBlockHeight: 1, - SessionEndBlockHeight: shared.GetDefaultSessionEndHeight(1), + SessionEndBlockHeight: shared.GetSessionEndHeightWithDefaultParams(1), }, RootHash: smstRootWithSum(sum), } diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty.go b/x/tokenomics/keeper/update_relay_mining_difficulty.go new file mode 100644 index 000000000..07ca79319 --- /dev/null +++ b/x/tokenomics/keeper/update_relay_mining_difficulty.go @@ -0,0 +1,153 @@ +package keeper + +import ( + "context" + "fmt" + "math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + proofkeeper "github.com/pokt-network/poktroll/x/proof/keeper" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +const ( + // Exponential moving average (ema) smoothing factor, commonly known as alpha. + // Usually, alpha = 2 / (N+1), where N is the number of periods. + // Large alpha -> more weight on recent data; less smoothing and fast response. + // Small alpha -> more weight on past data; more smoothing and slow response. + emaSmoothingFactor = float64(0.1) + + // The target number of relays we want the network to mine for a specific + // service across all applications & suppliers per session. + // This number determines the total number of leafs to be created across in + // the off-chain SMTs, across all suppliers, for each service. + // It indirectly drives the off-chain resource requirements of the network + // in additional to playing a critical role in Relay Mining. + // TODO_UPNEXT(#542, @Olshansk): Make this a governance parameter. + TargetNumRelays = uint64(10e4) +) + +// UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty +// based on the amount of on-chain relays for each service, given a map of serviceId->numRelays. +func (k Keeper) UpdateRelayMiningDifficulty( + ctx context.Context, + relaysPerServiceMap map[string]uint64, +) error { + logger := k.Logger().With("method", "UpdateRelayMiningDifficulty") + sdkCtx := sdk.UnwrapSDKContext(ctx) + + for serviceId, numRelays := range relaysPerServiceMap { + prevDifficulty, found := k.GetRelayMiningDifficulty(ctx, serviceId) + if !found { + types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf("No previous relay mining difficulty found for service %s. Initializing with default difficulty %v", serviceId, prevDifficulty.TargetHash) + // If a previous difficulty for the service is not found, we initialize + // it with a default. + prevDifficulty = types.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: sdkCtx.BlockHeight(), + NumRelaysEma: numRelays, + TargetHash: defaultDifficultyTargetHash(), + } + } + + // TODO_CONSIDERATION: We could potentially compute the smoothing factor + // using a common formula, such as alpha = 2 / (N+1), where N is the number + // of periods. + // N := ctx.BlockHeight() - prevDifficulty.BlockHeight + // alpha := 2 / (1 + N) + alpha := emaSmoothingFactor + + // Compute the updated EMA of the number of relays. + prevRelaysEma := prevDifficulty.NumRelaysEma + newRelaysEma := computeEma(alpha, prevRelaysEma, numRelays) + difficultyHash := ComputeNewDifficultyTargetHash(TargetNumRelays, newRelaysEma) + newDifficulty := types.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: sdkCtx.BlockHeight(), + NumRelaysEma: newRelaysEma, + TargetHash: difficultyHash, + } + k.SetRelayMiningDifficulty(ctx, newDifficulty) + + // TODO_UPNEXT(#542, @Olshansk): Emit an event for the updated difficulty. + logger.Info(fmt.Sprintf("Updated relay mining difficulty for service %s at height %d from %v to %v", serviceId, sdkCtx.BlockHeight(), prevDifficulty.TargetHash, newDifficulty.TargetHash)) + + } + return nil +} + +// ComputeNewDifficultyTargetHash computes the new difficulty target hash based +// on the target number of relays we want the network to mine and the new EMA of +// the number of relays. +// NB: Exported for testing purposes only. +func ComputeNewDifficultyTargetHash(targetNumRelays, newRelaysEma uint64) []byte { + // The target number of relays we want the network to mine is greater than + // the actual on-chain relays, so we don't need to scale to anything above + // the default. + if targetNumRelays > newRelaysEma { + return defaultDifficultyTargetHash() + } + + log2 := func(x float64) float64 { + return math.Log(x) / math.Ln2 + } + + // We are dealing with a bitwise binary distribution, and are trying to convert + // the proportion of an off-chain relay (i.e. relayEMA) to an + // on-chain relay (i.e. target) based on the probability of x leading zeros + // in the target hash. + // + // In other words, the probability of an off-chain relay moving into the tree + // should equal (approximately) the probability of having x leading zeroes + // in the target hash. + // + // The construction is as follows: + // (0.5)^num_leading_zeroes = (num_target_relay / num_total_relays) + // (0.5)^x = (T/R) + // x = -ln2(T/R) + numLeadingZeroBits := int(-log2(float64(targetNumRelays) / float64(newRelaysEma))) + numBytes := proofkeeper.SmtSpec.PathHasherSize() + return LeadingZeroBitsToTargetDifficultyHash(numLeadingZeroBits, numBytes) +} + +// defaultDifficultyTargetHash returns the default difficulty target hash with +// the default number of leading zero bits. +func defaultDifficultyTargetHash() []byte { + numBytes := proofkeeper.SmtSpec.PathHasherSize() + numDefaultLeadingZeroBits := int(prooftypes.DefaultMinRelayDifficultyBits) + return LeadingZeroBitsToTargetDifficultyHash(numDefaultLeadingZeroBits, numBytes) +} + +// computeEma computes the EMA at time t, given the EMA at time t-1, the raw +// data revealed at time t, and the smoothing factor α. +// Src: https://en.wikipedia.org/wiki/Exponential_smoothing +func computeEma(alpha float64, prevEma, currValue uint64) uint64 { + return uint64(alpha*float64(currValue) + (1-alpha)*float64(prevEma)) +} + +// LeadingZeroBitsToTargetDifficultyHash generates a slice of bytes with the specified number of leading zero bits +// NB: Exported for testing purposes only. +func LeadingZeroBitsToTargetDifficultyHash(numLeadingZeroBits int, numBytes int) []byte { + targetDifficultyHah := make([]byte, numBytes) + + // Set everything to 1s initially + for i := range targetDifficultyHah { + targetDifficultyHah[i] = 0xff + } + + // Set full zero bytes + fullZeroBytes := numLeadingZeroBits / 8 + for i := 0; i < fullZeroBytes; i++ { + targetDifficultyHah[i] = 0 + } + + // Set remaining bits in the next byte + remainingZeroBits := numLeadingZeroBits % 8 + if remainingZeroBits > 0 { + targetDifficultyHah[fullZeroBytes] = byte(0xff >> remainingZeroBits) + } + + return targetDifficultyHah +} diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty_test.go b/x/tokenomics/keeper/update_relay_mining_difficulty_test.go new file mode 100644 index 000000000..1c89e2b74 --- /dev/null +++ b/x/tokenomics/keeper/update_relay_mining_difficulty_test.go @@ -0,0 +1,288 @@ +package keeper_test + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + tokenomicskeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func TestUpdateRelayMiningDifficulty_General(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + + // Introduce svc1 for the first time + relaysPerServiceMap := map[string]uint64{ + "svc1": 1e3, // new service + } + err := keeper.UpdateRelayMiningDifficulty(ctx, relaysPerServiceMap) + require.NoError(t, err) + + // The first time svc1 difficulty is updated, the relay EMA will be equal + // to the first value provided. + difficultySvc11, found := keeper.GetRelayMiningDifficulty(ctx, "svc1") + require.True(t, found) + require.Equal(t, uint64(1e3), difficultySvc11.NumRelaysEma) + + // Update svc1 and introduce svc2 for the first time + relaysPerServiceMap = map[string]uint64{ + "svc1": 1e10, // higher than the first value above + "svc2": 1e5, // new service + } + err = keeper.UpdateRelayMiningDifficulty(ctx, relaysPerServiceMap) + require.NoError(t, err) + + difficultySvc12, found := keeper.GetRelayMiningDifficulty(ctx, "svc1") + require.True(t, found) + // Verify that the svc1 relay ema is strictly higher than the first value + // above, but strictly lower than the second value because of the rolling average. + require.Greater(t, difficultySvc12.NumRelaysEma, difficultySvc11.NumRelaysEma) + require.Less(t, difficultySvc12.NumRelaysEma, uint64(1e10)) + // Because the number of relays went up, there are more leading zeroes in the + // target hash, so the number is lower than it was before. + require.Less(t, difficultySvc12.TargetHash, difficultySvc11.TargetHash) + + // The first time svc2 difficulty is updated, so the num relays ema is + // equal to the first value provided. + difficultySvc21, found := keeper.GetRelayMiningDifficulty(ctx, "svc2") + require.True(t, found) + require.Equal(t, uint64(1e5), difficultySvc21.NumRelaysEma) + + // Update svc1 and svc2 and introduce svc3 for the first time + relaysPerServiceMap = map[string]uint64{ + "svc1": 1e12, // higher than the second value above + "svc2": 1e2, // lower than the first value above + "svc3": 1e10, // new service + } + err = keeper.UpdateRelayMiningDifficulty(ctx, relaysPerServiceMap) + require.NoError(t, err) + + // svc1 relays went up so the target hash is now a smaller number (more leading zeroes) + // because the difficulty is higher. + difficultySvc13, found := keeper.GetRelayMiningDifficulty(ctx, "svc1") + require.True(t, found) + require.Greater(t, difficultySvc13.NumRelaysEma, difficultySvc12.NumRelaysEma) + require.Less(t, difficultySvc13.TargetHash, difficultySvc12.TargetHash) + + // svc2 relay ema went down so the target hash is now a larger number (less leading zeroes) + difficultySvc22, found := keeper.GetRelayMiningDifficulty(ctx, "svc2") + require.True(t, found) + require.Less(t, difficultySvc22.NumRelaysEma, difficultySvc21.NumRelaysEma) + // Since the relays EMA is lower than the target, the difficulty hash is all 1s + require.Less(t, difficultySvc22.NumRelaysEma, tokenomicskeeper.TargetNumRelays) + require.Equal(t, difficultySvc22.TargetHash, makeBytesFullOfOnes(32)) + + // svc3 is new so the relay ema is equal to the first value provided + difficultySvc31, found := keeper.GetRelayMiningDifficulty(ctx, "svc3") + require.True(t, found) + require.Equal(t, uint64(1e10), difficultySvc31.NumRelaysEma) +} + +func TestUpdateRelayMiningDifficulty_FirstDifficulty(t *testing.T) { + tests := []struct { + desc string + numRelays uint64 + expectedRelayMiningDifficulty types.RelayMiningDifficulty + }{ + { + desc: "First Difficulty way below target", + numRelays: keeper.TargetNumRelays / 1e3, + expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + ServiceId: "svc1", + BlockHeight: 1, + NumRelaysEma: keeper.TargetNumRelays / 1e3, + TargetHash: defaultDifficulty(), // default difficulty without any leading 0 bits + }, + }, { + desc: "First Difficulty equal to target", + numRelays: keeper.TargetNumRelays, + expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + ServiceId: "svc1", + BlockHeight: 1, + NumRelaysEma: keeper.TargetNumRelays, + TargetHash: defaultDifficulty(), // default difficulty without any leading 0 bits + }, + }, { + desc: "First Difficulty way above target", + numRelays: keeper.TargetNumRelays * 1e3, + expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + ServiceId: "svc1", + BlockHeight: 1, + NumRelaysEma: keeper.TargetNumRelays * 1e3, + TargetHash: append( + []byte{0b00000000, 0b01111111}, // 9 leading 0 bits + makeBytesFullOfOnes(30)..., + ), + }, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + keeper, ctx := keepertest.TokenomicsKeeper(t) + relaysPerServiceMap := map[string]uint64{ + "svc1": tt.numRelays, + } + err := keeper.UpdateRelayMiningDifficulty(ctx, relaysPerServiceMap) + require.NoError(t, err) + + difficulty, found := keeper.GetRelayMiningDifficulty(ctx, "svc1") + require.True(t, found) + + require.Equal(t, difficulty.NumRelaysEma, tt.numRelays) + require.Equal(t, difficulty.NumRelaysEma, tt.expectedRelayMiningDifficulty.NumRelaysEma) + + require.Equal(t, difficulty.TargetHash, tt.expectedRelayMiningDifficulty.TargetHash) + }) + } +} + +func TestComputeNewDifficultyHash(t *testing.T) { + tests := []struct { + desc string + numRelaysTarget uint64 + relaysEma uint64 + expectedDifficultyHash []byte + }{ + { + desc: "Relays Target > Relays EMA", + numRelaysTarget: 100, + relaysEma: 50, + expectedDifficultyHash: defaultDifficulty(), + }, + { + desc: "Relays Target == Relays EMA", + numRelaysTarget: 100, + relaysEma: 100, + expectedDifficultyHash: defaultDifficulty(), + }, + { + desc: "Relays Target < Relays EMA", + numRelaysTarget: 50, + relaysEma: 100, + expectedDifficultyHash: append( + []byte{0b01111111}, + makeBytesFullOfOnes(31)..., + ), + }, + { + desc: "Relays Target << Relays EMA", + numRelaysTarget: 50, + relaysEma: 200, + expectedDifficultyHash: append( + []byte{0b00111111}, + makeBytesFullOfOnes(31)..., + ), + }, + { + desc: "Relays Target << Relays EMA", + numRelaysTarget: 50, + relaysEma: 1000, + expectedDifficultyHash: append( + []byte{0b00001111}, + makeBytesFullOfOnes(31)..., + ), + }, + { + desc: "Relays Target << Relays EMA", + numRelaysTarget: 50, + relaysEma: 10000, + expectedDifficultyHash: append( + []byte{0b00000001}, + makeBytesFullOfOnes(31)..., + ), + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + result := keeper.ComputeNewDifficultyTargetHash(tt.numRelaysTarget, tt.relaysEma) + require.Equal(t, result, tt.expectedDifficultyHash) + }) + } +} + +func TestLeadingZeroBitsToTargetDifficultyHash(t *testing.T) { + tests := []struct { + desc string + numLeadingZeroBits int + numBytes int + expectedDifficultyHash []byte + }{ + { + desc: "0 leading 0 bits in 1 byte", + numLeadingZeroBits: 0, + numBytes: 1, + expectedDifficultyHash: []byte{0b11111111}, + }, + { + desc: "full zero bytes (16 leading 0 bits in 32 bytes)", + numLeadingZeroBits: 16, + numBytes: 32, + expectedDifficultyHash: append( + []byte{0b00000000, 0b00000000}, + makeBytesFullOfOnes(30)..., + ), + }, + { + desc: "partial byte (20 leading 0 bits in 32 bytes)", + numLeadingZeroBits: 20, + numBytes: 32, + expectedDifficultyHash: append( + []byte{0b00000000, 0b00000000, 0b00001111}, + makeBytesFullOfOnes(29)..., + ), + }, + { + desc: "another partial byte (10 leading 0 bits in 32 bytes)", + numLeadingZeroBits: 10, + numBytes: 32, + expectedDifficultyHash: append( + []byte{0b00000000, 0b00111111}, + makeBytesFullOfOnes(30)..., + ), + }, + { + desc: "edge case 1 bit (1 leading 0 bits in 32 bytes)", + numLeadingZeroBits: 1, + numBytes: 32, + expectedDifficultyHash: append( + []byte{0b01111111}, + makeBytesFullOfOnes(31)..., + ), + }, + { + desc: "exact byte boundary (24 leading 0 bits in 32 bytes)", + numLeadingZeroBits: 24, + numBytes: 32, + expectedDifficultyHash: append( + []byte{0b00000000, 0b00000000, 0b00000000}, + makeBytesFullOfOnes(29)..., + ), + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + result := keeper.LeadingZeroBitsToTargetDifficultyHash(tt.numLeadingZeroBits, tt.numBytes) + if !bytes.Equal(result, tt.expectedDifficultyHash) { + t.Errorf("got %x, expected %x", result, tt.expectedDifficultyHash) + } + }) + } +} + +func makeBytesFullOfOnes(length int) []byte { + result := make([]byte, length) + for i := range result { + result[i] = 0b11111111 + } + return result +} + +func defaultDifficulty() []byte { + return makeBytesFullOfOnes(32) +} diff --git a/x/tokenomics/module/autocli.go b/x/tokenomics/module/autocli.go index e246b275d..758d76ed4 100644 --- a/x/tokenomics/module/autocli.go +++ b/x/tokenomics/module/autocli.go @@ -10,7 +10,7 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ // { // RpcMethod: "Params", @@ -21,6 +21,17 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Example: // $ poktrolld q tokenomics params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, // }, + { + RpcMethod: "RelayMiningDifficultyAll", + Use: "list-relay-mining-difficulty", + Short: "List all relay-mining-difficulty", + }, + { + RpcMethod: "RelayMiningDifficulty", + Use: "show-relay-mining-difficulty [id]", + Short: "Shows a relay-mining-difficulty", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "serviceId"}}, + }, // this line is used by ignite scaffolding # autocli/query }, }, diff --git a/x/tokenomics/module/genesis.go b/x/tokenomics/module/genesis.go index c877263d1..e4e09b61d 100644 --- a/x/tokenomics/module/genesis.go +++ b/x/tokenomics/module/genesis.go @@ -9,6 +9,10 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the relayMiningDifficulty + for _, difficulty := range genState.RelayMiningDifficultyList { + k.SetRelayMiningDifficulty(ctx, difficulty) + } // this line is used by starport scaffolding # genesis/module/init if err := k.SetParams(ctx, genState.Params); err != nil { panic(err) @@ -20,6 +24,7 @@ func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) + genesis.RelayMiningDifficultyList = k.GetAllRelayMiningDifficulty(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/tokenomics/module/genesis_test.go b/x/tokenomics/module/genesis_test.go index 60f0b969f..ebe89fa4e 100644 --- a/x/tokenomics/module/genesis_test.go +++ b/x/tokenomics/module/genesis_test.go @@ -15,10 +15,18 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } - k, ctx, _, _ := keepertest.TokenomicsKeeper(t) + k, ctx, _, _ := keepertest.TokenomicsKeeperWithActorAddrs(t) tokenomics.InitGenesis(ctx, k, genesisState) got := tokenomics.ExportGenesis(ctx, k) require.NotNil(t, got) @@ -26,5 +34,6 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) + require.ElementsMatch(t, genesisState.RelayMiningDifficultyList, got.RelayMiningDifficultyList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/tokenomics/module/module.go b/x/tokenomics/module/module.go index 46b88cc52..95b7bb152 100644 --- a/x/tokenomics/module/module.go +++ b/x/tokenomics/module/module.go @@ -3,7 +3,6 @@ package tokenomics import ( "context" "encoding/json" - "fmt" // this line is used by starport scaffolding # 1 @@ -75,7 +74,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + return types.ErrTokenomicsUnmarshalInvalid.Wrapf("invalid genesis state: %v", err) } return genState.Validate() } diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 2f5a8bbc9..d2f45037c 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -6,20 +6,23 @@ import sdkerrors "cosmossdk.io/errors" // x/tokenomics module sentinel errors var ( - ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "the provided authority address does not match the on-chain governance address") - ErrTokenomicsAddressInvalid = sdkerrors.Register(ModuleName, 1101, "the provided authority address is not a valid bech32 address") - ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1102, "provided claim is nil") - ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1103, "provided claim's session header is nil") - ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1104, "provided claim's session header is invalid") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1105, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 1106, "failed to send uPOKT from supplier module account to supplier") - ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 1107, "the supplier address in the claim is not a valid bech32 address") - ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1108, "application not found") - ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1109, "failed to burn uPOKT from application module account") - ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1112, "the application address in the claim is not a valid bech32 address") - ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1113, "provided params are invalid") - ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1114, "the root hash in the claim is invalid") - ErrTokenomicsApplicationNewStakeInvalid = sdkerrors.Register(ModuleName, 1115, "application stake cannot be reduced to a -ve amount") - ErrTokenomicsParamNameInvalid = sdkerrors.Register(ModuleName, 1116, "the provided param name is invalid") - ErrTokenomicsParamInvalid = sdkerrors.Register(ModuleName, 1117, "the provided param is invalid") + ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "the provided authority address does not match the on-chain governance address") + ErrTokenomicsAddressInvalid = sdkerrors.Register(ModuleName, 1101, "the provided authority address is not a valid bech32 address") + ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1102, "provided claim is nil") + ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1103, "provided claim's session header is nil") + ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1104, "provided claim's session header is invalid") + ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1105, "failed to mint uPOKT to supplier module account") + ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 1106, "failed to send uPOKT from supplier module account to supplier") + ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 1107, "the supplier address in the claim is not a valid bech32 address") + ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1108, "application not found") + ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1109, "failed to burn uPOKT from application module account") + ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1112, "the application address in the claim is not a valid bech32 address") + ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1113, "provided params are invalid") + ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1114, "the root hash in the claim is invalid") + ErrTokenomicsApplicationNewStakeInvalid = sdkerrors.Register(ModuleName, 1115, "application stake cannot be reduced to a -ve amount") + ErrTokenomicsParamNameInvalid = sdkerrors.Register(ModuleName, 1116, "the provided param name is invalid") + ErrTokenomicsParamInvalid = sdkerrors.Register(ModuleName, 1117, "the provided param is invalid") + ErrTokenomicsUnmarshalInvalid = sdkerrors.Register(ModuleName, 1118, "failed to unmarshal the provided bytes") + ErrTokenomicsDuplicateIndex = sdkerrors.Register(ModuleName, 1119, "cannot have a duplicate index") + ErrTokenomicsMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1120, "missing relay mining difficulty") ) diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go index 60d614ce4..2d38fc760 100644 --- a/x/tokenomics/types/genesis.go +++ b/x/tokenomics/types/genesis.go @@ -1,10 +1,9 @@ package types -// this line is used by starport scaffolding # genesis/types/import - // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ + RelayMiningDifficultyList: []RelayMiningDifficulty{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -13,6 +12,16 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { + // Check for duplicated index in relayMiningDifficulty + relayMiningDifficultyIndexMap := make(map[string]struct{}) + + for _, elem := range gs.RelayMiningDifficultyList { + index := string(RelayMiningDifficultyKey(elem.ServiceId)) + if _, ok := relayMiningDifficultyIndexMap[index]; ok { + return ErrTokenomicsDuplicateIndex.Wrapf("duplicated index for relayMiningDifficulty: %s", index) + } + relayMiningDifficultyIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.ValidateBasic() diff --git a/x/tokenomics/types/genesis.pb.go b/x/tokenomics/types/genesis.pb.go index dc98580aa..f7a21c331 100644 --- a/x/tokenomics/types/genesis.pb.go +++ b/x/tokenomics/types/genesis.pb.go @@ -27,7 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the tokenomics module's genesis state. type GenesisState struct { // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + RelayMiningDifficultyList []RelayMiningDifficulty `protobuf:"bytes,2,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -70,6 +71,13 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetRelayMiningDifficultyList() []RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficultyList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "poktroll.tokenomics.GenesisState") } @@ -77,21 +85,25 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/genesis.proto", fileDescriptor_a4de321d172b0811) } var fileDescriptor_a4de321d172b0811 = []byte{ - // 216 bytes of a gzipped FileDescriptorProto + // 285 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0xcb, 0xcf, 0xcd, 0x4c, 0x2e, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x29, 0xd1, 0x43, 0x28, 0x91, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x75, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x15, 0x55, 0xc0, 0x66, 0x41, - 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x7c, 0x25, 0x3f, 0x2e, 0x1e, 0x77, 0x88, 0x85, 0xc1, 0x25, - 0x89, 0x25, 0xa9, 0x42, 0x76, 0x5c, 0x6c, 0x10, 0x79, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, - 0x69, 0x3d, 0x2c, 0x0e, 0xd0, 0x0b, 0x00, 0x2b, 0x71, 0xe2, 0x3c, 0x71, 0x4f, 0x9e, 0x61, 0xc5, - 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x5d, 0x4e, 0xbe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, - 0x2c, 0xc7, 0x10, 0x65, 0x9c, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, - 0x32, 0x53, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0xee, 0xc6, 0x0a, 0x64, 0x57, - 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x5d, 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0xd5, 0xe3, 0x60, 0x8d, 0x2a, 0x01, 0x00, 0x00, + 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x7c, 0x29, 0x43, 0x6c, 0x2a, 0x8a, 0x52, 0x73, 0x12, 0x2b, + 0xe3, 0x73, 0x33, 0xf3, 0x32, 0xf3, 0xd2, 0xe3, 0x53, 0x32, 0xd3, 0xd2, 0x32, 0x93, 0x4b, 0x73, + 0x4a, 0x2a, 0x21, 0x5a, 0x94, 0xf6, 0x31, 0x72, 0xf1, 0xb8, 0x43, 0x1c, 0x19, 0x5c, 0x92, 0x58, + 0x92, 0x2a, 0x64, 0xc7, 0xc5, 0x06, 0x31, 0x53, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x5a, + 0x0f, 0x8b, 0xa3, 0xf5, 0x02, 0xc0, 0x4a, 0x9c, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, 0xf1, 0x7c, + 0x83, 0x16, 0x63, 0x10, 0x54, 0x97, 0x50, 0x1e, 0x97, 0x24, 0xd8, 0x46, 0x5f, 0xb0, 0x85, 0x2e, + 0x70, 0xfb, 0x7c, 0x32, 0x8b, 0x4b, 0x24, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0xb4, 0xb0, 0x1a, + 0x19, 0x84, 0x4d, 0x97, 0x13, 0x0b, 0xc8, 0x86, 0x20, 0xdc, 0x46, 0x3a, 0xf9, 0x9e, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x71, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x42, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x78, + 0x28, 0x55, 0x20, 0x87, 0x53, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x58, 0x8c, 0x01, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xe8, 0x52, 0xb6, 0xce, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -114,6 +126,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RelayMiningDifficultyList) > 0 { + for iNdEx := len(m.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RelayMiningDifficultyList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -146,6 +172,12 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.RelayMiningDifficultyList) > 0 { + for _, e := range m.RelayMiningDifficultyList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -217,6 +249,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RelayMiningDifficultyList = append(m.RelayMiningDifficultyList, RelayMiningDifficulty{}) + if err := m.RelayMiningDifficultyList[len(m.RelayMiningDifficultyList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go index 5994a3b52..4c8d30f84 100644 --- a/x/tokenomics/types/genesis_test.go +++ b/x/tokenomics/types/genesis_test.go @@ -3,8 +3,9 @@ package types_test import ( "testing" - "github.com/pokt-network/poktroll/x/tokenomics/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/tokenomics/types" ) func TestGenesisState_Validate(t *testing.T) { @@ -24,6 +25,14 @@ func TestGenesisState_Validate(t *testing.T) { Params: types.Params{ ComputeUnitsToTokensMultiplier: 1, }, + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "1", + }, + }, // this line is used by starport scaffolding # types/genesis/validField }, isValid: true, @@ -38,6 +47,20 @@ func TestGenesisState_Validate(t *testing.T) { }, isValid: false, }, + { + desc: "duplicated relayMiningDifficulty", + genState: &types.GenesisState{ + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "0", + }, + }, + }, + isValid: false, + }, // this line is used by starport scaffolding # types/genesis/testcase } for _, test := range tests { diff --git a/x/tokenomics/types/key_relay_mining_difficulty.go b/x/tokenomics/types/key_relay_mining_difficulty.go new file mode 100644 index 000000000..ca7626471 --- /dev/null +++ b/x/tokenomics/types/key_relay_mining_difficulty.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RelayMiningDifficultyKeyPrefix is the prefix to retrieve all RelayMiningDifficulty + RelayMiningDifficultyKeyPrefix = "RelayMiningDifficulty/value/" +) + +// RelayMiningDifficultyKey returns the store key to retrieve a RelayMiningDifficulty from the index fields +func RelayMiningDifficultyKey( + serviceId string, +) []byte { + var key []byte + + serviceIdBz := []byte(serviceId) + key = append(key, serviceIdBz...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/tokenomics/types/query.pb.go b/x/tokenomics/types/query.pb.go index 483412a0f..e83334bce 100644 --- a/x/tokenomics/types/query.pb.go +++ b/x/tokenomics/types/query.pb.go @@ -6,6 +6,9 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -113,34 +116,239 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +type QueryGetRelayMiningDifficultyRequest struct { + ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` +} + +func (m *QueryGetRelayMiningDifficultyRequest) Reset() { *m = QueryGetRelayMiningDifficultyRequest{} } +func (m *QueryGetRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} +func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_19d6daded0c54373, []int{2} +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.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 *QueryGetRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.Merge(m, src) +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRelayMiningDifficultyRequest proto.InternalMessageInfo + +func (m *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { + if m != nil { + return m.ServiceId + } + return "" +} + +type QueryGetRelayMiningDifficultyResponse struct { + RelayMiningDifficulty RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` +} + +func (m *QueryGetRelayMiningDifficultyResponse) Reset() { *m = QueryGetRelayMiningDifficultyResponse{} } +func (m *QueryGetRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} +func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_19d6daded0c54373, []int{3} +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.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 *QueryGetRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.Merge(m, src) +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRelayMiningDifficultyResponse proto.InternalMessageInfo + +func (m *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficulty + } + return RelayMiningDifficulty{} +} + +type QueryAllRelayMiningDifficultyRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRelayMiningDifficultyRequest) Reset() { *m = QueryAllRelayMiningDifficultyRequest{} } +func (m *QueryAllRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} +func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_19d6daded0c54373, []int{4} +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.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 *QueryAllRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.Merge(m, src) +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRelayMiningDifficultyRequest proto.InternalMessageInfo + +func (m *QueryAllRelayMiningDifficultyRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRelayMiningDifficultyResponse struct { + RelayMiningDifficulty []RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRelayMiningDifficultyResponse) Reset() { *m = QueryAllRelayMiningDifficultyResponse{} } +func (m *QueryAllRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} +func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_19d6daded0c54373, []int{5} +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.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 *QueryAllRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.Merge(m, src) +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRelayMiningDifficultyResponse proto.InternalMessageInfo + +func (m *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficulty + } + return nil +} + +func (m *QueryAllRelayMiningDifficultyResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "poktroll.tokenomics.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "poktroll.tokenomics.QueryParamsResponse") + proto.RegisterType((*QueryGetRelayMiningDifficultyRequest)(nil), "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest") + proto.RegisterType((*QueryGetRelayMiningDifficultyResponse)(nil), "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse") + proto.RegisterType((*QueryAllRelayMiningDifficultyRequest)(nil), "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest") + proto.RegisterType((*QueryAllRelayMiningDifficultyResponse)(nil), "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse") } func init() { proto.RegisterFile("poktroll/tokenomics/query.proto", fileDescriptor_19d6daded0c54373) } var fileDescriptor_19d6daded0c54373 = []byte{ - // 296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0xc8, 0xcf, 0x2e, - 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0xcb, 0xcf, 0xcd, 0x4c, 0x2e, 0xd6, - 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x29, 0xd0, - 0x43, 0x28, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x75, 0x52, 0x22, - 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x15, 0x95, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, - 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, - 0x2b, 0x86, 0xca, 0x2a, 0x60, 0xb3, 0xbc, 0x20, 0xb1, 0x28, 0x31, 0x17, 0xaa, 0x42, 0x49, 0x84, - 0x4b, 0x28, 0x10, 0xe4, 0x98, 0x00, 0xb0, 0x60, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x52, - 0x28, 0x97, 0x30, 0x8a, 0x68, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x1d, 0x17, 0x1b, 0x44, - 0xb3, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xb4, 0x1e, 0x16, 0xb7, 0xeb, 0x41, 0x34, 0x39, - 0x71, 0x9e, 0xb8, 0x27, 0xcf, 0xb0, 0xe2, 0xf9, 0x06, 0x2d, 0xc6, 0x20, 0xa8, 0x2e, 0xa3, 0xe9, - 0x8c, 0x5c, 0xac, 0x60, 0x73, 0x85, 0x7a, 0x19, 0xb9, 0xd8, 0x20, 0xea, 0x84, 0xd4, 0xb1, 0x1a, - 0x82, 0xe9, 0x28, 0x29, 0x0d, 0xc2, 0x0a, 0x21, 0xee, 0x54, 0x32, 0x68, 0xba, 0xfc, 0x64, 0x32, - 0x93, 0x96, 0x90, 0x86, 0x3e, 0x48, 0x87, 0x6e, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, - 0xee, 0xc0, 0x70, 0xf2, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xe3, - 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x1c, 0xa6, 0x55, 0x20, 0x9b, 0x57, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x5c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xe7, 0x8d, 0x14, 0xf2, 0xfd, 0x01, 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0xb3, 0xb5, 0x06, 0x32, 0x9e, 0x9c, 0xb6, 0x50, 0x63, 0xd9, 0x96, 0x45, 0x6d, 0x08, + 0xb8, 0x63, 0xda, 0x53, 0x15, 0x84, 0x84, 0x6a, 0xf0, 0x10, 0xa8, 0x0b, 0x5e, 0xbc, 0x84, 0xc9, + 0x76, 0xb2, 0x0e, 0xd9, 0x9d, 0xd9, 0xee, 0x4e, 0xaa, 0x41, 0xbc, 0x78, 0x17, 0x05, 0xbf, 0x84, + 0x47, 0x3f, 0x46, 0x4f, 0x52, 0xd0, 0x43, 0x2f, 0x8a, 0x24, 0x82, 0x5f, 0x43, 0x76, 0x66, 0xd2, + 0xa4, 0x38, 0x9b, 0x85, 0xd2, 0xcb, 0xb2, 0x3b, 0xf3, 0xde, 0xfb, 0xff, 0x7f, 0x6f, 0xde, 0x0e, + 0xd8, 0x8c, 0xf9, 0x40, 0x24, 0x3c, 0x0c, 0x91, 0xe0, 0x03, 0xc2, 0x78, 0x44, 0xfd, 0x14, 0x1d, + 0x0d, 0x49, 0x32, 0x72, 0xe3, 0x84, 0x0b, 0x0e, 0x57, 0xa6, 0x01, 0xee, 0x2c, 0xa0, 0x7a, 0x13, + 0x47, 0x94, 0x71, 0x24, 0x9f, 0x2a, 0xae, 0xba, 0x1a, 0xf0, 0x80, 0xcb, 0x57, 0x94, 0xbd, 0xe9, + 0xd5, 0x8d, 0x80, 0xf3, 0x20, 0x24, 0x08, 0xc7, 0x14, 0x61, 0xc6, 0xb8, 0xc0, 0x82, 0x72, 0x96, + 0xea, 0xdd, 0x5b, 0x3e, 0x4f, 0x23, 0x9e, 0x76, 0x55, 0x9a, 0xfa, 0xd0, 0x5b, 0x75, 0xf5, 0x85, + 0x7a, 0x38, 0x25, 0xca, 0x0f, 0x3a, 0x6e, 0xf4, 0x88, 0xc0, 0x0d, 0x14, 0xe3, 0x80, 0x32, 0x59, + 0x47, 0xc7, 0xda, 0xf3, 0xb1, 0xd3, 0x28, 0x9f, 0xd3, 0xe9, 0xfe, 0x96, 0x89, 0x31, 0xc6, 0x09, + 0x8e, 0xa6, 0x6a, 0x0d, 0x53, 0x44, 0x42, 0x42, 0x3c, 0xea, 0x46, 0x94, 0x51, 0x16, 0x74, 0x0f, + 0x69, 0xbf, 0x4f, 0xfd, 0x61, 0x28, 0x74, 0x5f, 0x9c, 0x55, 0x00, 0x9f, 0x67, 0xb6, 0x0e, 0x64, + 0x1d, 0x8f, 0x1c, 0x0d, 0x49, 0x2a, 0x9c, 0x17, 0x60, 0xe5, 0xc2, 0x6a, 0x1a, 0x73, 0x96, 0x12, + 0xf8, 0x18, 0x94, 0x95, 0xde, 0xba, 0xb5, 0x65, 0xd5, 0x6e, 0xec, 0xdc, 0x76, 0x0d, 0x5d, 0x75, + 0x55, 0x52, 0xab, 0x72, 0xf2, 0x6b, 0xb3, 0xf4, 0xe5, 0xef, 0xd7, 0xba, 0xe5, 0xe9, 0x2c, 0x67, + 0x1f, 0xdc, 0x91, 0x65, 0xdb, 0x44, 0x78, 0x99, 0xab, 0x8e, 0x34, 0xb5, 0x7f, 0xee, 0x49, 0xcb, + 0xc3, 0x0d, 0x50, 0x49, 0x49, 0x72, 0x4c, 0x7d, 0xf2, 0xec, 0x50, 0x4a, 0x55, 0xbc, 0xd9, 0x82, + 0xf3, 0xd1, 0x02, 0x77, 0x0b, 0xca, 0x68, 0xbf, 0x7d, 0xb0, 0x96, 0x98, 0x02, 0xb4, 0xfd, 0xba, + 0xd1, 0xbe, 0xb1, 0x64, 0x6b, 0x39, 0xa3, 0xf1, 0xcc, 0xe5, 0x1c, 0xa6, 0xb9, 0x9a, 0x61, 0xb8, + 0x90, 0xeb, 0x29, 0x00, 0xb3, 0x53, 0xd7, 0x26, 0xee, 0xb9, 0x7a, 0x60, 0xb2, 0x63, 0x77, 0xd5, + 0xc8, 0xea, 0xc3, 0x77, 0x0f, 0x70, 0x40, 0x74, 0xae, 0x37, 0x97, 0xe9, 0x9c, 0x4d, 0x3b, 0x90, + 0x2f, 0x58, 0xdc, 0x81, 0x6b, 0x57, 0xd8, 0x01, 0xd8, 0xbe, 0x40, 0xb6, 0x24, 0xc9, 0xb6, 0x0b, + 0xc9, 0x94, 0xc9, 0x79, 0xb4, 0x9d, 0x6f, 0xcb, 0xe0, 0xba, 0x44, 0x83, 0x1f, 0x2c, 0x50, 0x56, + 0xa3, 0x04, 0xb7, 0x8d, 0x36, 0xff, 0x9f, 0xdb, 0x6a, 0xad, 0x38, 0x50, 0x69, 0x3a, 0x0f, 0xde, + 0x7f, 0xff, 0xf3, 0x79, 0xa9, 0x0e, 0x6b, 0x28, 0xcb, 0xb8, 0xcf, 0x88, 0x78, 0xcd, 0x93, 0x01, + 0xca, 0xff, 0xc5, 0xe0, 0x4f, 0x0b, 0xac, 0x19, 0x3b, 0x03, 0xf7, 0xf2, 0x55, 0x0b, 0x26, 0xbd, + 0xfa, 0xf0, 0x32, 0xa9, 0x1a, 0xa1, 0x23, 0x11, 0xda, 0xf0, 0x49, 0x31, 0x42, 0xce, 0x1d, 0x80, + 0xde, 0x9e, 0xff, 0x55, 0xef, 0xe0, 0x0f, 0x0b, 0xac, 0x1b, 0x05, 0x9b, 0x61, 0xb8, 0x08, 0xb1, + 0x60, 0xe8, 0x17, 0x21, 0x16, 0x8d, 0xaf, 0xd3, 0x94, 0x88, 0x8f, 0xe0, 0xde, 0xa5, 0x11, 0x5b, + 0x9d, 0x93, 0xb1, 0x6d, 0x9d, 0x8e, 0x6d, 0xeb, 0xf7, 0xd8, 0xb6, 0x3e, 0x4d, 0xec, 0xd2, 0xe9, + 0xc4, 0x2e, 0x9d, 0x4d, 0xec, 0xd2, 0xcb, 0xdd, 0x80, 0x8a, 0x57, 0xc3, 0x9e, 0xeb, 0xf3, 0x28, + 0xa7, 0xfc, 0x9b, 0x79, 0x01, 0x31, 0x8a, 0x49, 0xda, 0x2b, 0xcb, 0x6b, 0x73, 0xf7, 0x5f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x64, 0x2d, 0x35, 0xad, 0x71, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -157,6 +365,9 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -176,10 +387,31 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { + out := new(QueryGetRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, "/poktroll.tokenomics.Query/RelayMiningDifficulty", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { + out := new(QueryAllRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, "/poktroll.tokenomics.Query/RelayMiningDifficultyAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -189,6 +421,12 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) RelayMiningDifficulty(ctx context.Context, req *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") +} +func (*UnimplementedQueryServer) RelayMiningDifficultyAll(ctx context.Context, req *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -212,6 +450,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficulty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.tokenomics.Query/RelayMiningDifficulty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.tokenomics.Query/RelayMiningDifficultyAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "poktroll.tokenomics.Query", HandlerType: (*QueryServer)(nil), @@ -220,6 +494,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "RelayMiningDifficulty", + Handler: _Query_RelayMiningDifficulty_Handler, + }, + { + MethodName: "RelayMiningDifficultyAll", + Handler: _Query_RelayMiningDifficultyAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/tokenomics/query.proto", @@ -281,6 +563,153 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryGetRelayMiningDifficultyRequest) 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 *QueryGetRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetRelayMiningDifficultyResponse) 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 *QueryGetRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.RelayMiningDifficulty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllRelayMiningDifficultyRequest) 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 *QueryAllRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllRelayMiningDifficultyResponse) 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 *QueryAllRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RelayMiningDifficulty) > 0 { + for iNdEx := len(m.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RelayMiningDifficulty[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -312,7 +741,63 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func sovQuery(x uint64) (n int) { +func (m *QueryGetRelayMiningDifficultyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRelayMiningDifficultyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RelayMiningDifficulty.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllRelayMiningDifficultyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRelayMiningDifficultyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RelayMiningDifficulty) > 0 { + for _, e := range m.RelayMiningDifficulty { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozQuery(x uint64) (n int) { @@ -451,6 +936,377 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetRelayMiningDifficultyRequest) 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 ErrIntOverflowQuery + } + 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: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRelayMiningDifficultyResponse) 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 ErrIntOverflowQuery + } + 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: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RelayMiningDifficulty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllRelayMiningDifficultyRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllRelayMiningDifficultyResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RelayMiningDifficulty = append(m.RelayMiningDifficulty, RelayMiningDifficulty{}) + if err := m.RelayMiningDifficulty[len(m.RelayMiningDifficulty)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenomics/types/query.pb.gw.go b/x/tokenomics/types/query.pb.gw.go index 08c31f3c5..15d7f5446 100644 --- a/x/tokenomics/types/query.pb.gw.go +++ b/x/tokenomics/types/query.pb.gw.go @@ -51,6 +51,96 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["serviceId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") + } + + protoReq.ServiceId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) + } + + msg, err := client.RelayMiningDifficulty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["serviceId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") + } + + protoReq.ServiceId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) + } + + msg, err := server.RelayMiningDifficulty(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RelayMiningDifficultyAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RelayMiningDifficultyAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RelayMiningDifficultyAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +170,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +277,61 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"pokt-network", "poktroll", "tokenomics", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RelayMiningDifficulty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"pokt-network", "poktroll", "tokenomics", "relay_mining_difficulty", "serviceId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RelayMiningDifficultyAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"pokt-network", "poktroll", "tokenomics", "relay_mining_difficulty"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_RelayMiningDifficulty_0 = runtime.ForwardResponseMessage + + forward_Query_RelayMiningDifficultyAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/tokenomics/types/relay_mining_difficulty.pb.go b/x/tokenomics/types/relay_mining_difficulty.pb.go new file mode 100644 index 000000000..a60e69e05 --- /dev/null +++ b/x/tokenomics/types/relay_mining_difficulty.pb.go @@ -0,0 +1,458 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: poktroll/tokenomics/relay_mining_difficulty.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// RelayMiningDifficulty is a message used to store the on-chain Relay Mining +// difficulty associated with a specific service ID. +type RelayMiningDifficulty struct { + // The service ID the the relay mining difficulty is associated with. + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + // The block height at which this relay mining difficulty was computed. + // This is needed to determine how much time has passed since the last time + // the exponential moving average was computed. + BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // The exponential moving average of the number of relays for this service. + NumRelaysEma uint64 `protobuf:"varint,3,opt,name=num_relays_ema,json=numRelaysEma,proto3" json:"num_relays_ema,omitempty"` + // The target hash determining the difficulty to mine relays for this service. + // For example, if we use sha256 to hash the (RelayRequest,ReqlayResponse) tuple, + // and the difficulty has 4 leading zero bits, then the target hash would be: + // 0b0000111... (until 32 bytes are filled up). + TargetHash []byte `protobuf:"bytes,4,opt,name=target_hash,json=targetHash,proto3" json:"target_hash,omitempty"` +} + +func (m *RelayMiningDifficulty) Reset() { *m = RelayMiningDifficulty{} } +func (m *RelayMiningDifficulty) String() string { return proto.CompactTextString(m) } +func (*RelayMiningDifficulty) ProtoMessage() {} +func (*RelayMiningDifficulty) Descriptor() ([]byte, []int) { + return fileDescriptor_1777fca7cd39aaea, []int{0} +} +func (m *RelayMiningDifficulty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RelayMiningDifficulty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RelayMiningDifficulty.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 *RelayMiningDifficulty) XXX_Merge(src proto.Message) { + xxx_messageInfo_RelayMiningDifficulty.Merge(m, src) +} +func (m *RelayMiningDifficulty) XXX_Size() int { + return m.Size() +} +func (m *RelayMiningDifficulty) XXX_DiscardUnknown() { + xxx_messageInfo_RelayMiningDifficulty.DiscardUnknown(m) +} + +var xxx_messageInfo_RelayMiningDifficulty proto.InternalMessageInfo + +func (m *RelayMiningDifficulty) GetServiceId() string { + if m != nil { + return m.ServiceId + } + return "" +} + +func (m *RelayMiningDifficulty) GetBlockHeight() int64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *RelayMiningDifficulty) GetNumRelaysEma() uint64 { + if m != nil { + return m.NumRelaysEma + } + return 0 +} + +func (m *RelayMiningDifficulty) GetTargetHash() []byte { + if m != nil { + return m.TargetHash + } + return nil +} + +func init() { + proto.RegisterType((*RelayMiningDifficulty)(nil), "poktroll.tokenomics.RelayMiningDifficulty") +} + +func init() { + proto.RegisterFile("poktroll/tokenomics/relay_mining_difficulty.proto", fileDescriptor_1777fca7cd39aaea) +} + +var fileDescriptor_1777fca7cd39aaea = []byte{ + // 274 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x3f, 0x4e, 0xf3, 0x30, + 0x18, 0x87, 0xe3, 0xaf, 0xd5, 0x27, 0xd5, 0x8d, 0x18, 0x82, 0x90, 0xb2, 0x60, 0x02, 0x62, 0xc8, + 0x42, 0x22, 0xd4, 0x1b, 0x20, 0x90, 0xca, 0xd0, 0x25, 0x23, 0x8b, 0xe5, 0x24, 0x6e, 0x6c, 0xc5, + 0x7f, 0x22, 0xdb, 0x01, 0x72, 0x0b, 0x8e, 0xc0, 0x71, 0x18, 0x3b, 0x32, 0xa2, 0xe4, 0x22, 0xa8, + 0x06, 0x0a, 0xeb, 0x23, 0x3d, 0x7a, 0xdf, 0xdf, 0x03, 0xaf, 0x3b, 0xdd, 0x3a, 0xa3, 0x85, 0xc8, + 0x9d, 0x6e, 0xa9, 0xd2, 0x92, 0x57, 0x36, 0x37, 0x54, 0x90, 0x01, 0x4b, 0xae, 0xb8, 0x6a, 0x70, + 0xcd, 0xb7, 0x5b, 0x5e, 0xf5, 0xc2, 0x0d, 0x59, 0x67, 0xb4, 0xd3, 0xd1, 0xf1, 0x8f, 0x92, 0xfd, + 0x2a, 0x17, 0xaf, 0x00, 0x9e, 0x14, 0x7b, 0x6d, 0xe3, 0xad, 0xdb, 0x83, 0x14, 0x9d, 0x42, 0x68, + 0xa9, 0x79, 0xe4, 0x15, 0xc5, 0xbc, 0x8e, 0x41, 0x02, 0xd2, 0x45, 0xb1, 0xf8, 0x26, 0xf7, 0x75, + 0x74, 0x0e, 0xc3, 0x52, 0xe8, 0xaa, 0xc5, 0x8c, 0xf2, 0x86, 0xb9, 0xf8, 0x5f, 0x02, 0xd2, 0x59, + 0xb1, 0xf4, 0x6c, 0xed, 0x51, 0x74, 0x09, 0x8f, 0x54, 0x2f, 0xb1, 0xff, 0xca, 0x62, 0x2a, 0x49, + 0x3c, 0x4b, 0x40, 0x3a, 0x2f, 0x42, 0xd5, 0x4b, 0x7f, 0xd3, 0xde, 0x49, 0x12, 0x9d, 0xc1, 0xa5, + 0x23, 0xa6, 0xa1, 0x0e, 0x33, 0x62, 0x59, 0x3c, 0x4f, 0x40, 0x1a, 0x16, 0xf0, 0x0b, 0xad, 0x89, + 0x65, 0x37, 0x9b, 0xb7, 0x11, 0x81, 0xdd, 0x88, 0xc0, 0xc7, 0x88, 0xc0, 0xcb, 0x84, 0x82, 0xdd, + 0x84, 0x82, 0xf7, 0x09, 0x05, 0x0f, 0xab, 0x86, 0x3b, 0xd6, 0x97, 0x59, 0xa5, 0x65, 0xbe, 0x1f, + 0x77, 0xa5, 0xa8, 0x7b, 0xd2, 0xa6, 0xcd, 0x0f, 0x71, 0x9e, 0xff, 0xe6, 0x71, 0x43, 0x47, 0x6d, + 0xf9, 0xdf, 0xd7, 0x58, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, 0x07, 0xd6, 0x20, 0xbb, 0x42, 0x01, + 0x00, 0x00, +} + +func (m *RelayMiningDifficulty) 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 *RelayMiningDifficulty) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RelayMiningDifficulty) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TargetHash) > 0 { + i -= len(m.TargetHash) + copy(dAtA[i:], m.TargetHash) + i = encodeVarintRelayMiningDifficulty(dAtA, i, uint64(len(m.TargetHash))) + i-- + dAtA[i] = 0x22 + } + if m.NumRelaysEma != 0 { + i = encodeVarintRelayMiningDifficulty(dAtA, i, uint64(m.NumRelaysEma)) + i-- + dAtA[i] = 0x18 + } + if m.BlockHeight != 0 { + i = encodeVarintRelayMiningDifficulty(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = encodeVarintRelayMiningDifficulty(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRelayMiningDifficulty(dAtA []byte, offset int, v uint64) int { + offset -= sovRelayMiningDifficulty(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RelayMiningDifficulty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + sovRelayMiningDifficulty(uint64(l)) + } + if m.BlockHeight != 0 { + n += 1 + sovRelayMiningDifficulty(uint64(m.BlockHeight)) + } + if m.NumRelaysEma != 0 { + n += 1 + sovRelayMiningDifficulty(uint64(m.NumRelaysEma)) + } + l = len(m.TargetHash) + if l > 0 { + n += 1 + l + sovRelayMiningDifficulty(uint64(l)) + } + return n +} + +func sovRelayMiningDifficulty(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRelayMiningDifficulty(x uint64) (n int) { + return sovRelayMiningDifficulty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RelayMiningDifficulty) 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 ErrIntOverflowRelayMiningDifficulty + } + 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: RelayMiningDifficulty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RelayMiningDifficulty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRelayMiningDifficulty + } + 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 ErrInvalidLengthRelayMiningDifficulty + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRelayMiningDifficulty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRelaysEma", wireType) + } + m.NumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRelayMiningDifficulty + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRelayMiningDifficulty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TargetHash = append(m.TargetHash[:0], dAtA[iNdEx:postIndex]...) + if m.TargetHash == nil { + m.TargetHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRelayMiningDifficulty(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRelayMiningDifficulty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRelayMiningDifficulty(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRelayMiningDifficulty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRelayMiningDifficulty + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRelayMiningDifficulty + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRelayMiningDifficulty + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRelayMiningDifficulty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRelayMiningDifficulty = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRelayMiningDifficulty = fmt.Errorf("proto: unexpected end of group") +)