diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 1046b1541..6fe0f8265 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -5,39 +5,79 @@ on: env: TAR_PATH: heighliner.tar + IBC_TAR_PATH: heighliner-ibc.tar concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build: + + build-primary: runs-on: ubuntu-latest steps: - - name: Build Docker Image + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Build Primary Docker Image uses: strangelove-ventures/heighliner-build-action@v1.0.3 with: - registry: "" # empty registry, image only shared for e2e testing - tag: local # emulate local environment for consistency in interchaintest cases - tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs - platform: linux/amd64 # test runner architecture only - git-ref: ${{ github.head_ref }} # source code ref - - # Heighliner chains.yaml config + registry: "" + tag: local + tar-export-path: ${{ env.TAR_PATH }} + platform: linux/amd64 + git-ref: ${{ github.head_ref }} chain: layer dockerfile: cosmos build-target: make install binaries: | - /go/bin/layerd - - name: Publish Tarball as Artifact + - name: Publish Primary Tarball as Artifact uses: actions/upload-artifact@v4 with: name: layer-docker-image path: ${{ env.TAR_PATH }} + # Second job: Build the IBC image, depends on the primary image job + build-ibc: + runs-on: ubuntu-latest + needs: build-primary + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Switch to IBC branch + run: | + git fetch --all + git checkout ibc + + - name: Build IBC Docker Image + uses: strangelove-ventures/heighliner-build-action@v1.0.3 + with: + registry: "" + tag: local + tar-export-path: ${{ env.IBC_TAR_PATH }} + platform: linux/amd64 + git-ref: ibc + chain: layer-icq + dockerfile: cosmos + build-target: make install + binaries: | + - /go/bin/layerd + + - name: Publish IBC Tarball as Artifact + uses: actions/upload-artifact@v4 + with: + name: layer-icq-docker-image + path: ${{ env.IBC_TAR_PATH }} + + # Prepare job (depends on both build jobs) prepare: runs-on: ubuntu-latest + needs: + - build-primary + - build-ibc outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: @@ -52,19 +92,17 @@ jobs: - name: Generate Matrix id: set-matrix run: | - # Run the command and convert its output to a JSON array TESTS=$(cd e2e && go test -list . | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]') echo "matrix=${TESTS}" >> $GITHUB_OUTPUT + # Test job (depends on prepare, which in turn depends on both build jobs) test: + runs-on: ubuntu-latest needs: - - build - prepare - runs-on: ubuntu-latest strategy: matrix: - # names of `make` commands to run tests - test: ${{fromJson(needs.prepare.outputs.matrix)}} + test: ${{ fromJson(needs.prepare.outputs.matrix) }} fail-fast: false steps: @@ -76,13 +114,21 @@ jobs: with: go-version: '1.22' - - name: Download Tarball Artifact + - name: Download Primary Tarball uses: actions/download-artifact@v4 with: name: layer-docker-image - - name: Load Docker Image + - name: Download IBC Tarball + uses: actions/download-artifact@v4 + with: + name: layer-icq-docker-image + + - name: Load Primary Docker Image run: docker image load -i ${{ env.TAR_PATH }} + - name: Load IBC Docker Image + run: docker image load -i ${{ env.IBC_TAR_PATH }} + - name: Run Tests run: cd e2e && go test -race -v -timeout 10m -run ^${{ matrix.test }}$ . \ No newline at end of file diff --git a/Makefile b/Makefile index 00c0af397..9f87667a6 100644 --- a/Makefile +++ b/Makefile @@ -195,6 +195,7 @@ mock-gen-registry: mock-gen-reporter: @go run github.com/vektra/mockery/v2 --name=AccountKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks @go run github.com/vektra/mockery/v2 --name=BankKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks + @go run github.com/vektra/mockery/v2 --name=OracleKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks @go run github.com/vektra/mockery/v2 --name=StakingKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks @go run github.com/vektra/mockery/v2 --name=StakingHooks --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks @go run github.com/vektra/mockery/v2 --name=RegistryKeeper --dir=$(CURDIR)/x/reporter/types --recursive --output=./x/reporter/mocks diff --git a/api/layer/oracle/query_meta.pulsar.go b/api/layer/oracle/query_meta.pulsar.go index 0a3525c74..01f04e792 100644 --- a/api/layer/oracle/query_meta.pulsar.go +++ b/api/layer/oracle/query_meta.pulsar.go @@ -2,6 +2,7 @@ package oracle import ( + _ "cosmossdk.io/api/amino" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -818,6 +819,704 @@ func (x *fastReflection_QueryMeta) ProtoMethods() *protoiface.Methods { } } +var ( + md_Reward protoreflect.MessageDescriptor + fd_Reward_totalPower protoreflect.FieldDescriptor + fd_Reward_amount protoreflect.FieldDescriptor + fd_Reward_cycle_list protoreflect.FieldDescriptor + fd_Reward_block_height protoreflect.FieldDescriptor + fd_Reward_power_paid_out protoreflect.FieldDescriptor + fd_Reward_amount_paid_out protoreflect.FieldDescriptor +) + +func init() { + file_layer_oracle_query_meta_proto_init() + md_Reward = File_layer_oracle_query_meta_proto.Messages().ByName("reward") + fd_Reward_totalPower = md_Reward.Fields().ByName("totalPower") + fd_Reward_amount = md_Reward.Fields().ByName("amount") + fd_Reward_cycle_list = md_Reward.Fields().ByName("cycle_list") + fd_Reward_block_height = md_Reward.Fields().ByName("block_height") + fd_Reward_power_paid_out = md_Reward.Fields().ByName("power_paid_out") + fd_Reward_amount_paid_out = md_Reward.Fields().ByName("amount_paid_out") +} + +var _ protoreflect.Message = (*fastReflection_Reward)(nil) + +type fastReflection_Reward Reward + +func (x *Reward) ProtoReflect() protoreflect.Message { + return (*fastReflection_Reward)(x) +} + +func (x *Reward) slowProtoReflect() protoreflect.Message { + mi := &file_layer_oracle_query_meta_proto_msgTypes[1] + 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_Reward_messageType fastReflection_Reward_messageType +var _ protoreflect.MessageType = fastReflection_Reward_messageType{} + +type fastReflection_Reward_messageType struct{} + +func (x fastReflection_Reward_messageType) Zero() protoreflect.Message { + return (*fastReflection_Reward)(nil) +} +func (x fastReflection_Reward_messageType) New() protoreflect.Message { + return new(fastReflection_Reward) +} +func (x fastReflection_Reward_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Reward +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Reward) Descriptor() protoreflect.MessageDescriptor { + return md_Reward +} + +// 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_Reward) Type() protoreflect.MessageType { + return _fastReflection_Reward_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Reward) New() protoreflect.Message { + return new(fastReflection_Reward) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Reward) Interface() protoreflect.ProtoMessage { + return (*Reward)(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_Reward) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.TotalPower != uint64(0) { + value := protoreflect.ValueOfUint64(x.TotalPower) + if !f(fd_Reward_totalPower, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_Reward_amount, value) { + return + } + } + if x.CycleList != false { + value := protoreflect.ValueOfBool(x.CycleList) + if !f(fd_Reward_cycle_list, value) { + return + } + } + if x.BlockHeight != uint64(0) { + value := protoreflect.ValueOfUint64(x.BlockHeight) + if !f(fd_Reward_block_height, value) { + return + } + } + if x.PowerPaidOut != "" { + value := protoreflect.ValueOfString(x.PowerPaidOut) + if !f(fd_Reward_power_paid_out, value) { + return + } + } + if x.AmountPaidOut != "" { + value := protoreflect.ValueOfString(x.AmountPaidOut) + if !f(fd_Reward_amount_paid_out, 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_Reward) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.oracle.reward.totalPower": + return x.TotalPower != uint64(0) + case "layer.oracle.reward.amount": + return x.Amount != "" + case "layer.oracle.reward.cycle_list": + return x.CycleList != false + case "layer.oracle.reward.block_height": + return x.BlockHeight != uint64(0) + case "layer.oracle.reward.power_paid_out": + return x.PowerPaidOut != "" + case "layer.oracle.reward.amount_paid_out": + return x.AmountPaidOut != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.oracle.reward.totalPower": + x.TotalPower = uint64(0) + case "layer.oracle.reward.amount": + x.Amount = "" + case "layer.oracle.reward.cycle_list": + x.CycleList = false + case "layer.oracle.reward.block_height": + x.BlockHeight = uint64(0) + case "layer.oracle.reward.power_paid_out": + x.PowerPaidOut = "" + case "layer.oracle.reward.amount_paid_out": + x.AmountPaidOut = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.oracle.reward.totalPower": + value := x.TotalPower + return protoreflect.ValueOfUint64(value) + case "layer.oracle.reward.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + case "layer.oracle.reward.cycle_list": + value := x.CycleList + return protoreflect.ValueOfBool(value) + case "layer.oracle.reward.block_height": + value := x.BlockHeight + return protoreflect.ValueOfUint64(value) + case "layer.oracle.reward.power_paid_out": + value := x.PowerPaidOut + return protoreflect.ValueOfString(value) + case "layer.oracle.reward.amount_paid_out": + value := x.AmountPaidOut + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.oracle.reward.totalPower": + x.TotalPower = value.Uint() + case "layer.oracle.reward.amount": + x.Amount = value.Interface().(string) + case "layer.oracle.reward.cycle_list": + x.CycleList = value.Bool() + case "layer.oracle.reward.block_height": + x.BlockHeight = value.Uint() + case "layer.oracle.reward.power_paid_out": + x.PowerPaidOut = value.Interface().(string) + case "layer.oracle.reward.amount_paid_out": + x.AmountPaidOut = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.reward.totalPower": + panic(fmt.Errorf("field totalPower of message layer.oracle.reward is not mutable")) + case "layer.oracle.reward.amount": + panic(fmt.Errorf("field amount of message layer.oracle.reward is not mutable")) + case "layer.oracle.reward.cycle_list": + panic(fmt.Errorf("field cycle_list of message layer.oracle.reward is not mutable")) + case "layer.oracle.reward.block_height": + panic(fmt.Errorf("field block_height of message layer.oracle.reward is not mutable")) + case "layer.oracle.reward.power_paid_out": + panic(fmt.Errorf("field power_paid_out of message layer.oracle.reward is not mutable")) + case "layer.oracle.reward.amount_paid_out": + panic(fmt.Errorf("field amount_paid_out of message layer.oracle.reward is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.reward.totalPower": + return protoreflect.ValueOfUint64(uint64(0)) + case "layer.oracle.reward.amount": + return protoreflect.ValueOfString("") + case "layer.oracle.reward.cycle_list": + return protoreflect.ValueOfBool(false) + case "layer.oracle.reward.block_height": + return protoreflect.ValueOfUint64(uint64(0)) + case "layer.oracle.reward.power_paid_out": + return protoreflect.ValueOfString("") + case "layer.oracle.reward.amount_paid_out": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.reward")) + } + panic(fmt.Errorf("message layer.oracle.reward 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_Reward) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.oracle.reward", 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_Reward) 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_Reward) 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_Reward) 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_Reward) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Reward) + 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.TotalPower != 0 { + n += 1 + runtime.Sov(uint64(x.TotalPower)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.CycleList { + n += 2 + } + if x.BlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.BlockHeight)) + } + l = len(x.PowerPaidOut) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.AmountPaidOut) + 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().(*Reward) + 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.AmountPaidOut) > 0 { + i -= len(x.AmountPaidOut) + copy(dAtA[i:], x.AmountPaidOut) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AmountPaidOut))) + i-- + dAtA[i] = 0x32 + } + if len(x.PowerPaidOut) > 0 { + i -= len(x.PowerPaidOut) + copy(dAtA[i:], x.PowerPaidOut) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PowerPaidOut))) + i-- + dAtA[i] = 0x2a + } + if x.BlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockHeight)) + i-- + dAtA[i] = 0x20 + } + if x.CycleList { + i-- + if x.CycleList { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x12 + } + if x.TotalPower != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.TotalPower)) + i-- + dAtA[i] = 0x8 + } + 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().(*Reward) + 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: Reward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Reward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TotalPower", wireType) + } + x.TotalPower = 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.TotalPower |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CycleList", wireType) + } + var v 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++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.CycleList = bool(v != 0) + case 4: + 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 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PowerPaidOut", 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.PowerPaidOut = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AmountPaidOut", 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.AmountPaidOut = 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, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -931,6 +1630,83 @@ func (x *QueryMeta) GetCycleList() bool { return false } +type Reward struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TotalPower uint64 `protobuf:"varint,1,opt,name=totalPower,proto3" json:"totalPower,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + // cycle_list indicates if a reward should also include timebasedRewards(tbr) + CycleList bool `protobuf:"varint,3,opt,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + // if cyclist then tbr amount can be fetched by this height + BlockHeight uint64 `protobuf:"varint,4,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + PowerPaidOut string `protobuf:"bytes,5,opt,name=power_paid_out,json=powerPaidOut,proto3" json:"power_paid_out,omitempty"` + AmountPaidOut string `protobuf:"bytes,6,opt,name=amount_paid_out,json=amountPaidOut,proto3" json:"amount_paid_out,omitempty"` +} + +func (x *Reward) Reset() { + *x = Reward{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_oracle_query_meta_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reward) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reward) ProtoMessage() {} + +// Deprecated: Use Reward.ProtoReflect.Descriptor instead. +func (*Reward) Descriptor() ([]byte, []int) { + return file_layer_oracle_query_meta_proto_rawDescGZIP(), []int{1} +} + +func (x *Reward) GetTotalPower() uint64 { + if x != nil { + return x.TotalPower + } + return 0 +} + +func (x *Reward) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +func (x *Reward) GetCycleList() bool { + if x != nil { + return x.CycleList + } + return false +} + +func (x *Reward) GetBlockHeight() uint64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +func (x *Reward) GetPowerPaidOut() string { + if x != nil { + return x.PowerPaidOut + } + return "" +} + +func (x *Reward) GetAmountPaidOut() string { + if x != nil { + return x.AmountPaidOut + } + return "" +} + var File_layer_oracle_query_meta_proto protoreflect.FileDescriptor var file_layer_oracle_query_meta_proto_rawDesc = []byte{ @@ -943,39 +1719,63 @@ var file_layer_oracle_query_meta_proto_rawDesc = []byte{ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xcc, 0x02, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, - 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x73, - 0x70, 0x65, 0x63, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x17, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x53, 0x70, 0x65, 0x63, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, - 0x30, 0x0a, 0x14, 0x68, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x5f, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x68, - 0x61, 0x73, 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x1d, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa0, - 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0x42, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xcc, 0x02, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x77, 0x69, 0x6e, + 0x64, 0x6f, 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x17, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x53, 0x70, 0x65, 0x63, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x6e, 0x64, + 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x14, 0x68, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x61, 0x6c, + 0x65, 0x64, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x12, 0x68, 0x61, 0x73, 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0xe9, 0x02, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, + 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, + 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x57, 0x0a, 0x0e, 0x70, 0x6f, 0x77, + 0x65, 0x72, 0x5f, 0x70, 0x61, 0x69, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x50, 0x61, 0x69, 0x64, 0x4f, + 0x75, 0x74, 0x12, 0x59, 0x0a, 0x0f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x69, + 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, + 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x69, 0x64, 0x4f, 0x75, 0x74, 0x42, 0xa0, 0x01, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x42, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -990,9 +1790,10 @@ func file_layer_oracle_query_meta_proto_rawDescGZIP() []byte { return file_layer_oracle_query_meta_proto_rawDescData } -var file_layer_oracle_query_meta_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_layer_oracle_query_meta_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_layer_oracle_query_meta_proto_goTypes = []interface{}{ (*QueryMeta)(nil), // 0: layer.oracle.QueryMeta + (*Reward)(nil), // 1: layer.oracle.reward } var file_layer_oracle_query_meta_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -1020,6 +1821,18 @@ func file_layer_oracle_query_meta_proto_init() { return nil } } + file_layer_oracle_query_meta_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reward); 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{ @@ -1027,7 +1840,7 @@ func file_layer_oracle_query_meta_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_oracle_query_meta_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/api/layer/oracle/tx.pulsar.go b/api/layer/oracle/tx.pulsar.go index b1b28abd3..162184e4d 100644 --- a/api/layer/oracle/tx.pulsar.go +++ b/api/layer/oracle/tx.pulsar.go @@ -1423,12 +1423,14 @@ func (x *fastReflection_MsgSubmitValue) ProtoMethods() *protoiface.Methods { } var ( - md_MsgSubmitValueResponse protoreflect.MessageDescriptor + md_MsgSubmitValueResponse protoreflect.MessageDescriptor + fd_MsgSubmitValueResponse_id protoreflect.FieldDescriptor ) func init() { file_layer_oracle_tx_proto_init() md_MsgSubmitValueResponse = File_layer_oracle_tx_proto.Messages().ByName("MsgSubmitValueResponse") + fd_MsgSubmitValueResponse_id = md_MsgSubmitValueResponse.Fields().ByName("id") } var _ protoreflect.Message = (*fastReflection_MsgSubmitValueResponse)(nil) @@ -1496,6 +1498,12 @@ func (x *fastReflection_MsgSubmitValueResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgSubmitValueResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != uint64(0) { + value := protoreflect.ValueOfUint64(x.Id) + if !f(fd_MsgSubmitValueResponse_id, value) { + return + } + } } // Has reports whether a field is populated. @@ -1511,6 +1519,8 @@ func (x *fastReflection_MsgSubmitValueResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgSubmitValueResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + return x.Id != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1527,6 +1537,8 @@ func (x *fastReflection_MsgSubmitValueResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitValueResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + x.Id = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1543,6 +1555,9 @@ func (x *fastReflection_MsgSubmitValueResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgSubmitValueResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + value := x.Id + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1563,6 +1578,8 @@ func (x *fastReflection_MsgSubmitValueResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitValueResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + x.Id = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1583,6 +1600,8 @@ func (x *fastReflection_MsgSubmitValueResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitValueResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + panic(fmt.Errorf("field id of message layer.oracle.MsgSubmitValueResponse is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1596,6 +1615,8 @@ func (x *fastReflection_MsgSubmitValueResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgSubmitValueResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "layer.oracle.MsgSubmitValueResponse.id": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgSubmitValueResponse")) @@ -1665,6 +1686,9 @@ func (x *fastReflection_MsgSubmitValueResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l + if x.Id != 0 { + n += 1 + runtime.Sov(uint64(x.Id)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1694,6 +1718,11 @@ func (x *fastReflection_MsgSubmitValueResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Id != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Id)) + i-- + dAtA[i] = 0x8 + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -1743,6 +1772,25 @@ func (x *fastReflection_MsgSubmitValueResponse) ProtoMethods() *protoiface.Metho return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + x.Id = 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.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3741,6 +3789,8 @@ type MsgSubmitValueResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *MsgSubmitValueResponse) Reset() { @@ -3763,6 +3813,13 @@ func (*MsgSubmitValueResponse) Descriptor() ([]byte, []int) { return file_layer_oracle_tx_proto_rawDescGZIP(), []int{3} } +func (x *MsgSubmitValueResponse) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + type MsgTip struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3948,8 +4005,9 @@ var file_layer_oracle_tx_proto_rawDesc = []byte{ 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x22, - 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x06, 0x4d, 0x73, + 0x28, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x06, 0x4d, 0x73, 0x67, 0x54, 0x69, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, diff --git a/api/layer/reporter/query.pulsar.go b/api/layer/reporter/query.pulsar.go index 14f935435..e21fea89e 100644 --- a/api/layer/reporter/query.pulsar.go +++ b/api/layer/reporter/query.pulsar.go @@ -6407,12 +6407,18 @@ func (x *fastReflection_QuerySpaceAvailableByReporterResponse) ProtoMethods() *p var ( md_QueryAvailableTipsRequest protoreflect.MessageDescriptor fd_QueryAvailableTipsRequest_selector_address protoreflect.FieldDescriptor + fd_QueryAvailableTipsRequest_reporter_address protoreflect.FieldDescriptor + fd_QueryAvailableTipsRequest_query_id protoreflect.FieldDescriptor + fd_QueryAvailableTipsRequest_meta_id protoreflect.FieldDescriptor ) func init() { file_layer_reporter_query_proto_init() md_QueryAvailableTipsRequest = File_layer_reporter_query_proto.Messages().ByName("QueryAvailableTipsRequest") fd_QueryAvailableTipsRequest_selector_address = md_QueryAvailableTipsRequest.Fields().ByName("selector_address") + fd_QueryAvailableTipsRequest_reporter_address = md_QueryAvailableTipsRequest.Fields().ByName("reporter_address") + fd_QueryAvailableTipsRequest_query_id = md_QueryAvailableTipsRequest.Fields().ByName("query_id") + fd_QueryAvailableTipsRequest_meta_id = md_QueryAvailableTipsRequest.Fields().ByName("meta_id") } var _ protoreflect.Message = (*fastReflection_QueryAvailableTipsRequest)(nil) @@ -6486,6 +6492,24 @@ func (x *fastReflection_QueryAvailableTipsRequest) Range(f func(protoreflect.Fie return } } + if x.ReporterAddress != "" { + value := protoreflect.ValueOfString(x.ReporterAddress) + if !f(fd_QueryAvailableTipsRequest_reporter_address, value) { + return + } + } + if x.QueryId != "" { + value := protoreflect.ValueOfString(x.QueryId) + if !f(fd_QueryAvailableTipsRequest_query_id, value) { + return + } + } + if x.MetaId != uint64(0) { + value := protoreflect.ValueOfUint64(x.MetaId) + if !f(fd_QueryAvailableTipsRequest_meta_id, value) { + return + } + } } // Has reports whether a field is populated. @@ -6503,6 +6527,12 @@ func (x *fastReflection_QueryAvailableTipsRequest) Has(fd protoreflect.FieldDesc switch fd.FullName() { case "layer.reporter.QueryAvailableTipsRequest.selector_address": return x.SelectorAddress != "" + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + return x.ReporterAddress != "" + case "layer.reporter.QueryAvailableTipsRequest.query_id": + return x.QueryId != "" + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + return x.MetaId != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6521,6 +6551,12 @@ func (x *fastReflection_QueryAvailableTipsRequest) Clear(fd protoreflect.FieldDe switch fd.FullName() { case "layer.reporter.QueryAvailableTipsRequest.selector_address": x.SelectorAddress = "" + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + x.ReporterAddress = "" + case "layer.reporter.QueryAvailableTipsRequest.query_id": + x.QueryId = "" + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + x.MetaId = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6540,6 +6576,15 @@ func (x *fastReflection_QueryAvailableTipsRequest) Get(descriptor protoreflect.F case "layer.reporter.QueryAvailableTipsRequest.selector_address": value := x.SelectorAddress return protoreflect.ValueOfString(value) + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + value := x.ReporterAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.QueryAvailableTipsRequest.query_id": + value := x.QueryId + return protoreflect.ValueOfString(value) + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + value := x.MetaId + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6562,6 +6607,12 @@ func (x *fastReflection_QueryAvailableTipsRequest) Set(fd protoreflect.FieldDesc switch fd.FullName() { case "layer.reporter.QueryAvailableTipsRequest.selector_address": x.SelectorAddress = value.Interface().(string) + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + x.ReporterAddress = value.Interface().(string) + case "layer.reporter.QueryAvailableTipsRequest.query_id": + x.QueryId = value.Interface().(string) + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + x.MetaId = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6584,6 +6635,12 @@ func (x *fastReflection_QueryAvailableTipsRequest) Mutable(fd protoreflect.Field switch fd.FullName() { case "layer.reporter.QueryAvailableTipsRequest.selector_address": panic(fmt.Errorf("field selector_address of message layer.reporter.QueryAvailableTipsRequest is not mutable")) + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryAvailableTipsRequest is not mutable")) + case "layer.reporter.QueryAvailableTipsRequest.query_id": + panic(fmt.Errorf("field query_id of message layer.reporter.QueryAvailableTipsRequest is not mutable")) + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + panic(fmt.Errorf("field meta_id of message layer.reporter.QueryAvailableTipsRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6599,6 +6656,12 @@ func (x *fastReflection_QueryAvailableTipsRequest) NewField(fd protoreflect.Fiel switch fd.FullName() { case "layer.reporter.QueryAvailableTipsRequest.selector_address": return protoreflect.ValueOfString("") + case "layer.reporter.QueryAvailableTipsRequest.reporter_address": + return protoreflect.ValueOfString("") + case "layer.reporter.QueryAvailableTipsRequest.query_id": + return protoreflect.ValueOfString("") + case "layer.reporter.QueryAvailableTipsRequest.meta_id": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryAvailableTipsRequest")) @@ -6672,6 +6735,17 @@ func (x *fastReflection_QueryAvailableTipsRequest) ProtoMethods() *protoiface.Me if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.ReporterAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.QueryId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.MetaId != 0 { + n += 1 + runtime.Sov(uint64(x.MetaId)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -6701,6 +6775,25 @@ func (x *fastReflection_QueryAvailableTipsRequest) ProtoMethods() *protoiface.Me i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MetaId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MetaId)) + i-- + dAtA[i] = 0x20 + } + if len(x.QueryId) > 0 { + i -= len(x.QueryId) + copy(dAtA[i:], x.QueryId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryId))) + i-- + dAtA[i] = 0x1a + } + if len(x.ReporterAddress) > 0 { + i -= len(x.ReporterAddress) + copy(dAtA[i:], x.ReporterAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) + i-- + dAtA[i] = 0x12 + } if len(x.SelectorAddress) > 0 { i -= len(x.SelectorAddress) copy(dAtA[i:], x.SelectorAddress) @@ -6789,6 +6882,89 @@ func (x *fastReflection_QueryAvailableTipsRequest) ProtoMethods() *protoiface.Me } x.SelectorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryId", 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.QueryId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MetaId", wireType) + } + x.MetaId = 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.MetaId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -7813,6 +7989,9 @@ type QueryAvailableTipsRequest struct { // selector address defines the address of the selector to query for. SelectorAddress string `protobuf:"bytes,1,opt,name=selector_address,json=selectorAddress,proto3" json:"selector_address,omitempty"` + ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + QueryId string `protobuf:"bytes,3,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + MetaId uint64 `protobuf:"varint,4,opt,name=meta_id,json=metaId,proto3" json:"meta_id,omitempty"` } func (x *QueryAvailableTipsRequest) Reset() { @@ -7842,6 +8021,27 @@ func (x *QueryAvailableTipsRequest) GetSelectorAddress() string { return "" } +func (x *QueryAvailableTipsRequest) GetReporterAddress() string { + if x != nil { + return x.ReporterAddress + } + return "" +} + +func (x *QueryAvailableTipsRequest) GetQueryId() string { + if x != nil { + return x.QueryId + } + return "" +} + +func (x *QueryAvailableTipsRequest) GetMetaId() uint64 { + if x != nil { + return x.MetaId + } + return 0 +} + type QueryAvailableTipsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7987,122 +8187,130 @@ var file_layer_reporter_query_proto_rawDesc = []byte{ 0x62, 0x6c, 0x65, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x60, - 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x54, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, 0x73, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x22, 0x7c, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, - 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, - 0x0a, 0x0e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x70, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x37, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, - 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x10, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0x52, - 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x32, 0x8e, - 0x0b, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x7b, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x87, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x74, 0x65, 0x6c, - 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, - 0xb7, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x12, 0x2c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x46, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x12, 0x3e, 0x2f, 0x74, 0x65, 0x6c, 0x6c, - 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x7b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0d, 0x41, 0x6c, - 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x74, 0x65, 0x6c, - 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0xc1, 0x01, 0x0a, 0x17, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x33, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x22, 0xd9, + 0x01, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, + 0x65, 0x54, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, + 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, + 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x61, 0x49, 0x64, 0x22, 0x7c, 0x0a, 0x1a, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x61, 0x76, 0x61, 0x69, + 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x70, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x37, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, + 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x10, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0x52, 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x32, 0x95, 0x0b, 0x0a, 0x05, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x12, 0x7b, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x87, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, 0xb7, 0x01, 0x0a, 0x10, 0x53, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x2c, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x40, 0x12, 0x3e, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x73, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2f, 0x7b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x0d, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, - 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x35, 0x12, 0x33, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x65, 0x78, - 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xda, 0x01, 0x0a, 0x18, 0x4e, 0x75, 0x6d, - 0x4f, 0x66, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x79, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, + 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0xc1, + 0x01, 0x0a, 0x17, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, + 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x34, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x35, 0x12, 0x33, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x2d, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0xda, 0x01, 0x0a, 0x18, 0x4e, 0x75, 0x6d, 0x4f, 0x66, 0x53, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, + 0x34, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x75, 0x6d, 0x4f, 0x66, 0x53, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x73, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4e, 0x75, 0x6d, 0x4f, 0x66, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4e, 0x75, 0x6d, 0x4f, 0x66, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, - 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x51, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4b, 0x12, 0x49, 0x2f, 0x74, 0x65, 0x6c, - 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x6e, 0x75, 0x6d, 0x2d, 0x6f, 0x66, 0x2d, 0x73, 0x65, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x2d, 0x62, 0x79, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xd9, 0x01, 0x0a, 0x18, 0x53, 0x70, 0x61, 0x63, 0x65, 0x41, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x4b, 0x12, 0x49, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, + 0x6e, 0x75, 0x6d, 0x2d, 0x6f, 0x66, 0x2d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, + 0x2d, 0x62, 0x79, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x7b, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, + 0xd9, 0x01, 0x0a, 0x18, 0x53, 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, + 0x6c, 0x65, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, + 0x65, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, - 0x70, 0x61, 0x63, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x79, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x50, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4a, 0x12, 0x48, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, - 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, - 0x6c, 0x65, 0x2d, 0x62, 0x79, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x7b, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x7d, 0x12, 0xab, 0x01, 0x0a, 0x0d, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, - 0x69, 0x70, 0x73, 0x12, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, - 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, - 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x43, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x3d, 0x12, 0x3b, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2d, 0x74, 0x69, 0x70, 0x73, 0x2f, 0x7b, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x42, - 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x50, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x4a, 0x12, 0x48, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x2d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2d, 0x62, 0x79, 0x2d, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xb2, 0x01, 0x0a, 0x14, + 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x42, 0x79, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, + 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x43, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x3d, 0x12, 0x3b, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, + 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2d, 0x74, 0x69, 0x70, 0x73, 0x2f, 0x7b, 0x73, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, + 0x42, 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -8154,7 +8362,7 @@ var file_layer_reporter_query_proto_depIdxs = []int32{ 9, // 9: layer.reporter.Query.AllowedAmountExpiration:input_type -> layer.reporter.QueryAllowedAmountExpirationRequest 11, // 10: layer.reporter.Query.NumOfSelectorsByReporter:input_type -> layer.reporter.QueryNumOfSelectorsByReporterRequest 13, // 11: layer.reporter.Query.SpaceAvailableByReporter:input_type -> layer.reporter.QuerySpaceAvailableByReporterRequest - 15, // 12: layer.reporter.Query.AvailableTips:input_type -> layer.reporter.QueryAvailableTipsRequest + 15, // 12: layer.reporter.Query.AvailableTipsByQuery:input_type -> layer.reporter.QueryAvailableTipsRequest 1, // 13: layer.reporter.Query.Params:output_type -> layer.reporter.QueryParamsResponse 4, // 14: layer.reporter.Query.Reporters:output_type -> layer.reporter.QueryReportersResponse 6, // 15: layer.reporter.Query.SelectorReporter:output_type -> layer.reporter.QuerySelectorReporterResponse @@ -8162,7 +8370,7 @@ var file_layer_reporter_query_proto_depIdxs = []int32{ 10, // 17: layer.reporter.Query.AllowedAmountExpiration:output_type -> layer.reporter.QueryAllowedAmountExpirationResponse 12, // 18: layer.reporter.Query.NumOfSelectorsByReporter:output_type -> layer.reporter.QueryNumOfSelectorsByReporterResponse 14, // 19: layer.reporter.Query.SpaceAvailableByReporter:output_type -> layer.reporter.QuerySpaceAvailableByReporterResponse - 16, // 20: layer.reporter.Query.AvailableTips:output_type -> layer.reporter.QueryAvailableTipsResponse + 16, // 20: layer.reporter.Query.AvailableTipsByQuery:output_type -> layer.reporter.QueryAvailableTipsResponse 13, // [13:21] is the sub-list for method output_type 5, // [5:13] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name diff --git a/api/layer/reporter/query_grpc.pb.go b/api/layer/reporter/query_grpc.pb.go index 43adfd440..a2d3966b0 100644 --- a/api/layer/reporter/query_grpc.pb.go +++ b/api/layer/reporter/query_grpc.pb.go @@ -32,7 +32,7 @@ type QueryClient interface { // SpaceAvailableByReporter queries the space available in a reporter. SpaceAvailableByReporter(ctx context.Context, in *QuerySpaceAvailableByReporterRequest, opts ...grpc.CallOption) (*QuerySpaceAvailableByReporterResponse, error) // AvailableTips queries the tips available for withdrawal for a given selector. - AvailableTips(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) + AvailableTipsByQuery(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) } type queryClient struct { @@ -106,9 +106,9 @@ func (c *queryClient) SpaceAvailableByReporter(ctx context.Context, in *QuerySpa return out, nil } -func (c *queryClient) AvailableTips(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) { +func (c *queryClient) AvailableTipsByQuery(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) { out := new(QueryAvailableTipsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/AvailableTips", in, out, opts...) + err := c.cc.Invoke(ctx, "/layer.reporter.Query/AvailableTipsByQuery", in, out, opts...) if err != nil { return nil, err } @@ -133,7 +133,7 @@ type QueryServer interface { // SpaceAvailableByReporter queries the space available in a reporter. SpaceAvailableByReporter(context.Context, *QuerySpaceAvailableByReporterRequest) (*QuerySpaceAvailableByReporterResponse, error) // AvailableTips queries the tips available for withdrawal for a given selector. - AvailableTips(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) + AvailableTipsByQuery(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) mustEmbedUnimplementedQueryServer() } @@ -162,8 +162,8 @@ func (UnimplementedQueryServer) NumOfSelectorsByReporter(context.Context, *Query func (UnimplementedQueryServer) SpaceAvailableByReporter(context.Context, *QuerySpaceAvailableByReporterRequest) (*QuerySpaceAvailableByReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SpaceAvailableByReporter not implemented") } -func (UnimplementedQueryServer) AvailableTips(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AvailableTips not implemented") +func (UnimplementedQueryServer) AvailableTipsByQuery(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AvailableTipsByQuery not implemented") } func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} @@ -304,20 +304,20 @@ func _Query_SpaceAvailableByReporter_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _Query_AvailableTips_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_AvailableTipsByQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAvailableTipsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).AvailableTips(ctx, in) + return srv.(QueryServer).AvailableTipsByQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/layer.reporter.Query/AvailableTips", + FullMethod: "/layer.reporter.Query/AvailableTipsByQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AvailableTips(ctx, req.(*QueryAvailableTipsRequest)) + return srv.(QueryServer).AvailableTipsByQuery(ctx, req.(*QueryAvailableTipsRequest)) } return interceptor(ctx, in, info, handler) } @@ -358,8 +358,8 @@ var Query_ServiceDesc = grpc.ServiceDesc{ Handler: _Query_SpaceAvailableByReporter_Handler, }, { - MethodName: "AvailableTips", - Handler: _Query_AvailableTips_Handler, + MethodName: "AvailableTipsByQuery", + Handler: _Query_AvailableTipsByQuery_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/api/layer/reporter/tx.pulsar.go b/api/layer/reporter/tx.pulsar.go index 212d7a9aa..c88db3086 100644 --- a/api/layer/reporter/tx.pulsar.go +++ b/api/layer/reporter/tx.pulsar.go @@ -5077,6 +5077,9 @@ var ( md_MsgWithdrawTip protoreflect.MessageDescriptor fd_MsgWithdrawTip_selector_address protoreflect.FieldDescriptor fd_MsgWithdrawTip_validator_address protoreflect.FieldDescriptor + fd_MsgWithdrawTip_reporter_address protoreflect.FieldDescriptor + fd_MsgWithdrawTip_id protoreflect.FieldDescriptor + fd_MsgWithdrawTip_query_id protoreflect.FieldDescriptor ) func init() { @@ -5084,6 +5087,9 @@ func init() { md_MsgWithdrawTip = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTip") fd_MsgWithdrawTip_selector_address = md_MsgWithdrawTip.Fields().ByName("selector_address") fd_MsgWithdrawTip_validator_address = md_MsgWithdrawTip.Fields().ByName("validator_address") + fd_MsgWithdrawTip_reporter_address = md_MsgWithdrawTip.Fields().ByName("reporter_address") + fd_MsgWithdrawTip_id = md_MsgWithdrawTip.Fields().ByName("id") + fd_MsgWithdrawTip_query_id = md_MsgWithdrawTip.Fields().ByName("query_id") } var _ protoreflect.Message = (*fastReflection_MsgWithdrawTip)(nil) @@ -5163,6 +5169,24 @@ func (x *fastReflection_MsgWithdrawTip) Range(f func(protoreflect.FieldDescripto return } } + if x.ReporterAddress != "" { + value := protoreflect.ValueOfString(x.ReporterAddress) + if !f(fd_MsgWithdrawTip_reporter_address, value) { + return + } + } + if x.Id != uint64(0) { + value := protoreflect.ValueOfUint64(x.Id) + if !f(fd_MsgWithdrawTip_id, value) { + return + } + } + if len(x.QueryId) != 0 { + value := protoreflect.ValueOfBytes(x.QueryId) + if !f(fd_MsgWithdrawTip_query_id, value) { + return + } + } } // Has reports whether a field is populated. @@ -5182,6 +5206,12 @@ func (x *fastReflection_MsgWithdrawTip) Has(fd protoreflect.FieldDescriptor) boo return x.SelectorAddress != "" case "layer.reporter.MsgWithdrawTip.validator_address": return x.ValidatorAddress != "" + case "layer.reporter.MsgWithdrawTip.reporter_address": + return x.ReporterAddress != "" + case "layer.reporter.MsgWithdrawTip.id": + return x.Id != uint64(0) + case "layer.reporter.MsgWithdrawTip.query_id": + return len(x.QueryId) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5202,6 +5232,12 @@ func (x *fastReflection_MsgWithdrawTip) Clear(fd protoreflect.FieldDescriptor) { x.SelectorAddress = "" case "layer.reporter.MsgWithdrawTip.validator_address": x.ValidatorAddress = "" + case "layer.reporter.MsgWithdrawTip.reporter_address": + x.ReporterAddress = "" + case "layer.reporter.MsgWithdrawTip.id": + x.Id = uint64(0) + case "layer.reporter.MsgWithdrawTip.query_id": + x.QueryId = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5224,6 +5260,15 @@ func (x *fastReflection_MsgWithdrawTip) Get(descriptor protoreflect.FieldDescrip case "layer.reporter.MsgWithdrawTip.validator_address": value := x.ValidatorAddress return protoreflect.ValueOfString(value) + case "layer.reporter.MsgWithdrawTip.reporter_address": + value := x.ReporterAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.MsgWithdrawTip.id": + value := x.Id + return protoreflect.ValueOfUint64(value) + case "layer.reporter.MsgWithdrawTip.query_id": + value := x.QueryId + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5248,6 +5293,12 @@ func (x *fastReflection_MsgWithdrawTip) Set(fd protoreflect.FieldDescriptor, val x.SelectorAddress = value.Interface().(string) case "layer.reporter.MsgWithdrawTip.validator_address": x.ValidatorAddress = value.Interface().(string) + case "layer.reporter.MsgWithdrawTip.reporter_address": + x.ReporterAddress = value.Interface().(string) + case "layer.reporter.MsgWithdrawTip.id": + x.Id = value.Uint() + case "layer.reporter.MsgWithdrawTip.query_id": + x.QueryId = value.Bytes() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5272,6 +5323,12 @@ func (x *fastReflection_MsgWithdrawTip) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field selector_address of message layer.reporter.MsgWithdrawTip is not mutable")) case "layer.reporter.MsgWithdrawTip.validator_address": panic(fmt.Errorf("field validator_address of message layer.reporter.MsgWithdrawTip is not mutable")) + case "layer.reporter.MsgWithdrawTip.reporter_address": + panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgWithdrawTip is not mutable")) + case "layer.reporter.MsgWithdrawTip.id": + panic(fmt.Errorf("field id of message layer.reporter.MsgWithdrawTip is not mutable")) + case "layer.reporter.MsgWithdrawTip.query_id": + panic(fmt.Errorf("field query_id of message layer.reporter.MsgWithdrawTip is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5289,6 +5346,12 @@ func (x *fastReflection_MsgWithdrawTip) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "layer.reporter.MsgWithdrawTip.validator_address": return protoreflect.ValueOfString("") + case "layer.reporter.MsgWithdrawTip.reporter_address": + return protoreflect.ValueOfString("") + case "layer.reporter.MsgWithdrawTip.id": + return protoreflect.ValueOfUint64(uint64(0)) + case "layer.reporter.MsgWithdrawTip.query_id": + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) @@ -5366,6 +5429,17 @@ func (x *fastReflection_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.ReporterAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Id != 0 { + n += 1 + runtime.Sov(uint64(x.Id)) + } + l = len(x.QueryId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -5395,6 +5469,25 @@ func (x *fastReflection_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.QueryId) > 0 { + i -= len(x.QueryId) + copy(dAtA[i:], x.QueryId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryId))) + i-- + dAtA[i] = 0x2a + } + if x.Id != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Id)) + i-- + dAtA[i] = 0x20 + } + if len(x.ReporterAddress) > 0 { + i -= len(x.ReporterAddress) + copy(dAtA[i:], x.ReporterAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) + i-- + dAtA[i] = 0x1a + } if len(x.ValidatorAddress) > 0 { i -= len(x.ValidatorAddress) copy(dAtA[i:], x.ValidatorAddress) @@ -5522,6 +5615,91 @@ func (x *fastReflection_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { } x.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + x.Id = 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.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryId", 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.QueryId = append(x.QueryId[:0], dAtA[iNdEx:postIndex]...) + if x.QueryId == nil { + x.QueryId = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6369,6 +6547,9 @@ type MsgWithdrawTip struct { SelectorAddress string `protobuf:"bytes,1,opt,name=selector_address,json=selectorAddress,proto3" json:"selector_address,omitempty"` ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ReporterAddress string `protobuf:"bytes,3,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + Id uint64 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"` + QueryId []byte `protobuf:"bytes,5,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` } func (x *MsgWithdrawTip) Reset() { @@ -6405,6 +6586,27 @@ func (x *MsgWithdrawTip) GetValidatorAddress() string { return "" } +func (x *MsgWithdrawTip) GetReporterAddress() string { + if x != nil { + return x.ReporterAddress + } + return "" +} + +func (x *MsgWithdrawTip) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *MsgWithdrawTip) GetQueryId() []byte { + if x != nil { + return x.QueryId + } + return nil +} + // MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. type MsgWithdrawTipResponse struct { state protoimpl.MessageState @@ -6533,7 +6735,7 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0xbc, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, + 0xac, 0x02, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, @@ -6543,7 +6745,14 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x65, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9d, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, diff --git a/app/app.go b/app/app.go index 1c9c4ea5a..35f3eaa62 100644 --- a/app/app.go +++ b/app/app.go @@ -598,7 +598,7 @@ func New( app.ReporterKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - + app.ReporterKeeper.SetOracleKeeper(app.OracleKeeper) app.DisputeKeeper = disputemodulekeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[disputemoduletypes.StoreKey]), diff --git a/e2e/icq_test.go b/e2e/icq_test.go index 6e36300c3..a037195a7 100644 --- a/e2e/icq_test.go +++ b/e2e/icq_test.go @@ -67,8 +67,8 @@ func TestIbcInterchainQuery(t *testing.T) { NoHostMount: false, Images: []ibc.DockerImage{ { - Repository: "ghcr.io/akremstudy/layer-icq", // source code ibc branch - Version: "latest", + Repository: "layer-icq", // source code ibc branch + Version: "local", UidGid: "1025:1025", }, }, diff --git a/proto/layer/oracle/query_meta.proto b/proto/layer/oracle/query_meta.proto index b57a3fa6e..9c0953292 100644 --- a/proto/layer/oracle/query_meta.proto +++ b/proto/layer/oracle/query_meta.proto @@ -6,6 +6,7 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "amino/amino.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; @@ -32,3 +33,26 @@ message QueryMeta { // bool cycle list query bool cycle_list = 8; } + +message reward { + uint64 totalPower = 1; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // cycle_list indicates if a reward should also include timebasedRewards(tbr) + bool cycle_list = 3; + // if cyclist then tbr amount can be fetched by this height + uint64 block_height = 4; + string power_paid_out = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string amount_paid_out = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} \ No newline at end of file diff --git a/proto/layer/oracle/tx.proto b/proto/layer/oracle/tx.proto index 844a3d353..ce7b44775 100644 --- a/proto/layer/oracle/tx.proto +++ b/proto/layer/oracle/tx.proto @@ -46,7 +46,9 @@ message MsgSubmitValue { string value = 3; } -message MsgSubmitValueResponse {} +message MsgSubmitValueResponse { + uint64 id = 1; +} message MsgTip { option (cosmos.msg.v1.signer) = "tipper"; diff --git a/proto/layer/reporter/query.proto b/proto/layer/reporter/query.proto index 5e0b9090d..8538b8e2b 100644 --- a/proto/layer/reporter/query.proto +++ b/proto/layer/reporter/query.proto @@ -44,7 +44,7 @@ service Query { option (google.api.http).get = "/tellor-io/layer/reporter/space-available-by-reporter/{reporter_address}"; } // AvailableTips queries the tips available for withdrawal for a given selector. - rpc AvailableTips(QueryAvailableTipsRequest) returns (QueryAvailableTipsResponse) { + rpc AvailableTipsByQuery(QueryAvailableTipsRequest) returns (QueryAvailableTipsResponse) { option (google.api.http).get = "/tellor-io/layer/reporter/available-tips/{selector_address}"; } } @@ -155,6 +155,10 @@ message QuerySpaceAvailableByReporterResponse { message QueryAvailableTipsRequest { // selector address defines the address of the selector to query for. string selector_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string reporter_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string query_id = 3; + uint64 meta_id = 4; + } message QueryAvailableTipsResponse { diff --git a/proto/layer/reporter/tx.proto b/proto/layer/reporter/tx.proto index 7f3866c8e..133e0fdb7 100644 --- a/proto/layer/reporter/tx.proto +++ b/proto/layer/reporter/tx.proto @@ -134,6 +134,9 @@ message MsgWithdrawTip { option (cosmos.msg.v1.signer) = "selector_address"; string selector_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string reporter_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 id = 4; + bytes query_id = 5; } // MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. diff --git a/tests/e2e/edit_spec_test.go b/tests/e2e/edit_spec_test.go index 55aecb94d..de3538036 100644 --- a/tests/e2e/edit_spec_test.go +++ b/tests/e2e/edit_spec_test.go @@ -4,6 +4,7 @@ import ( "time" "github.com/tellor-io/layer/testutil" + "github.com/tellor-io/layer/utils" oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" oracletypes "github.com/tellor-io/layer/x/oracle/types" registrykeeper "github.com/tellor-io/layer/x/registry/keeper" @@ -127,7 +128,7 @@ func (s *E2ETestSuite) TestEditSpec() { QueryData: encodedDataSpec, Value: testutil.EncodeValue(5_000), } - _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) + res, err := oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) @@ -140,10 +141,13 @@ func (s *E2ETestSuite) TestEditSpec() { _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - + queryId := utils.QueryIDFromData(encodedDataSpec) msgWithdrawTip := reportertypes.MsgWithdrawTip{ SelectorAddress: valAccAddrs[0].String(), ValidatorAddress: valValAddrs[0].String(), + ReporterAddress: valAccAddrs[0].String(), + QueryId: queryId, + Id: res.Id, } _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) @@ -233,7 +237,7 @@ func (s *E2ETestSuite) TestEditSpec() { _, err = oracleMsgServer.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) - _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) + res, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) @@ -248,6 +252,7 @@ func (s *E2ETestSuite) TestEditSpec() { require.NoError(err) s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + msgWithdrawTip.Id = res.Id _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) @@ -285,7 +290,7 @@ func (s *E2ETestSuite) TestEditSpec() { require.NoError(err) require.Equal(proposal.ProposalId, uint64(2)) - _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) + res, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) @@ -300,6 +305,7 @@ func (s *E2ETestSuite) TestEditSpec() { require.NoError(err) s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + msgWithdrawTip.Id = res.Id _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index c64196993..3a4b782ea 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -29,7 +29,7 @@ import ( func (s *IntegrationTestSuite) TestTipping() { msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) - + ctx := s.Setup.Ctx addr := s.newKeysWithTokens() tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)) @@ -39,49 +39,49 @@ func (s *IntegrationTestSuite) TestTipping() { QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.Setup.Ctx, &msg) + _, err := msgServer.Tip(ctx, &msg) s.NoError(err) queryId := utils.QueryIDFromData(ethQueryData) - tips, err := s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) + tips, err := s.Setup.Oraclekeeper.GetQueryTip(ctx, queryId) s.NoError(err) s.Equal(tip.Sub(twoPercent).Amount, tips) - userTips, err := s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) + userTips, err := s.Setup.Oraclekeeper.GetUserTips(ctx, addr) s.NoError(err) s.Equal(userTips.Int64(), tips.Int64()) // tip same query again - _, err = msgServer.Tip(s.Setup.Ctx, &msg) + _, err = msgServer.Tip(ctx, &msg) s.NoError(err) - tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) + tips, err = s.Setup.Oraclekeeper.GetQueryTip(ctx, queryId) s.NoError(err) // tips should be 2x s.Equal(tip.Sub(twoPercent).Amount.Mul(math.NewInt(2)), tips) // total tips overall - userTips, err = s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) + userTips, err = s.Setup.Oraclekeeper.GetUserTips(ctx, addr) s.NoError(err) s.Equal(userTips, tips) // tip different query btcQueryId := utils.QueryIDFromData(btcQueryData) - _, err = msgServer.Tip(s.Setup.Ctx, &types.MsgTip{QueryData: btcQueryData, Tipper: addr.String(), Amount: tip}) + _, err = msgServer.Tip(ctx, &types.MsgTip{QueryData: btcQueryData, Tipper: addr.String(), Amount: tip}) s.NoError(err) - tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, btcQueryId) + tips, err = s.Setup.Oraclekeeper.GetQueryTip(ctx, btcQueryId) s.NoError(err) s.Equal(tip.Sub(twoPercent).Amount, tips) - userTips, err = s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) + userTips, err = s.Setup.Oraclekeeper.GetUserTips(ctx, addr) s.NoError(err) s.Equal(userTips, tips.Add(tips).Add(tips)) } func (s *IntegrationTestSuite) TestGetCurrentTip() { msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) - + ctx := s.Setup.Ctx addr := s.newKeysWithTokens() tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)) @@ -91,20 +91,21 @@ func (s *IntegrationTestSuite) TestGetCurrentTip() { QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.Setup.Ctx, &msg) + _, err := msgServer.Tip(ctx, &msg) s.NoError(err) // Get current tip queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - resp, err := queryServer.GetCurrentTip(s.Setup.Ctx, &types.QueryGetCurrentTipRequest{QueryData: hex.EncodeToString(ethQueryData)}) + resp, err := queryServer.GetCurrentTip(ctx, &types.QueryGetCurrentTipRequest{QueryData: hex.EncodeToString(ethQueryData)}) s.NoError(err) s.Equal(tip.Amount.Sub(twoPercent.Amount), resp.Tips) } // test tipping, reporting and allocation of rewards func (s *IntegrationTestSuite) TestTippingReporting() { - s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + ctx := s.Setup.Ctx + ctx = ctx.WithBlockTime(time.Now()) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) repAccs, _, _ := s.createValidatorAccs([]uint64{100, 200}) addr := s.newKeysWithTokens() @@ -116,49 +117,49 @@ func (s *IntegrationTestSuite) TestTippingReporting() { QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.Setup.Ctx, &msg) + _, err := msgServer.Tip(ctx, &msg) s.NoError(err) queryId := utils.QueryIDFromData(ethQueryData) - tips, err := s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) + tips, err := s.Setup.Oraclekeeper.GetQueryTip(ctx, queryId) s.NoError(err) s.Equal(tip.Sub(twoPercent).Amount, tips) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) value := testutil.EncodeValue(29266) reveal := report(repAccs[0].String(), value, ethQueryData) - query, _ := s.Setup.Oraclekeeper.CurrentQuery(s.Setup.Ctx, (queryId)) - _, err = msgServer.SubmitValue(s.Setup.Ctx, &reveal) + query, _ := s.Setup.Oraclekeeper.CurrentQuery(ctx, (queryId)) + _, err = msgServer.SubmitValue(ctx, &reveal) s.Nil(err) // advance time to expire the query and aggregate report - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal - err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(ctx) s.Nil(err) queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - res, err := queryServer.GetCurrentAggregateReport(s.Setup.Ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(queryId)}) + res, err := queryServer.GetCurrentAggregateReport(ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(queryId)}) s.Nil(err) - med, _ := s.Setup.Oraclekeeper.AggregateValue.Get(s.Setup.Ctx, query.Id) + med, _ := s.Setup.Oraclekeeper.AggregateValue.Get(ctx, query.Id) fmt.Println(med.Value, res.Aggregate.AggregateValue) s.Equal(res.Aggregate.AggregateReporter, repAccs[0].String()) // tip should be 0 after aggregated report - tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) + tips, err = s.Setup.Oraclekeeper.GetQueryTip(ctx, queryId) s.Nil(err) s.Equal(tips, math.ZeroInt()) - totalTips, err := s.Setup.Oraclekeeper.GetTotalTips(s.Setup.Ctx) + totalTips, err := s.Setup.Oraclekeeper.GetTotalTips(ctx) s.Nil(err) s.Equal(totalTips, tip.Sub(twoPercent).Amount) // total tips should be equal to the tipped amount minus 2% burned } func (s *IntegrationTestSuite) TestGetUserTipTotal() { msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) - + ctx := s.Setup.Ctx addr := s.newKeysWithTokens() tip := math.NewInt(1000) @@ -168,24 +169,24 @@ func (s *IntegrationTestSuite) TestGetUserTipTotal() { QueryData: ethQueryData, Amount: sdk.NewCoin(s.Setup.Denom, tip), } - _, err := msgServer.Tip(s.Setup.Ctx, &msg) + _, err := msgServer.Tip(ctx, &msg) s.NoError(err) queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) // Get current tip - resp, err := queryServer.GetUserTipTotal(s.Setup.Ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) + resp, err := queryServer.GetUserTipTotal(ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) s.NoError(err) s.Equal(resp.TotalTips, tip.Sub(twoPercent)) // Check total tips without a given query data - respUserTotal, err := queryServer.GetUserTipTotal(s.Setup.Ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) + respUserTotal, err := queryServer.GetUserTipTotal(ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) s.NoError(err) s.Equal(respUserTotal.TotalTips, tip.Sub(twoPercent)) } func (s *IntegrationTestSuite) TestSmallTip() { msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) - + ctx := s.Setup.Ctx addr := s.newKeysWithTokens() tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(10)) @@ -195,25 +196,26 @@ func (s *IntegrationTestSuite) TestSmallTip() { QueryData: ethQueryData, Amount: tip, } - accBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, addr, s.Setup.Denom) - modBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) - _, err := msgServer.Tip(s.Setup.Ctx, &msg) + accBalanceBefore := s.Setup.Bankkeeper.GetBalance(ctx, addr, s.Setup.Denom) + modBalanceBefore := s.Setup.Bankkeeper.GetBalance(ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) + _, err := msgServer.Tip(ctx, &msg) s.NoError(err) - accBalanceAfter := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, addr, s.Setup.Denom) - modBalanceAfter := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) + accBalanceAfter := s.Setup.Bankkeeper.GetBalance(ctx, addr, s.Setup.Denom) + modBalanceAfter := s.Setup.Bankkeeper.GetBalance(ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) s.Equal(accBalanceBefore.Amount.Sub(tip.Amount), accBalanceAfter.Amount) s.Equal(modBalanceBefore.Amount.Add(tip.Amount).Sub(twoPercent.Amount), modBalanceAfter.Amount) } func (s *IntegrationTestSuite) TestMedianReports() { - s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) + ctx := s.Setup.Ctx + ctx = ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) repAccs, _, _ := s.createValidatorAccs([]uint64{100, 200, 300, 400, 500}) tipper := s.newKeysWithTokens() for _, rep := range repAccs { - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, rep, reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, rep, reportertypes.NewSelection(rep, 1))) - _, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, rep, []byte{}) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, rep, reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, rep, reportertypes.NewSelection(rep, 1))) + _, err := s.Setup.Reporterkeeper.ReporterStake(ctx, rep, []byte{}) s.NoError(err) } reporters := []struct { @@ -259,7 +261,7 @@ func (s *IntegrationTestSuite) TestMedianReports() { power: 5, }, } - _, err := msgServer.Tip(s.Setup.Ctx, &types.MsgTip{Tipper: tipper.String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1000))}) + _, err := msgServer.Tip(ctx, &types.MsgTip{Tipper: tipper.String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1000))}) s.Nil(err) addr := make([]sdk.AccAddress, len(reporters)) for i, r := range reporters { @@ -267,26 +269,26 @@ func (s *IntegrationTestSuite) TestMedianReports() { // create reporter addr[r.reporterIndex] = repAccs[i] reveal := report(repAccs[i].String(), r.value, ethQueryData) - _, err = msgServer.SubmitValue(s.Setup.Ctx, &reveal) + _, err = msgServer.SubmitValue(ctx, &reveal) s.Nil(err) }) } // advance time to expire query and aggregate report - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 3) // bypass time to expire query so it can be aggregated + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) // bypass time to expire query so it can be aggregated - _, _ = s.Setup.App.EndBlocker(s.Setup.Ctx) - s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx)) + _, _ = s.Setup.App.EndBlocker(ctx) + s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(ctx)) // check median qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - res, err := queryServer.GetCurrentAggregateReport(s.Setup.Ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) + res, err := queryServer.GetCurrentAggregateReport(ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) s.Nil(err) expectedMedianReporterIndex := 4 expectedMedianReporter := addr[expectedMedianReporterIndex].String() s.Equal(expectedMedianReporter, res.Aggregate.AggregateReporter) s.Equal(reporters[expectedMedianReporterIndex].value, res.Aggregate.AggregateValue) - query, _ := s.Setup.Oraclekeeper.CurrentQuery(s.Setup.Ctx, qId) - med, _ := s.Setup.Oraclekeeper.AggregateValue.Get(s.Setup.Ctx, query.Id) + query, _ := s.Setup.Oraclekeeper.CurrentQuery(ctx, qId) + med, _ := s.Setup.Oraclekeeper.AggregateValue.Get(ctx, query.Id) fmt.Println(med.Value, res.Aggregate.AggregateValue) } @@ -300,9 +302,10 @@ func report(creator, value string, qdata []byte) types.MsgSubmitValue { } func (s *IntegrationTestSuite) TestGetCylceListQueries() { + ctx := s.Setup.Ctx accs, _, _ := s.createValidatorAccs([]uint64{100, 200, 300, 400, 500}) // Get supported queries - resp, err := s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) + resp, err := s.Setup.Oraclekeeper.GetCyclelist(ctx) s.NoError(err) s.Equal(resp, [][]byte{trbQueryData, ethQueryData, btcQueryData}) @@ -311,111 +314,105 @@ func (s *IntegrationTestSuite) TestGetCylceListQueries() { Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Cyclelist: [][]byte{matic}, } - proposal1, err := s.Setup.Govkeeper.SubmitProposal(s.Setup.Ctx, []sdk.Msg{msgContent}, "", "test", "description", accs[0], false) + proposal1, err := s.Setup.Govkeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "test", "description", accs[0], false) s.NoError(err) - govParams, err := s.Setup.Govkeeper.Params.Get(s.Setup.Ctx) + govParams, err := s.Setup.Govkeeper.Params.Get(ctx) s.NoError(err) - votingStarted, err := s.Setup.Govkeeper.AddDeposit(s.Setup.Ctx, proposal1.Id, accs[0], govParams.MinDeposit) + votingStarted, err := s.Setup.Govkeeper.AddDeposit(ctx, proposal1.Id, accs[0], govParams.MinDeposit) s.NoError(err) s.True(votingStarted) - proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusVotingPeriod) - err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[0], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(ctx, proposal1.Id, accs[0], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[1], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(ctx, proposal1.Id, accs[1], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[2], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(ctx, proposal1.Id, accs[2], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(ctx, proposal1.Id) s.NoError(err) - s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Hour * 24 * 2)) - s.NoError(gov.EndBlocker(s.Setup.Ctx, s.Setup.Govkeeper)) - proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(time.Hour * 24 * 2)) + s.NoError(gov.EndBlocker(ctx, s.Setup.Govkeeper)) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusPassed) - resp, err = s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) + resp, err = s.Setup.Oraclekeeper.GetCyclelist(ctx) s.NoError(err) s.Equal([][]byte{matic}, resp) } func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { + ctx := s.Setup.Ctx reporterPower := uint64(1) repAccs, valAddrs, _ := s.createValidatorAccs([]uint64{reporterPower}) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) qId := utils.QueryIDFromData(ethQueryData) - stake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0], qId) + stake, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[0], qId) s.NoError(err) // send timebasedrewards tokens to oracle module to pay reporters with tipper := s.newKeysWithTokens() reward := math.NewInt(100) - err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) s.NoError(err) // testing for a query id and check if the reporter gets the reward, bypassing the commit/reveal process value := []string{"000001"} reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0]}, value, []uint64{reporterPower}, qId) - s.NoError(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, collections.Join(qId, uint64(1)), types.QueryMeta{ + queryMetaId := uint64(1) + s.NoError(s.Setup.Oraclekeeper.Query.Set(ctx, collections.Join(qId, queryMetaId), types.QueryMeta{ Id: 1, HasRevealedReports: true, })) for _, r := range reports[:1] { - s.NoError(s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), uint64(1)), r)) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, 1, r)) - } - s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx)) - // aggregateReport, err := s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports[:1], 1) - // s.NoError(err) - // err = s.Setup.Oraclekeeper.SetAggregate(s.Setup.Ctx, aggregateReport) - // s.NoError(err) - queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - res, err := queryServer.GetCurrentAggregateReport(s.Setup.Ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) - s.NoError(err) + r.Cyclelist = true + s.NoError(s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), queryMetaId), r)) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, queryMetaId, r)) + } + s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(ctx)) - tbr, err := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, err := queryServer.GetCurrentAggregateReport(ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) s.NoError(err) - err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Aggregate, tbr.Reward.Amount, minttypes.TimeBasedRewards) - s.NoError(err) // advance height - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) - - tip, err := s.Setup.Reporterkeeper.SelectorTips.Get(s.Setup.Ctx, repAccs[0].Bytes()) - s.NoError(err) - s.Equal(tip.TruncateInt(), reward, "reporter should get the reward") + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) // withdraw the reward repServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) - _, err = repServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: repAccs[0].String(), ValidatorAddress: valAddrs[0].String()}) + _, err = repServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: repAccs[0].String(), ValidatorAddress: valAddrs[0].String(), + ReporterAddress: repAccs[0].String(), Id: res.Aggregate.MetaId, QueryId: res.Aggregate.QueryId, + }) s.NoError(err) - bond, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, repAccs[0]) + bond, err := s.Setup.Stakingkeeper.GetDelegatorBonded(ctx, repAccs[0]) s.NoError(err) s.Equal(stake.Add(reward), bond, "current balance should be equal to previous balance + reward") } func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { qId := utils.QueryIDFromData(ethQueryData) - + ctx := s.Setup.Ctx value := []string{"000001", "000002"} reporterPower1 := uint64(1) reporterPower2 := uint64(2) totalReporterPower := reporterPower1 + reporterPower2 repAccs, _, _ := s.createValidatorAccs([]uint64{reporterPower1, reporterPower2}) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) - reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0], qId) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) + reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[0], qId) s.NoError(err) - reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1], qId) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[1], qId) s.NoError(err) // send timebasedrewards tokens to oracle module to pay reporters with tipper := s.newKeysWithTokens() reward := math.NewInt(100) - err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) s.NoError(err) // generate 2 reports for ethQueryData reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1]}, value, []uint64{reporterPower1, reporterPower2}, qId) @@ -431,45 +428,39 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { name: "reporter with 1 voting power", reporterIndex: 0, beforeBalance: reporterStake, - afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalReporterPower, reward).TruncateInt(), + afterBalanceIncrease: reporterkeeper.CalculateRewardAmount(reporterPower1, totalReporterPower, reward).TruncateInt(), delegator: repAccs[0], }, { name: "reporter with 2 voting power", reporterIndex: 1, beforeBalance: reporterStake2, - afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalReporterPower, reward).TruncateInt(), + afterBalanceIncrease: reporterkeeper.CalculateRewardAmount(reporterPower2, totalReporterPower, reward).TruncateInt(), delegator: repAccs[1], }, } - s.NoError(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, collections.Join(qId, uint64(1)), types.QueryMeta{ + s.NoError(s.Setup.Oraclekeeper.Query.Set(ctx, collections.Join(qId, uint64(1)), types.QueryMeta{ Id: 1, HasRevealedReports: true, })) for _, r := range reports[:2] { - s.NoError(s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), uint64(1)), r)) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, 1, r)) - } - s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx)) - // aggregateReport, err := s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports, 1) - // s.NoError(err) - // err = s.Setup.Oraclekeeper.SetAggregate(s.Setup.Ctx, aggregateReport) - // s.NoError(err) - queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - res, err := queryServer.GetCurrentAggregateReport(s.Setup.Ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) - s.NoError(err, "error getting aggregated report") - tbr, err := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) - s.NoError(err, "error getting time based rewards") - err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Aggregate, tbr.Reward.Amount, minttypes.TimeBasedRewards) - s.NoError(err, "error allocating rewards") + r.Cyclelist = true + s.NoError(s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), uint64(1)), r)) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, 1, r)) + } + s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(ctx)) + reporterServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) // advance height - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - _, err = reporterServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String()}) + _, err = reporterServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String(), + ReporterAddress: tc.delegator.String(), Id: 1, QueryId: qId, + }) s.NoError(err) - afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, tc.delegator) + afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(ctx, tc.delegator) s.NoError(err) s.Equal(tc.beforeBalance.Add(tc.afterBalanceIncrease), afterBalance) }) @@ -479,90 +470,80 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { qId := utils.QueryIDFromData(ethQueryData) values := []string{"000001", "000002", "000003", "000004"} - + ctx := s.Setup.Ctx reporterPower1 := uint64(1) reporterPower2 := uint64(2) reporterPower3 := uint64(3) - totalPower := reporterPower1 + reporterPower2 + reporterPower3 + totalPower := uint64(12) repAccs, _, _ := s.createValidatorAccs([]uint64{reporterPower1, reporterPower2, reporterPower3}) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[2], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[2], reportertypes.NewSelection(repAccs[2], 1))) - reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0], qId) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[2], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[2], reportertypes.NewSelection(repAccs[2], 1))) + reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[0], qId) s.NoError(err) - reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1], qId) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[1], qId) s.NoError(err) - reporterStake3, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[2], qId) + reporterStake3, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[2], qId) s.NoError(err) tipper := s.newKeysWithTokens() reward := math.NewInt(100) - err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) s.NoError(err) // generate 4 reports for ethQueryData - reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1], repAccs[2]}, values, []uint64{reporterPower1, reporterPower2, reporterPower3}, qId) + reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1], repAccs[2]}, values, []uint64{2, 4, 6}, qId) testCases := []struct { name string - reporterIndex int beforeBalance math.Int afterBalanceIncrease math.Int delegator sdk.AccAddress }{ { name: "reporter with 100 voting power", - reporterIndex: 0, beforeBalance: reporterStake, - afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalPower, reward).TruncateInt(), + afterBalanceIncrease: reporterkeeper.CalculateRewardAmount(2, totalPower, reward).TruncateInt(), delegator: repAccs[0], }, { name: "reporter with 200 voting power", - reporterIndex: 1, beforeBalance: reporterStake2, - afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalPower, reward).TruncateInt(), + afterBalanceIncrease: reporterkeeper.CalculateRewardAmount(4, totalPower, reward).TruncateInt(), delegator: repAccs[1], }, { name: "reporter with 300 voting power", - reporterIndex: 2, beforeBalance: reporterStake3, - afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower3, 1, totalPower, reward).TruncateInt(), + afterBalanceIncrease: reporterkeeper.CalculateRewardAmount(6, totalPower, reward).TruncateInt(), delegator: repAccs[2], }, } - s.NoError(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, collections.Join(qId, uint64(1)), types.QueryMeta{ + s.NoError(s.Setup.Oraclekeeper.Query.Set(ctx, collections.Join(qId, uint64(1)), types.QueryMeta{ Id: 1, HasRevealedReports: true, })) for _, r := range reports[:3] { - s.NoError(s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), uint64(1)), r)) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, 1, r)) - } - s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx)) - // aggregateReport, err := s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports[:3], 1) - // s.NoError(err) - // err = s.Setup.Oraclekeeper.SetAggregate(s.Setup.Ctx, aggregateReport) - // s.NoError(err) - queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) - res, err := queryServer.GetCurrentAggregateReport(s.Setup.Ctx, &types.QueryGetCurrentAggregateReportRequest{QueryId: hex.EncodeToString(qId)}) - s.NoError(err) - tbr, err := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) - s.NoError(err) - err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Aggregate, tbr.Reward.Amount, minttypes.TimeBasedRewards) - s.NoError(err) + r.Cyclelist = true + s.NoError(s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(qId, sdk.MustAccAddressFromBech32(r.Reporter).Bytes(), uint64(1)), r)) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, 1, r)) + } + s.NoError(s.Setup.Oraclekeeper.SetAggregatedReport(ctx)) + // advance height - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) reporterServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - _, err = reporterServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String()}) + _, err = reporterServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String(), + ReporterAddress: tc.delegator.String(), QueryId: qId, Id: 1, + }) s.NoError(err) - afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, tc.delegator) + afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(ctx, tc.delegator) s.NoError(err) expectedAfterBalance := tc.beforeBalance.Add(tc.afterBalanceIncrease) tolerance := expectedAfterBalance.SubRaw(1) @@ -573,9 +554,14 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { } func (s *IntegrationTestSuite) TestTokenBridgeQuery() { - repAccs, _, _ := s.Setup.CreateValidators(5) - ok := s.Setup.Oraclekeeper ctx := s.Setup.Ctx + repAccs, valAddr, _ := s.Setup.CreateValidators(5) + ok := s.Setup.Oraclekeeper + m, err := s.Setup.Mintkeeper.Minter.Get(ctx) + s.NoError(err) + m.Initialized = true + s.NoError(s.Setup.Mintkeeper.Minter.Set(ctx, m)) + app := s.Setup.App msgServer := keeper.NewMsgServerImpl(ok) for _, rep := range repAccs { @@ -684,8 +670,14 @@ func (s *IntegrationTestSuite) TestTokenBridgeQuery() { agg, _, err = ok.GetCurrentAggregateReport(ctx, crypto.Keccak256(querydata)) s.NoError(err) - // s.Equal(len(agg.Reporters), 1) s.Equal(agg.AggregateReporter, reporter5.String()) + // msgwithdrawTips + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) + _, err = reporterMsgServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: reporter5.String(), ValidatorAddress: valAddr[0].String(), + ReporterAddress: reporter5.String(), QueryId: agg.QueryId, Id: agg.MetaId, + }) + s.NoError(err) } func (s *IntegrationTestSuite) TestTokenBridgeQueryDirectreveal() { @@ -803,17 +795,18 @@ func (s *IntegrationTestSuite) TestTokenBridgeQueryDirectreveal() { // test tipping a query id not in cycle list and observe the reporters' delegators stake increase in staking module func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { + ctx := s.Setup.Ctx require := s.Require() - s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) + ctx = ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) repAccs, valAddrs, _ := s.createValidatorAccs([]uint64{1000}) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) queryData, _ := utils.QueryBytesFromString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") queryId := utils.QueryIDFromData(queryData) - stakeAmount, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0], queryId) + stakeAmount, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[0], queryId) require.NoError(err) tipAmount := math.NewInt(1000) @@ -827,32 +820,32 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { QueryData: queryData, Amount: sdk.NewCoin(s.Setup.Denom, tipAmount), } - _, err = msgServer.Tip(s.Setup.Ctx, &msg) + _, err = msgServer.Tip(ctx, &msg) s.Nil(err) // check delegation shares before reporting, should be equal to the stake amount - delBefore, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, repAccs[0].Bytes(), valAddr) + delBefore, err := s.Setup.Stakingkeeper.Delegation(ctx, repAccs[0].Bytes(), valAddr) s.Nil(err) s.True(delBefore.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation shares should be equal to the stake amount") reporterPower := uint64(1) value := []string{"000001"} reports := testutil.GenerateReports(repAccs, value, []uint64{reporterPower}, queryId) - query, err := s.Setup.Oraclekeeper.CurrentQuery(s.Setup.Ctx, queryId) + query, err := s.Setup.Oraclekeeper.CurrentQuery(ctx, queryId) s.Nil(err) query.HasRevealedReports = true - s.Nil(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, collections.Join(queryId, query.Id), query)) - err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) + s.Nil(s.Setup.Oraclekeeper.Query.Set(ctx, collections.Join(queryId, query.Id), query)) + err = s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) s.Nil(err) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, query.Id, reports[0])) - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal - err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, query.Id, reports[0])) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(ctx) s.Nil(err) // check that tip is in escrow escrowAcct := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) require.NotNil(escrowAcct) - escrowBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) + escrowBalance := s.Setup.Bankkeeper.GetBalance(ctx, escrowAcct, s.Setup.Denom) require.NotNil(escrowBalance) twoPercent := sdk.NewCoin(s.Setup.Denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) @@ -860,32 +853,36 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { // create reporterMsgServer reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) // withdraw tip - _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: repAccs[0].String(), ValidatorAddress: valAddr.String()}) + _, err = reporterMsgServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: repAccs[0].String(), ValidatorAddress: valAddr.String(), + ReporterAddress: repAccs[0].String(), QueryId: queryId, Id: query.Id, + }) require.NoError(err) // delegation shares should increase after reporting and escrow balance should go back to 0 - delAfter, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, repAccs[0].Bytes(), valAddr) + delAfter, err := s.Setup.Stakingkeeper.Delegation(ctx, repAccs[0].Bytes(), valAddr) s.Nil(err) s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares plus the tip added") // 1000 - 2% tip - escrowBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) + escrowBalance = s.Setup.Bankkeeper.GetBalance(ctx, escrowAcct, s.Setup.Denom) s.True(escrowBalance.IsZero()) } func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { require := s.Require() + ctx := s.Setup.Ctx msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) repAccs, valAddrs, _ := s.createValidatorAccs([]uint64{1, 2}) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[0], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[0], reportertypes.NewSelection(repAccs[0], 1))) queryData, _ := utils.QueryBytesFromString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") queryId := utils.QueryIDFromData(queryData) - reporterStake1, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0], queryId) + reporterStake1, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[0], queryId) require.NoError(err) - s.NoError(s.Setup.Reporterkeeper.Reporters.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) - s.NoError(s.Setup.Reporterkeeper.Selectors.Set(s.Setup.Ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) - reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1], queryId) + s.NoError(s.Setup.Reporterkeeper.Reporters.Set(ctx, repAccs[1], reportertypes.NewReporter(reportertypes.DefaultMinCommissionRate, math.OneInt()))) + s.NoError(s.Setup.Reporterkeeper.Selectors.Set(ctx, repAccs[1], reportertypes.NewSelection(repAccs[1], 1))) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(ctx, repAccs[1], queryId) require.NoError(err) tipAmount := math.NewInt(1000) @@ -902,15 +899,15 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { QueryData: queryData, Amount: sdk.NewCoin(s.Setup.Denom, tipAmount), } - _, err = msgServer.Tip(s.Setup.Ctx, &msg) + _, err = msgServer.Tip(ctx, &msg) s.Nil(err) // check delegation shares before reporting, should be equal to the stake amount - del1Before, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator1.Bytes(), valAddr1) + del1Before, err := s.Setup.Stakingkeeper.Delegation(ctx, delegator1.Bytes(), valAddr1) s.Nil(err) s.True(del1Before.GetShares().Equal(math.LegacyNewDecFromInt(reporterStake1)), "delegation 1 shares should be equal to the stake amount") - del2Before, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator2.Bytes(), valAddr2) + del2Before, err := s.Setup.Stakingkeeper.Delegation(ctx, delegator2.Bytes(), valAddr2) s.Nil(err) s.True(del2Before.GetShares().Equal(math.LegacyNewDecFromInt(reporterStake2)), "delegation 2 shares should be equal to the stake amount") @@ -918,42 +915,50 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { reporterPower2 := uint64(2) value := []string{"000001", "000002"} reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1]}, value, []uint64{reporterPower, reporterPower2}, queryId) - query, err := s.Setup.Oraclekeeper.CurrentQuery(s.Setup.Ctx, queryId) + query, err := s.Setup.Oraclekeeper.CurrentQuery(ctx, queryId) s.Nil(err) query.HasRevealedReports = true - s.NoError(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, collections.Join(queryId, query.Id), query)) - err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) + s.NoError(s.Setup.Oraclekeeper.Query.Set(ctx, collections.Join(queryId, query.Id), query)) + err = s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) s.Nil(err) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, query.Id, reports[0])) - err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[1].Bytes(), query.Id), reports[1]) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, query.Id, reports[0])) + err = s.Setup.Oraclekeeper.Reports.Set(ctx, collections.Join3(queryId, repAccs[1].Bytes(), query.Id), reports[1]) s.Nil(err) - s.NoError(s.Setup.Oraclekeeper.AddReport(s.Setup.Ctx, query.Id, reports[1])) - s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal - err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) + s.NoError(s.Setup.Oraclekeeper.AddReport(ctx, query.Id, reports[1])) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(ctx) s.Nil(err) // check tip escrow account escrowAcct := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) require.NotNil(escrowAcct) - escrowBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) + escrowBalance := s.Setup.Bankkeeper.GetBalance(ctx, escrowAcct, s.Setup.Denom) require.NotNil(escrowBalance) twoPercent := sdk.NewCoin(s.Setup.Denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) // withdraw self delegation from tip escrow reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) - _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: delegator1.String(), ValidatorAddress: valAddr1.String()}) + _, err = reporterMsgServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: delegator1.String(), ValidatorAddress: valAddr1.String(), + ReporterAddress: delegator1.String(), QueryId: queryId, Id: query.Id, + }) require.NoError(err) // delegation shares should increase after reporting and withdrawing - del1After, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator1.Bytes(), valAddr1) + del1After, err := s.Setup.Stakingkeeper.Delegation(ctx, delegator1.Bytes(), valAddr1) s.Nil(err) s.True(del1After.GetShares().Equal(del1Before.GetShares().Add(math.LegacyNewDec(326))), "delegation 1 (self delegation) shares should be half the tip plus 50 percent commission") // withdraw del2 delegation from tip escrow - _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{SelectorAddress: delegator2.String(), ValidatorAddress: valAddr2.String()}) + _, err = reporterMsgServer.WithdrawTip(ctx, &reportertypes.MsgWithdrawTip{ + SelectorAddress: delegator2.String(), ValidatorAddress: valAddr2.String(), + ReporterAddress: delegator2.String(), QueryId: queryId, Id: query.Id, + }) require.NoError(err) - del2After, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator2.Bytes(), valAddr2) + del2After, err := s.Setup.Stakingkeeper.Delegation(ctx, delegator2.Bytes(), valAddr2) s.Nil(err) s.True(del2After.GetShares().Equal(del2Before.GetShares().Add(math.LegacyNewDec(653))), "delegation 2 shares should be half the tip minus 50 percent reporter commission") } + +// func (s IntegrationTestSuite) TestNewFlow diff --git a/tests/setup.go b/tests/setup.go index 2da51b531..3d22f0cfe 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -255,6 +255,7 @@ func (s *SharedSetup) SetupTest(t *testing.T) { require.NoError(t, err) s.Ctx = sdk.UnwrapSDKContext(app.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()})) s.Oraclekeeper.SetBridgeKeeper(s.Bridgekeeper) + s.Reporterkeeper.SetOracleKeeper(s.Oraclekeeper) s.require.NoError(err) s.fetchStoreKey = app.UnsafeFindStoreKey diff --git a/testutil/keeper/reporter.go b/testutil/keeper/reporter.go index 49e3a4656..2874fd780 100644 --- a/testutil/keeper/reporter.go +++ b/testutil/keeper/reporter.go @@ -24,7 +24,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -func ReporterKeeper(tb testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, sdk.Context, corestore.KVStoreService) { +func ReporterKeeper(tb testing.TB) (keeper.Keeper, *mocks.OracleKeeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, sdk.Context, corestore.KVStoreService) { tb.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) @@ -39,6 +39,7 @@ func ReporterKeeper(tb testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks. bk := new(mocks.BankKeeper) sk := new(mocks.StakingKeeper) rk := new(mocks.RegistryKeeper) + ok := new(mocks.OracleKeeper) storeservice := runtime.NewKVStoreService(storeKey) k := keeper.NewKeeper( cdc, @@ -49,12 +50,12 @@ func ReporterKeeper(tb testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks. bk, rk, ) - + k.SetOracleKeeper(ok) ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params err := k.Params.Set(ctx, types.DefaultParams()) require.NoError(tb, err) - return k, sk, bk, rk, ctx, storeservice + return k, ok, sk, bk, rk, ctx, storeservice } diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 5f76ac24a..5eb938f9c 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -7,10 +7,13 @@ import ( "fmt" "time" + minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/collections" "cosmossdk.io/collections/indexes" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -27,7 +30,10 @@ func (k Keeper) SetAggregatedReport(ctx context.Context) (err error) { // aggregate sdkCtx := sdk.UnwrapSDKContext(ctx) blockHeight := uint64(sdkCtx.BlockHeight()) - cyclist := make([]types.Aggregate, 0) + totalPowerTbr := uint64(0) + transferAmount := math.ZeroInt() + // does cyclist query exist + cyclelistQuery := false // rng for queries that have expired and have revealed reports // ranger is inclusive and descending rng := collections.NewPrefixUntilPairRange[collections.Pair[bool, uint64], collections.Pair[[]byte, uint64]](collections.Join(true, blockHeight)).Descending() @@ -47,7 +53,7 @@ func (k Keeper) SetAggregatedReport(ctx context.Context) (err error) { return err } if !fullKey.K1().K1() { - return nil + break } query, err := k.Query.Get(ctx, fullKey.K2()) if err != nil { @@ -58,22 +64,47 @@ func (k Keeper) SetAggregatedReport(ctx context.Context) (err error) { if err != nil { return err } + + tip := query.Amount + if tip.IsNil() { + tip = math.ZeroInt() + } + + reward := types.Reward{TotalPower: aggregateReport.AggregatePower, Amount: tip.ToLegacyDec(), CycleList: isCyclelist, BlockHeight: blockHeight} + err = k.reporterKeeper.AddTip(ctx, query.Id, reward) + if err != nil { + return err + } if !query.Amount.IsZero() { - err = k.AllocateRewards(ctx, &aggregateReport, query.Amount, types.ModuleName) - if err != nil { - return err - } + transferAmount = transferAmount.Add(query.Amount) } + // if the query is part of a cyclelist, allocate time-based rewards if isCyclelist { - cyclist = append(cyclist, aggregateReport) + cyclelistQuery = isCyclelist + totalPowerTbr += aggregateReport.AggregatePower } err = k.Query.Remove(ctx, fullKey.K2()) if err != nil { return err } } - return k.AllocateTBR(ctx, cyclist) + if transferAmount.IsPositive() { + return k.bankKeeper.SendCoinsFromModuleToModule( + ctx, types.ModuleName, reportertypes.TipsEscrowPool, sdk.NewCoins(sdk.NewCoin("loya", transferAmount)), + ) + } + + if !cyclelistQuery { + return nil + } + + tbrAmount := k.GetTimeBasedRewards(ctx) + err = k.reporterKeeper.AddTbr(ctx, blockHeight, types.Reward{Amount: tbrAmount.ToLegacyDec(), TotalPower: totalPowerTbr}) + + return k.bankKeeper.SendCoinsFromModuleToModule( + ctx, minttypes.TimeBasedRewards, reportertypes.TipsEscrowPool, sdk.NewCoins(sdk.NewCoin("loya", tbrAmount)), + ) } // SetAggregate increments the queryId's report index plus sets the timestamp and blockHeight and stores the aggregate report diff --git a/x/oracle/keeper/aggregate_test.go b/x/oracle/keeper/aggregate_test.go index 0578865ff..8bab1a8b0 100644 --- a/x/oracle/keeper/aggregate_test.go +++ b/x/oracle/keeper/aggregate_test.go @@ -135,7 +135,7 @@ func (s *KeeperTestSuite) TestSetAggregatedReport() { s.accountKeeper.On("GetModuleAccount", ctx, minttypes.TimeBasedRewards).Return(testModuleAccount) s.bankKeeper.On("GetBalance", mock.Anything, mock.Anything, layertypes.BondDenom).Return(sdk.Coin{Amount: math.NewInt(1 * 1e6)}) s.bankKeeper.On("SendCoinsFromModuleToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.reporterKeeper.On("DivvyingTips", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + s.reporterKeeper.On("AddTip", mock.Anything, mock.Anything, mock.Anything).Return(nil) s.reporterKeeper.On("AllocateTokensToReporter", mock.Anything, mock.Anything, mock.Anything).Return(nil) err = s.oracleKeeper.SetAggregatedReport(ctx) diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index 9f75fe3db..65afedccd 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -85,7 +85,7 @@ func (k msgServer) SubmitValue(ctx context.Context, msg *types.MsgSubmitValue) ( if err != nil { return nil, err } - return &types.MsgSubmitValueResponse{}, nil + return &types.MsgSubmitValueResponse{Id: query.Id}, nil } func (k Keeper) DirectReveal(ctx context.Context, diff --git a/x/oracle/keeper/msg_server_submit_value_test.go b/x/oracle/keeper/msg_server_submit_value_test.go index d5157fba6..6c74683db 100644 --- a/x/oracle/keeper/msg_server_submit_value_test.go +++ b/x/oracle/keeper/msg_server_submit_value_test.go @@ -66,7 +66,7 @@ func (s *KeeperTestSuite) TestSubmitValue() (sdk.AccAddress, []byte) { res, err := s.msgServer.SubmitValue(s.ctx, &submitreq) require.NoError(err) - require.Equal(&types.MsgSubmitValueResponse{}, res) + require.Equal(&types.MsgSubmitValueResponse{Id: 1}, res) report, err := s.queryClient.GetReportsbyQid(ctx, &types.QueryGetReportsbyQidRequest{QueryId: hex.EncodeToString(queryId)}) s.Nil(err) diff --git a/x/oracle/keeper/rewards.go b/x/oracle/keeper/rewards.go index d5cb274dc..bbb9cb479 100644 --- a/x/oracle/keeper/rewards.go +++ b/x/oracle/keeper/rewards.go @@ -2,13 +2,10 @@ package keeper import ( "context" - "fmt" - "sort" layer "github.com/tellor-io/layer/types" minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" - reportertypes "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/collections" "cosmossdk.io/math" @@ -16,170 +13,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ReportersReportCount struct { - Power uint64 - Reports uint64 - Height uint64 - queryId []byte -} -type ReporterInfo struct { - address string - data ReportersReportCount -} - -// AllocateRewards distributes rewards to reporters based on their power and number of reports. -// It calculates the reward amount for each reporter and allocates the rewards. -// Finally, it sends the allocated rewards to the apprppopriate module based on the source of the reward. -func (k Keeper) AllocateRewards(ctx context.Context, report *types.Aggregate, reward math.Int, fromPool string) error { - if reward.IsZero() { - return nil - } - // Initialize totalPower to keep track of the total power of all reporters. - totalPower := uint64(0) - // First pass: collect data in map - reportersMap := make(map[string]ReportersReportCount) - // Use a struct to hold reporter info - iter, err := k.Reports.Indexes.IdQueryId.MatchExact(ctx, collections.Join(report.MetaId, report.QueryId)) - if err != nil { - fmt.Println("error getting reports", err) - return err - } - - defer iter.Close() - for ; iter.Valid(); iter.Next() { - reporterk, err := iter.PrimaryKey() - if err != nil { - return err - } - report, err := k.Reports.Get(ctx, reporterk) - if err != nil { - return err - } - reporter, found := reportersMap[report.Reporter] - if found { - fmt.Println("found reporter", reporter) - reporter.Reports++ - } else { - reporter = ReportersReportCount{ - Power: report.Power, - Reports: 1, - Height: report.BlockNumber, - queryId: report.QueryId, - } - } - reportersMap[report.Reporter] = reporter - totalPower += report.Power - } - sortedReporters := make([]ReporterInfo, 0, len(reportersMap)) - for addr, data := range reportersMap { - sortedReporters = append(sortedReporters, ReporterInfo{ - address: addr, - data: data, - }) - } - - // Sort by address for deterministic ordering - sort.Slice(sortedReporters, func(i, j int) bool { - return sortedReporters[i].address < sortedReporters[j].address - }) - return k.Allocate(ctx, sortedReporters, totalPower, reward, fromPool) -} - -func (k Keeper) AllocateTBR(ctx context.Context, reports []types.Aggregate) error { - if len(reports) == 0 { - return nil - } - - totalPower := uint64(0) - reportersMap := make(map[string]ReportersReportCount) - - for _, aggRep := range reports { - iter, err := k.Reports.Indexes.IdQueryId.MatchExact(ctx, collections.Join(aggRep.MetaId, aggRep.QueryId)) - if err != nil { - return err - } - - defer iter.Close() - for ; iter.Valid(); iter.Next() { - reporterk, err := iter.PrimaryKey() - if err != nil { - return err - } - report, err := k.Reports.Get(ctx, reporterk) - if err != nil { - return err - } - reporter, found := reportersMap[report.Reporter] - if found { - fmt.Println("found reporter", reporter) - reporter.Reports++ - } else { - reporter = ReportersReportCount{ - Power: report.Power, - Reports: 1, - Height: report.BlockNumber, - queryId: report.QueryId, - } - } - reportersMap[report.Reporter] = reporter - totalPower += report.Power - } - sortedReporters := make([]ReporterInfo, 0, len(reportersMap)) - for addr, data := range reportersMap { - sortedReporters = append(sortedReporters, ReporterInfo{ - address: addr, - data: data, - }) - } - - // Sort by address for deterministic ordering - sort.Slice(sortedReporters, func(i, j int) bool { - return sortedReporters[i].address < sortedReporters[j].address - }) - tbr := k.GetTimeBasedRewards(ctx) - err = k.Allocate(ctx, sortedReporters, totalPower, tbr, minttypes.TimeBasedRewards) - if err != nil { - return err - } - } - return nil -} - -func (k Keeper) Allocate(ctx context.Context, sortedReporters []ReporterInfo, totalPower uint64, reward math.Int, fromPool string) error { - // Process rewards in deterministic order - totaldist := math.LegacyZeroDec() - for i, reporter := range sortedReporters { - amount := CalculateRewardAmount( - reporter.data.Power, - reporter.data.Reports, - totalPower, - // reward is in loya - reward, - ) - totaldist = totaldist.Add(amount) - - reporterAddr, err := sdk.AccAddressFromBech32(reporter.address) - if err != nil { - return err - } - - // final reporter gets total reward - total distributed so far - if i == len(sortedReporters)-1 { - amount = amount.Add(math.LegacyNewDecFromInt(reward).Sub(totaldist)) - } - - err = k.AllocateTip(ctx, reporterAddr.Bytes(), reporter.data.queryId, amount, reporter.data.Height) - if err != nil { - return err - } - } - - return k.bankKeeper.SendCoinsFromModuleToModule( - ctx, - fromPool, - reportertypes.TipsEscrowPool, - sdk.NewCoins(sdk.NewCoin(layer.BondDenom, reward)), - ) +func (k Keeper) MicroReport(ctx context.Context, key collections.Triple[[]byte, []byte, uint64]) (types.MicroReport, error) { + return k.Reports.Get(ctx, key) } func (k Keeper) GetTimeBasedRewards(ctx context.Context) math.Int { @@ -191,19 +26,3 @@ func (k Keeper) GetTimeBasedRewards(ctx context.Context) math.Int { func (k Keeper) GetTimeBasedRewardsAccount(ctx context.Context) sdk.ModuleAccountI { return k.accountKeeper.GetModuleAccount(ctx, minttypes.TimeBasedRewards) } - -func CalculateRewardAmount(reporterPower, reportsCount, totalPower uint64, reward math.Int) math.LegacyDec { - rPower := math.LegacyNewDec(int64(reporterPower)) - rcount := math.LegacyNewDec(int64(reportsCount)) - tPower := math.LegacyNewDec(int64(totalPower)) - - power := rPower.Mul(rcount) - // reward is in loya - // amount = (power/TotalPower) * reward - amount := power.Quo(tPower).Mul(reward.ToLegacyDec()) - return amount -} - -func (k Keeper) AllocateTip(ctx context.Context, addr, queryId []byte, amount math.LegacyDec, height uint64) error { - return k.reporterKeeper.DivvyingTips(ctx, addr, amount, queryId, height) -} diff --git a/x/oracle/keeper/rewards_test.go b/x/oracle/keeper/rewards_test.go index 455047c82..09efb951c 100644 --- a/x/oracle/keeper/rewards_test.go +++ b/x/oracle/keeper/rewards_test.go @@ -1,13 +1,8 @@ package keeper_test import ( - "testing" - - "github.com/stretchr/testify/require" "github.com/tellor-io/layer/testutil/sample" minttypes "github.com/tellor-io/layer/x/mint/types" - "github.com/tellor-io/layer/x/oracle/keeper" - "github.com/tellor-io/layer/x/oracle/types" "cosmossdk.io/math" @@ -15,127 +10,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) -var reward = math.NewInt(100) - -func TestCalculateRewardAmount(t *testing.T) { - testCases := []struct { - name string - reporter []keeper.ReportersReportCount - reporterPowers []uint64 - totalPower uint64 - reportsCount uint64 - expectedAmount []math.LegacyDec - }{ - { - name: "Test all reporters report", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, - expectedAmount: []math.LegacyDec{math.LegacyNewDec(10), math.LegacyNewDec(20), math.LegacyNewDec(30), math.LegacyNewDec(40)}, - totalPower: 100, // 40 + 30 + 20 + 10 - - }, - { - name: "only 1 reports", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 0}, {Power: 40, Reports: 0}}, - expectedAmount: []math.LegacyDec{math.LegacyNewDec(100), math.LegacyNewDec(0), math.LegacyNewDec(0), math.LegacyNewDec(0)}, - totalPower: 10, - }, - { - name: "only 1 and 3 reports one report, a single queryId", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 1}, {Power: 40, Reports: 0}}, - expectedAmount: []math.LegacyDec{math.LegacyNewDec(25), math.LegacyNewDec(0), math.LegacyNewDec(75), math.LegacyNewDec(0)}, - totalPower: 40, // 30 + 10 - }, - { - name: "all reporters report, a two queryIds", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 2}, {Power: 30, Reports: 2}, {Power: 40, Reports: 2}}, - expectedAmount: []math.LegacyDec{math.LegacyNewDec(10), math.LegacyNewDec(20), math.LegacyNewDec(30), math.LegacyNewDec(40)}, - totalPower: 200, - }, - { - name: "all reporters report single, and 1 reports two queryIds", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, - expectedAmount: []math.LegacyDec{ - // power*reports/totalPower*reward - math.LegacyNewDec(10 * 2).Quo(math.LegacyNewDec(110)).Mul(math.LegacyNewDec(100)), - math.LegacyNewDec(20).Quo(math.LegacyNewDec(110)).Mul(math.LegacyNewDec(100)), - math.LegacyNewDec(30).Quo(math.LegacyNewDec(110)).Mul(math.LegacyNewDec(100)), - math.LegacyNewDec(40).Quo(math.LegacyNewDec(110)).Mul(math.LegacyNewDec(100)), - }, - totalPower: 110, // 40 + 30 + 20 + (10 * 2) - }, - { - name: "all reporters report single, 1 and 3 report a second queryId", - reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 2}, {Power: 40, Reports: 1}}, - expectedAmount: []math.LegacyDec{ - math.LegacyMustNewDecFromStr("14.285714285714285700"), - math.LegacyMustNewDecFromStr("14.285714285714285700"), - math.LegacyMustNewDecFromStr("42.857142857142857100"), - math.LegacyMustNewDecFromStr("28.571428571428571400"), - }, - totalPower: 140, // 40 + (30 * 2) + 20 + (10 * 2) - }, - } - for _, tc := range testCases { - expectedTotalReward := math.LegacyZeroDec() - totaldist := math.LegacyZeroDec() - t.Run(tc.name, func(t *testing.T) { - for i, r := range tc.reporter { - amount := keeper.CalculateRewardAmount(r.Power, r.Reports, tc.totalPower, reward) - totaldist = totaldist.Add(amount) - require.Equal(t, amount, tc.expectedAmount[i]) - if i == len(tc.reporter)-1 { - amount = amount.Add(math.LegacyNewDecFromInt(reward).Sub(totaldist)) - } - expectedTotalReward = expectedTotalReward.Add(amount) - - } - }) - require.True(t, expectedTotalReward.Equal(math.LegacyNewDecFromInt(reward)), "reward amount should be within tolerance") - } -} - -func (s *KeeperTestSuite) TestAllocateRewards() { - require := s.Require() - k := s.oracleKeeper - bk := s.bankKeeper - rk := s.reporterKeeper - ctx := s.ctx - - // zero reward - reports := types.Aggregate{} - reward := math.ZeroInt() - require.NoError(k.AllocateRewards(ctx, &reports, reward, types.ModuleName)) - // todo: remove this or change to a different test since bad addresses are not allowed and don't make it this far - // 2 reporters, bad addresses - // reporters := types.Aggregate{ - // QueryId: []byte{}, - // Reporters: []*types.AggregateReporter{ - // {Reporter: "bad address", Power: 10, BlockNumber: 0}, - // {Reporter: "bad address", Power: 10, BlockNumber: 0}, - // }, - // } - // reward = math.NewInt(100) - // require.Error(k.AllocateRewards(ctx, &reporters, reward, types.ModuleName)) - - // 2 reporters, good addresses - rep1 := sample.AccAddress() - rep2 := sample.AccAddress() - reporters := types.Aggregate{ - QueryId: []byte{}, - } - - reward = math.NewInt(100) - rep1Addr, err := sdk.AccAddressFromBech32(rep1) - require.NoError(err) - rep2Addr, err := sdk.AccAddressFromBech32(rep2) - require.NoError(err) - - rk.On("DivvyingTips", ctx, rep1Addr, math.LegacyNewDec(50), []byte{}, uint64(0)).Return(nil).Once() - rk.On("DivvyingTips", ctx, rep2Addr, math.LegacyNewDec(50), []byte{}, uint64(0)).Return(nil).Once() - bk.On("SendCoinsFromModuleToModule", ctx, "oracle", "tips_escrow_pool", sdk.NewCoins(sdk.NewCoin("loya", reward))).Return(nil) - require.NoError(k.AllocateRewards(ctx, &reporters, reward, types.ModuleName)) -} - func (s *KeeperTestSuite) TestGetTimeBasedRewards() { require := s.Require() k := s.oracleKeeper @@ -173,16 +47,3 @@ func (s *KeeperTestSuite) TestGetTimeBasedRewardsAccount() { ak.On("GetModuleAccount", ctx, minttypes.TimeBasedRewards).Return(sdk.ModuleAccountI(testModuleAccount)).Once() require.Equal(k.GetTimeBasedRewardsAccount(ctx), testModuleAccount) } - -// TODO: add scenarios -func (s *KeeperTestSuite) TestAllocateTips() { - require := s.Require() - k := s.oracleKeeper - rk := s.reporterKeeper - ctx := s.ctx - - addr := sample.AccAddressBytes() - amount := math.LegacyNewDec(100) - rk.On("DivvyingTips", ctx, addr, amount, []byte{}, uint64(ctx.BlockHeight())).Return(nil).Once() - require.NoError(k.AllocateTip(ctx, addr, []byte{}, amount, uint64(ctx.BlockHeight()))) -} diff --git a/x/oracle/mocks/ReporterKeeper.go b/x/oracle/mocks/ReporterKeeper.go index d94154314..1f07bc2c4 100644 --- a/x/oracle/mocks/ReporterKeeper.go +++ b/x/oracle/mocks/ReporterKeeper.go @@ -6,10 +6,11 @@ import ( context "context" math "cosmossdk.io/math" + cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" mock "github.com/stretchr/testify/mock" - types "github.com/cosmos/cosmos-sdk/types" + types "github.com/tellor-io/layer/x/oracle/types" ) // ReporterKeeper is an autogenerated mock type for the ReporterKeeper type @@ -17,13 +18,27 @@ type ReporterKeeper struct { mock.Mock } -// DivvyingTips provides a mock function with given fields: ctx, reporterAddr, reward, queryId, height -func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.AccAddress, reward math.LegacyDec, queryId []byte, height uint64) error { - ret := _m.Called(ctx, reporterAddr, reward, queryId, height) +// AddTbr provides a mock function with given fields: ctx, metaId, tbr +func (_m *ReporterKeeper) AddTbr(ctx context.Context, metaId uint64, tbr types.Reward) error { + ret := _m.Called(ctx, metaId, tbr) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.LegacyDec, []byte, uint64) error); ok { - r0 = rf(ctx, reporterAddr, reward, queryId, height) + if rf, ok := ret.Get(0).(func(context.Context, uint64, types.Reward) error); ok { + r0 = rf(ctx, metaId, tbr) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AddTip provides a mock function with given fields: ctx, metaId, tip +func (_m *ReporterKeeper) AddTip(ctx context.Context, metaId uint64, tip types.Reward) error { + ret := _m.Called(ctx, metaId, tip) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, types.Reward) error); ok { + r0 = rf(ctx, metaId, tip) } else { r0 = ret.Error(0) } @@ -32,21 +47,21 @@ func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.A } // ReporterStake provides a mock function with given fields: ctx, repAddress, queryId -func (_m *ReporterKeeper) ReporterStake(ctx context.Context, repAddress types.AccAddress, queryId []byte) (math.Int, error) { +func (_m *ReporterKeeper) ReporterStake(ctx context.Context, repAddress cosmos_sdktypes.AccAddress, queryId []byte) (math.Int, error) { ret := _m.Called(ctx, repAddress, queryId) var r0 math.Int var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, []byte) (math.Int, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, []byte) (math.Int, error)); ok { return rf(ctx, repAddress, queryId) } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, []byte) math.Int); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, []byte) math.Int); ok { r0 = rf(ctx, repAddress, queryId) } else { r0 = ret.Get(0).(math.Int) } - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, []byte) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, []byte) error); ok { r1 = rf(ctx, repAddress, queryId) } else { r1 = ret.Error(1) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 12c27b50f..ce58d364b 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -39,7 +39,8 @@ type RegistryKeeper interface { type ReporterKeeper interface { // Methods imported from reporter should be defined here ReporterStake(ctx context.Context, repAddress sdk.AccAddress, queryId []byte) (math.Int, error) - DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.LegacyDec, queryId []byte, height uint64) error + AddTip(ctx context.Context, metaId uint64, tip Reward) error + AddTbr(ctx context.Context, metaId uint64, tbr Reward) error } type RegistryHooks interface { diff --git a/x/oracle/types/query_meta.pb.go b/x/oracle/types/query_meta.pb.go index 6a262cda4..8cf9e8da9 100644 --- a/x/oracle/types/query_meta.pb.go +++ b/x/oracle/types/query_meta.pb.go @@ -7,6 +7,7 @@ import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/protobuf/types/known/durationpb" @@ -129,40 +130,114 @@ func (m *QueryMeta) GetCycleList() bool { return false } +type Reward struct { + TotalPower uint64 `protobuf:"varint,1,opt,name=totalPower,proto3" json:"totalPower,omitempty"` + Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` + // cycle_list indicates if a reward should also include timebasedRewards(tbr) + CycleList bool `protobuf:"varint,3,opt,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + // if cyclist then tbr amount can be fetched by this height + BlockHeight uint64 `protobuf:"varint,4,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + PowerPaidOut cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=power_paid_out,json=powerPaidOut,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"power_paid_out"` + AmountPaidOut cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=amount_paid_out,json=amountPaidOut,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount_paid_out"` +} + +func (m *Reward) Reset() { *m = Reward{} } +func (m *Reward) String() string { return proto.CompactTextString(m) } +func (*Reward) ProtoMessage() {} +func (*Reward) Descriptor() ([]byte, []int) { + return fileDescriptor_072f14e329c22246, []int{1} +} +func (m *Reward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Reward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Reward.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 *Reward) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reward.Merge(m, src) +} +func (m *Reward) XXX_Size() int { + return m.Size() +} +func (m *Reward) XXX_DiscardUnknown() { + xxx_messageInfo_Reward.DiscardUnknown(m) +} + +var xxx_messageInfo_Reward proto.InternalMessageInfo + +func (m *Reward) GetTotalPower() uint64 { + if m != nil { + return m.TotalPower + } + return 0 +} + +func (m *Reward) GetCycleList() bool { + if m != nil { + return m.CycleList + } + return false +} + +func (m *Reward) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + func init() { proto.RegisterType((*QueryMeta)(nil), "layer.oracle.QueryMeta") + proto.RegisterType((*Reward)(nil), "layer.oracle.reward") } func init() { proto.RegisterFile("layer/oracle/query_meta.proto", fileDescriptor_072f14e329c22246) } var fileDescriptor_072f14e329c22246 = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0xc1, 0x6e, 0xd4, 0x30, - 0x10, 0x86, 0x37, 0x4b, 0x59, 0xba, 0x56, 0xc5, 0x21, 0x2a, 0x22, 0xac, 0xd4, 0xec, 0x8a, 0xd3, - 0x22, 0xd4, 0x04, 0x89, 0x23, 0xb7, 0x2d, 0x97, 0x4a, 0x70, 0x20, 0x20, 0x21, 0x71, 0xb1, 0xbc, - 0xce, 0x90, 0xb5, 0xea, 0x64, 0x8c, 0x3d, 0xa1, 0xcd, 0x5b, 0xf0, 0x30, 0x3c, 0x44, 0x0f, 0x1c, - 0x2a, 0x4e, 0x88, 0x43, 0x85, 0x76, 0x5f, 0x04, 0xc5, 0xce, 0x0a, 0xd4, 0x9b, 0xe7, 0xff, 0x7e, - 0x7b, 0x7e, 0x6b, 0x86, 0x9d, 0x68, 0xd1, 0x81, 0x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, 0xbf, - 0x60, 0xc7, 0x1b, 0xe1, 0xb8, 0x85, 0xaf, 0x20, 0x34, 0x94, 0xdc, 0x82, 0x41, 0x4b, 0x2e, 0xb9, - 0xbf, 0x88, 0x96, 0x87, 0x45, 0xbc, 0x11, 0xae, 0x18, 0x50, 0x11, 0x48, 0x7c, 0xc2, 0x58, 0x98, - 0x42, 0x29, 0x48, 0x24, 0x93, 0x45, 0xb4, 0x3c, 0x2a, 0xa6, 0x5e, 0x79, 0x2d, 0x48, 0xfc, 0xc3, - 0xd4, 0x19, 0x48, 0x1e, 0xf4, 0xdf, 0x1e, 0xf0, 0x87, 0xce, 0x40, 0x8f, 0x65, 0x27, 0x35, 0x70, - 0xad, 0x1c, 0x25, 0x87, 0xbe, 0xcb, 0xd4, 0x2b, 0x6f, 0x94, 0xa3, 0xd5, 0xd9, 0xf5, 0x36, 0x8d, - 0x6e, 0xb6, 0x69, 0xf4, 0x67, 0x9b, 0x46, 0xdf, 0x76, 0xe9, 0xe8, 0x66, 0x97, 0x8e, 0x7e, 0xed, - 0xd2, 0xd1, 0xa7, 0x67, 0x95, 0xa2, 0x4d, 0xbb, 0xce, 0x24, 0xd6, 0x39, 0x81, 0xd6, 0x68, 0x4f, - 0x15, 0xe6, 0x61, 0x39, 0xae, 0xf6, 0xeb, 0xd1, 0xf7, 0x74, 0xeb, 0x89, 0x1f, 0xcd, 0xcb, 0xbf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x0a, 0x9a, 0x7a, 0x3b, 0x02, 0x00, 0x00, + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, + 0x1c, 0xc6, 0x9b, 0x6e, 0x94, 0xd5, 0x94, 0x21, 0xac, 0x21, 0xc2, 0xd0, 0xb2, 0xb2, 0x53, 0x11, + 0x5a, 0x03, 0xe2, 0xc8, 0xad, 0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 0xc2, 0xcf, 0x19, 0xa6, + 0xc3, 0x49, 0x81, 0xdf, 0xbf, 0xee, 0x13, 0xbb, 0x8d, 0x49, 0x81, 0x81, 0xfd, 0x94, 0x7a, 0x84, + 0xc0, 0x69, 0xc9, 0x4d, 0x54, 0x77, 0x4d, 0x9b, 0x2f, 0x29, 0xf4, 0x05, 0xd9, 0x96, 0x90, 0x70, + 0x85, 0xb2, 0x0e, 0x55, 0x09, 0x51, 0x38, 0xcd, 0x44, 0x74, 0x12, 0xce, 0x78, 0x11, 0x8b, 0x99, + 0xbb, 0xae, 0xe7, 0xef, 0x5f, 0x4e, 0xbc, 0x2d, 0x21, 0x1a, 0x35, 0xfc, 0x58, 0x63, 0xfa, 0x94, + 0x6c, 0xa5, 0x4c, 0x85, 0x12, 0x3e, 0x03, 0xcb, 0x20, 0x0e, 0x25, 0x94, 0x42, 0xa2, 0x72, 0x6f, + 0xf4, 0x9d, 0xc1, 0x46, 0x40, 0x53, 0xa6, 0x02, 0x8b, 0x02, 0x43, 0xe8, 0x0e, 0x21, 0xe6, 0x60, + 0x62, 0x86, 0xcc, 0xed, 0xf4, 0x9d, 0x41, 0x2f, 0xe8, 0x6a, 0x65, 0xcc, 0x90, 0x5d, 0x61, 0xac, + 0x4b, 0x70, 0x6f, 0x36, 0xdb, 0xb6, 0xf8, 0x5d, 0x5d, 0x42, 0x83, 0xa3, 0x3a, 0xca, 0x20, 0xcc, + 0xb8, 0x42, 0x77, 0x43, 0xff, 0xa5, 0xab, 0x95, 0x43, 0xae, 0x70, 0xef, 0x77, 0x9b, 0x74, 0x24, + 0xcc, 0x98, 0x8c, 0x9b, 0x6d, 0xa3, 0x40, 0x96, 0x1d, 0x89, 0x19, 0x48, 0xdb, 0xe9, 0x92, 0x42, + 0x27, 0x2b, 0xdd, 0x3e, 0xb3, 0xdd, 0x3e, 0xfc, 0xbf, 0xdb, 0x43, 0x48, 0x58, 0x54, 0x8f, 0x21, + 0x5a, 0x6a, 0x78, 0x0c, 0xd1, 0xdf, 0x86, 0xff, 0x0d, 0xb5, 0xb6, 0x12, 0x8a, 0x3e, 0x22, 0x3d, + 0x53, 0x69, 0x0a, 0x3c, 0x49, 0xd1, 0x56, 0x7a, 0x4b, 0x6b, 0x2f, 0xb5, 0x44, 0x8f, 0xc9, 0x66, + 0xd9, 0xa4, 0x0a, 0x4b, 0xc6, 0xe3, 0x50, 0x54, 0xa8, 0x0b, 0xbc, 0x56, 0xa8, 0x9e, 0x36, 0x3a, + 0x62, 0x3c, 0x7e, 0x5d, 0x21, 0x7d, 0x4f, 0xee, 0x98, 0x90, 0x57, 0xce, 0x9d, 0xeb, 0x3a, 0xdf, + 0x36, 0x4e, 0xd6, 0x7a, 0x74, 0x70, 0x36, 0xf7, 0x9c, 0xf3, 0xb9, 0xe7, 0xfc, 0x9a, 0x7b, 0xce, + 0x97, 0x85, 0xd7, 0x3a, 0x5f, 0x78, 0xad, 0x1f, 0x0b, 0xaf, 0xf5, 0xe1, 0x71, 0xc2, 0x31, 0xad, + 0xa6, 0xc3, 0x48, 0xe4, 0x3e, 0x42, 0x96, 0x09, 0xb9, 0xcf, 0x85, 0x6f, 0xee, 0xe6, 0xe9, 0xe5, + 0xed, 0x6c, 0xce, 0x57, 0x4d, 0x3b, 0xfa, 0x1a, 0x3c, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x12, + 0xd6, 0x2c, 0xdb, 0xba, 0x03, 0x00, 0x00, } func (m *QueryMeta) Marshal() (dAtA []byte, err error) { @@ -247,6 +322,79 @@ func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Reward) 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 *Reward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Reward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.AmountPaidOut.Size() + i -= size + if _, err := m.AmountPaidOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQueryMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.PowerPaidOut.Size() + i -= size + if _, err := m.PowerPaidOut.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQueryMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.BlockHeight != 0 { + i = encodeVarintQueryMeta(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x20 + } + if m.CycleList { + i-- + if m.CycleList { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQueryMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.TotalPower != 0 { + i = encodeVarintQueryMeta(dAtA, i, uint64(m.TotalPower)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQueryMeta(dAtA []byte, offset int, v uint64) int { offset -= sovQueryMeta(v) base := offset @@ -292,6 +440,30 @@ func (m *QueryMeta) Size() (n int) { return n } +func (m *Reward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TotalPower != 0 { + n += 1 + sovQueryMeta(uint64(m.TotalPower)) + } + l = m.Amount.Size() + n += 1 + l + sovQueryMeta(uint64(l)) + if m.CycleList { + n += 2 + } + if m.BlockHeight != 0 { + n += 1 + sovQueryMeta(uint64(m.BlockHeight)) + } + l = m.PowerPaidOut.Size() + n += 1 + l + sovQueryMeta(uint64(l)) + l = m.AmountPaidOut.Size() + n += 1 + l + sovQueryMeta(uint64(l)) + return n +} + func sovQueryMeta(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -545,6 +717,216 @@ func (m *QueryMeta) Unmarshal(dAtA []byte) error { } return nil } +func (m *Reward) 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 ErrIntOverflowQueryMeta + } + 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: reward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: reward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPower", wireType) + } + m.TotalPower = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPower |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + 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 ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CycleList", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.CycleList = bool(v != 0) + case 4: + 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 ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PowerPaidOut", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + 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 ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PowerPaidOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPaidOut", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + 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 ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AmountPaidOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQueryMeta(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 962aa5e4b..7f4415eec 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -186,6 +186,7 @@ func (m *MsgSubmitValue) GetValue() string { } type MsgSubmitValueResponse struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *MsgSubmitValueResponse) Reset() { *m = MsgSubmitValueResponse{} } @@ -221,6 +222,13 @@ func (m *MsgSubmitValueResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitValueResponse proto.InternalMessageInfo +func (m *MsgSubmitValueResponse) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + type MsgTip struct { Tipper string `protobuf:"bytes,1,opt,name=tipper,proto3" json:"tipper,omitempty"` QueryData []byte `protobuf:"bytes,2,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` @@ -423,46 +431,46 @@ func init() { func init() { proto.RegisterFile("layer/oracle/tx.proto", fileDescriptor_85ff275c542a231a) } var fileDescriptor_85ff275c542a231a = []byte{ - // 609 bytes of a gzipped FileDescriptorProto + // 621 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, - 0x10, 0x8d, 0x9b, 0x5f, 0xf3, 0x53, 0x36, 0x11, 0x05, 0x2b, 0xb4, 0x8e, 0x95, 0x9a, 0x60, 0x81, - 0x14, 0x22, 0xd5, 0x56, 0x02, 0xa2, 0x22, 0x37, 0x12, 0xae, 0x91, 0xc0, 0x0d, 0x1c, 0x90, 0x50, - 0xb5, 0x71, 0x56, 0xee, 0x4a, 0xb6, 0xd7, 0xec, 0xae, 0xa3, 0xe6, 0x86, 0x90, 0xb8, 0x70, 0xe2, - 0x23, 0x70, 0xe4, 0x98, 0x03, 0x7c, 0x87, 0xde, 0xa8, 0x38, 0x71, 0x42, 0x28, 0x39, 0xe4, 0x6b, - 0x20, 0xdb, 0x6b, 0x37, 0x7f, 0x68, 0x2b, 0x71, 0x49, 0x3c, 0xef, 0xcd, 0xbc, 0x7d, 0x3b, 0x33, - 0x36, 0xb8, 0xed, 0xc2, 0x09, 0xa2, 0x26, 0xa1, 0xd0, 0x76, 0x91, 0xc9, 0x4f, 0x8d, 0x80, 0x12, - 0x4e, 0xe4, 0x72, 0x0c, 0x1b, 0x09, 0xac, 0xde, 0x82, 0x1e, 0xf6, 0x89, 0x19, 0xff, 0x26, 0x09, - 0xaa, 0x66, 0x13, 0xe6, 0x11, 0x66, 0x0e, 0x21, 0x43, 0xe6, 0xb8, 0x35, 0x44, 0x1c, 0xb6, 0x4c, - 0x9b, 0x60, 0x5f, 0xf0, 0x7b, 0x82, 0xf7, 0x98, 0x63, 0x8e, 0x5b, 0xd1, 0x9f, 0x20, 0xaa, 0x09, - 0x71, 0x1c, 0x47, 0x66, 0x12, 0x08, 0xaa, 0xe2, 0x10, 0x87, 0x24, 0x78, 0xf4, 0x94, 0x16, 0xac, - 0x38, 0x0c, 0x20, 0x85, 0x9e, 0x28, 0xd0, 0xbf, 0x49, 0x60, 0xa7, 0xcf, 0x9c, 0x97, 0xc1, 0x08, - 0x72, 0xf4, 0x3c, 0x66, 0xe4, 0xc7, 0xa0, 0x08, 0x43, 0x7e, 0x42, 0x28, 0xe6, 0x13, 0x45, 0xaa, - 0x4b, 0x8d, 0x62, 0x57, 0xf9, 0xf1, 0xf5, 0xa0, 0x22, 0x4e, 0x7a, 0x3a, 0x1a, 0x51, 0xc4, 0xd8, - 0x11, 0xa7, 0xd8, 0x77, 0xac, 0x8b, 0x54, 0xf9, 0x10, 0x14, 0x12, 0x6d, 0x65, 0xab, 0x2e, 0x35, - 0x4a, 0xed, 0x8a, 0xb1, 0xdc, 0x02, 0x23, 0x51, 0xef, 0x16, 0xcf, 0x7e, 0xdd, 0xc9, 0x7d, 0x59, - 0x4c, 0x9b, 0x92, 0x25, 0xd2, 0x3b, 0xad, 0xf7, 0x8b, 0x69, 0xf3, 0x42, 0xe8, 0xe3, 0x62, 0xda, - 0xd4, 0x12, 0xcb, 0xa7, 0xa9, 0xe9, 0x35, 0x8f, 0x7a, 0x15, 0xec, 0xad, 0x41, 0x16, 0x62, 0x01, - 0xf1, 0x19, 0xd2, 0x3d, 0x70, 0xa3, 0xcf, 0x9c, 0xa3, 0x70, 0xe8, 0x61, 0xfe, 0x0a, 0xba, 0x21, - 0x92, 0x15, 0xf0, 0xbf, 0x4d, 0x11, 0xe4, 0x84, 0x26, 0xd7, 0xb1, 0xd2, 0x50, 0xde, 0x07, 0xe0, - 0x6d, 0x88, 0xe8, 0xe4, 0x78, 0x04, 0x39, 0x8c, 0x6d, 0x97, 0xad, 0x62, 0x8c, 0x3c, 0x83, 0x1c, - 0xca, 0x15, 0xb0, 0x3d, 0x8e, 0x14, 0x94, 0x7c, 0x5c, 0x96, 0x04, 0x9d, 0x72, 0x64, 0x37, 0x95, - 0xd0, 0x15, 0xb0, 0xbb, 0x7a, 0x5c, 0x66, 0xe4, 0x83, 0x04, 0x0a, 0x7d, 0xe6, 0x0c, 0x70, 0x20, - 0xef, 0x82, 0x02, 0xc7, 0x41, 0x80, 0x52, 0x03, 0x22, 0xba, 0xee, 0xfc, 0x43, 0x50, 0x80, 0x1e, - 0x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3f, 0x70, 0x30, 0x3f, 0x09, 0x87, 0x86, 0x4d, 0x3c, - 0x93, 0x23, 0xd7, 0x25, 0xf4, 0x00, 0x13, 0x73, 0x6d, 0x82, 0x7c, 0x12, 0x20, 0x36, 0x2c, 0xc4, - 0x1f, 0x95, 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xbd, 0x03, 0x0e, 0x13, 0x05, 0x00, - 0x00, + 0x10, 0x8d, 0x93, 0x36, 0x3f, 0x65, 0x13, 0xb5, 0x3f, 0xac, 0xd0, 0x3a, 0x56, 0x6a, 0x82, 0x05, + 0x52, 0x88, 0x54, 0x5b, 0x09, 0x88, 0x8a, 0xdc, 0x48, 0xb8, 0x46, 0x02, 0x37, 0x70, 0x40, 0x42, + 0xd5, 0xc6, 0x5e, 0xb9, 0x2b, 0xd9, 0x5e, 0xe3, 0x5d, 0x47, 0xcd, 0x0d, 0x21, 0x71, 0xe1, 0xc4, + 0x47, 0xe0, 0xc8, 0x31, 0x07, 0xf8, 0x0e, 0xbd, 0x51, 0x71, 0xe2, 0x84, 0x50, 0x72, 0xc8, 0xd7, + 0x40, 0xb6, 0xd7, 0x6e, 0xfe, 0xd0, 0x56, 0xe2, 0x92, 0x78, 0xe6, 0xcd, 0xbc, 0x7d, 0x3b, 0xf3, + 0x6c, 0x70, 0xdb, 0x81, 0x13, 0x14, 0xe8, 0x24, 0x80, 0xa6, 0x83, 0x74, 0x76, 0xa6, 0xf9, 0x01, + 0x61, 0x44, 0xac, 0xc4, 0x69, 0x2d, 0x49, 0xcb, 0xb7, 0xa0, 0x8b, 0x3d, 0xa2, 0xc7, 0xbf, 0x49, + 0x81, 0xac, 0x98, 0x84, 0xba, 0x84, 0xea, 0x23, 0x48, 0x91, 0x3e, 0x6e, 0x8f, 0x10, 0x83, 0x6d, + 0xdd, 0x24, 0xd8, 0xe3, 0xf8, 0x3e, 0xc7, 0x5d, 0x6a, 0xeb, 0xe3, 0x76, 0xf4, 0xc7, 0x81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f1, 0x10, 0xfb, + 0x72, 0xfd, 0x6f, 0xd9, 0xac, 0xf5, 0x0d, 0xd8, 0x5d, 0x5f, 0x54, 0xe3, 0x8a, 0x7b, 0x64, 0x15, + 0x72, 0xf3, 0xa6, 0x8a, 0x94, 0x5e, 0xde, 0x7e, 0x17, 0xbd, 0x9b, 0xbd, 0xfe, 0xf9, 0x4c, 0x11, + 0x2e, 0x66, 0x8a, 0xf0, 0x7b, 0xa6, 0x08, 0x9f, 0xe6, 0x4a, 0xee, 0x62, 0xae, 0xe4, 0x7e, 0xce, + 0x95, 0xdc, 0xeb, 0x07, 0x36, 0x66, 0xa7, 0xe1, 0x48, 0x33, 0x89, 0xab, 0x33, 0xe4, 0x38, 0x24, + 0x38, 0xc4, 0x44, 0x5f, 0xdb, 0x20, 0x9b, 0xf8, 0x88, 0x8e, 0x8a, 0xf1, 0x47, 0xe6, 0xe1, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xca, 0x65, 0x3a, 0x23, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -784,6 +792,11 @@ func (m *MsgSubmitValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -981,6 +994,9 @@ func (m *MsgSubmitValueResponse) Size() (n int) { } var l int _ = l + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } return n } @@ -1388,6 +1404,25 @@ func (m *MsgSubmitValueResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgSubmitValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/reporter/ante/ante_test.go b/x/reporter/ante/ante_test.go index 420e98119..6c61c60ef 100644 --- a/x/reporter/ante/ante_test.go +++ b/x/reporter/ante/ante_test.go @@ -18,7 +18,7 @@ import ( ) func TestNewTrackStakeChangesDecorator(t *testing.T) { - k, sk, _, _, ctx, _ := keepertest.ReporterKeeper(t) + k, _, sk, _, _, ctx, _ := keepertest.ReporterKeeper(t) decorator := NewTrackStakeChangesDecorator(k, sk) sk.On("TotalBondedTokens", ctx).Return(math.NewInt(100), nil) err := k.Tracker.Set(ctx, types.StakeTracker{ diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 5d898cc1c..7587c10a4 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -1,76 +1,16 @@ package keeper import ( - "bytes" "context" "errors" "fmt" - "cosmossdk.io/collections" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// divvy up the tips that a reporter has earned from reporting in the oracle module amongst the reporters' selectors -// purpose of height argument is to only pay out selectors that were part of the reporter at height of the report -// DivvyingTips distributes the reward among the reporter and its selectors based on their shares at the given height. -// -// The function performs the following steps: -// 1. Retrieves the reporter's information using the reporter's address. -// 2. Converts the reward and commission rate to legacy decimals for calculations. -// 3. Calculates the commission for the reporter and the net reward after commission. -// 4. Retrieves the selectors' addresses and their respective shares. -// 5. Distributes the net reward among the selectors based on their shares. -// 6. Adds the commission to the reporter's share if the reporter is also a selector. -// 7. Updates the selectors' tips with the new calculated shares. -func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.LegacyDec, queryId []byte, height uint64) error { - reporter, err := k.Reporters.Get(ctx, reporterAddr) - if err != nil { - return err - } - - // selector's commission = reporter's commission rate * reward - commission := reward.Mul(reporter.CommissionRate) - // Calculate net reward - netReward := reward.Sub(commission) - - delAddrs, err := k.Report.Get(ctx, collections.Join(queryId, collections.Join(reporterAddr.Bytes(), height))) - if err != nil { - return err - } - - for _, del := range delAddrs.TokenOrigins { - // delegator share = netReward * selector's share / total shares - delAmountDec := del.Amount.ToLegacyDec() - delTotalDec := delAddrs.Total.ToLegacyDec() - delegatorShare := netReward.Mul(delAmountDec).Quo(delTotalDec) - - if bytes.Equal(del.DelegatorAddress, reporterAddr.Bytes()) { - delegatorShare = delegatorShare.Add(commission) - } - // get selector's previous tips - oldTips, err := k.SelectorTips.Get(ctx, del.DelegatorAddress) - if err != nil { - if errors.Is(err, collections.ErrNotFound) { - oldTips = math.LegacyZeroDec() - } else { - return err - } - } - // add the new tip to the old tips - newTips := oldTips.Add(delegatorShare) - // set new tip total - err = k.SelectorTips.Set(ctx, del.DelegatorAddress, newTips) - if err != nil { - return err - } - } - - return nil -} - // ReturnSlashedTokens returns the slashed tokens to the delegators, // called in dispute module after dispute is resolved with result invalid or reporter wins func (k Keeper) ReturnSlashedTokens(ctx context.Context, amt math.Int, hashId []byte) error { diff --git a/x/reporter/keeper/distribution_test.go b/x/reporter/keeper/distribution_test.go index 15e36e5c1..ab88518ed 100644 --- a/x/reporter/keeper/distribution_test.go +++ b/x/reporter/keeper/distribution_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "fmt" "testing" "github.com/stretchr/testify/require" @@ -17,7 +16,7 @@ import ( ) func TestDivvyingTips(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) height := uint64(10) val1Address := sample.AccAddressBytes() vals := simtestutil.ConvertAddrsToValAddrs([]sdk.AccAddress{val1Address}) @@ -48,25 +47,10 @@ func TestDivvyingTips(t *testing.T) { err = k.Report.Set(ctx, collections.Join([]byte{}, collections.Join(addr.Bytes(), height)), delegationAmounts) require.NoError(t, err) - - ctx = ctx.WithBlockHeight(12) - err = k.DivvyingTips(ctx, addr, math.LegacyNewDec(10*1e6), []byte{}, 10) - require.NoError(t, err) - - ctx = ctx.WithBlockHeight(13) - del1, err := k.SelectorTips.Get(ctx, addr.Bytes()) - require.NoError(t, err) - del2, err := k.SelectorTips.Get(ctx, addr2.Bytes()) - - fmt.Printf("delegator1: %v, delegator2: %v\r", del1, del2) - require.Equal(t, math.LegacyNewDec(5*1e6), del1) - - require.NoError(t, err) - require.Equal(t, math.LegacyNewDec(5*1e6), del2) } func TestReturnSlashedTokens(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) delAddr1, delAddr2 := sample.AccAddressBytes(), sample.AccAddressBytes() val1Address, val2Address := sdk.ValAddress(sample.AccAddressBytes()), sdk.ValAddress(sample.AccAddressBytes()) @@ -98,7 +82,7 @@ func TestReturnSlashedTokens(t *testing.T) { func TestFeeRefund(t *testing.T) { // set fee refund - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) delAddr1, delAddr2 := sample.AccAddressBytes(), sample.AccAddressBytes() valAddr1, valAddr2 := sample.AccAddressBytes(), sample.AccAddressBytes() tokenOrigin1 := &types.TokenOriginInfo{ @@ -129,7 +113,7 @@ func TestFeeRefund(t *testing.T) { } func TestGetBondedValidators(t *testing.T) { - k, sk, _, _, ctx, kvstore := setupKeeper(t) + k, _, sk, _, _, ctx, kvstore := setupKeeper(t) valAddr := sdk.ValAddress(sample.AccAddressBytes()) @@ -163,7 +147,7 @@ func TestGetBondedValidators(t *testing.T) { } func TestAddAmountToStake(t *testing.T) { - k, sk, _, _, ctx, kvstore := setupKeeper(t) + k, _, sk, _, _, ctx, kvstore := setupKeeper(t) acc := sample.AccAddressBytes() valAddr := sdk.ValAddress(sample.AccAddressBytes()) diff --git a/x/reporter/keeper/hooks_test.go b/x/reporter/keeper/hooks_test.go index 42698c328..04e39ea26 100644 --- a/x/reporter/keeper/hooks_test.go +++ b/x/reporter/keeper/hooks_test.go @@ -13,7 +13,7 @@ import ( ) func TestBeforeDelegationCreated(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) delAddr, valAddr := sample.AccAddressBytes(), sdk.ValAddress(sample.AccAddressBytes()) require.NoError(t, k.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)) @@ -29,7 +29,7 @@ func TestBeforeDelegationCreated(t *testing.T) { } func TestBeforeDelegationRemoved(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) delAddr, valAddr := sample.AccAddressBytes(), sdk.ValAddress(sample.AccAddressBytes()) require.NoError(t, k.Hooks().BeforeDelegationRemoved(ctx, delAddr, valAddr)) diff --git a/x/reporter/keeper/indexes_test.go b/x/reporter/keeper/indexes_test.go index c34ae0154..5be050b4b 100644 --- a/x/reporter/keeper/indexes_test.go +++ b/x/reporter/keeper/indexes_test.go @@ -13,7 +13,7 @@ import ( ) func TestReporterDelegatorIndex(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) repAddr := sample.AccAddressBytes() // set reporter @@ -57,7 +57,7 @@ func TestReporterDelegatorIndex(t *testing.T) { } func TestNewSelectorsIndex(t *testing.T) { - _, _, _, _, _, store := setupKeeper(t) + _, _, _, _, _, _, store := setupKeeper(t) require := require.New(t) sb := collections.NewSchemaBuilder(store) @@ -66,7 +66,7 @@ func TestNewSelectorsIndex(t *testing.T) { } func TestIndexesList(t *testing.T) { - _, _, _, _, _, store := setupKeeper(t) + _, _, _, _, _, _, store := setupKeeper(t) require := require.New(t) sb := collections.NewSchemaBuilder(store) diff --git a/x/reporter/keeper/jail_test.go b/x/reporter/keeper/jail_test.go index 32f37b6ee..b6f54fd01 100644 --- a/x/reporter/keeper/jail_test.go +++ b/x/reporter/keeper/jail_test.go @@ -12,7 +12,7 @@ import ( ) func TestJailReporter(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() updatedAt := time.Now().UTC() reporter := types.NewReporter(types.DefaultMinCommissionRate, math.OneInt()) @@ -34,7 +34,7 @@ func TestJailReporter(t *testing.T) { } func TestUnJailReporter(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() jailedAt := time.Now().UTC() reporter := types.NewReporter(types.DefaultMinCommissionRate, math.OneInt()) diff --git a/x/reporter/keeper/keeper.go b/x/reporter/keeper/keeper.go index 7390d83cb..5bdac9391 100644 --- a/x/reporter/keeper/keeper.go +++ b/x/reporter/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "time" layertypes "github.com/tellor-io/layer/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/collections" @@ -30,6 +31,9 @@ type ( DisputedDelegationAmounts collections.Map[[]byte, types.DelegationsAmounts] // key: dispute hashId FeePaidFromStake collections.Map[[]byte, types.DelegationsAmounts] // key: dispute hashId Report *collections.IndexedMap[collections.Pair[[]byte, collections.Pair[[]byte, uint64]], types.DelegationsAmounts, ReporterBlockNumberIndexes] // key: queryId, (reporter AccAddress, blockNumber) + Tip collections.Map[uint64, oracletypes.Reward] // key: QueryMeta.Id + Tbr collections.Map[uint64, oracletypes.Reward] // key: blockNumer + ClaimStatus collections.Map[collections.Pair[[]byte, uint64], bool] Schema collections.Schema logger log.Logger @@ -41,6 +45,7 @@ type ( stakingKeeper types.StakingKeeper bankKeeper types.BankKeeper registryKeeper types.RegistryKeeper + oracleKeeper types.OracleKeeper } ) @@ -73,6 +78,9 @@ func NewKeeper( sb, types.ReporterPrefix, "report", collections.PairKeyCodec(collections.BytesKey, collections.PairKeyCodec(collections.BytesKey, collections.Uint64Key)), codec.CollValue[types.DelegationsAmounts](cdc), newReportIndexes(sb), ), + Tip: collections.NewMap(sb, types.TipPrefix, "tips", collections.Uint64Key, codec.CollValue[oracletypes.Reward](cdc)), + Tbr: collections.NewMap(sb, types.TbrPrefix, "tbr", collections.Uint64Key, codec.CollValue[oracletypes.Reward](cdc)), + ClaimStatus: collections.NewMap(sb, types.ClaimStatusPrefix, "claim_status", collections.PairKeyCodec(collections.BytesKey, collections.Uint64Key), collections.BoolValue), authority: authority, logger: logger, stakingKeeper: stakingKeeper, @@ -92,6 +100,10 @@ func (k Keeper) GetAuthority() string { return k.authority } +func (k *Keeper) SetOracleKeeper(o types.OracleKeeper) { + k.oracleKeeper = o +} + // Logger returns a module-specific logger. func (k Keeper) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) @@ -188,3 +200,133 @@ func (k Keeper) TrackStakeChange(ctx context.Context) error { maxStake.Amount = total return k.Tracker.Set(ctx, maxStake) } + +func (k Keeper) AddTip(ctx context.Context, metaId uint64, tip oracletypes.Reward) error { + return k.Tip.Set(ctx, metaId, tip) +} + +func (k Keeper) AddTbr(ctx context.Context, metaId uint64, tbr oracletypes.Reward) error { + return k.Tbr.Set(ctx, metaId, tbr) +} + +func (k Keeper) RewardByReporter(ctx context.Context, selAddr, repAddr sdk.AccAddress, metaId uint64, queryId []byte) (math.LegacyDec, error) { + // ensure the selector hasn't claimed tips already + claimed, err := k.ClaimStatus.Has(ctx, collections.Join(selAddr.Bytes(), metaId)) + if err != nil { + return math.LegacyDec{}, err + } + if claimed { + return math.LegacyZeroDec(), nil + } + + report, err := k.oracleKeeper.MicroReport(ctx, collections.Join3(queryId, repAddr.Bytes(), metaId)) + if err != nil { + return math.LegacyDec{}, err + } + selectors, err := k.Report.Get(ctx, collections.Join(queryId, collections.Join(repAddr.Bytes(), report.BlockNumber))) + if err != nil { + return math.LegacyDec{}, err + } + var selectorPortion types.TokenOriginInfo + selectorPower := math.LegacyZeroDec() + for _, selector := range selectors.TokenOrigins { + if bytes.Equal(selector.DelegatorAddress, selAddr.Bytes()) { + selectorPortion = *selector + selectorPower = selector.Amount.ToLegacyDec() + break + } + } + + // check if selector found + if selectorPortion.Amount.IsNil() { + return math.LegacyZeroDec(), nil + } + selectorsTotalDec := selectors.Total.ToLegacyDec() + selAmountDec := selectorPortion.Amount.ToLegacyDec() + + normalizedSelectorPower := selectorPower.Quo(layertypes.PowerReduction.ToLegacyDec()) + + tipobj, err := k.Tip.Get(ctx, metaId) + if err != nil { + return math.LegacyDec{}, err + } + + reporter, err := k.Reporters.Get(ctx, repAddr) + if err != nil { + return math.LegacyDec{}, err + } + + tip := tipobj.Amount + + selectorShareTip := math.LegacyZeroDec() + if tip.IsPositive() { + reporterTipAmount := CalculateRewardAmount( + report.Power, + tipobj.TotalPower, + tip.TruncateInt(), + ) + commission := reporterTipAmount.Mul(reporter.CommissionRate) + netRewardtip := reporterTipAmount.Sub(commission) + selectorShareTip = netRewardtip.Mul(selAmountDec).Quo(selectorsTotalDec) + if selAddr.Equals(repAddr) { + selectorShareTip = selectorShareTip.Add(commission) + } + tipobj.PowerPaidOut = normalizedSelectorPower.Add(tipobj.PowerPaidOut) + if tipobj.PowerPaidOut.Equal(math.LegacyNewDec(int64(tipobj.TotalPower))) { + selectorShareTip = tipobj.Amount.Sub(tipobj.AmountPaidOut) + } else { + tipobj.AmountPaidOut = tipobj.AmountPaidOut.Add(selectorShareTip) + } + if err := k.Tip.Set(ctx, metaId, tipobj); err != nil { + return math.LegacyDec{}, err + } + } + + // calculate tbr if any + selectorShareTbr := math.LegacyZeroDec() + if tipobj.CycleList { + // if query is part of cyclist then tbr amount and total power should've been set + tbrobj, err := k.Tbr.Get(ctx, tipobj.BlockHeight) + if err != nil { + return math.LegacyDec{}, err + } + tbr := tbrobj.Amount + if tbr.IsPositive() { + reporterTbrAmount := CalculateRewardAmount( + report.Power, + tbrobj.TotalPower, + tbr.TruncateInt(), + ) + commission := reporterTbrAmount.Mul(reporter.CommissionRate) + netRewardtbr := reporterTbrAmount.Sub(commission) + selectorShareTbr = netRewardtbr.Mul(selAmountDec).Quo(selectorsTotalDec) + + if selAddr.Equals(repAddr) { + selectorShareTbr = selectorShareTbr.Add(commission) + } + + tbrobj.PowerPaidOut = normalizedSelectorPower.Add(tbrobj.PowerPaidOut) + + if tbrobj.PowerPaidOut.Equal(math.LegacyNewDec(int64(tbrobj.TotalPower))) { + selectorShareTbr = tbrobj.Amount.Sub(tbrobj.AmountPaidOut) + } else { + tbrobj.AmountPaidOut = tbrobj.AmountPaidOut.Add(selectorShareTbr) + } + + if err := k.Tbr.Set(ctx, tipobj.BlockHeight, tbrobj); err != nil { + return math.LegacyDec{}, err + } + } + } + + fmt.Println("selector sharetip", selectorShareTip) + fmt.Println("selector sharetbr", selectorShareTbr) + return selectorShareTip.Add(selectorShareTbr), nil +} + +func CalculateRewardAmount(reporterPower, totalPower uint64, reward math.Int) math.LegacyDec { + rPower := math.LegacyNewDec(int64(reporterPower)) + tPower := math.LegacyNewDec(int64(totalPower)) + amount := rPower.Quo(tPower).Mul(reward.ToLegacyDec()) + return amount +} diff --git a/x/reporter/keeper/keeper_test.go b/x/reporter/keeper/keeper_test.go index 48574217c..991dcf6db 100644 --- a/x/reporter/keeper/keeper_test.go +++ b/x/reporter/keeper/keeper_test.go @@ -1,12 +1,15 @@ package keeper_test import ( + "fmt" "testing" "time" "github.com/stretchr/testify/require" keepertest "github.com/tellor-io/layer/testutil/keeper" "github.com/tellor-io/layer/testutil/sample" + layertypes "github.com/tellor-io/layer/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" "github.com/tellor-io/layer/x/reporter/keeper" "github.com/tellor-io/layer/x/reporter/mocks" "github.com/tellor-io/layer/x/reporter/types" @@ -18,21 +21,22 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func setupKeeper(tb testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, sdk.Context, store.KVStoreService) { +func setupKeeper(tb testing.TB) (keeper.Keeper, *mocks.OracleKeeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, sdk.Context, store.KVStoreService) { tb.Helper() return keepertest.ReporterKeeper(tb) } func TestKeeper(t *testing.T) { - k, sk, bk, _, ctx, _ := keepertest.ReporterKeeper(t) + k, ok, sk, bk, _, ctx, _ := keepertest.ReporterKeeper(t) require.NotNil(t, ctx) require.NotEmpty(t, k) + require.NotNil(t, ok) require.NotNil(t, sk) require.NotNil(t, bk) } func TestGetAuthority(t *testing.T) { - k, _, _, _, _, _ := setupKeeper(t) + k, _, _, _, _, _, _ := setupKeeper(t) authority := k.GetAuthority() require.NotEmpty(t, authority) @@ -42,12 +46,12 @@ func TestGetAuthority(t *testing.T) { } func TestLogger(t *testing.T) { - k, _, _, _, _, _ := setupKeeper(t) + k, _, _, _, _, _, _ := setupKeeper(t) require.NotNil(t, k.Logger()) } func TestGetDelegatorTokensAtBlock(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) delAddr, val1Address, val2Address := sample.AccAddressBytes(), sdk.ValAddress(sample.AccAddressBytes()), sdk.ValAddress(sample.AccAddressBytes()) require.NoError(t, k.Selectors.Set(ctx, delAddr, types.NewSelection(delAddr, 2))) @@ -70,7 +74,7 @@ func TestGetDelegatorTokensAtBlock(t *testing.T) { } func TestGetReporterTokensAtBlock(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) reporter := sample.AccAddressBytes() tokens, err := k.GetReporterTokensAtBlock(ctx, reporter, uint64(ctx.BlockHeight())) require.NoError(t, err) @@ -88,7 +92,7 @@ func TestGetReporterTokensAtBlock(t *testing.T) { } func TestTrackStakeChange(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) expiration := ctx.BlockTime().Add(1) err := k.Tracker.Set(ctx, types.StakeTracker{Expiration: &expiration, Amount: math.NewInt(1000)}) require.NoError(t, err) @@ -107,7 +111,7 @@ func TestTrackStakeChange(t *testing.T) { } func TestReportIndexedMap(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) keys := []collections.Pair[[]byte, collections.Pair[[]byte, uint64]]{ collections.Join([]byte("queryid1"), collections.Join([]byte("reporterA"), uint64(1))), collections.Join([]byte("queryid2"), collections.Join([]byte("reporterA"), uint64(1))), @@ -150,3 +154,517 @@ func TestReportIndexedMap(t *testing.T) { require.NoError(t, err) require.Equal(t, 5, len(repAkeys)) } + +func TestRewardTip(t *testing.T) { + k, ok, _, _, _, ctx, _ := setupKeeper(t) + // make three reporters, each with power of 15 and total power of 45 + // make each reporter have three selectors each with power of 5 which makes the reporters power 15 + // reporter1 + reward := math.NewInt(100) + _ = reward + metaId := uint64(1) + queryId := []byte("queryid") + height := uint64(ctx.BlockHeight()) + reporter1, selector1b, selector1c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter1.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter1, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter2, selector2b, selector2c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter2.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter2, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter3, selector3b, selector3c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter3.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter3, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporters := []sdk.AccAddress{reporter1, reporter2, reporter3} + for _, r := range reporters { + require.NoError(t, k.Reporters.Set(ctx, r, types.OracleReporter{CommissionRate: math.LegacyMustNewDecFromStr("0.5")})) // 50% + } + // query id gets aggregated then AddTip, skip tbr for now + require.NoError(t, k.AddTip(ctx, metaId, oracletypes.Reward{ + TotalPower: 45, + Amount: reward.ToLegacyDec(), + CycleList: false, + BlockHeight: height + 1, + })) + + // microreports + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter1.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter2.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter3.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + type Reporter struct { + selectors []sdk.AccAddress + } + reporterA := Reporter{ + selectors: []sdk.AccAddress{reporter1, selector1b, selector1c}, + } + reporterB := Reporter{ + selectors: []sdk.AccAddress{reporter2, selector2b, selector2c}, + } + reporterC := Reporter{ + selectors: []sdk.AccAddress{reporter3, selector3b, selector3c}, + } + all := append([]Reporter{reporterA}, reporterB, reporterC) + total := math.LegacyZeroDec() + for i, r := range all { + for _, s := range r.selectors { + share, err := k.RewardByReporter(ctx, s, reporters[i], metaId, queryId) + require.NoError(t, err) + total = total.Add(share) + } + } + fmt.Println("total", total) + require.True(t, total.Equal(reward.ToLegacyDec())) +} + +func TestRewardTrb(t *testing.T) { + k, ok, _, _, _, ctx, _ := setupKeeper(t) + reward := math.NewInt(100) + + metaId := uint64(1) + queryId := []byte("queryid") + height := uint64(ctx.BlockHeight()) + reporter1, selector1b, selector1c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter1.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter1, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter2, selector2b, selector2c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter2.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter2, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter3, selector3b, selector3c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter3.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter3, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporters := []sdk.AccAddress{reporter1, reporter2, reporter3} + for _, r := range reporters { + require.NoError(t, k.Reporters.Set(ctx, r, types.OracleReporter{CommissionRate: math.LegacyMustNewDecFromStr("0.5")})) // 50% + } + + require.NoError(t, k.AddTip(ctx, metaId, oracletypes.Reward{ + TotalPower: 45, + Amount: math.LegacyZeroDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + require.NoError(t, k.AddTbr(ctx, metaId, oracletypes.Reward{ + TotalPower: 45, + Amount: reward.ToLegacyDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + // microreports + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter1.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter2.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter3.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + type Reporter struct { + selectors []sdk.AccAddress + } + reporterA := Reporter{ + selectors: []sdk.AccAddress{reporter1, selector1b, selector1c}, + } + reporterB := Reporter{ + selectors: []sdk.AccAddress{reporter2, selector2b, selector2c}, + } + reporterC := Reporter{ + selectors: []sdk.AccAddress{reporter3, selector3b, selector3c}, + } + all := append([]Reporter{reporterA}, reporterB, reporterC) + total := math.LegacyZeroDec() + for i, r := range all { + for _, s := range r.selectors { + share, err := k.RewardByReporter(ctx, s, reporters[i], metaId, queryId) + require.NoError(t, err) + total = total.Add(share) + } + } + require.True(t, total.Equal(reward.ToLegacyDec())) +} + +func TestRewardTrbTip(t *testing.T) { + k, ok, _, _, _, ctx, _ := setupKeeper(t) + tip := math.NewInt(100) + tbr := math.NewInt(50) + reward := tip.Add(tbr) + metaId := uint64(1) + queryId := []byte("queryid") + height := uint64(ctx.BlockHeight()) + reporter1, selector1b, selector1c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter1.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter1, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter2, selector2b, selector2c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter2.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter2, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporter3, selector3b, selector3c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter3.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter3, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + + reporters := []sdk.AccAddress{reporter1, reporter2, reporter3} + for _, r := range reporters { + require.NoError(t, k.Reporters.Set(ctx, r, types.OracleReporter{CommissionRate: math.LegacyMustNewDecFromStr("0.5")})) // 50% + } + + require.NoError(t, k.AddTip(ctx, metaId, oracletypes.Reward{ + TotalPower: 45, + Amount: tip.ToLegacyDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + require.NoError(t, k.AddTbr(ctx, height+1, oracletypes.Reward{ + TotalPower: 45, + Amount: tbr.ToLegacyDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + // microreports + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter1.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter2.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter3.Bytes(), metaId)).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + + type Reporter struct { + selectors []sdk.AccAddress + } + reporterA := Reporter{ + selectors: []sdk.AccAddress{reporter1, selector1b, selector1c}, + } + reporterB := Reporter{ + selectors: []sdk.AccAddress{reporter2, selector2b, selector2c}, + } + reporterC := Reporter{ + selectors: []sdk.AccAddress{reporter3, selector3b, selector3c}, + } + all := append([]Reporter{reporterA}, reporterB, reporterC) + total := math.LegacyZeroDec() + for i, r := range all { + for _, s := range r.selectors { + share, err := k.RewardByReporter(ctx, s, reporters[i], metaId, queryId) + require.NoError(t, err) + total = total.Add(share) + } + } + fmt.Println(total) + require.True(t, total.Equal(reward.ToLegacyDec())) +} + +// two queryids one cyclelist only and the other both tip n tbr +func TestRewardMix(t *testing.T) { + k, ok, _, _, _, ctx, _ := setupKeeper(t) + tip := math.NewInt(100) + tbr := math.NewInt(50) + metaIds := []uint64{1, 2} + queryIds := [][]byte{ + []byte("queryid"), + []byte("queryid2"), + } + + height := uint64(ctx.BlockHeight()) + reporter1, selector1b, selector1c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + for _, queryId := range queryIds { + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter1.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter1, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector1c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + } + + reporter2, selector2b, selector2c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + for _, queryId := range queryIds { + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter2.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter2, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector2c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + } + reporter3, selector3b, selector3c := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() + for _, queryId := range queryIds { + require.NoError(t, k.Report.Set(ctx, collections.Join(queryId, collections.Join(reporter3.Bytes(), height)), types.DelegationsAmounts{ + Total: math.NewInt(15).Mul(layertypes.PowerReduction), + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: reporter3, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3b, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + { + DelegatorAddress: selector3c, + Amount: math.NewInt(5).Mul(layertypes.PowerReduction), + }, + }, + })) + } + + reporters := []sdk.AccAddress{reporter1, reporter2, reporter3} + for _, r := range reporters { + require.NoError(t, k.Reporters.Set(ctx, r, types.OracleReporter{CommissionRate: math.LegacyMustNewDecFromStr("0.5")})) // 50% + } + + require.NoError(t, k.AddTip(ctx, metaIds[0], oracletypes.Reward{ + TotalPower: 45, + Amount: math.LegacyZeroDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + require.NoError(t, k.AddTip(ctx, metaIds[1], oracletypes.Reward{ + TotalPower: 45, + Amount: tip.ToLegacyDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + require.NoError(t, k.AddTbr(ctx, height+1, oracletypes.Reward{ + TotalPower: 90, + Amount: tbr.ToLegacyDec(), + CycleList: true, + BlockHeight: height + 1, + })) + + // microreports + for i, queryId := range queryIds { + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter1.Bytes(), metaIds[i])).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + } + for i, queryId := range queryIds { + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter2.Bytes(), metaIds[i])).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + } + for i, queryId := range queryIds { + ok.On("MicroReport", ctx, collections.Join3(queryId, reporter3.Bytes(), metaIds[i])).Return(oracletypes.MicroReport{ + BlockNumber: height, + Power: uint64(15), + }, nil) + } + type Reporter struct { + selectors []sdk.AccAddress + } + reporterA := Reporter{ + selectors: []sdk.AccAddress{reporter1, selector1b, selector1c}, + } + reporterB := Reporter{ + selectors: []sdk.AccAddress{reporter2, selector2b, selector2c}, + } + reporterC := Reporter{ + selectors: []sdk.AccAddress{reporter3, selector3b, selector3c}, + } + all := []Reporter{reporterA, reporterB, reporterC} + total := math.LegacyZeroDec() + for m, queryId := range queryIds { + for i, r := range all { + for _, s := range r.selectors { + share, err := k.RewardByReporter(ctx, s, reporters[i], metaIds[m], queryId) + require.NoError(t, err) + total = total.Add(share) + } + } + } + fmt.Println(total) + require.True(t, total.Equal(tip.Add(tbr).ToLegacyDec())) +} diff --git a/x/reporter/keeper/msg_server.go b/x/reporter/keeper/msg_server.go index 9a6488f52..ddb00af3a 100644 --- a/x/reporter/keeper/msg_server.go +++ b/x/reporter/keeper/msg_server.go @@ -10,6 +10,7 @@ import ( layertypes "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/reporter/types" + "cosmossdk.io/collections" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -58,8 +59,8 @@ func (k msgServer) CreateReporter(goCtx context.Context, msg *types.MsgCreateRep return nil, errors.New("address already exists") } - if msg.CommissionRate.GT(math.LegacyNewDec(100)) { - return nil, errors.New("commission rate must be LTE 100 as that is a 100 percent commission rate") + if msg.CommissionRate.GT(math.LegacyOneDec()) { + return nil, errors.New("commission rate must be LTE 1 as that is a 100 percent commission rate") } // set the reporter and set the self selector if err := k.Keeper.Reporters.Set(goCtx, addr.Bytes(), types.NewReporter(msg.CommissionRate, msg.MinTokensRequired)); err != nil { @@ -293,12 +294,16 @@ func (k msgServer) UnjailReporter(goCtx context.Context, msg *types.MsgUnjailRep // Msg: WithdrawTip, allows selectors to directly withdraw reporting rewards and stake them with a BONDED validator func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) (*types.MsgWithdrawTipResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - delAddr := sdk.MustAccAddressFromBech32(msg.SelectorAddress) - shares, err := k.Keeper.SelectorTips.Get(ctx, delAddr) + selectorAddr := sdk.MustAccAddressFromBech32(msg.SelectorAddress) + repAddr := sdk.MustAccAddressFromBech32(msg.ReporterAddress) + + shares, err := k.Keeper.RewardByReporter(ctx, selectorAddr, repAddr, msg.Id, msg.QueryId) if err != nil { return nil, err } - + if shares.IsZero() { + return nil, errors.New("no tips to withdraw") + } valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) if err != nil { return nil, err @@ -311,31 +316,50 @@ func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) if !val.IsBonded() { return nil, errors.New("chosen validator must be bonded") } + amtToDelegate := shares.TruncateInt() if amtToDelegate.IsZero() { return nil, errors.New("no tips to withdraw") } - _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, amtToDelegate, val.Status, val, false) - if err != nil { + // remainder ie .1234 = 1.1234 - 1 + remainder := shares.Sub(shares.TruncateDec()) + prevRemainder, err := k.Keeper.SelectorTips.Get(ctx, selectorAddr) + if err != nil && !errors.Is(err, collections.ErrNotFound) { return nil, err } + if prevRemainder.IsNil() { + prevRemainder = math.LegacyZeroDec() + } - // isolate decimals from shares - remainder := shares.Sub(shares.TruncateDec()) - if remainder.IsZero() { - err = k.Keeper.SelectorTips.Remove(ctx, delAddr) - if err != nil { - return nil, err + if remainder.IsPositive() { + newRemainder := prevRemainder.Add(remainder) + whole := newRemainder.TruncateInt() + if whole.IsPositive() { + amtToDelegate = amtToDelegate.Add(whole) + newRemainder = newRemainder.Sub(newRemainder.TruncateDec()) + } + if newRemainder.IsPositive() { + err = k.Keeper.SelectorTips.Set(ctx, selectorAddr, newRemainder) + } else { + err = k.Keeper.SelectorTips.Remove(ctx, selectorAddr) } - } else { - err = k.Keeper.SelectorTips.Set(ctx, delAddr, remainder) if err != nil { return nil, err } } - + _, err = k.Keeper.stakingKeeper.Delegate(ctx, selectorAddr, amtToDelegate, val.Status, val, false) + if err != nil { + return nil, err + } // send coins - err = k.Keeper.bankKeeper.SendCoinsFromModuleToModule(ctx, types.TipsEscrowPool, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, math.NewInt(int64(amtToDelegate.Uint64()))))) + err = k.Keeper.bankKeeper.SendCoinsFromModuleToModule(ctx, + types.TipsEscrowPool, stakingtypes.BondedPoolName, + sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, amtToDelegate)), + ) + if err != nil { + return nil, err + } + err = k.ClaimStatus.Set(ctx, collections.Join(selectorAddr.Bytes(), msg.Id), true) if err != nil { return nil, err } diff --git a/x/reporter/keeper/msg_server_test.go b/x/reporter/keeper/msg_server_test.go index b8dad7db3..9ef158c26 100644 --- a/x/reporter/keeper/msg_server_test.go +++ b/x/reporter/keeper/msg_server_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/tellor-io/layer/testutil/sample" + oracletypes "github.com/tellor-io/layer/x/oracle/types" "github.com/tellor-io/layer/x/reporter/keeper" "github.com/tellor-io/layer/x/reporter/mocks" "github.com/tellor-io/layer/x/reporter/types" @@ -19,24 +20,25 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func setupMsgServer(tb testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, types.MsgServer, sdk.Context) { +func setupMsgServer(tb testing.TB) (keeper.Keeper, *mocks.OracleKeeper, *mocks.StakingKeeper, *mocks.BankKeeper, *mocks.RegistryKeeper, types.MsgServer, sdk.Context) { tb.Helper() - k, sk, bk, rk, ctx, _ := setupKeeper(tb) - return k, sk, bk, rk, keeper.NewMsgServerImpl(k), ctx + k, ok, sk, bk, rk, ctx, _ := setupKeeper(tb) + return k, ok, sk, bk, rk, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { - k, sk, bk, rk, ms, ctx := setupMsgServer(t) + k, ok, sk, bk, rk, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) require.NotEmpty(t, k) + require.NotNil(t, ok) require.NotNil(t, sk) require.NotNil(t, bk) require.NotNil(t, rk) } func TestCreateReporter(t *testing.T) { - k, sk, _, _, ms, ctx := setupMsgServer(t) + k, _, sk, _, _, ms, ctx := setupMsgServer(t) addr := sample.AccAddressBytes() sk.On("IterateDelegatorDelegations", ctx, addr, mock.Anything).Return(nil) _, err := ms.CreateReporter(ctx, &types.MsgCreateReporter{ReporterAddress: addr.String(), CommissionRate: types.DefaultMinCommissionRate, MinTokensRequired: types.DefaultMinTrb}) @@ -83,7 +85,7 @@ func TestCreateReporter(t *testing.T) { } func TestSelectReporter(t *testing.T) { - k, sk, _, _, ms, ctx := setupMsgServer(t) + k, _, sk, _, _, ms, ctx := setupMsgServer(t) selector, reporter := sample.AccAddressBytes(), sample.AccAddressBytes() require.NoError(t, k.Reporters.Set(ctx, reporter, types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb))) sk.On("IterateDelegatorDelegations", ctx, selector, mock.Anything).Return(nil) @@ -129,7 +131,7 @@ func TestSelectReporter(t *testing.T) { } func TestSwitchReporter(t *testing.T) { - k, sk, _, rk, ms, ctx := setupMsgServer(t) + k, _, sk, _, rk, ms, ctx := setupMsgServer(t) ctx = ctx.WithBlockTime(time.Now()) selector, reporter, reporter2 := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() @@ -210,7 +212,7 @@ func TestSwitchReporter(t *testing.T) { } func TestRemoveSelector(t *testing.T) { - k, sk, _, _, ms, ctx := setupMsgServer(t) + k, _, sk, _, _, ms, ctx := setupMsgServer(t) reporter, selector := sample.AccAddressBytes(), sample.AccAddressBytes() require.NoError(t, k.Reporters.Set(ctx, reporter, types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb))) require.NoError(t, k.Selectors.Set(ctx, selector, types.NewSelection(reporter, 1))) @@ -261,7 +263,7 @@ func TestRemoveSelector(t *testing.T) { } func TestUnjailReporter(t *testing.T) { - k, _, _, _, msg, ctx := setupMsgServer(t) + k, _, _, _, _, msg, ctx := setupMsgServer(t) addr := sample.AccAddressBytes() require.NoError(t, k.Reporters.Set(ctx, addr, types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb))) reporter, err := k.Reporters.Get(ctx, addr) @@ -287,20 +289,43 @@ func TestUnjailReporter(t *testing.T) { } func TestWithdrawTip(t *testing.T) { - k, sk, bk, _, msg, ctx := setupMsgServer(t) + k, ok, sk, bk, _, msg, ctx := setupMsgServer(t) + + report := oracletypes.MicroReport{} + ok.On("MicroReport", mock.Anything, mock.Anything).Return(report, collections.ErrNotFound).Once() selector, valAddr := sample.AccAddressBytes(), sdk.ValAddress(sample.AccAddressBytes()) require.NoError(t, k.Selectors.Set(ctx, selector, types.NewSelection(selector, 1))) - _, err := msg.WithdrawTip(ctx, &types.MsgWithdrawTip{SelectorAddress: selector.String(), ValidatorAddress: valAddr.String()}) + _, err := msg.WithdrawTip(ctx, &types.MsgWithdrawTip{ + SelectorAddress: selector.String(), ValidatorAddress: valAddr.String(), + ReporterAddress: selector.String(), QueryId: []byte(""), + }) require.ErrorIs(t, err, collections.ErrNotFound) require.NoError(t, k.SelectorTips.Set(ctx, selector, math.LegacyNewDec(1*1e6))) - + require.NoError(t, k.Reporters.Set(ctx, selector, types.OracleReporter{CommissionRate: types.DefaultMinCommissionRate})) + require.NoError(t, k.Report.Set( + ctx, collections.Join([]byte("queryid"), collections.Join(selector.Bytes(), uint64(0))), + types.DelegationsAmounts{ + TokenOrigins: []*types.TokenOriginInfo{ + { + DelegatorAddress: selector, + Amount: math.OneInt(), + }, + }, + Total: math.OneInt(), + })) + require.NoError(t, k.AddTip(ctx, uint64(1), oracletypes.Reward{TotalPower: uint64(1), Amount: math.NewInt(1 * 1e6).ToLegacyDec()})) validator := stakingtypes.Validator{Status: stakingtypes.Bonded} sk.On("GetValidator", ctx, valAddr).Return(validator, nil) sk.On("Delegate", ctx, selector, math.NewInt(1*1e6), stakingtypes.Bonded, validator, false).Return(math.LegacyZeroDec(), nil) bk.On("SendCoinsFromModuleToModule", ctx, types.TipsEscrowPool, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(1*1e6)))).Return(nil) - _, err = msg.WithdrawTip(ctx, &types.MsgWithdrawTip{SelectorAddress: selector.String(), ValidatorAddress: valAddr.String()}) + report = oracletypes.MicroReport{Power: uint64(1), BlockNumber: 0} + ok.On("MicroReport", mock.Anything, mock.Anything).Return(report, nil).Once() + _, err = msg.WithdrawTip(ctx, &types.MsgWithdrawTip{ + SelectorAddress: selector.String(), ValidatorAddress: valAddr.String(), + ReporterAddress: selector.String(), QueryId: []byte("queryid"), Id: uint64(1), + }) require.NoError(t, err) } diff --git a/x/reporter/keeper/msg_update_params_test.go b/x/reporter/keeper/msg_update_params_test.go index d5505bd0c..b98ddad91 100644 --- a/x/reporter/keeper/msg_update_params_test.go +++ b/x/reporter/keeper/msg_update_params_test.go @@ -10,7 +10,7 @@ import ( ) func TestMsgUpdateParams(t *testing.T) { - k, _, _, _, ms, ctx := setupMsgServer(t) + k, _, _, _, _, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.Params.Set(ctx, params)) wctx := sdk.UnwrapSDKContext(ctx) diff --git a/x/reporter/keeper/query.go b/x/reporter/keeper/query.go index 40ee47f4f..de92ea98e 100644 --- a/x/reporter/keeper/query.go +++ b/x/reporter/keeper/query.go @@ -1,12 +1,16 @@ package keeper import ( + "bytes" "context" + "fmt" + "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/reporter/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "cosmossdk.io/collections" "cosmossdk.io/math" "cosmossdk.io/store/prefix" @@ -139,15 +143,103 @@ func (k Querier) SpaceAvailableByReporter(ctx context.Context, req *types.QueryS return &types.QuerySpaceAvailableByReporterResponse{SpaceAvailable: int32(remaining)}, nil } -func (k Querier) AvailableTips(ctx context.Context, req *types.QueryAvailableTipsRequest) (*types.QueryAvailableTipsResponse, error) { +func (k Querier) AvailableTipsByQuery(ctx context.Context, req *types.QueryAvailableTipsRequest) (*types.QueryAvailableTipsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } selectorAcc := sdk.MustAccAddressFromBech32(req.SelectorAddress) + reporterAcc := sdk.MustAccAddressFromBech32(req.ReporterAddress) + queryId, err := utils.QueryIDFromDataString(req.QueryId) + if err != nil { + return nil, err + } + + // ensure the selector hasn't claimed tips already + claimed, err := k.ClaimStatus.Has(ctx, collections.Join(selectorAcc.Bytes(), req.MetaId)) + if err != nil { + return nil, err + } + if claimed { + return nil, nil + } - rewards, err := k.Keeper.SelectorTips.Get(ctx, selectorAcc) + report, err := k.oracleKeeper.MicroReport(ctx, collections.Join3(queryId, reporterAcc.Bytes(), req.MetaId)) if err != nil { return nil, err } - return &types.QueryAvailableTipsResponse{AvailableTips: rewards}, nil + + reporterTipAmount := math.LegacyZeroDec() + reporterTbrAmount := math.LegacyZeroDec() + + // a tip object should always exist for a legit metaId set during aggregation even if amount is 0 + tipobj, err := k.Tip.Get(ctx, req.MetaId) + if err != nil { + return nil, err + } + + tip := tipobj.Amount + if tip.IsPositive() { + reporterTipAmount = CalculateRewardAmount( + report.Power, + tipobj.TotalPower, + tip.TruncateInt(), + ) + } + + if tipobj.CycleList { + // if query is part of cyclist then tbr amount and total power should've been set + tbrobj, err := k.Tbr.Get(ctx, tipobj.BlockHeight) + if err != nil { + return nil, err + } + tbr := tbrobj.Amount + if tbr.IsPositive() { + reporterTbrAmount = CalculateRewardAmount( + report.Power, + tbrobj.TotalPower, + tbr.TruncateInt(), + ) + } + } + + reporter, err := k.Keeper.Reporters.Get(ctx, reporterAcc) + if err != nil { + return nil, err + } + reporterAmount := reporterTipAmount.Add(reporterTbrAmount) + + if reporterAmount.IsZero() { + return nil, nil + } + // selector's commission = reporter's commission rate * reward + commission := reporterAmount.Mul(reporter.CommissionRate) + // Calculate net reward + netReward := reporterAmount.Sub(commission) + + selectors, err := k.Report.Get(ctx, collections.Join(queryId, collections.Join(reporterAcc.Bytes(), report.BlockNumber))) + if err != nil { + return nil, err + } + selectorsTotalDec := selectors.Total.ToLegacyDec() + var selectorPortion types.TokenOriginInfo + for _, selector := range selectors.TokenOrigins { + if bytes.Equal(selector.DelegatorAddress, selectorAcc.Bytes()) { + selectorPortion = *selector + break + } + } + + // check if selector found + if selectorPortion.Amount.IsNil() { + return nil, nil + } + selAmountDec := selectorPortion.Amount.ToLegacyDec() + selectorShare := netReward.Mul(selAmountDec).Quo(selectorsTotalDec) + + if selectorAcc.Equals(reporterAcc) { + selectorShare = selectorShare.Add(commission) + } + fmt.Println("selector share", selectorShare) + + return &types.QueryAvailableTipsResponse{AvailableTips: selectorShare}, nil } diff --git a/x/reporter/keeper/query_params_test.go b/x/reporter/keeper/query_params_test.go index addb86975..51fe890d0 100644 --- a/x/reporter/keeper/query_params_test.go +++ b/x/reporter/keeper/query_params_test.go @@ -10,7 +10,7 @@ import ( ) func TestParamsQuery(t *testing.T) { - k, _, _, _, ctx, _ := keepertest.ReporterKeeper(t) + k, _, _, _, _, ctx, _ := keepertest.ReporterKeeper(t) querier := keeper.NewQuerier(k) params := types.DefaultParams() require.NoError(t, k.Params.Set(ctx, params)) diff --git a/x/reporter/keeper/query_test.go b/x/reporter/keeper/query_test.go index a9f7b4baf..f74e904d8 100644 --- a/x/reporter/keeper/query_test.go +++ b/x/reporter/keeper/query_test.go @@ -13,7 +13,7 @@ import ( ) func TestReportersQuery(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) for i := 0; i < 10; i++ { err := k.Reporters.Set(ctx, sample.AccAddressBytes(), types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb)) @@ -25,7 +25,7 @@ func TestReportersQuery(t *testing.T) { } func TestSelectorReporterQuery(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) selector := sample.AccAddressBytes() reporterAddr := sample.AccAddressBytes() @@ -37,7 +37,7 @@ func TestSelectorReporterQuery(t *testing.T) { } func TestAllowedAmountQuery(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) // set the last stored tracked amount @@ -55,7 +55,7 @@ func TestAllowedAmountQuery(t *testing.T) { } func TestNumOfSelectorsByReporter(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) reporterAddr := sample.AccAddressBytes() @@ -70,7 +70,7 @@ func TestNumOfSelectorsByReporter(t *testing.T) { } func TestSpaceAvailableByReporter(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) reporterAddr := sample.AccAddressBytes() @@ -85,7 +85,7 @@ func TestSpaceAvailableByReporter(t *testing.T) { } func TestAllowedAmountExpiration(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) querier := keeper.NewQuerier(k) ctx = ctx.WithBlockTime(time.Now()) @@ -96,81 +96,3 @@ func TestAllowedAmountExpiration(t *testing.T) { require.NoError(t, err) require.Equal(t, res.Expiration, uint64(ctx.BlockTime().Add(1).UnixMilli())) } - -func TestAvailableTips(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) - querier := keeper.NewQuerier(k) - require := require.New(t) - - selectorAddr := sample.AccAddressBytes() - - cleanup := func() { - iter, err := k.SelectorTips.Iterate(ctx, nil) - require.NoError(err) - defer iter.Close() - - for ; iter.Valid(); iter.Next() { - key, err := iter.Key() - require.NoError(err) - require.NoError(k.SelectorTips.Remove(ctx, key)) - } - } - - testCases := []struct { - name string - setup func() - req *types.QueryAvailableTipsRequest - err bool - expected math.LegacyDec - }{ - { - name: "nil request", - req: nil, - err: true, - }, - { - name: "no tips", - req: &types.QueryAvailableTipsRequest{SelectorAddress: selectorAddr.String()}, - err: true, - expected: math.LegacyZeroDec(), - }, - { - name: "one tip", - setup: func() { - err := k.SelectorTips.Set(ctx, selectorAddr, math.LegacyNewDec(100*1e6)) - require.NoError(err) - }, - req: &types.QueryAvailableTipsRequest{SelectorAddress: selectorAddr.String()}, - err: false, - expected: math.LegacyNewDec(100 * 1e6), - }, - { - name: "amount changes", - setup: func() { - err := k.SelectorTips.Set(ctx, selectorAddr, math.LegacyNewDec(100*1e6)) - require.NoError(err) - err = k.SelectorTips.Set(ctx, selectorAddr, math.LegacyNewDec(200*1e6)) - require.NoError(err) - }, - req: &types.QueryAvailableTipsRequest{SelectorAddress: selectorAddr.String()}, - err: false, - expected: math.LegacyNewDec(200 * 1e6), - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - cleanup() - - if tc.setup != nil { - tc.setup() - } - res, err := querier.AvailableTips(ctx, tc.req) - if tc.err { - require.Error(err) - } else { - require.NoError(err) - require.Equal(tc.expected, res.AvailableTips) - } - }) - } -} diff --git a/x/reporter/keeper/reporter_test.go b/x/reporter/keeper/reporter_test.go index 37a8ad442..63f286241 100644 --- a/x/reporter/keeper/reporter_test.go +++ b/x/reporter/keeper/reporter_test.go @@ -17,7 +17,7 @@ import ( ) func TestHasMin(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() testCases := []struct { @@ -108,7 +108,7 @@ func TestHasMin(t *testing.T) { } func TestReporterStake(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) reporterAddr, selector, noSelectorsReporterAddr, jailedReporterAddr := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() require.NoError(t, k.Reporters.Set(ctx, reporterAddr, types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb))) @@ -194,7 +194,7 @@ func TestReporterStake(t *testing.T) { } func TestCheckSelectorsDelegations(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() testCases := []struct { @@ -256,7 +256,7 @@ func TestCheckSelectorsDelegations(t *testing.T) { } func TestTotalReporterPower(t *testing.T) { - k, sk, _, _, ctx, _ := setupKeeper(t) + k, _, sk, _, _, ctx, _ := setupKeeper(t) valSet := new(mocks.ValidatorSet) sk.On("GetValidatorSet").Return(valSet) valSet.On("TotalBondedTokens", ctx).Return(math.ZeroInt(), nil) @@ -272,7 +272,7 @@ func TestTotalReporterPower(t *testing.T) { } func TestDelegation(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() require.NoError(t, k.Selectors.Set(ctx, addr, types.NewSelection(addr, 2))) selection, err := k.Delegation(ctx, addr) @@ -281,7 +281,7 @@ func TestDelegation(t *testing.T) { } func TestReporter(t *testing.T) { - k, _, _, _, ctx, _ := setupKeeper(t) + k, _, _, _, _, ctx, _ := setupKeeper(t) addr := sample.AccAddressBytes() require.NoError(t, k.Reporters.Set(ctx, addr, types.NewReporter(types.DefaultMinCommissionRate, types.DefaultMinTrb))) reporter, err := k.Reporter(ctx, addr) diff --git a/x/reporter/keeper/withdraw_test.go b/x/reporter/keeper/withdraw_test.go index 95d627075..752d162fd 100644 --- a/x/reporter/keeper/withdraw_test.go +++ b/x/reporter/keeper/withdraw_test.go @@ -17,7 +17,7 @@ import ( ) func TestFeefromReporterStake(t *testing.T) { - k, sk, bk, _, ctx, _ := setupKeeper(t) + k, _, sk, bk, _, ctx, _ := setupKeeper(t) fee := math.NewIntWithDecimal(100, 6) reporterAddr, selector1, selector2, selector3 := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() @@ -81,7 +81,7 @@ func TestFeefromReporterStake(t *testing.T) { } func TestFeefromReporterStakeMultiplevalidators(t *testing.T) { - k, sk, bk, _, ctx, _ := setupKeeper(t) + k, _, sk, bk, _, ctx, _ := setupKeeper(t) fee := math.NewIntWithDecimal(100, 6) reporterAddr, selector := sample.AccAddressBytes(), sample.AccAddressBytes() @@ -124,7 +124,7 @@ func TestFeefromReporterStakeMultiplevalidators(t *testing.T) { } func TestEscrowReporterStake(t *testing.T) { - k, sk, bk, _, ctx, _ := setupKeeper(t) + k, _, sk, bk, _, ctx, _ := setupKeeper(t) reporterAddr := sample.AccAddressBytes() stake := math.NewIntWithDecimal(100, 6) require.NoError(t, k.Report.Set(ctx, collections.Join([]byte{}, collections.Join(reporterAddr.Bytes(), uint64(ctx.BlockHeight()))), types.DelegationsAmounts{ @@ -145,7 +145,7 @@ func TestEscrowReporterStake(t *testing.T) { } func TestEscrowReporterStakeUnbondingdelegations(t *testing.T) { - k, sk, bk, _, ctx, _ := setupKeeper(t) + k, _, sk, bk, _, ctx, _ := setupKeeper(t) reporterAddr, selector2, selector3, valAddr1, valAddr2 := sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes(), sample.AccAddressBytes() stake := math.NewIntWithDecimal(1000, 6) require.NoError(t, k.Report.Set(ctx, collections.Join([]byte{}, collections.Join(reporterAddr.Bytes(), uint64(ctx.BlockHeight()))), types.DelegationsAmounts{ diff --git a/x/reporter/mocks/OracleKeeper.go b/x/reporter/mocks/OracleKeeper.go new file mode 100644 index 000000000..94ef2077f --- /dev/null +++ b/x/reporter/mocks/OracleKeeper.go @@ -0,0 +1,57 @@ +// Code generated by mockery v2.23.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + collections "cosmossdk.io/collections" + + mock "github.com/stretchr/testify/mock" + + types "github.com/tellor-io/layer/x/oracle/types" +) + +// OracleKeeper is an autogenerated mock type for the OracleKeeper type +type OracleKeeper struct { + mock.Mock +} + +// MicroReport provides a mock function with given fields: ctx, key +func (_m *OracleKeeper) MicroReport(ctx context.Context, key collections.Triple[[]byte, []byte, uint64]) (types.MicroReport, error) { + ret := _m.Called(ctx, key) + + var r0 types.MicroReport + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, collections.Triple[[]byte, []byte, uint64]) (types.MicroReport, error)); ok { + return rf(ctx, key) + } + if rf, ok := ret.Get(0).(func(context.Context, collections.Triple[[]byte, []byte, uint64]) types.MicroReport); ok { + r0 = rf(ctx, key) + } else { + r0 = ret.Get(0).(types.MicroReport) + } + + if rf, ok := ret.Get(1).(func(context.Context, collections.Triple[[]byte, []byte, uint64]) error); ok { + r1 = rf(ctx, key) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewOracleKeeper interface { + mock.TestingT + Cleanup(func()) +} + +// NewOracleKeeper creates a new instance of OracleKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewOracleKeeper(t mockConstructorTestingTNewOracleKeeper) *OracleKeeper { + mock := &OracleKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/reporter/module/autocli.go b/x/reporter/module/autocli.go index 93e2e58b1..2acba3b52 100644 --- a/x/reporter/module/autocli.go +++ b/x/reporter/module/autocli.go @@ -48,8 +48,8 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, }, { - RpcMethod: "AvailableTips", - Use: "available-tips", + RpcMethod: "AvailableTipsByQuery", + Use: "available-tips-by-query", Short: "Query how much how much tips a selector has", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "selector_address"}}, }, @@ -95,10 +95,16 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, }, { - RpcMethod: "WithdrawTip", - Use: "withdraw-tip [selector-address] [validator-address]", - Short: "Send a WithdrawTip tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "selector_address"}, {ProtoField: "validator_address"}}, + RpcMethod: "WithdrawTip", + Use: "withdraw-tip [selector-address] [validator-address] [reporter-address] [id] [query-id]", + Short: "Send a WithdrawTip tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "selector_address"}, + {ProtoField: "validator_address"}, + {ProtoField: "reporter_address"}, + {ProtoField: "id"}, + {ProtoField: "query_id"}, + }, }, // this line is used by ignite scaffolding # autocli/tx }, diff --git a/x/reporter/module/genesis_test.go b/x/reporter/module/genesis_test.go index fbf44d505..0a919badc 100644 --- a/x/reporter/module/genesis_test.go +++ b/x/reporter/module/genesis_test.go @@ -17,7 +17,7 @@ func TestGenesis(t *testing.T) { // this line is used by starport scaffolding # genesis/test/state } - k, _, _, _, ctx, _ := keepertest.ReporterKeeper(t) + k, _, _, _, _, ctx, _ := keepertest.ReporterKeeper(t) reporter.InitGenesis(ctx, k, genesisState) got := reporter.ExportGenesis(ctx, k) require.NotNil(t, got) diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index 57f44b234..53f722422 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -2,8 +2,11 @@ package types import ( "context" - time "time" + "time" + oracletypes "github.com/tellor-io/layer/x/oracle/types" + + "cosmossdk.io/collections" "cosmossdk.io/core/store" "cosmossdk.io/math" @@ -68,3 +71,7 @@ type StakingHooks interface { type RegistryKeeper interface { MaxReportBufferWindow(ctx context.Context) (uint64, error) } + +type OracleKeeper interface { + MicroReport(ctx context.Context, key collections.Triple[[]byte, []byte, uint64]) (oracletypes.MicroReport, error) +} diff --git a/x/reporter/types/keys.go b/x/reporter/types/keys.go index b42c936f5..265e43c2e 100644 --- a/x/reporter/types/keys.go +++ b/x/reporter/types/keys.go @@ -27,4 +27,7 @@ var ( FeePaidFromStakePrefix = collections.NewPrefix(16) StakeTrackerPrefix = collections.NewPrefix(17) ReporterPrefix = collections.NewPrefix(18) + TipPrefix = collections.NewPrefix(19) + TbrPrefix = collections.NewPrefix(20) + ClaimStatusPrefix = collections.NewPrefix(21) ) diff --git a/x/reporter/types/query.pb.go b/x/reporter/types/query.pb.go index 6546f90b0..78084fa28 100644 --- a/x/reporter/types/query.pb.go +++ b/x/reporter/types/query.pb.go @@ -689,6 +689,9 @@ func (m *QuerySpaceAvailableByReporterResponse) GetSpaceAvailable() int32 { type QueryAvailableTipsRequest struct { // selector address defines the address of the selector to query for. SelectorAddress string `protobuf:"bytes,1,opt,name=selector_address,json=selectorAddress,proto3" json:"selector_address,omitempty"` + ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + QueryId string `protobuf:"bytes,3,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + MetaId uint64 `protobuf:"varint,4,opt,name=meta_id,json=metaId,proto3" json:"meta_id,omitempty"` } func (m *QueryAvailableTipsRequest) Reset() { *m = QueryAvailableTipsRequest{} } @@ -731,6 +734,27 @@ func (m *QueryAvailableTipsRequest) GetSelectorAddress() string { return "" } +func (m *QueryAvailableTipsRequest) GetReporterAddress() string { + if m != nil { + return m.ReporterAddress + } + return "" +} + +func (m *QueryAvailableTipsRequest) GetQueryId() string { + if m != nil { + return m.QueryId + } + return "" +} + +func (m *QueryAvailableTipsRequest) GetMetaId() uint64 { + if m != nil { + return m.MetaId + } + return 0 +} + type QueryAvailableTipsResponse struct { // available_tips defines the tips available for withdrawal for a given selector. AvailableTips cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=available_tips,json=availableTips,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"available_tips"` @@ -792,74 +816,77 @@ func init() { func init() { proto.RegisterFile("layer/reporter/query.proto", fileDescriptor_a043abc58a7b99a9) } var fileDescriptor_a043abc58a7b99a9 = []byte{ - // 1070 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0x5e, 0x07, 0x1a, 0x92, 0x89, 0xf2, 0x83, 0x21, 0x2d, 0x5b, 0xa7, 0x6c, 0x2a, 0xa7, 0x69, - 0x97, 0x04, 0xdb, 0x34, 0x69, 0x41, 0xb4, 0x02, 0x91, 0x94, 0x06, 0x02, 0x88, 0x6e, 0x1c, 0xe0, - 0xc0, 0x81, 0x65, 0x76, 0x77, 0xe2, 0x5a, 0xb5, 0x3d, 0xae, 0x3d, 0x5b, 0xba, 0x94, 0x5e, 0xb8, - 0xc0, 0x09, 0x21, 0x71, 0x81, 0x5b, 0x8f, 0x48, 0x5c, 0x38, 0x44, 0xe2, 0xcc, 0x2d, 0xc7, 0x2a, - 0x5c, 0xa0, 0x87, 0x0a, 0x25, 0x48, 0xf0, 0x67, 0x20, 0xcf, 0x0f, 0xef, 0xae, 0xd7, 0x8e, 0x37, - 0x12, 0xbd, 0x44, 0xeb, 0x37, 0xef, 0xbd, 0xef, 0xfb, 0x9e, 0xdf, 0x7c, 0x56, 0x80, 0xea, 0xa2, - 0x0e, 0x0e, 0xcd, 0x10, 0x07, 0x24, 0xa4, 0x38, 0x34, 0x6f, 0xb7, 0x71, 0xd8, 0x31, 0x82, 0x90, - 0x50, 0x02, 0xa7, 0xd8, 0x99, 0x21, 0xcf, 0xd4, 0x67, 0x91, 0xe7, 0xf8, 0xc4, 0x64, 0x7f, 0x79, - 0x8a, 0xba, 0xd4, 0x24, 0x91, 0x47, 0x22, 0xb3, 0x81, 0x22, 0xcc, 0x6b, 0xcd, 0x3b, 0x17, 0x1b, - 0x98, 0xa2, 0x8b, 0x66, 0x80, 0x6c, 0xc7, 0x47, 0xd4, 0x21, 0xbe, 0xc8, 0xad, 0xf4, 0xe6, 0xca, - 0xac, 0x26, 0x71, 0xe4, 0xf9, 0x69, 0x7e, 0x5e, 0x67, 0x4f, 0x26, 0x7f, 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 0x98, 0x55, 0x42, 0xc6, 0x16, 0x93, 0xf1, 0x1e, 0xdc, 0xcc, 0x97, 0xe1, 0xb7, 0x3d, - 0x9d, 0xec, 0xe8, 0x89, 0x4d, 0xeb, 0x8d, 0x4e, 0xcf, 0xee, 0xa4, 0x2d, 0xf7, 0x3e, 0xfc, 0x53, - 0x01, 0xe5, 0x3c, 0xd3, 0xcc, 0x11, 0x57, 0x60, 0xed, 0x39, 0xe2, 0x8a, 0x9c, 0x59, 0xab, 0x31, - 0x71, 0xef, 0xc2, 0x77, 0x8e, 0xb8, 0x0d, 0x71, 0x0f, 0x3d, 0xf1, 0xb1, 0x22, 0x6d, 0x3f, 0xc7, - 0xf7, 0xa2, 0xd7, 0xf4, 0xf2, 0xee, 0x45, 0x86, 0xc5, 0xe7, 0xdd, 0x8b, 0x2c, 0xaf, 0xd6, 0xae, - 0x31, 0xea, 0xaf, 0xc3, 0xab, 0x47, 0xac, 0x57, 0x42, 0x3a, 0xf6, 0xf2, 0x8c, 0x5b, 0xbc, 0x7e, - 0x7d, 0xef, 0xa0, 0xa2, 0x3c, 0x3c, 0xa8, 0x28, 0x7f, 0x1d, 0x54, 0x94, 0xef, 0x0e, 0x2b, 0xa5, - 0x87, 0x87, 0x95, 0xd2, 0x1f, 0x87, 0x95, 0xd2, 0x27, 0xcb, 0xb6, 0x43, 0x6f, 0xb6, 0x1b, 0x46, - 0x93, 0x78, 0x03, 0x00, 0x77, 0xbb, 0x10, 0xb4, 0x13, 0xe0, 0xa8, 0x31, 0xca, 0xfe, 0x9f, 0x58, - 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x24, 0xef, 0x81, 0x6b, 0x6e, 0x0d, 0x00, 0x00, + // 1116 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6f, 0xdc, 0x44, + 0x14, 0x5f, 0xa7, 0x6d, 0x3e, 0x26,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0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -885,10 +912,10 @@ type QueryClient interface { AllowedAmountExpiration(ctx context.Context, in *QueryAllowedAmountExpirationRequest, opts ...grpc.CallOption) (*QueryAllowedAmountExpirationResponse, error) // NumOfSelectorsByReporter queries the number of selectors by a reporter. NumOfSelectorsByReporter(ctx context.Context, in *QueryNumOfSelectorsByReporterRequest, opts ...grpc.CallOption) (*QueryNumOfSelectorsByReporterResponse, error) - // SpaceAvailableByReporter queries the space available in a reporter. + // SpaceAvailableByReporter queries the space available in a reporter. SpaceAvailableByReporter(ctx context.Context, in *QuerySpaceAvailableByReporterRequest, opts ...grpc.CallOption) (*QuerySpaceAvailableByReporterResponse, error) - // AvailableTips queries the tips available for withdrawal for a given selector. - AvailableTips(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) + // AvailableTips queries the tips available for withdrawal for a given selector. + AvailableTipsByQuery(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) } type queryClient struct { @@ -962,9 +989,9 @@ func (c *queryClient) SpaceAvailableByReporter(ctx context.Context, in *QuerySpa return out, nil } -func (c *queryClient) AvailableTips(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) { +func (c *queryClient) AvailableTipsByQuery(ctx context.Context, in *QueryAvailableTipsRequest, opts ...grpc.CallOption) (*QueryAvailableTipsResponse, error) { out := new(QueryAvailableTipsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/AvailableTips", in, out, opts...) + err := c.cc.Invoke(ctx, "/layer.reporter.Query/AvailableTipsByQuery", in, out, opts...) if err != nil { return nil, err } @@ -984,10 +1011,10 @@ type QueryServer interface { AllowedAmountExpiration(context.Context, *QueryAllowedAmountExpirationRequest) (*QueryAllowedAmountExpirationResponse, error) // NumOfSelectorsByReporter queries the number of selectors by a reporter. NumOfSelectorsByReporter(context.Context, *QueryNumOfSelectorsByReporterRequest) (*QueryNumOfSelectorsByReporterResponse, error) - // SpaceAvailableByReporter queries the space available in a reporter. + // SpaceAvailableByReporter queries the space available in a reporter. SpaceAvailableByReporter(context.Context, *QuerySpaceAvailableByReporterRequest) (*QuerySpaceAvailableByReporterResponse, error) - // AvailableTips queries the tips available for withdrawal for a given selector. - AvailableTips(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) + // AvailableTips queries the tips available for withdrawal for a given selector. + AvailableTipsByQuery(context.Context, *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1015,8 +1042,8 @@ func (*UnimplementedQueryServer) NumOfSelectorsByReporter(ctx context.Context, r func (*UnimplementedQueryServer) SpaceAvailableByReporter(ctx context.Context, req *QuerySpaceAvailableByReporterRequest) (*QuerySpaceAvailableByReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SpaceAvailableByReporter not implemented") } -func (*UnimplementedQueryServer) AvailableTips(ctx context.Context, req *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AvailableTips not implemented") +func (*UnimplementedQueryServer) AvailableTipsByQuery(ctx context.Context, req *QueryAvailableTipsRequest) (*QueryAvailableTipsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AvailableTipsByQuery not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -1149,20 +1176,20 @@ func _Query_SpaceAvailableByReporter_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _Query_AvailableTips_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_AvailableTipsByQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryAvailableTipsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).AvailableTips(ctx, in) + return srv.(QueryServer).AvailableTipsByQuery(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/layer.reporter.Query/AvailableTips", + FullMethod: "/layer.reporter.Query/AvailableTipsByQuery", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AvailableTips(ctx, req.(*QueryAvailableTipsRequest)) + return srv.(QueryServer).AvailableTipsByQuery(ctx, req.(*QueryAvailableTipsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1200,8 +1227,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_SpaceAvailableByReporter_Handler, }, { - MethodName: "AvailableTips", - Handler: _Query_AvailableTips_Handler, + MethodName: "AvailableTipsByQuery", + Handler: _Query_AvailableTipsByQuery_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -1703,6 +1730,25 @@ func (m *QueryAvailableTipsRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.MetaId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.MetaId)) + i-- + dAtA[i] = 0x20 + } + if len(m.QueryId) > 0 { + i -= len(m.QueryId) + copy(dAtA[i:], m.QueryId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.QueryId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ReporterAddress) > 0 { + i -= len(m.ReporterAddress) + copy(dAtA[i:], m.ReporterAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) + i-- + dAtA[i] = 0x12 + } if len(m.SelectorAddress) > 0 { i -= len(m.SelectorAddress) copy(dAtA[i:], m.SelectorAddress) @@ -1955,6 +2001,17 @@ func (m *QueryAvailableTipsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.ReporterAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.QueryId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.MetaId != 0 { + n += 1 + sovQuery(uint64(m.MetaId)) + } return n } @@ -3246,6 +3303,89 @@ func (m *QueryAvailableTipsRequest) Unmarshal(dAtA []byte) error { } m.SelectorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryId", 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.QueryId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaId", wireType) + } + m.MetaId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MetaId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/reporter/types/query.pb.gw.go b/x/reporter/types/query.pb.gw.go index 1ad4292f5..371278d91 100644 --- a/x/reporter/types/query.pb.gw.go +++ b/x/reporter/types/query.pb.gw.go @@ -285,7 +285,11 @@ func local_request_Query_SpaceAvailableByReporter_0(ctx context.Context, marshal } -func request_Query_AvailableTips_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +var ( + filter_Query_AvailableTipsByQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"selector_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_AvailableTipsByQuery_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAvailableTipsRequest var metadata runtime.ServerMetadata @@ -307,12 +311,19 @@ func request_Query_AvailableTips_0(ctx context.Context, marshaler runtime.Marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "selector_address", err) } - msg, err := client.AvailableTips(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AvailableTipsByQuery_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AvailableTipsByQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_AvailableTips_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_AvailableTipsByQuery_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAvailableTipsRequest var metadata runtime.ServerMetadata @@ -334,7 +345,14 @@ func local_request_Query_AvailableTips_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "selector_address", err) } - msg, err := server.AvailableTips(ctx, &protoReq) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AvailableTipsByQuery_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AvailableTipsByQuery(ctx, &protoReq) return msg, metadata, err } @@ -506,7 +524,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_AvailableTips_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AvailableTipsByQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -517,7 +535,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AvailableTips_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AvailableTipsByQuery_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 { @@ -525,7 +543,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AvailableTips_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AvailableTipsByQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -710,7 +728,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_AvailableTips_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AvailableTipsByQuery_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) @@ -719,14 +737,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_AvailableTips_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_AvailableTipsByQuery_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_AvailableTips_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AvailableTipsByQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -748,7 +766,7 @@ var ( pattern_Query_SpaceAvailableByReporter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "space-available-by-reporter", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_AvailableTips_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "available-tips", "selector_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AvailableTipsByQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "available-tips", "selector_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -766,5 +784,5 @@ var ( forward_Query_SpaceAvailableByReporter_0 = runtime.ForwardResponseMessage - forward_Query_AvailableTips_0 = runtime.ForwardResponseMessage + forward_Query_AvailableTipsByQuery_0 = runtime.ForwardResponseMessage ) diff --git a/x/reporter/types/tx.pb.go b/x/reporter/types/tx.pb.go index 6e727c4a6..01c8110b6 100644 --- a/x/reporter/types/tx.pb.go +++ b/x/reporter/types/tx.pb.go @@ -566,6 +566,9 @@ var xxx_messageInfo_MsgUnjailReporterResponse proto.InternalMessageInfo type MsgWithdrawTip struct { SelectorAddress string `protobuf:"bytes,1,opt,name=selector_address,json=selectorAddress,proto3" json:"selector_address,omitempty"` ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ReporterAddress string `protobuf:"bytes,3,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + Id uint64 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"` + QueryId []byte `protobuf:"bytes,5,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` } func (m *MsgWithdrawTip) Reset() { *m = MsgWithdrawTip{} } @@ -615,6 +618,27 @@ func (m *MsgWithdrawTip) GetValidatorAddress() string { return "" } +func (m *MsgWithdrawTip) GetReporterAddress() string { + if m != nil { + return m.ReporterAddress + } + return "" +} + +func (m *MsgWithdrawTip) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *MsgWithdrawTip) GetQueryId() []byte { + if m != nil { + return m.QueryId + } + return nil +} + // MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. type MsgWithdrawTipResponse struct { } @@ -672,60 +696,62 @@ func init() { func init() { proto.RegisterFile("layer/reporter/tx.proto", fileDescriptor_67b904a7aa978eb1) } var fileDescriptor_67b904a7aa978eb1 = []byte{ - // 838 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6b, 0xdb, 0x48, - 0x14, 0xb6, 0x1c, 0x12, 0xf0, 0x64, 0xf1, 0x0f, 0x6d, 0x7e, 0x38, 0x0e, 0x91, 0x13, 0xb3, 0xec, - 0xe6, 0x07, 0xb6, 0x48, 0x02, 0x0b, 0x09, 0x7b, 0x59, 0x67, 0xf7, 0x10, 0x58, 0x2f, 0x8b, 0x92, - 0xec, 0x2e, 0xbb, 0x50, 0x33, 0x96, 0x07, 0x79, 0x1a, 0x4b, 0xe3, 0xce, 0x4c, 0x9c, 0xf8, 0x56, - 0x7a, 0x2a, 0x3d, 0xf5, 0xda, 0x43, 0x21, 0x97, 0x42, 0x8f, 0x39, 0xf8, 0x52, 0xe8, 0x1f, 0x90, - 0x63, 0xf0, 0xa9, 0xf4, 0x10, 0x4a, 0x72, 0x48, 0xff, 0x8c, 0x22, 0x69, 0x64, 0x5b, 0xf2, 0x34, - 0x69, 0xa0, 0x97, 0x5e, 0x6c, 0x6b, 0xde, 0x7b, 0xdf, 0xfb, 0xbe, 0x4f, 0x7a, 0xcf, 0x02, 0xb3, - 0x4d, 0xd8, 0x41, 0x54, 0xa7, 0xa8, 0x45, 0x28, 0x47, 0x54, 0xe7, 0x27, 0xa5, 0x16, 0x25, 0x9c, - 0xa8, 0x49, 0x2f, 0x50, 0x0a, 0x02, 0xb9, 0x0c, 0xb4, 0xb1, 0x43, 0x74, 0xef, 0xd3, 0x4f, 0xc9, - 0x69, 0x26, 0x61, 0x36, 0x61, 0x7a, 0x0d, 0x32, 0xa4, 0xb7, 0xd7, 0x6b, 0x88, 0xc3, 0x75, 0xdd, - 0x24, 0xd8, 0x11, 0xf1, 0x59, 0x11, 0xb7, 0x99, 0xa5, 0xb7, 0xd7, 0xdd, 0x2f, 0x11, 0xf8, 0x41, - 0x04, 0x18, 0x87, 0x87, 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0x58, 0x19, 0x7e, 0x38, 0x45, 0x8a, 0x2f, 0x1f, 0x28, - 0x17, 0x3f, 0x32, 0x4d, 0x32, 0xfc, 0x70, 0x8a, 0x14, 0x5f, 0x3e, 0x1a, 0xea, 0x01, 0x98, 0x1c, - 0x1e, 0x0b, 0x4d, 0x52, 0x39, 0x14, 0xcf, 0xfd, 0x78, 0x7b, 0x3c, 0x80, 0xcd, 0x8d, 0x3f, 0x76, - 0xff, 0x1c, 0xcb, 0xbf, 0x9f, 0x5f, 0x69, 0xca, 0xc5, 0x95, 0xa6, 0x7c, 0xb8, 0xd2, 0x94, 0xe7, - 0xd7, 0x5a, 0xec, 0xe2, 0x5a, 0x8b, 0xbd, 0xbb, 0xd6, 0x62, 0xff, 0xad, 0x59, 0x98, 0x37, 0x8e, - 0x6a, 0x25, 0x93, 0xd8, 0x3a, 0x47, 0xcd, 0x26, 0xa1, 0x45, 0x4c, 0xf4, 0x91, 0x17, 0x04, 0xde, - 0x69, 0x21, 0x56, 0x9b, 0xf0, 0xde, 0x6c, 0x36, 0x3f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x39, - 0x08, 0xd7, 0xe7, 0x09, 0x00, 0x00, + // 878 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0xd3, 0xed, 0x42, 0xa6, 0xab, 0xfc, 0x30, 0xbb, 0xdb, 0x24, 0xd5, 0x3a, 0x69, 0x84, + 0x20, 0x6d, 0x95, 0x58, 0x6d, 0x25, 0xa4, 0x56, 0x5c, 0x48, 0xe1, 0x50, 0x89, 0x20, 0xe4, 0xb6, + 0x80, 0x40, 0x22, 0x9a, 0xd8, 0x23, 0x67, 0x68, 0xec, 0x49, 0x67, 0x26, 0x69, 0x73, 0x43, 0x9c, + 0x10, 0x27, 0xae, 0x1c, 0x90, 0x7a, 0x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 0x8b, 0xef, + 0xdc, 0xef, 0x0f, 0x61, 0x8b, 0x8b, 0xdf, 0x7a, 0x97, 0x71, 0xe3, 0xa3, 0xcb, 0x1b, 0x4d, 0xb9, + 0xba, 0xd1, 0x94, 0xbf, 0x6e, 0x34, 0xe5, 0xc7, 0x5b, 0x2d, 0x71, 0x75, 0xab, 0x25, 0xfe, 0xb8, + 0xd5, 0x12, 0x5f, 0x6e, 0xd8, 0x98, 0x77, 0xfa, 0xed, 0xba, 0x49, 0x1c, 0x9d, 0xa3, 0x6e, 0x97, + 0xd0, 0x1a, 0x26, 0xfa, 0xdc, 0x07, 0x09, 0x1f, 0xf6, 0x10, 0x6b, 0x3f, 0xf5, 0xbf, 0xa4, 0xb6, + 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x2d, 0xea, 0x5b, 0x57, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1431,6 +1457,25 @@ func (m *MsgWithdrawTip) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.QueryId) > 0 { + i -= len(m.QueryId) + copy(dAtA[i:], m.QueryId) + i = encodeVarintTx(dAtA, i, uint64(len(m.QueryId))) + i-- + dAtA[i] = 0x2a + } + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x20 + } + if len(m.ReporterAddress) > 0 { + i -= len(m.ReporterAddress) + copy(dAtA[i:], m.ReporterAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReporterAddress))) + i-- + dAtA[i] = 0x1a + } if len(m.ValidatorAddress) > 0 { i -= len(m.ValidatorAddress) copy(dAtA[i:], m.ValidatorAddress) @@ -1646,6 +1691,17 @@ func (m *MsgWithdrawTip) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ReporterAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + l = len(m.QueryId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2746,6 +2802,91 @@ func (m *MsgWithdrawTip) Unmarshal(dAtA []byte) error { } m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReporterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryId", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueryId = append(m.QueryId[:0], dAtA[iNdEx:postIndex]...) + if m.QueryId == nil { + m.QueryId = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])