From 153bd69b202f7952248387b0994acdd76b8f664e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 26 Jun 2024 14:03:43 +0200 Subject: [PATCH 01/15] refactor: settled/expired events --- api/poktroll/tokenomics/event.pulsar.go | 418 ++++++++++++------ e2e/tests/init_test.go | 58 +-- e2e/tests/session_steps_test.go | 4 +- proto/poktroll/tokenomics/event.proto | 14 +- telemetry/event_counters.go | 27 +- x/proof/types/types.go | 20 + x/tokenomics/keeper/keeper_exports_test.go | 6 +- .../keeper_settle_pending_claims_test.go | 14 +- x/tokenomics/keeper/settle_pending_claims.go | 48 +- x/tokenomics/module/abci.go | 7 +- x/tokenomics/types/event.pb.go | 217 ++++++--- 11 files changed, 521 insertions(+), 312 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 9d3c567dd..be04fe8c9 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -5,6 +5,7 @@ import ( proof "github.com/pokt-network/poktroll/api/poktroll/proof" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -14,16 +15,18 @@ import ( ) var ( - md_EventClaimExpired protoreflect.MessageDescriptor - fd_EventClaimExpired_claim protoreflect.FieldDescriptor - fd_EventClaimExpired_compute_units protoreflect.FieldDescriptor + md_EventClaimExpired protoreflect.MessageDescriptor + fd_EventClaimExpired_claim protoreflect.FieldDescriptor + fd_EventClaimExpired_num_relays protoreflect.FieldDescriptor + fd_EventClaimExpired_num_compute_units protoreflect.FieldDescriptor ) func init() { file_poktroll_tokenomics_event_proto_init() md_EventClaimExpired = File_poktroll_tokenomics_event_proto.Messages().ByName("EventClaimExpired") fd_EventClaimExpired_claim = md_EventClaimExpired.Fields().ByName("claim") - fd_EventClaimExpired_compute_units = md_EventClaimExpired.Fields().ByName("compute_units") + fd_EventClaimExpired_num_relays = md_EventClaimExpired.Fields().ByName("num_relays") + fd_EventClaimExpired_num_compute_units = md_EventClaimExpired.Fields().ByName("num_compute_units") } var _ protoreflect.Message = (*fastReflection_EventClaimExpired)(nil) @@ -97,9 +100,15 @@ func (x *fastReflection_EventClaimExpired) Range(f func(protoreflect.FieldDescri return } } - if x.ComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.ComputeUnits) - if !f(fd_EventClaimExpired_compute_units, value) { + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventClaimExpired_num_relays, value) { + return + } + } + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventClaimExpired_num_compute_units, value) { return } } @@ -120,8 +129,10 @@ func (x *fastReflection_EventClaimExpired) Has(fd protoreflect.FieldDescriptor) switch fd.FullName() { case "poktroll.tokenomics.EventClaimExpired.claim": return x.Claim != nil - case "poktroll.tokenomics.EventClaimExpired.compute_units": - return x.ComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + return x.NumComputeUnits != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -140,8 +151,10 @@ func (x *fastReflection_EventClaimExpired) Clear(fd protoreflect.FieldDescriptor switch fd.FullName() { case "poktroll.tokenomics.EventClaimExpired.claim": x.Claim = nil - case "poktroll.tokenomics.EventClaimExpired.compute_units": - x.ComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_relays": + x.NumRelays = uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + x.NumComputeUnits = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -161,8 +174,11 @@ func (x *fastReflection_EventClaimExpired) Get(descriptor protoreflect.FieldDesc case "poktroll.tokenomics.EventClaimExpired.claim": value := x.Claim return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.tokenomics.EventClaimExpired.compute_units": - value := x.ComputeUnits + case "poktroll.tokenomics.EventClaimExpired.num_relays": + value := x.NumRelays + return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + value := x.NumComputeUnits return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { @@ -186,8 +202,10 @@ func (x *fastReflection_EventClaimExpired) Set(fd protoreflect.FieldDescriptor, switch fd.FullName() { case "poktroll.tokenomics.EventClaimExpired.claim": x.Claim = value.Message().Interface().(*proof.Claim) - case "poktroll.tokenomics.EventClaimExpired.compute_units": - x.ComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimExpired.num_relays": + x.NumRelays = value.Uint() + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + x.NumComputeUnits = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -213,8 +231,10 @@ func (x *fastReflection_EventClaimExpired) Mutable(fd protoreflect.FieldDescript x.Claim = new(proof.Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.tokenomics.EventClaimExpired.compute_units": - panic(fmt.Errorf("field compute_units of message poktroll.tokenomics.EventClaimExpired is not mutable")) + case "poktroll.tokenomics.EventClaimExpired.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.tokenomics.EventClaimExpired is not mutable")) + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.tokenomics.EventClaimExpired is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -231,7 +251,9 @@ func (x *fastReflection_EventClaimExpired) NewField(fd protoreflect.FieldDescrip case "poktroll.tokenomics.EventClaimExpired.claim": m := new(proof.Claim) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.tokenomics.EventClaimExpired.compute_units": + case "poktroll.tokenomics.EventClaimExpired.num_relays": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimExpired.num_compute_units": return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { @@ -306,8 +328,11 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { l = options.Size(x.Claim) n += 1 + l + runtime.Sov(uint64(l)) } - if x.ComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.ComputeUnits)) + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -338,8 +363,13 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.ComputeUnits)) + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) i-- dAtA[i] = 0x10 } @@ -444,9 +474,9 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 2: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) } - x.ComputeUnits = 0 + x.NumRelays = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -456,7 +486,26 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.ComputeUnits |= uint64(b&0x7F) << shift + x.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -497,18 +546,20 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } var ( - md_EventClaimSettled protoreflect.MessageDescriptor - fd_EventClaimSettled_claim protoreflect.FieldDescriptor - fd_EventClaimSettled_compute_units protoreflect.FieldDescriptor - fd_EventClaimSettled_proof_required protoreflect.FieldDescriptor + md_EventClaimSettled protoreflect.MessageDescriptor + fd_EventClaimSettled_claim protoreflect.FieldDescriptor + fd_EventClaimSettled_num_relays protoreflect.FieldDescriptor + fd_EventClaimSettled_num_compute_units protoreflect.FieldDescriptor + fd_EventClaimSettled_proof_requirement protoreflect.FieldDescriptor ) func init() { file_poktroll_tokenomics_event_proto_init() md_EventClaimSettled = File_poktroll_tokenomics_event_proto.Messages().ByName("EventClaimSettled") fd_EventClaimSettled_claim = md_EventClaimSettled.Fields().ByName("claim") - fd_EventClaimSettled_compute_units = md_EventClaimSettled.Fields().ByName("compute_units") - fd_EventClaimSettled_proof_required = md_EventClaimSettled.Fields().ByName("proof_required") + fd_EventClaimSettled_num_relays = md_EventClaimSettled.Fields().ByName("num_relays") + fd_EventClaimSettled_num_compute_units = md_EventClaimSettled.Fields().ByName("num_compute_units") + fd_EventClaimSettled_proof_requirement = md_EventClaimSettled.Fields().ByName("proof_requirement") } var _ protoreflect.Message = (*fastReflection_EventClaimSettled)(nil) @@ -582,15 +633,21 @@ func (x *fastReflection_EventClaimSettled) Range(f func(protoreflect.FieldDescri return } } - if x.ComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.ComputeUnits) - if !f(fd_EventClaimSettled_compute_units, value) { + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventClaimSettled_num_relays, value) { return } } - if x.ProofRequired != false { - value := protoreflect.ValueOfBool(x.ProofRequired) - if !f(fd_EventClaimSettled_proof_required, value) { + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventClaimSettled_num_compute_units, value) { + return + } + } + if x.ProofRequirement != "" { + value := protoreflect.ValueOfString(x.ProofRequirement) + if !f(fd_EventClaimSettled_proof_requirement, value) { return } } @@ -611,10 +668,12 @@ func (x *fastReflection_EventClaimSettled) Has(fd protoreflect.FieldDescriptor) switch fd.FullName() { case "poktroll.tokenomics.EventClaimSettled.claim": return x.Claim != nil - case "poktroll.tokenomics.EventClaimSettled.compute_units": - return x.ComputeUnits != uint64(0) - case "poktroll.tokenomics.EventClaimSettled.proof_required": - return x.ProofRequired != false + case "poktroll.tokenomics.EventClaimSettled.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + return x.NumComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + return x.ProofRequirement != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -633,10 +692,12 @@ func (x *fastReflection_EventClaimSettled) Clear(fd protoreflect.FieldDescriptor switch fd.FullName() { case "poktroll.tokenomics.EventClaimSettled.claim": x.Claim = nil - case "poktroll.tokenomics.EventClaimSettled.compute_units": - x.ComputeUnits = uint64(0) - case "poktroll.tokenomics.EventClaimSettled.proof_required": - x.ProofRequired = false + case "poktroll.tokenomics.EventClaimSettled.num_relays": + x.NumRelays = uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + x.NumComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + x.ProofRequirement = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -656,12 +717,15 @@ func (x *fastReflection_EventClaimSettled) Get(descriptor protoreflect.FieldDesc case "poktroll.tokenomics.EventClaimSettled.claim": value := x.Claim return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.compute_units": - value := x.ComputeUnits + case "poktroll.tokenomics.EventClaimSettled.num_relays": + value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventClaimSettled.proof_required": - value := x.ProofRequired - return protoreflect.ValueOfBool(value) + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + value := x.NumComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + value := x.ProofRequirement + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -684,10 +748,12 @@ func (x *fastReflection_EventClaimSettled) Set(fd protoreflect.FieldDescriptor, switch fd.FullName() { case "poktroll.tokenomics.EventClaimSettled.claim": x.Claim = value.Message().Interface().(*proof.Claim) - case "poktroll.tokenomics.EventClaimSettled.compute_units": - x.ComputeUnits = value.Uint() - case "poktroll.tokenomics.EventClaimSettled.proof_required": - x.ProofRequired = value.Bool() + case "poktroll.tokenomics.EventClaimSettled.num_relays": + x.NumRelays = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + x.NumComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + x.ProofRequirement = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -713,10 +779,12 @@ func (x *fastReflection_EventClaimSettled) Mutable(fd protoreflect.FieldDescript x.Claim = new(proof.Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.compute_units": - panic(fmt.Errorf("field compute_units of message poktroll.tokenomics.EventClaimSettled is not mutable")) - case "poktroll.tokenomics.EventClaimSettled.proof_required": - panic(fmt.Errorf("field proof_required of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + panic(fmt.Errorf("field proof_requirement of message poktroll.tokenomics.EventClaimSettled is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -733,10 +801,12 @@ func (x *fastReflection_EventClaimSettled) NewField(fd protoreflect.FieldDescrip case "poktroll.tokenomics.EventClaimSettled.claim": m := new(proof.Claim) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.compute_units": + case "poktroll.tokenomics.EventClaimSettled.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventClaimSettled.proof_required": - return protoreflect.ValueOfBool(false) + case "poktroll.tokenomics.EventClaimSettled.num_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -810,11 +880,15 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { l = options.Size(x.Claim) n += 1 + l + runtime.Sov(uint64(l)) } - if x.ComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.ComputeUnits)) + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) } - if x.ProofRequired { - n += 2 + l = len(x.ProofRequirement) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -845,18 +919,20 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ProofRequired { + if len(x.ProofRequirement) > 0 { + i -= len(x.ProofRequirement) + copy(dAtA[i:], x.ProofRequirement) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProofRequirement))) i-- - if x.ProofRequired { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + dAtA[i] = 0x22 + } + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) i-- dAtA[i] = 0x18 } - if x.ComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.ComputeUnits)) + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) i-- dAtA[i] = 0x10 } @@ -961,9 +1037,9 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 2: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) } - x.ComputeUnits = 0 + x.NumRelays = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -973,16 +1049,35 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.ComputeUnits |= uint64(b&0x7F) << shift + x.NumRelays |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequired", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - var v int + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) + } + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -992,12 +1087,24 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - x.ProofRequired = bool(v != 0) + 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.ProofRequirement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1698,8 +1805,9 @@ type EventClaimExpired struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - ComputeUnits uint64 `protobuf:"varint,2,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` + Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` } func (x *EventClaimExpired) Reset() { @@ -1729,9 +1837,16 @@ func (x *EventClaimExpired) GetClaim() *proof.Claim { return nil } -func (x *EventClaimExpired) GetComputeUnits() uint64 { +func (x *EventClaimExpired) GetNumRelays() uint64 { if x != nil { - return x.ComputeUnits + return x.NumRelays + } + return 0 +} + +func (x *EventClaimExpired) GetNumComputeUnits() uint64 { + if x != nil { + return x.NumComputeUnits } return 0 } @@ -1743,9 +1858,11 @@ type EventClaimSettled struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - ComputeUnits uint64 `protobuf:"varint,2,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` - ProofRequired bool `protobuf:"varint,3,opt,name=proof_required,json=proofRequired,proto3" json:"proof_required,omitempty"` + Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + // TODO_IN_THIS_PR: make a protobuf enum + ProofRequirement string `protobuf:"bytes,4,opt,name=proof_requirement,json=proofRequirement,proto3" json:"proof_requirement,omitempty"` } func (x *EventClaimSettled) Reset() { @@ -1775,18 +1892,25 @@ func (x *EventClaimSettled) GetClaim() *proof.Claim { return nil } -func (x *EventClaimSettled) GetComputeUnits() uint64 { +func (x *EventClaimSettled) GetNumRelays() uint64 { if x != nil { - return x.ComputeUnits + return x.NumRelays } return 0 } -func (x *EventClaimSettled) GetProofRequired() bool { +func (x *EventClaimSettled) GetNumComputeUnits() uint64 { if x != nil { - return x.ProofRequired + return x.NumComputeUnits } - return false + return 0 +} + +func (x *EventClaimSettled) GetProofRequirement() string { + if x != nil { + return x.ProofRequirement + } + return "" } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated @@ -1864,54 +1988,68 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x0a, 0x1f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, - 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, - 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, - 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x11, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, - 0x2b, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x23, 0x0a, 0x0d, - 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, - 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x21, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3e, 0x0a, - 0x1c, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, - 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x3c, 0x0a, - 0x1b, 0x6e, 0x65, 0x77, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x17, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, - 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x13, 0x70, - 0x72, 0x65, 0x76, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, - 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x4e, 0x75, - 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, 0x0a, 0x12, 0x6e, 0x65, - 0x77, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, 0x75, 0x6d, 0x52, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x36, + 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, + 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x81, 0x02, 0x0a, 0x11, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, + 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, + 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x9c, 0x02, 0x0a, + 0x21, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, + 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, + 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x6e, 0x65, 0x77, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, + 0x2d, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, + 0x65, 0x76, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, + 0x0a, 0x12, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, + 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x42, 0xb8, 0x01, 0x0a, 0x17, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, + 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 859799c47..2de6c816d 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -28,7 +28,6 @@ import ( "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/pkg/client/block" "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/observable/channel" "github.com/pokt-network/poktroll/testutil/testclient" "github.com/pokt-network/poktroll/testutil/yaml" apptypes "github.com/pokt-network/poktroll/x/application/types" @@ -390,6 +389,18 @@ func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithPathAndData( relayKey := relayReferenceKey(appName, supplierName) s.scenarioState[relayKey] = res.Stdout + + deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) + onChainClaimEventsReplayClient, err := events.NewEventsReplayClient[*block.CometNewBlockEvent]( + s.ctx, + deps, + newBlockEventSubscriptionQuery, + block.UnmarshalNewBlockEvent, + eventsReplayClientBufferSize, + ) + require.NoError(s, err) + + s.scenarioState[newBlockEventReplayClientKey] = onChainClaimEventsReplayClient } func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) { @@ -406,51 +417,8 @@ func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName s require.NoError(s, err, `Expected valid JSON, got: %s`, stdout) } -// TODO_TECHDEBT: Factor out the common logic between this step and waitForTxResultEvent. -// It is not currently (easily) possible since the latter is getting the query client from -// s.scenarioState, which seems to be the source of the query client's failure. func (s *suite) AModuleEventIsBroadcasted(module, event string) { - ctx, done := context.WithCancel(context.Background()) - - // Construct an events query client to listen for tx events from the supplier. - eventType := fmt.Sprintf("poktroll.%s.Event%s", module, event) - deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) - onChainClaimEventsReplayClient, err := events.NewEventsReplayClient[*block.CometNewBlockEvent]( - ctx, - deps, - newBlockEventSubscriptionQuery, - block.UnmarshalNewBlockEvent, - eventsReplayClientBufferSize, - ) - require.NoError(s, err) - - // For each observed event, **asynchronously** check if it contains the given action. - channel.ForEach[*block.CometNewBlockEvent]( - ctx, onChainClaimEventsReplayClient.EventsSequence(ctx), - func(_ context.Context, newBlockEvent *block.CometNewBlockEvent) { - if newBlockEvent == nil { - return - } - - // Range over each event's attributes to find the "action" attribute - // and compare its value to that of the action provided. - for _, event := range newBlockEvent.Data.Value.ResultFinalizeBlock.Events { - // Checks on the event. For example, for a Claim Settlement event, - // we can parse the claim and verify the compute units. - if event.Type == eventType { - done() - return - } - } - }, - ) - - select { - case <-time.After(eventTimeout): - s.Fatalf("timed out waiting for event to be emitted by module %q", eventType) - case <-ctx.Done(): - s.Log("Success; event from module emitted before timeout.") - } + s.TheUserShouldWaitForTheModuleEventToBeBroadcast(module, event) } func (s *suite) getStakedAmount(actorType, accName string) (int, bool) { diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 47124c308..8757dd253 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -182,9 +182,7 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBeSuccess require.Equal(s, app.Address, claim.SessionHeader.ApplicationAddress) require.Equal(s, supplier.Address, claim.SupplierAddress) require.Equal(s, serviceId, claim.SessionHeader.Service.Id) - require.Greater(s, claimSettledEvent.ComputeUnits, uint64(0), "compute units should be greater than 0") - s.Logf("Claim settled for %d compute units w/ proof requirement: %t\n", claimSettledEvent.ComputeUnits, claimSettledEvent.ProofRequired) - + require.Greater(s, claimSettledEvent.NumComputeUnits, uint64(0), "compute units should be greater than 0") return true } diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 5fe5c8906..edd8a5b9e 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -3,22 +3,26 @@ package poktroll.tokenomics; option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; +import "gogoproto/gogo.proto"; import "poktroll/proof/claim.proto"; // EventClaimExpired is an event emitted during settlement whenever a claim requiring // an on-chain proof doesn't have one. The claim cannot be settled, leading to that work // never being rewarded. message EventClaimExpired { - poktroll.proof.Claim claim = 1; - uint64 compute_units = 2; + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; } // EventClaimSettled is an event emitted whenever a claim is settled. // The proof_required determines whether the claim requires a proof that has been submitted or not message EventClaimSettled { - poktroll.proof.Claim claim = 1; - uint64 compute_units = 2; - bool proof_required = 3; + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; + // TODO_IN_THIS_PR: make a protobuf enum + string proof_requirement = 4 [(gogoproto.jsontag) = "proof_requirement"]; } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated diff --git a/telemetry/event_counters.go b/telemetry/event_counters.go index 2d222413c..611de99a9 100644 --- a/telemetry/event_counters.go +++ b/telemetry/event_counters.go @@ -10,26 +10,11 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" "github.com/hashicorp/go-metrics" -) - -const eventTypeMetricKey = "event_type" - -type ClaimProofStage = string -const ( - ClaimProofStageClaimed = ClaimProofStage("claimed") - ClaimProofStageProven = ClaimProofStage("proven") - ClaimProofStageSettled = ClaimProofStage("settled") - ClaimProofStageExpired = ClaimProofStage("expired") + prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) -type ProofRequirementReason = string - -const ( - ProofNotRequired = ProofRequirementReason("not_required") - ProofRequirementReasonProbabilistic = ProofRequirementReason("probabilistic_selection") - ProofRequirementReasonThreshold = ProofRequirementReason("above_compute_unit_threshold") -) +const eventTypeMetricKey = "event_type" // EventSuccessCounter increments a counter with the given data type and success status. func EventSuccessCounter( @@ -56,11 +41,11 @@ func EventSuccessCounter( // If err is not nil, the counter is not incremented and an "error" label is added // with the error's message. func ProofRequirementCounter( - reason ProofRequirementReason, + reason prooftypes.ProofRequirementReason, err error, ) { incrementAmount := 1 - isRequired := strconv.FormatBool(reason != ProofNotRequired) + isRequired := strconv.FormatBool(reason != prooftypes.ProofNotRequired) labels := []metrics.Label{ {Name: "proof_required_reason", Value: reason}, {Name: "is_required", Value: isRequired}, @@ -84,7 +69,7 @@ func ProofRequirementCounter( // If err is not nil, the counter is not incremented and an "error" label is added // with the error's message. I.e., Prometheus will ingest this event. func ClaimComputeUnitsCounter( - claimProofStage ClaimProofStage, + claimProofStage prooftypes.ClaimProofStage, numComputeUnits uint64, err error, ) { @@ -112,7 +97,7 @@ func ClaimComputeUnitsCounter( // If err is not nil, the counter is not incremented and an "error" label is added // with the error's message. I.e., Prometheus will ingest this event. func ClaimCounter( - claimProofStage ClaimProofStage, + claimProofStage prooftypes.ClaimProofStage, numClaims uint64, err error, ) { diff --git a/x/proof/types/types.go b/x/proof/types/types.go index 78d9ec9f9..86d386575 100644 --- a/x/proof/types/types.go +++ b/x/proof/types/types.go @@ -1,3 +1,23 @@ package types // This file is in place to declare the package for dynamically generated protobufs + +// ClaimProofStage is a string enum which represents a stage of a claim proof lifecycle. +type ClaimProofStage = string + +const ( + ClaimProofStageClaimed = ClaimProofStage("claimed") + ClaimProofStageProven = ClaimProofStage("proven") + ClaimProofStageSettled = ClaimProofStage("settled") + ClaimProofStageExpired = ClaimProofStage("expired") +) + +// ProofRequirementReason is a string enum which represents whether +// a proof is required, and why, if it is. +type ProofRequirementReason = string + +const ( + ProofNotRequired = ProofRequirementReason("not_required") + ProofRequirementReasonProbabilistic = ProofRequirementReason("probabilistic_selection") + ProofRequirementReasonThreshold = ProofRequirementReason("above_compute_unit_threshold") +) diff --git a/x/tokenomics/keeper/keeper_exports_test.go b/x/tokenomics/keeper/keeper_exports_test.go index f44484638..2f4d7f46f 100644 --- a/x/tokenomics/keeper/keeper_exports_test.go +++ b/x/tokenomics/keeper/keeper_exports_test.go @@ -7,7 +7,7 @@ import ( prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) -// IsProofRequiredForClaim wraps the unexported isProofRequiredForClaim function for testing purposes. -func (k Keeper) IsProofRequiredForClaim(ctx cosmostypes.Context, claim *prooftypes.Claim) (bool, error) { - return k.isProofRequiredForClaim(ctx, claim) +// ProofRequirementForClaim wraps the unexported proofRequirementForClaim function for testing purposes. +func (k Keeper) ProofRequirementForClaim(ctx cosmostypes.Context, claim *prooftypes.Claim) (prooftypes.ProofRequirementReason, error) { + return k.proofRequirementForClaim(ctx, claim) } diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index acb550b38..4086d9bef 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -196,7 +196,7 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequiredAndNotProv // Validate the event expectedEvent := expectedEvents[0] - require.Equal(t, s.expectedComputeUnits, expectedEvent.ComputeUnits) + require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvided_ViaThreshold() { @@ -244,8 +244,8 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide // Validate the event expectedEvent := expectedEvents[0] - require.True(t, expectedEvent.ProofRequired) - require.Equal(t, s.expectedComputeUnits, expectedEvent.ComputeUnits) + require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_ViaProbability() { @@ -301,8 +301,8 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi events, "poktroll.tokenomics.EventClaimSettled") require.Len(t, expectedEvents, 1) expectedEvent := expectedEvents[0] - require.True(t, expectedEvent.ProofRequired) - require.Equal(t, s.expectedComputeUnits, expectedEvent.ComputeUnits) + require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { @@ -356,8 +356,8 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { // Validate the event expectedEvent := expectedEvents[0] - require.False(t, expectedEvent.ProofRequired) - require.Equal(t, s.expectedComputeUnits, expectedEvent.ComputeUnits) + require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } func (s *TestSuite) TestSettlePendingClaims_DoesNotSettle_BeforeProofWindowCloses() { diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index 60aea8595..edb6951cd 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -60,17 +60,18 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( _, isProofFound := k.proofKeeper.GetProof(ctx, sessionId, claim.SupplierAddress) // Using the probabilistic proofs approach, determine if this expiring // claim required an on-chain proof - isProofRequiredForClaim, err := k.isProofRequiredForClaim(ctx, &claim) + proofRequirement, err := k.proofRequirementForClaim(ctx, &claim) if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } - if isProofRequiredForClaim { + if proofRequirement != prooftypes.ProofNotRequired { // If a proof is not found, the claim will expire and never be settled. if !isProofFound { // Emit an event that a claim has expired and being removed without being settled. claimExpiredEvent := types.EventClaimExpired{ - Claim: &claim, - ComputeUnits: numClaimComputeUnits, + Claim: &claim, + NumComputeUnits: numClaimComputeUnits, + NumRelays: numRelaysInSessionTree, } if err := ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err @@ -93,14 +94,23 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } claimSettledEvent := types.EventClaimSettled{ - Claim: &claim, - ComputeUnits: numClaimComputeUnits, - ProofRequired: isProofRequiredForClaim, + Claim: &claim, + NumComputeUnits: numClaimComputeUnits, + ProofRequirement: proofRequirement, } if err := ctx.EventManager().EmitTypedEvent(&claimSettledEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } + if err := ctx.EventManager().EmitTypedEvent(&prooftypes.EventProofUpdated{ + Claim: &claim, + Proof: nil, + NumRelays: 0, + NumComputeUnits: 0, + }); err != nil { + return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err + } + // The claim & proof are no longer necessary, so there's no need for them // to take up on-chain space. k.proofKeeper.RemoveClaim(ctx, sessionId, claim.SupplierAddress) @@ -149,14 +159,14 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes. return expiringClaims } -// isProofRequiredForClaim checks if a proof is required for a claim. +// proofRequirementForClaim checks if a proof is required for a claim. // If it is not, the claim will be settled without a proof. // If it is, the claim will only be settled if a valid proof is available. // TODO_BLOCKER(@bryanchriswhite, #419): Document safety assumptions of the probabilistic proofs mechanism. -func (k Keeper) isProofRequiredForClaim(ctx sdk.Context, claim *prooftypes.Claim) (_ bool, err error) { - logger := k.logger.With("method", "isProofRequiredForClaim") +func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Claim) (_ prooftypes.ProofRequirementReason, err error) { + logger := k.logger.With("method", "proofRequirementForClaim") - var requirementReason = telemetry.ProofNotRequired + var requirementReason = prooftypes.ProofNotRequired // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { @@ -167,7 +177,7 @@ func (k Keeper) isProofRequiredForClaim(ctx sdk.Context, claim *prooftypes.Claim // is retrieved from the store and validated, on-chain, at time of creation. claimComputeUnits, err := claim.GetNumComputeUnits() if err != nil { - return true, err + return requirementReason, err } proofParams := k.proofKeeper.GetParams(ctx) @@ -182,40 +192,40 @@ func (k Keeper) isProofRequiredForClaim(ctx sdk.Context, claim *prooftypes.Claim // whether there was a proof submission error downstream from here. This would // require a more comprehensive metrics API. if claimComputeUnits >= proofParams.GetProofRequirementThreshold() { - requirementReason = telemetry.ProofRequirementReasonThreshold + requirementReason = prooftypes.ProofRequirementReasonThreshold logger.Info(fmt.Sprintf( "claim requires proof due to compute units (%d) exceeding threshold (%d)", claimComputeUnits, proofParams.GetProofRequirementThreshold(), )) - return true, nil + return requirementReason, nil } // Get the hash of the claim to seed the random number generator. claimHash, err := claim.GetHash() if err != nil { - return true, err + return requirementReason, err } // Sample a pseudo-random value between 0 and 1 to determine if a proof is required probabilistically. randFloat, err := poktrand.SeededFloat32(claimHash[:]) if err != nil { - return true, err + return requirementReason, err } // Require a proof probabilistically based on the proof_request_probability param. // NB: A random value between 0 and 1 will be less than or equal to proof_request_probability // with probability equal to the proof_request_probability. if randFloat <= proofParams.GetProofRequestProbability() { - requirementReason = telemetry.ProofRequirementReasonProbabilistic + requirementReason = prooftypes.ProofRequirementReasonProbabilistic logger.Info(fmt.Sprintf( "claim requires proof due to random sample (%.2f) being less than or equal to probability (%.2f)", randFloat, proofParams.GetProofRequestProbability(), )) - return true, nil + return requirementReason, nil } logger.Info(fmt.Sprintf( @@ -225,5 +235,5 @@ func (k Keeper) isProofRequiredForClaim(ctx sdk.Context, claim *prooftypes.Claim randFloat, proofParams.GetProofRequestProbability(), )) - return false, nil + return requirementReason, nil } diff --git a/x/tokenomics/module/abci.go b/x/tokenomics/module/abci.go index 3994da681..08e463939 100644 --- a/x/tokenomics/module/abci.go +++ b/x/tokenomics/module/abci.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/telemetry" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" "github.com/pokt-network/poktroll/x/tokenomics/keeper" ) @@ -39,17 +40,17 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) (err error) { // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { telemetry.ClaimComputeUnitsCounter( - telemetry.ClaimProofStageSettled, + prooftypes.ClaimProofStageSettled, numComputeUnits, err, ) telemetry.ClaimCounter( - telemetry.ClaimProofStageSettled, + prooftypes.ClaimProofStageSettled, numClaimsSettled, err, ) telemetry.ClaimCounter( - telemetry.ClaimProofStageExpired, + prooftypes.ClaimProofStageExpired, numClaimsExpired, err, ) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index c50abed3d..22800e9b8 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" types "github.com/pokt-network/poktroll/x/proof/types" io "io" @@ -27,8 +28,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // an on-chain proof doesn't have one. The claim cannot be settled, leading to that work // never being rewarded. type EventClaimExpired struct { - Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - ComputeUnits uint64 `protobuf:"varint,2,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` + Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` } func (m *EventClaimExpired) Reset() { *m = EventClaimExpired{} } @@ -71,9 +73,16 @@ func (m *EventClaimExpired) GetClaim() *types.Claim { return nil } -func (m *EventClaimExpired) GetComputeUnits() uint64 { +func (m *EventClaimExpired) GetNumRelays() uint64 { if m != nil { - return m.ComputeUnits + return m.NumRelays + } + return 0 +} + +func (m *EventClaimExpired) GetNumComputeUnits() uint64 { + if m != nil { + return m.NumComputeUnits } return 0 } @@ -81,9 +90,11 @@ func (m *EventClaimExpired) GetComputeUnits() uint64 { // EventClaimSettled is an event emitted whenever a claim is settled. // The proof_required determines whether the claim requires a proof that has been submitted or not type EventClaimSettled struct { - Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - ComputeUnits uint64 `protobuf:"varint,2,opt,name=compute_units,json=computeUnits,proto3" json:"compute_units,omitempty"` - ProofRequired bool `protobuf:"varint,3,opt,name=proof_required,json=proofRequired,proto3" json:"proof_required,omitempty"` + Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + // TODO_IN_THIS_PR: make a protobuf enum + ProofRequirement string `protobuf:"bytes,4,opt,name=proof_requirement,json=proofRequirement,proto3" json:"proof_requirement"` } func (m *EventClaimSettled) Reset() { *m = EventClaimSettled{} } @@ -126,18 +137,25 @@ func (m *EventClaimSettled) GetClaim() *types.Claim { return nil } -func (m *EventClaimSettled) GetComputeUnits() uint64 { +func (m *EventClaimSettled) GetNumRelays() uint64 { if m != nil { - return m.ComputeUnits + return m.NumRelays } return 0 } -func (m *EventClaimSettled) GetProofRequired() bool { +func (m *EventClaimSettled) GetNumComputeUnits() uint64 { if m != nil { - return m.ProofRequired + return m.NumComputeUnits } - return false + return 0 +} + +func (m *EventClaimSettled) GetProofRequirement() string { + if m != nil { + return m.ProofRequirement + } + return "" } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated @@ -227,34 +245,37 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0xcb, 0x8e, 0xd3, 0x30, - 0x14, 0x86, 0xeb, 0xb9, 0x20, 0x6a, 0x18, 0x2e, 0x1e, 0x21, 0xa2, 0x01, 0x42, 0x29, 0x42, 0xaa, - 0x34, 0x9a, 0x44, 0x62, 0xb6, 0x88, 0x05, 0x10, 0x69, 0x58, 0x0c, 0x8b, 0xc0, 0x6c, 0xd8, 0x58, - 0x9e, 0xe4, 0xb4, 0xb1, 0x1a, 0x5f, 0xb0, 0x9d, 0x26, 0x7d, 0x07, 0x16, 0x3c, 0x00, 0x0f, 0xc4, - 0x72, 0x96, 0x2c, 0x51, 0xfb, 0x22, 0xc8, 0x6e, 0x29, 0x15, 0x82, 0x25, 0xdb, 0xff, 0x7c, 0xff, - 0xf9, 0xcf, 0xb1, 0x0f, 0x7e, 0xac, 0xd5, 0xd4, 0x19, 0x55, 0xd7, 0xa9, 0x53, 0x53, 0x90, 0x4a, - 0xf0, 0xc2, 0xa6, 0x30, 0x03, 0xe9, 0x12, 0x6d, 0x94, 0x53, 0xe4, 0xf0, 0x17, 0x90, 0xfc, 0x06, - 0x8e, 0x8e, 0x36, 0x2e, 0x6d, 0x94, 0x1a, 0xa7, 0x45, 0xcd, 0xb8, 0x58, 0x19, 0x86, 0x80, 0xef, - 0x66, 0xde, 0xff, 0xda, 0x6b, 0x59, 0xa7, 0xb9, 0x81, 0x92, 0x1c, 0xe3, 0xfd, 0xc0, 0x44, 0x68, - 0x80, 0x46, 0x37, 0x9e, 0xdf, 0x4b, 0x36, 0x5d, 0x43, 0x83, 0x24, 0xc0, 0xf9, 0x8a, 0x21, 0x4f, - 0xf1, 0x41, 0xa1, 0x84, 0x6e, 0x1c, 0xd0, 0x46, 0x72, 0x67, 0xa3, 0x9d, 0x01, 0x1a, 0xed, 0xe5, - 0x37, 0xd7, 0xe2, 0x85, 0xd7, 0x86, 0x9f, 0xd1, 0x76, 0xce, 0x7b, 0x70, 0xae, 0xfe, 0x1f, 0x39, - 0xe4, 0x19, 0xbe, 0x15, 0xac, 0xd4, 0xc0, 0xa7, 0xc6, 0xef, 0x12, 0xed, 0x0e, 0xd0, 0xe8, 0x7a, - 0x7e, 0x10, 0xd4, 0x7c, 0x2d, 0x0e, 0xbf, 0xee, 0xe0, 0x27, 0x61, 0x9c, 0x1c, 0x6a, 0x36, 0x3f, - 0xe7, 0x92, 0xcb, 0xc9, 0x1b, 0x3e, 0x1e, 0xf3, 0xa2, 0xa9, 0xdd, 0xfc, 0x42, 0x97, 0xcc, 0x41, - 0x49, 0x1e, 0x61, 0x6c, 0xc1, 0xcc, 0x78, 0x01, 0x94, 0x97, 0x61, 0xc6, 0x7e, 0xde, 0x5f, 0x2b, - 0x6f, 0x4b, 0xf2, 0x12, 0x3f, 0xd4, 0x06, 0x66, 0xd4, 0x31, 0x33, 0x01, 0x47, 0x2b, 0x66, 0x2b, - 0x5a, 0x41, 0x47, 0x41, 0x16, 0xaa, 0x84, 0x32, 0xcc, 0xd7, 0xcf, 0x23, 0xcf, 0x7c, 0x08, 0xc8, - 0x19, 0xb3, 0xd5, 0x19, 0x74, 0xd9, 0xaa, 0x4e, 0x5e, 0xe0, 0x07, 0x12, 0xda, 0x7f, 0xda, 0x77, - 0x83, 0xfd, 0xbe, 0x84, 0xf6, 0xaf, 0xee, 0x13, 0x7c, 0x18, 0xd2, 0x65, 0x23, 0xa8, 0xf1, 0x5b, - 0x58, 0x0a, 0x82, 0x45, 0x7b, 0xe1, 0x51, 0xee, 0xf8, 0xd2, 0xbb, 0x46, 0x84, 0xf5, 0x6c, 0x26, - 0x18, 0x39, 0xc6, 0xc4, 0x87, 0xfd, 0x41, 0xef, 0x07, 0xfa, 0xb6, 0x84, 0x76, 0x1b, 0x7e, 0x75, - 0xfe, 0x6d, 0x11, 0xa3, 0xab, 0x45, 0x8c, 0x7e, 0x2c, 0x62, 0xf4, 0x65, 0x19, 0xf7, 0xae, 0x96, - 0x71, 0xef, 0xfb, 0x32, 0xee, 0x7d, 0x3c, 0x9d, 0x70, 0x57, 0x35, 0x97, 0x49, 0xa1, 0x44, 0xea, - 0x3f, 0xeb, 0x44, 0x82, 0x6b, 0x95, 0x99, 0xa6, 0x9b, 0x13, 0xeb, 0xb6, 0x4f, 0xd3, 0xcd, 0x35, - 0xd8, 0xcb, 0x6b, 0xe1, 0xd4, 0x4e, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0xee, 0x9a, 0x02, 0xb4, - 0xbe, 0x02, 0x00, 0x00, + // 479 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0xcd, 0x6e, 0xd3, 0x40, + 0x14, 0x85, 0xe3, 0x34, 0x45, 0xf2, 0x20, 0x51, 0x32, 0xa5, 0x22, 0x0a, 0xe0, 0x84, 0xac, 0x22, + 0xa1, 0xd8, 0x12, 0x95, 0x58, 0x21, 0x24, 0x52, 0x22, 0x95, 0x45, 0x59, 0x18, 0xba, 0x61, 0x63, + 0xb9, 0xf6, 0x8d, 0x3d, 0x8a, 0x67, 0xc6, 0x8c, 0xc7, 0xf9, 0x59, 0xf2, 0x06, 0x3c, 0x00, 0xaf, + 0xc2, 0x9e, 0x65, 0x97, 0xac, 0x22, 0x94, 0xec, 0xf2, 0x14, 0x68, 0xae, 0x69, 0x12, 0x51, 0x78, + 0x00, 0x56, 0x19, 0x9d, 0xf3, 0xdd, 0x9f, 0x1c, 0xf9, 0x92, 0x4e, 0x2e, 0x27, 0x5a, 0xc9, 0x2c, + 0xf3, 0xb4, 0x9c, 0x80, 0x90, 0x9c, 0x45, 0x85, 0x07, 0x53, 0x10, 0xda, 0xcd, 0x95, 0xd4, 0x92, + 0x1e, 0xdf, 0x00, 0xee, 0x0e, 0x68, 0x3f, 0x48, 0x64, 0x22, 0xd1, 0xf7, 0xcc, 0xab, 0x42, 0xdb, + 0xed, 0x6d, 0xaf, 0x5c, 0x49, 0x39, 0xf6, 0xa2, 0x2c, 0x64, 0xbc, 0xf2, 0x7a, 0xdf, 0x2c, 0xd2, + 0x1c, 0x99, 0xb6, 0x67, 0x46, 0x1c, 0xcd, 0x73, 0xa6, 0x20, 0xa6, 0x2f, 0xc8, 0x21, 0x42, 0x2d, + 0xab, 0x6b, 0xf5, 0xef, 0x3e, 0x3f, 0x71, 0xb7, 0xc3, 0xb0, 0x83, 0x8b, 0xf0, 0xd0, 0xde, 0x2c, + 0x3b, 0x15, 0xe7, 0x57, 0x3f, 0x74, 0x40, 0x88, 0x28, 0x79, 0xa0, 0x20, 0x0b, 0x17, 0x45, 0xab, + 0xde, 0xb5, 0xfa, 0x8d, 0xe1, 0xbd, 0xcd, 0xb2, 0xb3, 0xa7, 0xfa, 0xb6, 0x28, 0xb9, 0x8f, 0x4f, + 0xfa, 0x9a, 0x34, 0x8d, 0x11, 0x49, 0x9e, 0x97, 0x1a, 0x82, 0x52, 0x30, 0x5d, 0xb4, 0x0e, 0xb0, + 0xea, 0x64, 0xb3, 0xec, 0xdc, 0x36, 0xfd, 0x23, 0x51, 0xf2, 0xb3, 0x4a, 0xb9, 0x34, 0x42, 0xef, + 0x73, 0x7d, 0x7f, 0xff, 0xf7, 0xa0, 0x75, 0xf6, 0x3f, 0xed, 0x4f, 0x87, 0xa4, 0x89, 0x2b, 0x05, + 0x0a, 0x3e, 0x95, 0x4c, 0x01, 0x07, 0xa1, 0x5b, 0x8d, 0xae, 0xd5, 0xb7, 0xab, 0x16, 0xb7, 0x4c, + 0xff, 0x3e, 0x4a, 0xfe, 0x4e, 0xe9, 0x7d, 0xad, 0x93, 0xa7, 0x98, 0x01, 0xae, 0x75, 0xc1, 0x04, + 0x13, 0xc9, 0x1b, 0x36, 0x1e, 0xb3, 0xa8, 0xcc, 0xf4, 0xe2, 0x32, 0x8f, 0x43, 0x0d, 0x31, 0x7d, + 0x42, 0x48, 0x01, 0x6a, 0xca, 0x22, 0x08, 0x58, 0x8c, 0xc1, 0xd8, 0xbe, 0xfd, 0x5b, 0x79, 0x1b, + 0xd3, 0x57, 0xe4, 0x71, 0xae, 0x60, 0x1a, 0xe8, 0x50, 0x25, 0xa0, 0x83, 0x34, 0x2c, 0xd2, 0x20, + 0x85, 0x79, 0x00, 0x22, 0x92, 0x31, 0xc4, 0x18, 0x86, 0xed, 0xb7, 0x0c, 0xf3, 0x01, 0x91, 0xf3, + 0xb0, 0x48, 0xcf, 0x61, 0x3e, 0xaa, 0x7c, 0xfa, 0x92, 0x3c, 0x12, 0x30, 0xfb, 0x67, 0xf9, 0x01, + 0x96, 0x3f, 0x14, 0x30, 0xfb, 0x6b, 0xf5, 0x80, 0x1c, 0xe3, 0xf4, 0x5d, 0xce, 0x01, 0xf0, 0x10, + 0x83, 0x68, 0x98, 0x7f, 0x0c, 0xd3, 0x77, 0x37, 0xa9, 0x8f, 0x78, 0x48, 0x9f, 0x11, 0x6a, 0x86, + 0xfd, 0x41, 0x1f, 0x22, 0x7d, 0x24, 0x60, 0xb6, 0x0f, 0x0f, 0x2f, 0xbe, 0xaf, 0x1c, 0xeb, 0x7a, + 0xe5, 0x58, 0x3f, 0x57, 0x8e, 0xf5, 0x65, 0xed, 0xd4, 0xae, 0xd7, 0x4e, 0xed, 0xc7, 0xda, 0xa9, + 0x7d, 0x3c, 0x4d, 0x98, 0x4e, 0xcb, 0x2b, 0x37, 0x92, 0xdc, 0x33, 0x5f, 0xc8, 0x40, 0x80, 0x9e, + 0x49, 0x35, 0xf1, 0xb6, 0x07, 0x33, 0xdf, 0x3f, 0x3f, 0xbd, 0xc8, 0xa1, 0xb8, 0xba, 0x83, 0x87, + 0x73, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x6c, 0x83, 0xec, 0xa2, 0x03, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -277,8 +298,13 @@ func (m *EventClaimExpired) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.ComputeUnits)) + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) i-- dAtA[i] = 0x10 } @@ -317,18 +343,20 @@ func (m *EventClaimSettled) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ProofRequired { + if len(m.ProofRequirement) > 0 { + i -= len(m.ProofRequirement) + copy(dAtA[i:], m.ProofRequirement) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ProofRequirement))) i-- - if m.ProofRequired { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + dAtA[i] = 0x22 + } + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) i-- dAtA[i] = 0x18 } - if m.ComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.ComputeUnits)) + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) i-- dAtA[i] = 0x10 } @@ -422,8 +450,11 @@ func (m *EventClaimExpired) Size() (n int) { l = m.Claim.Size() n += 1 + l + sovEvent(uint64(l)) } - if m.ComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.ComputeUnits)) + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) + } + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) } return n } @@ -438,11 +469,15 @@ func (m *EventClaimSettled) Size() (n int) { l = m.Claim.Size() n += 1 + l + sovEvent(uint64(l)) } - if m.ComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.ComputeUnits)) + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.ProofRequired { - n += 2 + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) + } + l = len(m.ProofRequirement) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -547,9 +582,28 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + m.NumRelays = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) } - m.ComputeUnits = 0 + m.NumComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -559,7 +613,7 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ComputeUnits |= uint64(b&0x7F) << shift + m.NumComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -652,9 +706,9 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) } - m.ComputeUnits = 0 + m.NumRelays = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -664,16 +718,16 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ComputeUnits |= uint64(b&0x7F) << shift + m.NumRelays |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofRequired", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) } - var v int + m.NumComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -683,12 +737,43 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.NumComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.ProofRequired = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + 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 ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofRequirement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) From e4f2df2402a8b3a71eb96d3cde86036289083a5f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 13:33:35 +0200 Subject: [PATCH 02/15] refactor: proof requirement reason & claim/proof stage as protobuf enums --- api/poktroll/proof/requirement.pulsar.go | 144 ++++++++++++++ api/poktroll/proof/stage.pulsar.go | 146 ++++++++++++++ api/poktroll/tokenomics/event.pulsar.go | 196 +++++++++---------- proto/poktroll/proof/requirement.proto | 11 ++ proto/poktroll/proof/stage.proto | 12 ++ proto/poktroll/tokenomics/event.proto | 4 +- telemetry/event_counters.go | 8 +- x/proof/keeper/msg_server_create_claim.go | 4 +- x/proof/keeper/msg_server_submit_proof.go | 4 +- x/proof/types/requirement.pb.go | 72 +++++++ x/proof/types/stage.pb.go | 74 +++++++ x/proof/types/types.go | 20 -- x/tokenomics/keeper/settle_pending_claims.go | 9 +- x/tokenomics/module/abci.go | 7 +- x/tokenomics/types/event.pb.go | 109 +++++------ 15 files changed, 618 insertions(+), 202 deletions(-) create mode 100644 api/poktroll/proof/requirement.pulsar.go create mode 100644 api/poktroll/proof/stage.pulsar.go create mode 100644 proto/poktroll/proof/requirement.proto create mode 100644 proto/poktroll/proof/stage.proto create mode 100644 x/proof/types/requirement.pb.go create mode 100644 x/proof/types/stage.pb.go diff --git a/api/poktroll/proof/requirement.pulsar.go b/api/poktroll/proof/requirement.pulsar.go new file mode 100644 index 000000000..ea1f308f8 --- /dev/null +++ b/api/poktroll/proof/requirement.pulsar.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/requirement.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ProofRequirementReason int32 + +const ( + ProofRequirementReason_NOT_REQUIRED ProofRequirementReason = 0 + ProofRequirementReason_PROBABILISTIC ProofRequirementReason = 1 + ProofRequirementReason_THRESHOLD ProofRequirementReason = 2 +) + +// Enum value maps for ProofRequirementReason. +var ( + ProofRequirementReason_name = map[int32]string{ + 0: "NOT_REQUIRED", + 1: "PROBABILISTIC", + 2: "THRESHOLD", + } + ProofRequirementReason_value = map[string]int32{ + "NOT_REQUIRED": 0, + "PROBABILISTIC": 1, + "THRESHOLD": 2, + } +) + +func (x ProofRequirementReason) Enum() *ProofRequirementReason { + p := new(ProofRequirementReason) + *p = x + return p +} + +func (x ProofRequirementReason) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProofRequirementReason) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_proof_requirement_proto_enumTypes[0].Descriptor() +} + +func (ProofRequirementReason) Type() protoreflect.EnumType { + return &file_poktroll_proof_requirement_proto_enumTypes[0] +} + +func (x ProofRequirementReason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ProofRequirementReason.Descriptor instead. +func (ProofRequirementReason) EnumDescriptor() ([]byte, []int) { + return file_poktroll_proof_requirement_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_proof_requirement_proto protoreflect.FileDescriptor + +var file_poktroll_proof_requirement_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2a, 0x4c, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x0c, + 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, + 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x42, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x53, 0x54, 0x49, 0x43, 0x10, + 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x02, + 0x42, 0xa0, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x10, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, + 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, + 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_requirement_proto_rawDescOnce sync.Once + file_poktroll_proof_requirement_proto_rawDescData = file_poktroll_proof_requirement_proto_rawDesc +) + +func file_poktroll_proof_requirement_proto_rawDescGZIP() []byte { + file_poktroll_proof_requirement_proto_rawDescOnce.Do(func() { + file_poktroll_proof_requirement_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_requirement_proto_rawDescData) + }) + return file_poktroll_proof_requirement_proto_rawDescData +} + +var file_poktroll_proof_requirement_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_poktroll_proof_requirement_proto_goTypes = []interface{}{ + (ProofRequirementReason)(0), // 0: poktroll.proof.ProofRequirementReason +} +var file_poktroll_proof_requirement_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_requirement_proto_init() } +func file_poktroll_proof_requirement_proto_init() { + if File_poktroll_proof_requirement_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_requirement_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_requirement_proto_goTypes, + DependencyIndexes: file_poktroll_proof_requirement_proto_depIdxs, + EnumInfos: file_poktroll_proof_requirement_proto_enumTypes, + }.Build() + File_poktroll_proof_requirement_proto = out.File + file_poktroll_proof_requirement_proto_rawDesc = nil + file_poktroll_proof_requirement_proto_goTypes = nil + file_poktroll_proof_requirement_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/stage.pulsar.go b/api/poktroll/proof/stage.pulsar.go new file mode 100644 index 000000000..48afa3009 --- /dev/null +++ b/api/poktroll/proof/stage.pulsar.go @@ -0,0 +1,146 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/stage.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClaimProofStage int32 + +const ( + ClaimProofStage_CLAIMED ClaimProofStage = 0 + ClaimProofStage_PROVEN ClaimProofStage = 1 + ClaimProofStage_SETTLED ClaimProofStage = 2 + ClaimProofStage_EXPIRED ClaimProofStage = 3 +) + +// Enum value maps for ClaimProofStage. +var ( + ClaimProofStage_name = map[int32]string{ + 0: "CLAIMED", + 1: "PROVEN", + 2: "SETTLED", + 3: "EXPIRED", + } + ClaimProofStage_value = map[string]int32{ + "CLAIMED": 0, + "PROVEN": 1, + "SETTLED": 2, + "EXPIRED": 3, + } +) + +func (x ClaimProofStage) Enum() *ClaimProofStage { + p := new(ClaimProofStage) + *p = x + return p +} + +func (x ClaimProofStage) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClaimProofStage) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_proof_stage_proto_enumTypes[0].Descriptor() +} + +func (ClaimProofStage) Type() protoreflect.EnumType { + return &file_poktroll_proof_stage_proto_enumTypes[0] +} + +func (x ClaimProofStage) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClaimProofStage.Descriptor instead. +func (ClaimProofStage) EnumDescriptor() ([]byte, []int) { + return file_poktroll_proof_stage_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_proof_stage_proto protoreflect.FileDescriptor + +var file_poktroll_proof_stage_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x73, 0x74, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2a, 0x44, 0x0a, 0x0f, + 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, + 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, + 0x50, 0x52, 0x4f, 0x56, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x54, + 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, + 0x10, 0x03, 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x67, 0x65, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, + 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, + 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_stage_proto_rawDescOnce sync.Once + file_poktroll_proof_stage_proto_rawDescData = file_poktroll_proof_stage_proto_rawDesc +) + +func file_poktroll_proof_stage_proto_rawDescGZIP() []byte { + file_poktroll_proof_stage_proto_rawDescOnce.Do(func() { + file_poktroll_proof_stage_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_stage_proto_rawDescData) + }) + return file_poktroll_proof_stage_proto_rawDescData +} + +var file_poktroll_proof_stage_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_poktroll_proof_stage_proto_goTypes = []interface{}{ + (ClaimProofStage)(0), // 0: poktroll.proof.ClaimProofStage +} +var file_poktroll_proof_stage_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_stage_proto_init() } +func file_poktroll_proof_stage_proto_init() { + if File_poktroll_proof_stage_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_stage_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_stage_proto_goTypes, + DependencyIndexes: file_poktroll_proof_stage_proto_depIdxs, + EnumInfos: file_poktroll_proof_stage_proto_enumTypes, + }.Build() + File_poktroll_proof_stage_proto = out.File + file_poktroll_proof_stage_proto_rawDesc = nil + file_poktroll_proof_stage_proto_goTypes = nil + file_poktroll_proof_stage_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index be04fe8c9..7da1fe30e 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2,10 +2,10 @@ package tokenomics import ( - proof "github.com/pokt-network/poktroll/api/poktroll/proof" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + proof "github.com/pokt-network/poktroll/api/poktroll/proof" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -645,8 +645,8 @@ func (x *fastReflection_EventClaimSettled) Range(f func(protoreflect.FieldDescri return } } - if x.ProofRequirement != "" { - value := protoreflect.ValueOfString(x.ProofRequirement) + if x.ProofRequirement != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ProofRequirement)) if !f(fd_EventClaimSettled_proof_requirement, value) { return } @@ -673,7 +673,7 @@ func (x *fastReflection_EventClaimSettled) Has(fd protoreflect.FieldDescriptor) case "poktroll.tokenomics.EventClaimSettled.num_compute_units": return x.NumComputeUnits != uint64(0) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - return x.ProofRequirement != "" + return x.ProofRequirement != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -697,7 +697,7 @@ func (x *fastReflection_EventClaimSettled) Clear(fd protoreflect.FieldDescriptor case "poktroll.tokenomics.EventClaimSettled.num_compute_units": x.NumComputeUnits = uint64(0) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - x.ProofRequirement = "" + x.ProofRequirement = 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -725,7 +725,7 @@ func (x *fastReflection_EventClaimSettled) Get(descriptor protoreflect.FieldDesc return protoreflect.ValueOfUint64(value) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": value := x.ProofRequirement - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -753,7 +753,7 @@ func (x *fastReflection_EventClaimSettled) Set(fd protoreflect.FieldDescriptor, case "poktroll.tokenomics.EventClaimSettled.num_compute_units": x.NumComputeUnits = value.Uint() case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - x.ProofRequirement = value.Interface().(string) + x.ProofRequirement = (proof.ProofRequirementReason)(value.Enum()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -806,7 +806,7 @@ func (x *fastReflection_EventClaimSettled) NewField(fd protoreflect.FieldDescrip case "poktroll.tokenomics.EventClaimSettled.num_compute_units": return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - return protoreflect.ValueOfString("") + return protoreflect.ValueOfEnum(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -886,9 +886,8 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { if x.NumComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) } - l = len(x.ProofRequirement) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if x.ProofRequirement != 0 { + n += 1 + runtime.Sov(uint64(x.ProofRequirement)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -919,12 +918,10 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.ProofRequirement) > 0 { - i -= len(x.ProofRequirement) - copy(dAtA[i:], x.ProofRequirement) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProofRequirement))) + if x.ProofRequirement != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProofRequirement)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if x.NumComputeUnits != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) @@ -1074,10 +1071,10 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { } } case 4: - if wireType != 2 { + if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) } - var stringLen uint64 + x.ProofRequirement = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1087,24 +1084,11 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + x.ProofRequirement |= proof.ProofRequirementReason(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.ProofRequirement = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1858,11 +1842,10 @@ type EventClaimSettled struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` - // TODO_IN_THIS_PR: make a protobuf enum - ProofRequirement string `protobuf:"bytes,4,opt,name=proof_requirement,json=proofRequirement,proto3" json:"proof_requirement,omitempty"` + Claim *proof.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + ProofRequirement proof.ProofRequirementReason `protobuf:"varint,4,opt,name=proof_requirement,json=proofRequirement,proto3,enum=poktroll.proof.ProofRequirementReason" json:"proof_requirement,omitempty"` } func (x *EventClaimSettled) Reset() { @@ -1906,11 +1889,11 @@ func (x *EventClaimSettled) GetNumComputeUnits() uint64 { return 0 } -func (x *EventClaimSettled) GetProofRequirement() string { +func (x *EventClaimSettled) GetProofRequirement() proof.ProofRequirementReason { if x != nil { return x.ProofRequirement } - return "" + return proof.ProofRequirementReason(0) } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated @@ -1991,65 +1974,70 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, - 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x36, - 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, - 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, - 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x81, 0x02, 0x0a, 0x11, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, - 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, - 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, - 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x9c, 0x02, 0x0a, - 0x21, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, - 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x6e, 0x65, 0x77, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, - 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, - 0x2d, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, - 0x65, 0x76, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, - 0x0a, 0x12, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, - 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x42, 0xb8, 0x01, 0x0a, 0x17, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, - 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x11, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, + 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, + 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xa9, 0x02, 0x0a, 0x11, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, + 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, + 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x6a, 0x0a, 0x11, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x15, 0xea, + 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x9c, 0x02, 0x0a, 0x21, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x70, + 0x72, 0x65, 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, + 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, + 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x6e, + 0x65, 0x77, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, + 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x17, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, + 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x13, 0x70, 0x72, 0x65, + 0x76, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x4e, 0x75, 0x6d, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, 0x0a, 0x12, 0x6e, 0x65, 0x77, 0x5f, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x45, 0x6d, 0x61, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2070,15 +2058,17 @@ var file_poktroll_tokenomics_event_proto_goTypes = []interface{}{ (*EventClaimSettled)(nil), // 1: poktroll.tokenomics.EventClaimSettled (*EventRelayMiningDifficultyUpdated)(nil), // 2: poktroll.tokenomics.EventRelayMiningDifficultyUpdated (*proof.Claim)(nil), // 3: poktroll.proof.Claim + (proof.ProofRequirementReason)(0), // 4: poktroll.proof.ProofRequirementReason } var file_poktroll_tokenomics_event_proto_depIdxs = []int32{ 3, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim 3, // 1: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 4, // 2: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_tokenomics_event_proto_init() } diff --git a/proto/poktroll/proof/requirement.proto b/proto/poktroll/proof/requirement.proto new file mode 100644 index 000000000..af0acbbd8 --- /dev/null +++ b/proto/poktroll/proof/requirement.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package poktroll.proof; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +enum ProofRequirementReason { + NOT_REQUIRED = 0; + PROBABILISTIC = 1; + THRESHOLD = 2; +} \ No newline at end of file diff --git a/proto/poktroll/proof/stage.proto b/proto/poktroll/proof/stage.proto new file mode 100644 index 000000000..4fcbb2311 --- /dev/null +++ b/proto/poktroll/proof/stage.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package poktroll.proof; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +enum ClaimProofStage { + CLAIMED = 0; + PROVEN = 1; + SETTLED = 2; + EXPIRED = 3; +} \ No newline at end of file diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index edd8a5b9e..2652f330e 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -5,6 +5,7 @@ option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; import "gogoproto/gogo.proto"; import "poktroll/proof/claim.proto"; +import "poktroll/proof/requirement.proto"; // EventClaimExpired is an event emitted during settlement whenever a claim requiring // an on-chain proof doesn't have one. The claim cannot be settled, leading to that work @@ -21,8 +22,7 @@ message EventClaimSettled { poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; - // TODO_IN_THIS_PR: make a protobuf enum - string proof_requirement = 4 [(gogoproto.jsontag) = "proof_requirement"]; + poktroll.proof.ProofRequirementReason proof_requirement = 4 [(gogoproto.jsontag) = "proof_requirement"]; } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated diff --git a/telemetry/event_counters.go b/telemetry/event_counters.go index 611de99a9..b1b0126c6 100644 --- a/telemetry/event_counters.go +++ b/telemetry/event_counters.go @@ -45,9 +45,9 @@ func ProofRequirementCounter( err error, ) { incrementAmount := 1 - isRequired := strconv.FormatBool(reason != prooftypes.ProofNotRequired) + isRequired := strconv.FormatBool(reason != prooftypes.ProofRequirementReason_NOT_REQUIRED) labels := []metrics.Label{ - {Name: "proof_required_reason", Value: reason}, + {Name: "proof_required_reason", Value: reason.String()}, {Name: "is_required", Value: isRequired}, } @@ -76,7 +76,7 @@ func ClaimComputeUnitsCounter( incrementAmount := numComputeUnits labels := []metrics.Label{ {Name: "unit", Value: "compute_units"}, - {Name: "claim_proof_stage", Value: claimProofStage}, + {Name: "claim_proof_stage", Value: claimProofStage.String()}, } // Ensure the counter is not incremented if there was an error. @@ -104,7 +104,7 @@ func ClaimCounter( incrementAmount := numClaims labels := []metrics.Label{ {Name: "unit", Value: "claims"}, - {Name: "claim_proof_stage", Value: claimProofStage}, + {Name: "claim_proof_stage", Value: claimProofStage.String()}, } // Ensure the counter is not incremented if there was an error. diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index ef5b54b29..8a7eeb690 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -24,9 +24,9 @@ func (k msgServer) CreateClaim( numComputeUnits, deferredErr := claim.GetNumComputeUnits() err = errors.Join(err, deferredErr) - telemetry.ClaimCounter(telemetry.ClaimProofStageClaimed, 1, err) + telemetry.ClaimCounter(types.ClaimProofStage_CLAIMED, 1, err) telemetry.ClaimComputeUnitsCounter( - telemetry.ClaimProofStageClaimed, + types.ClaimProofStage_CLAIMED, numComputeUnits, err, ) diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index 5beff318a..b3c58f44d 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -68,9 +68,9 @@ func (k msgServer) SubmitProof( numComputeUnits, deferredErr := claim.GetNumComputeUnits() err = errors.Join(err, deferredErr) - telemetry.ClaimCounter(telemetry.ClaimProofStageProven, 1, err) + telemetry.ClaimCounter(types.ClaimProofStage_PROVEN, 1, err) telemetry.ClaimComputeUnitsCounter( - telemetry.ClaimProofStageProven, + types.ClaimProofStage_PROVEN, numComputeUnits, err, ) diff --git a/x/proof/types/requirement.pb.go b/x/proof/types/requirement.pb.go new file mode 100644 index 000000000..78b52fc2e --- /dev/null +++ b/x/proof/types/requirement.pb.go @@ -0,0 +1,72 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: poktroll/proof/requirement.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ProofRequirementReason int32 + +const ( + ProofRequirementReason_NOT_REQUIRED ProofRequirementReason = 0 + ProofRequirementReason_PROBABILISTIC ProofRequirementReason = 1 + ProofRequirementReason_THRESHOLD ProofRequirementReason = 2 +) + +var ProofRequirementReason_name = map[int32]string{ + 0: "NOT_REQUIRED", + 1: "PROBABILISTIC", + 2: "THRESHOLD", +} + +var ProofRequirementReason_value = map[string]int32{ + "NOT_REQUIRED": 0, + "PROBABILISTIC": 1, + "THRESHOLD": 2, +} + +func (x ProofRequirementReason) String() string { + return proto.EnumName(ProofRequirementReason_name, int32(x)) +} + +func (ProofRequirementReason) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_33d036c0b01e3395, []int{0} +} + +func init() { + proto.RegisterEnum("poktroll.proof.ProofRequirementReason", ProofRequirementReason_name, ProofRequirementReason_value) +} + +func init() { proto.RegisterFile("poktroll/proof/requirement.proto", fileDescriptor_33d036c0b01e3395) } + +var fileDescriptor_33d036c0b01e3395 = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xc8, 0xcf, 0x2e, + 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0xd3, 0x2f, 0x4a, 0x2d, 0x2c, 0xcd, + 0x2c, 0x4a, 0xcd, 0x4d, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xa9, + 0xd0, 0x03, 0xab, 0xd0, 0xf2, 0xe1, 0x12, 0x0b, 0x00, 0x31, 0x82, 0x10, 0x2a, 0x83, 0x52, 0x13, + 0x8b, 0xf3, 0xf3, 0x84, 0x04, 0xb8, 0x78, 0xfc, 0xfc, 0x43, 0xe2, 0x83, 0x5c, 0x03, 0x43, 0x3d, + 0x83, 0x5c, 0x5d, 0x04, 0x18, 0x84, 0x04, 0xb9, 0x78, 0x03, 0x82, 0xfc, 0x9d, 0x1c, 0x9d, 0x3c, + 0x7d, 0x3c, 0x83, 0x43, 0x3c, 0x9d, 0x05, 0x18, 0x85, 0x78, 0xb9, 0x38, 0x43, 0x3c, 0x82, 0x5c, + 0x83, 0x3d, 0xfc, 0x7d, 0x5c, 0x04, 0x98, 0x9c, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, + 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, + 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, + 0xe4, 0x04, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0xb8, 0x8b, 0x2b, 0xa0, 0x6e, + 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x3b, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0x12, 0x9e, 0x3a, 0x15, 0xd2, 0x00, 0x00, 0x00, +} diff --git a/x/proof/types/stage.pb.go b/x/proof/types/stage.pb.go new file mode 100644 index 000000000..80d215572 --- /dev/null +++ b/x/proof/types/stage.pb.go @@ -0,0 +1,74 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: poktroll/proof/stage.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ClaimProofStage int32 + +const ( + ClaimProofStage_CLAIMED ClaimProofStage = 0 + ClaimProofStage_PROVEN ClaimProofStage = 1 + ClaimProofStage_SETTLED ClaimProofStage = 2 + ClaimProofStage_EXPIRED ClaimProofStage = 3 +) + +var ClaimProofStage_name = map[int32]string{ + 0: "CLAIMED", + 1: "PROVEN", + 2: "SETTLED", + 3: "EXPIRED", +} + +var ClaimProofStage_value = map[string]int32{ + "CLAIMED": 0, + "PROVEN": 1, + "SETTLED": 2, + "EXPIRED": 3, +} + +func (x ClaimProofStage) String() string { + return proto.EnumName(ClaimProofStage_name, int32(x)) +} + +func (ClaimProofStage) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b565e55c52d3566e, []int{0} +} + +func init() { + proto.RegisterEnum("poktroll.proof.ClaimProofStage", ClaimProofStage_name, ClaimProofStage_value) +} + +func init() { proto.RegisterFile("poktroll/proof/stage.proto", fileDescriptor_b565e55c52d3566e) } + +var fileDescriptor_b565e55c52d3566e = []byte{ + // 188 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xc8, 0xcf, 0x2e, + 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0xd3, 0x2f, 0x2e, 0x49, 0x4c, 0x4f, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xc9, 0xe9, 0x81, 0xe5, 0xb4, 0x5c, 0xb8, + 0xf8, 0x9d, 0x73, 0x12, 0x33, 0x73, 0x03, 0x40, 0xbc, 0x60, 0x90, 0x42, 0x21, 0x6e, 0x2e, 0x76, + 0x67, 0x1f, 0x47, 0x4f, 0x5f, 0x57, 0x17, 0x01, 0x06, 0x21, 0x2e, 0x2e, 0xb6, 0x80, 0x20, 0xff, + 0x30, 0x57, 0x3f, 0x01, 0x46, 0x90, 0x44, 0xb0, 0x6b, 0x48, 0x88, 0x8f, 0xab, 0x8b, 0x00, 0x13, + 0x88, 0xe3, 0x1a, 0x11, 0xe0, 0x19, 0xe4, 0xea, 0x22, 0xc0, 0xec, 0xe4, 0x71, 0xe2, 0x91, 0x1c, + 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, + 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x7a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, + 0xf9, 0xb9, 0xfa, 0x20, 0xab, 0x75, 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0xe1, 0x6e, + 0xac, 0x80, 0xba, 0xb2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x4c, 0x63, 0x40, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x09, 0xfc, 0x51, 0x09, 0xc4, 0x00, 0x00, 0x00, +} diff --git a/x/proof/types/types.go b/x/proof/types/types.go index 86d386575..78d9ec9f9 100644 --- a/x/proof/types/types.go +++ b/x/proof/types/types.go @@ -1,23 +1,3 @@ package types // This file is in place to declare the package for dynamically generated protobufs - -// ClaimProofStage is a string enum which represents a stage of a claim proof lifecycle. -type ClaimProofStage = string - -const ( - ClaimProofStageClaimed = ClaimProofStage("claimed") - ClaimProofStageProven = ClaimProofStage("proven") - ClaimProofStageSettled = ClaimProofStage("settled") - ClaimProofStageExpired = ClaimProofStage("expired") -) - -// ProofRequirementReason is a string enum which represents whether -// a proof is required, and why, if it is. -type ProofRequirementReason = string - -const ( - ProofNotRequired = ProofRequirementReason("not_required") - ProofRequirementReasonProbabilistic = ProofRequirementReason("probabilistic_selection") - ProofRequirementReasonThreshold = ProofRequirementReason("above_compute_unit_threshold") -) diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index edb6951cd..7db020fcf 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -64,7 +64,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } - if proofRequirement != prooftypes.ProofNotRequired { + if proofRequirement != prooftypes.ProofRequirementReason_NOT_REQUIRED { // If a proof is not found, the claim will expire and never be settled. if !isProofFound { // Emit an event that a claim has expired and being removed without being settled. @@ -98,6 +98,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( NumComputeUnits: numClaimComputeUnits, ProofRequirement: proofRequirement, } + if err := ctx.EventManager().EmitTypedEvent(&claimSettledEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } @@ -166,7 +167,7 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes. func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Claim) (_ prooftypes.ProofRequirementReason, err error) { logger := k.logger.With("method", "proofRequirementForClaim") - var requirementReason = prooftypes.ProofNotRequired + var requirementReason = prooftypes.ProofRequirementReason_NOT_REQUIRED // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { @@ -192,7 +193,7 @@ func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Clai // whether there was a proof submission error downstream from here. This would // require a more comprehensive metrics API. if claimComputeUnits >= proofParams.GetProofRequirementThreshold() { - requirementReason = prooftypes.ProofRequirementReasonThreshold + requirementReason = prooftypes.ProofRequirementReason_THRESHOLD logger.Info(fmt.Sprintf( "claim requires proof due to compute units (%d) exceeding threshold (%d)", @@ -218,7 +219,7 @@ func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Clai // NB: A random value between 0 and 1 will be less than or equal to proof_request_probability // with probability equal to the proof_request_probability. if randFloat <= proofParams.GetProofRequestProbability() { - requirementReason = prooftypes.ProofRequirementReasonProbabilistic + requirementReason = prooftypes.ProofRequirementReason_PROBABILISTIC logger.Info(fmt.Sprintf( "claim requires proof due to random sample (%.2f) being less than or equal to probability (%.2f)", diff --git a/x/tokenomics/module/abci.go b/x/tokenomics/module/abci.go index 08e463939..dc7484f4e 100644 --- a/x/tokenomics/module/abci.go +++ b/x/tokenomics/module/abci.go @@ -40,20 +40,21 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) (err error) { // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { telemetry.ClaimComputeUnitsCounter( - prooftypes.ClaimProofStageSettled, + prooftypes.ClaimProofStage_SETTLED, numComputeUnits, err, ) telemetry.ClaimCounter( - prooftypes.ClaimProofStageSettled, + prooftypes.ClaimProofStage_SETTLED, numClaimsSettled, err, ) telemetry.ClaimCounter( - prooftypes.ClaimProofStageExpired, + prooftypes.ClaimProofStage_EXPIRED, numClaimsExpired, err, ) + // TODO_IMPROVE(#observability): Add a counter for expired compute units. }() logger.Info(fmt.Sprintf("settled %d claims and expired %d claims", numClaimsSettled, numClaimsExpired)) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 22800e9b8..3d4b74ee8 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -90,11 +90,10 @@ func (m *EventClaimExpired) GetNumComputeUnits() uint64 { // EventClaimSettled is an event emitted whenever a claim is settled. // The proof_required determines whether the claim requires a proof that has been submitted or not type EventClaimSettled struct { - Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` - // TODO_IN_THIS_PR: make a protobuf enum - ProofRequirement string `protobuf:"bytes,4,opt,name=proof_requirement,json=proofRequirement,proto3" json:"proof_requirement"` + Claim *types.Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + ProofRequirement types.ProofRequirementReason `protobuf:"varint,4,opt,name=proof_requirement,json=proofRequirement,proto3,enum=poktroll.proof.ProofRequirementReason" json:"proof_requirement"` } func (m *EventClaimSettled) Reset() { *m = EventClaimSettled{} } @@ -151,11 +150,11 @@ func (m *EventClaimSettled) GetNumComputeUnits() uint64 { return 0 } -func (m *EventClaimSettled) GetProofRequirement() string { +func (m *EventClaimSettled) GetProofRequirement() types.ProofRequirementReason { if m != nil { return m.ProofRequirement } - return "" + return types.ProofRequirementReason_NOT_REQUIRED } // EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated @@ -245,37 +244,39 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 479 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x14, 0x85, 0xe3, 0x34, 0x45, 0xf2, 0x20, 0x51, 0x32, 0xa5, 0x22, 0x0a, 0xe0, 0x84, 0xac, 0x22, - 0xa1, 0xd8, 0x12, 0x95, 0x58, 0x21, 0x24, 0x52, 0x22, 0x95, 0x45, 0x59, 0x18, 0xba, 0x61, 0x63, - 0xb9, 0xf6, 0x8d, 0x3d, 0x8a, 0x67, 0xc6, 0x8c, 0xc7, 0xf9, 0x59, 0xf2, 0x06, 0x3c, 0x00, 0xaf, - 0xc2, 0x9e, 0x65, 0x97, 0xac, 0x22, 0x94, 0xec, 0xf2, 0x14, 0x68, 0xae, 0x69, 0x12, 0x51, 0x78, - 0x00, 0x56, 0x19, 0x9d, 0xf3, 0xdd, 0x9f, 0x1c, 0xf9, 0x92, 0x4e, 0x2e, 0x27, 0x5a, 0xc9, 0x2c, - 0xf3, 0xb4, 0x9c, 0x80, 0x90, 0x9c, 0x45, 0x85, 0x07, 0x53, 0x10, 0xda, 0xcd, 0x95, 0xd4, 0x92, - 0x1e, 0xdf, 0x00, 0xee, 0x0e, 0x68, 0x3f, 0x48, 0x64, 0x22, 0xd1, 0xf7, 0xcc, 0xab, 0x42, 0xdb, - 0xed, 0x6d, 0xaf, 0x5c, 0x49, 0x39, 0xf6, 0xa2, 0x2c, 0x64, 0xbc, 0xf2, 0x7a, 0xdf, 0x2c, 0xd2, - 0x1c, 0x99, 0xb6, 0x67, 0x46, 0x1c, 0xcd, 0x73, 0xa6, 0x20, 0xa6, 0x2f, 0xc8, 0x21, 0x42, 0x2d, - 0xab, 0x6b, 0xf5, 0xef, 0x3e, 0x3f, 0x71, 0xb7, 0xc3, 0xb0, 0x83, 0x8b, 0xf0, 0xd0, 0xde, 0x2c, - 0x3b, 0x15, 0xe7, 0x57, 0x3f, 0x74, 0x40, 0x88, 0x28, 0x79, 0xa0, 0x20, 0x0b, 0x17, 0x45, 0xab, - 0xde, 0xb5, 0xfa, 0x8d, 0xe1, 0xbd, 0xcd, 0xb2, 0xb3, 0xa7, 0xfa, 0xb6, 0x28, 0xb9, 0x8f, 0x4f, - 0xfa, 0x9a, 0x34, 0x8d, 0x11, 0x49, 0x9e, 0x97, 0x1a, 0x82, 0x52, 0x30, 0x5d, 0xb4, 0x0e, 0xb0, - 0xea, 0x64, 0xb3, 0xec, 0xdc, 0x36, 0xfd, 0x23, 0x51, 0xf2, 0xb3, 0x4a, 0xb9, 0x34, 0x42, 0xef, - 0x73, 0x7d, 0x7f, 0xff, 0xf7, 0xa0, 0x75, 0xf6, 0x3f, 0xed, 0x4f, 0x87, 0xa4, 0x89, 0x2b, 0x05, - 0x0a, 0x3e, 0x95, 0x4c, 0x01, 0x07, 0xa1, 0x5b, 0x8d, 0xae, 0xd5, 0xb7, 0xab, 0x16, 0xb7, 0x4c, - 0xff, 0x3e, 0x4a, 0xfe, 0x4e, 0xe9, 0x7d, 0xad, 0x93, 0xa7, 0x98, 0x01, 0xae, 0x75, 0xc1, 0x04, - 0x13, 0xc9, 0x1b, 0x36, 0x1e, 0xb3, 0xa8, 0xcc, 0xf4, 0xe2, 0x32, 0x8f, 0x43, 0x0d, 0x31, 0x7d, - 0x42, 0x48, 0x01, 0x6a, 0xca, 0x22, 0x08, 0x58, 0x8c, 0xc1, 0xd8, 0xbe, 0xfd, 0x5b, 0x79, 0x1b, - 0xd3, 0x57, 0xe4, 0x71, 0xae, 0x60, 0x1a, 0xe8, 0x50, 0x25, 0xa0, 0x83, 0x34, 0x2c, 0xd2, 0x20, - 0x85, 0x79, 0x00, 0x22, 0x92, 0x31, 0xc4, 0x18, 0x86, 0xed, 0xb7, 0x0c, 0xf3, 0x01, 0x91, 0xf3, - 0xb0, 0x48, 0xcf, 0x61, 0x3e, 0xaa, 0x7c, 0xfa, 0x92, 0x3c, 0x12, 0x30, 0xfb, 0x67, 0xf9, 0x01, - 0x96, 0x3f, 0x14, 0x30, 0xfb, 0x6b, 0xf5, 0x80, 0x1c, 0xe3, 0xf4, 0x5d, 0xce, 0x01, 0xf0, 0x10, - 0x83, 0x68, 0x98, 0x7f, 0x0c, 0xd3, 0x77, 0x37, 0xa9, 0x8f, 0x78, 0x48, 0x9f, 0x11, 0x6a, 0x86, - 0xfd, 0x41, 0x1f, 0x22, 0x7d, 0x24, 0x60, 0xb6, 0x0f, 0x0f, 0x2f, 0xbe, 0xaf, 0x1c, 0xeb, 0x7a, - 0xe5, 0x58, 0x3f, 0x57, 0x8e, 0xf5, 0x65, 0xed, 0xd4, 0xae, 0xd7, 0x4e, 0xed, 0xc7, 0xda, 0xa9, - 0x7d, 0x3c, 0x4d, 0x98, 0x4e, 0xcb, 0x2b, 0x37, 0x92, 0xdc, 0x33, 0x5f, 0xc8, 0x40, 0x80, 0x9e, - 0x49, 0x35, 0xf1, 0xb6, 0x07, 0x33, 0xdf, 0x3f, 0x3f, 0xbd, 0xc8, 0xa1, 0xb8, 0xba, 0x83, 0x87, - 0x73, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x6c, 0x83, 0xec, 0xa2, 0x03, 0x00, 0x00, + // 504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xc7, 0xe3, 0x34, 0xfd, 0x49, 0xde, 0x9f, 0xd4, 0x92, 0x2d, 0x15, 0x56, 0x00, 0x27, 0xe4, + 0x80, 0x22, 0xa1, 0xd8, 0x52, 0x2b, 0x71, 0x42, 0x48, 0xa4, 0x44, 0x2a, 0x87, 0x22, 0x64, 0xe8, + 0x85, 0x8b, 0xe5, 0xda, 0x13, 0x7b, 0x89, 0x77, 0xd7, 0xac, 0xd7, 0xf9, 0xf3, 0x16, 0x3c, 0x00, + 0x2f, 0xc0, 0x43, 0x70, 0xe7, 0xd8, 0x23, 0xa7, 0x08, 0x25, 0xb7, 0x3c, 0x05, 0xda, 0x75, 0x9b, + 0x58, 0x29, 0x3c, 0x00, 0x97, 0x64, 0x35, 0xdf, 0xcf, 0xcc, 0x7c, 0x3d, 0xa3, 0x41, 0xed, 0x8c, + 0x8f, 0xa5, 0xe0, 0x69, 0xea, 0x4a, 0x3e, 0x06, 0xc6, 0x29, 0x09, 0x73, 0x17, 0x26, 0xc0, 0xa4, + 0x93, 0x09, 0x2e, 0x39, 0x3e, 0xba, 0x05, 0x9c, 0x2d, 0xd0, 0xba, 0x1f, 0xf3, 0x98, 0x6b, 0xdd, + 0x55, 0xaf, 0x12, 0x6d, 0xb5, 0x36, 0xb5, 0x32, 0xc1, 0xf9, 0xc8, 0x0d, 0xd3, 0x80, 0xd0, 0x1b, + 0xad, 0xb3, 0xa3, 0x09, 0xf8, 0x5c, 0x10, 0x01, 0x74, 0xd3, 0xa8, 0xfb, 0xdd, 0x40, 0xcd, 0xa1, + 0x6a, 0x7c, 0xa6, 0xd2, 0x86, 0xb3, 0x8c, 0x08, 0x88, 0xf0, 0x73, 0xb4, 0xaf, 0xcb, 0x58, 0x46, + 0xc7, 0xe8, 0xfd, 0x7f, 0x72, 0xec, 0x6c, 0xec, 0xe8, 0x3a, 0x8e, 0x86, 0x07, 0xe6, 0x7a, 0xd1, + 0x2e, 0x39, 0xaf, 0xfc, 0xc3, 0x7d, 0x84, 0x58, 0x41, 0x7d, 0x01, 0x69, 0x30, 0xcf, 0xad, 0x7a, + 0xc7, 0xe8, 0x35, 0x06, 0x07, 0xeb, 0x45, 0xbb, 0x12, 0xf5, 0x4c, 0x56, 0x50, 0x4f, 0x3f, 0xf1, + 0x2b, 0xd4, 0x54, 0x42, 0xc8, 0x69, 0x56, 0x48, 0xf0, 0x0b, 0x46, 0x64, 0x6e, 0xed, 0xe9, 0xac, + 0xe3, 0xf5, 0xa2, 0x7d, 0x57, 0xf4, 0x0e, 0x59, 0x41, 0xcf, 0xca, 0xc8, 0xa5, 0x0a, 0x74, 0xbf, + 0xd5, 0xab, 0xfe, 0xdf, 0x83, 0x94, 0xe9, 0xbf, 0xe4, 0x1f, 0x7f, 0x42, 0x4d, 0x6d, 0xc9, 0xaf, + 0xac, 0xc6, 0x6a, 0x74, 0x8c, 0xde, 0xc1, 0xc9, 0xd3, 0x5d, 0xd7, 0xef, 0xd4, 0xaf, 0xb7, 0xe5, + 0x3c, 0x08, 0x72, 0xce, 0xca, 0x56, 0x77, 0x8a, 0x78, 0xf7, 0xb2, 0x1d, 0xbc, 0xfb, 0xb5, 0x8e, + 0x9e, 0xe8, 0x59, 0x69, 0xfb, 0x17, 0x84, 0x11, 0x16, 0xbf, 0x26, 0xa3, 0x11, 0x09, 0x8b, 0x54, + 0xce, 0x2f, 0xb3, 0x28, 0x90, 0x10, 0xe1, 0xc7, 0x08, 0xe5, 0x20, 0x26, 0x24, 0x04, 0x9f, 0x44, + 0x7a, 0x80, 0xa6, 0x67, 0xde, 0x44, 0xde, 0x44, 0xf8, 0x25, 0x7a, 0x94, 0x09, 0x98, 0xf8, 0x32, + 0x10, 0x31, 0x48, 0x3f, 0x09, 0xf2, 0xc4, 0x4f, 0x60, 0xe6, 0x03, 0x0b, 0x79, 0x04, 0x91, 0x1e, + 0x9a, 0xe9, 0x59, 0x8a, 0xf9, 0xa0, 0x91, 0xf3, 0x20, 0x4f, 0xce, 0x61, 0x36, 0x2c, 0x75, 0xfc, + 0x02, 0x3d, 0x64, 0x30, 0xfd, 0x6b, 0xfa, 0x9e, 0x4e, 0x7f, 0xc0, 0x60, 0xfa, 0xc7, 0xec, 0x3e, + 0x3a, 0xd2, 0xdd, 0xb7, 0xfb, 0xf0, 0x81, 0x06, 0x7a, 0x60, 0x0d, 0xf5, 0xc5, 0x30, 0x79, 0x7b, + 0xbb, 0x9d, 0x21, 0x0d, 0xf0, 0x33, 0x84, 0x55, 0xb3, 0x1d, 0x7a, 0x5f, 0xd3, 0x87, 0x0c, 0xa6, + 0x55, 0x78, 0x70, 0xf1, 0x63, 0x69, 0x1b, 0xd7, 0x4b, 0xdb, 0xf8, 0xb5, 0xb4, 0x8d, 0x2f, 0x2b, + 0xbb, 0x76, 0xbd, 0xb2, 0x6b, 0x3f, 0x57, 0x76, 0xed, 0xe3, 0x69, 0x4c, 0x64, 0x52, 0x5c, 0x39, + 0x21, 0xa7, 0xae, 0xda, 0x49, 0x9f, 0x81, 0x9c, 0x72, 0x31, 0x76, 0x37, 0xe7, 0x35, 0xab, 0x1e, + 0xb2, 0x9c, 0x67, 0x90, 0x5f, 0xfd, 0xa7, 0x0f, 0xec, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xe2, 0x1a, 0xdf, 0x58, 0xec, 0x03, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -343,12 +344,10 @@ func (m *EventClaimSettled) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ProofRequirement) > 0 { - i -= len(m.ProofRequirement) - copy(dAtA[i:], m.ProofRequirement) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ProofRequirement))) + if m.ProofRequirement != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.ProofRequirement)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if m.NumComputeUnits != 0 { i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) @@ -475,9 +474,8 @@ func (m *EventClaimSettled) Size() (n int) { if m.NumComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumComputeUnits)) } - l = len(m.ProofRequirement) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) + if m.ProofRequirement != 0 { + n += 1 + sovEvent(uint64(m.ProofRequirement)) } return n } @@ -743,10 +741,10 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } } case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) } - var stringLen uint64 + m.ProofRequirement = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -756,24 +754,11 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ProofRequirement |= types.ProofRequirementReason(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProofRequirement = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) From e6163cf63b70843b009ce2ec041bab8d249757b4 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 09:01:28 +0200 Subject: [PATCH 03/15] chore: add logs around claim expiration/settlement --- x/tokenomics/keeper/settle_pending_claims.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index 7db020fcf..c6c64f767 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -39,6 +39,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( relaysPerServiceMap = make(map[string]uint64) computeUnitsPerServiceMap = make(map[string]uint64) + logger.Debug("settling expiring claims") for _, claim := range expiringClaims { // NB: Note that not every (Req, Res) pair in the session is inserted in @@ -64,6 +65,15 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } + + logger := k.logger.With( + "session_id", sessionId, + "supplier_address", claim.SupplierAddress, + "num_claim_compute_units", numClaimComputeUnits, + "num_relays_in_session_tree", numRelaysInSessionTree, + "proof_requirement", proofRequirement, + ) + if proofRequirement != prooftypes.ProofRequirementReason_NOT_REQUIRED { // If a proof is not found, the claim will expire and never be settled. if !isProofFound { @@ -76,6 +86,9 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( if err := ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } + + logger.Info("claim expired; required proof not found") + // The claim & proof are no longer necessary, so there's no need for them // to take up on-chain space. k.proofKeeper.RemoveClaim(ctx, sessionId, claim.SupplierAddress) @@ -112,6 +125,8 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } + logger.Info("claim settled") + // The claim & proof are no longer necessary, so there's no need for them // to take up on-chain space. k.proofKeeper.RemoveClaim(ctx, sessionId, claim.SupplierAddress) From 5d68fd9efcd5b50e8e9b725f9705fd92259adc90 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Sat, 22 Jun 2024 10:50:43 +0200 Subject: [PATCH 04/15] refactor: E2E steps to disambiguate tx & begin/end block events --- e2e/tests/0_settlement.feature | 2 +- e2e/tests/init_test.go | 51 +++++++--- e2e/tests/relay.feature | 2 +- e2e/tests/session.feature | 7 +- e2e/tests/session_steps_test.go | 168 +++++++++++++++++++------------- 5 files changed, 143 insertions(+), 87 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index 69c5ce28c..719e8ec0d 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -16,7 +16,7 @@ Feature: Tokenomics Namespace When the supplier "supplier1" has serviced a session with "10" relays for service "anvil" for application "app1" And the user should wait for the "proof" module "CreateClaim" Message to be submitted And the user should wait for the "proof" module "SubmitProof" Message to be submitted - And the user should wait for the "tokenomics" module "ClaimSettled" Event to be broadcast + And the user should wait for the "tokenomics" module "ClaimSettled" end block event to be broadcast Then the account balance of "supplier1" should be "420" uPOKT "more" than before And the "application" stake of "app1" should be "420" uPOKT "less" than before diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 2de6c816d..084fa26b9 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -20,14 +20,17 @@ import ( "cosmossdk.io/depinject" sdklog "cosmossdk.io/log" + abci "github.com/cometbft/cometbft/abci/types" cometcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/codec" "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/pkg/client" "github.com/pokt-network/poktroll/pkg/client/block" "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/client/tx" "github.com/pokt-network/poktroll/testutil/testclient" "github.com/pokt-network/poktroll/testutil/yaml" apptypes "github.com/pokt-network/poktroll/x/application/types" @@ -81,7 +84,9 @@ type suite struct { ctx context.Context once sync.Once // TODO_TECHDEBT: rename to `poktrolld`. - pocketd *pocketdBin + pocketd *pocketdBin + + // TODO_IMPROVE: refactor all usages of scenarioState to be fields on the suite struct. scenarioState map[string]any // temporary state for each scenario cdc codec.Codec proofQueryClient prooftypes.QueryClient @@ -93,6 +98,11 @@ type suite struct { // moduleParamsMap is a map of module names to a map of parameter names to parameter values & types. expectedModuleParams moduleParamsMap + + deps depinject.Config + newBlockEventsReplayClient client.EventsReplayClient[*block.CometNewBlockEvent] + txResultReplayClient client.EventsReplayClient[*abci.TxResult] + finalizeBlockEventsReplayClient client.EventsReplayClient[*abci.Event] } func (s *suite) Before() { @@ -114,6 +124,29 @@ func (s *suite) Before() { flagSet := testclient.NewLocalnetFlagSet(s) clientCtx := testclient.NewLocalnetClientCtx(s, flagSet) s.proofQueryClient = prooftypes.NewQueryClient(clientCtx) + + s.deps = depinject.Supply( + events.NewEventsQueryClient(testclient.CometLocalWebsocketURL), + ) + + // Start the NewBlockEventsReplayClient before the test so that it can't miss any block events. + s.newBlockEventsReplayClient, err = events.NewEventsReplayClient[*block.CometNewBlockEvent]( + s.ctx, + s.deps, + "tm.event='NewBlock'", + block.UnmarshalNewBlockEvent, + eventsReplayClientBufferSize, + ) + require.NoError(s, err) + + s.txResultReplayClient, err = events.NewEventsReplayClient[*abci.TxResult]( + s.ctx, + s.deps, + "tm.event='Tx'", + tx.UnmarshalTxResult, + eventsReplayClientBufferSize, + ) + require.NoError(s, err) } // TestFeatures runs the e2e tests specified in any .features files in this directory @@ -389,18 +422,6 @@ func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithPathAndData( relayKey := relayReferenceKey(appName, supplierName) s.scenarioState[relayKey] = res.Stdout - - deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) - onChainClaimEventsReplayClient, err := events.NewEventsReplayClient[*block.CometNewBlockEvent]( - s.ctx, - deps, - newBlockEventSubscriptionQuery, - block.UnmarshalNewBlockEvent, - eventsReplayClientBufferSize, - ) - require.NoError(s, err) - - s.scenarioState[newBlockEventReplayClientKey] = onChainClaimEventsReplayClient } func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) { @@ -417,8 +438,8 @@ func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName s require.NoError(s, err, `Expected valid JSON, got: %s`, stdout) } -func (s *suite) AModuleEventIsBroadcasted(module, event string) { - s.TheUserShouldWaitForTheModuleEventToBeBroadcast(module, event) +func (s *suite) AModuleEndBlockEventIsBroadcast(module, eventType string) { + s.waitForNewBlockEvent(newEventTypeMatchFn(module, eventType)) } func (s *suite) getStakedAmount(actorType, accName string) (int, bool) { diff --git a/e2e/tests/relay.feature b/e2e/tests/relay.feature index 658493f88..1681de489 100644 --- a/e2e/tests/relay.feature +++ b/e2e/tests/relay.feature @@ -16,7 +16,7 @@ Feature: Relay Namespace And the session for application "app1" and service "ollama" contains the supplier "supplier1" When the application "app1" sends the supplier "supplier1" a request for service "ollama" with path "/api/chat" and data '{"model": "qwen:0.5b", "stream": false, "messages": [{"role": "user", "content":"count from 1 to 10"}]}' Then the application "app1" receives a successful relay response signed by "supplier1" - And a "tokenomics" module "ClaimSettled" event is broadcasted + And a "tokenomics" module "ClaimSettled" end block event is broadcast # TODO_TEST(@Olshansk): # - Successful relay through applicat's sovereign appgate server diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature index 746341728..547e74634 100644 --- a/e2e/tests/session.feature +++ b/e2e/tests/session.feature @@ -3,10 +3,11 @@ Feature: Session Namespace Scenario: Supplier completes claim/proof lifecycle for a valid session Given the user has the pocketd binary installed When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1" - And the user should wait for the "proof" module "CreateClaim" Message to be submitted - # TODO_BLOCKER(@bryanchriswhite): Use a cosmos-sdk event (e.g. EventClaimCreated) so this is not flaky. +# And the user should wait for the "proof" module "CreateClaim" Message to be submitted + And the user should wait for the "proof" module "ClaimCreated" tx event to be broadcast Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain - And the user should wait for the "proof" module "SubmitProof" Message to be submitted +# And the user should wait for the "proof" module "SubmitProof" Message to be submitted + And the user should wait for the "proof" module "ProofSubmitted" tx event to be broadcast Then the claim created by supplier "supplier1" for service "anvil" for application "app1" should be successfully settled # TODO_BLOCKER(@red-0ne): Make sure to implement and validate this test diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 8757dd253..0050fe210 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -8,18 +8,13 @@ import ( "strconv" "time" - "cosmossdk.io/depinject" abci "github.com/cometbft/cometbft/abci/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/pkg/client" "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/tx" "github.com/pokt-network/poktroll/pkg/observable/channel" testutilevents "github.com/pokt-network/poktroll/testutil/events" - "github.com/pokt-network/poktroll/testutil/testclient" prooftypes "github.com/pokt-network/poktroll/x/proof/types" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -39,9 +34,7 @@ const ( // This is used by an events replay client to subscribe to tx events from the supplier. // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events txSenderEventSubscriptionQueryFmt = "tm.event='Tx' AND message.sender='%s'" - // newBlockEventSubscriptionQuery is the query string which yields a - // subscription query to listen for on-chain new block events. - newBlockEventSubscriptionQuery = "tm.event='NewBlock'" + // eventsReplayClientBufferSize is the buffer size for the events replay client // for the subscriptions above. eventsReplayClientBufferSize = 100 @@ -61,15 +54,21 @@ const ( preExistingProofsKey = "preExistingProofsKey" ) -func (s *suite) TheUserShouldWaitForTheModuleMessageToBeSubmitted(module, message string) { - msgType := fmt.Sprintf("/poktroll.%s.Msg%s", module, message) - s.waitForTxResultEvent(msgType) +func (s *suite) TheUserShouldWaitForTheModuleMessageToBeSubmitted(module, msgType string) { + s.waitForTxResultEvent(newEventMsgTypeMatchFn(module, msgType)) +} + +func (s *suite) TheUserShouldWaitForTheModuleTxEventToBeBroadcast(module, eventType string) { + s.waitForTxResultEvent(newEventTypeMatchFn(module, eventType)) } -func (s *suite) TheUserShouldWaitForTheModuleEventToBeBroadcast(module, message string) { - eventType := fmt.Sprintf("poktroll.%s.Event%s", module, message) - isExpectedEventFn := func(event *abci.Event) bool { return event.Type == eventType } - s.waitForNewBlockEvent(isExpectedEventFn) +func (s *suite) TheUserShouldWaitForTheModuleEndBlockEventToBeBroadcast(module, eventType string) { + s.waitForNewBlockEvent( + combineEventMatchFns( + newEventTypeMatchFn(module, eventType), + newEventModeMatchFn("EndBlock"), + ), + ) } // TODO_FLAKY: See how 'TheClaimCreatedBySupplierForServiceForApplicationShouldBeSuccessfullySettled' @@ -124,30 +123,6 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication require.NoError(s, err) s.scenarioState[preExistingProofsKey] = allProofsRes.Proofs - // Construct an events query client to listen for tx events from the supplier. - msgSenderQuery := fmt.Sprintf(txSenderEventSubscriptionQueryFmt, accNameToAddrMap[supplierName]) - deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) - txSendEventsReplayClient, err := events.NewEventsReplayClient[*abci.TxResult]( - ctx, - deps, - msgSenderQuery, - tx.UnmarshalTxResult, - eventsReplayClientBufferSize, - ) - require.NoError(s, err) - s.scenarioState[txResultEventsReplayClientKey] = txSendEventsReplayClient - - // Construct an events query client to listen for claim settlement or expiration events on-chain. - onChainClaimEventsReplayClient, err := events.NewEventsReplayClient[*block.CometNewBlockEvent]( - ctx, - deps, - newBlockEventSubscriptionQuery, - block.UnmarshalNewBlockEvent, - eventsReplayClientBufferSize, - ) - require.NoError(s, err) - s.scenarioState[newBlockEventReplayClientKey] = onChainClaimEventsReplayClient - // Send relays for the session. s.sendRelaysForSession( appName, @@ -203,27 +178,21 @@ func (s *suite) sendRelaysForSession( data := `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}` for i := 0; i < relayLimit; i++ { - s.Logf("Sending relay %d \n", i) s.TheApplicationSendsTheSupplierARequestForServiceWithPathAndData(appName, supplierName, serviceId, defaultJSONPRCPath, data) s.TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName, supplierName) } } // waitForTxResultEvent waits for an event to be observed which has the given message action. -func (s *suite) waitForTxResultEvent(targetAction string) { - ctx, done := context.WithCancel(context.Background()) - - txResultEventsReplayClientState, ok := s.scenarioState[txResultEventsReplayClientKey] - require.Truef(s, ok, "%s not found in scenarioState", txResultEventsReplayClientKey) - - txResultEventsReplayClient, ok := txResultEventsReplayClientState.(client.EventsReplayClient[*abci.TxResult]) - require.True(s, ok, "%q not of the right type; expected client.EventsReplayClient[*abci.TxResult], got %T", txResultEventsReplayClientKey, txResultEventsReplayClientState) - require.NotNil(s, txResultEventsReplayClient) +// func (s *suite) waitForTxResultEvent(targetAction string) { +// func (s *suite) waitForTxResultEvent(waitForEvent waitForEachTxEventFn) { +func (s *suite) waitForTxResultEvent(eventIsMatch func(*abci.Event) bool) { + ctx, cancel := context.WithCancel(context.Background()) // For each observed event, **asynchronously** check if it contains the given action. channel.ForEach[*abci.TxResult]( - ctx, txResultEventsReplayClient.EventsSequence(ctx), - func(_ context.Context, txResult *abci.TxResult) { + ctx, s.txResultReplayClient.EventsSequence(ctx), + func(ctx context.Context, txResult *abci.TxResult) { if txResult == nil { return } @@ -231,13 +200,8 @@ func (s *suite) waitForTxResultEvent(targetAction string) { // Range over each event's attributes to find the "action" attribute // and compare its value to that of the action provided. for _, event := range txResult.Result.Events { - for _, attribute := range event.Attributes { - if attribute.Key == "action" { - if attribute.Value == targetAction { - done() - return - } - } + if eventIsMatch(&event) { + cancel() } } }, @@ -245,7 +209,7 @@ func (s *suite) waitForTxResultEvent(targetAction string) { select { case <-time.After(eventTimeout): - s.Fatalf("ERROR: timed out waiting for message with action %q", targetAction) + s.Fatalf("ERROR: timed out waiting for tx result event") case <-ctx.Done(): s.Log("Success; message detected before timeout.") } @@ -260,16 +224,9 @@ func (s *suite) waitForNewBlockEvent( ) { ctx, done := context.WithCancel(context.Background()) - newBlockEventsReplayClientState, ok := s.scenarioState[newBlockEventReplayClientKey] - require.Truef(s, ok, "%s not found in scenarioState", newBlockEventReplayClientKey) - - newBlockEventsReplayClient, ok := newBlockEventsReplayClientState.(client.EventsReplayClient[*block.CometNewBlockEvent]) - require.True(s, ok, "%q not of the right type; expected client.EventsReplayClient[*block.CometNewBlockEvent], got %T", newBlockEventReplayClientKey, newBlockEventsReplayClientState) - require.NotNil(s, newBlockEventsReplayClient) - // For each observed event, **asynchronously** check if it contains the given action. channel.ForEach[*block.CometNewBlockEvent]( - ctx, newBlockEventsReplayClient.EventsSequence(ctx), + ctx, s.newBlockEventsReplayClient.EventsSequence(ctx), func(_ context.Context, newBlockEvent *block.CometNewBlockEvent) { if newBlockEvent == nil { return @@ -295,3 +252,80 @@ func (s *suite) waitForNewBlockEvent( s.Log("Success; message detected before timeout.") } } + +// newEventTypeMatchFn returns a function that matches an event based on its type +// field. The type URL is constructed from the given module and eventType arguments +// where module is the module name and eventType is the protobuf message type name +// without the "Event" prefix; e.g., pass "tokenomics" and "ClaimSettled" to match +// the poktroll.tokenomics.EventClaimSettled event. +func newEventTypeMatchFn(module, eventType string) func(*abci.Event) bool { + targetEventType := fmt.Sprintf("poktroll.%s.Event%s", module, eventType) + return func(event *abci.Event) bool { + if event == nil { + return false + } + + if event.Type == targetEventType { + return true + } + return false + } +} + +// newEventMsgTypeMatchFn returns a function that matches an event based on the +// "action" attribute in its attributes field, which is populated with the message +// type URL of the message to which a given event corresponds. The target action +// is constructed from the given module and msgType arguments where module is the +// module name and msgType is the protobuf message type name without the "Msg" prefix; +// e.g., pass "proof" and "CreateClaim" to match the poktroll.proof.MsgCreateClaim. +func newEventMsgTypeMatchFn(module, msgType string) func(event *abci.Event) bool { + targetMsgType := fmt.Sprintf("/poktroll.%s.Msg%s", module, msgType) + return func(event *abci.Event) bool { + if event == nil { + return false + } + + for _, attribute := range event.Attributes { + if attribute.Key == "action" { + if attribute.Value == targetMsgType { + return true + } + } + } + return false + } +} + +// newEventModeMatchFn returns a function that matches an event based on the +// "mode" attribute in its attributes field. The target mode value is the given +// mode string. +func newEventModeMatchFn(mode string) func(event *abci.Event) bool { + return func(event *abci.Event) bool { + if event == nil { + return false + } + + for _, attribute := range event.Attributes { + if attribute.Key == "mode" { + if attribute.Value == mode { + return true + } + } + } + return false + } +} + +// combineEventMatchFns returns a function that matches an event based on the +// conjunction of multiple event match functions. The returned function will +// return true only if all the given functions return true. +func combineEventMatchFns(fns ...func(*abci.Event) bool) func(*abci.Event) bool { + return func(event *abci.Event) bool { + for _, fn := range fns { + if !fn(event) { + return false + } + } + return true + } +} From e7e99b782b369f1e142d2fa5acf37824988e0f3c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 20 Jun 2024 18:10:43 +0200 Subject: [PATCH 05/15] feat: add claim/proof events --- api/poktroll/proof/event.pulsar.go | 2722 +++++++++++++++++++++ proto/poktroll/proof/event.proto | 36 + x/proof/keeper/msg_server_create_claim.go | 72 +- x/proof/keeper/msg_server_submit_proof.go | 69 +- x/proof/types/event.pb.go | 1275 ++++++++++ 5 files changed, 4147 insertions(+), 27 deletions(-) create mode 100644 api/poktroll/proof/event.pulsar.go create mode 100644 proto/poktroll/proof/event.proto create mode 100644 x/proof/types/event.pb.go diff --git a/api/poktroll/proof/event.pulsar.go b/api/poktroll/proof/event.pulsar.go new file mode 100644 index 000000000..5481bfdb1 --- /dev/null +++ b/api/poktroll/proof/event.pulsar.go @@ -0,0 +1,2722 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_EventClaimCreated protoreflect.MessageDescriptor + fd_EventClaimCreated_claim protoreflect.FieldDescriptor + fd_EventClaimCreated_num_relays protoreflect.FieldDescriptor + fd_EventClaimCreated_num_compute_units protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_event_proto_init() + md_EventClaimCreated = File_poktroll_proof_event_proto.Messages().ByName("EventClaimCreated") + fd_EventClaimCreated_claim = md_EventClaimCreated.Fields().ByName("claim") + fd_EventClaimCreated_num_relays = md_EventClaimCreated.Fields().ByName("num_relays") + fd_EventClaimCreated_num_compute_units = md_EventClaimCreated.Fields().ByName("num_compute_units") +} + +var _ protoreflect.Message = (*fastReflection_EventClaimCreated)(nil) + +type fastReflection_EventClaimCreated EventClaimCreated + +func (x *EventClaimCreated) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventClaimCreated)(x) +} + +func (x *EventClaimCreated) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventClaimCreated_messageType fastReflection_EventClaimCreated_messageType +var _ protoreflect.MessageType = fastReflection_EventClaimCreated_messageType{} + +type fastReflection_EventClaimCreated_messageType struct{} + +func (x fastReflection_EventClaimCreated_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventClaimCreated)(nil) +} +func (x fastReflection_EventClaimCreated_messageType) New() protoreflect.Message { + return new(fastReflection_EventClaimCreated) +} +func (x fastReflection_EventClaimCreated_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventClaimCreated +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventClaimCreated) Descriptor() protoreflect.MessageDescriptor { + return md_EventClaimCreated +} + +// 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_EventClaimCreated) Type() protoreflect.MessageType { + return _fastReflection_EventClaimCreated_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventClaimCreated) New() protoreflect.Message { + return new(fastReflection_EventClaimCreated) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventClaimCreated) Interface() protoreflect.ProtoMessage { + return (*EventClaimCreated)(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_EventClaimCreated) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_EventClaimCreated_claim, value) { + return + } + } + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventClaimCreated_num_relays, value) { + return + } + } + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventClaimCreated_num_compute_units, 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_EventClaimCreated) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + return x.Claim != nil + case "poktroll.proof.EventClaimCreated.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.proof.EventClaimCreated.num_compute_units": + return x.NumComputeUnits != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + x.Claim = nil + case "poktroll.proof.EventClaimCreated.num_relays": + x.NumRelays = uint64(0) + case "poktroll.proof.EventClaimCreated.num_compute_units": + x.NumComputeUnits = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventClaimCreated.num_relays": + value := x.NumRelays + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimCreated.num_compute_units": + value := x.NumComputeUnits + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + x.Claim = value.Message().Interface().(*Claim) + case "poktroll.proof.EventClaimCreated.num_relays": + x.NumRelays = value.Uint() + case "poktroll.proof.EventClaimCreated.num_compute_units": + x.NumComputeUnits = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventClaimCreated.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimCreated is not mutable")) + case "poktroll.proof.EventClaimCreated.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventClaimCreated is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventClaimCreated.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventClaimCreated.num_relays": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimCreated.num_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimCreated 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_EventClaimCreated) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.EventClaimCreated", 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_EventClaimCreated) 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_EventClaimCreated) 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_EventClaimCreated) 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_EventClaimCreated) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventClaimCreated) + 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.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + } + 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().(*EventClaimCreated) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) + i-- + dAtA[i] = 0x10 + } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventClaimCreated) + 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: EventClaimCreated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimCreated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + x.NumRelays = 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.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventClaimUpdated protoreflect.MessageDescriptor + fd_EventClaimUpdated_claim protoreflect.FieldDescriptor + fd_EventClaimUpdated_num_relays protoreflect.FieldDescriptor + fd_EventClaimUpdated_num_compute_units protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_event_proto_init() + md_EventClaimUpdated = File_poktroll_proof_event_proto.Messages().ByName("EventClaimUpdated") + fd_EventClaimUpdated_claim = md_EventClaimUpdated.Fields().ByName("claim") + fd_EventClaimUpdated_num_relays = md_EventClaimUpdated.Fields().ByName("num_relays") + fd_EventClaimUpdated_num_compute_units = md_EventClaimUpdated.Fields().ByName("num_compute_units") +} + +var _ protoreflect.Message = (*fastReflection_EventClaimUpdated)(nil) + +type fastReflection_EventClaimUpdated EventClaimUpdated + +func (x *EventClaimUpdated) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventClaimUpdated)(x) +} + +func (x *EventClaimUpdated) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_event_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_EventClaimUpdated_messageType fastReflection_EventClaimUpdated_messageType +var _ protoreflect.MessageType = fastReflection_EventClaimUpdated_messageType{} + +type fastReflection_EventClaimUpdated_messageType struct{} + +func (x fastReflection_EventClaimUpdated_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventClaimUpdated)(nil) +} +func (x fastReflection_EventClaimUpdated_messageType) New() protoreflect.Message { + return new(fastReflection_EventClaimUpdated) +} +func (x fastReflection_EventClaimUpdated_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventClaimUpdated +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventClaimUpdated) Descriptor() protoreflect.MessageDescriptor { + return md_EventClaimUpdated +} + +// 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_EventClaimUpdated) Type() protoreflect.MessageType { + return _fastReflection_EventClaimUpdated_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventClaimUpdated) New() protoreflect.Message { + return new(fastReflection_EventClaimUpdated) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventClaimUpdated) Interface() protoreflect.ProtoMessage { + return (*EventClaimUpdated)(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_EventClaimUpdated) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_EventClaimUpdated_claim, value) { + return + } + } + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventClaimUpdated_num_relays, value) { + return + } + } + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventClaimUpdated_num_compute_units, 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_EventClaimUpdated) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + return x.Claim != nil + case "poktroll.proof.EventClaimUpdated.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.proof.EventClaimUpdated.num_compute_units": + return x.NumComputeUnits != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + x.Claim = nil + case "poktroll.proof.EventClaimUpdated.num_relays": + x.NumRelays = uint64(0) + case "poktroll.proof.EventClaimUpdated.num_compute_units": + x.NumComputeUnits = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventClaimUpdated.num_relays": + value := x.NumRelays + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimUpdated.num_compute_units": + value := x.NumComputeUnits + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + x.Claim = value.Message().Interface().(*Claim) + case "poktroll.proof.EventClaimUpdated.num_relays": + x.NumRelays = value.Uint() + case "poktroll.proof.EventClaimUpdated.num_compute_units": + x.NumComputeUnits = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventClaimUpdated.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimUpdated is not mutable")) + case "poktroll.proof.EventClaimUpdated.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventClaimUpdated is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventClaimUpdated.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventClaimUpdated.num_relays": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimUpdated.num_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventClaimUpdated 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_EventClaimUpdated) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.EventClaimUpdated", 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_EventClaimUpdated) 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_EventClaimUpdated) 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_EventClaimUpdated) 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_EventClaimUpdated) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventClaimUpdated) + 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.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + } + 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().(*EventClaimUpdated) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) + i-- + dAtA[i] = 0x10 + } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventClaimUpdated) + 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: EventClaimUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + x.NumRelays = 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.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventProofSubmitted protoreflect.MessageDescriptor + fd_EventProofSubmitted_claim protoreflect.FieldDescriptor + fd_EventProofSubmitted_proof protoreflect.FieldDescriptor + fd_EventProofSubmitted_num_relays protoreflect.FieldDescriptor + fd_EventProofSubmitted_num_compute_units protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_event_proto_init() + md_EventProofSubmitted = File_poktroll_proof_event_proto.Messages().ByName("EventProofSubmitted") + fd_EventProofSubmitted_claim = md_EventProofSubmitted.Fields().ByName("claim") + fd_EventProofSubmitted_proof = md_EventProofSubmitted.Fields().ByName("proof") + fd_EventProofSubmitted_num_relays = md_EventProofSubmitted.Fields().ByName("num_relays") + fd_EventProofSubmitted_num_compute_units = md_EventProofSubmitted.Fields().ByName("num_compute_units") +} + +var _ protoreflect.Message = (*fastReflection_EventProofSubmitted)(nil) + +type fastReflection_EventProofSubmitted EventProofSubmitted + +func (x *EventProofSubmitted) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProofSubmitted)(x) +} + +func (x *EventProofSubmitted) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_event_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventProofSubmitted_messageType fastReflection_EventProofSubmitted_messageType +var _ protoreflect.MessageType = fastReflection_EventProofSubmitted_messageType{} + +type fastReflection_EventProofSubmitted_messageType struct{} + +func (x fastReflection_EventProofSubmitted_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProofSubmitted)(nil) +} +func (x fastReflection_EventProofSubmitted_messageType) New() protoreflect.Message { + return new(fastReflection_EventProofSubmitted) +} +func (x fastReflection_EventProofSubmitted_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofSubmitted +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventProofSubmitted) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofSubmitted +} + +// 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_EventProofSubmitted) Type() protoreflect.MessageType { + return _fastReflection_EventProofSubmitted_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventProofSubmitted) New() protoreflect.Message { + return new(fastReflection_EventProofSubmitted) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventProofSubmitted) Interface() protoreflect.ProtoMessage { + return (*EventProofSubmitted)(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_EventProofSubmitted) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_EventProofSubmitted_claim, value) { + return + } + } + if x.Proof != nil { + value := protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + if !f(fd_EventProofSubmitted_proof, value) { + return + } + } + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventProofSubmitted_num_relays, value) { + return + } + } + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventProofSubmitted_num_compute_units, 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_EventProofSubmitted) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + return x.Claim != nil + case "poktroll.proof.EventProofSubmitted.proof": + return x.Proof != nil + case "poktroll.proof.EventProofSubmitted.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.proof.EventProofSubmitted.num_compute_units": + return x.NumComputeUnits != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + x.Claim = nil + case "poktroll.proof.EventProofSubmitted.proof": + x.Proof = nil + case "poktroll.proof.EventProofSubmitted.num_relays": + x.NumRelays = uint64(0) + case "poktroll.proof.EventProofSubmitted.num_compute_units": + x.NumComputeUnits = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.proof": + value := x.Proof + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.num_relays": + value := x.NumRelays + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofSubmitted.num_compute_units": + value := x.NumComputeUnits + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + x.Claim = value.Message().Interface().(*Claim) + case "poktroll.proof.EventProofSubmitted.proof": + x.Proof = value.Message().Interface().(*Proof) + case "poktroll.proof.EventProofSubmitted.num_relays": + x.NumRelays = value.Uint() + case "poktroll.proof.EventProofSubmitted.num_compute_units": + x.NumComputeUnits = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.proof": + if x.Proof == nil { + x.Proof = new(Proof) + } + return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofSubmitted is not mutable")) + case "poktroll.proof.EventProofSubmitted.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventProofSubmitted is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofSubmitted.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.proof": + m := new(Proof) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.num_relays": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofSubmitted.num_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofSubmitted 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_EventProofSubmitted) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.EventProofSubmitted", 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_EventProofSubmitted) 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_EventProofSubmitted) 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_EventProofSubmitted) 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_EventProofSubmitted) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventProofSubmitted) + 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.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Proof != nil { + l = options.Size(x.Proof) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + } + 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().(*EventProofSubmitted) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + i-- + dAtA[i] = 0x20 + } + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) + i-- + dAtA[i] = 0x18 + } + if x.Proof != nil { + encoded, err := options.Marshal(x.Proof) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventProofSubmitted) + 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: EventProofSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProofSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Proof == nil { + x.Proof = &Proof{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proof); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + x.NumRelays = 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.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventProofUpdated protoreflect.MessageDescriptor + fd_EventProofUpdated_claim protoreflect.FieldDescriptor + fd_EventProofUpdated_proof protoreflect.FieldDescriptor + fd_EventProofUpdated_num_relays protoreflect.FieldDescriptor + fd_EventProofUpdated_num_compute_units protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_event_proto_init() + md_EventProofUpdated = File_poktroll_proof_event_proto.Messages().ByName("EventProofUpdated") + fd_EventProofUpdated_claim = md_EventProofUpdated.Fields().ByName("claim") + fd_EventProofUpdated_proof = md_EventProofUpdated.Fields().ByName("proof") + fd_EventProofUpdated_num_relays = md_EventProofUpdated.Fields().ByName("num_relays") + fd_EventProofUpdated_num_compute_units = md_EventProofUpdated.Fields().ByName("num_compute_units") +} + +var _ protoreflect.Message = (*fastReflection_EventProofUpdated)(nil) + +type fastReflection_EventProofUpdated EventProofUpdated + +func (x *EventProofUpdated) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProofUpdated)(x) +} + +func (x *EventProofUpdated) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_event_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventProofUpdated_messageType fastReflection_EventProofUpdated_messageType +var _ protoreflect.MessageType = fastReflection_EventProofUpdated_messageType{} + +type fastReflection_EventProofUpdated_messageType struct{} + +func (x fastReflection_EventProofUpdated_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProofUpdated)(nil) +} +func (x fastReflection_EventProofUpdated_messageType) New() protoreflect.Message { + return new(fastReflection_EventProofUpdated) +} +func (x fastReflection_EventProofUpdated_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofUpdated +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventProofUpdated) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofUpdated +} + +// 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_EventProofUpdated) Type() protoreflect.MessageType { + return _fastReflection_EventProofUpdated_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventProofUpdated) New() protoreflect.Message { + return new(fastReflection_EventProofUpdated) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventProofUpdated) Interface() protoreflect.ProtoMessage { + return (*EventProofUpdated)(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_EventProofUpdated) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_EventProofUpdated_claim, value) { + return + } + } + if x.Proof != nil { + value := protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + if !f(fd_EventProofUpdated_proof, value) { + return + } + } + if x.NumRelays != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelays) + if !f(fd_EventProofUpdated_num_relays, value) { + return + } + } + if x.NumComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumComputeUnits) + if !f(fd_EventProofUpdated_num_compute_units, 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_EventProofUpdated) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + return x.Claim != nil + case "poktroll.proof.EventProofUpdated.proof": + return x.Proof != nil + case "poktroll.proof.EventProofUpdated.num_relays": + return x.NumRelays != uint64(0) + case "poktroll.proof.EventProofUpdated.num_compute_units": + return x.NumComputeUnits != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + x.Claim = nil + case "poktroll.proof.EventProofUpdated.proof": + x.Proof = nil + case "poktroll.proof.EventProofUpdated.num_relays": + x.NumRelays = uint64(0) + case "poktroll.proof.EventProofUpdated.num_compute_units": + x.NumComputeUnits = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.proof": + value := x.Proof + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.num_relays": + value := x.NumRelays + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofUpdated.num_compute_units": + value := x.NumComputeUnits + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + x.Claim = value.Message().Interface().(*Claim) + case "poktroll.proof.EventProofUpdated.proof": + x.Proof = value.Message().Interface().(*Proof) + case "poktroll.proof.EventProofUpdated.num_relays": + x.NumRelays = value.Uint() + case "poktroll.proof.EventProofUpdated.num_compute_units": + x.NumComputeUnits = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.proof": + if x.Proof == nil { + x.Proof = new(Proof) + } + return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofUpdated is not mutable")) + case "poktroll.proof.EventProofUpdated.num_compute_units": + panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventProofUpdated is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofUpdated.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.proof": + m := new(Proof) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.num_relays": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofUpdated.num_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofUpdated 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_EventProofUpdated) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.EventProofUpdated", 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_EventProofUpdated) 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_EventProofUpdated) 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_EventProofUpdated) 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_EventProofUpdated) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventProofUpdated) + 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.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Proof != nil { + l = options.Size(x.Proof) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + } + 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().(*EventProofUpdated) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.NumComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + i-- + dAtA[i] = 0x20 + } + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) + i-- + dAtA[i] = 0x18 + } + if x.Proof != nil { + encoded, err := options.Marshal(x.Proof) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventProofUpdated) + 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: EventProofUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProofUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Proof == nil { + x.Proof = &Proof{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proof); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + x.NumRelays = 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.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + x.NumComputeUnits = 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.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/event.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EventClaimCreated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` +} + +func (x *EventClaimCreated) Reset() { + *x = EventClaimCreated{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventClaimCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventClaimCreated) ProtoMessage() {} + +// Deprecated: Use EventClaimCreated.ProtoReflect.Descriptor instead. +func (*EventClaimCreated) Descriptor() ([]byte, []int) { + return file_poktroll_proof_event_proto_rawDescGZIP(), []int{0} +} + +func (x *EventClaimCreated) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + +func (x *EventClaimCreated) GetNumRelays() uint64 { + if x != nil { + return x.NumRelays + } + return 0 +} + +func (x *EventClaimCreated) GetNumComputeUnits() uint64 { + if x != nil { + return x.NumComputeUnits + } + return 0 +} + +// TODO_TEST: Add coverage for claim updates. +type EventClaimUpdated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` +} + +func (x *EventClaimUpdated) Reset() { + *x = EventClaimUpdated{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventClaimUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventClaimUpdated) ProtoMessage() {} + +// Deprecated: Use EventClaimUpdated.ProtoReflect.Descriptor instead. +func (*EventClaimUpdated) Descriptor() ([]byte, []int) { + return file_poktroll_proof_event_proto_rawDescGZIP(), []int{1} +} + +func (x *EventClaimUpdated) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + +func (x *EventClaimUpdated) GetNumRelays() uint64 { + if x != nil { + return x.NumRelays + } + return 0 +} + +func (x *EventClaimUpdated) GetNumComputeUnits() uint64 { + if x != nil { + return x.NumComputeUnits + } + return 0 +} + +type EventProofSubmitted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` +} + +func (x *EventProofSubmitted) Reset() { + *x = EventProofSubmitted{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_event_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventProofSubmitted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventProofSubmitted) ProtoMessage() {} + +// Deprecated: Use EventProofSubmitted.ProtoReflect.Descriptor instead. +func (*EventProofSubmitted) Descriptor() ([]byte, []int) { + return file_poktroll_proof_event_proto_rawDescGZIP(), []int{2} +} + +func (x *EventProofSubmitted) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + +func (x *EventProofSubmitted) GetProof() *Proof { + if x != nil { + return x.Proof + } + return nil +} + +func (x *EventProofSubmitted) GetNumRelays() uint64 { + if x != nil { + return x.NumRelays + } + return 0 +} + +func (x *EventProofSubmitted) GetNumComputeUnits() uint64 { + if x != nil { + return x.NumComputeUnits + } + return 0 +} + +// TODO_TEST: Add coverage for proof updates. +type EventProofUpdated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` +} + +func (x *EventProofUpdated) Reset() { + *x = EventProofUpdated{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_event_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventProofUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventProofUpdated) ProtoMessage() {} + +// Deprecated: Use EventProofUpdated.ProtoReflect.Descriptor instead. +func (*EventProofUpdated) Descriptor() ([]byte, []int) { + return file_poktroll_proof_event_proto_rawDescGZIP(), []int{3} +} + +func (x *EventProofUpdated) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + +func (x *EventProofUpdated) GetProof() *Proof { + if x != nil { + return x.Proof + } + return nil +} + +func (x *EventProofUpdated) GetNumRelays() uint64 { + if x != nil { + return x.NumRelays + } + return 0 +} + +func (x *EventProofUpdated) GetNumComputeUnits() uint64 { + if x != nil { + return x.NumComputeUnits + } + return 0 +} + +var File_poktroll_proof_event_proto protoreflect.FileDescriptor + +var file_poktroll_proof_event_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x14, 0x67, 0x6f, + 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x11, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, + 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xbd, 0x01, 0x0a, 0x11, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, + 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xf7, 0x01, 0x0a, 0x13, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, + 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, + 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, + 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, + 0x6e, 0x69, 0x74, 0x73, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, + 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, + 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, + 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, + 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, + 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x42, 0x9a, 0x01, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_poktroll_proof_event_proto_rawDescOnce sync.Once + file_poktroll_proof_event_proto_rawDescData = file_poktroll_proof_event_proto_rawDesc +) + +func file_poktroll_proof_event_proto_rawDescGZIP() []byte { + file_poktroll_proof_event_proto_rawDescOnce.Do(func() { + file_poktroll_proof_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_event_proto_rawDescData) + }) + return file_poktroll_proof_event_proto_rawDescData +} + +var file_poktroll_proof_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_proof_event_proto_goTypes = []interface{}{ + (*EventClaimCreated)(nil), // 0: poktroll.proof.EventClaimCreated + (*EventClaimUpdated)(nil), // 1: poktroll.proof.EventClaimUpdated + (*EventProofSubmitted)(nil), // 2: poktroll.proof.EventProofSubmitted + (*EventProofUpdated)(nil), // 3: poktroll.proof.EventProofUpdated + (*Claim)(nil), // 4: poktroll.proof.Claim + (*Proof)(nil), // 5: poktroll.proof.Proof +} +var file_poktroll_proof_event_proto_depIdxs = []int32{ + 4, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim + 4, // 1: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim + 4, // 2: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim + 5, // 3: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof + 4, // 4: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim + 5, // 5: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_event_proto_init() } +func file_poktroll_proof_event_proto_init() { + if File_poktroll_proof_event_proto != nil { + return + } + file_poktroll_proof_claim_proto_init() + file_poktroll_proof_proof_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventClaimCreated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventClaimUpdated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventProofSubmitted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventProofUpdated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_event_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_event_proto_goTypes, + DependencyIndexes: file_poktroll_proof_event_proto_depIdxs, + MessageInfos: file_poktroll_proof_event_proto_msgTypes, + }.Build() + File_poktroll_proof_event_proto = out.File + file_poktroll_proof_event_proto_rawDesc = nil + file_poktroll_proof_event_proto_goTypes = nil + file_poktroll_proof_event_proto_depIdxs = nil +} diff --git a/proto/poktroll/proof/event.proto b/proto/poktroll/proof/event.proto new file mode 100644 index 000000000..8c94d50ad --- /dev/null +++ b/proto/poktroll/proof/event.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package poktroll.proof; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +import "gogoproto/gogo.proto"; +import "poktroll/proof/claim.proto"; +import "poktroll/proof/proof.proto"; + +message EventClaimCreated { + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; +} + +// TODO_TEST: Add coverage for claim updates. +message EventClaimUpdated { + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; +} + +message EventProofSubmitted { + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + poktroll.proof.Proof proof = 2 [(gogoproto.jsontag) = "proof"]; + uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; +} + +// TODO_TEST: Add coverage for proof updates. +message EventProofUpdated { + poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; + poktroll.proof.Proof proof = 2 [(gogoproto.jsontag) = "proof"]; + uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; + uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; +} diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index 8a7eeb690..375779262 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -2,8 +2,9 @@ package keeper import ( "context" - "errors" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -16,20 +17,25 @@ func (k msgServer) CreateClaim( msg *types.MsgCreateClaim, ) (_ *types.MsgCreateClaimResponse, err error) { // Declare claim to reference in telemetry. - var claim types.Claim + var ( + claim types.Claim + isExistingClaim bool + numRelays uint64 + numComputeUnits uint64 + ) // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { - // TODO_IMPROVE: We could track on-chain relays here with claim.GetNumRelays(). - numComputeUnits, deferredErr := claim.GetNumComputeUnits() - err = errors.Join(err, deferredErr) - - telemetry.ClaimCounter(types.ClaimProofStage_CLAIMED, 1, err) - telemetry.ClaimComputeUnitsCounter( - types.ClaimProofStage_CLAIMED, - numComputeUnits, - err, - ) + // Only increment these metrics counters if handling a new claim. + if !isExistingClaim { + // TODO_IMPROVE: We could track on-chain relays here with claim.GetNumRelays(). + telemetry.ClaimCounter(types.ClaimProofStage_CLAIMED, 1, err) + telemetry.ClaimComputeUnitsCounter( + types.ClaimProofStage_CLAIMED, + numComputeUnits, + err, + ) + } }() logger := k.Logger().With("method", "CreateClaim") @@ -85,13 +91,49 @@ func (k msgServer) CreateClaim( RootHash: msg.GetRootHash(), } - // TODO_BLOCKER(@Olshansk): check if this claim already exists and return an - // appropriate error in any case where the supplier should no longer be able - // to update the given proof. + _, isExistingClaim = k.Keeper.GetClaim(ctx, claim.GetSessionHeader().GetSessionId(), claim.GetSupplierAddress()) + k.Keeper.UpsertClaim(ctx, claim) logger.Info("created new claim") + // NB: Don't return these error, it should not prevent the MsgCreateClaimResopnse + // from being returned. Instead, it will be attached as an "error" label to any + // metrics tracked in this function. + // TODO_IMPROVE: While this will surface the error in metrics, it will also cause + // any counters not to be incremented even though a new claim might have been inserted. + numRelays, err = claim.GetNumRelays() + numComputeUnits, err = claim.GetNumComputeUnits() + + // Emit the appropriate event based on whether the claim was created or updated. + var claimUpsertEvent proto.Message + switch isExistingClaim { + case true: + claimUpsertEvent = proto.Message( + &types.EventClaimUpdated{ + Claim: &claim, + NumRelays: numRelays, + NumComputeUnits: numComputeUnits, + }, + ) + case false: + claimUpsertEvent = proto.Message( + &types.EventClaimCreated{ + Claim: &claim, + NumRelays: numRelays, + NumComputeUnits: numComputeUnits, + }, + ) + } + + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + // NB: Don't return this error, it should not prevent the MsgCreateClaimResopnse + // from being returned. Instead, it will be attached as an "error" label to any + // metrics tracked in this function. + // TODO_IMPROVE: While this will surface the error in metrics, it will also cause + // any counters not to be incremented even though a new claim might have been inserted. + err = sdkCtx.EventManager().EmitTypedEvent(claimUpsertEvent) + // TODO_BETA: return the claim in the response. return &types.MsgCreateClaimResponse{}, nil } diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index b3c58f44d..d77b2a998 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -8,10 +8,11 @@ import ( "bytes" "context" "crypto/sha256" - "errors" "fmt" "hash" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" "github.com/pokt-network/smt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -60,20 +61,25 @@ func (k msgServer) SubmitProof( logger.Info("About to start submitting proof") // Declare claim to reference in telemetry. - claim := new(types.Claim) + var ( + claim = new(types.Claim) + isExistingProof bool + numRelays uint64 + numComputeUnits uint64 + ) // Defer telemetry calls so that they reference the final values the relevant variables. defer func() { - // TODO_IMPROVE: We could track on-chain relays here with claim.GetNumRelays(). - numComputeUnits, deferredErr := claim.GetNumComputeUnits() - err = errors.Join(err, deferredErr) - - telemetry.ClaimCounter(types.ClaimProofStage_PROVEN, 1, err) - telemetry.ClaimComputeUnitsCounter( - types.ClaimProofStage_PROVEN, - numComputeUnits, - err, - ) + // Only increment these metrics counters if handling a new claim. + if !isExistingProof { + // TODO_IMPROVE: We could track on-chain relays here with claim.GetNumRelays(). + telemetry.ClaimCounter(types.ClaimProofStage_PROVEN, 1, err) + telemetry.ClaimComputeUnitsCounter( + types.ClaimProofStage_PROVEN, + numComputeUnits, + err, + ) + } }() /* @@ -260,12 +266,51 @@ func (k msgServer) SubmitProof( } logger.Debug(fmt.Sprintf("queried and validated the claim for session ID %q", sessionHeader.SessionId)) + _, isExistingProof = k.GetProof(ctx, proof.GetSessionHeader().GetSessionId(), proof.GetSupplierAddress()) + // TODO_BLOCKER(@Olshansk): check if this proof already exists and return an // appropriate error in any case where the supplier should no longer be able // to update the given proof. k.UpsertProof(ctx, proof) logger.Info("successfully upserted the proof") + // NB: Don't return these error, it should not prevent the MsgCreateClaimResopnse + // from being returned. Instead, it will be attached as an "error" label to any + // metrics tracked in this function. + // TODO_IMPROVE: While this will surface the error in metrics, it will also cause + // any counters not to be incremented even though a new claim might have been inserted. + numRelays, err = claim.GetNumRelays() + numComputeUnits, err = claim.GetNumComputeUnits() + + // Emit the appropriate event based on whether the claim was created or updated. + var proofUpsertEvent proto.Message + switch isExistingProof { + case true: + proofUpsertEvent = proto.Message( + &types.EventProofUpdated{ + Proof: &proof, + NumRelays: numRelays, + NumComputeUnits: numComputeUnits, + }, + ) + case false: + proofUpsertEvent = proto.Message( + &types.EventProofSubmitted{ + Proof: &proof, + NumRelays: numRelays, + NumComputeUnits: numComputeUnits, + }, + ) + } + + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + // NB: Don't return this error, it should not prevent the MsgCreateProofResopnse + // from being returned. Instead, it will be attached as an "error" label to any + // metrics tracked in this function. + // TODO_IMPROVE: While this will surface the error in metrics, it will also cause + // any counters not to be incremented even though a new proof might have been inserted. + err = sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent) + return &types.MsgSubmitProofResponse{}, nil } diff --git a/x/proof/types/event.pb.go b/x/proof/types/event.pb.go new file mode 100644 index 000000000..3c53ade1b --- /dev/null +++ b/x/proof/types/event.pb.go @@ -0,0 +1,1275 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: poktroll/proof/event.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventClaimCreated struct { + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` +} + +func (m *EventClaimCreated) Reset() { *m = EventClaimCreated{} } +func (m *EventClaimCreated) String() string { return proto.CompactTextString(m) } +func (*EventClaimCreated) ProtoMessage() {} +func (*EventClaimCreated) Descriptor() ([]byte, []int) { + return fileDescriptor_dd4c19e04487fbec, []int{0} +} +func (m *EventClaimCreated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClaimCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClaimCreated.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 *EventClaimCreated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClaimCreated.Merge(m, src) +} +func (m *EventClaimCreated) XXX_Size() int { + return m.Size() +} +func (m *EventClaimCreated) XXX_DiscardUnknown() { + xxx_messageInfo_EventClaimCreated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClaimCreated proto.InternalMessageInfo + +func (m *EventClaimCreated) GetClaim() *Claim { + if m != nil { + return m.Claim + } + return nil +} + +func (m *EventClaimCreated) GetNumRelays() uint64 { + if m != nil { + return m.NumRelays + } + return 0 +} + +func (m *EventClaimCreated) GetNumComputeUnits() uint64 { + if m != nil { + return m.NumComputeUnits + } + return 0 +} + +// TODO_TEST: Add coverage for claim updates. +type EventClaimUpdated struct { + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` +} + +func (m *EventClaimUpdated) Reset() { *m = EventClaimUpdated{} } +func (m *EventClaimUpdated) String() string { return proto.CompactTextString(m) } +func (*EventClaimUpdated) ProtoMessage() {} +func (*EventClaimUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_dd4c19e04487fbec, []int{1} +} +func (m *EventClaimUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClaimUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClaimUpdated.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 *EventClaimUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClaimUpdated.Merge(m, src) +} +func (m *EventClaimUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventClaimUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventClaimUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClaimUpdated proto.InternalMessageInfo + +func (m *EventClaimUpdated) GetClaim() *Claim { + if m != nil { + return m.Claim + } + return nil +} + +func (m *EventClaimUpdated) GetNumRelays() uint64 { + if m != nil { + return m.NumRelays + } + return 0 +} + +func (m *EventClaimUpdated) GetNumComputeUnits() uint64 { + if m != nil { + return m.NumComputeUnits + } + return 0 +} + +type EventProofSubmitted struct { + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` +} + +func (m *EventProofSubmitted) Reset() { *m = EventProofSubmitted{} } +func (m *EventProofSubmitted) String() string { return proto.CompactTextString(m) } +func (*EventProofSubmitted) ProtoMessage() {} +func (*EventProofSubmitted) Descriptor() ([]byte, []int) { + return fileDescriptor_dd4c19e04487fbec, []int{2} +} +func (m *EventProofSubmitted) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventProofSubmitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventProofSubmitted.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 *EventProofSubmitted) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProofSubmitted.Merge(m, src) +} +func (m *EventProofSubmitted) XXX_Size() int { + return m.Size() +} +func (m *EventProofSubmitted) XXX_DiscardUnknown() { + xxx_messageInfo_EventProofSubmitted.DiscardUnknown(m) +} + +var xxx_messageInfo_EventProofSubmitted proto.InternalMessageInfo + +func (m *EventProofSubmitted) GetClaim() *Claim { + if m != nil { + return m.Claim + } + return nil +} + +func (m *EventProofSubmitted) GetProof() *Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *EventProofSubmitted) GetNumRelays() uint64 { + if m != nil { + return m.NumRelays + } + return 0 +} + +func (m *EventProofSubmitted) GetNumComputeUnits() uint64 { + if m != nil { + return m.NumComputeUnits + } + return 0 +} + +// TODO_TEST: Add coverage for proof updates. +type EventProofUpdated struct { + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` +} + +func (m *EventProofUpdated) Reset() { *m = EventProofUpdated{} } +func (m *EventProofUpdated) String() string { return proto.CompactTextString(m) } +func (*EventProofUpdated) ProtoMessage() {} +func (*EventProofUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_dd4c19e04487fbec, []int{3} +} +func (m *EventProofUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventProofUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventProofUpdated.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 *EventProofUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProofUpdated.Merge(m, src) +} +func (m *EventProofUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventProofUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventProofUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventProofUpdated proto.InternalMessageInfo + +func (m *EventProofUpdated) GetClaim() *Claim { + if m != nil { + return m.Claim + } + return nil +} + +func (m *EventProofUpdated) GetProof() *Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *EventProofUpdated) GetNumRelays() uint64 { + if m != nil { + return m.NumRelays + } + return 0 +} + +func (m *EventProofUpdated) GetNumComputeUnits() uint64 { + if m != nil { + return m.NumComputeUnits + } + return 0 +} + +func init() { + proto.RegisterType((*EventClaimCreated)(nil), "poktroll.proof.EventClaimCreated") + proto.RegisterType((*EventClaimUpdated)(nil), "poktroll.proof.EventClaimUpdated") + proto.RegisterType((*EventProofSubmitted)(nil), "poktroll.proof.EventProofSubmitted") + proto.RegisterType((*EventProofUpdated)(nil), "poktroll.proof.EventProofUpdated") +} + +func init() { proto.RegisterFile("poktroll/proof/event.proto", fileDescriptor_dd4c19e04487fbec) } + +var fileDescriptor_dd4c19e04487fbec = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xc8, 0xcf, 0x2e, + 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0xd3, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, + 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xc9, 0xe9, 0x81, 0xe5, 0xa4, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x14, 0xba, 0x09, 0xc9, 0x39, 0x89, + 0x99, 0xb9, 0x38, 0xe4, 0xc0, 0x24, 0x44, 0x4e, 0x69, 0x2f, 0x23, 0x97, 0xa0, 0x2b, 0xc8, 0x36, + 0x67, 0x90, 0x06, 0xe7, 0xa2, 0xd4, 0xc4, 0x92, 0xd4, 0x14, 0x21, 0x33, 0x2e, 0x56, 0xb0, 0x01, + 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0xa2, 0x7a, 0xa8, 0x6e, 0xd0, 0x03, 0x2b, 0x76, 0xe2, + 0x7c, 0x75, 0x4f, 0x1e, 0xa2, 0x2e, 0x08, 0x42, 0x09, 0xe9, 0x72, 0x71, 0xe5, 0x95, 0xe6, 0xc6, + 0x17, 0xa5, 0xe6, 0x24, 0x56, 0x16, 0x4b, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x38, 0xf1, 0xbd, 0xba, + 0x27, 0x8f, 0x24, 0x1a, 0xc4, 0x99, 0x57, 0x9a, 0x1b, 0x04, 0x66, 0x0a, 0x39, 0x72, 0x09, 0x82, + 0x24, 0x92, 0xf3, 0x73, 0x0b, 0x4a, 0x4b, 0x52, 0xe3, 0x4b, 0xf3, 0x32, 0x4b, 0x8a, 0x25, 0x98, + 0xc1, 0xba, 0x44, 0x5f, 0xdd, 0x93, 0xc7, 0x94, 0x0c, 0xe2, 0xcf, 0x2b, 0xcd, 0x75, 0x86, 0x88, + 0x84, 0x82, 0x04, 0xd0, 0xdc, 0x1f, 0x5a, 0x90, 0x32, 0xc4, 0xdc, 0xff, 0x9d, 0x91, 0x4b, 0x18, + 0xec, 0xfe, 0x00, 0x90, 0xc3, 0x82, 0x4b, 0x93, 0x72, 0x33, 0x4b, 0x28, 0xf1, 0x81, 0x19, 0x17, + 0x2b, 0x58, 0x01, 0xd8, 0xf1, 0x58, 0xf4, 0x81, 0xad, 0x81, 0xe8, 0x03, 0x0b, 0x04, 0x41, 0x28, + 0x34, 0x9f, 0x33, 0x93, 0xe5, 0x73, 0x16, 0x92, 0x7c, 0xfe, 0x15, 0x16, 0x73, 0x60, 0x27, 0x51, + 0x1a, 0x73, 0x43, 0xc6, 0xdf, 0x4e, 0x1e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, + 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, + 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x72, 0xbe, + 0x6e, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0x3c, 0xff, 0x56, 0x40, 0x73, 0x70, 0x49, + 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x0b, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x43, + 0x89, 0xd4, 0x5f, 0x3e, 0x04, 0x00, 0x00, +} + +func (m *EventClaimCreated) 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 *EventClaimCreated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClaimCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) + i-- + dAtA[i] = 0x10 + } + if m.Claim != nil { + { + size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventClaimUpdated) 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 *EventClaimUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClaimUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + i-- + dAtA[i] = 0x18 + } + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) + i-- + dAtA[i] = 0x10 + } + if m.Claim != nil { + { + size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventProofSubmitted) 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 *EventProofSubmitted) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventProofSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + i-- + dAtA[i] = 0x20 + } + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) + i-- + dAtA[i] = 0x18 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Claim != nil { + { + size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventProofUpdated) 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 *EventProofUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventProofUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + i-- + dAtA[i] = 0x20 + } + if m.NumRelays != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) + i-- + dAtA[i] = 0x18 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Claim != nil { + { + size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventClaimCreated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Claim != nil { + l = m.Claim.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) + } + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) + } + return n +} + +func (m *EventClaimUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Claim != nil { + l = m.Claim.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) + } + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) + } + return n +} + +func (m *EventProofSubmitted) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Claim != nil { + l = m.Claim.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) + } + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) + } + return n +} + +func (m *EventProofUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Claim != nil { + l = m.Claim.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.NumRelays != 0 { + n += 1 + sovEvent(uint64(m.NumRelays)) + } + if m.NumComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumComputeUnits)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventClaimCreated) 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 ErrIntOverflowEvent + } + 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: EventClaimCreated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClaimCreated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Claim == nil { + m.Claim = &Claim{} + } + if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + m.NumRelays = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + m.NumComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventClaimUpdated) 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 ErrIntOverflowEvent + } + 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: EventClaimUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClaimUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Claim == nil { + m.Claim = &Claim{} + } + if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + m.NumRelays = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + m.NumComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventProofSubmitted) 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 ErrIntOverflowEvent + } + 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: EventProofSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventProofSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Claim == nil { + m.Claim = &Claim{} + } + if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + m.NumRelays = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + m.NumComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventProofUpdated) 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 ErrIntOverflowEvent + } + 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: EventProofUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventProofUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Claim == nil { + m.Claim = &Claim{} + } + if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) + } + m.NumRelays = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumRelays |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + } + m.NumComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) From b9eeb40b5025a91c539416dfd83da85760ce652d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 12:43:33 +0200 Subject: [PATCH 06/15] chore: add claim/proof to response messages --- api/poktroll/proof/tx.pulsar.go | 437 +++++++++++++++++++++++--------- proto/poktroll/proof/tx.proto | 10 +- x/proof/types/tx.pb.go | 218 ++++++++++++---- 3 files changed, 492 insertions(+), 173 deletions(-) diff --git a/api/poktroll/proof/tx.pulsar.go b/api/poktroll/proof/tx.pulsar.go index 3cb8c7e72..2dc2636b2 100644 --- a/api/poktroll/proof/tx.pulsar.go +++ b/api/poktroll/proof/tx.pulsar.go @@ -2758,12 +2758,14 @@ func (x *fastReflection_MsgCreateClaim) ProtoMethods() *protoiface.Methods { } var ( - md_MsgCreateClaimResponse protoreflect.MessageDescriptor + md_MsgCreateClaimResponse protoreflect.MessageDescriptor + fd_MsgCreateClaimResponse_claim protoreflect.FieldDescriptor ) func init() { file_poktroll_proof_tx_proto_init() md_MsgCreateClaimResponse = File_poktroll_proof_tx_proto.Messages().ByName("MsgCreateClaimResponse") + fd_MsgCreateClaimResponse_claim = md_MsgCreateClaimResponse.Fields().ByName("claim") } var _ protoreflect.Message = (*fastReflection_MsgCreateClaimResponse)(nil) @@ -2831,6 +2833,12 @@ func (x *fastReflection_MsgCreateClaimResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateClaimResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_MsgCreateClaimResponse_claim, value) { + return + } + } } // Has reports whether a field is populated. @@ -2846,6 +2854,8 @@ func (x *fastReflection_MsgCreateClaimResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateClaimResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + return x.Claim != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -2862,6 +2872,8 @@ func (x *fastReflection_MsgCreateClaimResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClaimResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + x.Claim = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -2878,6 +2890,9 @@ func (x *fastReflection_MsgCreateClaimResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateClaimResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -2898,6 +2913,8 @@ func (x *fastReflection_MsgCreateClaimResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClaimResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + x.Claim = value.Message().Interface().(*Claim) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -2918,6 +2935,11 @@ func (x *fastReflection_MsgCreateClaimResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClaimResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -2931,6 +2953,9 @@ func (x *fastReflection_MsgCreateClaimResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateClaimResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.proof.MsgCreateClaimResponse.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) @@ -3000,6 +3025,10 @@ func (x *fastReflection_MsgCreateClaimResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l + if x.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -3029,6 +3058,20 @@ func (x *fastReflection_MsgCreateClaimResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -3078,6 +3121,42 @@ func (x *fastReflection_MsgCreateClaimResponse) ProtoMethods() *protoiface.Metho return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3679,12 +3758,14 @@ func (x *fastReflection_MsgSubmitProof) ProtoMethods() *protoiface.Methods { } var ( - md_MsgSubmitProofResponse protoreflect.MessageDescriptor + md_MsgSubmitProofResponse protoreflect.MessageDescriptor + fd_MsgSubmitProofResponse_proof protoreflect.FieldDescriptor ) func init() { file_poktroll_proof_tx_proto_init() md_MsgSubmitProofResponse = File_poktroll_proof_tx_proto.Messages().ByName("MsgSubmitProofResponse") + fd_MsgSubmitProofResponse_proof = md_MsgSubmitProofResponse.Fields().ByName("proof") } var _ protoreflect.Message = (*fastReflection_MsgSubmitProofResponse)(nil) @@ -3752,6 +3833,12 @@ func (x *fastReflection_MsgSubmitProofResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgSubmitProofResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Proof != nil { + value := protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + if !f(fd_MsgSubmitProofResponse_proof, value) { + return + } + } } // Has reports whether a field is populated. @@ -3767,6 +3854,8 @@ func (x *fastReflection_MsgSubmitProofResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgSubmitProofResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + return x.Proof != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3783,6 +3872,8 @@ func (x *fastReflection_MsgSubmitProofResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitProofResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + x.Proof = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3799,6 +3890,9 @@ func (x *fastReflection_MsgSubmitProofResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgSubmitProofResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + value := x.Proof + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3819,6 +3913,8 @@ func (x *fastReflection_MsgSubmitProofResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitProofResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + x.Proof = value.Message().Interface().(*Proof) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3839,6 +3935,11 @@ func (x *fastReflection_MsgSubmitProofResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgSubmitProofResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + if x.Proof == nil { + x.Proof = new(Proof) + } + return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3852,6 +3953,9 @@ func (x *fastReflection_MsgSubmitProofResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgSubmitProofResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.proof.MsgSubmitProofResponse.proof": + m := new(Proof) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) @@ -3921,6 +4025,10 @@ func (x *fastReflection_MsgSubmitProofResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l + if x.Proof != nil { + l = options.Size(x.Proof) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -3950,6 +4058,20 @@ func (x *fastReflection_MsgSubmitProofResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Proof != nil { + encoded, err := options.Marshal(x.Proof) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -3999,6 +4121,42 @@ func (x *fastReflection_MsgSubmitProofResponse) ProtoMethods() *protoiface.Metho return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Proof == nil { + x.Proof = &Proof{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proof); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -4346,6 +4504,8 @@ type MsgCreateClaimResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` } func (x *MsgCreateClaimResponse) Reset() { @@ -4368,6 +4528,13 @@ func (*MsgCreateClaimResponse) Descriptor() ([]byte, []int) { return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{5} } +func (x *MsgCreateClaimResponse) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + type MsgSubmitProof struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4424,6 +4591,8 @@ type MsgSubmitProofResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` } func (x *MsgSubmitProofResponse) Reset() { @@ -4446,6 +4615,13 @@ func (*MsgSubmitProofResponse) Descriptor() ([]byte, []int) { return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{7} } +func (x *MsgSubmitProofResponse) GetProof() *Proof { + if x != nil { + return x.Proof + } + return nil +} + var File_poktroll_proof_tx_proto protoreflect.FileDescriptor var file_poktroll_proof_tx_proto_rawDesc = []byte{ @@ -4461,114 +4637,123 @@ var file_poktroll_proof_tx_proto_rawDesc = []byte{ 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, - 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, - 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x33, 0x82, 0xe7, 0xb0, 0x2a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x20, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, - 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe9, 0x02, 0x0a, 0x0e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x33, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0xe9, 0x02, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x29, + 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, + 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, + 0x52, 0x07, 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, + 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x66, + 0x6c, 0x6f, 0x61, 0x74, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, + 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, + 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, + 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x48, 0x0a, + 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, + 0x48, 0x61, 0x73, 0x68, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x45, 0x0a, 0x16, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x22, 0xca, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xea, 0xde, 0x1f, - 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, - 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, - 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x08, - 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0c, - 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x48, 0x00, 0x52, 0x07, - 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, - 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, - 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x48, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, - 0xd1, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, - 0x69, 0x6d, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x3a, 0x15, 0x82, 0xe7, - 0xb0, 0x2a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, 0x01, - 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, - 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xeb, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, - 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1e, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x26, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, - 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, + 0x45, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, + 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x32, 0xeb, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, + 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x55, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1e, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, + 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x26, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, + 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, + 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, + 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, + 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4596,26 +4781,30 @@ var file_poktroll_proof_tx_proto_goTypes = []interface{}{ (*Params)(nil), // 8: poktroll.proof.Params (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin (*session.SessionHeader)(nil), // 10: poktroll.session.SessionHeader + (*Claim)(nil), // 11: poktroll.proof.Claim + (*Proof)(nil), // 12: poktroll.proof.Proof } var file_poktroll_proof_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.proof.MsgUpdateParams.params:type_name -> poktroll.proof.Params 9, // 1: poktroll.proof.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin 8, // 2: poktroll.proof.MsgUpdateParamResponse.params:type_name -> poktroll.proof.Params 10, // 3: poktroll.proof.MsgCreateClaim.session_header:type_name -> poktroll.session.SessionHeader - 10, // 4: poktroll.proof.MsgSubmitProof.session_header:type_name -> poktroll.session.SessionHeader - 0, // 5: poktroll.proof.Msg.UpdateParams:input_type -> poktroll.proof.MsgUpdateParams - 4, // 6: poktroll.proof.Msg.CreateClaim:input_type -> poktroll.proof.MsgCreateClaim - 6, // 7: poktroll.proof.Msg.SubmitProof:input_type -> poktroll.proof.MsgSubmitProof - 2, // 8: poktroll.proof.Msg.UpdateParam:input_type -> poktroll.proof.MsgUpdateParam - 1, // 9: poktroll.proof.Msg.UpdateParams:output_type -> poktroll.proof.MsgUpdateParamsResponse - 5, // 10: poktroll.proof.Msg.CreateClaim:output_type -> poktroll.proof.MsgCreateClaimResponse - 7, // 11: poktroll.proof.Msg.SubmitProof:output_type -> poktroll.proof.MsgSubmitProofResponse - 3, // 12: poktroll.proof.Msg.UpdateParam:output_type -> poktroll.proof.MsgUpdateParamResponse - 9, // [9:13] is the sub-list for method output_type - 5, // [5:9] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 11, // 4: poktroll.proof.MsgCreateClaimResponse.claim:type_name -> poktroll.proof.Claim + 10, // 5: poktroll.proof.MsgSubmitProof.session_header:type_name -> poktroll.session.SessionHeader + 12, // 6: poktroll.proof.MsgSubmitProofResponse.proof:type_name -> poktroll.proof.Proof + 0, // 7: poktroll.proof.Msg.UpdateParams:input_type -> poktroll.proof.MsgUpdateParams + 4, // 8: poktroll.proof.Msg.CreateClaim:input_type -> poktroll.proof.MsgCreateClaim + 6, // 9: poktroll.proof.Msg.SubmitProof:input_type -> poktroll.proof.MsgSubmitProof + 2, // 10: poktroll.proof.Msg.UpdateParam:input_type -> poktroll.proof.MsgUpdateParam + 1, // 11: poktroll.proof.Msg.UpdateParams:output_type -> poktroll.proof.MsgUpdateParamsResponse + 5, // 12: poktroll.proof.Msg.CreateClaim:output_type -> poktroll.proof.MsgCreateClaimResponse + 7, // 13: poktroll.proof.Msg.SubmitProof:output_type -> poktroll.proof.MsgSubmitProofResponse + 3, // 14: poktroll.proof.Msg.UpdateParam:output_type -> poktroll.proof.MsgUpdateParamResponse + 11, // [11:15] is the sub-list for method output_type + 7, // [7:11] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_poktroll_proof_tx_proto_init() } @@ -4624,6 +4813,8 @@ func file_poktroll_proof_tx_proto_init() { return } file_poktroll_proof_params_proto_init() + file_poktroll_proof_claim_proto_init() + file_poktroll_proof_proof_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_proof_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgUpdateParams); i { diff --git a/proto/poktroll/proof/tx.proto b/proto/poktroll/proof/tx.proto index 0cb5ddb0f..f2f3968e5 100644 --- a/proto/poktroll/proof/tx.proto +++ b/proto/poktroll/proof/tx.proto @@ -10,6 +10,8 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "poktroll/proof/params.proto"; +import "poktroll/proof/claim.proto"; +import "poktroll/proof/proof.proto"; import "poktroll/session/session.proto"; import "poktroll/shared/service.proto"; @@ -80,7 +82,9 @@ message MsgCreateClaim { bytes root_hash = 3; } -message MsgCreateClaimResponse {} +message MsgCreateClaimResponse { + poktroll.proof.Claim claim = 1; +} message MsgSubmitProof { option (cosmos.msg.v1.signer) = "supplier_address"; @@ -91,4 +95,6 @@ message MsgSubmitProof { bytes proof = 3; } -message MsgSubmitProofResponse {} \ No newline at end of file +message MsgSubmitProofResponse { + poktroll.proof.Proof proof = 1; +} \ No newline at end of file diff --git a/x/proof/types/tx.pb.go b/x/proof/types/tx.pb.go index e40c881b3..ad1227474 100644 --- a/x/proof/types/tx.pb.go +++ b/x/proof/types/tx.pb.go @@ -381,6 +381,7 @@ func (m *MsgCreateClaim) GetRootHash() []byte { } type MsgCreateClaimResponse struct { + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` } func (m *MsgCreateClaimResponse) Reset() { *m = MsgCreateClaimResponse{} } @@ -416,6 +417,13 @@ func (m *MsgCreateClaimResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClaimResponse proto.InternalMessageInfo +func (m *MsgCreateClaimResponse) GetClaim() *Claim { + if m != nil { + return m.Claim + } + return nil +} + type MsgSubmitProof struct { SupplierAddress string `protobuf:"bytes,1,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` SessionHeader *types1.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` @@ -478,6 +486,7 @@ func (m *MsgSubmitProof) GetProof() []byte { } type MsgSubmitProofResponse struct { + Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` } func (m *MsgSubmitProofResponse) Reset() { *m = MsgSubmitProofResponse{} } @@ -513,6 +522,13 @@ func (m *MsgSubmitProofResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitProofResponse proto.InternalMessageInfo +func (m *MsgSubmitProofResponse) GetProof() *Proof { + if m != nil { + return m.Proof + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.proof.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.proof.MsgUpdateParamsResponse") @@ -527,54 +543,56 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/tx.proto", fileDescriptor_345e95e87511f6a6) } var fileDescriptor_345e95e87511f6a6 = []byte{ - // 747 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x31, 0x4f, 0xdb, 0x40, - 0x14, 0x8e, 0x43, 0x09, 0xf1, 0x11, 0x42, 0x6b, 0x51, 0x30, 0x41, 0x75, 0xa2, 0x0c, 0x6d, 0x8a, - 0x8a, 0x2d, 0xa0, 0x42, 0x2a, 0x1b, 0x89, 0x84, 0xd2, 0x01, 0x09, 0x19, 0x21, 0x55, 0x5d, 0xa2, - 0x4b, 0x72, 0xc4, 0x16, 0xb1, 0xcf, 0xba, 0xbb, 0x50, 0xd8, 0xaa, 0x8e, 0x9d, 0xfa, 0x33, 0x3a, - 0x32, 0x74, 0xe9, 0x3f, 0x40, 0x9d, 0x68, 0xa7, 0x4e, 0x51, 0x05, 0x03, 0x2a, 0xfd, 0x13, 0xd5, - 0x9d, 0xcf, 0x8e, 0x13, 0xa2, 0x20, 0x75, 0xea, 0x12, 0xdf, 0xbd, 0xef, 0xbb, 0x4f, 0xef, 0x7b, - 0xef, 0xdd, 0x05, 0x2c, 0x05, 0xf8, 0x98, 0x11, 0xdc, 0xed, 0x5a, 0x01, 0xc1, 0xf8, 0xc8, 0x62, - 0xa7, 0x66, 0x40, 0x30, 0xc3, 0x5a, 0x3e, 0x02, 0x4c, 0x01, 0x14, 0x1e, 0x41, 0xcf, 0xf5, 0xb1, - 0x25, 0x7e, 0x43, 0x4a, 0xc1, 0x68, 0x61, 0xea, 0x61, 0x6a, 0x35, 0x21, 0x45, 0xd6, 0xc9, 0x7a, - 0x13, 0x31, 0xb8, 0x6e, 0xb5, 0xb0, 0xeb, 0x4b, 0x7c, 0x49, 0xe2, 0x1e, 0xed, 0x58, 0x27, 0xeb, - 0xfc, 0x23, 0x81, 0xe5, 0x10, 0x68, 0x88, 0x9d, 0x15, 0x6e, 0x24, 0xb4, 0xd0, 0xc1, 0x1d, 0x1c, - 0xc6, 0xf9, 0x4a, 0x46, 0x57, 0x46, 0xb2, 0x0c, 0x20, 0x81, 0x5e, 0x74, 0xc4, 0x88, 0x41, 0x8a, - 0x28, 0x75, 0xb1, 0x1f, 0x7d, 0x25, 0xfe, 0x64, 0x80, 0x3b, 0x90, 0xa0, 0xb6, 0x45, 0x11, 0x39, - 0x71, 0x5b, 0x28, 0x84, 0xcb, 0x5f, 0x15, 0x30, 0xbf, 0x47, 0x3b, 0x87, 0x41, 0x1b, 0x32, 0xb4, - 0x2f, 0x84, 0xb5, 0x2d, 0xa0, 0xc2, 0x1e, 0x73, 0x30, 0x71, 0xd9, 0x99, 0xae, 0x94, 0x94, 0x8a, - 0x5a, 0xd5, 0x7f, 0x7c, 0x59, 0x5b, 0x90, 0xa9, 0xee, 0xb4, 0xdb, 0x04, 0x51, 0x7a, 0xc0, 0x88, - 0xeb, 0x77, 0xec, 0x01, 0x55, 0x7b, 0x05, 0x32, 0x61, 0x6a, 0x7a, 0xba, 0xa4, 0x54, 0x66, 0x37, - 0x16, 0xcd, 0xe1, 0x2a, 0x9a, 0xa1, 0x7e, 0x55, 0xbd, 0xe8, 0x17, 0x53, 0x9f, 0x6f, 0xce, 0x57, - 0x15, 0x5b, 0x1e, 0xd8, 0xde, 0xfc, 0x70, 0x73, 0xbe, 0x3a, 0x90, 0xfa, 0x78, 0x73, 0xbe, 0x5a, - 0x8a, 0x13, 0x3f, 0x95, 0xbe, 0x47, 0xf2, 0x2c, 0x2f, 0x83, 0xa5, 0x91, 0x90, 0x8d, 0x68, 0x80, - 0x7d, 0x8a, 0xca, 0xbf, 0xd3, 0x20, 0x3f, 0x8c, 0xfd, 0xb3, 0x2b, 0x0d, 0x3c, 0xf0, 0xa1, 0x87, - 0x84, 0x27, 0xd5, 0x16, 0x6b, 0xed, 0x05, 0x50, 0x21, 0x6d, 0x50, 0xc1, 0xd5, 0xa7, 0x84, 0xd6, - 0xdc, 0x6d, 0xbf, 0x38, 0x08, 0xd6, 0x53, 0x76, 0x16, 0x4a, 0x31, 0xed, 0x39, 0xc8, 0x42, 0xda, - 0x70, 0x7d, 0xb6, 0xf5, 0x52, 0xcf, 0x94, 0x94, 0xca, 0x54, 0x35, 0x77, 0xdb, 0x2f, 0xc6, 0xb1, - 0x7a, 0xca, 0x9e, 0x81, 0xf4, 0x35, 0x5f, 0x4a, 0x6a, 0xf3, 0x8c, 0x21, 0xaa, 0xcf, 0x94, 0x94, - 0x4a, 0x2e, 0xa6, 0x8a, 0x58, 0x48, 0xad, 0xf2, 0xa5, 0xa4, 0x1e, 0x75, 0x31, 0x64, 0x7a, 0xb6, - 0xa4, 0x54, 0xd2, 0x31, 0x55, 0xc4, 0x42, 0xea, 0x2e, 0x5f, 0x6a, 0x3b, 0x60, 0x06, 0xd2, 0x06, - 0x9f, 0x4d, 0x5d, 0x15, 0x9d, 0x59, 0x36, 0xa5, 0x6b, 0x3e, 0xbc, 0xa6, 0x1c, 0x5e, 0xb3, 0x86, - 0x5d, 0xbf, 0x3a, 0x7b, 0xdb, 0x2f, 0x46, 0xec, 0x7a, 0xca, 0xce, 0x40, 0xca, 0xc3, 0xdb, 0xf9, - 0xe1, 0x06, 0x55, 0x55, 0x21, 0xc9, 0xce, 0x02, 0x54, 0xae, 0x83, 0xc5, 0xe1, 0x52, 0x47, 0x5d, - 0xd0, 0xcc, 0x78, 0x20, 0x94, 0x49, 0x03, 0x11, 0x4d, 0x41, 0xf9, 0xbb, 0x22, 0xba, 0x56, 0x23, - 0x08, 0x32, 0x54, 0xeb, 0x42, 0xd7, 0xd3, 0x6a, 0xe0, 0x21, 0xed, 0x05, 0x41, 0xd7, 0x45, 0xa4, - 0x01, 0xc3, 0x16, 0xdd, 0xdb, 0xbc, 0xf9, 0xe8, 0x84, 0x0c, 0x6b, 0xbb, 0x20, 0x2f, 0x2f, 0x45, - 0xc3, 0x41, 0xb0, 0x8d, 0x88, 0x1c, 0xd0, 0xe2, 0x20, 0x9f, 0xe8, 0xd2, 0x1c, 0x84, 0xdf, 0xba, - 0xa0, 0xd9, 0x73, 0x34, 0xb9, 0xd5, 0x56, 0x80, 0x4a, 0x30, 0x66, 0x0d, 0x07, 0x52, 0x47, 0xb4, - 0x3d, 0x67, 0x67, 0x79, 0xa0, 0x0e, 0xa9, 0xb3, 0xfd, 0x98, 0x57, 0xe8, 0x4e, 0xb2, 0x65, 0x5d, - 0x54, 0x27, 0x61, 0x29, 0x9e, 0xd1, 0x6f, 0xa1, 0xdb, 0x83, 0x5e, 0xd3, 0x73, 0xd9, 0x3e, 0xaf, - 0xc7, 0xff, 0xe5, 0x76, 0x01, 0x4c, 0x8b, 0x2e, 0x49, 0xa7, 0xe1, 0x66, 0xb2, 0xcd, 0x84, 0x97, - 0xc8, 0xe6, 0xc6, 0x9f, 0x34, 0x98, 0xda, 0xa3, 0x1d, 0xed, 0x0d, 0xc8, 0x0d, 0xbd, 0x32, 0xc5, - 0xd1, 0x61, 0x18, 0xb9, 0xcb, 0x85, 0x67, 0xf7, 0x10, 0xe2, 0x31, 0x3b, 0x04, 0xb3, 0xc9, 0x91, - 0x31, 0xc6, 0x9c, 0x4b, 0xe0, 0x85, 0xa7, 0x93, 0xf1, 0xa4, 0x6c, 0xb2, 0x37, 0xe3, 0x64, 0x13, - 0xf8, 0x58, 0xd9, 0x31, 0xf5, 0xe0, 0xb2, 0xc9, 0x67, 0xc9, 0x98, 0xec, 0x72, 0xac, 0xec, 0x98, - 0xbb, 0x56, 0x98, 0x7e, 0xcf, 0x1f, 0xd4, 0x6a, 0xfd, 0xe2, 0xca, 0x50, 0x2e, 0xaf, 0x0c, 0xe5, - 0xd7, 0x95, 0xa1, 0x7c, 0xba, 0x36, 0x52, 0x97, 0xd7, 0x46, 0xea, 0xe7, 0xb5, 0x91, 0x7a, 0x6b, - 0x76, 0x5c, 0xe6, 0xf4, 0x9a, 0x66, 0x0b, 0x7b, 0x16, 0x97, 0x5c, 0xf3, 0x11, 0x7b, 0x87, 0xc9, - 0xb1, 0x75, 0xe7, 0x9d, 0xe5, 0xb7, 0x9a, 0x36, 0x33, 0xe2, 0x0f, 0x62, 0xf3, 0x6f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x51, 0xc2, 0x1c, 0xdb, 0x24, 0x07, 0x00, 0x00, + // 783 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0xc3, 0x25, 0xc4, 0x93, 0x10, 0xee, 0xb5, 0xf8, 0x31, 0x41, 0xd7, 0x89, 0xb2, 0xb8, + 0x37, 0xa5, 0xc5, 0x16, 0x50, 0x21, 0x95, 0x1d, 0x89, 0x8a, 0xd2, 0x05, 0x12, 0x32, 0x42, 0xaa, + 0xba, 0x89, 0x26, 0xc9, 0x90, 0x58, 0xc4, 0x1e, 0xcb, 0x33, 0xa1, 0xb0, 0xab, 0xba, 0xec, 0xaa, + 0x8f, 0xd1, 0x25, 0x8b, 0x6e, 0xfa, 0x06, 0xa8, 0x2b, 0xda, 0x55, 0x57, 0x51, 0x05, 0x0b, 0x54, + 0xfa, 0x12, 0xd5, 0xfc, 0xd8, 0x71, 0x42, 0x08, 0x52, 0x57, 0xdd, 0x78, 0x66, 0xce, 0xf7, 0xcd, + 0xd1, 0x39, 0xdf, 0x39, 0x73, 0x0c, 0x96, 0x7c, 0x7c, 0x4c, 0x03, 0xdc, 0xed, 0x5a, 0x7e, 0x80, + 0xf1, 0x91, 0x45, 0x4f, 0x4d, 0x3f, 0xc0, 0x14, 0x6b, 0xb9, 0x10, 0x30, 0x39, 0x90, 0xff, 0x07, + 0xba, 0x8e, 0x87, 0x2d, 0xfe, 0x15, 0x94, 0xbc, 0xd1, 0xc4, 0xc4, 0xc5, 0xc4, 0x6a, 0x40, 0x82, + 0xac, 0x93, 0xf5, 0x06, 0xa2, 0x70, 0xdd, 0x6a, 0x62, 0xc7, 0x93, 0xf8, 0x92, 0xc4, 0x5d, 0xd2, + 0xb6, 0x4e, 0xd6, 0xd9, 0x22, 0x81, 0x65, 0x01, 0xd4, 0xf9, 0xc9, 0x12, 0x07, 0x09, 0xcd, 0xb7, + 0x71, 0x1b, 0x0b, 0x3b, 0xdb, 0x49, 0xeb, 0xca, 0x48, 0x94, 0x3e, 0x0c, 0xa0, 0x1b, 0x5e, 0xc9, + 0x8f, 0x80, 0xcd, 0x2e, 0x74, 0xdc, 0x7b, 0x30, 0xfe, 0x0d, 0xc3, 0x8f, 0x30, 0x82, 0x08, 0x71, + 0xb0, 0x17, 0xae, 0x12, 0xff, 0x77, 0x80, 0x77, 0x60, 0x80, 0x5a, 0x16, 0x41, 0xc1, 0x89, 0xd3, + 0x44, 0x02, 0x2e, 0x7d, 0x52, 0xc0, 0xdc, 0x1e, 0x69, 0x1f, 0xfa, 0x2d, 0x48, 0xd1, 0x3e, 0x0f, + 0x48, 0xdb, 0x02, 0x2a, 0xec, 0xd1, 0x0e, 0x0e, 0x1c, 0x7a, 0xa6, 0x2b, 0x45, 0xa5, 0xac, 0x56, + 0xf4, 0xaf, 0x1f, 0xd7, 0xe6, 0x65, 0x8a, 0x3b, 0xad, 0x56, 0x80, 0x08, 0x39, 0xa0, 0x81, 0xe3, + 0xb5, 0xed, 0x01, 0x55, 0x7b, 0x06, 0x52, 0x22, 0x25, 0x3d, 0x59, 0x54, 0xca, 0x99, 0x8d, 0x45, + 0x73, 0x58, 0x7d, 0x53, 0xf8, 0xaf, 0xa8, 0x17, 0xfd, 0x42, 0xe2, 0xc3, 0xcd, 0xf9, 0xaa, 0x62, + 0xcb, 0x0b, 0xdb, 0x9b, 0x6f, 0x6f, 0xce, 0x57, 0x07, 0xae, 0xde, 0xdd, 0x9c, 0xaf, 0x16, 0xa3, + 0xc0, 0x4f, 0x65, 0xda, 0x23, 0x71, 0x96, 0x96, 0xc1, 0xd2, 0x88, 0xc9, 0x46, 0xc4, 0xc7, 0x1e, + 0x41, 0xa5, 0x1f, 0x49, 0x90, 0x1b, 0xc6, 0x7e, 0x3b, 0x2b, 0x0d, 0xfc, 0xe5, 0x41, 0x17, 0xf1, + 0x9c, 0x54, 0x9b, 0xef, 0xb5, 0x27, 0x40, 0x85, 0xa4, 0x4e, 0x38, 0x57, 0x9f, 0xe2, 0xbe, 0x66, + 0x6f, 0xfb, 0x85, 0x81, 0xb1, 0x96, 0xb0, 0xd3, 0x50, 0x3a, 0xd3, 0x1e, 0x81, 0x34, 0x24, 0x75, + 0xc7, 0xa3, 0x5b, 0x4f, 0xf5, 0x54, 0x51, 0x29, 0x4f, 0x55, 0xb2, 0xb7, 0xfd, 0x42, 0x64, 0xab, + 0x25, 0xec, 0x19, 0x48, 0x5e, 0xb0, 0xad, 0xa4, 0x36, 0xce, 0x28, 0x22, 0xfa, 0x4c, 0x51, 0x29, + 0x67, 0x23, 0x2a, 0xb7, 0x09, 0x6a, 0x85, 0x6d, 0x25, 0xf5, 0xa8, 0x8b, 0x21, 0xd5, 0xd3, 0x45, + 0xa5, 0x9c, 0x8c, 0xa8, 0xdc, 0x26, 0xa8, 0xbb, 0x6c, 0xab, 0xed, 0x80, 0x19, 0x48, 0xea, 0xac, + 0xa7, 0x75, 0x95, 0x57, 0x66, 0xd9, 0x94, 0x59, 0xb3, 0xa6, 0x37, 0x65, 0xd3, 0x9b, 0x55, 0xec, + 0x78, 0x95, 0xcc, 0x6d, 0xbf, 0x10, 0xb2, 0x6b, 0x09, 0x3b, 0x05, 0x09, 0x33, 0x6f, 0xe7, 0x86, + 0x0b, 0x54, 0x51, 0xb9, 0x4b, 0x7a, 0xe6, 0xa3, 0x52, 0x0d, 0x2c, 0x0e, 0x4b, 0x1d, 0x56, 0x41, + 0x33, 0xa3, 0x86, 0x50, 0x26, 0x35, 0x44, 0xd8, 0x05, 0xa5, 0x2f, 0x0a, 0xaf, 0x5a, 0x35, 0x40, + 0x90, 0xa2, 0x2a, 0x7b, 0x00, 0x5a, 0x15, 0xfc, 0x4d, 0x7a, 0xbe, 0xdf, 0x75, 0x50, 0x50, 0x87, + 0xa2, 0x44, 0x0f, 0x16, 0x6f, 0x2e, 0xbc, 0x21, 0xcd, 0xda, 0x2e, 0xc8, 0xc9, 0x47, 0x51, 0xef, + 0x20, 0xd8, 0x42, 0x81, 0x6c, 0xd0, 0xc2, 0x20, 0x9e, 0xf0, 0xd1, 0x1c, 0x88, 0xb5, 0xc6, 0x69, + 0xf6, 0x2c, 0x89, 0x1f, 0xb5, 0x15, 0xa0, 0x06, 0x18, 0xd3, 0x7a, 0x07, 0x92, 0x0e, 0x2f, 0x7b, + 0xd6, 0x4e, 0x33, 0x43, 0x0d, 0x92, 0xce, 0xf6, 0x02, 0x53, 0xe8, 0x4e, 0xb0, 0xa5, 0xe7, 0x5c, + 0x9d, 0x58, 0x4a, 0x91, 0x3a, 0x8f, 0xc1, 0x34, 0x7f, 0xe4, 0x52, 0x9c, 0x85, 0x51, 0x71, 0x04, + 0x5b, 0x70, 0x4a, 0x9f, 0x85, 0x34, 0x07, 0xbd, 0x86, 0xeb, 0xd0, 0x7d, 0x86, 0xff, 0x59, 0xd2, + 0xcc, 0x83, 0x69, 0x1e, 0xb5, 0x94, 0x45, 0x1c, 0x26, 0x6b, 0x12, 0xcb, 0x25, 0xae, 0x89, 0x70, + 0x73, 0x8f, 0x26, 0x82, 0x2d, 0x38, 0x1b, 0x3f, 0x93, 0x60, 0x6a, 0x8f, 0xb4, 0xb5, 0x97, 0x20, + 0x3b, 0x34, 0xbf, 0x0a, 0xa3, 0xb7, 0x46, 0xa6, 0x44, 0xfe, 0xff, 0x07, 0x08, 0x51, 0x38, 0x87, + 0x20, 0x13, 0x6f, 0x46, 0x63, 0xcc, 0xbd, 0x18, 0x9e, 0xff, 0x6f, 0x32, 0x1e, 0x77, 0x1b, 0x2f, + 0xe4, 0x38, 0xb7, 0x31, 0x7c, 0xac, 0xdb, 0x71, 0xe2, 0x1d, 0x82, 0x4c, 0x7c, 0xe0, 0x19, 0x93, + 0xb3, 0x1c, 0xeb, 0x76, 0xcc, 0x2b, 0xce, 0x4f, 0xbf, 0x61, 0xa3, 0xba, 0x52, 0xbb, 0xb8, 0x32, + 0x94, 0xcb, 0x2b, 0x43, 0xf9, 0x7e, 0x65, 0x28, 0xef, 0xaf, 0x8d, 0xc4, 0xe5, 0xb5, 0x91, 0xf8, + 0x76, 0x6d, 0x24, 0x5e, 0x99, 0x6d, 0x87, 0x76, 0x7a, 0x0d, 0xb3, 0x89, 0x5d, 0x8b, 0xb9, 0x5c, + 0xf3, 0x10, 0x7d, 0x8d, 0x83, 0x63, 0xeb, 0xce, 0x04, 0x67, 0xf3, 0x82, 0x34, 0x52, 0xfc, 0xd7, + 0xb3, 0xf9, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x5d, 0x17, 0x47, 0xb6, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1058,6 +1076,18 @@ func (m *MsgCreateClaimResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Claim != nil { + { + size, err := m.Claim.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1130,6 +1160,18 @@ func (m *MsgSubmitProofResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1280,6 +1322,10 @@ func (m *MsgCreateClaimResponse) Size() (n int) { } var l int _ = l + if m.Claim != nil { + l = m.Claim.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1310,6 +1356,10 @@ func (m *MsgSubmitProofResponse) Size() (n int) { } var l int _ = l + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1996,6 +2046,42 @@ func (m *MsgCreateClaimResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgCreateClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Claim == nil { + m.Claim = &Claim{} + } + if err := m.Claim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2198,6 +2284,42 @@ func (m *MsgSubmitProofResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgSubmitProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From 80788b22bedac0f689f7e517226d5c02ec3f27b4 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 09:20:25 +0200 Subject: [PATCH 07/15] test: add assertions for claim/proof events --- .../keeper/msg_server_create_claim_test.go | 32 ++++++++++++++++- .../keeper/msg_server_submit_proof_test.go | 36 ++++++++++++++++--- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/x/proof/keeper/msg_server_create_claim_test.go b/x/proof/keeper/msg_server_create_claim_test.go index c1ba1479d..e28763696 100644 --- a/x/proof/keeper/msg_server_create_claim_test.go +++ b/x/proof/keeper/msg_server_create_claim_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + abci "github.com/cometbft/cometbft/abci/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/smt" "github.com/stretchr/testify/require" @@ -21,7 +22,12 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -var defaultMerkleRoot = testproof.SmstRootWithSum(10) +const ( + expectedNumComputeUnits = 10 + expectedNumRelays = 1 +) + +var defaultMerkleRoot = testproof.SmstRootWithSum(expectedNumComputeUnits) func TestMsgServer_CreateClaim_Success(t *testing.T) { tests := []struct { @@ -120,6 +126,21 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { require.Equal(t, claimMsg.SupplierAddress, claim.GetSupplierAddress()) require.Equal(t, claimMsg.SessionHeader.GetSessionEndBlockHeight(), claimSessionHeader.GetSessionEndBlockHeight()) require.Equal(t, claimMsg.RootHash, claim.GetRootHash()) + + events := sdkCtx.EventManager().Events() + require.Equal(t, 1, len(events)) + + require.Equal(t, events[0].Type, "poktroll.proof.EventClaimCreated") + + event, err := cosmostypes.ParseTypedEvent(abci.Event(events[0])) + require.NoError(t, err) + + claimCreatedEvent, ok := event.(*types.EventClaimCreated) + require.Truef(t, ok, "unexpected event type %T", event) + + require.EqualValues(t, &claim, claimCreatedEvent.GetClaim()) + require.Equal(t, uint64(expectedNumComputeUnits), claimCreatedEvent.GetNumComputeUnits()) + require.Equal(t, uint64(expectedNumRelays), claimCreatedEvent.GetNumRelays()) }) } } @@ -229,6 +250,10 @@ func TestMsgServer_CreateClaim_Error_OutsideOfWindow(t *testing.T) { claims := claimRes.GetClaims() require.Lenf(t, claims, 0, "expected 0 claim, got %d", len(claims)) + + // Assert that no events were emitted. + events := sdkCtx.EventManager().Events() + require.Equal(t, 0, len(events)) }) } } @@ -431,6 +456,11 @@ func TestMsgServer_CreateClaim_Error(t *testing.T) { createClaimRes, err := srv.CreateClaim(ctx, test.claimMsgFn(t)) require.ErrorContains(t, err, test.expectedErr.Error()) require.Nil(t, createClaimRes) + + // Assert that no events were emitted. + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + events := sdkCtx.EventManager().Events() + require.Equal(t, 0, len(events)) }) } } diff --git a/x/proof/keeper/msg_server_submit_proof_test.go b/x/proof/keeper/msg_server_submit_proof_test.go index 547d3d87a..366784463 100644 --- a/x/proof/keeper/msg_server_submit_proof_test.go +++ b/x/proof/keeper/msg_server_submit_proof_test.go @@ -21,6 +21,7 @@ import ( "github.com/pokt-network/poktroll/pkg/relayer" "github.com/pokt-network/poktroll/pkg/relayer/protocol" "github.com/pokt-network/poktroll/pkg/relayer/session" + testutilevents "github.com/pokt-network/poktroll/testutil/events" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/testkeyring" "github.com/pokt-network/poktroll/testutil/testrelayer" @@ -138,10 +139,10 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { require.NoError(t, err) // Submit the corresponding proof. - numRelays := uint(5) + expectedNumRelays := uint(5) sessionTree := newFilledSessionTree( ctx, t, - numRelays, + expectedNumRelays, supplierUid, supplierAddr, sessionHeader, sessionHeader, sessionHeader, keyRing, @@ -157,7 +158,7 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { ctx = sdkCtx // Create a valid claim. - createClaimAndStoreBlockHash( + claim := createClaimAndStoreBlockHash( ctx, t, 1, supplierAddr, appAddr, @@ -191,6 +192,19 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { require.Equal(t, proofMsg.SessionHeader.SessionId, proofs[0].GetSessionHeader().GetSessionId()) require.Equal(t, proofMsg.SupplierAddress, proofs[0].GetSupplierAddress()) require.Equal(t, proofMsg.SessionHeader.GetSessionEndBlockHeight(), proofs[0].GetSessionHeader().GetSessionEndBlockHeight()) + + events := sdkCtx.EventManager().Events() + require.Equal(t, 2, len(events)) + + proofSubmittedEvents := testutilevents.FilterEvents[*prooftypes.EventProofSubmitted](t, events, "poktroll.proof.EventProofSubmitted") + require.Equal(t, 1, len(proofSubmittedEvents)) + + proofSubmittedEvent := proofSubmittedEvents[0] + + require.EqualValues(t, claim, proofSubmittedEvent.GetClaim()) + require.EqualValues(t, &proofs[0], proofSubmittedEvent.GetProof()) + require.Equal(t, uint64(expectedNumComputeUnits), proofSubmittedEvent.GetNumComputeUnits()) + require.Equal(t, uint64(expectedNumRelays), proofSubmittedEvent.GetNumRelays()) }) } } @@ -341,6 +355,11 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { proofs := proofRes.GetProofs() require.Lenf(t, proofs, 0, "expected 0 proof, got %d", len(proofs)) + + // Assert that only the create claim event was emitted. + events := sdkCtx.EventManager().Events() + require.Equal(t, 1, len(events)) + require.Equal(t, events[0].Type, "poktroll.proof.EventClaimCreated") }) } } @@ -1120,6 +1139,11 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { // Expect zero proofs to have been persisted as all test cases are error cases. proofs := proofRes.GetProofs() require.Lenf(t, proofs, 0, "expected 0 proofs, got %d", len(proofs)) + + // Assert that no proof submitted events were emitted. + events := sdkCtx.EventManager().Events() + proofSubmittedEvents := testutilevents.FilterEvents[*prooftypes.EventProofSubmitted](t, events, "poktroll.proof.EventProofSubmitted") + require.Equal(t, 0, len(proofSubmittedEvents)) }) } } @@ -1260,7 +1284,7 @@ func createClaimAndStoreBlockHash( sessionHeader *sessiontypes.SessionHeader, msgServer types.MsgServer, keepers *keepertest.ProofModuleKeepers, -) { +) *prooftypes.Claim { merkleRootBz, err := sessionTree.Flush() require.NoError(t, err) @@ -1273,7 +1297,7 @@ func createClaimAndStoreBlockHash( service, merkleRootBz, ) - _, err = msgServer.CreateClaim(ctx, claimMsg) + claimRes, err := msgServer.CreateClaim(ctx, claimMsg) require.NoError(t, err) // TODO_TECHDEBT(@red-0ne): Centralize the business logic that involves taking @@ -1287,6 +1311,8 @@ func createClaimAndStoreBlockHash( // Store the current context's block hash for future height, which is currently an EndBlocker operation. keepers.StoreBlockHash(blockHeightCtx) + + return claimRes.GetClaim() } // getClosestRelayDifficultyBits returns the number of leading 0s (i.e. relay From 097d646b0b603e3bbf697d3879781f28c9e1cf30 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 12:46:34 +0200 Subject: [PATCH 08/15] fix: proof types import alias --- .../keeper/msg_server_submit_proof_test.go | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/x/proof/keeper/msg_server_submit_proof_test.go b/x/proof/keeper/msg_server_submit_proof_test.go index 366784463..0f838f119 100644 --- a/x/proof/keeper/msg_server_submit_proof_test.go +++ b/x/proof/keeper/msg_server_submit_proof_test.go @@ -26,7 +26,7 @@ import ( "github.com/pokt-network/poktroll/testutil/testkeyring" "github.com/pokt-network/poktroll/testutil/testrelayer" "github.com/pokt-network/poktroll/x/proof/keeper" - "github.com/pokt-network/poktroll/x/proof/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" "github.com/pokt-network/poktroll/x/shared" @@ -46,7 +46,7 @@ var ( // testProofParams sets: // - the minimum relay difficulty bits to zero so that these tests don't need to mine for valid relays. // - the proof request probability to 1 so that all test sessions require a proof. - testProofParams = types.Params{ + testProofParams = prooftypes.Params{ MinRelayDifficultyBits: 0, ProofRequestProbability: 1, } @@ -132,9 +132,9 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { // Prepare a ring client to sign & validate relays. ringClient, err := rings.NewRingClient(depinject.Supply( polyzero.NewLogger(), - types.NewAppKeeperQueryClient(keepers.ApplicationKeeper), - types.NewAccountKeeperQueryClient(keepers.AccountKeeper), - types.NewSharedKeeperQueryClient(keepers.SharedKeeper), + prooftypes.NewAppKeeperQueryClient(keepers.ApplicationKeeper), + prooftypes.NewAccountKeeperQueryClient(keepers.AccountKeeper), + prooftypes.NewSharedKeeperQueryClient(keepers.SharedKeeper), )) require.NoError(t, err) @@ -184,7 +184,7 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { require.NoError(t, err) require.NotNil(t, submitProofRes) - proofRes, err := keepers.AllProofs(ctx, &types.QueryAllProofsRequest{}) + proofRes, err := keepers.AllProofs(ctx, &prooftypes.QueryAllProofsRequest{}) require.NoError(t, err) proofs := proofRes.GetProofs() @@ -261,9 +261,9 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { // Prepare a ring client to sign & validate relays. ringClient, err := rings.NewRingClient(depinject.Supply( polyzero.NewLogger(), - types.NewAppKeeperQueryClient(keepers.ApplicationKeeper), - types.NewAccountKeeperQueryClient(keepers.AccountKeeper), - types.NewSharedKeeperQueryClient(keepers.SharedKeeper), + prooftypes.NewAppKeeperQueryClient(keepers.ApplicationKeeper), + prooftypes.NewAccountKeeperQueryClient(keepers.AccountKeeper), + prooftypes.NewSharedKeeperQueryClient(keepers.SharedKeeper), )) require.NoError(t, err) @@ -313,7 +313,7 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { proofMsgHeight: int64(proofWindowOpenHeight) - 1, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofProofOutsideOfWindow.Wrapf( + prooftypes.ErrProofProofOutsideOfWindow.Wrapf( "current block height (%d) is less than session proof window open height (%d)", int64(proofWindowOpenHeight)-1, proofWindowOpenHeight, @@ -325,7 +325,7 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { proofMsgHeight: int64(proofWindowCloseHeight) + 1, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofProofOutsideOfWindow.Wrapf( + prooftypes.ErrProofProofOutsideOfWindow.Wrapf( "current block height (%d) is greater than session proof window close height (%d)", int64(proofWindowCloseHeight)+1, proofWindowCloseHeight, @@ -350,7 +350,7 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { _, err := srv.SubmitProof(ctx, proofMsg) require.ErrorContains(t, err, test.expectedErr.Error()) - proofRes, err := keepers.AllProofs(ctx, &types.QueryAllProofsRequest{}) + proofRes, err := keepers.AllProofs(ctx, &prooftypes.QueryAllProofsRequest{}) require.NoError(t, err) proofs := proofRes.GetProofs() @@ -460,9 +460,9 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { // request signature. ringClient, err := rings.NewRingClient(depinject.Supply( polyzero.NewLogger(), - types.NewAppKeeperQueryClient(keepers.ApplicationKeeper), - types.NewAccountKeeperQueryClient(keepers.AccountKeeper), - types.NewSharedKeeperQueryClient(keepers.SharedKeeper), + prooftypes.NewAppKeeperQueryClient(keepers.ApplicationKeeper), + prooftypes.NewAccountKeeperQueryClient(keepers.AccountKeeper), + prooftypes.NewSharedKeeperQueryClient(keepers.SharedKeeper), )) require.NoError(t, err) @@ -547,12 +547,12 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { tests := []struct { desc string - newProofMsg func(t *testing.T) *types.MsgSubmitProof + newProofMsg func(t *testing.T) *prooftypes.MsgSubmitProof expectedErr error }{ { desc: "proof service ID cannot be empty", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Set proof session ID to empty string. emptySessionIdHeader := *validSessionHeader emptySessionIdHeader.SessionId = "" @@ -567,7 +567,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidSessionId.Wrapf( + prooftypes.ErrProofInvalidSessionId.Wrapf( "session ID does not match on-chain session ID; expected %q, got %q", validSessionHeader.GetSessionId(), "", @@ -576,7 +576,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "merkle proof cannot be empty", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct new proof message. proof := newTestProofMsg(t, supplierAddr, @@ -591,14 +591,14 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidProof.Wrap( + prooftypes.ErrProofInvalidProof.Wrap( "proof cannot be empty", ).Error(), ), }, { desc: "proof session ID must match on-chain session ID", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct new proof message using the wrong session ID. return newTestProofMsg(t, supplierAddr, @@ -609,7 +609,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidSessionId.Wrapf( + prooftypes.ErrProofInvalidSessionId.Wrapf( "session ID does not match on-chain session ID; expected %q, got %q", validSessionHeader.GetSessionId(), wrongSessionIdHeader.GetSessionId(), @@ -618,7 +618,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "proof supplier must be in on-chain session", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a proof message with a supplier that does not belong in the session. return newTestProofMsg(t, wrongSupplierAddr, @@ -629,7 +629,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofNotFound.Wrapf( + prooftypes.ErrProofNotFound.Wrapf( "supplier address %q not found in session ID %q", wrongSupplierAddr, validSessionHeader.GetSessionId(), @@ -638,7 +638,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "merkle proof must be deserializable", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct new proof message. proof := newTestProofMsg(t, supplierAddr, @@ -654,7 +654,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidProof.Wrapf( + prooftypes.ErrProofInvalidProof.Wrapf( "failed to unmarshal closest merkle proof: %s", expectedInvalidProofUnmarshalErr, ).Error(), @@ -662,7 +662,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay must be deserializable", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a session tree to which we'll add 1 unserializable relay. mangledRelaySessionTree := newEmptySessionTree(t, validSessionHeader, supplierAddr) @@ -698,7 +698,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidRelay.Wrapf( + prooftypes.ErrProofInvalidRelay.Wrapf( "failed to unmarshal relay: %s", keepers.Codec.Unmarshal(mangledRelayBz, &servicetypes.Relay{}), ).Error(), @@ -707,7 +707,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { { // TODO_TEST(community): expand: test case to cover each session header field. desc: "relay request session header must match proof session header", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a session tree with 1 relay with a session header containing // a session ID that doesn't match the proof session ID. numRelays := uint(1) @@ -748,7 +748,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidRelay.Wrapf( + prooftypes.ErrProofInvalidRelay.Wrapf( "session headers session IDs mismatch; expected: %q, got: %q", validSessionHeader.GetSessionId(), wrongSessionIdHeader.GetSessionId(), @@ -758,7 +758,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { { // TODO_TEST: expand: test case to cover each session header field. desc: "relay response session header must match proof session header", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a session tree with 1 relay with a session header containing // a session ID that doesn't match the expected session ID. numRelays := uint(1) @@ -799,7 +799,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidRelay.Wrapf( + prooftypes.ErrProofInvalidRelay.Wrapf( "session headers session IDs mismatch; expected: %q, got: %q", validSessionHeader.GetSessionId(), wrongSessionIdHeader.GetSessionId(), @@ -808,7 +808,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay request signature must be valid", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Set the relay request signature to an invalid byte slice. invalidRequestSignatureRelay := testrelayer.NewEmptyRelay(validSessionHeader, validSessionHeader, supplierAddr) invalidRequestSignatureRelay.Req.Meta.Signature = invalidSignatureBz @@ -855,7 +855,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidRelayRequest.Wrapf( + prooftypes.ErrProofInvalidRelayRequest.Wrapf( "error deserializing ring signature: %s", new(ring.RingSig).Deserialize(ring_secp256k1.NewCurve(), invalidSignatureBz), ).Error(), @@ -863,14 +863,14 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay request signature is valid but signed by an incorrect application", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("TODO_TECHDEBT(@bryanchriswhite): Implement this") return nil }, }, { desc: "relay response signature must be valid", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Set the relay response signature to an invalid byte slice. relay := testrelayer.NewEmptyRelay(validSessionHeader, validSessionHeader, supplierAddr) relay.Res.Meta.SupplierSignature = invalidSignatureBz @@ -922,14 +922,14 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay response signature is valid but signed by an incorrect supplier", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("TODO_TECHDEBT(@bryanchriswhite): Implement this") return nil }, }, { desc: "the merkle proof path provided does not match the one expected/enforced by the protocol", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a new valid session tree for this test case because once the // closest proof has already been generated, the path cannot be changed. numRelays := uint(5) @@ -963,7 +963,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidProof.Wrapf( + prooftypes.ErrProofInvalidProof.Wrapf( "the proof for the path provided (%x) does not match one expected by the on-chain protocol (%x)", wrongClosestProofPath, blockHeaderHash, @@ -972,17 +972,17 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay difficulty must be greater than or equal to minimum (zero difficulty)", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Set the minimum relay difficulty to a non-zero value such that the relays // constructed by the test helpers have a negligable chance of being valid. - err := keepers.Keeper.SetParams(ctx, types.Params{ + err := keepers.Keeper.SetParams(ctx, prooftypes.Params{ MinRelayDifficultyBits: 10, }) require.NoError(t, err) // Reset the minimum relay difficulty to zero after this test case. t.Cleanup(func() { - err := keepers.Keeper.SetParams(ctx, types.DefaultParams()) + err := keepers.Keeper.SetParams(ctx, prooftypes.DefaultParams()) require.NoError(t, err) }) @@ -997,7 +997,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidRelay.Wrapf( + prooftypes.ErrProofInvalidRelay.Wrapf( "relay difficulty %d is less than the minimum difficulty %d", validClosestRelayDifficultyBits, 10, @@ -1006,14 +1006,14 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "relay difficulty must be greater than or equal to minimum (non-zero difficulty)", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("TODO_TECHDEBT(@bryanchriswhite): Implement this") return nil }, }, { // group: claim must exist for proof message desc: "claim must exist for proof message", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { // Construct a new session tree corresponding to the unclaimed session. numRelays := uint(5) unclaimedSessionTree := newFilledSessionTree( @@ -1041,7 +1041,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofClaimNotFound.Wrapf( + prooftypes.ErrProofClaimNotFound.Wrapf( "no claim found for session ID %q and supplier %q", unclaimedSessionHeader.GetSessionId(), wrongSupplierAddr, @@ -1050,7 +1050,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, { desc: "Valid proof cannot validate claim with an incorrect root", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { numRelays := uint(10) wrongMerkleRootSessionTree := newFilledSessionTree( ctx, t, @@ -1098,26 +1098,26 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, expectedErr: status.Error( codes.FailedPrecondition, - types.ErrProofInvalidProof.Wrap("invalid closest merkle proof").Error(), + prooftypes.ErrProofInvalidProof.Wrap("invalid closest merkle proof").Error(), ), }, { desc: "claim and proof application addresses must match", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("this test case reduces to either the 'claim must exist for proof message' or 'proof session ID must match on-chain session ID cases") return nil }, }, { desc: "claim and proof service IDs must match", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("this test case reduces to either the 'claim must exist for proof message' or 'proof session ID must match on-chain session ID cases") return nil }, }, { desc: "claim and proof supplier addresses must match", - newProofMsg: func(t *testing.T) *types.MsgSubmitProof { + newProofMsg: func(t *testing.T) *prooftypes.MsgSubmitProof { t.Skip("this test case reduces to either the 'claim must exist for proof message' or 'proof session ID must match on-chain session ID cases") return nil }, @@ -1133,7 +1133,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { require.ErrorContains(t, err, test.expectedErr.Error()) require.Nil(t, submitProofRes) - proofRes, err := keepers.AllProofs(ctx, &types.QueryAllProofsRequest{}) + proofRes, err := keepers.AllProofs(ctx, &prooftypes.QueryAllProofsRequest{}) require.NoError(t, err) // Expect zero proofs to have been persisted as all test cases are error cases. @@ -1251,7 +1251,7 @@ func newTestProofMsg( sessionHeader *sessiontypes.SessionHeader, sessionTree relayer.SessionTree, closestProofPath []byte, -) *types.MsgSubmitProof { +) *prooftypes.MsgSubmitProof { t.Helper() // Generate a closest proof from the session tree using closestProofPath. @@ -1263,7 +1263,7 @@ func newTestProofMsg( merkleProofBz, err := merkleProof.Marshal() require.NoError(t, err) - return &types.MsgSubmitProof{ + return &prooftypes.MsgSubmitProof{ SupplierAddress: supplierAddr, SessionHeader: sessionHeader, Proof: merkleProofBz, @@ -1282,7 +1282,7 @@ func createClaimAndStoreBlockHash( service *sharedtypes.Service, sessionTree relayer.SessionTree, sessionHeader *sessiontypes.SessionHeader, - msgServer types.MsgServer, + msgServer prooftypes.MsgServer, keepers *keepertest.ProofModuleKeepers, ) *prooftypes.Claim { merkleRootBz, err := sessionTree.Flush() From 00ccddcdf43066aeef19fdd9ed16b51b4502e590 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 09:03:27 +0200 Subject: [PATCH 09/15] test: add E2E steps to assert for events in session scenario --- e2e/tests/session.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature index 547e74634..8fb0c4059 100644 --- a/e2e/tests/session.feature +++ b/e2e/tests/session.feature @@ -3,10 +3,10 @@ Feature: Session Namespace Scenario: Supplier completes claim/proof lifecycle for a valid session Given the user has the pocketd binary installed When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1" -# And the user should wait for the "proof" module "CreateClaim" Message to be submitted + And the user should wait for the "proof" module "CreateClaim" Message to be submitted And the user should wait for the "proof" module "ClaimCreated" tx event to be broadcast Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain -# And the user should wait for the "proof" module "SubmitProof" Message to be submitted + And the user should wait for the "proof" module "SubmitProof" Message to be submitted And the user should wait for the "proof" module "ProofSubmitted" tx event to be broadcast Then the claim created by supplier "supplier1" for service "anvil" for application "app1" should be successfully settled From d48e73ebb22033206727dd4a7274586433955c82 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 13:56:53 +0200 Subject: [PATCH 10/15] chore: self-review improvements --- e2e/tests/session_steps_test.go | 12 +++++------- x/proof/keeper/msg_server_create_claim.go | 24 ++++++++++++++++------- x/proof/keeper/msg_server_submit_proof.go | 24 ++++++++++++++++------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 0050fe210..97f60a28f 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -184,15 +184,13 @@ func (s *suite) sendRelaysForSession( } // waitForTxResultEvent waits for an event to be observed which has the given message action. -// func (s *suite) waitForTxResultEvent(targetAction string) { -// func (s *suite) waitForTxResultEvent(waitForEvent waitForEachTxEventFn) { func (s *suite) waitForTxResultEvent(eventIsMatch func(*abci.Event) bool) { - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(s.ctx) // For each observed event, **asynchronously** check if it contains the given action. channel.ForEach[*abci.TxResult]( ctx, s.txResultReplayClient.EventsSequence(ctx), - func(ctx context.Context, txResult *abci.TxResult) { + func(_ context.Context, txResult *abci.TxResult) { if txResult == nil { return } @@ -222,7 +220,7 @@ func (s *suite) waitForTxResultEvent(eventIsMatch func(*abci.Event) bool) { func (s *suite) waitForNewBlockEvent( isEventMatchFn func(*abci.Event) bool, ) { - ctx, done := context.WithCancel(context.Background()) + ctx, done := context.WithCancel(s.ctx) // For each observed event, **asynchronously** check if it contains the given action. channel.ForEach[*block.CometNewBlockEvent]( @@ -257,7 +255,7 @@ func (s *suite) waitForNewBlockEvent( // field. The type URL is constructed from the given module and eventType arguments // where module is the module name and eventType is the protobuf message type name // without the "Event" prefix; e.g., pass "tokenomics" and "ClaimSettled" to match -// the poktroll.tokenomics.EventClaimSettled event. +// the "poktroll.tokenomics.EventClaimSettled" event. func newEventTypeMatchFn(module, eventType string) func(*abci.Event) bool { targetEventType := fmt.Sprintf("poktroll.%s.Event%s", module, eventType) return func(event *abci.Event) bool { @@ -277,7 +275,7 @@ func newEventTypeMatchFn(module, eventType string) func(*abci.Event) bool { // type URL of the message to which a given event corresponds. The target action // is constructed from the given module and msgType arguments where module is the // module name and msgType is the protobuf message type name without the "Msg" prefix; -// e.g., pass "proof" and "CreateClaim" to match the poktroll.proof.MsgCreateClaim. +// e.g., pass "proof" and "CreateClaim" to match the "poktroll.proof.MsgCreateClaim" message. func newEventMsgTypeMatchFn(module, msgType string) func(event *abci.Event) bool { targetMsgType := fmt.Sprintf("/poktroll.%s.Msg%s", module, msgType) return func(event *abci.Event) bool { diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index 375779262..69a75b3f1 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "errors" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/gogoproto/proto" @@ -97,13 +98,20 @@ func (k msgServer) CreateClaim( logger.Info("created new claim") - // NB: Don't return these error, it should not prevent the MsgCreateClaimResopnse - // from being returned. Instead, it will be attached as an "error" label to any - // metrics tracked in this function. + // NB: Don't return these errors, it should not prevent the MsgCreateProofResopnse + // from being returned. Instead, they will be joined and attached as an "error" label + // to any metrics tracked in this function. // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new claim might have been inserted. - numRelays, err = claim.GetNumRelays() - numComputeUnits, err = claim.GetNumComputeUnits() + // any counters not to be incremented even though a new proof might have been inserted. + var tempError error + numRelays, tempError = claim.GetNumRelays() + if tempError != nil { + err = errors.Join(err, tempError) + } + numComputeUnits, tempError = claim.GetNumComputeUnits() + if tempError != nil { + err = errors.Join(err, tempError) + } // Emit the appropriate event based on whether the claim was created or updated. var claimUpsertEvent proto.Message @@ -127,12 +135,14 @@ func (k msgServer) CreateClaim( } sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + emitEventErr := sdkCtx.EventManager().EmitTypedEvent(claimUpsertEvent) + // NB: Don't return this error, it should not prevent the MsgCreateClaimResopnse // from being returned. Instead, it will be attached as an "error" label to any // metrics tracked in this function. // TODO_IMPROVE: While this will surface the error in metrics, it will also cause // any counters not to be incremented even though a new claim might have been inserted. - err = sdkCtx.EventManager().EmitTypedEvent(claimUpsertEvent) + err = errors.Join(err, emitEventErr) // TODO_BETA: return the claim in the response. return &types.MsgCreateClaimResponse{}, nil diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index d77b2a998..a4f8f86db 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -8,6 +8,7 @@ import ( "bytes" "context" "crypto/sha256" + "errors" "fmt" "hash" @@ -274,13 +275,20 @@ func (k msgServer) SubmitProof( k.UpsertProof(ctx, proof) logger.Info("successfully upserted the proof") - // NB: Don't return these error, it should not prevent the MsgCreateClaimResopnse - // from being returned. Instead, it will be attached as an "error" label to any - // metrics tracked in this function. + // NB: Don't return these errors, it should not prevent the MsgCreateProofResopnse + // from being returned. Instead, they will be joined and attached as an "error" label + // to any metrics tracked in this function. // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new claim might have been inserted. - numRelays, err = claim.GetNumRelays() - numComputeUnits, err = claim.GetNumComputeUnits() + // any counters not to be incremented even though a new proof might have been inserted. + var tempErr error + numRelays, tempErr = claim.GetNumRelays() + if tempErr != nil { + err = errors.Join(err, tempErr) + } + numComputeUnits, tempErr = claim.GetNumComputeUnits() + if tempErr != nil { + err = errors.Join(err, tempErr) + } // Emit the appropriate event based on whether the claim was created or updated. var proofUpsertEvent proto.Message @@ -304,12 +312,14 @@ func (k msgServer) SubmitProof( } sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + emitEventErr := sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent) + // NB: Don't return this error, it should not prevent the MsgCreateProofResopnse // from being returned. Instead, it will be attached as an "error" label to any // metrics tracked in this function. // TODO_IMPROVE: While this will surface the error in metrics, it will also cause // any counters not to be incremented even though a new proof might have been inserted. - err = sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent) + err = errors.Join(err, emitEventErr) return &types.MsgSubmitProofResponse{}, nil } From 4dc858c32d3823a949f18b5d6c762efc818b1e26 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 27 Jun 2024 21:37:24 +0200 Subject: [PATCH 11/15] fix: failing tests --- .../integration/tokenomics/relay_mining_difficulty_test.go | 6 +++--- x/tokenomics/keeper/keeper_settle_pending_claims_test.go | 6 +++--- x/tokenomics/keeper/proof_requirement_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/integration/tokenomics/relay_mining_difficulty_test.go b/tests/integration/tokenomics/relay_mining_difficulty_test.go index af0b9a9b7..a96f9f6f2 100644 --- a/tests/integration/tokenomics/relay_mining_difficulty_test.go +++ b/tests/integration/tokenomics/relay_mining_difficulty_test.go @@ -11,7 +11,7 @@ import ( "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" testutilevents "github.com/pokt-network/poktroll/testutil/events" - integration "github.com/pokt-network/poktroll/testutil/integration" + "github.com/pokt-network/poktroll/testutil/integration" testutil "github.com/pokt-network/poktroll/testutil/integration" "github.com/pokt-network/poktroll/testutil/testrelayer" prooftypes "github.com/pokt-network/poktroll/x/proof/types" @@ -96,10 +96,10 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) // The number 14 was determined empirically by running the tests and will need // to be updated if they are changed. - expectedNumEvents := 14 + expectedNumEvents := 15 // Check the number of events is consistent. events := integrationApp.GetSdkCtx().EventManager().Events() - require.Len(t, events, expectedNumEvents, "unexpected number of total events") + require.Equalf(t, expectedNumEvents, len(events), "unexpected number of total events") relayMiningEvents := testutilevents.FilterEvents[*tokenomicstypes.EventRelayMiningDifficultyUpdated](t, events, "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index 4086d9bef..68e6fe851 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -244,7 +244,7 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide // Validate the event expectedEvent := expectedEvents[0] - require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.NotEqual(t, prooftypes.ProofRequirementReason_NOT_REQUIRED, expectedEvent.GetProofRequirement()) require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } @@ -301,7 +301,7 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi events, "poktroll.tokenomics.EventClaimSettled") require.Len(t, expectedEvents, 1) expectedEvent := expectedEvents[0] - require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.NotEqual(t, prooftypes.ProofRequirementReason_NOT_REQUIRED, expectedEvent.GetProofRequirement()) require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } @@ -356,7 +356,7 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { // Validate the event expectedEvent := expectedEvents[0] - require.NotEqual(t, prooftypes.ProofNotRequired, expectedEvent.GetProofRequirement()) + require.Equal(t, prooftypes.ProofRequirementReason_NOT_REQUIRED.String(), expectedEvent.GetProofRequirement().String()) require.Equal(t, s.expectedComputeUnits, expectedEvent.GetNumComputeUnits()) } diff --git a/x/tokenomics/keeper/proof_requirement_test.go b/x/tokenomics/keeper/proof_requirement_test.go index 7c6668237..19c3b7d7e 100644 --- a/x/tokenomics/keeper/proof_requirement_test.go +++ b/x/tokenomics/keeper/proof_requirement_test.go @@ -43,10 +43,10 @@ func TestKeeper_IsProofRequired(t *testing.T) { for i := int64(0); i < sampleSize; i++ { claim := tetsproof.ClaimWithRandomHash(t, sample.AccAddress(), sample.AccAddress(), expectedComputeUnits) - isRequired, err := keepers.Keeper.IsProofRequiredForClaim(sdkCtx, &claim) + proofRequirementReason, err := keepers.Keeper.ProofRequirementForClaim(sdkCtx, &claim) require.NoError(t, err) - if isRequired { + if proofRequirementReason != prooftypes.ProofRequirementReason_NOT_REQUIRED { numTrueSamples.Add(1) } } From a0896c37712d413f0721002e2a7344af3b0c628f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 28 Jun 2024 11:57:16 +0200 Subject: [PATCH 12/15] chore: proto_regen --- api/poktroll/tokenomics/event.pulsar.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 7da1fe30e..ca0ebfa25 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2,10 +2,10 @@ package tokenomics import ( + proof "github.com/pokt-network/poktroll/api/poktroll/proof" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" - proof "github.com/pokt-network/poktroll/api/poktroll/proof" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" From f381a61eb154b7b82f3bd1eb726955cc7f31752b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Sat, 29 Jun 2024 00:27:26 +0200 Subject: [PATCH 13/15] chore: reveiew feedback improvements --- x/proof/keeper/msg_server_submit_proof.go | 68 ++++++++------------ x/tokenomics/keeper/settle_pending_claims.go | 1 + 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index c2a7cb704..8df1c4011 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -8,10 +8,10 @@ import ( "bytes" "context" "crypto/sha256" - "errors" "fmt" "hash" + cosmoscryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/gogoproto/proto" "github.com/pokt-network/smt" @@ -123,19 +123,21 @@ func (k msgServer) SubmitProof( "supplier", supplierAddr) // Basic validation of the SubmitProof message. - if err := msg.ValidateBasic(); err != nil { + if err = msg.ValidateBasic(); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } logger.Info("validated the submitProof message ") // Retrieve the supplier's public key. - supplierPubKey, err := k.accountQuerier.GetPubKeyFromAddress(ctx, supplierAddr) + var supplierPubKey cosmoscryptotypes.PubKey + supplierPubKey, err = k.accountQuerier.GetPubKeyFromAddress(ctx, supplierAddr) if err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } // Validate the session header. - onChainSession, err := k.queryAndValidateSessionHeader(ctx, msg) + var onChainSession *sessiontypes.Session + onChainSession, err = k.queryAndValidateSessionHeader(ctx, msg) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -148,13 +150,13 @@ func (k msgServer) SubmitProof( // Validate proof message commit height is within the respective session's // proof submission window using the on-chain session header. - if err := k.validateProofWindow(ctx, msg); err != nil { + if err = k.validateProofWindow(ctx, msg); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } // Unmarshal the closest merkle proof from the message. sparseMerkleClosestProof := &smt.SparseMerkleClosestProof{} - if err := sparseMerkleClosestProof.Unmarshal(msg.GetProof()); err != nil { + if err = sparseMerkleClosestProof.Unmarshal(msg.GetProof()); err != nil { return nil, status.Error(codes.InvalidArgument, types.ErrProofInvalidProof.Wrapf( "failed to unmarshal closest merkle proof: %s", @@ -168,7 +170,7 @@ func (k msgServer) SubmitProof( // Get the relay request and response from the proof.GetClosestMerkleProof. relayBz := sparseMerkleClosestProof.GetValueHash(&SmtSpec) relay := &servicetypes.Relay{} - if err := k.cdc.Unmarshal(relayBz, relay); err != nil { + if err = k.cdc.Unmarshal(relayBz, relay); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrProofInvalidRelay.Wrapf( @@ -180,7 +182,7 @@ func (k msgServer) SubmitProof( // Basic validation of the relay request. relayReq := relay.GetReq() - if err := relayReq.ValidateBasic(); err != nil { + if err = relayReq.ValidateBasic(); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully validated relay request") @@ -193,32 +195,32 @@ func (k msgServer) SubmitProof( // Basic validation of the relay response. relayRes := relay.GetRes() - if err := relayRes.ValidateBasic(); err != nil { + if err = relayRes.ValidateBasic(); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully validated relay response") // Verify that the relay request session header matches the proof session header. - if err := compareSessionHeaders(msg.GetSessionHeader(), relayReq.Meta.GetSessionHeader()); err != nil { + if err = compareSessionHeaders(msg.GetSessionHeader(), relayReq.Meta.GetSessionHeader()); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully compared relay request session header") // Verify that the relay response session header matches the proof session header. - if err := compareSessionHeaders(msg.GetSessionHeader(), relayRes.Meta.GetSessionHeader()); err != nil { + if err = compareSessionHeaders(msg.GetSessionHeader(), relayRes.Meta.GetSessionHeader()); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully compared relay response session header") // Verify the relay request's signature. // TODO_BLOCKER(@red-0ne): Fetch the correct ring for the session this relay is from. - if err := k.ringClient.VerifyRelayRequestSignature(ctx, relayReq); err != nil { + if err = k.ringClient.VerifyRelayRequestSignature(ctx, relayReq); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully verified relay request signature") // Verify the relay response's signature. - if err := relayRes.VerifySupplierSignature(supplierPubKey); err != nil { + if err = relayRes.VerifySupplierSignature(supplierPubKey); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully verified relay response signature") @@ -227,14 +229,14 @@ func (k msgServer) SubmitProof( params := k.GetParams(ctx) // Verify the relay difficulty is above the minimum required to earn rewards. - if err := validateMiningDifficulty(relayBz, params.MinRelayDifficultyBits); err != nil { + if err = validateMiningDifficulty(relayBz, params.MinRelayDifficultyBits); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully validated relay mining difficulty") // Validate that path the proof is submitted for matches the expected one // based on the pseudo-random on-chain data associated with the header. - if err := k.validateClosestPath( + if err = k.validateClosestPath( ctx, sparseMerkleClosestProof, msg.GetSessionHeader(), @@ -245,7 +247,7 @@ func (k msgServer) SubmitProof( logger.Debug("successfully validated proof path") // Verify the relay's difficulty. - if err := validateMiningDifficulty(relayBz, params.MinRelayDifficultyBits); err != nil { + if err = validateMiningDifficulty(relayBz, params.MinRelayDifficultyBits); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } @@ -259,7 +261,7 @@ func (k msgServer) SubmitProof( logger.Debug("successfully retrieved and validated claim") // Verify the proof's closest merkle proof. - if err := verifyClosestProof(sparseMerkleClosestProof, claim.GetRootHash()); err != nil { + if err = verifyClosestProof(sparseMerkleClosestProof, claim.GetRootHash()); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } logger.Debug("successfully verified closest merkle proof") @@ -274,25 +276,16 @@ func (k msgServer) SubmitProof( _, isExistingProof = k.GetProof(ctx, proof.GetSessionHeader().GetSessionId(), proof.GetSupplierAddress()) - // TODO_BLOCKER(@Olshansk): check if this proof already exists and return an - // appropriate error in any case where the supplier should no longer be able - // to update the given proof. k.UpsertProof(ctx, proof) logger.Info("successfully upserted the proof") - // NB: Don't return these errors, it should not prevent the MsgCreateProofResopnse - // from being returned. Instead, they will be joined and attached as an "error" label - // to any metrics tracked in this function. - // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new proof might have been inserted. - var tempErr error - numRelays, tempErr = claim.GetNumRelays() - if tempErr != nil { - err = errors.Join(err, tempErr) + numRelays, err = claim.GetNumRelays() + if err != nil { + return nil, err } - numComputeUnits, tempErr = claim.GetNumComputeUnits() - if tempErr != nil { - err = errors.Join(err, tempErr) + numComputeUnits, err = claim.GetNumComputeUnits() + if err != nil { + return nil, err } // Emit the appropriate event based on whether the claim was created or updated. @@ -317,14 +310,9 @@ func (k msgServer) SubmitProof( } sdkCtx := cosmostypes.UnwrapSDKContext(ctx) - emitEventErr := sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent) - - // NB: Don't return this error, it should not prevent the MsgCreateProofResopnse - // from being returned. Instead, it will be attached as an "error" label to any - // metrics tracked in this function. - // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new proof might have been inserted. - err = errors.Join(err, emitEventErr) + if err = sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent); err != nil { + return nil, err + } return &types.MsgSubmitProofResponse{}, nil } diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index c6c64f767..af5304030 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -108,6 +108,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( claimSettledEvent := types.EventClaimSettled{ Claim: &claim, + NumRelays: numRelaysInSessionTree, NumComputeUnits: numClaimComputeUnits, ProofRequirement: proofRequirement, } From a4d3061900e0e2485522b5f24584eb20a277b690 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Sat, 29 Jun 2024 00:47:50 +0200 Subject: [PATCH 14/15] chore: review improvements --- x/proof/keeper/msg_server_create_claim.go | 50 ++++++++++---------- x/proof/keeper/msg_server_submit_proof.go | 20 ++++++-- x/shared/types/errors.go | 1 + x/tokenomics/keeper/settle_pending_claims.go | 34 ++++++++----- 4 files changed, 63 insertions(+), 42 deletions(-) diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index 69158c81c..da52a5f1e 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "errors" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/gogoproto/proto" @@ -11,6 +10,8 @@ import ( "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) func (k msgServer) CreateClaim( @@ -42,12 +43,13 @@ func (k msgServer) CreateClaim( logger := k.Logger().With("method", "CreateClaim") logger.Info("creating claim") - if err := msg.ValidateBasic(); err != nil { + if err = msg.ValidateBasic(); err != nil { return nil, err } // Compare msg session header w/ on-chain session header. - session, err := k.queryAndValidateSessionHeader(ctx, msg) + var session *sessiontypes.Session + session, err = k.queryAndValidateSessionHeader(ctx, msg) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -60,7 +62,7 @@ func (k msgServer) CreateClaim( // Validate claim message commit height is within the respective session's // claim creation window using the on-chain session header. - if err := k.validateClaimWindow(ctx, msg); err != nil { + if err = k.validateClaimWindow(ctx, msg); err != nil { return nil, status.Error(codes.FailedPrecondition, err.Error()) } @@ -86,19 +88,13 @@ func (k msgServer) CreateClaim( logger.Info("created new claim") - // NB: Don't return these errors, it should not prevent the MsgCreateProofResopnse - // from being returned. Instead, they will be joined and attached as an "error" label - // to any metrics tracked in this function. - // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new proof might have been inserted. - var tempError error - numRelays, tempError = claim.GetNumRelays() - if tempError != nil { - err = errors.Join(err, tempError) + numRelays, err = claim.GetNumRelays() + if err != nil { + return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } - numComputeUnits, tempError = claim.GetNumComputeUnits() - if tempError != nil { - err = errors.Join(err, tempError) + numComputeUnits, err = claim.GetNumComputeUnits() + if err != nil { + return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } // Emit the appropriate event based on whether the claim was created or updated. @@ -123,15 +119,19 @@ func (k msgServer) CreateClaim( } sdkCtx := cosmostypes.UnwrapSDKContext(ctx) - emitEventErr := sdkCtx.EventManager().EmitTypedEvent(claimUpsertEvent) - - // NB: Don't return this error, it should not prevent the MsgCreateClaimResopnse - // from being returned. Instead, it will be attached as an "error" label to any - // metrics tracked in this function. - // TODO_IMPROVE: While this will surface the error in metrics, it will also cause - // any counters not to be incremented even though a new claim might have been inserted. - err = errors.Join(err, emitEventErr) + if err = sdkCtx.EventManager().EmitTypedEvent(claimUpsertEvent); err != nil { + return nil, status.Error( + codes.Internal, + sharedtypes.ErrSharedEmitEvent.Wrapf( + "failed to emit event type %T: %v", + claimUpsertEvent, + err, + ).Error(), + ) + } // TODO_BETA: return the claim in the response. - return &types.MsgCreateClaimResponse{}, nil + return &types.MsgCreateClaimResponse{ + Claim: &claim, + }, nil } diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index 8df1c4011..465aa9da7 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -23,6 +23,7 @@ import ( "github.com/pokt-network/poktroll/x/proof/types" servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) // SMT specification used for the proof verification. @@ -281,11 +282,11 @@ func (k msgServer) SubmitProof( numRelays, err = claim.GetNumRelays() if err != nil { - return nil, err + return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } numComputeUnits, err = claim.GetNumComputeUnits() if err != nil { - return nil, err + return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } // Emit the appropriate event based on whether the claim was created or updated. @@ -294,6 +295,7 @@ func (k msgServer) SubmitProof( case true: proofUpsertEvent = proto.Message( &types.EventProofUpdated{ + Claim: claim, Proof: &proof, NumRelays: numRelays, NumComputeUnits: numComputeUnits, @@ -302,6 +304,7 @@ func (k msgServer) SubmitProof( case false: proofUpsertEvent = proto.Message( &types.EventProofSubmitted{ + Claim: claim, Proof: &proof, NumRelays: numRelays, NumComputeUnits: numComputeUnits, @@ -311,10 +314,19 @@ func (k msgServer) SubmitProof( sdkCtx := cosmostypes.UnwrapSDKContext(ctx) if err = sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent); err != nil { - return nil, err + return nil, status.Error( + codes.Internal, + sharedtypes.ErrSharedEmitEvent.Wrapf( + "failed to emit event type %T: %v", + proofUpsertEvent, + err, + ).Error(), + ) } - return &types.MsgSubmitProofResponse{}, nil + return &types.MsgSubmitProofResponse{ + Proof: &proof, + }, nil } // queryAndValidateClaimForProof ensures that a claim corresponding to the given diff --git a/x/shared/types/errors.go b/x/shared/types/errors.go index 5d56db228..df55eb100 100644 --- a/x/shared/types/errors.go +++ b/x/shared/types/errors.go @@ -12,4 +12,5 @@ var ( ErrSharedInvalidAddress = sdkerrors.Register(ModuleName, 1101, "invalid address") ErrSharedParamNameInvalid = sdkerrors.Register(ModuleName, 1102, "the provided param name is invalid") ErrSharedParamInvalid = sdkerrors.Register(ModuleName, 1103, "the provided param is invalid") + ErrSharedEmitEvent = sdkerrors.Register(ModuleName, 1104, "failed to emit event") ) diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index af5304030..74f0103de 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -41,17 +41,22 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( logger.Debug("settling expiring claims") for _, claim := range expiringClaims { + var ( + numClaimComputeUnits uint64 + numRelaysInSessionTree uint64 + proofRequirement prooftypes.ProofRequirementReason + ) // NB: Note that not every (Req, Res) pair in the session is inserted in // the tree for scalability reasons. This is the count of non-empty leaves // that matched the necessary difficulty and is therefore an estimation // of the total number of relays serviced and work done. - numClaimComputeUnits, err := claim.GetNumComputeUnits() + numClaimComputeUnits, err = claim.GetNumComputeUnits() if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } - numRelaysInSessionTree, err := claim.GetNumRelays() + numRelaysInSessionTree, err = claim.GetNumRelays() if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } @@ -61,7 +66,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( _, isProofFound := k.proofKeeper.GetProof(ctx, sessionId, claim.SupplierAddress) // Using the probabilistic proofs approach, determine if this expiring // claim required an on-chain proof - proofRequirement, err := k.proofRequirementForClaim(ctx, &claim) + proofRequirement, err = k.proofRequirementForClaim(ctx, &claim) if err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } @@ -83,7 +88,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( NumComputeUnits: numClaimComputeUnits, NumRelays: numRelaysInSessionTree, } - if err := ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { + if err = ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } @@ -101,7 +106,7 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } // Manage the mint & burn accounting for the claim. - if err := k.SettleSessionAccounting(ctx, &claim); err != nil { + if err = k.SettleSessionAccounting(ctx, &claim); err != nil { logger.Error(fmt.Sprintf("error settling session accounting for claim %q: %v", claim.SessionHeader.SessionId, err)) return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } @@ -113,11 +118,11 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( ProofRequirement: proofRequirement, } - if err := ctx.EventManager().EmitTypedEvent(&claimSettledEvent); err != nil { + if err = ctx.EventManager().EmitTypedEvent(&claimSettledEvent); err != nil { return 0, 0, relaysPerServiceMap, computeUnitsPerServiceMap, err } - if err := ctx.EventManager().EmitTypedEvent(&prooftypes.EventProofUpdated{ + if err = ctx.EventManager().EmitTypedEvent(&prooftypes.EventProofUpdated{ Claim: &claim, Proof: nil, NumRelays: 0, @@ -192,7 +197,8 @@ func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Clai // NB: Assumption that claim is non-nil and has a valid root sum because it // is retrieved from the store and validated, on-chain, at time of creation. - claimComputeUnits, err := claim.GetNumComputeUnits() + var numClaimComputeUnits uint64 + numClaimComputeUnits, err = claim.GetNumComputeUnits() if err != nil { return requirementReason, err } @@ -208,25 +214,27 @@ func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Clai // TODO_IMPROVE(@bryanchriswhite, @red-0ne): It might make sense to include // whether there was a proof submission error downstream from here. This would // require a more comprehensive metrics API. - if claimComputeUnits >= proofParams.GetProofRequirementThreshold() { + if numClaimComputeUnits >= proofParams.GetProofRequirementThreshold() { requirementReason = prooftypes.ProofRequirementReason_THRESHOLD logger.Info(fmt.Sprintf( "claim requires proof due to compute units (%d) exceeding threshold (%d)", - claimComputeUnits, + numClaimComputeUnits, proofParams.GetProofRequirementThreshold(), )) return requirementReason, nil } // Get the hash of the claim to seed the random number generator. - claimHash, err := claim.GetHash() + var claimHash []byte + claimHash, err = claim.GetHash() if err != nil { return requirementReason, err } // Sample a pseudo-random value between 0 and 1 to determine if a proof is required probabilistically. - randFloat, err := poktrand.SeededFloat32(claimHash[:]) + var randFloat float32 + randFloat, err = poktrand.SeededFloat32(claimHash[:]) if err != nil { return requirementReason, err } @@ -247,7 +255,7 @@ func (k Keeper) proofRequirementForClaim(ctx sdk.Context, claim *prooftypes.Clai logger.Info(fmt.Sprintf( "claim does not require proof due to compute units (%d) being less than the threshold (%d) and random sample (%.2f) being greater than probability (%.2f)", - claimComputeUnits, + numClaimComputeUnits, proofParams.GetProofRequirementThreshold(), randFloat, proofParams.GetProofRequestProbability(), From 26c3b22a2dc048953abb7a1a78a94b74af8c8f73 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Sat, 29 Jun 2024 13:43:59 +0200 Subject: [PATCH 15/15] chore: review feedback improvements --- e2e/tests/session_steps_test.go | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 97f60a28f..0a07c6340 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -278,36 +278,27 @@ func newEventTypeMatchFn(module, eventType string) func(*abci.Event) bool { // e.g., pass "proof" and "CreateClaim" to match the "poktroll.proof.MsgCreateClaim" message. func newEventMsgTypeMatchFn(module, msgType string) func(event *abci.Event) bool { targetMsgType := fmt.Sprintf("/poktroll.%s.Msg%s", module, msgType) - return func(event *abci.Event) bool { - if event == nil { - return false - } - - for _, attribute := range event.Attributes { - if attribute.Key == "action" { - if attribute.Value == targetMsgType { - return true - } - } - } - return false - } + return newEventAttributeMatchFn("action", targetMsgType) } // newEventModeMatchFn returns a function that matches an event based on the // "mode" attribute in its attributes field. The target mode value is the given // mode string. func newEventModeMatchFn(mode string) func(event *abci.Event) bool { + return newEventAttributeMatchFn("mode", mode) +} + +// newEventAttributeMatchFn returns a function that matches an event based on the +// presence of an attribute with the given key and value. +func newEventAttributeMatchFn(key, value string) func(event *abci.Event) bool { return func(event *abci.Event) bool { if event == nil { return false } for _, attribute := range event.Attributes { - if attribute.Key == "mode" { - if attribute.Value == mode { - return true - } + if attribute.Key == key && attribute.Value == value { + return true } } return false