From 6738d21137937f4eb2e23bb6d2a3c0496acc04ec Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 15 Aug 2024 21:39:08 -0400 Subject: [PATCH 01/48] WIP --- api/poktroll/tokenomics/event.pulsar.go | 800 +++++++++++++++++++-- proto/poktroll/tokenomics/event.proto | 11 +- x/tokenomics/keeper/token_logic_modules.go | 159 +++- x/tokenomics/types/errors.go | 53 +- x/tokenomics/types/event.pb.go | 428 +++++++++-- x/tokenomics/types/tx.pb.go | 1 - 6 files changed, 1300 insertions(+), 152 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 300c5cb18..ae7a1d67b 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2395,6 +2395,633 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface } } +var ( + md_EventApplicationReimbursementRequest protoreflect.MessageDescriptor + fd_EventApplicationReimbursementRequest_application_addr protoreflect.FieldDescriptor + fd_EventApplicationReimbursementRequest_service_id protoreflect.FieldDescriptor + fd_EventApplicationReimbursementRequest_session_id protoreflect.FieldDescriptor + fd_EventApplicationReimbursementRequest_amount protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_event_proto_init() + md_EventApplicationReimbursementRequest = File_poktroll_tokenomics_event_proto.Messages().ByName("EventApplicationReimbursementRequest") + fd_EventApplicationReimbursementRequest_application_addr = md_EventApplicationReimbursementRequest.Fields().ByName("application_addr") + fd_EventApplicationReimbursementRequest_service_id = md_EventApplicationReimbursementRequest.Fields().ByName("service_id") + fd_EventApplicationReimbursementRequest_session_id = md_EventApplicationReimbursementRequest.Fields().ByName("session_id") + fd_EventApplicationReimbursementRequest_amount = md_EventApplicationReimbursementRequest.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_EventApplicationReimbursementRequest)(nil) + +type fastReflection_EventApplicationReimbursementRequest EventApplicationReimbursementRequest + +func (x *EventApplicationReimbursementRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventApplicationReimbursementRequest)(x) +} + +func (x *EventApplicationReimbursementRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventApplicationReimbursementRequest_messageType fastReflection_EventApplicationReimbursementRequest_messageType +var _ protoreflect.MessageType = fastReflection_EventApplicationReimbursementRequest_messageType{} + +type fastReflection_EventApplicationReimbursementRequest_messageType struct{} + +func (x fastReflection_EventApplicationReimbursementRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventApplicationReimbursementRequest)(nil) +} +func (x fastReflection_EventApplicationReimbursementRequest_messageType) New() protoreflect.Message { + return new(fastReflection_EventApplicationReimbursementRequest) +} +func (x fastReflection_EventApplicationReimbursementRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventApplicationReimbursementRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventApplicationReimbursementRequest) Descriptor() protoreflect.MessageDescriptor { + return md_EventApplicationReimbursementRequest +} + +// 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_EventApplicationReimbursementRequest) Type() protoreflect.MessageType { + return _fastReflection_EventApplicationReimbursementRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventApplicationReimbursementRequest) New() protoreflect.Message { + return new(fastReflection_EventApplicationReimbursementRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventApplicationReimbursementRequest) Interface() protoreflect.ProtoMessage { + return (*EventApplicationReimbursementRequest)(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_EventApplicationReimbursementRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ApplicationAddr != "" { + value := protoreflect.ValueOfString(x.ApplicationAddr) + if !f(fd_EventApplicationReimbursementRequest_application_addr, value) { + return + } + } + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_EventApplicationReimbursementRequest_service_id, value) { + return + } + } + if x.SessionId != "" { + value := protoreflect.ValueOfString(x.SessionId) + if !f(fd_EventApplicationReimbursementRequest_session_id, value) { + return + } + } + if x.Amount != nil { + value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if !f(fd_EventApplicationReimbursementRequest_amount, 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_EventApplicationReimbursementRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + return x.ApplicationAddr != "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + return x.ServiceId != "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + return x.SessionId != "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + return x.Amount != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + x.ApplicationAddr = "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + x.ServiceId = "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + x.SessionId = "" + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + value := x.ApplicationAddr + return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + value := x.ServiceId + return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + value := x.SessionId + return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + value := x.Amount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + x.ApplicationAddr = value.Interface().(string) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + x.ServiceId = value.Interface().(string) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + x.SessionId = value.Interface().(string) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + x.Amount = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + if x.Amount == nil { + x.Amount = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + panic(fmt.Errorf("field application_addr of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + panic(fmt.Errorf("field service_id of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + panic(fmt.Errorf("field session_id of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": + return protoreflect.ValueOfString("") + case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": + return protoreflect.ValueOfString("") + case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": + return protoreflect.ValueOfString("") + case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.EventApplicationReimbursementRequest", 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventApplicationReimbursementRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ApplicationAddr) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ServiceId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.SessionId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Amount != nil { + l = options.Size(x.Amount) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventApplicationReimbursementRequest) + 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.Amount != nil { + encoded, err := options.Marshal(x.Amount) + 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] = 0x22 + } + if len(x.SessionId) > 0 { + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0x1a + } + if len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + i-- + dAtA[i] = 0x12 + } + if len(x.ApplicationAddr) > 0 { + i -= len(x.ApplicationAddr) + copy(dAtA[i:], x.ApplicationAddr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ApplicationAddr))) + 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().(*EventApplicationReimbursementRequest) + 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: EventApplicationReimbursementRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventApplicationReimbursementRequest: 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 ApplicationAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ApplicationAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount == nil { + x.Amount = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2703,16 +3330,77 @@ func (x *EventApplicationOverserviced) GetEffectiveBurn() *v1beta1.Coin { return nil } +// EventApplicationReimbursementRequest is emitted when an application requests a +// reimbursement +type EventApplicationReimbursementRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + ServiceId string `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Amount *v1beta1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *EventApplicationReimbursementRequest) Reset() { + *x = EventApplicationReimbursementRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventApplicationReimbursementRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventApplicationReimbursementRequest) ProtoMessage() {} + +// Deprecated: Use EventApplicationReimbursementRequest.ProtoReflect.Descriptor instead. +func (*EventApplicationReimbursementRequest) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{4} +} + +func (x *EventApplicationReimbursementRequest) GetApplicationAddr() string { + if x != nil { + return x.ApplicationAddr + } + return "" +} + +func (x *EventApplicationReimbursementRequest) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *EventApplicationReimbursementRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *EventApplicationReimbursementRequest) GetAmount() *v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + var File_poktroll_tokenomics_event_proto protoreflect.FileDescriptor 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 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, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, @@ -2785,25 +3473,37 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x75, 0x72, 0x6e, 0x18, 0x03, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x42, - 0x75, 0x72, 0x6e, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x1d, - 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, - 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, 0x56, 0x41, - 0x4c, 0x49, 0x44, 0x10, 0x02, 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, + 0x75, 0x72, 0x6e, 0x22, 0xc2, 0x01, 0x0a, 0x24, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x69, 0x6d, 0x62, 0x75, 0x72, 0x73, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x04, 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, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, + 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, + 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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 ( @@ -2819,29 +3519,31 @@ func file_poktroll_tokenomics_event_proto_rawDescGZIP() []byte { } var file_poktroll_tokenomics_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_poktroll_tokenomics_event_proto_goTypes = []interface{}{ - (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason - (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired - (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled - (*EventRelayMiningDifficultyUpdated)(nil), // 3: poktroll.tokenomics.EventRelayMiningDifficultyUpdated - (*EventApplicationOverserviced)(nil), // 4: poktroll.tokenomics.EventApplicationOverserviced - (*proof.Claim)(nil), // 5: poktroll.proof.Claim - (proof.ProofRequirementReason)(0), // 6: poktroll.proof.ProofRequirementReason - (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason + (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired + (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled + (*EventRelayMiningDifficultyUpdated)(nil), // 3: poktroll.tokenomics.EventRelayMiningDifficultyUpdated + (*EventApplicationOverserviced)(nil), // 4: poktroll.tokenomics.EventApplicationOverserviced + (*EventApplicationReimbursementRequest)(nil), // 5: poktroll.tokenomics.EventApplicationReimbursementRequest + (*proof.Claim)(nil), // 6: poktroll.proof.Claim + (proof.ProofRequirementReason)(0), // 7: poktroll.proof.ProofRequirementReason + (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin } var file_poktroll_tokenomics_event_proto_depIdxs = []int32{ - 5, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim + 6, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim 0, // 1: poktroll.tokenomics.EventClaimExpired.expiration_reason:type_name -> poktroll.tokenomics.ClaimExpirationReason - 5, // 2: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim - 6, // 3: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason - 7, // 4: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin - 7, // 5: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin - 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 + 6, // 2: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim + 7, // 3: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason + 8, // 4: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin + 8, // 5: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin + 8, // 6: poktroll.tokenomics.EventApplicationReimbursementRequest.amount:type_name -> cosmos.base.v1beta1.Coin + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] 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_tokenomics_event_proto_init() } @@ -2898,6 +3600,18 @@ func file_poktroll_tokenomics_event_proto_init() { return nil } } + file_poktroll_tokenomics_event_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventApplicationReimbursementRequest); 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{ @@ -2905,7 +3619,7 @@ func file_poktroll_tokenomics_event_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_tokenomics_event_proto_rawDesc, NumEnums: 1, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 780564496..76ef86e5c 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -3,8 +3,8 @@ package poktroll.tokenomics; option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; -import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; import "poktroll/proof/claim.proto"; import "poktroll/proof/requirement.proto"; @@ -51,3 +51,12 @@ message EventApplicationOverserviced { cosmos.base.v1beta1.Coin expected_burn = 2; cosmos.base.v1beta1.Coin effective_burn = 3; } + +// EventApplicationReimbursementRequest is emitted when an application requests a +// reimbursement +message EventApplicationReimbursementRequest { + string application_addr = 1; + string service_id = 2; + string session_id = 3; + cosmos.base.v1beta1.Coin amount = 4; +} diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 74e6d66c3..0190d78b3 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -19,6 +19,7 @@ import ( "github.com/pokt-network/poktroll/telemetry" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "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" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" @@ -26,29 +27,46 @@ import ( ) const ( + // Governance parameters for the TLMGlobalMint module + // TODO_UPNEXT(@olshansk): Remove this. An ephemeral placeholder before + // real values are introduced. When this is changed to a governance param, + // make sure to also add the necessary unit tests. + MintGlobalInflation = 0.0000000 // TODO_UPNEXT(@olshansk): Make all of the governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 MintAllocationSupplier = 0.7 MintAllocationSourceOwner = 0.15 MintAllocationApplication = 0.0 - // TODO_UPNEXT(@olshansk): Remove this. An ephemeral placeholder before - // real values are introduced. When this is changed to a governance param, - // make sure to also add the necessary unit tests. - MintGlobalAllocation = 0.0000000 ) type TokenLogicModule int const ( + // TLMRelayBurnEqualsMint is the token logic module that burns the application's + // stake based on the amount of work done by the supplier. The same amount of + // tokens is minted and sent to the supplier. + // When the network achieves equilibrium, this is theoretically the only TLM that will be necessary. TLMRelayBurnEqualsMint TokenLogicModule = iota + + // TLMGlobalMint is the token logic module that mints new tokens based on the + // on global governance parameters in order to reward the participants providing + // services while keeping inflation in check. TLMGlobalMint - // TODO_UPNEXT(@olshansk): Add more TLMs + + // TLMGlobalMintReimbursementRequest is the token logic module that complements + // TLMGlobalMint to enable permissionless demand. In order to prevent self-dealing + // attacks, applications will be overcharged by the amount equal to global inflation, + // those funds will be sent to the DAO/PNF, and event will be emitted to be used + // for reimbursements. + // TODO_POST_MAINNET: Introduce proper tokenomics based on the research done by @rawthil and @shane. + TLMGlobalMintReimbursementRequest ) var tokenLogicModuleStrings = [...]string{ "TLMRelayBurnEqualsMint", "TLMGlobalMint", + "TLMGlobalMintReimbursementRequest", } func (tlm TokenLogicModule) String() string { @@ -69,6 +87,7 @@ type TokenLogicModuleProcessor func( Keeper, context.Context, *sharedtypes.Service, + *sessiontypes.SessionHeader, *apptypes.Application, *sharedtypes.Supplier, cosmostypes.Coin, @@ -245,6 +264,7 @@ func (k Keeper) ProcessTokenLogicModules( func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( ctx context.Context, service *sharedtypes.Service, + _ *sessiontypes.SessionHeader, application *apptypes.Application, supplier *sharedtypes.Supplier, settlementCoin cosmostypes.Coin, @@ -319,24 +339,19 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( } // TokenLogicModuleGlobalMint processes the business logic for the GlobalMint TLM. -// TODO_UPNEXT(@olshansk): Delete this in favor of a real TLM that mints tokens -// and distributes them to the appropriate accounts via boosts. func (k Keeper) TokenLogicModuleGlobalMint( ctx context.Context, service *sharedtypes.Service, + _ *sessiontypes.SessionHeader, application *apptypes.Application, supplier *sharedtypes.Supplier, - settlementCoins cosmostypes.Coin, + settlementCoin cosmostypes.Coin, relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error { logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") // Determine how much new uPOKT to mint based on global inflation - // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. - settlementAmtFloat := new(big.Float).SetUint64(settlementCoins.Amount.Uint64()) - newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintGlobalAllocation)) - newMintAmtInt, _ := newMintAmtFloat.Int64() - newMintCoins := sdk.NewCoins(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt))) + newMintCoins, newMintAmtFloat := calculateGlobalMintAllocationFromSettlementAmount(settlementCoin) // Mint new uPOKT to the tokenomics module account if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, newMintCoins); err != nil { @@ -353,15 +368,16 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the application with address %q", appCoin, application.Address)) // Send a portion of the rewards to the supplier shareholders. - coinsToShareAmt := calculateGlobalMintAllocationFromSettlementAmount(newMintAmtFloat, MintAllocationSupplier) - if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier.OperatorAddress, service.Id, uint64(coinsToShareAmt)); err != nil { + supplierCoinsToShareAmt := calculateAllocationAmount(newMintAmtFloat, MintAllocationSupplier) + supplierCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(supplierCoinsToShareAmt)) + if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier.OperatorAddress, service.Id, uint64(supplierCoinsToShareAmt)); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, err, ) } - supplierCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt)) + logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the supplier with address %q", supplierCoin, supplier.OperatorAddress)) // Send a portion of the rewards to the DAO @@ -386,16 +402,73 @@ func (k Keeper) TokenLogicModuleGlobalMint( } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the proposer with address %q", proposerCoin, proposerAddr)) - // TODO_MAINNET: Verify that the total distributed coins equals the settlement coins which could happen due to float rounding + // Check and log the total amount of coins distributed totalDistributedCoins := appCoin.Add(supplierCoin).Add(*daoCoin).Add(*serviceCoin).Add(*proposerCoin) - if totalDistributedCoins.Amount.BigInt().Cmp(settlementCoins.Amount.BigInt()) != 0 { - logger.Error(fmt.Sprintf("TODO_MAINNET: The total distributed coins (%v) does not equal the settlement coins (%v)", totalDistributedCoins, settlementCoins.Amount.BigInt())) + if totalDistributedCoins.Amount.BigInt().Cmp(settlementCoin.Amount.BigInt()) != 0 { + logger.Error(fmt.Sprintf("TODO_MAINNET: Verify why the total distributed coins (%v) do not equal the settlement coins (%v). Likely floating point arithmetic.", totalDistributedCoins, settlementCoin.Amount.BigInt())) } logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalDistributedCoins)) return nil } +// 1. Mint = Burn +// 2. Global Mint +// 4. Overcharge applications +// - Determine the amount send to suppliers +// - Determine the amount send to source owner +// - Overcharge application based on the sum of the two above +// - Send the overcharge to the PNF +// - Emit an event so we can track it +// - PNF manually reimburses the application at the end of the month +// - Prevents self dealing because application has to ask for reimbursement +// - Does not introduce friction to service owners getting rewarded +// - Does not introduce friction to suppliers getting rewarded +// - Ensure NewSession breaks if app stake is too low +// - Ensure relayminer has a toggle to prevent over charging +func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( + ctx context.Context, + service *sharedtypes.Service, + sessionHeader *sessiontypes.SessionHeader, + application *apptypes.Application, + supplier *sharedtypes.Supplier, + settlementCoins cosmostypes.Coin, + relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, +) error { + logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") + + // Determine how much new uPOKT to mint based on global inflation + newMintCoins, _ := calculateGlobalMintAllocationFromSettlementAmount(settlementCoins) + + + + // EventApplicationReimbursementRequest + reimbursementRequest := tokenomictypes.EventApplicationReimbursementRequest{ + ApplicationAddr: application.Address, + ServiceId: service.Id, + SessionId: sessionHeader.SessionId, + Amount: &newMintCoins[0], + } + + eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() + if err := eventManager.EmitTypedEvent(&reimbursementRequest); err != nil { + return tokenomicstypes.ErrTokenomicsApplicationReimbursementRequestFailed.Wrapf( + "application address: %s; service Id %s; session Id: %s; amount: %s", + application.GetAddress(), + service.Id, + sessionHeader.SessionId, + newMintCoins.String(), + ) + } + + // EventApplicationReimbursementRequest + // What if the application is overcharged? + // How do I enforce running both of them? + // Need to add a new governance parameter? + // Should we prevent new application sessions from starting if its too low? + return nil +} + // sendRewardsToAccount sends (settlementAmtFloat * allocation) tokens from the // tokenomics module account to the specified address. func (k Keeper) sendRewardsToAccount( @@ -411,7 +484,7 @@ func (k Keeper) sendRewardsToAccount( return nil, err } - coinsToAccAmt := calculateGlobalMintAllocationFromSettlementAmount(settlementAmtFloat, allocation) + coinsToAccAmt := calculateAllocationAmount(settlementAmtFloat, allocation) coinToAcc := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(coinsToAccAmt)) if err := k.bankKeeper.SendCoinsFromModuleToAccount( ctx, suppliertypes.ModuleName, accountAddr, sdk.NewCoins(coinToAcc), @@ -454,12 +527,13 @@ func (k Keeper) handleOverservicedApplication( } eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() if err := eventManager.EmitTypedEvent(applicationOverservicedEvent); err != nil { - return cosmostypes.Coin{}, tokenomicstypes.ErrTokenomicsApplicationOverserviced.Wrapf( - "application address: %s; expected burn %s; effective burn: %s", - application.GetAddress(), - expectedBurn.String(), - application.GetStake().String(), - ) + return cosmostypes.Coin{}, + tokenomicstypes.ErrTokenomicsApplicationOverservicedEvent.Wrapf( + "application address: %s; expected burn %s; effective burn: %s", + application.GetAddress(), + expectedBurn.String(), + application.GetStake().String(), + ) } return *application.Stake, nil } @@ -518,6 +592,7 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( shareAmountMap := GetShareAmountMap(serviceRevShare, amountToDistribute) for shareHolderAddress, shareAmount := range shareAmountMap { + // TODO_IN_THIS_PR: Why don't we use sendRewardsToAccount here? shareAmountCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(int64(shareAmount))) shareAmountCoins := cosmostypes.NewCoins(shareAmountCoin) shareHolderAccAddress, err := sdk.AccAddressFromBech32(shareHolderAddress) @@ -541,14 +616,26 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( return nil } -// calculateGlobalMintAllocationFromSettlementAmount calculates the global mint -// allocation resulting from the GlobalMint TLM given the settlement amount and -// the allocation percentage. -func calculateGlobalMintAllocationFromSettlementAmount( - settlementAmtFloat *big.Float, - allocation float64, +// calculateGlobalMintAllocationFromSettlementAmount calculates the amount of uPOKT +// to mint based on the global inflation rate as a function of the settlement amount +// for a particular claim(s) or session(s). +func calculateGlobalMintAllocationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coins, *big.Float) { + // Determine how much new uPOKT to mint based on global inflation + // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. + settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) + newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintGlobalInflation)) + newMintAmtInt, _ := newMintAmtFloat.Int64() + mintAmtCoins := sdk.NewCoins(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt))) + return mintAmtCoins, newMintAmtFloat +} + +// calculateAllocationAmount does big float arithmetic to determine the absolute +// amount from amountFloat based on the allocation percentage provided. +func calculateAllocationAmount( + amountFloat *big.Float, + allocationPercentage float64, ) int64 { - coinsToAccAmt, _ := big.NewFloat(0).Mul(settlementAmtFloat, big.NewFloat(allocation)).Int64() + coinsToAccAmt, _ := big.NewFloat(0).Mul(amountFloat, big.NewFloat(allocationPercentage)).Int64() return coinsToAccAmt } @@ -563,12 +650,12 @@ func GetShareAmountMap( ) (shareAmountMap map[string]uint64) { totalDistributed := uint64(0) shareAmountMap = make(map[string]uint64, len(serviceRevShare)) - for _, revshare := range serviceRevShare { + for _, revShare := range serviceRevShare { // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. - sharePercentageFloat := big.NewFloat(float64(revshare.RevSharePercentage) / 100) + sharePercentageFloat := big.NewFloat(float64(revShare.RevSharePercentage) / 100) amountToDistributeFloat := big.NewFloat(float64(amountToDistribute)) shareAmount, _ := big.NewFloat(0).Mul(amountToDistributeFloat, sharePercentageFloat).Uint64() - shareAmountMap[revshare.Address] = shareAmount + shareAmountMap[revShare.Address] = shareAmount totalDistributed += shareAmount } diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 3ff72fc5a..6e7c23a0d 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -6,30 +6,31 @@ import sdkerrors "cosmossdk.io/errors" // x/tokenomics module sentinel errors var ( - ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "the provided authority address does not match the on-chain governance address") - ErrTokenomicsAddressInvalid = sdkerrors.Register(ModuleName, 1101, "the provided authority address is not a valid bech32 address") - ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1102, "provided claim is nil") - ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1103, "provided claim's session header is nil") - ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1104, "provided claim's session header is invalid") - ErrTokenomicsSupplierModuleSendFailed = sdkerrors.Register(ModuleName, 1105, "failed to send uPOKT to supplier module account") - ErrTokenomicsSupplierOperatorAddressInvalid = sdkerrors.Register(ModuleName, 1106, "the supplier operator address in the claim is not a valid bech32 address") - ErrTokenomicsSupplierNotFound = sdkerrors.Register(ModuleName, 1107, "supplier not found") - ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1108, "application not found") - ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1109, "failed to burn uPOKT from application module account") - ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1110, "the application address in the claim is not a valid bech32 address") - ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1111, "provided params are invalid") - ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1112, "the root hash in the claim is invalid") - ErrTokenomicsApplicationNewStakeInvalid = sdkerrors.Register(ModuleName, 1113, "application stake cannot be reduced to a -ve amount") - ErrTokenomicsParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") - ErrTokenomicsParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") - ErrTokenomicsUnmarshalInvalid = sdkerrors.Register(ModuleName, 1116, "failed to unmarshal the provided bytes") - ErrTokenomicsDuplicateIndex = sdkerrors.Register(ModuleName, 1117, "cannot have a duplicate index") - ErrTokenomicsMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1118, "missing relay mining difficulty") - ErrTokenomicsApplicationOverserviced = sdkerrors.Register(ModuleName, 1119, "application was overserviced") - ErrTokenomicsServiceNotFound = sdkerrors.Register(ModuleName, 1120, "service not found") - ErrTokenomicsModuleMintFailed = sdkerrors.Register(ModuleName, 1121, "failed to mint uPOKT to tokenomics module account") - ErrTokenomicsSendingMintRewards = sdkerrors.Register(ModuleName, 1122, "failed to send minted rewards") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1123, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1124, "the supplier owner address in the claim is not a valid bech32 address") - ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") + ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "the provided authority address does not match the on-chain governance address") + ErrTokenomicsAddressInvalid = sdkerrors.Register(ModuleName, 1101, "the provided authority address is not a valid bech32 address") + ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1102, "provided claim is nil") + ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1103, "provided claim's session header is nil") + ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1104, "provided claim's session header is invalid") + ErrTokenomicsSupplierModuleSendFailed = sdkerrors.Register(ModuleName, 1105, "failed to send uPOKT to supplier module account") + ErrTokenomicsSupplierOperatorAddressInvalid = sdkerrors.Register(ModuleName, 1106, "the supplier operator address in the claim is not a valid bech32 address") + ErrTokenomicsSupplierNotFound = sdkerrors.Register(ModuleName, 1107, "supplier not found") + ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1108, "application not found") + ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1109, "failed to burn uPOKT from application module account") + ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1110, "the application address in the claim is not a valid bech32 address") + ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1111, "provided params are invalid") + ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1112, "the root hash in the claim is invalid") + ErrTokenomicsApplicationNewStakeInvalid = sdkerrors.Register(ModuleName, 1113, "application stake cannot be reduced to a -ve amount") + ErrTokenomicsParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") + ErrTokenomicsParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") + ErrTokenomicsUnmarshalInvalid = sdkerrors.Register(ModuleName, 1116, "failed to unmarshal the provided bytes") + ErrTokenomicsDuplicateIndex = sdkerrors.Register(ModuleName, 1117, "cannot have a duplicate index") + ErrTokenomicsMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1118, "missing relay mining difficulty") + ErrTokenomicsApplicationOverservicedEvent = sdkerrors.Register(ModuleName, 1119, "application overserviced event cannot be sent") + ErrTokenomicsServiceNotFound = sdkerrors.Register(ModuleName, 1120, "service not found") + ErrTokenomicsModuleMintFailed = sdkerrors.Register(ModuleName, 1121, "failed to mint uPOKT to tokenomics module account") + ErrTokenomicsSendingMintRewards = sdkerrors.Register(ModuleName, 1122, "failed to send minted rewards") + ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1123, "failed to mint uPOKT to supplier module account") + ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1124, "the supplier owner address in the claim is not a valid bech32 address") + ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") + ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") ) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 5c55fbc6e..945d4ab97 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -335,63 +335,138 @@ func (m *EventApplicationOverserviced) GetEffectiveBurn() *types1.Coin { return nil } +// EventApplicationReimbursementRequest is emitted when an application requests a +// reimbursement +type EventApplicationReimbursementRequest struct { + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + ServiceId string `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Amount *types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventApplicationReimbursementRequest) Reset() { *m = EventApplicationReimbursementRequest{} } +func (m *EventApplicationReimbursementRequest) String() string { return proto.CompactTextString(m) } +func (*EventApplicationReimbursementRequest) ProtoMessage() {} +func (*EventApplicationReimbursementRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a78874bbf91a58c7, []int{4} +} +func (m *EventApplicationReimbursementRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventApplicationReimbursementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventApplicationReimbursementRequest.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 *EventApplicationReimbursementRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventApplicationReimbursementRequest.Merge(m, src) +} +func (m *EventApplicationReimbursementRequest) XXX_Size() int { + return m.Size() +} +func (m *EventApplicationReimbursementRequest) XXX_DiscardUnknown() { + xxx_messageInfo_EventApplicationReimbursementRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_EventApplicationReimbursementRequest proto.InternalMessageInfo + +func (m *EventApplicationReimbursementRequest) GetApplicationAddr() string { + if m != nil { + return m.ApplicationAddr + } + return "" +} + +func (m *EventApplicationReimbursementRequest) GetServiceId() string { + if m != nil { + return m.ServiceId + } + return "" +} + +func (m *EventApplicationReimbursementRequest) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +func (m *EventApplicationReimbursementRequest) GetAmount() *types1.Coin { + if m != nil { + return m.Amount + } + return nil +} + func init() { proto.RegisterEnum("poktroll.tokenomics.ClaimExpirationReason", ClaimExpirationReason_name, ClaimExpirationReason_value) proto.RegisterType((*EventClaimExpired)(nil), "poktroll.tokenomics.EventClaimExpired") proto.RegisterType((*EventClaimSettled)(nil), "poktroll.tokenomics.EventClaimSettled") proto.RegisterType((*EventRelayMiningDifficultyUpdated)(nil), "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") proto.RegisterType((*EventApplicationOverserviced)(nil), "poktroll.tokenomics.EventApplicationOverserviced") + proto.RegisterType((*EventApplicationReimbursementRequest)(nil), "poktroll.tokenomics.EventApplicationReimbursementRequest") } func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xc1, 0x4e, 0xdb, 0x4a, - 0x14, 0x8d, 0x03, 0x3c, 0x29, 0xc3, 0x03, 0x12, 0x53, 0xd4, 0x94, 0x42, 0x12, 0xb2, 0xa8, 0x28, + // 776 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x4e, 0xeb, 0x46, + 0x14, 0x8e, 0xc3, 0x8f, 0x94, 0xa1, 0x40, 0x32, 0x14, 0x35, 0xa5, 0x90, 0x84, 0xa8, 0xaa, 0x28, 0x15, 0xb6, 0x00, 0xa9, 0xab, 0x0a, 0x35, 0x09, 0xa6, 0x58, 0x2a, 0x49, 0xe4, 0x40, 0x55, 0x75, - 0x33, 0x75, 0xec, 0x9b, 0x64, 0x4a, 0x3c, 0xe3, 0x8e, 0xc7, 0x49, 0xf8, 0x8b, 0x7e, 0x40, 0x7f, - 0xa0, 0x8b, 0xfe, 0x47, 0xa5, 0x6e, 0x58, 0x76, 0x85, 0x2a, 0xd8, 0xf1, 0x15, 0x95, 0xc7, 0x21, - 0x49, 0x03, 0x55, 0xd7, 0xdd, 0x24, 0xd6, 0x3d, 0xe7, 0xdc, 0x7b, 0xe6, 0x78, 0x7c, 0x51, 0xde, - 0x67, 0x67, 0x82, 0xb3, 0x6e, 0x57, 0x17, 0xec, 0x0c, 0x28, 0xf3, 0x88, 0x13, 0xe8, 0xd0, 0x03, - 0x2a, 0x34, 0x9f, 0x33, 0xc1, 0xd4, 0xe5, 0x5b, 0x82, 0x36, 0x26, 0xac, 0x3e, 0x68, 0xb3, 0x36, - 0x93, 0xb8, 0x1e, 0x3d, 0xc5, 0xd4, 0xd5, 0x9c, 0xc3, 0x02, 0x8f, 0x05, 0x7a, 0xd3, 0x0e, 0x40, - 0xef, 0xed, 0x34, 0x41, 0xd8, 0x3b, 0xba, 0xc3, 0x08, 0x1d, 0xe2, 0xab, 0xa3, 0x59, 0x3e, 0x67, - 0xac, 0xa5, 0x3b, 0x5d, 0x9b, 0x78, 0x43, 0xac, 0x30, 0x85, 0x71, 0xf8, 0x18, 0x12, 0x0e, 0xde, - 0xc8, 0x48, 0xf1, 0x6b, 0x12, 0x65, 0x8c, 0xc8, 0x58, 0x25, 0x92, 0x19, 0x03, 0x9f, 0x70, 0x70, - 0xd5, 0xe7, 0x68, 0x4e, 0xb6, 0xc9, 0x2a, 0x05, 0x65, 0x73, 0x7e, 0x77, 0x45, 0x1b, 0xd9, 0x95, - 0x7d, 0x34, 0x49, 0x2e, 0xa7, 0x6e, 0x2e, 0xf3, 0x31, 0xcf, 0x8a, 0xff, 0xd4, 0x6d, 0x84, 0x68, - 0xe8, 0x61, 0x0e, 0x5d, 0xfb, 0x3c, 0xc8, 0x26, 0x0b, 0xca, 0xe6, 0x6c, 0x79, 0xf1, 0xe6, 0x32, - 0x3f, 0x51, 0xb5, 0x52, 0x34, 0xf4, 0x2c, 0xf9, 0xa8, 0x96, 0x50, 0x26, 0x02, 0x1c, 0xe6, 0xf9, - 0xa1, 0x00, 0x1c, 0x52, 0x22, 0x82, 0xec, 0x8c, 0x54, 0xad, 0xdc, 0x5c, 0xe6, 0xef, 0x82, 0xd6, - 0x12, 0x0d, 0xbd, 0x4a, 0x5c, 0x39, 0x8d, 0x0a, 0x2a, 0x45, 0x19, 0x88, 0x4c, 0xdb, 0x82, 0x30, - 0x8a, 0x39, 0xd8, 0x01, 0xa3, 0xd9, 0xd9, 0x82, 0xb2, 0xb9, 0xb8, 0xbb, 0xa5, 0xdd, 0x13, 0xb2, - 0x36, 0x3e, 0xa7, 0x94, 0x58, 0x52, 0x11, 0x8f, 0xbb, 0xd3, 0xc8, 0x4a, 0xc3, 0x14, 0xb1, 0xf8, - 0xe5, 0xb7, 0xbc, 0x1a, 0x20, 0x44, 0xf7, 0x9f, 0xca, 0xeb, 0x03, 0xca, 0x48, 0x4b, 0x78, 0xe2, - 0x2a, 0x0c, 0xf3, 0x7a, 0x32, 0xed, 0xba, 0x1e, 0xfd, 0x5a, 0x63, 0xde, 0x64, 0x56, 0x77, 0x9a, - 0x58, 0x69, 0x7f, 0x8a, 0x5e, 0xfc, 0x9c, 0x44, 0x1b, 0x32, 0x2b, 0x69, 0xff, 0x98, 0x50, 0x42, - 0xdb, 0x07, 0xa4, 0xd5, 0x22, 0x4e, 0xd8, 0x15, 0xe7, 0xa7, 0xbe, 0x6b, 0x0b, 0x70, 0xd5, 0x75, - 0x84, 0x02, 0xe0, 0x3d, 0xe2, 0x00, 0x26, 0xae, 0x0c, 0x30, 0x65, 0xa5, 0x86, 0x15, 0xd3, 0x55, - 0xf7, 0xd1, 0x9a, 0xcf, 0xa1, 0x87, 0x85, 0xcd, 0xdb, 0x20, 0x70, 0xc7, 0x0e, 0x3a, 0xb8, 0x03, - 0x03, 0x0c, 0xd4, 0x61, 0x2e, 0xb8, 0x32, 0xb4, 0x94, 0x95, 0x8d, 0x38, 0x27, 0x92, 0x72, 0x64, - 0x07, 0x9d, 0x23, 0x18, 0x18, 0x31, 0xae, 0xbe, 0x40, 0x8f, 0x29, 0xf4, 0xff, 0x28, 0x9f, 0x91, - 0xf2, 0x87, 0x14, 0xfa, 0xf7, 0xaa, 0xb7, 0xd1, 0xb2, 0x9c, 0x3e, 0x7e, 0x1f, 0x18, 0x3c, 0x5b, - 0x06, 0x36, 0x1b, 0x9d, 0x18, 0x7a, 0xd5, 0xdb, 0xb7, 0x63, 0x78, 0xb6, 0xfa, 0x0c, 0xa9, 0xd1, - 0xb0, 0x29, 0xf6, 0x9c, 0x64, 0x2f, 0x51, 0xe8, 0x4f, 0x92, 0x8b, 0xdf, 0x15, 0xb4, 0x26, 0xe3, - 0x29, 0xf9, 0x7e, 0x97, 0x38, 0xf2, 0x96, 0xd5, 0x7a, 0xc0, 0x87, 0x67, 0x77, 0xd5, 0xa7, 0x28, - 0x6d, 0x8f, 0x21, 0x6c, 0xbb, 0x2e, 0x1f, 0xe6, 0xb3, 0x34, 0x51, 0x2f, 0xb9, 0x2e, 0x57, 0xf7, - 0xd1, 0x02, 0x0c, 0x7c, 0x70, 0x04, 0xb8, 0xb8, 0x19, 0x72, 0x2a, 0x63, 0x99, 0xdf, 0x7d, 0xa4, - 0xc5, 0xcb, 0x43, 0x8b, 0x96, 0x87, 0x36, 0x5c, 0x1e, 0x5a, 0x85, 0x11, 0x6a, 0xfd, 0x7f, 0xcb, - 0x2f, 0x87, 0x9c, 0xaa, 0x2f, 0xd1, 0x22, 0xb4, 0x5a, 0xe0, 0x08, 0xd2, 0x83, 0xb8, 0xc1, 0xcc, - 0xdf, 0x1a, 0x2c, 0x8c, 0x04, 0x51, 0x87, 0xad, 0xf7, 0x68, 0xe5, 0xde, 0x4f, 0x4b, 0xdd, 0x40, - 0xeb, 0xc6, 0xdb, 0xba, 0x69, 0x95, 0x4e, 0xcc, 0x5a, 0x15, 0x5b, 0x46, 0xa9, 0x51, 0xab, 0xe2, - 0xd3, 0x6a, 0xa3, 0x6e, 0x54, 0xcc, 0x43, 0xd3, 0x38, 0x48, 0x27, 0xd4, 0x0c, 0x5a, 0xa8, 0x5b, - 0xb5, 0xda, 0x21, 0x3e, 0x36, 0x1b, 0x0d, 0xb3, 0xfa, 0x2a, 0xad, 0x8c, 0x4b, 0x66, 0xf5, 0x4d, - 0xe9, 0xb5, 0x79, 0x90, 0x4e, 0x96, 0x8f, 0xbf, 0x5d, 0xe5, 0x94, 0x8b, 0xab, 0x9c, 0xf2, 0xf3, - 0x2a, 0xa7, 0x7c, 0xba, 0xce, 0x25, 0x2e, 0xae, 0x73, 0x89, 0x1f, 0xd7, 0xb9, 0xc4, 0xbb, 0xbd, - 0x36, 0x11, 0x9d, 0xb0, 0xa9, 0x39, 0xcc, 0xd3, 0xa3, 0x3b, 0xbc, 0x4d, 0x41, 0xf4, 0x19, 0x3f, - 0xd3, 0x47, 0xeb, 0x6f, 0x30, 0xb9, 0x88, 0xc5, 0xb9, 0x0f, 0x41, 0xf3, 0x3f, 0xb9, 0x00, 0xf7, - 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xac, 0x71, 0x68, 0xf9, 0xac, 0x05, 0x00, 0x00, + 0xe3, 0x3a, 0xf6, 0x49, 0x32, 0x25, 0x9e, 0x31, 0xe3, 0x71, 0x12, 0xde, 0xa2, 0x0f, 0xd0, 0x17, + 0xe8, 0xa2, 0x2f, 0xd1, 0x55, 0xa5, 0x6e, 0x58, 0x76, 0x85, 0x2a, 0xd8, 0xf1, 0x14, 0x57, 0x1e, + 0x3b, 0x3f, 0x04, 0xee, 0xbd, 0xba, 0xcb, 0xbb, 0x49, 0x46, 0xe7, 0x7c, 0xdf, 0x37, 0xe7, 0x7c, + 0x73, 0x72, 0x82, 0x8a, 0x3e, 0xbb, 0x16, 0x9c, 0xf5, 0xfb, 0x9a, 0x60, 0xd7, 0x40, 0x99, 0x47, + 0x9c, 0x40, 0x83, 0x01, 0x50, 0xa1, 0xfa, 0x9c, 0x09, 0x86, 0x37, 0xc6, 0x00, 0x75, 0x0a, 0xd8, + 0x2a, 0x38, 0x2c, 0xf0, 0x58, 0xa0, 0xb5, 0xed, 0x00, 0xb4, 0xc1, 0x61, 0x1b, 0x84, 0x7d, 0xa8, + 0x39, 0x8c, 0xd0, 0x98, 0xb4, 0xf5, 0x69, 0x97, 0x75, 0x99, 0x3c, 0x6a, 0xd1, 0x29, 0x89, 0x6e, + 0x4d, 0xee, 0xf2, 0x39, 0x63, 0x1d, 0xcd, 0xe9, 0xdb, 0xc4, 0x4b, 0x72, 0xa5, 0xb9, 0x1c, 0x87, + 0x9b, 0x90, 0x70, 0xf0, 0x26, 0x85, 0x94, 0xff, 0x4a, 0xa3, 0x9c, 0x1e, 0x15, 0x56, 0x8b, 0x68, + 0xfa, 0xc8, 0x27, 0x1c, 0x5c, 0xfc, 0x2d, 0x5a, 0x92, 0x32, 0x79, 0xa5, 0xa4, 0xec, 0xad, 0x1c, + 0x6d, 0xaa, 0x93, 0x72, 0xa5, 0x8e, 0x2a, 0xc1, 0xd5, 0xcc, 0xd3, 0x7d, 0x31, 0xc6, 0x99, 0xf1, + 0x17, 0x3e, 0x40, 0x88, 0x86, 0x9e, 0xc5, 0xa1, 0x6f, 0xdf, 0x06, 0xf9, 0x74, 0x49, 0xd9, 0x5b, + 0xac, 0xae, 0x3d, 0xdd, 0x17, 0x67, 0xa2, 0x66, 0x86, 0x86, 0x9e, 0x29, 0x8f, 0xb8, 0x82, 0x72, + 0x51, 0xc2, 0x61, 0x9e, 0x1f, 0x0a, 0xb0, 0x42, 0x4a, 0x44, 0x90, 0x5f, 0x90, 0xac, 0xcd, 0xa7, + 0xfb, 0xe2, 0xcb, 0xa4, 0xb9, 0x4e, 0x43, 0xaf, 0x16, 0x47, 0xae, 0xa2, 0x00, 0xa6, 0x28, 0x07, + 0x51, 0xd1, 0xb6, 0x20, 0x8c, 0x5a, 0x1c, 0xec, 0x80, 0xd1, 0xfc, 0x62, 0x49, 0xd9, 0x5b, 0x3b, + 0xda, 0x57, 0x5f, 0x31, 0x59, 0x9d, 0xf6, 0x29, 0x29, 0xa6, 0x64, 0xc4, 0xd7, 0xbd, 0x10, 0x32, + 0xb3, 0x30, 0x07, 0x2c, 0xff, 0xf9, 0xcc, 0xaf, 0x16, 0x08, 0xd1, 0xff, 0xa8, 0xfc, 0xfa, 0x0d, + 0xe5, 0x64, 0x49, 0xd6, 0xcc, 0x28, 0x24, 0x7e, 0x7d, 0x35, 0x5f, 0x75, 0x33, 0xfa, 0x34, 0xa7, + 0xb8, 0x59, 0xaf, 0x5e, 0x88, 0x98, 0x59, 0x7f, 0x0e, 0x5e, 0xfe, 0x23, 0x8d, 0x76, 0xa5, 0x57, + 0xb2, 0xfc, 0x0b, 0x42, 0x09, 0xed, 0x9e, 0x92, 0x4e, 0x87, 0x38, 0x61, 0x5f, 0xdc, 0x5e, 0xf9, + 0xae, 0x2d, 0xc0, 0xc5, 0x3b, 0x08, 0x05, 0xc0, 0x07, 0xc4, 0x01, 0x8b, 0xb8, 0xd2, 0xc0, 0x8c, + 0x99, 0x49, 0x22, 0x86, 0x8b, 0x4f, 0xd0, 0xb6, 0xcf, 0x61, 0x60, 0x09, 0x9b, 0x77, 0x41, 0x58, + 0x3d, 0x3b, 0xe8, 0x59, 0x3d, 0x18, 0x59, 0x40, 0x1d, 0xe6, 0x82, 0x2b, 0x4d, 0xcb, 0x98, 0xf9, + 0x08, 0x73, 0x29, 0x21, 0xe7, 0x76, 0xd0, 0x3b, 0x87, 0x91, 0x1e, 0xe7, 0xf1, 0x77, 0xe8, 0x0b, + 0x0a, 0xc3, 0xb7, 0xd2, 0x17, 0x24, 0xfd, 0x33, 0x0a, 0xc3, 0x57, 0xd9, 0x07, 0x68, 0x43, 0xde, + 0x3e, 0x7d, 0x0f, 0x0b, 0x3c, 0x5b, 0x1a, 0xb6, 0x18, 0x75, 0x0c, 0x83, 0xfa, 0xf8, 0x75, 0x74, + 0xcf, 0xc6, 0xdf, 0x20, 0x1c, 0x5d, 0x36, 0x87, 0x5e, 0x92, 0xe8, 0x75, 0x0a, 0xc3, 0x59, 0x70, + 0xf9, 0x5f, 0x05, 0x6d, 0x4b, 0x7b, 0x2a, 0xbe, 0xdf, 0x27, 0x8e, 0x9c, 0xb2, 0xc6, 0x00, 0x78, + 0xd2, 0xbb, 0x8b, 0xbf, 0x46, 0x59, 0x7b, 0x9a, 0xb2, 0x6c, 0xd7, 0xe5, 0x89, 0x3f, 0xeb, 0x33, + 0xf1, 0x8a, 0xeb, 0x72, 0x7c, 0x82, 0x56, 0x61, 0xe4, 0x83, 0x23, 0xc0, 0xb5, 0xda, 0x21, 0xa7, + 0xd2, 0x96, 0x95, 0xa3, 0xcf, 0xd5, 0x78, 0xa5, 0xa8, 0xd1, 0x4a, 0x51, 0x93, 0x95, 0xa2, 0xd6, + 0x18, 0xa1, 0xe6, 0x27, 0x63, 0x7c, 0x35, 0xe4, 0x14, 0x7f, 0x8f, 0xd6, 0xa0, 0xd3, 0x01, 0x47, + 0x90, 0x01, 0xc4, 0x02, 0x0b, 0xef, 0x13, 0x58, 0x9d, 0x10, 0x22, 0x85, 0xf2, 0xdf, 0x0a, 0xfa, + 0x72, 0xbe, 0x1b, 0x13, 0x88, 0xd7, 0x0e, 0x79, 0x90, 0x4c, 0xcf, 0x4d, 0x08, 0x81, 0xf8, 0x90, + 0xae, 0x9e, 0x8f, 0x46, 0x7a, 0x7e, 0x34, 0x64, 0x3a, 0x08, 0x22, 0x15, 0x32, 0x7e, 0xc9, 0x4c, + 0x12, 0x31, 0x5c, 0x7c, 0x88, 0x96, 0x6d, 0x8f, 0x85, 0xc9, 0x7c, 0xbf, 0xb3, 0x97, 0x04, 0xb8, + 0xff, 0x2b, 0xda, 0x7c, 0x75, 0x3f, 0xe0, 0x5d, 0xb4, 0xa3, 0xff, 0xdc, 0x34, 0xcc, 0xca, 0xa5, + 0xd1, 0xa8, 0x5b, 0xa6, 0x5e, 0x69, 0x35, 0xea, 0xd6, 0x55, 0xbd, 0xd5, 0xd4, 0x6b, 0xc6, 0x99, + 0xa1, 0x9f, 0x66, 0x53, 0x38, 0x87, 0x56, 0x9b, 0x66, 0xa3, 0x71, 0x66, 0x5d, 0x18, 0xad, 0x96, + 0x51, 0xff, 0x21, 0xab, 0x4c, 0x43, 0x46, 0xfd, 0xa7, 0xca, 0x8f, 0xc6, 0x69, 0x36, 0x5d, 0xbd, + 0xf8, 0xe7, 0xa1, 0xa0, 0xdc, 0x3d, 0x14, 0x94, 0xff, 0x1f, 0x0a, 0xca, 0xef, 0x8f, 0x85, 0xd4, + 0xdd, 0x63, 0x21, 0xf5, 0xdf, 0x63, 0x21, 0xf5, 0xcb, 0x71, 0x97, 0x88, 0x5e, 0xd8, 0x56, 0x1d, + 0xe6, 0x69, 0xd1, 0x0f, 0xf1, 0x80, 0x82, 0x18, 0x32, 0x7e, 0xad, 0x4d, 0x76, 0xf8, 0x68, 0xf6, + 0xdf, 0x44, 0xdc, 0xfa, 0x10, 0xb4, 0x97, 0xe5, 0x16, 0x3f, 0x7e, 0x13, 0x00, 0x00, 0xff, 0xff, + 0xe7, 0x04, 0xe0, 0xc6, 0x71, 0x06, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -602,6 +677,62 @@ func (m *EventApplicationOverserviced) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *EventApplicationReimbursementRequest) 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 *EventApplicationReimbursementRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventApplicationReimbursementRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != nil { + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ApplicationAddr) > 0 { + i -= len(m.ApplicationAddr) + copy(dAtA[i:], m.ApplicationAddr) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ApplicationAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset @@ -705,6 +836,31 @@ func (m *EventApplicationOverserviced) Size() (n int) { return n } +func (m *EventApplicationReimbursementRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ApplicationAddr) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.SessionId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.Amount != nil { + l = m.Amount.Size() + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + func sovEvent(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1335,6 +1491,188 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventApplicationReimbursementRequest) 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: EventApplicationReimbursementRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventApplicationReimbursementRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplicationAddr", 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.ApplicationAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", 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.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount == nil { + m.Amount = &types1.Coin{} + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index 91f06eeff..5bc7d33e4 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -133,7 +133,6 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // // *MsgUpdateParam_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes From c3a235a737817a215b0c29b66b713a6b95e7c336 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Tue, 20 Aug 2024 21:09:41 -0400 Subject: [PATCH 02/48] Checkpoint --- api/poktroll/application/params.pulsar.go | 3 + api/poktroll/tokenomics/event.pulsar.go | 4 +- .../protocol/architecture/_category_.json | 4 +- .../docs/protocol/architecture/network.md | 2 +- .../docs/protocol/tokenomics/_category_.json | 8 + .../docs/protocol/tokenomics/resources.md | 18 ++ .../tokenomics/token_logic_modules.md | 157 ++++++++++++++++++ .../docs/protocol/upgrades/_category_.json | 2 +- pkg/relayer/session/sessiontree.go | 7 +- proto/poktroll/shared/service.proto | 6 +- proto/poktroll/tokenomics/event.proto | 17 +- x/application/types/params.pb.go | 3 + x/session/keeper/session_hydrator.go | 1 + x/tokenomics/keeper/token_logic_modules.go | 84 +++++----- x/tokenomics/types/errors.go | 1 + x/tokenomics/types/event.pb.go | 4 +- 16 files changed, 268 insertions(+), 53 deletions(-) create mode 100644 docusaurus/docs/protocol/tokenomics/_category_.json create mode 100644 docusaurus/docs/protocol/tokenomics/resources.md create mode 100644 docusaurus/docs/protocol/tokenomics/token_logic_modules.md diff --git a/api/poktroll/application/params.pulsar.go b/api/poktroll/application/params.pulsar.go index d7854990e..f4918ce45 100644 --- a/api/poktroll/application/params.pulsar.go +++ b/api/poktroll/application/params.pulsar.go @@ -437,6 +437,9 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // max_delegated_gateways defines the maximum number of gateways that a single + // application can delegate to. This is used to prevent performance issues + // in case the relay ring signature becomes too large. MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` } diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index ae7a1d67b..c0303e634 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -3330,8 +3330,8 @@ func (x *EventApplicationOverserviced) GetEffectiveBurn() *v1beta1.Coin { return nil } -// EventApplicationReimbursementRequest is emitted when an application requests a -// reimbursement +// EventApplicationReimbursementRequest is emitted when an application requests +// a reimbursement type EventApplicationReimbursementRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/docusaurus/docs/protocol/architecture/_category_.json b/docusaurus/docs/protocol/architecture/_category_.json index c4be422a5..985d17b7b 100644 --- a/docusaurus/docs/protocol/architecture/_category_.json +++ b/docusaurus/docs/protocol/architecture/_category_.json @@ -1,6 +1,6 @@ { - "label": "Architecture", - "position": 7, + "label": "[Outdated] Architecture", + "position": 6, "link": { "type": "generated-index", "description": "Documentation related to the high-level design, flows and components of the poktroll repo." diff --git a/docusaurus/docs/protocol/architecture/network.md b/docusaurus/docs/protocol/architecture/network.md index d0e25f1d3..b7949986e 100644 --- a/docusaurus/docs/protocol/architecture/network.md +++ b/docusaurus/docs/protocol/architecture/network.md @@ -1,5 +1,5 @@ --- -title: Pocket Actors, Nodes & Data Availability Network +title: Outdated - Pocket Actors, Nodes & Data Availability Network sidebar_position: 1 --- diff --git a/docusaurus/docs/protocol/tokenomics/_category_.json b/docusaurus/docs/protocol/tokenomics/_category_.json new file mode 100644 index 000000000..c23caaa17 --- /dev/null +++ b/docusaurus/docs/protocol/tokenomics/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Tokenomics", + "position": 5, + "link": { + "type": "generated-index", + "description": "Documentation related to Pocket Network tokenomics." + } +} diff --git a/docusaurus/docs/protocol/tokenomics/resources.md b/docusaurus/docs/protocol/tokenomics/resources.md new file mode 100644 index 000000000..9b31e6ec1 --- /dev/null +++ b/docusaurus/docs/protocol/tokenomics/resources.md @@ -0,0 +1,18 @@ +--- +title: Tokenomics Resources +sidebar_position: 1 +--- + +# Tokenomics Resources + +The following resources serve as the foundation for the Shannon Upgrade Tokenomics. + +It is an active an ever evolving work, but the following resources are the best +starting references: + +- [Token Logic Module](https://docs.pokt.network/pokt-protocol/the-shannon-upgrade/proposed-tokenomics/token-logic-modules) design approach. +- [Shannon Tokenomics Static](https://github.com/pokt-network/shannon-tokenomics-static-tests) modeling & evaluation +- [Relay Mining](https://arxiv.org/abs/2305.10672) paper +- [Probabilistic Proofs](https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md) design + +Thank you to [@Rama_stdout](https://x.com/Rama_stdout), [@shane8burger](https://x.com/shane8burger) and [@olshansky](https://x.com/olshansky) for the contributions! diff --git a/docusaurus/docs/protocol/tokenomics/token_logic_modules.md b/docusaurus/docs/protocol/tokenomics/token_logic_modules.md new file mode 100644 index 000000000..3fd36ddd0 --- /dev/null +++ b/docusaurus/docs/protocol/tokenomics/token_logic_modules.md @@ -0,0 +1,157 @@ +--- +title: Token Logic Modules +sidebar_position: 2 +--- + +# Token Logic Modules + +- [Introduction](#introduction) +- [Background: Relay Mining Payable Relay Accumulation](#background-relay-mining-payable-relay-accumulation) +- [TLM Pre-processor: Claim Settlement Limit](#tlm-pre-processor-claim-settlement-limit) +- [TLM: Mint=Burn (MEB)](#tlm-mintburn-meb) +- [TLM: Global Mint (GM)](#tlm-global-mint-gm) +- [TLM: Global Mint Reimbursement Request (GMRR)](#tlm-global-mint-reimbursement-request-gmrr) + +## Introduction + +:::warning + +Note that this is an active WIP and the [resources here](./resources.md) are the best starting references to learn more. + +::: + +Token Logic Modules (TLMs) processing involves: + +1. `TLM pre-processing` - A general pre-processor determining the amount of coins to settle per claim +2. `TLM processing` - Individual processing each TLM independent of the other + +## Background: Relay Mining Payable Relay Accumulation + +Per **Algorithm 1** of the [Relay Mining paper](https://arxiv.org/pdf/2305.10672), +the maximum amount a supplier can claim from an application in a single session is +proportional to the Application's stake divided by the number of nodes in the session +as see in the following image: + +![Algorithm 1](https://github.com/user-attachments/assets/d1a61535-aa31-447d-88ea-c8d14dcb20c6) + +## TLM Pre-processor: Claim Settlement Limit + +**Prior to** processing each individual TLM, we need to understand if the amount claimed +by the supplier adheres to the maximum allowed per the limits set by Relay Mining. + +Suppliers always have the option to over-service an application (**i.e. do free work**), +in exchange for providing a good service to the network, but their on-chain rewards +are still limited as a function of the application's stake before the session started +and the number of nodes in the session. + +:::note + +TODO_POST_MAINNET: After the Shannon upgrade, the team at Grove has a lot of ideas +related to [supplier gossipin](https://www.notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7?pvs=4) but that +is out of scope for the initial implementation. + +::: + +```mermaid +--- +title: "Token Logic Modules Processor" +--- +flowchart TB + CSA(["Claim Settlement Amount (CSA)"]) + MCS(["MaxClaimPerSupplier (MCS)
= (AppStake / NumNodesPerSession)"]) + CC{"Is CSA > MCS?"} + Update(Set SA = MCS
Broadcast Event) + SOAE{{Application Overserviced
Event}} + TLMP[["TLM Processor (SA)"]] + + CSA -- CSA --> CC + MCS -- MCS --> CC + + Update -..-> SOAE + CC -- Yes --> Update + CC -- No
SA=CSA --> TLMP + Update -- SA=CSA --> TLMP + + TLMP --SA--> TLMBEM[[TLM: Burn Equals Mint]] + TLMP --SA--> TLMGI[[TLM: Global Inflation]] + TLMP --SA--> TLMGIRR[[TLM: Global Inflation Reimbursment Request]] + + classDef tlm fill:#54ebd5,stroke:#333,stroke-width:2px; + classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; + classDef event fill:#e8b761,stroke:#333,stroke-width:2px; + + class TLMP,TLMBEM,TLMGI,TLMGIRR tlm; + class SOAE event; + class CC question; +``` + +## TLM: Mint=Burn (MEB) + +The `Mint=Burn` TLM is, _theoretically_, the only TLM necessary when the network +reaches equilibrium in the far future. + +Put simply, it is a transfer of tokens from the application to the supplier based on the +amount of work done by the supplier. + +The same amount of tokens that is minted in the supplier module is burned from the application module. +The stake of the application paying for work is reduced and the rewards are distributed to the supplier +and its revenue shareholder addresses. + +```mermaid +--- +title: "Token Logic Module: Mint=Burn" +--- +flowchart TD + SA(["Settlement Amount (SA)"]) + + SA -- Mint SA coins --> SM + SA -- Burn SA coins--> AM + + subgraph SO[Supplier Operations] + SM[[Supplier Module]] + SK[(Supplier Keeper)] + SD{Distribute SA coins} + OPA[Operator Address] + OA[Owner Address] + RSA[Revenue Share Addresses] + + SM -.- SK + SD -->|% Distribution
Increase Balance| OPA + SD -->|% Distribution
Increase Balance| OA + SD -->|% Distribution
Increase Balance| RSA + end + + subgraph AO[Application Operations] + AM[[Application Module]] + AK[(Application Keeper)] + AA[Application Address] + + AM -.- AK + AK -. Reduce Stake by CSA .-> AA + end + + SM --> SD + + + classDef module fill:#f9f,stroke:#333,stroke-width:2px; + classDef address fill:#bbf,stroke:#333,stroke-width:2px; + classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; + classDef event fill:#e8b761,stroke:#333,stroke-width:2px; + + class SM,AM module; + class RSA,OA,OPA,AA address; +``` + +## TLM: Global Mint (GM) + +TLMGlobalMint is the token logic module that mints new tokens based on the +on global governance parameters in order to reward the participants providing +services while keeping inflation in check. + +## TLM: Global Mint Reimbursement Request (GMRR) + +TLMGlobalMintReimbursementRequest is the token logic module that complements +TLMGlobalMint to enable permissionless demand. In order to prevent self-dealing +attacks, applications will be overcharged by the amount equal to global inflation, +those funds will be sent to the DAO/PNF, and event will be emitted to be used +for reimbursements. diff --git a/docusaurus/docs/protocol/upgrades/_category_.json b/docusaurus/docs/protocol/upgrades/_category_.json index 5fe4a715b..2e80f4c80 100644 --- a/docusaurus/docs/protocol/upgrades/_category_.json +++ b/docusaurus/docs/protocol/upgrades/_category_.json @@ -1,6 +1,6 @@ { "label": "Upgrades", - "position": 7, + "position": 4, "link": { "type": "generated-index", "description": "Documentation related to Pocket Network protocol upgrades." diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 843186b0d..d54992c82 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -19,7 +19,11 @@ import ( var _ relayer.SessionTree = (*sessionTree)(nil) // sessionTree is an implementation of the SessionTree interface. -// TODO_TEST: Add tests to the sessionTree. +// TODO_BETA(@red-0ne): Per the Relay Mining paper, we need to optimistically store +// the number of requests that an application can pay for. This needs to be tracked +// based on the app's stake in the beginning of a session and the number of nodes +// per session. An operator should be able to specify "overservicing_okay" whereby +// it keeps replying to requests even though it may not get paid for them. type sessionTree struct { // sessionMu is a mutex used to protect sessionTree operations from concurrent access. sessionMu *sync.Mutex @@ -65,6 +69,7 @@ type sessionTree struct { // NewSessionTree creates a new sessionTree from a Session and a storePrefix. It also takes a function // removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. // It returns an error if the KVStore fails to be created. +// TODO_BETA(@red-0ne): When starting a new session, check how many relays the app can handle. func NewSessionTree( sessionHeader *sessiontypes.SessionHeader, supplierOperatorAddress *cosmostypes.AccAddress, diff --git a/proto/poktroll/shared/service.proto b/proto/poktroll/shared/service.proto index 4777b0ccb..f6aa00d78 100644 --- a/proto/poktroll/shared/service.proto +++ b/proto/poktroll/shared/service.proto @@ -13,7 +13,7 @@ message Service { // For example, what if we want to request a session for a certain service but with some additional configs that identify it? string id = 1; // Unique identifier for the service - // TODO_MAINNET: Remove this. + // TODO_BETA: Either remove this or rename it to alias. string name = 2; // (Optional) Semantic human readable name for the service // The cost of a single relay for this service in terms of compute units. @@ -30,7 +30,7 @@ message Service { // ApplicationServiceConfig holds the service configuration the application stakes for message ApplicationServiceConfig { - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service service = 1; // The Service for which the application is configured // TODO_MAINNET: There is an opportunity for applications to advertise the max @@ -40,7 +40,7 @@ message ApplicationServiceConfig { // SupplierServiceConfig holds the service configuration the supplier stakes for message SupplierServiceConfig { - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service service = 1; // The Service for which the supplier is configured repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service repeated ServiceRevenueShare rev_share = 3; // List of revenue share configurations for the service diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 76ef86e5c..00a089f8f 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -44,16 +44,25 @@ message EventRelayMiningDifficultyUpdated { uint64 new_num_relays_ema = 5; } -// EventApplicationOverserviced is emitted when an application has less stake -// than the expected burn. +// EventApplicationOverserviced is emitted when an application has less stake than +// what a supplier is claiming (i.e. burn is not high enough). message EventApplicationOverserviced { string application_addr = 1; + string supplier_addr = 2; + cosmos.base.v1beta1.Coin expected_burn = 3; + cosmos.base.v1beta1.Coin effective_burn = 4; +} + +// EventSupplierExceededClaimableAmount is emitted when a supplier application has less stake +// than the expected burn. +message EventSupplierExceededClaimableAmount { + string supplier_addr = 1; cosmos.base.v1beta1.Coin expected_burn = 2; cosmos.base.v1beta1.Coin effective_burn = 3; } -// EventApplicationReimbursementRequest is emitted when an application requests a -// reimbursement +// EventApplicationReimbursementRequest is emitted when an application requests +// a reimbursement message EventApplicationReimbursementRequest { string application_addr = 1; string service_id = 2; diff --git a/x/application/types/params.pb.go b/x/application/types/params.pb.go index a2caf90b1..227e0f149 100644 --- a/x/application/types/params.pb.go +++ b/x/application/types/params.pb.go @@ -26,6 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // max_delegated_gateways defines the maximum number of gateways that a single + // application can delegate to. This is used to prevent performance issues + // in case the relay ring signature becomes too large. MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways" yaml:"max_delegated_gateways"` } diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go index e0711dd3a..60c292836 100644 --- a/x/session/keeper/session_hydrator.go +++ b/x/session/keeper/session_hydrator.go @@ -59,6 +59,7 @@ func NewSessionHydrator( // GetSession implements of the exposed `UtilityModule.GetSession` function // TECHDEBT(#519,#348): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. +// TODO_BETA: Consider returning an error if the application's stake has become very low. func (k Keeper) HydrateSession(ctx context.Context, sh *sessionHydrator) (*types.Session, error) { logger := k.Logger().With("method", "hydrateSession") diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 0190d78b3..99cff2611 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -98,6 +98,7 @@ type TokenLogicModuleProcessor func( var tokenLogicModuleProcessorMap = map[TokenLogicModule]TokenLogicModuleProcessor{ TLMRelayBurnEqualsMint: Keeper.TokenLogicModuleRelayBurnEqualsMint, TLMGlobalMint: Keeper.TokenLogicModuleGlobalMint, + // TLMGlobalMintReimbursementRequest: Keeper.TokenLogicModuleGlobalMintReimbursementRequest, } func init() { @@ -107,9 +108,9 @@ func init() { } } -// ProcessTokenLogicModules is responsible for calling all of the token logic -// modules (i.e. post session claim accounting) necessary to burn, mint or transfer -// tokens as a result of the amount of work (i.e. compute units) done. +// ProcessTokenLogicModules is the main TLM processor. It is responsible for calling +// all of the token logic module necessary to limit, burn, mint or transfer tokens +// as a result of the amount of work (i.e. compute units) done and governance parameters. func (k Keeper) ProcessTokenLogicModules( ctx context.Context, claim *prooftypes.Claim, // IMPORTANT: It is assumed the proof for the claim has been validated BEFORE calling this function @@ -117,17 +118,17 @@ func (k Keeper) ProcessTokenLogicModules( logger := k.Logger().With("method", "ProcessTokenLogicModules") // Declaring variables that will be emitted by telemetry - settlementCoin := cosmostypes.NewCoin("upokt", math.NewInt(0)) + claimSettlementCoin := cosmostypes.NewCoin("upokt", math.NewInt(0)) isSuccessful := false // This is emitted only when the function returns (successful or not) defer telemetry.EventSuccessCounter( "process_token_logic_modules", func() float32 { - if settlementCoin.Amount.BigInt() == nil { + if claimSettlementCoin.Amount.BigInt() == nil { return 0 } - return float32(settlementCoin.Amount.Int64()) + return float32(claimSettlementCoin.Amount.Int64()) }, func() bool { return isSuccessful }, ) @@ -196,6 +197,7 @@ func (k Keeper) ProcessTokenLogicModules( if err != nil { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("%v", err) } + // TODO_POST_MAINNET: Because of how things have evolved, we are now using // root.Count (numRelays) instead of root.Sum (numComputeUnits) to determine // the amount of work done. This is because the compute_units_per_relay is @@ -207,7 +209,7 @@ func (k Keeper) ProcessTokenLogicModules( // Determine the total number of tokens that'll be used for settling the session. // When the network achieves equilibrium, this will be the mint & burn. - settlementCoin, err = k.numRelaysToCoin(ctx, numRelays, &service) + claimSettlementCoin, err = k.numRelaysToCoin(ctx, numRelays, &service) if err != nil { return err } @@ -230,18 +232,33 @@ func (k Keeper) ProcessTokenLogicModules( // Helpers for logging the same metadata throughout this function calls logger = logger.With( "num_relays", numRelays, - "num_settlement_upokt", settlementCoin.Amount, + "claim_settlement_upokt", claimSettlementCoin.Amount, "session_id", sessionHeader.GetSessionId(), "service_id", sessionHeader.GetService().Id, "supplier_operator", supplier.OperatorAddress, "application", application.Address, ) - logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays equaling to (%s) coins", numRelays, settlementCoin)) + logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays equaling to (%s) upokt claimed", numRelays, claimSettlementCoin)) + + maxClaimableAmount := application.GetStake().QuoUint64(uint64(relayMiningDifficulty.NumNodesPerSession)) + + // Reduce the settlement amount if the application was over-serviced + var actualSettlementCoin cosmostypes.Coin + if application.GetStake().IsLT(claimSettlementCoin) { + actualSettlementCoin, err = k.handleOverservicedApplication(ctx, &application, claimSettlementCoin) + if err != nil { + return err + } + logger.Warn(fmt.Sprintf("Application with address %s was over-serviced so the actual amount being settled is (%v) instead of the claimed amount (%v) ", application.Address, actualSettlementCoin, claimSettlementCoin)) + } else { + actualSettlementCoin = claimSettlementCoin + } + logger = logger.With("actual_settlement_upokt", actualSettlementCoin) // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting to execute TLM %q", tlm)) - if err := tlmProcessor(k, ctx, &service, &application, &supplier, settlementCoin, &relayMiningDifficulty); err != nil { + if err := tlmProcessor(k, ctx, &service, claim.SessionHeader, &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { return err } logger.Info(fmt.Sprintf("Finished executing TLM %q", tlm)) @@ -277,7 +294,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( return err } - // NB: We are doing a mint & burn + transfer, instead of a simple transfer + // DEV_NOTE: We are doing a mint & burn + transfer, instead of a simple transfer // of funds from the supplier to the application in order to enable second // order economic effects with more optionality. This could include funds // going to pnf, delegators, enabling bonuses/rebates, etc... @@ -305,19 +322,6 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( } logger.Info(fmt.Sprintf("sent (%v) from the supplier module to the supplier account with address %q", settlementCoin, supplier.OperatorAddress)) - // TODO_MAINNET: Decide on the behaviour here when an app is over serviced. - // If an app has 10 POKT staked, but the supplier earned 20 POKT. We still - // end up minting 20 POKT but only burn 10 POKT from the app. There are - // questions and nuance here that needs to be addressed. - - // Verify that the application has enough uPOKT to pay for the services it consumed - if application.GetStake().IsLT(settlementCoin) { - settlementCoin, err = k.handleOverservicedApplication(ctx, application, settlementCoin) - if err != nil { - return err - } - } - // Burn uPOKT from the application module account which was held in escrow // on behalf of the application account. if err = k.bankKeeper.BurnCoins( @@ -404,8 +408,8 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Check and log the total amount of coins distributed totalDistributedCoins := appCoin.Add(supplierCoin).Add(*daoCoin).Add(*serviceCoin).Add(*proposerCoin) - if totalDistributedCoins.Amount.BigInt().Cmp(settlementCoin.Amount.BigInt()) != 0 { - logger.Error(fmt.Sprintf("TODO_MAINNET: Verify why the total distributed coins (%v) do not equal the settlement coins (%v). Likely floating point arithmetic.", totalDistributedCoins, settlementCoin.Amount.BigInt())) + if totalDistributedCoins.Amount.BigInt().Cmp(newMintCoins[0].Amount.BigInt()) != 0 { + return tokenomictypes.ErrTokenomicsAmountMismatch.Wrapf("the total distributed coins (%v) do not equal the settlement coins (%v). Likely floating point arithmetic.", totalDistributedCoins, settlementCoin.Amount.BigInt()) } logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalDistributedCoins)) @@ -435,15 +439,13 @@ func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( settlementCoins cosmostypes.Coin, relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error { - logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") + // logger := k.Logger().With("method", "TokenLogicModuleGlobalMintReimbursementRequest") // Determine how much new uPOKT to mint based on global inflation newMintCoins, _ := calculateGlobalMintAllocationFromSettlementAmount(settlementCoins) - - // EventApplicationReimbursementRequest - reimbursementRequest := tokenomictypes.EventApplicationReimbursementRequest{ + reimbursementRequestEvent := tokenomictypes.EventApplicationReimbursementRequest{ ApplicationAddr: application.Address, ServiceId: service.Id, SessionId: sessionHeader.SessionId, @@ -451,7 +453,7 @@ func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( } eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() - if err := eventManager.EmitTypedEvent(&reimbursementRequest); err != nil { + if err := eventManager.EmitTypedEvent(&reimbursementRequestEvent); err != nil { return tokenomicstypes.ErrTokenomicsApplicationReimbursementRequestFailed.Wrapf( "application address: %s; service Id %s; session Id: %s; amount: %s", application.GetAddress(), @@ -496,20 +498,25 @@ func (k Keeper) sendRewardsToAccount( return &coinToAcc, nil } +// handleOverservicedApplication handles the case where an application has been over-serviced. +// Per Algorithm #1 in the Relay Mining paper, the maximum amount that a single supplier +// can claim in a session is AppStake/NumNodesPerSession. +// If this is not the case, then the supplier essentially did "free work" and the actual +// claim amount is less than what was claimed. +// Ref: https://arxiv.org/pdf/2305.10672 func (k Keeper) handleOverservicedApplication( ctx context.Context, application *apptypes.Application, - settlementCoins cosmostypes.Coin, + claimSettlementCoin cosmostypes.Coin, ) ( - newSettlementCoins cosmostypes.Coin, + actualSettlementCoins cosmostypes.Coin, err error, ) { logger := k.Logger().With("method", "handleOverservicedApplication") - // over-serviced application logger.Warn(fmt.Sprintf( "THIS SHOULD NEVER HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", application.Address, - settlementCoins, + claimSettlementCoin, application.Stake, )) @@ -518,7 +525,7 @@ func (k Keeper) handleOverservicedApplication( // probabilistic proofs and add all the parameter logic. Do we touch the application balance? // Do we just let it go into debt? Do we penalize the application? Do we unstake it? Etc... // See this document from @red-0ne and @bryanchriswhite for more context: notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7 - expectedBurn := settlementCoins + expectedBurn := claimSettlementCoin applicationOverservicedEvent := &tokenomicstypes.EventApplicationOverserviced{ ApplicationAddr: application.Address, @@ -535,6 +542,9 @@ func (k Keeper) handleOverservicedApplication( application.GetStake().String(), ) } + + // TODO(@red-0ne) + return *application.Stake, nil } @@ -592,7 +602,7 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( shareAmountMap := GetShareAmountMap(serviceRevShare, amountToDistribute) for shareHolderAddress, shareAmount := range shareAmountMap { - // TODO_IN_THIS_PR: Why don't we use sendRewardsToAccount here? + // TODO_TECHDEBT(@red-0ne): Refactor to reuse the sendRewardsToAccount helper here. shareAmountCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(int64(shareAmount))) shareAmountCoins := cosmostypes.NewCoins(shareAmountCoin) shareHolderAccAddress, err := sdk.AccAddressFromBech32(shareHolderAddress) diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 6e7c23a0d..91b2d761e 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -33,4 +33,5 @@ var ( ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1124, "the supplier owner address in the claim is not a valid bech32 address") ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") + ErrTokenomicsAmountMismatch = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") ) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 945d4ab97..1585b4fcf 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -335,8 +335,8 @@ func (m *EventApplicationOverserviced) GetEffectiveBurn() *types1.Coin { return nil } -// EventApplicationReimbursementRequest is emitted when an application requests a -// reimbursement +// EventApplicationReimbursementRequest is emitted when an application requests +// a reimbursement type EventApplicationReimbursementRequest struct { ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` ServiceId string `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` From 846bc1d08f13d4b3903edbcb502ec9fcb03bc262 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 21 Aug 2024 14:55:06 -0400 Subject: [PATCH 03/48] Finished first version of the documentation --- api/poktroll/shared/service.pulsar.go | 6 +- api/poktroll/tokenomics/event.pulsar.go | 176 +++++++--- .../docs/protocol/tokenomics/resources.md | 9 +- .../tokenomics/token_logic_modules.md | 200 ++++++++++-- proto/poktroll/tokenomics/event.proto | 15 +- x/session/keeper/session_hydrator.go | 2 +- x/session/keeper/session_hydrator_test.go | 2 +- x/shared/types/service.pb.go | 6 +- x/tokenomics/keeper/token_logic_modules.go | 301 +++++++++--------- .../keeper/token_logic_modules_test.go | 3 + .../keeper/update_relay_mining_difficulty.go | 35 +- x/tokenomics/types/errors.go | 2 +- x/tokenomics/types/event.pb.go | 173 ++++++---- 13 files changed, 601 insertions(+), 329 deletions(-) diff --git a/api/poktroll/shared/service.pulsar.go b/api/poktroll/shared/service.pulsar.go index 9ca7b82a1..973ed5071 100644 --- a/api/poktroll/shared/service.pulsar.go +++ b/api/poktroll/shared/service.pulsar.go @@ -3420,7 +3420,7 @@ type Service struct { // For example, what if we want to request a session for a certain service but with some additional configs that identify it? Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the service - // TODO_MAINNET: Remove this. + // TODO_BETA: Either remove this or rename it to alias. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // (Optional) Semantic human readable name for the service // The cost of a single relay for this service in terms of compute units. // Must be used alongside the global 'compute_units_to_tokens_multipler' to calculate the cost of a relay for this service. @@ -3487,7 +3487,7 @@ type ApplicationServiceConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the application is configured } @@ -3524,7 +3524,7 @@ type SupplierServiceConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is configured Endpoints []*SupplierEndpoint `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // List of endpoints for the service RevShare []*ServiceRevenueShare `protobuf:"bytes,3,rep,name=rev_share,json=revShare,proto3" json:"rev_share,omitempty"` // List of revenue share configurations for the service diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index c0303e634..52ef98cfa 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -1820,6 +1820,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto var ( md_EventApplicationOverserviced protoreflect.MessageDescriptor fd_EventApplicationOverserviced_application_addr protoreflect.FieldDescriptor + fd_EventApplicationOverserviced_supplier_addr protoreflect.FieldDescriptor fd_EventApplicationOverserviced_expected_burn protoreflect.FieldDescriptor fd_EventApplicationOverserviced_effective_burn protoreflect.FieldDescriptor ) @@ -1828,6 +1829,7 @@ func init() { file_poktroll_tokenomics_event_proto_init() md_EventApplicationOverserviced = File_poktroll_tokenomics_event_proto.Messages().ByName("EventApplicationOverserviced") fd_EventApplicationOverserviced_application_addr = md_EventApplicationOverserviced.Fields().ByName("application_addr") + fd_EventApplicationOverserviced_supplier_addr = md_EventApplicationOverserviced.Fields().ByName("supplier_addr") fd_EventApplicationOverserviced_expected_burn = md_EventApplicationOverserviced.Fields().ByName("expected_burn") fd_EventApplicationOverserviced_effective_burn = md_EventApplicationOverserviced.Fields().ByName("effective_burn") } @@ -1903,6 +1905,12 @@ func (x *fastReflection_EventApplicationOverserviced) Range(f func(protoreflect. return } } + if x.SupplierAddr != "" { + value := protoreflect.ValueOfString(x.SupplierAddr) + if !f(fd_EventApplicationOverserviced_supplier_addr, value) { + return + } + } if x.ExpectedBurn != nil { value := protoreflect.ValueOfMessage(x.ExpectedBurn.ProtoReflect()) if !f(fd_EventApplicationOverserviced_expected_burn, value) { @@ -1932,6 +1940,8 @@ func (x *fastReflection_EventApplicationOverserviced) Has(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": return x.ApplicationAddr != "" + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + return x.SupplierAddr != "" case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": return x.ExpectedBurn != nil case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -1954,6 +1964,8 @@ func (x *fastReflection_EventApplicationOverserviced) Clear(fd protoreflect.Fiel switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": x.ApplicationAddr = "" + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + x.SupplierAddr = "" case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": x.ExpectedBurn = nil case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -1977,6 +1989,9 @@ func (x *fastReflection_EventApplicationOverserviced) Get(descriptor protoreflec case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": value := x.ApplicationAddr return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + value := x.SupplierAddr + return protoreflect.ValueOfString(value) case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": value := x.ExpectedBurn return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -2005,6 +2020,8 @@ func (x *fastReflection_EventApplicationOverserviced) Set(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": x.ApplicationAddr = value.Interface().(string) + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + x.SupplierAddr = value.Interface().(string) case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": x.ExpectedBurn = value.Message().Interface().(*v1beta1.Coin) case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -2041,6 +2058,8 @@ func (x *fastReflection_EventApplicationOverserviced) Mutable(fd protoreflect.Fi return protoreflect.ValueOfMessage(x.EffectiveBurn.ProtoReflect()) case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": panic(fmt.Errorf("field application_addr of message poktroll.tokenomics.EventApplicationOverserviced is not mutable")) + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + panic(fmt.Errorf("field supplier_addr of message poktroll.tokenomics.EventApplicationOverserviced is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationOverserviced")) @@ -2056,6 +2075,8 @@ func (x *fastReflection_EventApplicationOverserviced) NewField(fd protoreflect.F switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": return protoreflect.ValueOfString("") + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + return protoreflect.ValueOfString("") case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) @@ -2135,6 +2156,10 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.SupplierAddr) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.ExpectedBurn != nil { l = options.Size(x.ExpectedBurn) n += 1 + l + runtime.Sov(uint64(l)) @@ -2184,7 +2209,7 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if x.ExpectedBurn != nil { encoded, err := options.Marshal(x.ExpectedBurn) @@ -2198,6 +2223,13 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- + dAtA[i] = 0x1a + } + if len(x.SupplierAddr) > 0 { + i -= len(x.SupplierAddr) + copy(dAtA[i:], x.SupplierAddr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddr))) + i-- dAtA[i] = 0x12 } if len(x.ApplicationAddr) > 0 { @@ -2289,6 +2321,38 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface x.ApplicationAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExpectedBurn", wireType) } @@ -2324,7 +2388,7 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EffectiveBurn", wireType) } @@ -3277,16 +3341,24 @@ func (x *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { return 0 } -// EventApplicationOverserviced is emitted when an application has less stake -// than the expected burn. +// EventApplicationOverserviced is emitted when an application has less stake than +// what a supplier is claiming (i.e. burn is not high enough). type EventApplicationOverserviced struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - ExpectedBurn *v1beta1.Coin `protobuf:"bytes,2,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` - EffectiveBurn *v1beta1.Coin `protobuf:"bytes,3,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + SupplierAddr string `protobuf:"bytes,2,opt,name=supplier_addr,json=supplierAddr,proto3" json:"supplier_addr,omitempty"` + // Expected burn is the amount the supplier is claiming for work done + // to service the application during the session. + // This is usually the amount in the Claim object. + ExpectedBurn *v1beta1.Coin `protobuf:"bytes,3,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` + // Effective burn is the amount that is actually being paid to the supplier + // for the work done. It is less than the expected burn (claim amount) and + // most likely equal to the application's stake divided by the number of suppliers + // in a session. + EffectiveBurn *v1beta1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } func (x *EventApplicationOverserviced) Reset() { @@ -3316,6 +3388,13 @@ func (x *EventApplicationOverserviced) GetApplicationAddr() string { return "" } +func (x *EventApplicationOverserviced) GetSupplierAddr() string { + if x != nil { + return x.SupplierAddr + } + return "" +} + func (x *EventApplicationOverserviced) GetExpectedBurn() *v1beta1.Coin { if x != nil { return x.ExpectedBurn @@ -3460,50 +3539,53 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 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, 0x22, 0xcb, 0x01, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, + 0x79, 0x73, 0x45, 0x6d, 0x61, 0x22, 0xf0, 0x01, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, - 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x75, - 0x72, 0x6e, 0x18, 0x02, 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, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x75, 0x72, - 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x62, - 0x75, 0x72, 0x6e, 0x18, 0x03, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x42, - 0x75, 0x72, 0x6e, 0x22, 0xc2, 0x01, 0x0a, 0x24, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x69, 0x6d, 0x62, 0x75, 0x72, 0x73, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x04, 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, - 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, - 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, - 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, - 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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, + 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, + 0x65, 0x64, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x03, 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, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, + 0x65, 0x64, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x22, 0xc2, 0x01, 0x0a, 0x24, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x69, + 0x6d, 0x62, 0x75, 0x72, 0x73, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 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, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, + 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, + 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, + 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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/docusaurus/docs/protocol/tokenomics/resources.md b/docusaurus/docs/protocol/tokenomics/resources.md index 9b31e6ec1..b652b0349 100644 --- a/docusaurus/docs/protocol/tokenomics/resources.md +++ b/docusaurus/docs/protocol/tokenomics/resources.md @@ -5,10 +5,13 @@ sidebar_position: 1 # Tokenomics Resources -The following resources serve as the foundation for the Shannon Upgrade Tokenomics. +:::warning + +This is an active an ever evolving work. We are working on a single source of truth. -It is an active an ever evolving work, but the following resources are the best -starting references: +::: + +The following resources serve as the foundation for the Shannon Upgrade Tokenomics. - [Token Logic Module](https://docs.pokt.network/pokt-protocol/the-shannon-upgrade/proposed-tokenomics/token-logic-modules) design approach. - [Shannon Tokenomics Static](https://github.com/pokt-network/shannon-tokenomics-static-tests) modeling & evaluation diff --git a/docusaurus/docs/protocol/tokenomics/token_logic_modules.md b/docusaurus/docs/protocol/tokenomics/token_logic_modules.md index 3fd36ddd0..fd70d0fe9 100644 --- a/docusaurus/docs/protocol/tokenomics/token_logic_modules.md +++ b/docusaurus/docs/protocol/tokenomics/token_logic_modules.md @@ -6,8 +6,8 @@ sidebar_position: 2 # Token Logic Modules - [Introduction](#introduction) -- [Background: Relay Mining Payable Relay Accumulation](#background-relay-mining-payable-relay-accumulation) -- [TLM Pre-processor: Claim Settlement Limit](#tlm-pre-processor-claim-settlement-limit) +- [Background: Max Claimable Amount](#background-max-claimable-amount) +- [TLM (pre) Processing](#tlm-pre-processing) - [TLM: Mint=Burn (MEB)](#tlm-mintburn-meb) - [TLM: Global Mint (GM)](#tlm-global-mint-gm) - [TLM: Global Mint Reimbursement Request (GMRR)](#tlm-global-mint-reimbursement-request-gmrr) @@ -22,50 +22,58 @@ Note that this is an active WIP and the [resources here](./resources.md) are the Token Logic Modules (TLMs) processing involves: -1. `TLM pre-processing` - A general pre-processor determining the amount of coins to settle per claim -2. `TLM processing` - Individual processing each TLM independent of the other +1. `TLM pre-processing` - A general pre-processor determining the amount of tokens to settle per claim. +2. `TLM processing` - Iteration through all of the TLMs one by one. +3. `TLM processor` - Individual processing each TLM independent of one another. -## Background: Relay Mining Payable Relay Accumulation +## Background: Max Claimable Amount + +_tl;dr Max Claimable Amount ∝ (Application Stake / Number of Suppliers per Session)_ Per **Algorithm 1** of the [Relay Mining paper](https://arxiv.org/pdf/2305.10672), the maximum amount a supplier can claim from an application in a single session is -proportional to the Application's stake divided by the number of nodes in the session -as see in the following image: +proportional to the Application's stake divided by the number of suppliers in the session. + +This is referred to as "Relay Mining Payable Relay Accumulation" in the paper and +can be seen in the following image: ![Algorithm 1](https://github.com/user-attachments/assets/d1a61535-aa31-447d-88ea-c8d14dcb20c6) -## TLM Pre-processor: Claim Settlement Limit +## TLM (pre) Processing + +_tl;dr Determine if the claim settlement amount is greater than the maximum claimable amount and then run each individual TLM._ **Prior to** processing each individual TLM, we need to understand if the amount claimed -by the supplier adheres to the maximum allowed per the limits set by Relay Mining. +by the supplier adheres to the optimistic maxima set per the limits of Relay Mining. Suppliers always have the option to over-service an application (**i.e. do free work**), -in exchange for providing a good service to the network, but their on-chain rewards +in exchange for providing a good service to the network. This may lead to offchain +reputation benefits (e.g. Gateways favoring them), but their on-chain rewards are still limited as a function of the application's stake before the session started -and the number of nodes in the session. +and the number of suppliers in the session. :::note TODO_POST_MAINNET: After the Shannon upgrade, the team at Grove has a lot of ideas -related to [supplier gossipin](https://www.notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7?pvs=4) but that -is out of scope for the initial implementation. +related to on-chain reputation, [supplier gossiping](https://www.notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7?pvs=4), and +much more, but that is out of scope for the initial implementation. ::: ```mermaid --- -title: "Token Logic Modules Processor" +title: "Token Logic Modules (pre) Processing" --- flowchart TB CSA(["Claim Settlement Amount (CSA)"]) - MCS(["MaxClaimPerSupplier (MCS)
= (AppStake / NumNodesPerSession)"]) - CC{"Is CSA > MCS?"} - Update(Set SA = MCS
Broadcast Event) + MCA(["MaxClaimPerSupplier (MCA)
= (AppStake / NumSuppliersPerSession)"]) + CC{"Is CSA > MCA?"} + Update(Set SA = MCA
Broadcast Event) SOAE{{Application Overserviced
Event}} TLMP[["TLM Processor (SA)"]] CSA -- CSA --> CC - MCS -- MCS --> CC + MCA -- MCA --> CC Update -..-> SOAE CC -- Yes --> Update @@ -74,7 +82,7 @@ flowchart TB TLMP --SA--> TLMBEM[[TLM: Burn Equals Mint]] TLMP --SA--> TLMGI[[TLM: Global Inflation]] - TLMP --SA--> TLMGIRR[[TLM: Global Inflation Reimbursment Request]] + TLMP --SA--> TLMGIRR[[TLM: Global Inflation Reimbursement Request]] classDef tlm fill:#54ebd5,stroke:#333,stroke-width:2px; classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; @@ -87,15 +95,14 @@ flowchart TB ## TLM: Mint=Burn (MEB) +_tl;dr The transfer of tokens from the application to the supplier based on the amount of work received and provided respectively.._ + The `Mint=Burn` TLM is, _theoretically_, the only TLM necessary when the network reaches equilibrium in the far future. -Put simply, it is a transfer of tokens from the application to the supplier based on the -amount of work done by the supplier. - -The same amount of tokens that is minted in the supplier module is burned from the application module. -The stake of the application paying for work is reduced and the rewards are distributed to the supplier -and its revenue shareholder addresses. +The same amount of tokens that is minted in the **supplier module** is burned from +the **application module**. The stake of the application paying for work is reduced +and the rewards are distributed to the supplier and its revenue shareholder addresses. ```mermaid --- @@ -127,12 +134,12 @@ flowchart TD AA[Application Address] AM -.- AK - AK -. Reduce Stake by CSA .-> AA + AK -. Reduce Stake by SA .-> AA + AA -.- TODO{See TODO below} end SM --> SD - classDef module fill:#f9f,stroke:#333,stroke-width:2px; classDef address fill:#bbf,stroke:#333,stroke-width:2px; classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; @@ -140,18 +147,141 @@ flowchart TD class SM,AM module; class RSA,OA,OPA,AA address; + class TODO question; ``` +:::note + +TODO_MAINNET: If the application stake has dropped to (near?) zero, should +we unstake it? Should we use it's balance? Should their be a payee of last resort? +Make sure to document whatever decision we come to. + +::: + ## TLM: Global Mint (GM) -TLMGlobalMint is the token logic module that mints new tokens based on the -on global governance parameters in order to reward the participants providing -services while keeping inflation in check. +_tl;dr Distributed newly minted coins on a per claim basis to all involved stakeholders._ + +The `Global Mint` TLM is, _theoretically_, going to reach `zero`the only when the network +reaches equilibrium in the far future. + +On a per claim basis, the network mints new tokens based on the the amount of work +claimed. The newly minted tokens are distributed to the supplier, DAO, service owner +and application based on the values of various governance params. + +```mermaid +--- +title: "Token Logic Module: Global Mint" +--- +flowchart TD + SC(["Settlement Coin (SC)"]) + PCI(["Per Claim Global Inflation
(Governance Parameter)"]) + IMC(["Inflation Mint Coin (IMC)"]) + + DA(["DAO Mint Allocation"]) + PA(["Proposer Mint Allocation"]) + SA(["Supplier Mint Allocation"]) + SOA(["Source Owner Mint Allocation"]) + AA(["Application Mint Allocation"]) + + + SC --> IMC + PCI --> IMC + IMC --> TO + + subgraph TO[Tokenomics Operations] + TM[[Tokenomics Module]] + TK[(Tokenomics Keeper)] + TM -..- TK + end + + + DA --> ID + PA --> ID + TO -- New Mint Coin (NMC)--> ID + SA --> ID + AA --> ID + + subgraph ID[Inflation Distribution] + NMC["New Mint Coin (NMC)"] + APPA["Application Address"] + SPPA["Supplier Address"] + DAOA["DAO Address"] + SOA["Service Owner Address"] + PRA["Proposer Address"] + + NMC -->|% Mint Allocation| APPA + NMC -->|% Mint Allocation| SPPA + NMC -->|% Mint Allocation| DAOA + NMC -->|% Mint Allocation| SOA + NMC -->|% Mint Allocation| PRA + end + + classDef module fill:#f9f,stroke:#333,stroke-width:2px; + classDef address fill:#bbf,stroke:#333,stroke-width:2px; + classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; + classDef govparam fill:#d04a36,stroke:#333,stroke-width:2px; + classDef event fill:#e8b761,stroke:#333,stroke-width:2px; + + class TM module; + class PCI,DA,PA,SA,AA govparam; + class APPA,SPPA,DAOA,SOA,PRA address; +``` ## TLM: Global Mint Reimbursement Request (GMRR) -TLMGlobalMintReimbursementRequest is the token logic module that complements -TLMGlobalMint to enable permissionless demand. In order to prevent self-dealing -attacks, applications will be overcharged by the amount equal to global inflation, -those funds will be sent to the DAO/PNF, and event will be emitted to be used -for reimbursements. +_tl;dr Prevent self-dealing by over-charging applications, sending the excess to the DAO/PNF, and emitting an event as a reimbursement request._ + +This TLM **MUST** be processed alongside the Global Mint TLM. + +This TLM can, **theoretically**, be removed if self-dealing attacks are not a concern, +or if the global mint per claim governance parameter is set to zero. + +The goal of the TLM is to overcharge applications equal to the global inflation amount +and send those funds to the DAO/PNF. This forces potentially self-dealing gateways to +"show face" in front of the DAO/PNF and request reimbursement. + +The event emitted creates an easy, onchain mechanism, to track reimbursement handled offchain. + +A side effect of this TLM is creating additional buy pressure of the token as Applications +and Gateways will be responsible for frequently "topping up" their balances and app stakes. + +```mermaid +--- +title: "Token Logic Module: Global Mint Reimbursement Request" +--- +flowchart TD + SC(["Settlement Coin (SC)"]) + PCI(["Per Claim Global Inflation
(Governance Parameter)"]) + IMC(["Inflation Mint Coin (IMC)"]) + ARRE{{Application Reimbursement
Request Event}} + + SC --> IMC + PCI --> IMC + IMC --IMC--> AO + + + subgraph AO[Application Operations] + AM[[Application Module]] + AK[(Application Keeper)] + AA[Application Address] + DA[DAO Address] + + AM -.- AK + AK -. Reduce Stake by IMC .-> AA + AM -..-> |Increase Balance by IMC| DA + end + + AO -. Emit Event.-> ARRE + + classDef module fill:#f9f,stroke:#333,stroke-width:2px; + classDef address fill:#bbf,stroke:#333,stroke-width:2px; + classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; + classDef govparam fill:#d04a36,stroke:#333,stroke-width:2px; + classDef event fill:#e8b761,stroke:#333,stroke-width:2px; + + class AM module; + class ARRE event; + class PCI govparam; + class AA,DA address; +``` diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 00a089f8f..e7f698aea 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -49,18 +49,17 @@ message EventRelayMiningDifficultyUpdated { message EventApplicationOverserviced { string application_addr = 1; string supplier_addr = 2; + // Expected burn is the amount the supplier is claiming for work done + // to service the application during the session. + // This is usually the amount in the Claim object. cosmos.base.v1beta1.Coin expected_burn = 3; + // Effective burn is the amount that is actually being paid to the supplier + // for the work done. It is less than the expected burn (claim amount) and + // most likely equal to the application's stake divided by the number of suppliers + // in a session. cosmos.base.v1beta1.Coin effective_burn = 4; } -// EventSupplierExceededClaimableAmount is emitted when a supplier application has less stake -// than the expected burn. -message EventSupplierExceededClaimableAmount { - string supplier_addr = 1; - cosmos.base.v1beta1.Coin expected_burn = 2; - cosmos.base.v1beta1.Coin effective_burn = 3; -} - // EventApplicationReimbursementRequest is emitted when an application requests // a reimbursement message EventApplicationReimbursementRequest { diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go index 60c292836..bf7420e6d 100644 --- a/x/session/keeper/session_hydrator.go +++ b/x/session/keeper/session_hydrator.go @@ -20,8 +20,8 @@ import ( var SHA3HashLen = crypto.SHA3_256.Size() -// TODO_BLOCKER(@bryanchriswhite, #21): Make these configurable governance param const ( + // TODO_BETA(@bryanchriswhite): Make this a governance parameter NumSupplierPerSession = 15 SessionIDComponentDelimiter = "." ) diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go index d70c148b7..f0b3cf0ad 100644 --- a/x/session/keeper/session_hydrator_test.go +++ b/x/session/keeper/session_hydrator_test.go @@ -289,7 +289,7 @@ func TestSession_HydrateSession_Application(t *testing.T) { // TODO_TEST: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support func TestSession_HydrateSession_Suppliers(t *testing.T) { - // TODO_TEST: Extend these tests once `NumBlocksPerSession` is configurable. + // TODO_BETA(@bryanchriswhite): Extend these tests once `NumBlocksPerSession` is configurable. // Currently assumes NumSupplierPerSession=15 tests := []struct { // Description diff --git a/x/shared/types/service.pb.go b/x/shared/types/service.pb.go index 3bbb2d31d..22ed750a8 100644 --- a/x/shared/types/service.pb.go +++ b/x/shared/types/service.pb.go @@ -93,7 +93,7 @@ func (ConfigOptions) EnumDescriptor() ([]byte, []int) { type Service struct { // For example, what if we want to request a session for a certain service but with some additional configs that identify it? Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // TODO_MAINNET: Remove this. + // TODO_BETA: Either remove this or rename it to alias. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The cost of a single relay for this service in terms of compute units. // Must be used alongside the global 'compute_units_to_tokens_multipler' to calculate the cost of a relay for this service. @@ -169,7 +169,7 @@ func (m *Service) GetOwnerAddress() string { // ApplicationServiceConfig holds the service configuration the application stakes for type ApplicationServiceConfig struct { - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` } @@ -215,7 +215,7 @@ func (m *ApplicationServiceConfig) GetService() *Service { // SupplierServiceConfig holds the service configuration the supplier stakes for type SupplierServiceConfig struct { - // TODO_MAINNET: Avoid embedding the full Service because we just need the ID. + // TODO_BETA: Avoid embedding the full Service because we just need the ID. Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Endpoints []*SupplierEndpoint `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"` RevShare []*ServiceRevenueShare `protobuf:"bytes,3,rep,name=rev_share,json=revShare,proto3" json:"rev_share,omitempty"` diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 99cff2611..a05b1aee2 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -1,14 +1,11 @@ package keeper -// References: -// - https://docs.pokt.network/pokt-protocol/the-shannon-upgrade/proposed-tokenomics/token-logic-modules -// - https://github.com/pokt-network/shannon-tokenomics-static-tests - import ( "context" "fmt" "math/big" + "cosmossdk.io/log" "cosmossdk.io/math" cosmostypes "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,6 +16,7 @@ import ( "github.com/pokt-network/poktroll/telemetry" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" @@ -28,11 +26,12 @@ import ( const ( // Governance parameters for the TLMGlobalMint module - // TODO_UPNEXT(@olshansk): Remove this. An ephemeral placeholder before + // TODO_BETA_TEST(@olshansk): Remove this. It is an ephemeral placeholder before // real values are introduced. When this is changed to a governance param, // make sure to also add the necessary unit tests. - MintGlobalInflation = 0.0000000 - // TODO_UPNEXT(@olshansk): Make all of the governance params + MintPerClaimGlobalInflation = 0.0000000 + + // TODO_BETA: Make all of the governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 MintAllocationSupplier = 0.7 @@ -44,8 +43,8 @@ type TokenLogicModule int const ( // TLMRelayBurnEqualsMint is the token logic module that burns the application's - // stake based on the amount of work done by the supplier. The same amount of - // tokens is minted and sent to the supplier. + // stake based on the amount of work done by the supplier. + // The same amount of tokens is minted and sent to the supplier. // When the network achieves equilibrium, this is theoretically the only TLM that will be necessary. TLMRelayBurnEqualsMint TokenLogicModule = iota @@ -57,8 +56,8 @@ const ( // TLMGlobalMintReimbursementRequest is the token logic module that complements // TLMGlobalMint to enable permissionless demand. In order to prevent self-dealing // attacks, applications will be overcharged by the amount equal to global inflation, - // those funds will be sent to the DAO/PNF, and event will be emitted to be used - // for reimbursements. + // those funds will be sent to the DAO/PNF, and an event will be emitted to track + // and send reimbursements; managed offchain by PNF. // TODO_POST_MAINNET: Introduce proper tokenomics based on the research done by @rawthil and @shane. TLMGlobalMintReimbursementRequest ) @@ -79,10 +78,10 @@ func (tlm TokenLogicModule) EnumIndex() int { // TokenLogicModuleProcessor is the method signature that all token logic modules // are expected to implement. -// IMPORTANT SIDE EFFECTS: Please note that TLMS may update the application and supplier -// objects, which is why they are passed in as pointers. However, this IS NOT persisted. -// The persistence to the keeper is currently done by ProcessTokenLogicModules only. -// This may be an interim state of the implementation and may change in the future. +// IMPORTANT_SIDE_EFFECTS: Please note that TLMs may update the application and supplier +// objects, which is why they are passed in as pointers. NOTE THAT THIS IS NOT PERSISTED. +// The persistence to the keeper is currently done by the TLM processor: ProcessTokenLogicModules. +// This design and separation of concerns may change in the future. type TokenLogicModuleProcessor func( Keeper, context.Context, @@ -94,10 +93,11 @@ type TokenLogicModuleProcessor func( *tokenomictypes.RelayMiningDifficulty, ) error -// tokenLogicModuleProcessorMap is a map of token logic modules to their respective processors. +// tokenLogicModuleProcessorMap is a map of TLMs to their respective independent processors. var tokenLogicModuleProcessorMap = map[TokenLogicModule]TokenLogicModuleProcessor{ TLMRelayBurnEqualsMint: Keeper.TokenLogicModuleRelayBurnEqualsMint, TLMGlobalMint: Keeper.TokenLogicModuleGlobalMint, + // TODO_BETA_UPNEXT(@Olshansky): Uncomment this and add tests. // TLMGlobalMintReimbursementRequest: Keeper.TokenLogicModuleGlobalMintReimbursementRequest, } @@ -108,16 +108,18 @@ func init() { } } -// ProcessTokenLogicModules is the main TLM processor. It is responsible for calling -// all of the token logic module necessary to limit, burn, mint or transfer tokens -// as a result of the amount of work (i.e. compute units) done and governance parameters. +// ProcessTokenLogicModules is the main TLM processor. It is responsible for running +// all of the independent TLMs necessary to limit, burn, mint or transfer tokens +// as a result of the amount of work (i.e. relays, compute units) done in proportion +// to the global governance parameters. +// IMPORTANT: It is assumed the proof for the claim has been validated BEFORE calling this function. func (k Keeper) ProcessTokenLogicModules( ctx context.Context, - claim *prooftypes.Claim, // IMPORTANT: It is assumed the proof for the claim has been validated BEFORE calling this function + claim *prooftypes.Claim, ) (err error) { logger := k.Logger().With("method", "ProcessTokenLogicModules") - // Declaring variables that will be emitted by telemetry + // Telemetry variable declaration to be emitted a the end of the function claimSettlementCoin := cosmostypes.NewCoin("upokt", math.NewInt(0)) isSuccessful := false @@ -133,7 +135,7 @@ func (k Keeper) ProcessTokenLogicModules( func() bool { return isSuccessful }, ) - // Ensure the claim is not nil + // Sanity check the claim is not nil. Validation of the claim is expected by the caller. if claim == nil { logger.Error("received a nil claim") return tokenomicstypes.ErrTokenomicsClaimNil @@ -150,22 +152,8 @@ func (k Keeper) ProcessTokenLogicModules( return tokenomicstypes.ErrTokenomicsSessionHeaderInvalid } - // Retrieve the supplier operator address that will be getting rewarded; providing services - supplierOperatorAddr, err := cosmostypes.AccAddressFromBech32(claim.GetSupplierOperatorAddress()) - if err != nil || supplierOperatorAddr == nil { - return tokenomicstypes.ErrTokenomicsSupplierOperatorAddressInvalid - } - - // Retrieve the application address that is being charged; getting services - applicationAddress, err := cosmostypes.AccAddressFromBech32(sessionHeader.GetApplicationAddress()) - if err != nil || applicationAddress == nil { - return tokenomicstypes.ErrTokenomicsApplicationAddressInvalid - } - - // Retrieve the root of the claim to determine the amount of work done + // Retrieve and validate the root of the claim to determine the amount of work done root := (smt.MerkleSumRoot)(claim.GetRootHash()) - - // Ensure the root hash is valid if !root.HasDigestSize(protocol.TrieHasherSize) { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf( "root hash has invalid digest size (%d), expected (%d)", @@ -173,6 +161,29 @@ func (k Keeper) ProcessTokenLogicModules( ) } + // Retrieve the count (i.e. number of relays) to determine the amount of work done + numRelays, err := root.Count() + if err != nil { + return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("%v", err) + } + + /* + TODO_POST_MAINNET: Because of how things have evolved, we are now using + root.Count (numRelays) instead of root.Sum (numComputeUnits) to determine + the amount of work done. This is because the compute_units_per_relay is + a service specific (not request specific) parameter that will be maintained + by the service owner to capture the average amount of resources (i.e. + compute, storage, bandwidth, electricity, etc...) per request. Modifying + this on a per request basis has been deemed too complex and not a mainnet + blocker. + */ + + // Retrieve the application address that is being charged; getting services and paying tokens + applicationAddress, err := cosmostypes.AccAddressFromBech32(sessionHeader.GetApplicationAddress()) + if err != nil || applicationAddress == nil { + return tokenomicstypes.ErrTokenomicsApplicationAddressInvalid + } + // Retrieve the on-chain staked application record application, isAppFound := k.applicationKeeper.GetApplication(ctx, applicationAddress.String()) if !isAppFound { @@ -180,6 +191,12 @@ func (k Keeper) ProcessTokenLogicModules( return tokenomicstypes.ErrTokenomicsApplicationNotFound } + // Retrieve the supplier operator address that will be getting rewarded; providing services and earning tokens + supplierOperatorAddr, err := cosmostypes.AccAddressFromBech32(claim.GetSupplierOperatorAddress()) + if err != nil || supplierOperatorAddr == nil { + return tokenomicstypes.ErrTokenomicsSupplierOperatorAddressInvalid + } + // Retrieve the on-chain staked supplier record supplier, isSupplierFound := k.supplierKeeper.GetSupplier(ctx, supplierOperatorAddr.String()) if !isSupplierFound { @@ -187,48 +204,20 @@ func (k Keeper) ProcessTokenLogicModules( return tokenomicstypes.ErrTokenomicsSupplierNotFound } + // Retrieve the service that the supplier is providing service, isServiceFound := k.serviceKeeper.GetService(ctx, sessionHeader.Service.Id) if !isServiceFound { return tokenomicstypes.ErrTokenomicsServiceNotFound.Wrapf("service with ID %q not found", sessionHeader.Service.Id) } - // Retrieve the count (i.e. number of relays) to determine the amount of work done - numRelays, err := root.Count() - if err != nil { - return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("%v", err) - } - - // TODO_POST_MAINNET: Because of how things have evolved, we are now using - // root.Count (numRelays) instead of root.Sum (numComputeUnits) to determine - // the amount of work done. This is because the compute_units_per_relay is - /// a service specific (not request specific) parameter that will be maintained - // by the service owner to capture the average amount of resources (i.e. - // compute, storage, bandwidth, electricity, etc...) per request. Modifying - // this on a per request basis has been deemed too complex and not a mainnet - // blocker. - - // Determine the total number of tokens that'll be used for settling the session. - // When the network achieves equilibrium, this will be the mint & burn. + // Determine the total number of tokens being claimed (i.e. requested) + // by the supplier for the amount of work they did to service the application + // in the session. claimSettlementCoin, err = k.numRelaysToCoin(ctx, numRelays, &service) if err != nil { return err } - // Retrieving the relay mining difficulty for the service at hand - relayMiningDifficulty, found := k.GetRelayMiningDifficulty(ctx, service.Id) - if !found { - if err != nil { - return err - } - logger.Warn(fmt.Sprintf("relay mining difficulty for service %q not found. Using default difficulty", service.Id)) - relayMiningDifficulty = tokenomicstypes.RelayMiningDifficulty{ - ServiceId: service.Id, - BlockHeight: sdk.UnwrapSDKContext(ctx).BlockHeight(), - NumRelaysEma: numRelays, - TargetHash: prooftypes.DefaultRelayDifficultyTargetHash, - } - } - // Helpers for logging the same metadata throughout this function calls logger = logger.With( "num_relays", numRelays, @@ -238,37 +227,40 @@ func (k Keeper) ProcessTokenLogicModules( "supplier_operator", supplier.OperatorAddress, "application", application.Address, ) - logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays equaling to (%s) upokt claimed", numRelays, claimSettlementCoin)) - maxClaimableAmount := application.GetStake().QuoUint64(uint64(relayMiningDifficulty.NumNodesPerSession)) + // Retrieving the relay mining difficulty for the service at hand + relayMiningDifficulty, found := k.GetRelayMiningDifficulty(ctx, service.Id) + if !found { + relayMiningDifficulty = newDefaultRelayMiningDifficulty(ctx, logger, service.Id, numRelays) + } - // Reduce the settlement amount if the application was over-serviced - var actualSettlementCoin cosmostypes.Coin - if application.GetStake().IsLT(claimSettlementCoin) { - actualSettlementCoin, err = k.handleOverservicedApplication(ctx, &application, claimSettlementCoin) - if err != nil { - return err - } - logger.Warn(fmt.Sprintf("Application with address %s was over-serviced so the actual amount being settled is (%v) instead of the claimed amount (%v) ", application.Address, actualSettlementCoin, claimSettlementCoin)) - } else { - actualSettlementCoin = claimSettlementCoin + // Ensure the claim amount is within the limits set by Relay Mining. + // Update the settlement amount if not and emit any necessary events in doing so. + actualSettlementCoin, err := k.ensureClaimAmountLimits(ctx, logger, &application, &supplier, claimSettlementCoin) + if err != nil { + return err } logger = logger.With("actual_settlement_upokt", actualSettlementCoin) + logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays equaling to (%s) upokt claimed", numRelays, actualSettlementCoin)) // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { - logger.Info(fmt.Sprintf("Starting to execute TLM %q", tlm)) + logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) if err := tlmProcessor(k, ctx, &service, claim.SessionHeader, &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { return err } - logger.Info(fmt.Sprintf("Finished executing TLM %q", tlm)) + logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } - // Update the application's on-chain record + // State mutation: update the application's on-chain record k.applicationKeeper.SetApplication(ctx, application) logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) - // Update the suppliers's on-chain record + // TODO_MAINNET: If the application stake has dropped to (near?) zero, should + // we unstake it? Should we use it's balance? Should their be a payee of last resort? + // Make sure to document whatever decision we come to. + + // State mutation: Update the suppliers's on-chain record k.supplierKeeper.SetSupplier(ctx, supplier) logger.Info(fmt.Sprintf("updated on-chain supplier record with address %q", supplier.OperatorAddress)) @@ -289,16 +281,16 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( ) error { logger := k.Logger().With("method", "TokenLogicModuleRelayBurnEqualsMint") - ownerAddr, err := cosmostypes.AccAddressFromBech32(supplier.OwnerAddress) - if err != nil { - return err - } - // DEV_NOTE: We are doing a mint & burn + transfer, instead of a simple transfer // of funds from the supplier to the application in order to enable second // order economic effects with more optionality. This could include funds // going to pnf, delegators, enabling bonuses/rebates, etc... + ownerAddr, err := cosmostypes.AccAddressFromBech32(supplier.OwnerAddress) + if err != nil { + return err + } + // Mint new uPOKT to the supplier module account. // These funds will be transferred to the supplier below. if err = k.bankKeeper.MintCoins( @@ -312,8 +304,8 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( } logger.Info(fmt.Sprintf("minted (%v) coins in the supplier module", settlementCoin)) - amount := settlementCoin.Amount.Uint64() - if err = k.distributeSupplierRewardsToShareHolders(ctx, ownerAddr.String(), service.Id, amount); err != nil { + // Distribute the rewards to the supplier's shareholders based on the rev share percentage. + if err = k.distributeSupplierRewardsToShareHolders(ctx, ownerAddr.String(), service.Id, settlementCoin.Amount.Uint64()); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, @@ -355,7 +347,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") // Determine how much new uPOKT to mint based on global inflation - newMintCoins, newMintAmtFloat := calculateGlobalMintAllocationFromSettlementAmount(settlementCoin) + newMintCoins, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) // Mint new uPOKT to the tokenomics module account if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, newMintCoins); err != nil { @@ -416,20 +408,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( return nil } -// 1. Mint = Burn -// 2. Global Mint -// 4. Overcharge applications -// - Determine the amount send to suppliers -// - Determine the amount send to source owner -// - Overcharge application based on the sum of the two above -// - Send the overcharge to the PNF -// - Emit an event so we can track it -// - PNF manually reimburses the application at the end of the month -// - Prevents self dealing because application has to ask for reimbursement -// - Does not introduce friction to service owners getting rewarded -// - Does not introduce friction to suppliers getting rewarded -// - Ensure NewSession breaks if app stake is too low -// - Ensure relayminer has a toggle to prevent over charging +// TokenLogicModuleGlobalMintReimbursementRequest processes the business logic for the GlobalMintReimbursementRequest TLM. func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( ctx context.Context, service *sharedtypes.Service, @@ -439,35 +418,29 @@ func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( settlementCoins cosmostypes.Coin, relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error { - // logger := k.Logger().With("method", "TokenLogicModuleGlobalMintReimbursementRequest") // Determine how much new uPOKT to mint based on global inflation - newMintCoins, _ := calculateGlobalMintAllocationFromSettlementAmount(settlementCoins) + newMintCoins, _ := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoins) + + /* + TODO_UPNEXT_BETA(@Olshansky): Finish implementing this: + 1. Overcharge the application (reduce stake and burn app module tokens) + 2. Send the overcharge to the DAO/PNF address + 3. Add extensive tests for this. + */ - // EventApplicationReimbursementRequest + // Prepare and emit the event for the application being overcharged reimbursementRequestEvent := tokenomictypes.EventApplicationReimbursementRequest{ ApplicationAddr: application.Address, ServiceId: service.Id, SessionId: sessionHeader.SessionId, Amount: &newMintCoins[0], } - eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() if err := eventManager.EmitTypedEvent(&reimbursementRequestEvent); err != nil { - return tokenomicstypes.ErrTokenomicsApplicationReimbursementRequestFailed.Wrapf( - "application address: %s; service Id %s; session Id: %s; amount: %s", - application.GetAddress(), - service.Id, - sessionHeader.SessionId, - newMintCoins.String(), - ) + return tokenomicstypes.ErrTokenomicsEmittingEventFailed.Wrapf("error emitting event %v", reimbursementRequestEvent) } - // EventApplicationReimbursementRequest - // What if the application is overcharged? - // How do I enforce running both of them? - // Need to add a new governance parameter? - // Should we prevent new application sessions from starting if its too low? return nil } @@ -498,54 +471,64 @@ func (k Keeper) sendRewardsToAccount( return &coinToAcc, nil } -// handleOverservicedApplication handles the case where an application has been over-serviced. +// ensureClaimAmountLimits checks if the application was overserviced and handles +// the case if it was. // Per Algorithm #1 in the Relay Mining paper, the maximum amount that a single supplier -// can claim in a session is AppStake/NumNodesPerSession. -// If this is not the case, then the supplier essentially did "free work" and the actual -// claim amount is less than what was claimed. +// can claim in a session is AppStake/NumSuppliersPerSession. +// If this is not the case, then the supplier essentially did "free work" and the +// actual claim amount is less than what was claimed. // Ref: https://arxiv.org/pdf/2305.10672 -func (k Keeper) handleOverservicedApplication( +func (k Keeper) ensureClaimAmountLimits( ctx context.Context, + methodLogger log.Logger, application *apptypes.Application, + supplier *sharedtypes.Supplier, claimSettlementCoin cosmostypes.Coin, ) ( actualSettlementCoins cosmostypes.Coin, err error, ) { - logger := k.Logger().With("method", "handleOverservicedApplication") - logger.Warn(fmt.Sprintf( - "THIS SHOULD NEVER HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", - application.Address, - claimSettlementCoin, - application.Stake, - )) - - // TODO_MAINNET(@Olshansk, @RawthiL): The application was over-serviced in the last session so it basically - // goes "into debt". Need to design a way to handle this when we implement - // probabilistic proofs and add all the parameter logic. Do we touch the application balance? - // Do we just let it go into debt? Do we penalize the application? Do we unstake it? Etc... - // See this document from @red-0ne and @bryanchriswhite for more context: notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7 - expectedBurn := claimSettlementCoin + logger := methodLogger.With("helper", "ensureClaimAmountLimits") + + // TODO_BETA_OR_MAINNET(@red-0ne): The application stake gets reduced with every claim + // settlement. Relay miners use the appStake at the beginning of a session to determine + // the maximum amount they can claim. We need to somehow access and propagate this + // value (via context?) so it is the same for all TLM processors for each claim. + // Note that this will also need to incorporate MintPerClaimGlobalInflation because + // applications are being overcharged by that amount in the meantime. Whatever the + // solution and implementation ends up being, make sure to KISS. + appStake := application.GetStake() + + // Determine the max claimable amount for the supplier based on the application's stake + // in this session. + maxClaimableCoin := sdk.NewCoin(volatile.DenomuPOKT, appStake.Amount.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession))) + + if maxClaimableCoin.Amount.GTE(claimSettlementCoin.Amount) { + logger.Info(fmt.Sprintf("Claim by supplier %s IS WITHIN LIMITS of servicing application %s. Max claimable amount < Claim amount: %v < %v", + supplier.OperatorAddress, application.Address, maxClaimableCoin, claimSettlementCoin.Amount)) + return claimSettlementCoin, nil + } + logger.Warn(fmt.Sprintf("Claim by supplier %s EXCEEDS LIMITS for application %s. Max claimable amount < Claim amount: %v < %v", + supplier.OperatorAddress, application.Address, maxClaimableCoin, claimSettlementCoin.Amount)) + + // Reduce the settlement amount if the application was over-serviced + actualSettlementCoins = maxClaimableCoin + + // Prepare and emit the event for the application being overserviced applicationOverservicedEvent := &tokenomicstypes.EventApplicationOverserviced{ ApplicationAddr: application.Address, - ExpectedBurn: &expectedBurn, - EffectiveBurn: application.GetStake(), + SupplierAddr: supplier.OperatorAddress, + ExpectedBurn: &claimSettlementCoin, + EffectiveBurn: &maxClaimableCoin, } eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() if err := eventManager.EmitTypedEvent(applicationOverservicedEvent); err != nil { return cosmostypes.Coin{}, - tokenomicstypes.ErrTokenomicsApplicationOverservicedEvent.Wrapf( - "application address: %s; expected burn %s; effective burn: %s", - application.GetAddress(), - expectedBurn.String(), - application.GetStake().String(), - ) + tokenomicstypes.ErrTokenomicsEmittingEventFailed.Wrapf("error emitting event %v", applicationOverservicedEvent) } - // TODO(@red-0ne) - - return *application.Stake, nil + return actualSettlementCoins, nil } // numRelaysToCoin calculates the amount of uPOKT to mint based on the number of compute units. @@ -626,14 +609,14 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( return nil } -// calculateGlobalMintAllocationFromSettlementAmount calculates the amount of uPOKT -// to mint based on the global inflation rate as a function of the settlement amount -// for a particular claim(s) or session(s). -func calculateGlobalMintAllocationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coins, *big.Float) { - // Determine how much new uPOKT to mint based on global inflation +// calculateGlobalPerClaimMintInflationFromSettlementAmount calculates the amount +// of uPOKT to mint based on the global per claim inflation rate as a function of +// the settlement amount for a particular claim(s) or session(s). +func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coins, *big.Float) { + // Determine how much new uPOKT to mint based on global per claim inflation. // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) - newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintGlobalInflation)) + newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimGlobalInflation)) newMintAmtInt, _ := newMintAmtFloat.Int64() mintAmtCoins := sdk.NewCoins(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt))) return mintAmtCoins, newMintAmtFloat diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index eb2bea113..50fecad21 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -33,6 +33,9 @@ func init() { cmd.InitSDKConfig() } +// TODO_IN_THIS_PR: Tests to add or list +// claimSettlementAmount > maxClaimableAmount + func TestProcessTokenLogicModules_HandleAppGoingIntoDebt(t *testing.T) { keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil) diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty.go b/x/tokenomics/keeper/update_relay_mining_difficulty.go index 71f2b50fc..d563db86b 100644 --- a/x/tokenomics/keeper/update_relay_mining_difficulty.go +++ b/x/tokenomics/keeper/update_relay_mining_difficulty.go @@ -7,11 +7,13 @@ import ( "fmt" "math/big" + "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/pkg/crypto/protocol" prooftypes "github.com/pokt-network/poktroll/x/proof/types" "github.com/pokt-network/poktroll/x/tokenomics/types" + tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) // TargetNumRelays is the target number of relays we want the network to mine for @@ -49,17 +51,7 @@ func (k Keeper) UpdateRelayMiningDifficulty( for serviceId, numRelays := range relaysPerServiceMap { prevDifficulty, found := k.GetRelayMiningDifficulty(ctx, serviceId) if !found { - logger.Warn(types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf( - "No previous relay mining difficulty found for service %s. Initializing with default difficulty %v", - serviceId, prevDifficulty.TargetHash, - ).Error()) - // If a previous difficulty for the service is not found, we initialize a default. - prevDifficulty = types.RelayMiningDifficulty{ - ServiceId: serviceId, - BlockHeight: sdkCtx.BlockHeight(), - NumRelaysEma: numRelays, - TargetHash: prooftypes.DefaultRelayDifficultyTargetHash, - } + prevDifficulty = newDefaultRelayMiningDifficulty(ctx, logger, serviceId, numRelays) } // TODO_MAINNET(@Olshansk): We could potentially compute the smoothing factor @@ -190,3 +182,24 @@ func computeEma(alpha *big.Float, prevEma, currValue uint64) uint64 { newEma, _ := new(big.Float).Add(weightedCurrentContribution, weightedPreviousContribution).Uint64() return newEma } + +func newDefaultRelayMiningDifficulty( + ctx context.Context, + methodLogger log.Logger, + serviceId string, + numRelays uint64, +) tokenomicstypes.RelayMiningDifficulty { + logger := methodLogger.With("helper", "newDefaultRelayMiningDifficulty") + logger.Warn(types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf( + "No previous relay mining difficulty found for service %s. Creating a temporary relay mining difficulty with %d relays and default target hash %x", + serviceId, numRelays, + ).Error()) + + return tokenomicstypes.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: sdk.UnwrapSDKContext(ctx).BlockHeight(), + NumRelaysEma: numRelays, + TargetHash: prooftypes.DefaultRelayDifficultyTargetHash, + } + +} diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 91b2d761e..24a16cd1b 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -25,7 +25,7 @@ var ( ErrTokenomicsUnmarshalInvalid = sdkerrors.Register(ModuleName, 1116, "failed to unmarshal the provided bytes") ErrTokenomicsDuplicateIndex = sdkerrors.Register(ModuleName, 1117, "cannot have a duplicate index") ErrTokenomicsMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1118, "missing relay mining difficulty") - ErrTokenomicsApplicationOverservicedEvent = sdkerrors.Register(ModuleName, 1119, "application overserviced event cannot be sent") + ErrTokenomicsEmittingEventFailed = sdkerrors.Register(ModuleName, 1119, "failed to emit event") ErrTokenomicsServiceNotFound = sdkerrors.Register(ModuleName, 1120, "service not found") ErrTokenomicsModuleMintFailed = sdkerrors.Register(ModuleName, 1121, "failed to mint uPOKT to tokenomics module account") ErrTokenomicsSendingMintRewards = sdkerrors.Register(ModuleName, 1122, "failed to send minted rewards") diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 1585b4fcf..795d595a9 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -273,12 +273,20 @@ func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { return 0 } -// EventApplicationOverserviced is emitted when an application has less stake -// than the expected burn. +// EventApplicationOverserviced is emitted when an application has less stake than +// what a supplier is claiming (i.e. burn is not high enough). type EventApplicationOverserviced struct { - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - ExpectedBurn *types1.Coin `protobuf:"bytes,2,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` - EffectiveBurn *types1.Coin `protobuf:"bytes,3,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + SupplierAddr string `protobuf:"bytes,2,opt,name=supplier_addr,json=supplierAddr,proto3" json:"supplier_addr,omitempty"` + // Expected burn is the amount the supplier is claiming for work done + // to service the application during the session. + // This is usually the amount in the Claim object. + ExpectedBurn *types1.Coin `protobuf:"bytes,3,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` + // Effective burn is the amount that is actually being paid to the supplier + // for the work done. It is less than the expected burn (claim amount) and + // most likely equal to the application's stake divided by the number of suppliers + // in a session. + EffectiveBurn *types1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } func (m *EventApplicationOverserviced) Reset() { *m = EventApplicationOverserviced{} } @@ -321,6 +329,13 @@ func (m *EventApplicationOverserviced) GetApplicationAddr() string { return "" } +func (m *EventApplicationOverserviced) GetSupplierAddr() string { + if m != nil { + return m.SupplierAddr + } + return "" +} + func (m *EventApplicationOverserviced) GetExpectedBurn() *types1.Coin { if m != nil { return m.ExpectedBurn @@ -417,56 +432,57 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 776 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x4e, 0xeb, 0x46, - 0x14, 0x8e, 0xc3, 0x8f, 0x94, 0xa1, 0x40, 0x32, 0x14, 0x35, 0xa5, 0x90, 0x84, 0xa8, 0xaa, 0x28, - 0x15, 0xb6, 0x00, 0xa9, 0xab, 0x0a, 0x35, 0x09, 0xa6, 0x58, 0x2a, 0x49, 0xe4, 0x40, 0x55, 0x75, - 0xe3, 0x3a, 0xf6, 0x49, 0x32, 0x25, 0x9e, 0x31, 0xe3, 0x71, 0x12, 0xde, 0xa2, 0x0f, 0xd0, 0x17, - 0xe8, 0xa2, 0x2f, 0xd1, 0x55, 0xa5, 0x6e, 0x58, 0x76, 0x85, 0x2a, 0xd8, 0xf1, 0x14, 0x57, 0x1e, - 0x3b, 0x3f, 0x04, 0xee, 0xbd, 0xba, 0xcb, 0xbb, 0x49, 0x46, 0xe7, 0x7c, 0xdf, 0x37, 0xe7, 0x7c, - 0x73, 0x72, 0x82, 0x8a, 0x3e, 0xbb, 0x16, 0x9c, 0xf5, 0xfb, 0x9a, 0x60, 0xd7, 0x40, 0x99, 0x47, - 0x9c, 0x40, 0x83, 0x01, 0x50, 0xa1, 0xfa, 0x9c, 0x09, 0x86, 0x37, 0xc6, 0x00, 0x75, 0x0a, 0xd8, - 0x2a, 0x38, 0x2c, 0xf0, 0x58, 0xa0, 0xb5, 0xed, 0x00, 0xb4, 0xc1, 0x61, 0x1b, 0x84, 0x7d, 0xa8, - 0x39, 0x8c, 0xd0, 0x98, 0xb4, 0xf5, 0x69, 0x97, 0x75, 0x99, 0x3c, 0x6a, 0xd1, 0x29, 0x89, 0x6e, - 0x4d, 0xee, 0xf2, 0x39, 0x63, 0x1d, 0xcd, 0xe9, 0xdb, 0xc4, 0x4b, 0x72, 0xa5, 0xb9, 0x1c, 0x87, - 0x9b, 0x90, 0x70, 0xf0, 0x26, 0x85, 0x94, 0xff, 0x4a, 0xa3, 0x9c, 0x1e, 0x15, 0x56, 0x8b, 0x68, - 0xfa, 0xc8, 0x27, 0x1c, 0x5c, 0xfc, 0x2d, 0x5a, 0x92, 0x32, 0x79, 0xa5, 0xa4, 0xec, 0xad, 0x1c, - 0x6d, 0xaa, 0x93, 0x72, 0xa5, 0x8e, 0x2a, 0xc1, 0xd5, 0xcc, 0xd3, 0x7d, 0x31, 0xc6, 0x99, 0xf1, - 0x17, 0x3e, 0x40, 0x88, 0x86, 0x9e, 0xc5, 0xa1, 0x6f, 0xdf, 0x06, 0xf9, 0x74, 0x49, 0xd9, 0x5b, - 0xac, 0xae, 0x3d, 0xdd, 0x17, 0x67, 0xa2, 0x66, 0x86, 0x86, 0x9e, 0x29, 0x8f, 0xb8, 0x82, 0x72, - 0x51, 0xc2, 0x61, 0x9e, 0x1f, 0x0a, 0xb0, 0x42, 0x4a, 0x44, 0x90, 0x5f, 0x90, 0xac, 0xcd, 0xa7, - 0xfb, 0xe2, 0xcb, 0xa4, 0xb9, 0x4e, 0x43, 0xaf, 0x16, 0x47, 0xae, 0xa2, 0x00, 0xa6, 0x28, 0x07, - 0x51, 0xd1, 0xb6, 0x20, 0x8c, 0x5a, 0x1c, 0xec, 0x80, 0xd1, 0xfc, 0x62, 0x49, 0xd9, 0x5b, 0x3b, - 0xda, 0x57, 0x5f, 0x31, 0x59, 0x9d, 0xf6, 0x29, 0x29, 0xa6, 0x64, 0xc4, 0xd7, 0xbd, 0x10, 0x32, - 0xb3, 0x30, 0x07, 0x2c, 0xff, 0xf9, 0xcc, 0xaf, 0x16, 0x08, 0xd1, 0xff, 0xa8, 0xfc, 0xfa, 0x0d, - 0xe5, 0x64, 0x49, 0xd6, 0xcc, 0x28, 0x24, 0x7e, 0x7d, 0x35, 0x5f, 0x75, 0x33, 0xfa, 0x34, 0xa7, - 0xb8, 0x59, 0xaf, 0x5e, 0x88, 0x98, 0x59, 0x7f, 0x0e, 0x5e, 0xfe, 0x23, 0x8d, 0x76, 0xa5, 0x57, - 0xb2, 0xfc, 0x0b, 0x42, 0x09, 0xed, 0x9e, 0x92, 0x4e, 0x87, 0x38, 0x61, 0x5f, 0xdc, 0x5e, 0xf9, - 0xae, 0x2d, 0xc0, 0xc5, 0x3b, 0x08, 0x05, 0xc0, 0x07, 0xc4, 0x01, 0x8b, 0xb8, 0xd2, 0xc0, 0x8c, - 0x99, 0x49, 0x22, 0x86, 0x8b, 0x4f, 0xd0, 0xb6, 0xcf, 0x61, 0x60, 0x09, 0x9b, 0x77, 0x41, 0x58, - 0x3d, 0x3b, 0xe8, 0x59, 0x3d, 0x18, 0x59, 0x40, 0x1d, 0xe6, 0x82, 0x2b, 0x4d, 0xcb, 0x98, 0xf9, - 0x08, 0x73, 0x29, 0x21, 0xe7, 0x76, 0xd0, 0x3b, 0x87, 0x91, 0x1e, 0xe7, 0xf1, 0x77, 0xe8, 0x0b, - 0x0a, 0xc3, 0xb7, 0xd2, 0x17, 0x24, 0xfd, 0x33, 0x0a, 0xc3, 0x57, 0xd9, 0x07, 0x68, 0x43, 0xde, - 0x3e, 0x7d, 0x0f, 0x0b, 0x3c, 0x5b, 0x1a, 0xb6, 0x18, 0x75, 0x0c, 0x83, 0xfa, 0xf8, 0x75, 0x74, - 0xcf, 0xc6, 0xdf, 0x20, 0x1c, 0x5d, 0x36, 0x87, 0x5e, 0x92, 0xe8, 0x75, 0x0a, 0xc3, 0x59, 0x70, - 0xf9, 0x5f, 0x05, 0x6d, 0x4b, 0x7b, 0x2a, 0xbe, 0xdf, 0x27, 0x8e, 0x9c, 0xb2, 0xc6, 0x00, 0x78, - 0xd2, 0xbb, 0x8b, 0xbf, 0x46, 0x59, 0x7b, 0x9a, 0xb2, 0x6c, 0xd7, 0xe5, 0x89, 0x3f, 0xeb, 0x33, - 0xf1, 0x8a, 0xeb, 0x72, 0x7c, 0x82, 0x56, 0x61, 0xe4, 0x83, 0x23, 0xc0, 0xb5, 0xda, 0x21, 0xa7, - 0xd2, 0x96, 0x95, 0xa3, 0xcf, 0xd5, 0x78, 0xa5, 0xa8, 0xd1, 0x4a, 0x51, 0x93, 0x95, 0xa2, 0xd6, - 0x18, 0xa1, 0xe6, 0x27, 0x63, 0x7c, 0x35, 0xe4, 0x14, 0x7f, 0x8f, 0xd6, 0xa0, 0xd3, 0x01, 0x47, - 0x90, 0x01, 0xc4, 0x02, 0x0b, 0xef, 0x13, 0x58, 0x9d, 0x10, 0x22, 0x85, 0xf2, 0xdf, 0x0a, 0xfa, - 0x72, 0xbe, 0x1b, 0x13, 0x88, 0xd7, 0x0e, 0x79, 0x90, 0x4c, 0xcf, 0x4d, 0x08, 0x81, 0xf8, 0x90, - 0xae, 0x9e, 0x8f, 0x46, 0x7a, 0x7e, 0x34, 0x64, 0x3a, 0x08, 0x22, 0x15, 0x32, 0x7e, 0xc9, 0x4c, - 0x12, 0x31, 0x5c, 0x7c, 0x88, 0x96, 0x6d, 0x8f, 0x85, 0xc9, 0x7c, 0xbf, 0xb3, 0x97, 0x04, 0xb8, - 0xff, 0x2b, 0xda, 0x7c, 0x75, 0x3f, 0xe0, 0x5d, 0xb4, 0xa3, 0xff, 0xdc, 0x34, 0xcc, 0xca, 0xa5, - 0xd1, 0xa8, 0x5b, 0xa6, 0x5e, 0x69, 0x35, 0xea, 0xd6, 0x55, 0xbd, 0xd5, 0xd4, 0x6b, 0xc6, 0x99, - 0xa1, 0x9f, 0x66, 0x53, 0x38, 0x87, 0x56, 0x9b, 0x66, 0xa3, 0x71, 0x66, 0x5d, 0x18, 0xad, 0x96, - 0x51, 0xff, 0x21, 0xab, 0x4c, 0x43, 0x46, 0xfd, 0xa7, 0xca, 0x8f, 0xc6, 0x69, 0x36, 0x5d, 0xbd, - 0xf8, 0xe7, 0xa1, 0xa0, 0xdc, 0x3d, 0x14, 0x94, 0xff, 0x1f, 0x0a, 0xca, 0xef, 0x8f, 0x85, 0xd4, - 0xdd, 0x63, 0x21, 0xf5, 0xdf, 0x63, 0x21, 0xf5, 0xcb, 0x71, 0x97, 0x88, 0x5e, 0xd8, 0x56, 0x1d, - 0xe6, 0x69, 0xd1, 0x0f, 0xf1, 0x80, 0x82, 0x18, 0x32, 0x7e, 0xad, 0x4d, 0x76, 0xf8, 0x68, 0xf6, - 0xdf, 0x44, 0xdc, 0xfa, 0x10, 0xb4, 0x97, 0xe5, 0x16, 0x3f, 0x7e, 0x13, 0x00, 0x00, 0xff, 0xff, - 0xe7, 0x04, 0xe0, 0xc6, 0x71, 0x06, 0x00, 0x00, + // 793 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0xb3, 0xd9, 0x95, 0x32, 0xbb, 0x69, 0x93, 0x59, 0x2a, 0x42, 0xd9, 0x4d, 0xb2, 0x01, + 0xa1, 0xb2, 0xa8, 0xb6, 0xda, 0x95, 0x38, 0xa1, 0x8a, 0x24, 0x75, 0xa9, 0x25, 0x9a, 0x44, 0x4e, + 0x8b, 0x10, 0x17, 0xe3, 0xd8, 0x2f, 0xc9, 0xd0, 0x78, 0xc6, 0x9d, 0x19, 0x27, 0xe9, 0xb7, 0xe0, + 0x03, 0xf0, 0x05, 0x38, 0xf0, 0x25, 0x38, 0x71, 0xec, 0x91, 0x53, 0x85, 0xda, 0x5b, 0x4f, 0x7c, + 0x04, 0xe4, 0xb1, 0xf3, 0xa7, 0x69, 0x01, 0x71, 0xe4, 0xd2, 0x8e, 0x7e, 0xef, 0xf7, 0x7b, 0xf3, + 0xde, 0x6f, 0x9e, 0x5f, 0x50, 0x35, 0x64, 0xe7, 0x92, 0xb3, 0xf1, 0xd8, 0x90, 0xec, 0x1c, 0x28, + 0x0b, 0x88, 0x27, 0x0c, 0x98, 0x00, 0x95, 0x7a, 0xc8, 0x99, 0x64, 0xf8, 0xe5, 0x9c, 0xa0, 0x2f, + 0x09, 0xdb, 0x15, 0x8f, 0x89, 0x80, 0x09, 0xa3, 0xef, 0x0a, 0x30, 0x26, 0x7b, 0x7d, 0x90, 0xee, + 0x9e, 0xe1, 0x31, 0x42, 0x13, 0xd1, 0xf6, 0x7b, 0x43, 0x36, 0x64, 0xea, 0x68, 0xc4, 0xa7, 0x14, + 0xdd, 0x5e, 0xdc, 0x15, 0x72, 0xc6, 0x06, 0x86, 0x37, 0x76, 0x49, 0x90, 0xc6, 0x6a, 0x6b, 0x31, + 0x0e, 0x17, 0x11, 0xe1, 0x10, 0x2c, 0x0a, 0xa9, 0xff, 0x92, 0x45, 0x25, 0x33, 0x2e, 0xac, 0x15, + 0xcb, 0xcc, 0x59, 0x48, 0x38, 0xf8, 0xf8, 0x73, 0xf4, 0x54, 0xa5, 0x29, 0x6b, 0x35, 0x6d, 0xe7, + 0xf9, 0xfe, 0x96, 0xbe, 0x28, 0x57, 0xe5, 0xd1, 0x15, 0xb9, 0x99, 0xbf, 0xbb, 0xae, 0x26, 0x3c, + 0x3b, 0xf9, 0x87, 0x77, 0x11, 0xa2, 0x51, 0xe0, 0x70, 0x18, 0xbb, 0x97, 0xa2, 0x9c, 0xad, 0x69, + 0x3b, 0xb9, 0xe6, 0xc6, 0xdd, 0x75, 0x75, 0x05, 0xb5, 0xf3, 0x34, 0x0a, 0x6c, 0x75, 0xc4, 0x0d, + 0x54, 0x8a, 0x03, 0x1e, 0x0b, 0xc2, 0x48, 0x82, 0x13, 0x51, 0x22, 0x45, 0xf9, 0x89, 0x52, 0x6d, + 0xdd, 0x5d, 0x57, 0x1f, 0x06, 0xed, 0x4d, 0x1a, 0x05, 0xad, 0x04, 0x39, 0x8b, 0x01, 0x4c, 0x51, + 0x09, 0xe2, 0xa2, 0x5d, 0x49, 0x18, 0x75, 0x38, 0xb8, 0x82, 0xd1, 0x72, 0xae, 0xa6, 0xed, 0x6c, + 0xec, 0xbf, 0xd5, 0x1f, 0x31, 0x59, 0x5f, 0xf6, 0xa9, 0x24, 0xb6, 0x52, 0x24, 0xd7, 0x3d, 0x48, + 0x64, 0x17, 0x61, 0x8d, 0x58, 0xff, 0xf9, 0x9e, 0x5f, 0x3d, 0x90, 0x72, 0xfc, 0xbf, 0xf2, 0xeb, + 0x07, 0x54, 0x52, 0x25, 0x39, 0x2b, 0xa3, 0x90, 0xfa, 0xf5, 0xc9, 0x7a, 0xd5, 0xdd, 0xf8, 0xaf, + 0xbd, 0xe4, 0xad, 0x7a, 0xf5, 0x20, 0x89, 0x5d, 0x0c, 0xd7, 0xe8, 0xf5, 0x9f, 0xb2, 0xe8, 0x8d, + 0xf2, 0x4a, 0x95, 0x7f, 0x42, 0x28, 0xa1, 0xc3, 0x43, 0x32, 0x18, 0x10, 0x2f, 0x1a, 0xcb, 0xcb, + 0xb3, 0xd0, 0x77, 0x25, 0xf8, 0xf8, 0x35, 0x42, 0x02, 0xf8, 0x84, 0x78, 0xe0, 0x10, 0x5f, 0x19, + 0x98, 0xb7, 0xf3, 0x29, 0x62, 0xf9, 0xf8, 0x00, 0xbd, 0x0a, 0x39, 0x4c, 0x1c, 0xe9, 0xf2, 0x21, + 0x48, 0x67, 0xe4, 0x8a, 0x91, 0x33, 0x82, 0x99, 0x03, 0xd4, 0x63, 0x3e, 0xf8, 0xca, 0xb4, 0xbc, + 0x5d, 0x8e, 0x39, 0xa7, 0x8a, 0x72, 0xec, 0x8a, 0xd1, 0x31, 0xcc, 0xcc, 0x24, 0x8e, 0xbf, 0x40, + 0x1f, 0x52, 0x98, 0xfe, 0xad, 0xfc, 0x89, 0x92, 0xbf, 0x4f, 0x61, 0xfa, 0xa8, 0x7a, 0x17, 0xbd, + 0x54, 0xb7, 0x2f, 0xdf, 0xc3, 0x81, 0xc0, 0x55, 0x86, 0xe5, 0xe2, 0x8e, 0x61, 0xd2, 0x9e, 0xbf, + 0x8e, 0x19, 0xb8, 0xf8, 0x33, 0x84, 0xe3, 0xcb, 0xd6, 0xd8, 0x4f, 0x15, 0x7b, 0x93, 0xc2, 0x74, + 0x95, 0x5c, 0xff, 0x53, 0x43, 0xaf, 0x94, 0x3d, 0x8d, 0x30, 0x1c, 0x13, 0x4f, 0x4d, 0x59, 0x67, + 0x02, 0x3c, 0xed, 0xdd, 0xc7, 0x9f, 0xa2, 0xa2, 0xbb, 0x0c, 0x39, 0xae, 0xef, 0xf3, 0xd4, 0x9f, + 0xcd, 0x15, 0xbc, 0xe1, 0xfb, 0x1c, 0x7f, 0x84, 0x0a, 0x22, 0x8a, 0x31, 0xe0, 0x09, 0x2f, 0xb1, + 0xe5, 0xc5, 0x1c, 0x54, 0xa4, 0x03, 0x54, 0x80, 0x59, 0x08, 0x9e, 0x04, 0xdf, 0xe9, 0x47, 0x9c, + 0xaa, 0xe6, 0x9f, 0xef, 0x7f, 0xa0, 0x27, 0x7b, 0x47, 0x8f, 0xf7, 0x8e, 0x9e, 0xee, 0x1d, 0xbd, + 0xc5, 0x08, 0xb5, 0x5f, 0xcc, 0xf9, 0xcd, 0x88, 0x53, 0xfc, 0x25, 0xda, 0x80, 0xc1, 0x00, 0x3c, + 0x49, 0x26, 0x90, 0x24, 0xc8, 0xfd, 0x5b, 0x82, 0xc2, 0x42, 0x10, 0x67, 0xa8, 0xff, 0xaa, 0xa1, + 0x8f, 0xd7, 0x5b, 0xb6, 0x81, 0x04, 0xfd, 0x88, 0x8b, 0x74, 0xc4, 0x2e, 0x22, 0x10, 0xf2, 0xbf, + 0xb4, 0x7e, 0x7f, 0x7e, 0xb2, 0xeb, 0xf3, 0xa3, 0xc2, 0x42, 0xc4, 0x59, 0xc8, 0xfc, 0xb9, 0xf3, + 0x29, 0x62, 0xf9, 0x78, 0x0f, 0x3d, 0x73, 0x03, 0x16, 0xa5, 0x1f, 0xc1, 0x3f, 0xf6, 0x92, 0x12, + 0xdf, 0x7e, 0x8f, 0xb6, 0x1e, 0x5d, 0x22, 0xf8, 0x0d, 0x7a, 0x6d, 0x7e, 0xdb, 0xb5, 0xec, 0xc6, + 0xa9, 0xd5, 0x69, 0x3b, 0xb6, 0xd9, 0xe8, 0x75, 0xda, 0xce, 0x59, 0xbb, 0xd7, 0x35, 0x5b, 0xd6, + 0x91, 0x65, 0x1e, 0x16, 0x33, 0xb8, 0x84, 0x0a, 0x5d, 0xbb, 0xd3, 0x39, 0x72, 0x4e, 0xac, 0x5e, + 0xcf, 0x6a, 0x7f, 0x55, 0xd4, 0x96, 0x90, 0xd5, 0xfe, 0xa6, 0xf1, 0xb5, 0x75, 0x58, 0xcc, 0x36, + 0x4f, 0x7e, 0xbb, 0xa9, 0x68, 0x57, 0x37, 0x15, 0xed, 0x8f, 0x9b, 0x8a, 0xf6, 0xe3, 0x6d, 0x25, + 0x73, 0x75, 0x5b, 0xc9, 0xfc, 0x7e, 0x5b, 0xc9, 0x7c, 0xf7, 0x6e, 0x48, 0xe4, 0x28, 0xea, 0xeb, + 0x1e, 0x0b, 0x8c, 0xf8, 0x6b, 0xdd, 0xa5, 0x20, 0xa7, 0x8c, 0x9f, 0x1b, 0x8b, 0x45, 0x3f, 0x5b, + 0xfd, 0xc9, 0x91, 0x97, 0x21, 0x88, 0xfe, 0x33, 0xb5, 0xea, 0xdf, 0xfd, 0x15, 0x00, 0x00, 0xff, + 0xff, 0x37, 0x47, 0xc1, 0x88, 0x96, 0x06, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -653,7 +669,7 @@ func (m *EventApplicationOverserviced) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintEvent(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if m.ExpectedBurn != nil { { @@ -665,6 +681,13 @@ func (m *EventApplicationOverserviced) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintEvent(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x1a + } + if len(m.SupplierAddr) > 0 { + i -= len(m.SupplierAddr) + copy(dAtA[i:], m.SupplierAddr) + i = encodeVarintEvent(dAtA, i, uint64(len(m.SupplierAddr))) + i-- dAtA[i] = 0x12 } if len(m.ApplicationAddr) > 0 { @@ -825,6 +848,10 @@ func (m *EventApplicationOverserviced) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } + l = len(m.SupplierAddr) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } if m.ExpectedBurn != nil { l = m.ExpectedBurn.Size() n += 1 + l + sovEvent(uint64(l)) @@ -1399,6 +1426,38 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { m.ApplicationAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SupplierAddr", 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.SupplierAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExpectedBurn", wireType) } @@ -1434,7 +1493,7 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EffectiveBurn", wireType) } From 98736f3c81b0126b0b4795007d32bb18133c40c4 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 21 Aug 2024 15:11:50 -0400 Subject: [PATCH 04/48] Revert tokenomic docs --- .../protocol/architecture/_category_.json | 4 +- .../docs/protocol/architecture/network.md | 2 +- .../docs/protocol/tokenomics/_category_.json | 8 - .../docs/protocol/tokenomics/resources.md | 21 -- .../tokenomics/token_logic_modules.md | 287 ------------------ .../docs/protocol/upgrades/_category_.json | 2 +- 6 files changed, 4 insertions(+), 320 deletions(-) delete mode 100644 docusaurus/docs/protocol/tokenomics/_category_.json delete mode 100644 docusaurus/docs/protocol/tokenomics/resources.md delete mode 100644 docusaurus/docs/protocol/tokenomics/token_logic_modules.md diff --git a/docusaurus/docs/protocol/architecture/_category_.json b/docusaurus/docs/protocol/architecture/_category_.json index 985d17b7b..c4be422a5 100644 --- a/docusaurus/docs/protocol/architecture/_category_.json +++ b/docusaurus/docs/protocol/architecture/_category_.json @@ -1,6 +1,6 @@ { - "label": "[Outdated] Architecture", - "position": 6, + "label": "Architecture", + "position": 7, "link": { "type": "generated-index", "description": "Documentation related to the high-level design, flows and components of the poktroll repo." diff --git a/docusaurus/docs/protocol/architecture/network.md b/docusaurus/docs/protocol/architecture/network.md index b7949986e..d0e25f1d3 100644 --- a/docusaurus/docs/protocol/architecture/network.md +++ b/docusaurus/docs/protocol/architecture/network.md @@ -1,5 +1,5 @@ --- -title: Outdated - Pocket Actors, Nodes & Data Availability Network +title: Pocket Actors, Nodes & Data Availability Network sidebar_position: 1 --- diff --git a/docusaurus/docs/protocol/tokenomics/_category_.json b/docusaurus/docs/protocol/tokenomics/_category_.json deleted file mode 100644 index c23caaa17..000000000 --- a/docusaurus/docs/protocol/tokenomics/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "Tokenomics", - "position": 5, - "link": { - "type": "generated-index", - "description": "Documentation related to Pocket Network tokenomics." - } -} diff --git a/docusaurus/docs/protocol/tokenomics/resources.md b/docusaurus/docs/protocol/tokenomics/resources.md deleted file mode 100644 index b652b0349..000000000 --- a/docusaurus/docs/protocol/tokenomics/resources.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Tokenomics Resources -sidebar_position: 1 ---- - -# Tokenomics Resources - -:::warning - -This is an active an ever evolving work. We are working on a single source of truth. - -::: - -The following resources serve as the foundation for the Shannon Upgrade Tokenomics. - -- [Token Logic Module](https://docs.pokt.network/pokt-protocol/the-shannon-upgrade/proposed-tokenomics/token-logic-modules) design approach. -- [Shannon Tokenomics Static](https://github.com/pokt-network/shannon-tokenomics-static-tests) modeling & evaluation -- [Relay Mining](https://arxiv.org/abs/2305.10672) paper -- [Probabilistic Proofs](https://github.com/pokt-network/pocket-core/blob/staging/docs/proposals/probabilistic_proofs.md) design - -Thank you to [@Rama_stdout](https://x.com/Rama_stdout), [@shane8burger](https://x.com/shane8burger) and [@olshansky](https://x.com/olshansky) for the contributions! diff --git a/docusaurus/docs/protocol/tokenomics/token_logic_modules.md b/docusaurus/docs/protocol/tokenomics/token_logic_modules.md deleted file mode 100644 index fd70d0fe9..000000000 --- a/docusaurus/docs/protocol/tokenomics/token_logic_modules.md +++ /dev/null @@ -1,287 +0,0 @@ ---- -title: Token Logic Modules -sidebar_position: 2 ---- - -# Token Logic Modules - -- [Introduction](#introduction) -- [Background: Max Claimable Amount](#background-max-claimable-amount) -- [TLM (pre) Processing](#tlm-pre-processing) -- [TLM: Mint=Burn (MEB)](#tlm-mintburn-meb) -- [TLM: Global Mint (GM)](#tlm-global-mint-gm) -- [TLM: Global Mint Reimbursement Request (GMRR)](#tlm-global-mint-reimbursement-request-gmrr) - -## Introduction - -:::warning - -Note that this is an active WIP and the [resources here](./resources.md) are the best starting references to learn more. - -::: - -Token Logic Modules (TLMs) processing involves: - -1. `TLM pre-processing` - A general pre-processor determining the amount of tokens to settle per claim. -2. `TLM processing` - Iteration through all of the TLMs one by one. -3. `TLM processor` - Individual processing each TLM independent of one another. - -## Background: Max Claimable Amount - -_tl;dr Max Claimable Amount ∝ (Application Stake / Number of Suppliers per Session)_ - -Per **Algorithm 1** of the [Relay Mining paper](https://arxiv.org/pdf/2305.10672), -the maximum amount a supplier can claim from an application in a single session is -proportional to the Application's stake divided by the number of suppliers in the session. - -This is referred to as "Relay Mining Payable Relay Accumulation" in the paper and -can be seen in the following image: - -![Algorithm 1](https://github.com/user-attachments/assets/d1a61535-aa31-447d-88ea-c8d14dcb20c6) - -## TLM (pre) Processing - -_tl;dr Determine if the claim settlement amount is greater than the maximum claimable amount and then run each individual TLM._ - -**Prior to** processing each individual TLM, we need to understand if the amount claimed -by the supplier adheres to the optimistic maxima set per the limits of Relay Mining. - -Suppliers always have the option to over-service an application (**i.e. do free work**), -in exchange for providing a good service to the network. This may lead to offchain -reputation benefits (e.g. Gateways favoring them), but their on-chain rewards -are still limited as a function of the application's stake before the session started -and the number of suppliers in the session. - -:::note - -TODO_POST_MAINNET: After the Shannon upgrade, the team at Grove has a lot of ideas -related to on-chain reputation, [supplier gossiping](https://www.notion.so/buildwithgrove/Off-chain-Application-Stake-Tracking-6a8bebb107db4f7f9dc62cbe7ba555f7?pvs=4), and -much more, but that is out of scope for the initial implementation. - -::: - -```mermaid ---- -title: "Token Logic Modules (pre) Processing" ---- -flowchart TB - CSA(["Claim Settlement Amount (CSA)"]) - MCA(["MaxClaimPerSupplier (MCA)
= (AppStake / NumSuppliersPerSession)"]) - CC{"Is CSA > MCA?"} - Update(Set SA = MCA
Broadcast Event) - SOAE{{Application Overserviced
Event}} - TLMP[["TLM Processor (SA)"]] - - CSA -- CSA --> CC - MCA -- MCA --> CC - - Update -..-> SOAE - CC -- Yes --> Update - CC -- No
SA=CSA --> TLMP - Update -- SA=CSA --> TLMP - - TLMP --SA--> TLMBEM[[TLM: Burn Equals Mint]] - TLMP --SA--> TLMGI[[TLM: Global Inflation]] - TLMP --SA--> TLMGIRR[[TLM: Global Inflation Reimbursement Request]] - - classDef tlm fill:#54ebd5,stroke:#333,stroke-width:2px; - classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; - classDef event fill:#e8b761,stroke:#333,stroke-width:2px; - - class TLMP,TLMBEM,TLMGI,TLMGIRR tlm; - class SOAE event; - class CC question; -``` - -## TLM: Mint=Burn (MEB) - -_tl;dr The transfer of tokens from the application to the supplier based on the amount of work received and provided respectively.._ - -The `Mint=Burn` TLM is, _theoretically_, the only TLM necessary when the network -reaches equilibrium in the far future. - -The same amount of tokens that is minted in the **supplier module** is burned from -the **application module**. The stake of the application paying for work is reduced -and the rewards are distributed to the supplier and its revenue shareholder addresses. - -```mermaid ---- -title: "Token Logic Module: Mint=Burn" ---- -flowchart TD - SA(["Settlement Amount (SA)"]) - - SA -- Mint SA coins --> SM - SA -- Burn SA coins--> AM - - subgraph SO[Supplier Operations] - SM[[Supplier Module]] - SK[(Supplier Keeper)] - SD{Distribute SA coins} - OPA[Operator Address] - OA[Owner Address] - RSA[Revenue Share Addresses] - - SM -.- SK - SD -->|% Distribution
Increase Balance| OPA - SD -->|% Distribution
Increase Balance| OA - SD -->|% Distribution
Increase Balance| RSA - end - - subgraph AO[Application Operations] - AM[[Application Module]] - AK[(Application Keeper)] - AA[Application Address] - - AM -.- AK - AK -. Reduce Stake by SA .-> AA - AA -.- TODO{See TODO below} - end - - SM --> SD - - classDef module fill:#f9f,stroke:#333,stroke-width:2px; - classDef address fill:#bbf,stroke:#333,stroke-width:2px; - classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; - classDef event fill:#e8b761,stroke:#333,stroke-width:2px; - - class SM,AM module; - class RSA,OA,OPA,AA address; - class TODO question; -``` - -:::note - -TODO_MAINNET: If the application stake has dropped to (near?) zero, should -we unstake it? Should we use it's balance? Should their be a payee of last resort? -Make sure to document whatever decision we come to. - -::: - -## TLM: Global Mint (GM) - -_tl;dr Distributed newly minted coins on a per claim basis to all involved stakeholders._ - -The `Global Mint` TLM is, _theoretically_, going to reach `zero`the only when the network -reaches equilibrium in the far future. - -On a per claim basis, the network mints new tokens based on the the amount of work -claimed. The newly minted tokens are distributed to the supplier, DAO, service owner -and application based on the values of various governance params. - -```mermaid ---- -title: "Token Logic Module: Global Mint" ---- -flowchart TD - SC(["Settlement Coin (SC)"]) - PCI(["Per Claim Global Inflation
(Governance Parameter)"]) - IMC(["Inflation Mint Coin (IMC)"]) - - DA(["DAO Mint Allocation"]) - PA(["Proposer Mint Allocation"]) - SA(["Supplier Mint Allocation"]) - SOA(["Source Owner Mint Allocation"]) - AA(["Application Mint Allocation"]) - - - SC --> IMC - PCI --> IMC - IMC --> TO - - subgraph TO[Tokenomics Operations] - TM[[Tokenomics Module]] - TK[(Tokenomics Keeper)] - TM -..- TK - end - - - DA --> ID - PA --> ID - TO -- New Mint Coin (NMC)--> ID - SA --> ID - AA --> ID - - subgraph ID[Inflation Distribution] - NMC["New Mint Coin (NMC)"] - APPA["Application Address"] - SPPA["Supplier Address"] - DAOA["DAO Address"] - SOA["Service Owner Address"] - PRA["Proposer Address"] - - NMC -->|% Mint Allocation| APPA - NMC -->|% Mint Allocation| SPPA - NMC -->|% Mint Allocation| DAOA - NMC -->|% Mint Allocation| SOA - NMC -->|% Mint Allocation| PRA - end - - classDef module fill:#f9f,stroke:#333,stroke-width:2px; - classDef address fill:#bbf,stroke:#333,stroke-width:2px; - classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; - classDef govparam fill:#d04a36,stroke:#333,stroke-width:2px; - classDef event fill:#e8b761,stroke:#333,stroke-width:2px; - - class TM module; - class PCI,DA,PA,SA,AA govparam; - class APPA,SPPA,DAOA,SOA,PRA address; -``` - -## TLM: Global Mint Reimbursement Request (GMRR) - -_tl;dr Prevent self-dealing by over-charging applications, sending the excess to the DAO/PNF, and emitting an event as a reimbursement request._ - -This TLM **MUST** be processed alongside the Global Mint TLM. - -This TLM can, **theoretically**, be removed if self-dealing attacks are not a concern, -or if the global mint per claim governance parameter is set to zero. - -The goal of the TLM is to overcharge applications equal to the global inflation amount -and send those funds to the DAO/PNF. This forces potentially self-dealing gateways to -"show face" in front of the DAO/PNF and request reimbursement. - -The event emitted creates an easy, onchain mechanism, to track reimbursement handled offchain. - -A side effect of this TLM is creating additional buy pressure of the token as Applications -and Gateways will be responsible for frequently "topping up" their balances and app stakes. - -```mermaid ---- -title: "Token Logic Module: Global Mint Reimbursement Request" ---- -flowchart TD - SC(["Settlement Coin (SC)"]) - PCI(["Per Claim Global Inflation
(Governance Parameter)"]) - IMC(["Inflation Mint Coin (IMC)"]) - ARRE{{Application Reimbursement
Request Event}} - - SC --> IMC - PCI --> IMC - IMC --IMC--> AO - - - subgraph AO[Application Operations] - AM[[Application Module]] - AK[(Application Keeper)] - AA[Application Address] - DA[DAO Address] - - AM -.- AK - AK -. Reduce Stake by IMC .-> AA - AM -..-> |Increase Balance by IMC| DA - end - - AO -. Emit Event.-> ARRE - - classDef module fill:#f9f,stroke:#333,stroke-width:2px; - classDef address fill:#bbf,stroke:#333,stroke-width:2px; - classDef question fill:#e3db6d,stroke:#333,stroke-width:2px; - classDef govparam fill:#d04a36,stroke:#333,stroke-width:2px; - classDef event fill:#e8b761,stroke:#333,stroke-width:2px; - - class AM module; - class ARRE event; - class PCI govparam; - class AA,DA address; -``` diff --git a/docusaurus/docs/protocol/upgrades/_category_.json b/docusaurus/docs/protocol/upgrades/_category_.json index 2e80f4c80..5fe4a715b 100644 --- a/docusaurus/docs/protocol/upgrades/_category_.json +++ b/docusaurus/docs/protocol/upgrades/_category_.json @@ -1,6 +1,6 @@ { "label": "Upgrades", - "position": 4, + "position": 7, "link": { "type": "generated-index", "description": "Documentation related to Pocket Network protocol upgrades." From eeabb30c17d82ad363619fc19231483dd303f006 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 21 Aug 2024 15:33:06 -0400 Subject: [PATCH 05/48] Performed self review --- e2e/tests/0_settlement.feature | 3 +++ pkg/relayer/session/sessiontree.go | 1 + x/tokenomics/keeper/token_logic_modules.go | 12 +++++------- x/tokenomics/keeper/token_logic_modules_test.go | 7 +++++-- .../keeper/update_relay_mining_difficulty.go | 6 ++++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index 358d2cd27..b4eaf2441 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -26,6 +26,9 @@ Feature: Tokenomics Namespace 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 + # TODO_IN_THIS_PR: Add the following test + # Scenario: Supplier overservices an application and gets paid for less work than claimed + # TODO_ADDTEST: Implement the following scenarios # Scenario: Emissions equals burn when a claim is created and a valid proof is submitted but not required # Scenario: No emissions or burn when a claim is created and an invalid proof is submitted diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index d54992c82..1a45883e1 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -70,6 +70,7 @@ type sessionTree struct { // removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. // It returns an error if the KVStore fails to be created. // TODO_BETA(@red-0ne): When starting a new session, check how many relays the app can handle. +// See the TODO next to the `sessionTree` struct definition for more details. func NewSessionTree( sessionHeader *sessiontypes.SessionHeader, supplierOperatorAddress *cosmostypes.AccAddress, diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index a05b1aee2..72c5bf2b7 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -26,12 +26,10 @@ import ( const ( // Governance parameters for the TLMGlobalMint module - // TODO_BETA_TEST(@olshansk): Remove this. It is an ephemeral placeholder before - // real values are introduced. When this is changed to a governance param, - // make sure to also add the necessary unit tests. + // TODO_UPNEXT(@olshansk, #732): Make this a governance parameter and give it a non-zero value + tests. MintPerClaimGlobalInflation = 0.0000000 - // TODO_BETA: Make all of the governance params + // TODO_BETA(@bryanchriswhite): Make all of the governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 MintAllocationSupplier = 0.7 @@ -97,7 +95,7 @@ type TokenLogicModuleProcessor func( var tokenLogicModuleProcessorMap = map[TokenLogicModule]TokenLogicModuleProcessor{ TLMRelayBurnEqualsMint: Keeper.TokenLogicModuleRelayBurnEqualsMint, TLMGlobalMint: Keeper.TokenLogicModuleGlobalMint, - // TODO_BETA_UPNEXT(@Olshansky): Uncomment this and add tests. + // TODO_UPNEXT(@olshansk, #732): Uncomment this, finish implementation, and add tests. // TLMGlobalMintReimbursementRequest: Keeper.TokenLogicModuleGlobalMintReimbursementRequest, } @@ -423,10 +421,10 @@ func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( newMintCoins, _ := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoins) /* - TODO_UPNEXT_BETA(@Olshansky): Finish implementing this: + TODO_UPNEXT(@olshansk, #732): Finish implementing this: 1. Overcharge the application (reduce stake and burn app module tokens) 2. Send the overcharge to the DAO/PNF address - 3. Add extensive tests for this. + 3. Add necessary tests. */ // Prepare and emit the event for the application being overcharged diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 50fecad21..e842abe59 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -33,8 +33,11 @@ func init() { cmd.InitSDKConfig() } -// TODO_IN_THIS_PR: Tests to add or list -// claimSettlementAmount > maxClaimableAmount +// TODO_IN_THIS_PR: Add these tests or update existing tests to account for it. +// func TestProcessTokenLogicModules_HandleMaxClaimGreaterActualClaim(t *testing.T) {...} +// TODO_UPNEXT(@olshansk, #732): Add the following tests +// func TestProcessTokenLogicModules_ValidateAppOverServicingEvent(t *testing.T) {...} +// func TestProcessTokenLogicModules_ValidateAppReimbursedRequestEvent(t *testing.T) {...} func TestProcessTokenLogicModules_HandleAppGoingIntoDebt(t *testing.T) { keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil) diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty.go b/x/tokenomics/keeper/update_relay_mining_difficulty.go index d563db86b..e93b1574d 100644 --- a/x/tokenomics/keeper/update_relay_mining_difficulty.go +++ b/x/tokenomics/keeper/update_relay_mining_difficulty.go @@ -183,6 +183,9 @@ func computeEma(alpha *big.Float, prevEma, currValue uint64) uint64 { return newEma } +// newDefaultRelayMiningDifficulty is a helper that creates a new RelayMiningDifficulty +// structure if one is not available. It is often used to set the default when a service's +// difficulty is being initialized for the first time. func newDefaultRelayMiningDifficulty( ctx context.Context, methodLogger log.Logger, @@ -192,8 +195,7 @@ func newDefaultRelayMiningDifficulty( logger := methodLogger.With("helper", "newDefaultRelayMiningDifficulty") logger.Warn(types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf( "No previous relay mining difficulty found for service %s. Creating a temporary relay mining difficulty with %d relays and default target hash %x", - serviceId, numRelays, - ).Error()) + serviceId, numRelays, prooftypes.DefaultRelayDifficultyTargetHash).Error()) return tokenomicstypes.RelayMiningDifficulty{ ServiceId: serviceId, From 0e725a44a0daba5368af781215926d50e233dc29 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Aug 2024 16:53:10 -0400 Subject: [PATCH 06/48] Remove everything related to TLMGlobalMintReimbursementRequest --- api/poktroll/tokenomics/event.pulsar.go | 792 +-------------------- proto/poktroll/tokenomics/event.proto | 11 +- x/tokenomics/keeper/token_logic_modules.go | 47 -- x/tokenomics/types/event.pb.go | 432 ++--------- 4 files changed, 87 insertions(+), 1195 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index afb700d4a..25caeaa82 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2459,633 +2459,6 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface } } -var ( - md_EventApplicationReimbursementRequest protoreflect.MessageDescriptor - fd_EventApplicationReimbursementRequest_application_addr protoreflect.FieldDescriptor - fd_EventApplicationReimbursementRequest_service_id protoreflect.FieldDescriptor - fd_EventApplicationReimbursementRequest_session_id protoreflect.FieldDescriptor - fd_EventApplicationReimbursementRequest_amount protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_event_proto_init() - md_EventApplicationReimbursementRequest = File_poktroll_tokenomics_event_proto.Messages().ByName("EventApplicationReimbursementRequest") - fd_EventApplicationReimbursementRequest_application_addr = md_EventApplicationReimbursementRequest.Fields().ByName("application_addr") - fd_EventApplicationReimbursementRequest_service_id = md_EventApplicationReimbursementRequest.Fields().ByName("service_id") - fd_EventApplicationReimbursementRequest_session_id = md_EventApplicationReimbursementRequest.Fields().ByName("session_id") - fd_EventApplicationReimbursementRequest_amount = md_EventApplicationReimbursementRequest.Fields().ByName("amount") -} - -var _ protoreflect.Message = (*fastReflection_EventApplicationReimbursementRequest)(nil) - -type fastReflection_EventApplicationReimbursementRequest EventApplicationReimbursementRequest - -func (x *EventApplicationReimbursementRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventApplicationReimbursementRequest)(x) -} - -func (x *EventApplicationReimbursementRequest) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_EventApplicationReimbursementRequest_messageType fastReflection_EventApplicationReimbursementRequest_messageType -var _ protoreflect.MessageType = fastReflection_EventApplicationReimbursementRequest_messageType{} - -type fastReflection_EventApplicationReimbursementRequest_messageType struct{} - -func (x fastReflection_EventApplicationReimbursementRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventApplicationReimbursementRequest)(nil) -} -func (x fastReflection_EventApplicationReimbursementRequest_messageType) New() protoreflect.Message { - return new(fastReflection_EventApplicationReimbursementRequest) -} -func (x fastReflection_EventApplicationReimbursementRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventApplicationReimbursementRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventApplicationReimbursementRequest) Descriptor() protoreflect.MessageDescriptor { - return md_EventApplicationReimbursementRequest -} - -// 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_EventApplicationReimbursementRequest) Type() protoreflect.MessageType { - return _fastReflection_EventApplicationReimbursementRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventApplicationReimbursementRequest) New() protoreflect.Message { - return new(fastReflection_EventApplicationReimbursementRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventApplicationReimbursementRequest) Interface() protoreflect.ProtoMessage { - return (*EventApplicationReimbursementRequest)(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_EventApplicationReimbursementRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ApplicationAddr != "" { - value := protoreflect.ValueOfString(x.ApplicationAddr) - if !f(fd_EventApplicationReimbursementRequest_application_addr, value) { - return - } - } - if x.ServiceId != "" { - value := protoreflect.ValueOfString(x.ServiceId) - if !f(fd_EventApplicationReimbursementRequest_service_id, value) { - return - } - } - if x.SessionId != "" { - value := protoreflect.ValueOfString(x.SessionId) - if !f(fd_EventApplicationReimbursementRequest_session_id, value) { - return - } - } - if x.Amount != nil { - value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) - if !f(fd_EventApplicationReimbursementRequest_amount, 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_EventApplicationReimbursementRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - return x.ApplicationAddr != "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - return x.ServiceId != "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - return x.SessionId != "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - return x.Amount != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - x.ApplicationAddr = "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - x.ServiceId = "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - x.SessionId = "" - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - x.Amount = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - value := x.ApplicationAddr - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - value := x.ServiceId - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - value := x.SessionId - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - value := x.Amount - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - x.ApplicationAddr = value.Interface().(string) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - x.ServiceId = value.Interface().(string) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - x.SessionId = value.Interface().(string) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - x.Amount = value.Message().Interface().(*v1beta1.Coin) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - if x.Amount == nil { - x.Amount = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - panic(fmt.Errorf("field application_addr of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - panic(fmt.Errorf("field service_id of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - panic(fmt.Errorf("field session_id of message poktroll.tokenomics.EventApplicationReimbursementRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.EventApplicationReimbursementRequest.application_addr": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventApplicationReimbursementRequest.service_id": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventApplicationReimbursementRequest.session_id": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventApplicationReimbursementRequest.amount": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationReimbursementRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventApplicationReimbursementRequest 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_EventApplicationReimbursementRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.EventApplicationReimbursementRequest", 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) 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_EventApplicationReimbursementRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventApplicationReimbursementRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ApplicationAddr) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.ServiceId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.SessionId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Amount != nil { - l = options.Size(x.Amount) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventApplicationReimbursementRequest) - 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.Amount != nil { - encoded, err := options.Marshal(x.Amount) - 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] = 0x22 - } - if len(x.SessionId) > 0 { - i -= len(x.SessionId) - copy(dAtA[i:], x.SessionId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) - i-- - dAtA[i] = 0x1a - } - if len(x.ServiceId) > 0 { - i -= len(x.ServiceId) - copy(dAtA[i:], x.ServiceId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) - i-- - dAtA[i] = 0x12 - } - if len(x.ApplicationAddr) > 0 { - i -= len(x.ApplicationAddr) - copy(dAtA[i:], x.ApplicationAddr) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ApplicationAddr))) - 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().(*EventApplicationReimbursementRequest) - 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: EventApplicationReimbursementRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventApplicationReimbursementRequest: 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 ApplicationAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.ApplicationAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.SessionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount == nil { - x.Amount = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3409,67 +2782,6 @@ func (x *EventApplicationOverserviced) GetEffectiveBurn() *v1beta1.Coin { return nil } -// EventApplicationReimbursementRequest is emitted when an application requests -// a reimbursement -type EventApplicationReimbursementRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - ServiceId string `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Amount *v1beta1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (x *EventApplicationReimbursementRequest) Reset() { - *x = EventApplicationReimbursementRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventApplicationReimbursementRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventApplicationReimbursementRequest) ProtoMessage() {} - -// Deprecated: Use EventApplicationReimbursementRequest.ProtoReflect.Descriptor instead. -func (*EventApplicationReimbursementRequest) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{4} -} - -func (x *EventApplicationReimbursementRequest) GetApplicationAddr() string { - if x != nil { - return x.ApplicationAddr - } - return "" -} - -func (x *EventApplicationReimbursementRequest) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *EventApplicationReimbursementRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *EventApplicationReimbursementRequest) GetAmount() *v1beta1.Coin { - if x != nil { - return x.Amount - } - return nil -} - var File_poktroll_tokenomics_event_proto protoreflect.FileDescriptor var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ @@ -3552,37 +2864,25 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x22, 0xc2, 0x01, 0x0a, 0x24, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x69, 0x6d, 0x62, - 0x75, 0x72, 0x73, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x04, 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, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, - 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, - 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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, + 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, + 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, + 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, + 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, + 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, + 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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 ( @@ -3598,31 +2898,29 @@ func file_poktroll_tokenomics_event_proto_rawDescGZIP() []byte { } var file_poktroll_tokenomics_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_tokenomics_event_proto_goTypes = []interface{}{ - (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason - (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired - (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled - (*EventRelayMiningDifficultyUpdated)(nil), // 3: poktroll.tokenomics.EventRelayMiningDifficultyUpdated - (*EventApplicationOverserviced)(nil), // 4: poktroll.tokenomics.EventApplicationOverserviced - (*EventApplicationReimbursementRequest)(nil), // 5: poktroll.tokenomics.EventApplicationReimbursementRequest - (*proof.Claim)(nil), // 6: poktroll.proof.Claim - (proof.ProofRequirementReason)(0), // 7: poktroll.proof.ProofRequirementReason - (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin + (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason + (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired + (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled + (*EventRelayMiningDifficultyUpdated)(nil), // 3: poktroll.tokenomics.EventRelayMiningDifficultyUpdated + (*EventApplicationOverserviced)(nil), // 4: poktroll.tokenomics.EventApplicationOverserviced + (*proof.Claim)(nil), // 5: poktroll.proof.Claim + (proof.ProofRequirementReason)(0), // 6: poktroll.proof.ProofRequirementReason + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin } var file_poktroll_tokenomics_event_proto_depIdxs = []int32{ - 6, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim + 5, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim 0, // 1: poktroll.tokenomics.EventClaimExpired.expiration_reason:type_name -> poktroll.tokenomics.ClaimExpirationReason - 6, // 2: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim - 7, // 3: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason - 8, // 4: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin - 8, // 5: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin - 8, // 6: poktroll.tokenomics.EventApplicationReimbursementRequest.amount:type_name -> cosmos.base.v1beta1.Coin - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] 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 + 5, // 2: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim + 6, // 3: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason + 7, // 4: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin + 7, // 5: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin + 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_tokenomics_event_proto_init() } @@ -3679,18 +2977,6 @@ func file_poktroll_tokenomics_event_proto_init() { return nil } } - file_poktroll_tokenomics_event_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventApplicationReimbursementRequest); 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{ @@ -3698,7 +2984,7 @@ func file_poktroll_tokenomics_event_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_tokenomics_event_proto_rawDesc, NumEnums: 1, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index f5af15a76..9b07d8ae1 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -57,13 +57,4 @@ message EventApplicationOverserviced { // most likely equal to the application's stake divided by the number of suppliers // in a session. cosmos.base.v1beta1.Coin effective_burn = 4; -} - -// EventApplicationReimbursementRequest is emitted when an application requests -// a reimbursement -message EventApplicationReimbursementRequest { - string application_addr = 1; - string service_id = 2; - string session_id = 3; - cosmos.base.v1beta1.Coin amount = 4; -} +} \ No newline at end of file diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 72c5bf2b7..3db0c9b41 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -50,20 +50,11 @@ const ( // on global governance parameters in order to reward the participants providing // services while keeping inflation in check. TLMGlobalMint - - // TLMGlobalMintReimbursementRequest is the token logic module that complements - // TLMGlobalMint to enable permissionless demand. In order to prevent self-dealing - // attacks, applications will be overcharged by the amount equal to global inflation, - // those funds will be sent to the DAO/PNF, and an event will be emitted to track - // and send reimbursements; managed offchain by PNF. - // TODO_POST_MAINNET: Introduce proper tokenomics based on the research done by @rawthil and @shane. - TLMGlobalMintReimbursementRequest ) var tokenLogicModuleStrings = [...]string{ "TLMRelayBurnEqualsMint", "TLMGlobalMint", - "TLMGlobalMintReimbursementRequest", } func (tlm TokenLogicModule) String() string { @@ -95,8 +86,6 @@ type TokenLogicModuleProcessor func( var tokenLogicModuleProcessorMap = map[TokenLogicModule]TokenLogicModuleProcessor{ TLMRelayBurnEqualsMint: Keeper.TokenLogicModuleRelayBurnEqualsMint, TLMGlobalMint: Keeper.TokenLogicModuleGlobalMint, - // TODO_UPNEXT(@olshansk, #732): Uncomment this, finish implementation, and add tests. - // TLMGlobalMintReimbursementRequest: Keeper.TokenLogicModuleGlobalMintReimbursementRequest, } func init() { @@ -406,42 +395,6 @@ func (k Keeper) TokenLogicModuleGlobalMint( return nil } -// TokenLogicModuleGlobalMintReimbursementRequest processes the business logic for the GlobalMintReimbursementRequest TLM. -func (k Keeper) TokenLogicModuleGlobalMintReimbursementRequest( - ctx context.Context, - service *sharedtypes.Service, - sessionHeader *sessiontypes.SessionHeader, - application *apptypes.Application, - supplier *sharedtypes.Supplier, - settlementCoins cosmostypes.Coin, - relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, -) error { - - // Determine how much new uPOKT to mint based on global inflation - newMintCoins, _ := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoins) - - /* - TODO_UPNEXT(@olshansk, #732): Finish implementing this: - 1. Overcharge the application (reduce stake and burn app module tokens) - 2. Send the overcharge to the DAO/PNF address - 3. Add necessary tests. - */ - - // Prepare and emit the event for the application being overcharged - reimbursementRequestEvent := tokenomictypes.EventApplicationReimbursementRequest{ - ApplicationAddr: application.Address, - ServiceId: service.Id, - SessionId: sessionHeader.SessionId, - Amount: &newMintCoins[0], - } - eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() - if err := eventManager.EmitTypedEvent(&reimbursementRequestEvent); err != nil { - return tokenomicstypes.ErrTokenomicsEmittingEventFailed.Wrapf("error emitting event %v", reimbursementRequestEvent) - } - - return nil -} - // sendRewardsToAccount sends (settlementAmtFloat * allocation) tokens from the // tokenomics module account to the specified address. func (k Keeper) sendRewardsToAccount( diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 27a0d9614..648c6afbb 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -350,139 +350,64 @@ func (m *EventApplicationOverserviced) GetEffectiveBurn() *types1.Coin { return nil } -// EventApplicationReimbursementRequest is emitted when an application requests -// a reimbursement -type EventApplicationReimbursementRequest struct { - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - ServiceId string `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Amount *types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *EventApplicationReimbursementRequest) Reset() { *m = EventApplicationReimbursementRequest{} } -func (m *EventApplicationReimbursementRequest) String() string { return proto.CompactTextString(m) } -func (*EventApplicationReimbursementRequest) ProtoMessage() {} -func (*EventApplicationReimbursementRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a78874bbf91a58c7, []int{4} -} -func (m *EventApplicationReimbursementRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventApplicationReimbursementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventApplicationReimbursementRequest.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 *EventApplicationReimbursementRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventApplicationReimbursementRequest.Merge(m, src) -} -func (m *EventApplicationReimbursementRequest) XXX_Size() int { - return m.Size() -} -func (m *EventApplicationReimbursementRequest) XXX_DiscardUnknown() { - xxx_messageInfo_EventApplicationReimbursementRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_EventApplicationReimbursementRequest proto.InternalMessageInfo - -func (m *EventApplicationReimbursementRequest) GetApplicationAddr() string { - if m != nil { - return m.ApplicationAddr - } - return "" -} - -func (m *EventApplicationReimbursementRequest) GetServiceId() string { - if m != nil { - return m.ServiceId - } - return "" -} - -func (m *EventApplicationReimbursementRequest) GetSessionId() string { - if m != nil { - return m.SessionId - } - return "" -} - -func (m *EventApplicationReimbursementRequest) GetAmount() *types1.Coin { - if m != nil { - return m.Amount - } - return nil -} - func init() { proto.RegisterEnum("poktroll.tokenomics.ClaimExpirationReason", ClaimExpirationReason_name, ClaimExpirationReason_value) proto.RegisterType((*EventClaimExpired)(nil), "poktroll.tokenomics.EventClaimExpired") proto.RegisterType((*EventClaimSettled)(nil), "poktroll.tokenomics.EventClaimSettled") proto.RegisterType((*EventRelayMiningDifficultyUpdated)(nil), "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") proto.RegisterType((*EventApplicationOverserviced)(nil), "poktroll.tokenomics.EventApplicationOverserviced") - proto.RegisterType((*EventApplicationReimbursementRequest)(nil), "poktroll.tokenomics.EventApplicationReimbursementRequest") } func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 786 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0x8e, 0x73, 0x73, 0xaf, 0x94, 0xb9, 0x37, 0x6d, 0x32, 0x97, 0x8a, 0x50, 0xee, 0x4d, 0x7a, - 0x03, 0x42, 0xa5, 0xa8, 0xb6, 0xda, 0x4a, 0xac, 0x50, 0x45, 0x92, 0xba, 0xd4, 0x12, 0x4d, 0x22, - 0xa7, 0x45, 0x88, 0x8d, 0x71, 0xec, 0x93, 0x64, 0x68, 0x3c, 0xe3, 0xce, 0x8c, 0x93, 0xf4, 0x2d, - 0x78, 0x00, 0x5e, 0x80, 0x05, 0x2f, 0xc1, 0x8a, 0x65, 0x97, 0xac, 0x2a, 0xd4, 0xee, 0xba, 0xe2, - 0x11, 0x90, 0xc7, 0xce, 0x4f, 0xd3, 0x02, 0x62, 0xc9, 0x26, 0x99, 0x7c, 0xe7, 0x3b, 0x7f, 0xdf, - 0x9c, 0x39, 0x41, 0xd5, 0x90, 0x5d, 0x48, 0xce, 0x46, 0x23, 0x43, 0xb2, 0x0b, 0xa0, 0x2c, 0x20, - 0x9e, 0x30, 0x60, 0x0c, 0x54, 0xea, 0x21, 0x67, 0x92, 0xe1, 0xd7, 0x33, 0x82, 0xbe, 0x20, 0x6c, - 0x56, 0x3c, 0x26, 0x02, 0x26, 0x8c, 0x9e, 0x2b, 0xc0, 0x18, 0xef, 0xf5, 0x40, 0xba, 0x7b, 0x86, - 0xc7, 0x08, 0x4d, 0x9c, 0x36, 0xdf, 0x1b, 0xb0, 0x01, 0x53, 0x47, 0x23, 0x3e, 0xa5, 0xe8, 0xe6, - 0x3c, 0x57, 0xc8, 0x19, 0xeb, 0x1b, 0xf2, 0x2a, 0x04, 0x91, 0xd8, 0x6a, 0xbf, 0x64, 0x51, 0xc9, - 0x8c, 0xd3, 0x36, 0x47, 0x2e, 0x09, 0xcc, 0x69, 0x48, 0x38, 0xf8, 0xf8, 0x73, 0xf4, 0xdc, 0x8b, - 0x7f, 0x97, 0xb5, 0x2d, 0x6d, 0xfb, 0xe5, 0xfe, 0x86, 0x3e, 0x2f, 0x46, 0x45, 0xd0, 0x15, 0xb9, - 0x91, 0xbf, 0xbf, 0xa9, 0x26, 0x3c, 0x3b, 0xf9, 0xc2, 0xbb, 0x08, 0xd1, 0x28, 0x70, 0x38, 0x8c, - 0xdc, 0x2b, 0x51, 0xce, 0x6e, 0x69, 0xdb, 0xb9, 0xc6, 0xda, 0xfd, 0x4d, 0x75, 0x09, 0xb5, 0xf3, - 0x34, 0x0a, 0x6c, 0x75, 0xc4, 0x75, 0x54, 0x8a, 0x0d, 0x1e, 0x0b, 0xc2, 0x48, 0x82, 0x13, 0x51, - 0x22, 0x45, 0xf9, 0x99, 0xf2, 0xda, 0xb8, 0xbf, 0xa9, 0x3e, 0x36, 0xda, 0xeb, 0x34, 0x0a, 0x9a, - 0x09, 0x72, 0x1e, 0x03, 0x98, 0xa2, 0x12, 0xc4, 0x45, 0xbb, 0x92, 0x30, 0xea, 0x70, 0x70, 0x05, - 0xa3, 0xe5, 0xdc, 0x96, 0xb6, 0xbd, 0xb6, 0xbf, 0xa3, 0x3f, 0x21, 0xa1, 0xbe, 0xe8, 0x53, 0xb9, - 0xd8, 0xca, 0x23, 0x49, 0xf7, 0x28, 0x90, 0x5d, 0x84, 0x15, 0x62, 0xed, 0xe7, 0x07, 0x7a, 0x75, - 0x41, 0xca, 0xd1, 0xff, 0x4a, 0xaf, 0x1f, 0x50, 0x49, 0x95, 0xe4, 0x70, 0xb8, 0x8c, 0x08, 0x87, - 0x00, 0xa8, 0x4c, 0xf5, 0xfa, 0x64, 0xb5, 0xea, 0x4e, 0xfc, 0x69, 0x2f, 0x78, 0xcb, 0x5a, 0x3d, - 0x0a, 0x62, 0x17, 0xc3, 0x15, 0x7a, 0xed, 0xa7, 0x2c, 0x7a, 0xa7, 0xb4, 0x52, 0xe5, 0x9f, 0x12, - 0x4a, 0xe8, 0xe0, 0x88, 0xf4, 0xfb, 0xc4, 0x8b, 0x46, 0xf2, 0xea, 0x3c, 0xf4, 0x5d, 0x09, 0x3e, - 0x7e, 0x8b, 0x90, 0x00, 0x3e, 0x26, 0x1e, 0x38, 0xc4, 0x57, 0x02, 0xe6, 0xed, 0x7c, 0x8a, 0x58, - 0x3e, 0x3e, 0x44, 0x6f, 0x42, 0x0e, 0x63, 0x47, 0xba, 0x7c, 0x00, 0xd2, 0x19, 0xba, 0x62, 0xe8, - 0x0c, 0x61, 0xea, 0x00, 0xf5, 0x98, 0x0f, 0xbe, 0x12, 0x2d, 0x6f, 0x97, 0x63, 0xce, 0x99, 0xa2, - 0x9c, 0xb8, 0x62, 0x78, 0x02, 0x53, 0x33, 0xb1, 0xe3, 0x2f, 0xd0, 0x87, 0x14, 0x26, 0x7f, 0xeb, - 0xfe, 0x4c, 0xb9, 0xbf, 0x4f, 0x61, 0xf2, 0xa4, 0xf7, 0x2e, 0x7a, 0xad, 0xb2, 0x2f, 0xee, 0xc3, - 0x81, 0xc0, 0x55, 0x82, 0xe5, 0xe2, 0x8e, 0x61, 0xdc, 0x9a, 0xdd, 0x8e, 0x19, 0xb8, 0xf8, 0x33, - 0x84, 0xe3, 0x64, 0x2b, 0xec, 0xe7, 0x8a, 0xbd, 0x4e, 0x61, 0xb2, 0x4c, 0xae, 0xfd, 0xa9, 0xa1, - 0x37, 0x4a, 0x9e, 0x7a, 0x18, 0x8e, 0x88, 0xa7, 0xa6, 0xac, 0x3d, 0x06, 0x9e, 0xf6, 0xee, 0xe3, - 0x4f, 0x51, 0xd1, 0x5d, 0x98, 0x1c, 0xd7, 0xf7, 0x79, 0xaa, 0xcf, 0xfa, 0x12, 0x5e, 0xf7, 0x7d, - 0x8e, 0x3f, 0x42, 0x05, 0x11, 0xc5, 0x18, 0xf0, 0x84, 0x97, 0xc8, 0xf2, 0x6a, 0x06, 0x2a, 0xd2, - 0x21, 0x2a, 0xc0, 0x34, 0x04, 0x4f, 0x82, 0xef, 0xf4, 0x22, 0x4e, 0x55, 0xf3, 0x2f, 0xf7, 0x3f, - 0xd0, 0x93, 0xad, 0xa2, 0xc7, 0x5b, 0x45, 0x4f, 0xb7, 0x8a, 0xde, 0x64, 0x84, 0xda, 0xaf, 0x66, - 0xfc, 0x46, 0xc4, 0x29, 0xfe, 0x12, 0xad, 0x41, 0xbf, 0x0f, 0x9e, 0x24, 0x63, 0x48, 0x02, 0xe4, - 0xfe, 0x2d, 0x40, 0x61, 0xee, 0x10, 0x47, 0xa8, 0xfd, 0xaa, 0xa1, 0x8f, 0x57, 0x5b, 0xb6, 0x81, - 0x04, 0xbd, 0x88, 0x8b, 0x74, 0xc4, 0x2e, 0x23, 0x10, 0xf2, 0xbf, 0xb4, 0xfe, 0x70, 0x7e, 0xb2, - 0xab, 0xf3, 0xa3, 0xcc, 0x42, 0xc4, 0x51, 0xc8, 0xec, 0xba, 0xf3, 0x29, 0x62, 0xf9, 0x78, 0x0f, - 0xbd, 0x70, 0x03, 0x16, 0xa5, 0x8f, 0xe0, 0x1f, 0x7b, 0x49, 0x89, 0x3b, 0xdf, 0xa3, 0x8d, 0x27, - 0x97, 0x08, 0x7e, 0x87, 0xde, 0x9a, 0xdf, 0x76, 0x2c, 0xbb, 0x7e, 0x66, 0xb5, 0x5b, 0x8e, 0x6d, - 0xd6, 0xbb, 0xed, 0x96, 0x73, 0xde, 0xea, 0x76, 0xcc, 0xa6, 0x75, 0x6c, 0x99, 0x47, 0xc5, 0x0c, - 0x2e, 0xa1, 0x42, 0xc7, 0x6e, 0xb7, 0x8f, 0x9d, 0x53, 0xab, 0xdb, 0xb5, 0x5a, 0x5f, 0x15, 0xb5, - 0x05, 0x64, 0xb5, 0xbe, 0xa9, 0x7f, 0x6d, 0x1d, 0x15, 0xb3, 0x8d, 0xd3, 0xdf, 0x6e, 0x2b, 0xda, - 0xf5, 0x6d, 0x45, 0xfb, 0xe3, 0xb6, 0xa2, 0xfd, 0x78, 0x57, 0xc9, 0x5c, 0xdf, 0x55, 0x32, 0xbf, - 0xdf, 0x55, 0x32, 0xdf, 0x1d, 0x0c, 0x88, 0x1c, 0x46, 0x3d, 0xdd, 0x63, 0x81, 0x11, 0xbf, 0xd6, - 0x5d, 0x0a, 0x72, 0xc2, 0xf8, 0x85, 0x31, 0x5f, 0xf1, 0xd3, 0xe5, 0x3f, 0x14, 0xb5, 0xe9, 0x7b, - 0x2f, 0xd4, 0xaa, 0x3f, 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xed, 0x40, 0xd7, 0x5c, 0x74, 0x06, - 0x00, 0x00, + // 730 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4d, 0x4f, 0xdb, 0x48, + 0x18, 0x8e, 0x43, 0x58, 0x29, 0x03, 0x81, 0xc4, 0x2c, 0xda, 0x2c, 0x0b, 0x09, 0x64, 0xa5, 0x15, + 0xcb, 0x0a, 0x5b, 0x80, 0xb4, 0xa7, 0x15, 0xda, 0x24, 0x98, 0xc5, 0xd2, 0x92, 0x44, 0x0e, 0x54, + 0x55, 0x2f, 0x53, 0xc7, 0x7e, 0x93, 0x4c, 0x89, 0x67, 0xdc, 0xf1, 0x38, 0x09, 0xff, 0xa2, 0x3f, + 0xa0, 0x7f, 0xa0, 0x87, 0xfe, 0x8f, 0x1e, 0x39, 0xf6, 0x84, 0x2a, 0xb8, 0x71, 0xea, 0x4f, 0xa8, + 0x3c, 0xce, 0x57, 0x03, 0x55, 0xcf, 0xbd, 0x24, 0x93, 0xe7, 0x7d, 0x9e, 0xf7, 0xe3, 0x99, 0xc9, + 0x8b, 0x8a, 0x3e, 0xbb, 0x12, 0x9c, 0xf5, 0x7a, 0xba, 0x60, 0x57, 0x40, 0x99, 0x47, 0x9c, 0x40, + 0x87, 0x3e, 0x50, 0xa1, 0xf9, 0x9c, 0x09, 0xa6, 0xae, 0x8d, 0x09, 0xda, 0x94, 0xb0, 0x51, 0x70, + 0x58, 0xe0, 0xb1, 0x40, 0x6f, 0xd9, 0x01, 0xe8, 0xfd, 0x83, 0x16, 0x08, 0xfb, 0x40, 0x77, 0x18, + 0xa1, 0xb1, 0x68, 0xe3, 0xe7, 0x0e, 0xeb, 0x30, 0x79, 0xd4, 0xa3, 0xd3, 0x08, 0xdd, 0x98, 0xd4, + 0xf2, 0x39, 0x63, 0x6d, 0x5d, 0x5c, 0xfb, 0x10, 0xc4, 0xb1, 0xd2, 0xfb, 0x24, 0xca, 0x19, 0x51, + 0xd9, 0x6a, 0xcf, 0x26, 0x9e, 0x31, 0xf4, 0x09, 0x07, 0x57, 0xfd, 0x1b, 0x2d, 0x3a, 0xd1, 0xef, + 0xbc, 0xb2, 0xad, 0xec, 0x2e, 0x1d, 0xae, 0x6b, 0x93, 0x66, 0x64, 0x06, 0x4d, 0x92, 0x2b, 0xe9, + 0x87, 0xdb, 0x62, 0xcc, 0xb3, 0xe2, 0x2f, 0x75, 0x1f, 0x21, 0x1a, 0x7a, 0x98, 0x43, 0xcf, 0xbe, + 0x0e, 0xf2, 0xc9, 0x6d, 0x65, 0x37, 0x55, 0x59, 0x79, 0xb8, 0x2d, 0xce, 0xa0, 0x56, 0x9a, 0x86, + 0x9e, 0x25, 0x8f, 0x6a, 0x19, 0xe5, 0xa2, 0x80, 0xc3, 0x3c, 0x3f, 0x14, 0x80, 0x43, 0x4a, 0x44, + 0x90, 0x5f, 0x90, 0xaa, 0xf5, 0x87, 0xdb, 0xe2, 0xe3, 0xa0, 0xb5, 0x4a, 0x43, 0xaf, 0x1a, 0x23, + 0x97, 0x11, 0xa0, 0x52, 0x94, 0x83, 0xa8, 0x69, 0x5b, 0x10, 0x46, 0x31, 0x07, 0x3b, 0x60, 0x34, + 0x9f, 0xda, 0x56, 0x76, 0x57, 0x0e, 0xf7, 0xb4, 0x27, 0x2c, 0xd4, 0xa6, 0x73, 0x4a, 0x89, 0x25, + 0x15, 0x71, 0xb9, 0x47, 0x89, 0xac, 0x2c, 0xcc, 0x11, 0x4b, 0xef, 0xbe, 0xf2, 0xab, 0x09, 0x42, + 0xf4, 0x7e, 0x28, 0xbf, 0x5e, 0xa1, 0x9c, 0x6c, 0x09, 0x73, 0x78, 0x1d, 0x12, 0x0e, 0x1e, 0x50, + 0x31, 0xf2, 0xeb, 0x8f, 0xf9, 0xae, 0x1b, 0xd1, 0xa7, 0x35, 0xe5, 0xcd, 0x7a, 0xf5, 0x28, 0x89, + 0x95, 0xf5, 0xe7, 0xe8, 0xa5, 0xb7, 0x49, 0xb4, 0x23, 0xbd, 0x92, 0xed, 0x9f, 0x13, 0x4a, 0x68, + 0xe7, 0x84, 0xb4, 0xdb, 0xc4, 0x09, 0x7b, 0xe2, 0xfa, 0xd2, 0x77, 0x6d, 0x01, 0xae, 0xba, 0x85, + 0x50, 0x00, 0xbc, 0x4f, 0x1c, 0xc0, 0xc4, 0x95, 0x06, 0xa6, 0xad, 0xf4, 0x08, 0x31, 0x5d, 0xf5, + 0x18, 0x6d, 0xfa, 0x1c, 0xfa, 0x58, 0xd8, 0xbc, 0x03, 0x02, 0x77, 0xed, 0xa0, 0x8b, 0xbb, 0x30, + 0xc4, 0x40, 0x1d, 0xe6, 0x82, 0x2b, 0x4d, 0x4b, 0x5b, 0xf9, 0x88, 0x73, 0x21, 0x29, 0x67, 0x76, + 0xd0, 0x3d, 0x83, 0xa1, 0x11, 0xc7, 0xd5, 0x7f, 0xd0, 0x6f, 0x14, 0x06, 0xdf, 0x94, 0x2f, 0x48, + 0xf9, 0x2f, 0x14, 0x06, 0x4f, 0xaa, 0xf7, 0xd1, 0x9a, 0xac, 0x3e, 0xbd, 0x0f, 0x0c, 0x9e, 0x2d, + 0x0d, 0x4b, 0x45, 0x13, 0x43, 0xbf, 0x36, 0xbe, 0x1d, 0xc3, 0xb3, 0xd5, 0xbf, 0x90, 0x1a, 0x15, + 0x9b, 0x63, 0x2f, 0x4a, 0xf6, 0x2a, 0x85, 0xc1, 0x2c, 0xb9, 0xf4, 0x59, 0x41, 0x9b, 0xd2, 0x9e, + 0xb2, 0xef, 0xf7, 0x88, 0x23, 0x5f, 0x59, 0xbd, 0x0f, 0x7c, 0x34, 0xbb, 0xab, 0xfe, 0x89, 0xb2, + 0xf6, 0x34, 0x84, 0x6d, 0xd7, 0xe5, 0x23, 0x7f, 0x56, 0x67, 0xf0, 0xb2, 0xeb, 0x72, 0xf5, 0x77, + 0x94, 0x09, 0xc2, 0x08, 0x03, 0x1e, 0xf3, 0x62, 0x5b, 0x96, 0xc7, 0xa0, 0x24, 0x1d, 0xa3, 0x0c, + 0x0c, 0x7d, 0x70, 0x04, 0xb8, 0xb8, 0x15, 0x72, 0x2a, 0x87, 0x5f, 0x3a, 0xfc, 0x55, 0x8b, 0xb7, + 0x8a, 0x16, 0x6d, 0x15, 0x6d, 0xb4, 0x55, 0xb4, 0x2a, 0x23, 0xd4, 0x5a, 0x1e, 0xf3, 0x2b, 0x21, + 0xa7, 0xea, 0xbf, 0x68, 0x05, 0xda, 0x6d, 0x70, 0x04, 0xe9, 0x43, 0x9c, 0x20, 0xf5, 0xbd, 0x04, + 0x99, 0x89, 0x20, 0xca, 0xb0, 0xf7, 0x12, 0xad, 0x3f, 0xf9, 0xff, 0x53, 0x77, 0xd0, 0x96, 0xf1, + 0xbc, 0x61, 0x5a, 0xe5, 0x0b, 0xb3, 0x5e, 0xc3, 0x96, 0x51, 0x6e, 0xd6, 0x6b, 0xf8, 0xb2, 0xd6, + 0x6c, 0x18, 0x55, 0xf3, 0xd4, 0x34, 0x4e, 0xb2, 0x09, 0x35, 0x87, 0x32, 0x0d, 0xab, 0x5e, 0x3f, + 0xc5, 0xe7, 0x66, 0xb3, 0x69, 0xd6, 0xfe, 0xcb, 0x2a, 0x53, 0xc8, 0xac, 0x3d, 0x2b, 0xff, 0x6f, + 0x9e, 0x64, 0x93, 0x95, 0xf3, 0x0f, 0x77, 0x05, 0xe5, 0xe6, 0xae, 0xa0, 0x7c, 0xba, 0x2b, 0x28, + 0x6f, 0xee, 0x0b, 0x89, 0x9b, 0xfb, 0x42, 0xe2, 0xe3, 0x7d, 0x21, 0xf1, 0xe2, 0xa8, 0x43, 0x44, + 0x37, 0x6c, 0x69, 0x0e, 0xf3, 0xf4, 0xe8, 0xa1, 0xef, 0x53, 0x10, 0x03, 0xc6, 0xaf, 0xf4, 0xc9, + 0x76, 0x1c, 0xce, 0xee, 0x62, 0xb9, 0x24, 0x5b, 0x3f, 0xc9, 0x2d, 0x79, 0xf4, 0x25, 0x00, 0x00, + 0xff, 0xff, 0x0c, 0xdb, 0x5a, 0x92, 0xaf, 0x05, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -700,62 +625,6 @@ func (m *EventApplicationOverserviced) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *EventApplicationReimbursementRequest) 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 *EventApplicationReimbursementRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventApplicationReimbursementRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != nil { - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.SessionId) > 0 { - i -= len(m.SessionId) - copy(dAtA[i:], m.SessionId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.SessionId))) - i-- - dAtA[i] = 0x1a - } - if len(m.ServiceId) > 0 { - i -= len(m.ServiceId) - copy(dAtA[i:], m.ServiceId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ServiceId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ApplicationAddr) > 0 { - i -= len(m.ApplicationAddr) - copy(dAtA[i:], m.ApplicationAddr) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ApplicationAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset @@ -863,31 +732,6 @@ func (m *EventApplicationOverserviced) Size() (n int) { return n } -func (m *EventApplicationReimbursementRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ApplicationAddr) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.ServiceId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.SessionId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - if m.Amount != nil { - l = m.Amount.Size() - n += 1 + l + sovEvent(uint64(l)) - } - return n -} - func sovEvent(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1550,188 +1394,6 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventApplicationReimbursementRequest) 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: EventApplicationReimbursementRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventApplicationReimbursementRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApplicationAddr", 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.ApplicationAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionId", 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.SessionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount == nil { - m.Amount = &types1.Coin{} - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 From bbe2366126da7220a96be17804acd4d58976ee11 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Fri, 23 Aug 2024 11:55:46 -0400 Subject: [PATCH 07/48] WIP --- config.yml | 18 +++ e2e/tests/0_settlement.feature | 24 +++- .../keeper/token_logic_modules_test.go | 126 +++++++++--------- 3 files changed, 99 insertions(+), 69 deletions(-) diff --git a/config.yml b/config.yml index 188eef958..2a945a92a 100644 --- a/config.yml +++ b/config.yml @@ -27,6 +27,10 @@ accounts: mnemonic: "involve clean slab term real human green immune valid swing protect talk silent unique cart few ice era right thunder again drop among bounce" coins: - 300000000upokt + - name: apptiny + mnemonic: "worry pupil rival such jump pitch flame prosper tattoo eternal round receive cube crowd remove afraid garment brand toy nut guitar toy sausage fragile" + coins: + - 1000000upokt # 1 POKT - name: supplier1 mnemonic: "cool industry busy tumble funny relax error state height like board wing goat emerge visual idle never unveil announce hill primary okay spatial frog" coins: @@ -169,6 +173,20 @@ genesis: # `supplier1_stake_config.yaml` so that the stake command causes a state change. amount: "1000068" denom: upokt + - address: pokt1ad28jdap2zfanjd7hpkh984yveney6k9a42man + delegatee_gateway_addresses: [] + service_configs: + - service: + id: anvil + - service: + id: rest + - service: + id: ollama + stake: + # NB: This value should be exactly 1upokt smaller than the value in + # `supplier1_stake_config.yaml` so that the stake command causes a state change. + amount: "1000068" + denom: upokt supplier: supplierList: - owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index b4eaf2441..89ab2527c 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -7,30 +7,42 @@ Feature: Tokenomics Namespace - Scenario: Emissions equals burn when a claim is created and a valid proof is submitted and required - # Baseline + Scenario: Mint equals burn when a claim is created and a valid proof is submitted and required Given the user has the pocketd binary installed - # Network preparation + # Network preparation and validation And an account exists for "supplier1" And the "supplier" account for "supplier1" is staked And an account exists for "app1" And the "application" account for "app1" is staked And the service "anvil" registered for application "app1" has a compute units per relay of "1" - # Start servicing + # Start servicing relays When the supplier "supplier1" has serviced a session with "10" relays for service "anvil" for application "app1" # Wait for the Claim & Proof lifecycle 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" end block event to be broadcast - # Validate the results + # Validate that mint equals burn 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 + Scenario: + Given the user has the pocketd binary installed + # Network preparation + And an account exists for "supplier1" + And the "supplier" account for "supplier1" is staked + And an account exists for "app1" + And the "application" account for "app1" is staked + And the service "anvil" registered for application "app1" has a compute units per relay of "1" + # Start servicing relays + When the supplier "supplier1" has serviced a session with "10" relays for service "anvil" for application "app1" + # Wait for the Claim & Proof lifecycle + And the user should wait for the "tokenomics" module "ClaimSettled" end block event to be broadcast + # TODO_IN_THIS_PR: Add the following test # Scenario: Supplier overservices an application and gets paid for less work than claimed # TODO_ADDTEST: Implement the following scenarios - # Scenario: Emissions equals burn when a claim is created and a valid proof is submitted but not required + # Scenario: Mint equals burn when a claim is created and a valid proof is submitted but not required # Scenario: No emissions or burn when a claim is created and an invalid proof is submitted # Scenario: No emissions or burn when a claim is created and a proof is required but is not submitted # Scenario: No emissions or burn when no claim is created \ No newline at end of file diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index e842abe59..849146091 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -39,68 +39,7 @@ func init() { // func TestProcessTokenLogicModules_ValidateAppOverServicingEvent(t *testing.T) {...} // func TestProcessTokenLogicModules_ValidateAppReimbursedRequestEvent(t *testing.T) {...} -func TestProcessTokenLogicModules_HandleAppGoingIntoDebt(t *testing.T) { - keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil) - - // Create a service that can be registered in the application and used in the claims - service := &sharedtypes.Service{ - Id: "svc1", - Name: "svcName1", - ComputeUnitsPerRelay: 1, - OwnerAddress: sample.AccAddress(), - } - keepers.SetService(ctx, *service) - - // Add a new application - appStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) - app := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &appStake, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{Service: service}}, - } - keepers.SetApplication(ctx, app) - - // Add a new supplier - supplierOwnerAddress := sample.AccAddress() - supplierStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) - supplier := sharedtypes.Supplier{ - OwnerAddress: supplierOwnerAddress, - OperatorAddress: supplierOwnerAddress, - Stake: &supplierStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: service, - RevShare: []*sharedtypes.ServiceRevenueShare{ - { - Address: supplierOwnerAddress, - RevSharePercentage: 100, - }, - }, - }, - }, - } - keepers.SetSupplier(ctx, supplier) - - // The base claim whose root will be customized for testing purposes - numRelays := appStake.Amount.Uint64() + 1 // More than the app stake - numComputeUnits := numRelays * service.ComputeUnitsPerRelay - claim := prooftypes.Claim{ - SupplierOperatorAddress: supplier.OperatorAddress, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: app.Address, - Service: service, - SessionId: "session_id", - SessionStartBlockHeight: 1, - SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), - }, - RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), - } - - err := keepers.ProcessTokenLogicModules(ctx, &claim) - require.NoError(t, err) -} - -func TestProcessTokenLogicModules_ValidAccounting(t *testing.T) { +func TestProcessTokenLogicModules_ValidateBurnEqualsMintValidAccounting(t *testing.T) { // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ Id: "svc1", @@ -228,7 +167,9 @@ func TestProcessTokenLogicModules_ValidAccounting(t *testing.T) { require.EqualValues(t, supplierModuleStartBalance, supplierModuleEndBalance) } -func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { +func TestProcessTokenLogicModules_HandleAppGoingIntoDebt(t *testing.T) { + keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil) + // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ Id: "svc1", @@ -236,10 +177,69 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { ComputeUnitsPerRelay: 1, OwnerAddress: sample.AccAddress(), } + keepers.SetService(ctx, *service) + + // Add a new application + appStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) + app := apptypes.Application{ + Address: sample.AccAddress(), + Stake: &appStake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{Service: service}}, + } + keepers.SetApplication(ctx, app) + // Add a new supplier + supplierOwnerAddress := sample.AccAddress() + supplierStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) + supplier := sharedtypes.Supplier{ + OwnerAddress: supplierOwnerAddress, + OperatorAddress: supplierOwnerAddress, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: service, + RevShare: []*sharedtypes.ServiceRevenueShare{ + { + Address: supplierOwnerAddress, + RevSharePercentage: 100, + }, + }, + }, + }, + } + keepers.SetSupplier(ctx, supplier) + + // The base claim whose root will be customized for testing purposes + numRelays := appStake.Amount.Uint64() + 1 // More than the app stake + numComputeUnits := numRelays * service.ComputeUnitsPerRelay + claim := prooftypes.Claim{ + SupplierOperatorAddress: supplier.OperatorAddress, + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: app.Address, + Service: service, + SessionId: "session_id", + SessionStartBlockHeight: 1, + SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), + }, + RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), + } + + err := keepers.ProcessTokenLogicModules(ctx, &claim) + require.NoError(t, err) +} + +func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { + // Create a service that can be registered in the application and used in the claims + service := &sharedtypes.Service{ + Id: "svc1", + Name: "svcName1", + ComputeUnitsPerRelay: 1, + OwnerAddress: sample.AccAddress(), + } keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) keepers.SetService(ctx, *service) + // Retrieve the app and supplier module addresses appModuleAddress := authtypes.NewModuleAddress(apptypes.ModuleName).String() supplierModuleAddress := authtypes.NewModuleAddress(suppliertypes.ModuleName).String() From ad70e7071ecbe8fd5cad37168cf04cbee0946002 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Fri, 23 Aug 2024 15:44:10 -0400 Subject: [PATCH 08/48] Fixed the TestProcessTokenLogicModules_TLMBurnEqualsMintValid test --- testutil/keeper/tokenomics.go | 3 + x/tokenomics/keeper/token_logic_modules.go | 83 ++++--- .../keeper/token_logic_modules_test.go | 208 ++++++++---------- x/tokenomics/types/errors.go | 2 +- x/tokenomics/types/expected_keepers.go | 1 + 5 files changed, 152 insertions(+), 145 deletions(-) diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 089913a36..6ec0e64df 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -186,6 +186,9 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( mockBankKeeper.EXPECT(). SendCoinsFromModuleToAccount(gomock.Any(), tokenomicstypes.ModuleName, gomock.Any(), gomock.Any()). AnyTimes() + mockBankKeeper.EXPECT(). + SendCoinsFromModuleToModule(gomock.Any(), tokenomicstypes.ModuleName, suppliertypes.ModuleName, gomock.Any()). + AnyTimes() // Mock the account keeper mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 3db0c9b41..33f24e618 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -24,11 +24,13 @@ import ( tokenomictypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) -const ( +var ( // Governance parameters for the TLMGlobalMint module // TODO_UPNEXT(@olshansk, #732): Make this a governance parameter and give it a non-zero value + tests. - MintPerClaimGlobalInflation = 0.0000000 + MintPerClaimGlobalInflation = 0.1 +) +const ( // TODO_BETA(@bryanchriswhite): Make all of the governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 @@ -333,18 +335,23 @@ func (k Keeper) TokenLogicModuleGlobalMint( ) error { logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") + if MintPerClaimGlobalInflation == 0 { + logger.Warn("global inflation is set to zero. Skipping Global Mint TLM.") + return nil + } + // Determine how much new uPOKT to mint based on global inflation - newMintCoins, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) + newMintCoin, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) // Mint new uPOKT to the tokenomics module account - if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, newMintCoins); err != nil { + if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { return tokenomicstypes.ErrTokenomicsModuleMintFailed.Wrapf( - "minting %s to the tokenomics module account: %v", newMintCoins, err) + "minting %s to the tokenomics module account: %v", newMintCoin, err) } - logger.Info(fmt.Sprintf("minted (%v) coins in the tokenomics module", newMintCoins)) + logger.Info(fmt.Sprintf("minted (%v) coins in the tokenomics module", newMintCoin)) // Send a portion of the rewards to the application - appCoin, err := k.sendRewardsToAccount(ctx, application.Address, newMintAmtFloat, MintAllocationApplication) + appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.Address, newMintAmtFloat, MintAllocationApplication) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to application: %v", err) } @@ -353,6 +360,15 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Send a portion of the rewards to the supplier shareholders. supplierCoinsToShareAmt := calculateAllocationAmount(newMintAmtFloat, MintAllocationSupplier) supplierCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(supplierCoinsToShareAmt)) + // Send funds from the tokenomics module to the supplier module account + if err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, tokenomicstypes.ModuleName, suppliertypes.ModuleName, sdk.NewCoins(supplierCoin)); err != nil { + return tokenomicstypes.ErrTokenomicsSupplierModuleSendFailed.Wrapf( + "sending %s from the tokenomics module to the supplier module account: %v", + supplierCoin, + err, + ) + } + // Distribute the rewards from within the supplier's module account. if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier.OperatorAddress, service.Id, uint64(supplierCoinsToShareAmt)); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", @@ -364,14 +380,14 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the supplier with address %q", supplierCoin, supplier.OperatorAddress)) // Send a portion of the rewards to the DAO - daoCoin, err := k.sendRewardsToAccount(ctx, k.GetAuthority(), newMintAmtFloat, MintAllocationDAO) + daoCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, k.GetAuthority(), newMintAmtFloat, MintAllocationDAO) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to DAO: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the DAO with address %q", daoCoin, k.GetAuthority())) // Send a portion of the rewards to the source owner - serviceCoin, err := k.sendRewardsToAccount(ctx, service.OwnerAddress, newMintAmtFloat, MintAllocationSourceOwner) + serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, service.OwnerAddress, newMintAmtFloat, MintAllocationSourceOwner) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to source owner: %v", err) } @@ -379,18 +395,30 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Send a portion of the rewards to the block proposer proposerAddr := cosmostypes.AccAddress(sdk.UnwrapSDKContext(ctx).BlockHeader().ProposerAddress).String() - proposerCoin, err := k.sendRewardsToAccount(ctx, proposerAddr, newMintAmtFloat, MintAllocationProposer) + proposerCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, proposerAddr, newMintAmtFloat, MintAllocationProposer) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to proposer: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the proposer with address %q", proposerCoin, proposerAddr)) // Check and log the total amount of coins distributed - totalDistributedCoins := appCoin.Add(supplierCoin).Add(*daoCoin).Add(*serviceCoin).Add(*proposerCoin) - if totalDistributedCoins.Amount.BigInt().Cmp(newMintCoins[0].Amount.BigInt()) != 0 { - return tokenomictypes.ErrTokenomicsAmountMismatch.Wrapf("the total distributed coins (%v) do not equal the settlement coins (%v). Likely floating point arithmetic.", totalDistributedCoins, settlementCoin.Amount.BigInt()) - } - logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalDistributedCoins)) + totalMintDistributedCoin := appCoin.Add(supplierCoin).Add(*daoCoin).Add(*serviceCoin).Add(*proposerCoin) + coinDifference := new(big.Int).Sub(totalMintDistributedCoin.Amount.BigInt(), newMintCoin.Amount.BigInt()) + coinDifference = coinDifference.Abs(coinDifference) + percentDifference := new(big.Float).Quo(new(big.Float).SetInt(coinDifference), new(big.Float).SetInt(newMintCoin.Amount.BigInt())) + if percentDifference.Cmp(big.NewFloat(0.01)) > 0 { + return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( + "the total distributed coins (%v) do not equal the amount of new minted coins (%v). Likely floating point arithmetic.\n"+ + "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", + totalMintDistributedCoin, newMintCoin, + appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin) + } else if coinDifference.Cmp(big.NewInt(0)) > 0 { + logger.Warn(fmt.Sprintf("Floating point arithmetic led to a discrepancy of %v (%f) between the total distributed coins (%v) and the amount of new minted coins (%v).\n"+ + "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", + coinDifference, percentDifference, totalMintDistributedCoin, newMintCoin, + appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin)) + } + logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalMintDistributedCoin)) return nil } @@ -399,13 +427,14 @@ func (k Keeper) TokenLogicModuleGlobalMint( // tokenomics module account to the specified address. func (k Keeper) sendRewardsToAccount( ctx context.Context, - addr string, + srcModule string, + destAdr string, settlementAmtFloat *big.Float, allocation float64, ) (*sdk.Coin, error) { logger := k.Logger().With("method", "mintRewardsToAccount") - accountAddr, err := cosmostypes.AccAddressFromBech32(addr) + accountAddr, err := cosmostypes.AccAddressFromBech32(destAdr) if err != nil { return nil, err } @@ -413,11 +442,11 @@ func (k Keeper) sendRewardsToAccount( coinsToAccAmt := calculateAllocationAmount(settlementAmtFloat, allocation) coinToAcc := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(coinsToAccAmt)) if err := k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, suppliertypes.ModuleName, accountAddr, sdk.NewCoins(coinToAcc), + ctx, srcModule, accountAddr, sdk.NewCoins(coinToAcc), ); err != nil { return nil, err } - logger.Info(fmt.Sprintf("sent (%v) coins from the tokenomics module to the account with address %q", coinToAcc, addr)) + logger.Info(fmt.Sprintf("sent (%v) coins from the tokenomics module to the account with address %q", coinToAcc, destAdr)) return &coinToAcc, nil } @@ -504,17 +533,17 @@ func (k Keeper) numRelaysToCoin( // shareholders based on the rev share percentage of the supplier service config. func (k Keeper) distributeSupplierRewardsToShareHolders( ctx context.Context, - supplierAddr string, + supplierOperatorAddr string, serviceId string, amountToDistribute uint64, ) error { logger := k.Logger().With("method", "distributeSupplierRewardsToShareHolders") - supplier, supplierFound := k.supplierKeeper.GetSupplier(ctx, supplierAddr) + supplier, supplierFound := k.supplierKeeper.GetSupplier(ctx, supplierOperatorAddr) if !supplierFound { return tokenomicstypes.ErrTokenomicsSupplierRevShareFailed.Wrapf( "supplier with address %q not found", - supplierAddr, + supplierOperatorAddr, ) } @@ -552,10 +581,10 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( return err } - logger.Info(fmt.Sprintf("sent %s from the supplier module to the supplier shareholder with address %q", shareAmountCoin, supplierAddr)) + logger.Info(fmt.Sprintf("sent %s from the supplier module to the supplier shareholder with address %q", shareAmountCoin, supplierOperatorAddr)) } - logger.Info(fmt.Sprintf("distributed %d uPOKT to supplier %q shareholders", amountToDistribute, supplierAddr)) + logger.Info(fmt.Sprintf("distributed %d uPOKT to supplier %q shareholders", amountToDistribute, supplierOperatorAddr)) return nil } @@ -563,14 +592,14 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( // calculateGlobalPerClaimMintInflationFromSettlementAmount calculates the amount // of uPOKT to mint based on the global per claim inflation rate as a function of // the settlement amount for a particular claim(s) or session(s). -func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coins, *big.Float) { +func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coin, *big.Float) { // Determine how much new uPOKT to mint based on global per claim inflation. // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimGlobalInflation)) newMintAmtInt, _ := newMintAmtFloat.Int64() - mintAmtCoins := sdk.NewCoins(cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt))) - return mintAmtCoins, newMintAmtFloat + mintAmtCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt)) + return mintAmtCoin, newMintAmtFloat } // calculateAllocationAmount does big float arithmetic to determine the absolute diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 849146091..e2db9c5c3 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -9,11 +9,13 @@ import ( "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/json" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/pokt-network/smt" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/pkg/crypto/protocol" testkeeper "github.com/pokt-network/poktroll/testutil/keeper" @@ -22,10 +24,11 @@ import ( testsession "github.com/pokt-network/poktroll/testutil/session" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" + tokenomicskeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -39,31 +42,49 @@ func init() { // func TestProcessTokenLogicModules_ValidateAppOverServicingEvent(t *testing.T) {...} // func TestProcessTokenLogicModules_ValidateAppReimbursedRequestEvent(t *testing.T) {...} -func TestProcessTokenLogicModules_ValidateBurnEqualsMintValidAccounting(t *testing.T) { +func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { + // Test Parameters + appInitialStake := math.NewInt(1000000) + supplierInitialStake := math.NewInt(1000000) + supplierRevShareRatios := []float32{12.5, 37.5, 50} + globalComputeUnitsToTokensMultiplier := uint64(1) + serviceComputeUnitsPerRelay := uint64(1) + numRelays := uint64(1000) + + // Ensure the claim is within relay mining bounds + numTokensClaimed := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) + maxClaimableAmount := appInitialStake.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession)) + require.GreaterOrEqual(t, maxClaimableAmount.Int64(), numTokensClaimed) + // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ Id: "svc1", Name: "svcName1", - ComputeUnitsPerRelay: 1, + ComputeUnitsPerRelay: serviceComputeUnitsPerRelay, OwnerAddress: sample.AccAddress(), } - keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) keepers.SetService(ctx, *service) + // Retrieve the app and supplier module addresses appModuleAddress := authtypes.NewModuleAddress(apptypes.ModuleName).String() supplierModuleAddress := authtypes.NewModuleAddress(suppliertypes.ModuleName).String() - // Set compute_units_to_tokens_multiplier to 1 to simplify expectation calculations. + // Set compute_units_to_tokens_multiplier to simplify expectation calculations. err := keepers.Keeper.SetParams(ctx, tokenomicstypes.Params{ - ComputeUnitsToTokensMultiplier: 1, + ComputeUnitsToTokensMultiplier: globalComputeUnitsToTokensMultiplier, }) require.NoError(t, err) + // TODO_TECHDEBT: Setting inflation to zero so we are testing the BurnEqualsMint logic exclusively. + // Once it is a governance param, update it using the keeper above. + prevInflationValue := tokenomicskeeper.MintPerClaimGlobalInflation + tokenomicskeeper.MintPerClaimGlobalInflation = 0 + t.Cleanup(func() { + tokenomicskeeper.MintPerClaimGlobalInflation = prevInflationValue + }) // Add a new application with non-zero app stake end balance to assert against. - appStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) - expectedAppEndStakeAmount := cosmostypes.NewCoin("upokt", math.NewInt(420)) - expectedAppBurn := appStake.Sub(expectedAppEndStakeAmount) + appStake := cosmostypes.NewCoin(volatile.DenomuPOKT, appInitialStake) app := apptypes.Application{ Address: sample.AccAddress(), Stake: &appStake, @@ -71,55 +92,38 @@ func TestProcessTokenLogicModules_ValidateBurnEqualsMintValidAccounting(t *testi } keepers.SetApplication(ctx, app) - shareRatios := []float32{12.5, 37.5, 50} - revShares := make([]*sharedtypes.ServiceRevenueShare, len(shareRatios)) - for i := range revShares { + // Determine the expected app end stake amount and the expected app burn + expectedAppBurn := math.NewInt(numTokensClaimed) + expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) + + // Prepare the supplier revenue shares + supplierRevShares := make([]*sharedtypes.ServiceRevenueShare, len(supplierRevShareRatios)) + for i := range supplierRevShares { shareHolderAddress := sample.AccAddress() - revShares[i] = &sharedtypes.ServiceRevenueShare{ + supplierRevShares[i] = &sharedtypes.ServiceRevenueShare{ Address: shareHolderAddress, - RevSharePercentage: shareRatios[i], + RevSharePercentage: supplierRevShareRatios[i], } } // Add a new supplier. - supplierStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) + supplierStake := cosmostypes.NewCoin(volatile.DenomuPOKT, supplierInitialStake) supplier := sharedtypes.Supplier{ // Make the first shareholder the supplier itself. - OwnerAddress: revShares[0].Address, - OperatorAddress: revShares[0].Address, + OwnerAddress: supplierRevShares[0].Address, + OperatorAddress: supplierRevShares[0].Address, Stake: &supplierStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: service, - RevShare: revShares, - }, - }, + Services: []*sharedtypes.SupplierServiceConfig{{Service: service, RevShare: supplierRevShares}}, } keepers.SetSupplier(ctx, supplier) - // Query application balance prior to the accounting. + // Query the account and module start balances appStartBalance := getBalance(t, ctx, keepers, app.GetAddress()) - // Query application module balance prior to the accounting. appModuleStartBalance := getBalance(t, ctx, keepers, appModuleAddress) - - // Query supplier module balance prior to the accounting. supplierModuleStartBalance := getBalance(t, ctx, keepers, supplierModuleAddress) - // Assumes ComputeUnitToTokenMultiplier is 1 - numComputeUnits := expectedAppBurn.Amount.Uint64() - numRelays := numComputeUnits / service.ComputeUnitsPerRelay - // The base claim whose root will be customized for testing purposes - claim := prooftypes.Claim{ - SupplierOperatorAddress: supplier.OperatorAddress, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: app.Address, - Service: service, - SessionId: "session_id", - SessionStartBlockHeight: 1, - SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), - }, - RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), - } + // Prepare the claim for which the supplier did work for the application + claim := prepareClaim(numRelays, service, &app, &supplier) // Process the token logic modules err = keepers.ProcessTokenLogicModules(ctx, &claim) @@ -132,29 +136,16 @@ func TestProcessTokenLogicModules_ValidateBurnEqualsMintValidAccounting(t *testi // Assert that `applicationAddress` staked balance has decreased by the appropriate amount app, appIsFound := keepers.GetApplication(ctx, app.GetAddress()) require.True(t, appIsFound) - require.Equal(t, &expectedAppEndStakeAmount, app.GetStake()) + require.Equal(t, expectedAppEndStakeAmount, app.GetStake().Amount) - // Assert that `apptypes.ModuleName` account module balance is *decreased* by the appropriate amount + // Assert that app module balance is *decreased* by the appropriate amount // NB: The application module account burns the amount of uPOKT that was held in escrow // on behalf of the applications which were serviced in a given session. + expectedAppModuleEndBalance := appModuleStartBalance.Sub(sdk.NewCoin(volatile.DenomuPOKT, expectedAppBurn)) appModuleEndBalance := getBalance(t, ctx, keepers, appModuleAddress) - expectedAppModuleEndBalance := appModuleStartBalance.Sub(expectedAppBurn) require.NotNil(t, appModuleEndBalance) require.EqualValues(t, &expectedAppModuleEndBalance, appModuleEndBalance) - // Assert that the supplier shareholders account balances have *increased* by - // the appropriate amount. - mintAmountInt := expectedAppBurn.Amount.Uint64() - shareAmounts := keeper.GetShareAmountMap(supplier.Services[0].RevShare, mintAmountInt) - for shareHolder, expectedShareAmount := range shareAmounts { - shareHolderBalance := getBalance(t, ctx, keepers, shareHolder) - - require.Equal(t, - int64(expectedShareAmount), - shareHolderBalance.Amount.Int64(), - ) - } - // Assert that `supplierOperatorAddress` staked balance is *unchanged* supplier, supplierIsFound := keepers.GetSupplier(ctx, supplier.GetOperatorAddress()) require.True(t, supplierIsFound) @@ -165,70 +156,24 @@ func TestProcessTokenLogicModules_ValidateBurnEqualsMintValidAccounting(t *testi // distributed to the supplier accounts which provided service in a given session. supplierModuleEndBalance := getBalance(t, ctx, keepers, supplierModuleAddress) require.EqualValues(t, supplierModuleStartBalance, supplierModuleEndBalance) -} - -func TestProcessTokenLogicModules_HandleAppGoingIntoDebt(t *testing.T) { - keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil) - - // Create a service that can be registered in the application and used in the claims - service := &sharedtypes.Service{ - Id: "svc1", - Name: "svcName1", - ComputeUnitsPerRelay: 1, - OwnerAddress: sample.AccAddress(), - } - keepers.SetService(ctx, *service) - - // Add a new application - appStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) - app := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &appStake, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{Service: service}}, - } - keepers.SetApplication(ctx, app) - // Add a new supplier - supplierOwnerAddress := sample.AccAddress() - supplierStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) - supplier := sharedtypes.Supplier{ - OwnerAddress: supplierOwnerAddress, - OperatorAddress: supplierOwnerAddress, - Stake: &supplierStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: service, - RevShare: []*sharedtypes.ServiceRevenueShare{ - { - Address: supplierOwnerAddress, - RevSharePercentage: 100, - }, - }, - }, - }, - } - keepers.SetSupplier(ctx, supplier) - - // The base claim whose root will be customized for testing purposes - numRelays := appStake.Amount.Uint64() + 1 // More than the app stake - numComputeUnits := numRelays * service.ComputeUnitsPerRelay - claim := prooftypes.Claim{ - SupplierOperatorAddress: supplier.OperatorAddress, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: app.Address, - Service: service, - SessionId: "session_id", - SessionStartBlockHeight: 1, - SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), - }, - RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), + // Assert that the supplier shareholders account balances have *increased* by + // the appropriate amount w.r.t token distribution. + shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, expectedAppBurn.Uint64()) + for shareHolderAddr, expectedShareAmount := range shareAmounts { + shareHolderBalance := getBalance(t, ctx, keepers, shareHolderAddr) + require.Equal(t, int64(expectedShareAmount), shareHolderBalance.Amount.Int64()) } - - err := keepers.ProcessTokenLogicModules(ctx, &claim) - require.NoError(t, err) } func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { + // Test Parameters + // appInitialStake := math.NewInt(1000000) + // appEndStake := math.NewInt(420) + // supplierInitialStake := math.NewInt(1000000) + // supplierRevShareRatios := []float32{12.5, 37.5, 50} + // computeUnitsToTokensMultiplier := uint64(1) + // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ Id: "svc1", @@ -346,6 +291,14 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { require.EqualValues(t, supplierModuleStartBalance, supplierModuleEndBalance) // Check that the expected burn >> effective burn because application is overserviced + + // events := sdkCtx.EventManager().Events() + // relayMiningEvents := testutilevents.FilterEvents[*tokenomicstypes.EventRelayMiningDifficultyUpdated](t, + // events, "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") + // require.Len(t, relayMiningEvents, 1, "unexpected number of relay mining difficulty updated events") + // relayMiningEvent := relayMiningEvents[0] + // require.Equal(t, "svc1", relayMiningEvent.ServiceId) + events := cosmostypes.UnwrapSDKContext(ctx).EventManager().Events() appAddrAttribute, _ := events.GetAttributes("application_addr") expectedBurnAttribute, _ := events.GetAttributes("expected_burn") @@ -576,6 +529,27 @@ func TestProcessTokenLogicModules_InvalidClaim(t *testing.T) { } } +func prepareClaim( + numRelays uint64, + service *sharedtypes.Service, + app *apptypes.Application, + supplier *sharedtypes.Supplier, +) prooftypes.Claim { + numComputeUnits := numRelays * service.ComputeUnitsPerRelay + return prooftypes.Claim{ + SupplierOperatorAddress: supplier.OperatorAddress, + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: app.Address, + Service: service, + SessionId: "session_id", + SessionStartBlockHeight: 1, + SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), + }, + RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), + } + +} + func getBalance( t *testing.T, ctx context.Context, diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 24a16cd1b..018c44601 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -33,5 +33,5 @@ var ( ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1124, "the supplier owner address in the claim is not a valid bech32 address") ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") - ErrTokenomicsAmountMismatch = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") + ErrTokenomicsAmountMismatchTooLarge = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") ) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index a267cbb18..b6e07314a 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -35,6 +35,7 @@ type BankKeeper interface { // than "delegate" funds from one account to another which is more closely // linked to staking. SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error Balance(context.Context, *banktypes.QueryBalanceRequest) (*banktypes.QueryBalanceResponse, error) } From b02ef24676b3eb145a6520e077ab619e8e21541b Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Fri, 23 Aug 2024 22:23:30 -0400 Subject: [PATCH 09/48] WIP --- .../keeper/token_logic_modules_test.go | 170 ++++++++++-------- 1 file changed, 91 insertions(+), 79 deletions(-) diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index e2db9c5c3..4bae90d8e 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -18,6 +18,7 @@ import ( "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/pkg/crypto/protocol" + testutilevents "github.com/pokt-network/poktroll/testutil/events" testkeeper "github.com/pokt-network/poktroll/testutil/keeper" testproof "github.com/pokt-network/poktroll/testutil/proof" "github.com/pokt-network/poktroll/testutil/sample" @@ -49,12 +50,12 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) serviceComputeUnitsPerRelay := uint64(1) - numRelays := uint64(1000) + numRelays := uint64(1000) // By supplier for application in this session // Ensure the claim is within relay mining bounds numTokensClaimed := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) - maxClaimableAmount := appInitialStake.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession)) - require.GreaterOrEqual(t, maxClaimableAmount.Int64(), numTokensClaimed) + maxClaimableAmountPerSupplier := appInitialStake.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession)) + require.GreaterOrEqual(t, maxClaimableAmountPerSupplier.Int64(), numTokensClaimed) // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ @@ -92,10 +93,6 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { } keepers.SetApplication(ctx, app) - // Determine the expected app end stake amount and the expected app burn - expectedAppBurn := math.NewInt(numTokensClaimed) - expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) - // Prepare the supplier revenue shares supplierRevShares := make([]*sharedtypes.ServiceRevenueShare, len(supplierRevShareRatios)) for i := range supplierRevShares { @@ -133,10 +130,15 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { appEndBalance := getBalance(t, ctx, keepers, app.GetAddress()) require.EqualValues(t, appStartBalance, appEndBalance) + // Determine the expected app end stake amount and the expected app burn + expectedAppBurn := math.NewInt(numTokensClaimed) + expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) + // Assert that `applicationAddress` staked balance has decreased by the appropriate amount app, appIsFound := keepers.GetApplication(ctx, app.GetAddress()) + actualAppEndStakeAmount := app.GetStake().Amount require.True(t, appIsFound) - require.Equal(t, expectedAppEndStakeAmount, app.GetStake().Amount) + require.Equal(t, expectedAppEndStakeAmount, actualAppEndStakeAmount) // Assert that app module balance is *decreased* by the appropriate amount // NB: The application module account burns the amount of uPOKT that was held in escrow @@ -166,19 +168,32 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { } } -func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { +// DEV_NOTE: Most of the setup here is a copy-paste of TLMBurnEqualsMintValid +// except that the application stake is calculated to explicitly be too low to +// handle all the relays completed. +func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxClaimableAmount(t *testing.T) { // Test Parameters - // appInitialStake := math.NewInt(1000000) - // appEndStake := math.NewInt(420) - // supplierInitialStake := math.NewInt(1000000) - // supplierRevShareRatios := []float32{12.5, 37.5, 50} - // computeUnitsToTokensMultiplier := uint64(1) + globalComputeUnitsToTokensMultiplier := uint64(1) + serviceComputeUnitsPerRelay := uint64(1) + numRelays := uint64(1000) // By a single supplier for application in this session + supplierInitialStake := math.NewInt(1000000) + supplierRevShareRatios := []float32{12.5, 37.5, 50} + + // Set up the relays to exceed the max claimable amount + // Determine the max a supplier can claim + maxClaimableAmountPerSupplier := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) + // Figure out what the app's initial stake should be to cover the max claimable amount + appInitialStake := math.NewInt(maxClaimableAmountPerSupplier*sessionkeeper.NumSupplierPerSession + 1) + // Increase the number of relay such that the supplier did "free work" and would + // be able to claim more than the max claimable amount. + numRelays *= 5 + numTokensClaimed := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) // Create a service that can be registered in the application and used in the claims service := &sharedtypes.Service{ Id: "svc1", Name: "svcName1", - ComputeUnitsPerRelay: 1, + ComputeUnitsPerRelay: serviceComputeUnitsPerRelay, OwnerAddress: sample.AccAddress(), } keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) @@ -188,16 +203,21 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { appModuleAddress := authtypes.NewModuleAddress(apptypes.ModuleName).String() supplierModuleAddress := authtypes.NewModuleAddress(suppliertypes.ModuleName).String() - // Set compute_units_to_tokens_multiplier to 1 to simplify expectation calculations. + // Set compute_units_to_tokens_multiplier to simplify expectation calculations. err := keepers.Keeper.SetParams(ctx, tokenomicstypes.Params{ - ComputeUnitsToTokensMultiplier: 1, + ComputeUnitsToTokensMultiplier: globalComputeUnitsToTokensMultiplier, }) require.NoError(t, err) + // TODO_TECHDEBT: Setting inflation to zero so we are testing the BurnEqualsMint logic exclusively. + // Once it is a governance param, update it using the keeper above. + prevInflationValue := tokenomicskeeper.MintPerClaimGlobalInflation + tokenomicskeeper.MintPerClaimGlobalInflation = 0 + t.Cleanup(func() { + tokenomicskeeper.MintPerClaimGlobalInflation = prevInflationValue + }) - // Add a new application - appStake := cosmostypes.NewCoin("upokt", math.NewInt(40000)) - expectedAppEndStakeZeroAmount := cosmostypes.NewCoin("upokt", math.NewInt(0)) - expectedAppBurn := appStake.AddAmount(math.NewInt(2000)) + // Add a new application with non-zero app stake end balance to assert against. + appStake := cosmostypes.NewCoin(volatile.DenomuPOKT, appInitialStake) app := apptypes.Application{ Address: sample.AccAddress(), Stake: &appStake, @@ -205,55 +225,34 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { } keepers.SetApplication(ctx, app) - // Query application balance prior to the accounting. - appStartBalance := getBalance(t, ctx, keepers, app.GetAddress()) - // Query application module balance prior to the accounting. - appModuleStartBalance := getBalance(t, ctx, keepers, appModuleAddress) + // Prepare the supplier revenue shares + supplierRevShares := make([]*sharedtypes.ServiceRevenueShare, len(supplierRevShareRatios)) + for i := range supplierRevShares { + shareHolderAddress := sample.AccAddress() + supplierRevShares[i] = &sharedtypes.ServiceRevenueShare{ + Address: shareHolderAddress, + RevSharePercentage: supplierRevShareRatios[i], + } + } // Add a new supplier. - supplierOwnerAddress := sample.AccAddress() - supplierStake := cosmostypes.NewCoin("upokt", math.NewInt(1000000)) + supplierStake := cosmostypes.NewCoin(volatile.DenomuPOKT, supplierInitialStake) supplier := sharedtypes.Supplier{ - OwnerAddress: supplierOwnerAddress, - OperatorAddress: supplierOwnerAddress, + // Make the first shareholder the supplier itself. + OwnerAddress: supplierRevShares[0].Address, + OperatorAddress: supplierRevShares[0].Address, Stake: &supplierStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: service, - RevShare: []*sharedtypes.ServiceRevenueShare{ - { - Address: supplierOwnerAddress, - RevSharePercentage: 100, - }, - }, - }, - }, + Services: []*sharedtypes.SupplierServiceConfig{{Service: service, RevShare: supplierRevShares}}, } keepers.SetSupplier(ctx, supplier) - // Query supplier owner balance prior to the accounting. - supplierOwnerStartBalance := getBalance(t, ctx, keepers, supplier.GetOwnerAddress()) - - // Query supplier module balance prior to the accounting. + // Query the account and module start balances + appStartBalance := getBalance(t, ctx, keepers, app.GetAddress()) + appModuleStartBalance := getBalance(t, ctx, keepers, appModuleAddress) supplierModuleStartBalance := getBalance(t, ctx, keepers, supplierModuleAddress) - // Determine the number of relays to use up the application's entire stake - sharedParams := keepers.Keeper.GetParams(ctx) - numComputeUnits := expectedAppBurn.Amount.Uint64() / sharedParams.ComputeUnitsToTokensMultiplier - numRelays := numComputeUnits / service.ComputeUnitsPerRelay - - // The base claim whose root will be customized for testing purposes - claim := prooftypes.Claim{ - SupplierOperatorAddress: supplier.OperatorAddress, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: app.Address, - Service: service, - SessionId: "session_id", - SessionStartBlockHeight: 1, - SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), - }, - RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), - } + // Prepare the claim for which the supplier did work for the application + claim := prepareClaim(numRelays, service, &app, &supplier) // Process the token logic modules err = keepers.ProcessTokenLogicModules(ctx, &claim) @@ -263,41 +262,54 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { appEndBalance := getBalance(t, ctx, keepers, app.GetAddress()) require.EqualValues(t, appStartBalance, appEndBalance) - // Assert that `applicationAddress` staked balance has gone to zero + // Determine the expected app end stake amount and the expected app burn + expectedAppBurn := math.NewInt(maxClaimableAmountPerSupplier) + expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) + + // Assert that `applicationAddress` staked balance has decreased by the max claimable amount app, appIsFound := keepers.GetApplication(ctx, app.GetAddress()) + actualAppEndStakeAmount := app.GetStake().Amount require.True(t, appIsFound) - require.Equal(t, &expectedAppEndStakeZeroAmount, app.GetStake()) + require.Equal(t, expectedAppEndStakeAmount, actualAppEndStakeAmount) - // Assert that `apptypes.ModuleName` account module balance is *decreased* by the appropriate amount + // Sanity + require.Less(t, maxClaimableAmountPerSupplier, numTokensClaimed) + + // Assert that app module balance is *decreased* by the appropriate amount + // NB: The application module account burns the amount of uPOKT that was held in escrow + // on behalf of the applications which were serviced in a given session. + expectedAppModuleEndBalance := appModuleStartBalance.Sub(sdk.NewCoin(volatile.DenomuPOKT, expectedAppBurn)) appModuleEndBalance := getBalance(t, ctx, keepers, appModuleAddress) - expectedAppModuleEndBalance := appModuleStartBalance.Sub(appStake) require.NotNil(t, appModuleEndBalance) require.EqualValues(t, &expectedAppModuleEndBalance, appModuleEndBalance) - // Assert that `supplierOwnerAddress` account balance has *increased* by the appropriate amount - supplierOwnerEndBalance := getBalance(t, ctx, keepers, supplier.GetOwnerAddress()) - require.NotNil(t, supplierOwnerEndBalance) - - expectedSupplierBalance := supplierOwnerStartBalance.Add(expectedAppBurn) - require.EqualValues(t, &expectedSupplierBalance, supplierOwnerEndBalance) - // Assert that `supplierOperatorAddress` staked balance is *unchanged* supplier, supplierIsFound := keepers.GetSupplier(ctx, supplier.GetOperatorAddress()) require.True(t, supplierIsFound) require.Equal(t, &supplierStake, supplier.GetStake()) // Assert that `suppliertypes.ModuleName` account module balance is *unchanged* + // NB: Supplier rewards are minted to the supplier module account but then immediately + // distributed to the supplier accounts which provided service in a given session. supplierModuleEndBalance := getBalance(t, ctx, keepers, supplierModuleAddress) require.EqualValues(t, supplierModuleStartBalance, supplierModuleEndBalance) + // Assert that the supplier shareholders account balances have *increased* by + // the appropriate amount w.r.t token distribution. + shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, expectedAppBurn.Uint64()) + for shareHolderAddr, expectedShareAmount := range shareAmounts { + shareHolderBalance := getBalance(t, ctx, keepers, shareHolderAddr) + require.Equal(t, int64(expectedShareAmount), shareHolderBalance.Amount.Int64()) + } + // Check that the expected burn >> effective burn because application is overserviced - // events := sdkCtx.EventManager().Events() - // relayMiningEvents := testutilevents.FilterEvents[*tokenomicstypes.EventRelayMiningDifficultyUpdated](t, - // events, "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") - // require.Len(t, relayMiningEvents, 1, "unexpected number of relay mining difficulty updated events") - // relayMiningEvent := relayMiningEvents[0] - // require.Equal(t, "svc1", relayMiningEvent.ServiceId) + sdkCtx := sdk.UnwrapSDKContext(ctx) + events := sdkCtx.EventManager().Events() + appOverservicedEvents := testutilevents.FilterEvents[*tokenomicstypes.EventApplicationOverserviced](t, + events, "poktroll.tokenomics.EventApplicationOverserviced") + require.Len(t, appOverservicedEvents, 1, "unexpected number of event overserviced events") + appOverservicedEvent := appOverservicedEvents[0] events := cosmostypes.UnwrapSDKContext(ctx).EventManager().Events() appAddrAttribute, _ := events.GetAttributes("application_addr") @@ -313,7 +325,7 @@ func TestProcessTokenLogicModules_AppStakeTooLow(t *testing.T) { err = json.Unmarshal([]byte(effectiveBurnAttribute[0].Value), &effectiveBurnEventCoin) require.NoError(t, err) - require.EqualValues(t, expectedAppBurn, expectedBurnEventCoin) + // require.EqualValues(t, expectedAppBurn, expectedBurnEventCoin) require.Greater(t, expectedBurnEventCoin.Amount.Uint64(), effectiveBurnEventCoin.Amount.Uint64()) } From 8663fac6cf2573347699e956edb9c168e6c17b73 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Sun, 25 Aug 2024 13:00:54 -0400 Subject: [PATCH 10/48] Finished implementing TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxClaimableAmount --- api/poktroll/tokenomics/event.pulsar.go | 127 +++++++++--------- proto/poktroll/tokenomics/event.proto | 8 +- x/tokenomics/keeper/token_logic_modules.go | 28 +++- .../keeper/token_logic_modules_test.go | 105 +++++++-------- x/tokenomics/types/event.pb.go | 123 ++++++++--------- 5 files changed, 196 insertions(+), 195 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 25caeaa82..944d6be99 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -1818,18 +1818,18 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } var ( - md_EventApplicationOverserviced protoreflect.MessageDescriptor - fd_EventApplicationOverserviced_application_addr protoreflect.FieldDescriptor - fd_EventApplicationOverserviced_supplier_addr protoreflect.FieldDescriptor - fd_EventApplicationOverserviced_expected_burn protoreflect.FieldDescriptor - fd_EventApplicationOverserviced_effective_burn protoreflect.FieldDescriptor + md_EventApplicationOverserviced protoreflect.MessageDescriptor + fd_EventApplicationOverserviced_application_addr protoreflect.FieldDescriptor + fd_EventApplicationOverserviced_supplier_operator_addr protoreflect.FieldDescriptor + fd_EventApplicationOverserviced_expected_burn protoreflect.FieldDescriptor + fd_EventApplicationOverserviced_effective_burn protoreflect.FieldDescriptor ) func init() { file_poktroll_tokenomics_event_proto_init() md_EventApplicationOverserviced = File_poktroll_tokenomics_event_proto.Messages().ByName("EventApplicationOverserviced") fd_EventApplicationOverserviced_application_addr = md_EventApplicationOverserviced.Fields().ByName("application_addr") - fd_EventApplicationOverserviced_supplier_addr = md_EventApplicationOverserviced.Fields().ByName("supplier_addr") + fd_EventApplicationOverserviced_supplier_operator_addr = md_EventApplicationOverserviced.Fields().ByName("supplier_operator_addr") fd_EventApplicationOverserviced_expected_burn = md_EventApplicationOverserviced.Fields().ByName("expected_burn") fd_EventApplicationOverserviced_effective_burn = md_EventApplicationOverserviced.Fields().ByName("effective_burn") } @@ -1905,9 +1905,9 @@ func (x *fastReflection_EventApplicationOverserviced) Range(f func(protoreflect. return } } - if x.SupplierAddr != "" { - value := protoreflect.ValueOfString(x.SupplierAddr) - if !f(fd_EventApplicationOverserviced_supplier_addr, value) { + if x.SupplierOperatorAddr != "" { + value := protoreflect.ValueOfString(x.SupplierOperatorAddr) + if !f(fd_EventApplicationOverserviced_supplier_operator_addr, value) { return } } @@ -1940,8 +1940,8 @@ func (x *fastReflection_EventApplicationOverserviced) Has(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": return x.ApplicationAddr != "" - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": - return x.SupplierAddr != "" + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": + return x.SupplierOperatorAddr != "" case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": return x.ExpectedBurn != nil case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -1964,8 +1964,8 @@ func (x *fastReflection_EventApplicationOverserviced) Clear(fd protoreflect.Fiel switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": x.ApplicationAddr = "" - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": - x.SupplierAddr = "" + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": + x.SupplierOperatorAddr = "" case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": x.ExpectedBurn = nil case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -1989,8 +1989,8 @@ func (x *fastReflection_EventApplicationOverserviced) Get(descriptor protoreflec case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": value := x.ApplicationAddr return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": - value := x.SupplierAddr + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": + value := x.SupplierOperatorAddr return protoreflect.ValueOfString(value) case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": value := x.ExpectedBurn @@ -2020,8 +2020,8 @@ func (x *fastReflection_EventApplicationOverserviced) Set(fd protoreflect.FieldD switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": x.ApplicationAddr = value.Interface().(string) - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": - x.SupplierAddr = value.Interface().(string) + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": + x.SupplierOperatorAddr = value.Interface().(string) case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": x.ExpectedBurn = value.Message().Interface().(*v1beta1.Coin) case "poktroll.tokenomics.EventApplicationOverserviced.effective_burn": @@ -2058,8 +2058,8 @@ func (x *fastReflection_EventApplicationOverserviced) Mutable(fd protoreflect.Fi return protoreflect.ValueOfMessage(x.EffectiveBurn.ProtoReflect()) case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": panic(fmt.Errorf("field application_addr of message poktroll.tokenomics.EventApplicationOverserviced is not mutable")) - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": - panic(fmt.Errorf("field supplier_addr of message poktroll.tokenomics.EventApplicationOverserviced is not mutable")) + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": + panic(fmt.Errorf("field supplier_operator_addr of message poktroll.tokenomics.EventApplicationOverserviced is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventApplicationOverserviced")) @@ -2075,7 +2075,7 @@ func (x *fastReflection_EventApplicationOverserviced) NewField(fd protoreflect.F switch fd.FullName() { case "poktroll.tokenomics.EventApplicationOverserviced.application_addr": return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventApplicationOverserviced.supplier_addr": + case "poktroll.tokenomics.EventApplicationOverserviced.supplier_operator_addr": return protoreflect.ValueOfString("") case "poktroll.tokenomics.EventApplicationOverserviced.expected_burn": m := new(v1beta1.Coin) @@ -2156,7 +2156,7 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.SupplierAddr) + l = len(x.SupplierOperatorAddr) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -2225,10 +2225,10 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface i-- dAtA[i] = 0x1a } - if len(x.SupplierAddr) > 0 { - i -= len(x.SupplierAddr) - copy(dAtA[i:], x.SupplierAddr) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddr))) + if len(x.SupplierOperatorAddr) > 0 { + i -= len(x.SupplierOperatorAddr) + copy(dAtA[i:], x.SupplierOperatorAddr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierOperatorAddr))) i-- dAtA[i] = 0x12 } @@ -2322,7 +2322,7 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddr", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierOperatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2350,7 +2350,7 @@ func (x *fastReflection_EventApplicationOverserviced) ProtoMethods() *protoiface if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.SupplierAddr = string(dAtA[iNdEx:postIndex]) + x.SupplierOperatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -2721,16 +2721,16 @@ type EventApplicationOverserviced struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - SupplierAddr string `protobuf:"bytes,2,opt,name=supplier_addr,json=supplierAddr,proto3" json:"supplier_addr,omitempty"` + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + SupplierOperatorAddr string `protobuf:"bytes,2,opt,name=supplier_operator_addr,json=supplierOperatorAddr,proto3" json:"supplier_operator_addr,omitempty"` // Expected burn is the amount the supplier is claiming for work done // to service the application during the session. - // This is usually the amount in the Claim object. + // This is usually the amount in the Claim submitted. ExpectedBurn *v1beta1.Coin `protobuf:"bytes,3,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and - // most likely equal to the application's stake divided by the number of suppliers - // in a session. + // is a function of the relay mining algorithm. + // E.g. Te application's stake divided by the number of suppliers in a session. EffectiveBurn *v1beta1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } @@ -2761,9 +2761,9 @@ func (x *EventApplicationOverserviced) GetApplicationAddr() string { return "" } -func (x *EventApplicationOverserviced) GetSupplierAddr() string { +func (x *EventApplicationOverserviced) GetSupplierOperatorAddr() string { if x != nil { - return x.SupplierAddr + return x.SupplierOperatorAddr } return "" } @@ -2849,40 +2849,41 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 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, 0x22, 0xf0, 0x01, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, + 0x45, 0x6d, 0x61, 0x22, 0x81, 0x02, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, - 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x03, 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, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, - 0x42, 0x75, 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x34, 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x14, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x03, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, - 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, - 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, - 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, - 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 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, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, + 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, + 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, + 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 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/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 9b07d8ae1..a536a1ae6 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -47,14 +47,14 @@ message EventRelayMiningDifficultyUpdated { // what a supplier is claiming (i.e. burn is not high enough). message EventApplicationOverserviced { string application_addr = 1; - string supplier_addr = 2; + string supplier_operator_addr = 2; // Expected burn is the amount the supplier is claiming for work done // to service the application during the session. - // This is usually the amount in the Claim object. + // This is usually the amount in the Claim submitted. cosmos.base.v1beta1.Coin expected_burn = 3; // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and - // most likely equal to the application's stake divided by the number of suppliers - // in a session. + // is a function of the relay mining algorithm. + // E.g. Te application's stake divided by the number of suppliers in a session. cosmos.base.v1beta1.Coin effective_burn = 4; } \ No newline at end of file diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 33f24e618..2d0a4aabc 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -37,6 +37,15 @@ const ( MintAllocationSupplier = 0.7 MintAllocationSourceOwner = 0.15 MintAllocationApplication = 0.0 + + // The percent difference that is allowable between the number of minted + // tokens in the tokenomics module and what is distributed to pocket network + // participants. + // This internal constant SHOULD ONLY be used in TokenLogicModuleGlobalMint. + // Due to floating point arithmetic, the total amount of minted coins may be slightly + // larger than what is distributed to pocket network participants + // TODO_MAINNET: Figure out if we can avoid this tolerance and use fixed point arithmetic. + mintDistributionAllowableTolerance = 0.02 ) type TokenLogicModule int @@ -155,6 +164,9 @@ func (k Keeper) ProcessTokenLogicModules( if err != nil { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("%v", err) } + if numRelays == 0 { + return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrap("root hash has zero relays") + } /* TODO_POST_MAINNET: Because of how things have evolved, we are now using @@ -343,6 +355,8 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Determine how much new uPOKT to mint based on global inflation newMintCoin, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) + fmt.Println("OLSH ", newMintCoin, MintPerClaimGlobalInflation, settlementCoin) + // Mint new uPOKT to the tokenomics module account if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { return tokenomicstypes.ErrTokenomicsModuleMintFailed.Wrapf( @@ -406,11 +420,11 @@ func (k Keeper) TokenLogicModuleGlobalMint( coinDifference := new(big.Int).Sub(totalMintDistributedCoin.Amount.BigInt(), newMintCoin.Amount.BigInt()) coinDifference = coinDifference.Abs(coinDifference) percentDifference := new(big.Float).Quo(new(big.Float).SetInt(coinDifference), new(big.Float).SetInt(newMintCoin.Amount.BigInt())) - if percentDifference.Cmp(big.NewFloat(0.01)) > 0 { + if percentDifference.Cmp(big.NewFloat(mintDistributionAllowableTolerance)) > 0 { return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( - "the total distributed coins (%v) do not equal the amount of new minted coins (%v). Likely floating point arithmetic.\n"+ + "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", - totalMintDistributedCoin, newMintCoin, + totalMintDistributedCoin, newMintCoin, percentDifference, appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin) } else if coinDifference.Cmp(big.NewInt(0)) > 0 { logger.Warn(fmt.Sprintf("Floating point arithmetic led to a discrepancy of %v (%f) between the total distributed coins (%v) and the amount of new minted coins (%v).\n"+ @@ -497,10 +511,10 @@ func (k Keeper) ensureClaimAmountLimits( // Prepare and emit the event for the application being overserviced applicationOverservicedEvent := &tokenomicstypes.EventApplicationOverserviced{ - ApplicationAddr: application.Address, - SupplierAddr: supplier.OperatorAddress, - ExpectedBurn: &claimSettlementCoin, - EffectiveBurn: &maxClaimableCoin, + ApplicationAddr: application.Address, + SupplierOperatorAddr: supplier.OperatorAddress, + ExpectedBurn: &claimSettlementCoin, + EffectiveBurn: &maxClaimableCoin, } eventManager := cosmostypes.UnwrapSDKContext(ctx).EventManager() if err := eventManager.EmitTypedEvent(applicationOverservicedEvent); err != nil { diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 4bae90d8e..6174ca72c 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -7,7 +7,6 @@ import ( "testing" "cosmossdk.io/math" - "github.com/cometbft/cometbft/libs/json" cosmostypes "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -37,36 +36,25 @@ func init() { cmd.InitSDKConfig() } -// TODO_IN_THIS_PR: Add these tests or update existing tests to account for it. -// func TestProcessTokenLogicModules_HandleMaxClaimGreaterActualClaim(t *testing.T) {...} -// TODO_UPNEXT(@olshansk, #732): Add the following tests -// func TestProcessTokenLogicModules_ValidateAppOverServicingEvent(t *testing.T) {...} -// func TestProcessTokenLogicModules_ValidateAppReimbursedRequestEvent(t *testing.T) {...} - -func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { +func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { // Test Parameters appInitialStake := math.NewInt(1000000) supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) serviceComputeUnitsPerRelay := uint64(1) + service := prepareTestService(serviceComputeUnitsPerRelay) numRelays := uint64(1000) // By supplier for application in this session + // Prepare the keepers + keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) + keepers.SetService(ctx, *service) + // Ensure the claim is within relay mining bounds numTokensClaimed := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) maxClaimableAmountPerSupplier := appInitialStake.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession)) require.GreaterOrEqual(t, maxClaimableAmountPerSupplier.Int64(), numTokensClaimed) - // Create a service that can be registered in the application and used in the claims - service := &sharedtypes.Service{ - Id: "svc1", - Name: "svcName1", - ComputeUnitsPerRelay: serviceComputeUnitsPerRelay, - OwnerAddress: sample.AccAddress(), - } - keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) - keepers.SetService(ctx, *service) - // Retrieve the app and supplier module addresses appModuleAddress := authtypes.NewModuleAddress(apptypes.ModuleName).String() supplierModuleAddress := authtypes.NewModuleAddress(suppliertypes.ModuleName).String() @@ -120,7 +108,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { supplierModuleStartBalance := getBalance(t, ctx, keepers, supplierModuleAddress) // Prepare the claim for which the supplier did work for the application - claim := prepareClaim(numRelays, service, &app, &supplier) + claim := prepareTestClaim(numRelays, service, &app, &supplier) // Process the token logic modules err = keepers.ProcessTokenLogicModules(ctx, &claim) @@ -131,8 +119,8 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { require.EqualValues(t, appStartBalance, appEndBalance) // Determine the expected app end stake amount and the expected app burn - expectedAppBurn := math.NewInt(numTokensClaimed) - expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) + appBurn := math.NewInt(numTokensClaimed) + expectedAppEndStakeAmount := appInitialStake.Sub(appBurn) // Assert that `applicationAddress` staked balance has decreased by the appropriate amount app, appIsFound := keepers.GetApplication(ctx, app.GetAddress()) @@ -143,7 +131,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { // Assert that app module balance is *decreased* by the appropriate amount // NB: The application module account burns the amount of uPOKT that was held in escrow // on behalf of the applications which were serviced in a given session. - expectedAppModuleEndBalance := appModuleStartBalance.Sub(sdk.NewCoin(volatile.DenomuPOKT, expectedAppBurn)) + expectedAppModuleEndBalance := appModuleStartBalance.Sub(sdk.NewCoin(volatile.DenomuPOKT, appBurn)) appModuleEndBalance := getBalance(t, ctx, keepers, appModuleAddress) require.NotNil(t, appModuleEndBalance) require.EqualValues(t, &expectedAppModuleEndBalance, appModuleEndBalance) @@ -161,7 +149,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { // Assert that the supplier shareholders account balances have *increased* by // the appropriate amount w.r.t token distribution. - shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, expectedAppBurn.Uint64()) + shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, appBurn.Uint64()) for shareHolderAddr, expectedShareAmount := range shareAmounts { shareHolderBalance := getBalance(t, ctx, keepers, shareHolderAddr) require.Equal(t, int64(expectedShareAmount), shareHolderBalance.Amount.Int64()) @@ -171,14 +159,19 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintValid(t *testing.T) { // DEV_NOTE: Most of the setup here is a copy-paste of TLMBurnEqualsMintValid // except that the application stake is calculated to explicitly be too low to // handle all the relays completed. -func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxClaimableAmount(t *testing.T) { +func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxClaimableAmount(t *testing.T) { // Test Parameters globalComputeUnitsToTokensMultiplier := uint64(1) serviceComputeUnitsPerRelay := uint64(1) + service := prepareTestService(serviceComputeUnitsPerRelay) numRelays := uint64(1000) // By a single supplier for application in this session supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} + // Prepare the keepers + keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) + keepers.SetService(ctx, *service) + // Set up the relays to exceed the max claimable amount // Determine the max a supplier can claim maxClaimableAmountPerSupplier := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) @@ -189,16 +182,6 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla numRelays *= 5 numTokensClaimed := int64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) - // Create a service that can be registered in the application and used in the claims - service := &sharedtypes.Service{ - Id: "svc1", - Name: "svcName1", - ComputeUnitsPerRelay: serviceComputeUnitsPerRelay, - OwnerAddress: sample.AccAddress(), - } - keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service)) - keepers.SetService(ctx, *service) - // Retrieve the app and supplier module addresses appModuleAddress := authtypes.NewModuleAddress(apptypes.ModuleName).String() supplierModuleAddress := authtypes.NewModuleAddress(suppliertypes.ModuleName).String() @@ -252,7 +235,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla supplierModuleStartBalance := getBalance(t, ctx, keepers, supplierModuleAddress) // Prepare the claim for which the supplier did work for the application - claim := prepareClaim(numRelays, service, &app, &supplier) + claim := prepareTestClaim(numRelays, service, &app, &supplier) // Process the token logic modules err = keepers.ProcessTokenLogicModules(ctx, &claim) @@ -263,8 +246,9 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla require.EqualValues(t, appStartBalance, appEndBalance) // Determine the expected app end stake amount and the expected app burn - expectedAppBurn := math.NewInt(maxClaimableAmountPerSupplier) - expectedAppEndStakeAmount := appInitialStake.Sub(expectedAppBurn) + appBurn := math.NewInt(maxClaimableAmountPerSupplier) + appBurnCoin := sdk.NewCoin(volatile.DenomuPOKT, appBurn) + expectedAppEndStakeAmount := appInitialStake.Sub(appBurn) // Assert that `applicationAddress` staked balance has decreased by the max claimable amount app, appIsFound := keepers.GetApplication(ctx, app.GetAddress()) @@ -278,7 +262,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla // Assert that app module balance is *decreased* by the appropriate amount // NB: The application module account burns the amount of uPOKT that was held in escrow // on behalf of the applications which were serviced in a given session. - expectedAppModuleEndBalance := appModuleStartBalance.Sub(sdk.NewCoin(volatile.DenomuPOKT, expectedAppBurn)) + expectedAppModuleEndBalance := appModuleStartBalance.Sub(appBurnCoin) appModuleEndBalance := getBalance(t, ctx, keepers, appModuleAddress) require.NotNil(t, appModuleEndBalance) require.EqualValues(t, &expectedAppModuleEndBalance, appModuleEndBalance) @@ -296,7 +280,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla // Assert that the supplier shareholders account balances have *increased* by // the appropriate amount w.r.t token distribution. - shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, expectedAppBurn.Uint64()) + shareAmounts := tokenomicskeeper.GetShareAmountMap(supplierRevShares, appBurn.Uint64()) for shareHolderAddr, expectedShareAmount := range shareAmounts { shareHolderBalance := getBalance(t, ctx, keepers, shareHolderAddr) require.Equal(t, int64(expectedShareAmount), shareHolderBalance.Amount.Int64()) @@ -311,22 +295,14 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMintInvalid_SupplierExceedsMaxCla require.Len(t, appOverservicedEvents, 1, "unexpected number of event overserviced events") appOverservicedEvent := appOverservicedEvents[0] - events := cosmostypes.UnwrapSDKContext(ctx).EventManager().Events() - appAddrAttribute, _ := events.GetAttributes("application_addr") - expectedBurnAttribute, _ := events.GetAttributes("expected_burn") - effectiveBurnAttribute, _ := events.GetAttributes("effective_burn") - - require.Equal(t, 1, len(appAddrAttribute)) - require.Equal(t, fmt.Sprintf("\"%s\"", app.GetAddress()), appAddrAttribute[0].Value) - - var expectedBurnEventCoin, effectiveBurnEventCoin cosmostypes.Coin - err = json.Unmarshal([]byte(expectedBurnAttribute[0].Value), &expectedBurnEventCoin) - require.NoError(t, err) - err = json.Unmarshal([]byte(effectiveBurnAttribute[0].Value), &effectiveBurnEventCoin) - require.NoError(t, err) + require.Equal(t, app.GetAddress(), appOverservicedEvent.ApplicationAddr) + require.Equal(t, supplier.GetOperatorAddress(), appOverservicedEvent.SupplierOperatorAddr) + require.Equal(t, numTokensClaimed, appOverservicedEvent.ExpectedBurn.Amount.Int64()) + require.Equal(t, appBurn, appOverservicedEvent.EffectiveBurn.Amount) + require.Less(t, appBurn.Int64(), numTokensClaimed) +} - // require.EqualValues(t, expectedAppBurn, expectedBurnEventCoin) - require.Greater(t, expectedBurnEventCoin.Amount.Uint64(), effectiveBurnEventCoin.Amount.Uint64()) +func TestProcessTokenLogicModules_TLMGlobalMint_Valid_CorrectMintDistribution(t *testing.T) { } func TestProcessTokenLogicModules_AppNotFound(t *testing.T) { @@ -361,10 +337,8 @@ func TestProcessTokenLogicModules_ServiceNotFound(t *testing.T) { claim := prooftypes.Claim{ SupplierOperatorAddress: supplierOperatorAddr, SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddr, - Service: &sharedtypes.Service{ - Id: "non_existent_svc", - }, + ApplicationAddress: appAddr, + Service: &sharedtypes.Service{Id: "non_existent_svc"}, SessionId: "session_id", SessionStartBlockHeight: 1, SessionEndBlockHeight: testsession.GetSessionEndHeightWithDefaultParams(1), @@ -410,7 +384,7 @@ func TestProcessTokenLogicModules_InvalidRoot(t *testing.T) { root := make([]byte, protocol.TrieRootSize) // All 0s return root[:] }(), - errExpected: false, + errExpected: true, }, { desc: "correct size but invalid value", @@ -541,7 +515,9 @@ func TestProcessTokenLogicModules_InvalidClaim(t *testing.T) { } } -func prepareClaim( +// prepareTestClaim uses the given number of relays and compute unit per relay in the +// service provided to set up the test claim correctly. +func prepareTestClaim( numRelays uint64, service *sharedtypes.Service, app *apptypes.Application, @@ -559,7 +535,16 @@ func prepareClaim( }, RootHash: testproof.SmstRootWithSumAndCount(numComputeUnits, numRelays), } +} +// prepareTestService creates a service with the given compute units per relay. +func prepareTestService(serviceComputeUnitsPerRelay uint64) *sharedtypes.Service { + return &sharedtypes.Service{ + Id: "svc1", + Name: "svcName1", + ComputeUnitsPerRelay: serviceComputeUnitsPerRelay, + OwnerAddress: sample.AccAddress(), + } } func getBalance( diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 648c6afbb..24d3052c8 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -276,16 +276,16 @@ func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { // EventApplicationOverserviced is emitted when an application has less stake than // what a supplier is claiming (i.e. burn is not high enough). type EventApplicationOverserviced struct { - ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` - SupplierAddr string `protobuf:"bytes,2,opt,name=supplier_addr,json=supplierAddr,proto3" json:"supplier_addr,omitempty"` + ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` + SupplierOperatorAddr string `protobuf:"bytes,2,opt,name=supplier_operator_addr,json=supplierOperatorAddr,proto3" json:"supplier_operator_addr,omitempty"` // Expected burn is the amount the supplier is claiming for work done // to service the application during the session. - // This is usually the amount in the Claim object. + // This is usually the amount in the Claim submitted. ExpectedBurn *types1.Coin `protobuf:"bytes,3,opt,name=expected_burn,json=expectedBurn,proto3" json:"expected_burn,omitempty"` // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and - // most likely equal to the application's stake divided by the number of suppliers - // in a session. + // is a function of the relay mining algorithm. + // E.g. Te application's stake divided by the number of suppliers in a session. EffectiveBurn *types1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } @@ -329,9 +329,9 @@ func (m *EventApplicationOverserviced) GetApplicationAddr() string { return "" } -func (m *EventApplicationOverserviced) GetSupplierAddr() string { +func (m *EventApplicationOverserviced) GetSupplierOperatorAddr() string { if m != nil { - return m.SupplierAddr + return m.SupplierOperatorAddr } return "" } @@ -361,53 +361,54 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 730 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4d, 0x4f, 0xdb, 0x48, - 0x18, 0x8e, 0x43, 0x58, 0x29, 0x03, 0x81, 0xc4, 0x2c, 0xda, 0x2c, 0x0b, 0x09, 0x64, 0xa5, 0x15, - 0xcb, 0x0a, 0x5b, 0x80, 0xb4, 0xa7, 0x15, 0xda, 0x24, 0x98, 0xc5, 0xd2, 0x92, 0x44, 0x0e, 0x54, - 0x55, 0x2f, 0x53, 0xc7, 0x7e, 0x93, 0x4c, 0x89, 0x67, 0xdc, 0xf1, 0x38, 0x09, 0xff, 0xa2, 0x3f, - 0xa0, 0x7f, 0xa0, 0x87, 0xfe, 0x8f, 0x1e, 0x39, 0xf6, 0x84, 0x2a, 0xb8, 0x71, 0xea, 0x4f, 0xa8, - 0x3c, 0xce, 0x57, 0x03, 0x55, 0xcf, 0xbd, 0x24, 0x93, 0xe7, 0x7d, 0x9e, 0xf7, 0xe3, 0x99, 0xc9, - 0x8b, 0x8a, 0x3e, 0xbb, 0x12, 0x9c, 0xf5, 0x7a, 0xba, 0x60, 0x57, 0x40, 0x99, 0x47, 0x9c, 0x40, - 0x87, 0x3e, 0x50, 0xa1, 0xf9, 0x9c, 0x09, 0xa6, 0xae, 0x8d, 0x09, 0xda, 0x94, 0xb0, 0x51, 0x70, - 0x58, 0xe0, 0xb1, 0x40, 0x6f, 0xd9, 0x01, 0xe8, 0xfd, 0x83, 0x16, 0x08, 0xfb, 0x40, 0x77, 0x18, - 0xa1, 0xb1, 0x68, 0xe3, 0xe7, 0x0e, 0xeb, 0x30, 0x79, 0xd4, 0xa3, 0xd3, 0x08, 0xdd, 0x98, 0xd4, - 0xf2, 0x39, 0x63, 0x6d, 0x5d, 0x5c, 0xfb, 0x10, 0xc4, 0xb1, 0xd2, 0xfb, 0x24, 0xca, 0x19, 0x51, - 0xd9, 0x6a, 0xcf, 0x26, 0x9e, 0x31, 0xf4, 0x09, 0x07, 0x57, 0xfd, 0x1b, 0x2d, 0x3a, 0xd1, 0xef, - 0xbc, 0xb2, 0xad, 0xec, 0x2e, 0x1d, 0xae, 0x6b, 0x93, 0x66, 0x64, 0x06, 0x4d, 0x92, 0x2b, 0xe9, - 0x87, 0xdb, 0x62, 0xcc, 0xb3, 0xe2, 0x2f, 0x75, 0x1f, 0x21, 0x1a, 0x7a, 0x98, 0x43, 0xcf, 0xbe, - 0x0e, 0xf2, 0xc9, 0x6d, 0x65, 0x37, 0x55, 0x59, 0x79, 0xb8, 0x2d, 0xce, 0xa0, 0x56, 0x9a, 0x86, - 0x9e, 0x25, 0x8f, 0x6a, 0x19, 0xe5, 0xa2, 0x80, 0xc3, 0x3c, 0x3f, 0x14, 0x80, 0x43, 0x4a, 0x44, - 0x90, 0x5f, 0x90, 0xaa, 0xf5, 0x87, 0xdb, 0xe2, 0xe3, 0xa0, 0xb5, 0x4a, 0x43, 0xaf, 0x1a, 0x23, - 0x97, 0x11, 0xa0, 0x52, 0x94, 0x83, 0xa8, 0x69, 0x5b, 0x10, 0x46, 0x31, 0x07, 0x3b, 0x60, 0x34, - 0x9f, 0xda, 0x56, 0x76, 0x57, 0x0e, 0xf7, 0xb4, 0x27, 0x2c, 0xd4, 0xa6, 0x73, 0x4a, 0x89, 0x25, - 0x15, 0x71, 0xb9, 0x47, 0x89, 0xac, 0x2c, 0xcc, 0x11, 0x4b, 0xef, 0xbe, 0xf2, 0xab, 0x09, 0x42, - 0xf4, 0x7e, 0x28, 0xbf, 0x5e, 0xa1, 0x9c, 0x6c, 0x09, 0x73, 0x78, 0x1d, 0x12, 0x0e, 0x1e, 0x50, - 0x31, 0xf2, 0xeb, 0x8f, 0xf9, 0xae, 0x1b, 0xd1, 0xa7, 0x35, 0xe5, 0xcd, 0x7a, 0xf5, 0x28, 0x89, - 0x95, 0xf5, 0xe7, 0xe8, 0xa5, 0xb7, 0x49, 0xb4, 0x23, 0xbd, 0x92, 0xed, 0x9f, 0x13, 0x4a, 0x68, - 0xe7, 0x84, 0xb4, 0xdb, 0xc4, 0x09, 0x7b, 0xe2, 0xfa, 0xd2, 0x77, 0x6d, 0x01, 0xae, 0xba, 0x85, - 0x50, 0x00, 0xbc, 0x4f, 0x1c, 0xc0, 0xc4, 0x95, 0x06, 0xa6, 0xad, 0xf4, 0x08, 0x31, 0x5d, 0xf5, - 0x18, 0x6d, 0xfa, 0x1c, 0xfa, 0x58, 0xd8, 0xbc, 0x03, 0x02, 0x77, 0xed, 0xa0, 0x8b, 0xbb, 0x30, - 0xc4, 0x40, 0x1d, 0xe6, 0x82, 0x2b, 0x4d, 0x4b, 0x5b, 0xf9, 0x88, 0x73, 0x21, 0x29, 0x67, 0x76, - 0xd0, 0x3d, 0x83, 0xa1, 0x11, 0xc7, 0xd5, 0x7f, 0xd0, 0x6f, 0x14, 0x06, 0xdf, 0x94, 0x2f, 0x48, - 0xf9, 0x2f, 0x14, 0x06, 0x4f, 0xaa, 0xf7, 0xd1, 0x9a, 0xac, 0x3e, 0xbd, 0x0f, 0x0c, 0x9e, 0x2d, - 0x0d, 0x4b, 0x45, 0x13, 0x43, 0xbf, 0x36, 0xbe, 0x1d, 0xc3, 0xb3, 0xd5, 0xbf, 0x90, 0x1a, 0x15, - 0x9b, 0x63, 0x2f, 0x4a, 0xf6, 0x2a, 0x85, 0xc1, 0x2c, 0xb9, 0xf4, 0x59, 0x41, 0x9b, 0xd2, 0x9e, - 0xb2, 0xef, 0xf7, 0x88, 0x23, 0x5f, 0x59, 0xbd, 0x0f, 0x7c, 0x34, 0xbb, 0xab, 0xfe, 0x89, 0xb2, - 0xf6, 0x34, 0x84, 0x6d, 0xd7, 0xe5, 0x23, 0x7f, 0x56, 0x67, 0xf0, 0xb2, 0xeb, 0x72, 0xf5, 0x77, - 0x94, 0x09, 0xc2, 0x08, 0x03, 0x1e, 0xf3, 0x62, 0x5b, 0x96, 0xc7, 0xa0, 0x24, 0x1d, 0xa3, 0x0c, - 0x0c, 0x7d, 0x70, 0x04, 0xb8, 0xb8, 0x15, 0x72, 0x2a, 0x87, 0x5f, 0x3a, 0xfc, 0x55, 0x8b, 0xb7, - 0x8a, 0x16, 0x6d, 0x15, 0x6d, 0xb4, 0x55, 0xb4, 0x2a, 0x23, 0xd4, 0x5a, 0x1e, 0xf3, 0x2b, 0x21, - 0xa7, 0xea, 0xbf, 0x68, 0x05, 0xda, 0x6d, 0x70, 0x04, 0xe9, 0x43, 0x9c, 0x20, 0xf5, 0xbd, 0x04, - 0x99, 0x89, 0x20, 0xca, 0xb0, 0xf7, 0x12, 0xad, 0x3f, 0xf9, 0xff, 0x53, 0x77, 0xd0, 0x96, 0xf1, - 0xbc, 0x61, 0x5a, 0xe5, 0x0b, 0xb3, 0x5e, 0xc3, 0x96, 0x51, 0x6e, 0xd6, 0x6b, 0xf8, 0xb2, 0xd6, - 0x6c, 0x18, 0x55, 0xf3, 0xd4, 0x34, 0x4e, 0xb2, 0x09, 0x35, 0x87, 0x32, 0x0d, 0xab, 0x5e, 0x3f, - 0xc5, 0xe7, 0x66, 0xb3, 0x69, 0xd6, 0xfe, 0xcb, 0x2a, 0x53, 0xc8, 0xac, 0x3d, 0x2b, 0xff, 0x6f, - 0x9e, 0x64, 0x93, 0x95, 0xf3, 0x0f, 0x77, 0x05, 0xe5, 0xe6, 0xae, 0xa0, 0x7c, 0xba, 0x2b, 0x28, - 0x6f, 0xee, 0x0b, 0x89, 0x9b, 0xfb, 0x42, 0xe2, 0xe3, 0x7d, 0x21, 0xf1, 0xe2, 0xa8, 0x43, 0x44, - 0x37, 0x6c, 0x69, 0x0e, 0xf3, 0xf4, 0xe8, 0xa1, 0xef, 0x53, 0x10, 0x03, 0xc6, 0xaf, 0xf4, 0xc9, - 0x76, 0x1c, 0xce, 0xee, 0x62, 0xb9, 0x24, 0x5b, 0x3f, 0xc9, 0x2d, 0x79, 0xf4, 0x25, 0x00, 0x00, - 0xff, 0xff, 0x0c, 0xdb, 0x5a, 0x92, 0xaf, 0x05, 0x00, 0x00, + // 740 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x4f, 0x4f, 0xdb, 0x48, + 0x14, 0x8f, 0x43, 0x58, 0x29, 0xc3, 0x02, 0x89, 0x81, 0xdd, 0x2c, 0x0b, 0x09, 0xe4, 0xb0, 0x62, + 0x59, 0x61, 0x0b, 0x58, 0xed, 0x69, 0x85, 0x9a, 0x04, 0x53, 0x2c, 0x95, 0x24, 0x72, 0xa0, 0xaa, + 0x7a, 0x99, 0x3a, 0xf6, 0x4b, 0x32, 0x25, 0x9e, 0x71, 0xc7, 0xe3, 0x24, 0x1c, 0xfb, 0x0d, 0xfa, + 0x01, 0xfa, 0x05, 0x7a, 0xe8, 0xf7, 0xe8, 0x91, 0x63, 0x4f, 0xa8, 0x82, 0x1b, 0x9f, 0xa2, 0xf2, + 0x38, 0xff, 0x1a, 0xa8, 0x7a, 0xee, 0xc5, 0x1e, 0xff, 0xde, 0xef, 0xf7, 0xde, 0x9b, 0xdf, 0x8c, + 0x1f, 0x2a, 0xf8, 0xec, 0x52, 0x70, 0xd6, 0xed, 0xea, 0x82, 0x5d, 0x02, 0x65, 0x1e, 0x71, 0x02, + 0x1d, 0x7a, 0x40, 0x85, 0xe6, 0x73, 0x26, 0x98, 0xba, 0x32, 0x22, 0x68, 0x13, 0xc2, 0x7a, 0xde, + 0x61, 0x81, 0xc7, 0x02, 0xbd, 0x69, 0x07, 0xa0, 0xf7, 0xf6, 0x9b, 0x20, 0xec, 0x7d, 0xdd, 0x61, + 0x84, 0xc6, 0xa2, 0xf5, 0xd5, 0x36, 0x6b, 0x33, 0xb9, 0xd4, 0xa3, 0xd5, 0x10, 0x5d, 0x1f, 0xd7, + 0xf2, 0x39, 0x63, 0x2d, 0x5d, 0x5c, 0xf9, 0x10, 0xc4, 0xb1, 0xe2, 0xc7, 0x24, 0xca, 0x1a, 0x51, + 0xd9, 0x4a, 0xd7, 0x26, 0x9e, 0x31, 0xf0, 0x09, 0x07, 0x57, 0xfd, 0x0f, 0xcd, 0x3b, 0xd1, 0x77, + 0x4e, 0xd9, 0x52, 0x76, 0x16, 0x0e, 0xd6, 0xb4, 0x71, 0x33, 0x32, 0x83, 0x26, 0xc9, 0xe5, 0xf4, + 0xfd, 0x4d, 0x21, 0xe6, 0x59, 0xf1, 0x4b, 0xdd, 0x43, 0x88, 0x86, 0x1e, 0xe6, 0xd0, 0xb5, 0xaf, + 0x82, 0x5c, 0x72, 0x4b, 0xd9, 0x49, 0x95, 0x97, 0xee, 0x6f, 0x0a, 0x53, 0xa8, 0x95, 0xa6, 0xa1, + 0x67, 0xc9, 0xa5, 0x5a, 0x42, 0xd9, 0x28, 0xe0, 0x30, 0xcf, 0x0f, 0x05, 0xe0, 0x90, 0x12, 0x11, + 0xe4, 0xe6, 0xa4, 0x6a, 0xed, 0xfe, 0xa6, 0xf0, 0x30, 0x68, 0x2d, 0xd3, 0xd0, 0xab, 0xc4, 0xc8, + 0x45, 0x04, 0xa8, 0x14, 0x65, 0x21, 0x6a, 0xda, 0x16, 0x84, 0x51, 0xcc, 0xc1, 0x0e, 0x18, 0xcd, + 0xa5, 0xb6, 0x94, 0x9d, 0xa5, 0x83, 0x5d, 0xed, 0x11, 0x0b, 0xb5, 0xc9, 0x3e, 0xa5, 0xc4, 0x92, + 0x8a, 0xb8, 0xdc, 0x83, 0x44, 0x56, 0x06, 0x66, 0x88, 0xc5, 0x0f, 0xdf, 0xf8, 0xd5, 0x00, 0x21, + 0xba, 0x3f, 0x95, 0x5f, 0xaf, 0x51, 0x56, 0xb6, 0x84, 0x39, 0xbc, 0x09, 0x09, 0x07, 0x0f, 0xa8, + 0x18, 0xfa, 0xf5, 0xd7, 0x6c, 0xd7, 0xf5, 0xe8, 0x69, 0x4d, 0x78, 0xd3, 0x5e, 0x3d, 0x48, 0x62, + 0x65, 0xfc, 0x19, 0x7a, 0xf1, 0x7d, 0x12, 0x6d, 0x4b, 0xaf, 0x64, 0xfb, 0x67, 0x84, 0x12, 0xda, + 0x3e, 0x26, 0xad, 0x16, 0x71, 0xc2, 0xae, 0xb8, 0xba, 0xf0, 0x5d, 0x5b, 0x80, 0xab, 0x6e, 0x22, + 0x14, 0x00, 0xef, 0x11, 0x07, 0x30, 0x71, 0xa5, 0x81, 0x69, 0x2b, 0x3d, 0x44, 0x4c, 0x57, 0x3d, + 0x42, 0x1b, 0x3e, 0x87, 0x1e, 0x16, 0x36, 0x6f, 0x83, 0xc0, 0x1d, 0x3b, 0xe8, 0xe0, 0x0e, 0x0c, + 0x30, 0x50, 0x87, 0xb9, 0xe0, 0x4a, 0xd3, 0xd2, 0x56, 0x2e, 0xe2, 0x9c, 0x4b, 0xca, 0xa9, 0x1d, + 0x74, 0x4e, 0x61, 0x60, 0xc4, 0x71, 0xf5, 0x7f, 0xf4, 0x27, 0x85, 0xfe, 0x77, 0xe5, 0x73, 0x52, + 0xfe, 0x3b, 0x85, 0xfe, 0xa3, 0xea, 0x3d, 0xb4, 0x22, 0xab, 0x4f, 0xce, 0x03, 0x83, 0x67, 0x4b, + 0xc3, 0x52, 0xd1, 0x8e, 0xa1, 0x57, 0x1d, 0x9d, 0x8e, 0xe1, 0xd9, 0xea, 0x3f, 0x48, 0x8d, 0x8a, + 0xcd, 0xb0, 0xe7, 0x25, 0x7b, 0x99, 0x42, 0x7f, 0x9a, 0x5c, 0x7c, 0x9b, 0x44, 0x1b, 0xd2, 0x9e, + 0x92, 0xef, 0x77, 0x89, 0x23, 0x6f, 0x59, 0xad, 0x07, 0x7c, 0xb8, 0x77, 0x57, 0xfd, 0x1b, 0x65, + 0xec, 0x49, 0x08, 0xdb, 0xae, 0xcb, 0x87, 0xfe, 0x2c, 0x4f, 0xe1, 0x25, 0xd7, 0xe5, 0xea, 0xbf, + 0xe8, 0xb7, 0x20, 0x8c, 0x30, 0xe0, 0x98, 0xf9, 0xc0, 0x6d, 0xc1, 0x78, 0x2c, 0x88, 0xfd, 0x59, + 0x1d, 0x45, 0x6b, 0xc3, 0xa0, 0x54, 0x1d, 0xa1, 0x45, 0x18, 0xf8, 0xe0, 0x08, 0x70, 0x71, 0x33, + 0xe4, 0x54, 0xba, 0xb1, 0x70, 0xf0, 0x87, 0x16, 0x8f, 0x19, 0x2d, 0x1a, 0x33, 0xda, 0x70, 0xcc, + 0x68, 0x15, 0x46, 0xa8, 0xf5, 0xeb, 0x88, 0x5f, 0x0e, 0x39, 0x55, 0x9f, 0xa0, 0x25, 0x68, 0xb5, + 0xc0, 0x11, 0xa4, 0x07, 0x71, 0x82, 0xd4, 0x8f, 0x12, 0x2c, 0x8e, 0x05, 0x51, 0x86, 0xdd, 0x57, + 0x68, 0xed, 0xd1, 0x1f, 0x52, 0xdd, 0x46, 0x9b, 0xc6, 0x8b, 0xba, 0x69, 0x95, 0xce, 0xcd, 0x5a, + 0x15, 0x5b, 0x46, 0xa9, 0x51, 0xab, 0xe2, 0x8b, 0x6a, 0xa3, 0x6e, 0x54, 0xcc, 0x13, 0xd3, 0x38, + 0xce, 0x24, 0xd4, 0x2c, 0x5a, 0xac, 0x5b, 0xb5, 0xda, 0x09, 0x3e, 0x33, 0x1b, 0x0d, 0xb3, 0xfa, + 0x34, 0xa3, 0x4c, 0x20, 0xb3, 0xfa, 0xbc, 0xf4, 0xcc, 0x3c, 0xce, 0x24, 0xcb, 0x67, 0x9f, 0x6e, + 0xf3, 0xca, 0xf5, 0x6d, 0x5e, 0xf9, 0x72, 0x9b, 0x57, 0xde, 0xdd, 0xe5, 0x13, 0xd7, 0x77, 0xf9, + 0xc4, 0xe7, 0xbb, 0x7c, 0xe2, 0xe5, 0x61, 0x9b, 0x88, 0x4e, 0xd8, 0xd4, 0x1c, 0xe6, 0xe9, 0xd1, + 0xcd, 0xdf, 0xa3, 0x20, 0xfa, 0x8c, 0x5f, 0xea, 0xe3, 0x71, 0x39, 0x98, 0x1e, 0xce, 0x72, 0x6a, + 0x36, 0x7f, 0x91, 0x63, 0xf3, 0xf0, 0x6b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x9c, 0x4b, 0x68, + 0xc0, 0x05, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -608,10 +609,10 @@ func (m *EventApplicationOverserviced) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x1a } - if len(m.SupplierAddr) > 0 { - i -= len(m.SupplierAddr) - copy(dAtA[i:], m.SupplierAddr) - i = encodeVarintEvent(dAtA, i, uint64(len(m.SupplierAddr))) + if len(m.SupplierOperatorAddr) > 0 { + i -= len(m.SupplierOperatorAddr) + copy(dAtA[i:], m.SupplierOperatorAddr) + i = encodeVarintEvent(dAtA, i, uint64(len(m.SupplierOperatorAddr))) i-- dAtA[i] = 0x12 } @@ -717,7 +718,7 @@ func (m *EventApplicationOverserviced) Size() (n int) { if l > 0 { n += 1 + l + sovEvent(uint64(l)) } - l = len(m.SupplierAddr) + l = len(m.SupplierOperatorAddr) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } @@ -1271,7 +1272,7 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SupplierAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SupplierOperatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1299,7 +1300,7 @@ func (m *EventApplicationOverserviced) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SupplierAddr = string(dAtA[iNdEx:postIndex]) + m.SupplierOperatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { From 085d13487fd22de9288817a7456d78b87bcc548d Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Sun, 25 Aug 2024 15:09:51 -0400 Subject: [PATCH 11/48] Implemented TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect --- testutil/keeper/tokenomics.go | 13 ++ testutil/sample/sample.go | 23 ++-- .../keeper_settle_pending_claims_test.go | 2 +- x/tokenomics/keeper/token_logic_modules.go | 31 +++-- .../keeper/token_logic_modules_test.go | 129 +++++++++++++++++- x/tokenomics/types/errors.go | 1 + 6 files changed, 167 insertions(+), 32 deletions(-) diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 6ec0e64df..008b29be2 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -460,3 +460,16 @@ func WithService(service sharedtypes.Service) TokenomicsModuleKeepersOpt { return ctx } } + +func WithProposerAddr(addr string) TokenomicsModuleKeepersOpt { + return func(ctx context.Context, keepers *TokenomicsModuleKeepers) context.Context { + valAddr, err := cosmostypes.ValAddressFromBech32(addr) + if err != nil { + panic(err) + } + consensusAddr := cosmostypes.ConsAddress(valAddr) + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx = sdkCtx.WithProposer(consensusAddr) + return sdkCtx + } +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 7bf7a7d3c..c9b91d874 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -1,6 +1,8 @@ package sample import ( + "encoding/hex" + "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -17,25 +19,28 @@ func AccAddressAndPubKey() (string, cryptotypes.PubKey) { // AccAddress returns a sample account address func AccAddress() string { - // TODO_BETA(@olshansk): Change this to secp256k1 because that's what we'll - // use in production for all real accounts. + addr, _ := AccAddressAndPubKey() + return addr +} + +// AccAddressAndPubKeyEdd2519 returns a sample account address and public key +func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() - return sdk.AccAddress(addr).String() + return sdk.AccAddress(addr).String(), pk } // ConsAddress returns a sample consensus address, which has the prefix // of validators (i.e. consensus nodes) when converted to bech32. func ConsAddress() string { - pk := ed25519.GenPrivKey().PubKey() + _, pk := AccAddressAndPubKey() consensusAddress := tmhash.SumTruncated(pk.Address()) valAddress := sdk.ValAddress(consensusAddress) return valAddress.String() } -// AccAddressAndPubKeyEdd2519 returns a sample account address and public key -func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { - pk := ed25519.GenPrivKey().PubKey() - addr := pk.Address() - return sdk.AccAddress(addr).String(), pk +func AccAddressFromConsAddress(validatorConsAddr string) string { + valAddr, _ := sdk.ValAddressFromBech32(validatorConsAddr) + proposerAddress, _ := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) + return proposerAddress.String() } diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index cdb9d8e98..94f873791 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -141,7 +141,7 @@ func (s *TestSuite) SetupTest() { require.NoError(t, err) // Construct a valid session tree with 10 relays. - s.numRelays = uint64(10) + s.numRelays = uint64(100) sessionTree := testtree.NewFilledSessionTree( sdkCtx, t, s.numRelays, service.ComputeUnitsPerRelay, diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 2d0a4aabc..c41b046fc 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -27,7 +27,7 @@ import ( var ( // Governance parameters for the TLMGlobalMint module // TODO_UPNEXT(@olshansk, #732): Make this a governance parameter and give it a non-zero value + tests. - MintPerClaimGlobalInflation = 0.1 + MintPerClaimedTokenGlobalInflation = 0.1 ) const ( @@ -45,7 +45,7 @@ const ( // Due to floating point arithmetic, the total amount of minted coins may be slightly // larger than what is distributed to pocket network participants // TODO_MAINNET: Figure out if we can avoid this tolerance and use fixed point arithmetic. - mintDistributionAllowableTolerance = 0.02 + MintDistributionAllowableTolerance = 0.02 ) type TokenLogicModule int @@ -347,15 +347,16 @@ func (k Keeper) TokenLogicModuleGlobalMint( ) error { logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") - if MintPerClaimGlobalInflation == 0 { + if MintPerClaimedTokenGlobalInflation == 0 { logger.Warn("global inflation is set to zero. Skipping Global Mint TLM.") return nil } // Determine how much new uPOKT to mint based on global inflation newMintCoin, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) - - fmt.Println("OLSH ", newMintCoin, MintPerClaimGlobalInflation, settlementCoin) + if newMintCoin.Amount.Int64() == 0 { + return tokenomicstypes.ErrTokenomicsMintAmountZero + } // Mint new uPOKT to the tokenomics module account if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { @@ -365,14 +366,14 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Info(fmt.Sprintf("minted (%v) coins in the tokenomics module", newMintCoin)) // Send a portion of the rewards to the application - appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.Address, newMintAmtFloat, MintAllocationApplication) + appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.Address, &newMintAmtFloat, MintAllocationApplication) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to application: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the application with address %q", appCoin, application.Address)) // Send a portion of the rewards to the supplier shareholders. - supplierCoinsToShareAmt := calculateAllocationAmount(newMintAmtFloat, MintAllocationSupplier) + supplierCoinsToShareAmt := calculateAllocationAmount(&newMintAmtFloat, MintAllocationSupplier) supplierCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(supplierCoinsToShareAmt)) // Send funds from the tokenomics module to the supplier module account if err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, tokenomicstypes.ModuleName, suppliertypes.ModuleName, sdk.NewCoins(supplierCoin)); err != nil { @@ -394,14 +395,14 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the supplier with address %q", supplierCoin, supplier.OperatorAddress)) // Send a portion of the rewards to the DAO - daoCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, k.GetAuthority(), newMintAmtFloat, MintAllocationDAO) + daoCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, k.GetAuthority(), &newMintAmtFloat, MintAllocationDAO) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to DAO: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the DAO with address %q", daoCoin, k.GetAuthority())) // Send a portion of the rewards to the source owner - serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, service.OwnerAddress, newMintAmtFloat, MintAllocationSourceOwner) + serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, service.OwnerAddress, &newMintAmtFloat, MintAllocationSourceOwner) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to source owner: %v", err) } @@ -409,7 +410,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Send a portion of the rewards to the block proposer proposerAddr := cosmostypes.AccAddress(sdk.UnwrapSDKContext(ctx).BlockHeader().ProposerAddress).String() - proposerCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, proposerAddr, newMintAmtFloat, MintAllocationProposer) + proposerCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, proposerAddr, &newMintAmtFloat, MintAllocationProposer) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to proposer: %v", err) } @@ -420,7 +421,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( coinDifference := new(big.Int).Sub(totalMintDistributedCoin.Amount.BigInt(), newMintCoin.Amount.BigInt()) coinDifference = coinDifference.Abs(coinDifference) percentDifference := new(big.Float).Quo(new(big.Float).SetInt(coinDifference), new(big.Float).SetInt(newMintCoin.Amount.BigInt())) - if percentDifference.Cmp(big.NewFloat(mintDistributionAllowableTolerance)) > 0 { + if percentDifference.Cmp(big.NewFloat(MintDistributionAllowableTolerance)) > 0 { return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", @@ -498,7 +499,7 @@ func (k Keeper) ensureClaimAmountLimits( maxClaimableCoin := sdk.NewCoin(volatile.DenomuPOKT, appStake.Amount.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession))) if maxClaimableCoin.Amount.GTE(claimSettlementCoin.Amount) { - logger.Info(fmt.Sprintf("Claim by supplier %s IS WITHIN LIMITS of servicing application %s. Max claimable amount < Claim amount: %v < %v", + logger.Info(fmt.Sprintf("Claim by supplier %s IS WITHIN LIMITS of servicing application %s. Max claimable amount >= Claim amount: %v >= %v", supplier.OperatorAddress, application.Address, maxClaimableCoin, claimSettlementCoin.Amount)) return claimSettlementCoin, nil } @@ -606,14 +607,14 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( // calculateGlobalPerClaimMintInflationFromSettlementAmount calculates the amount // of uPOKT to mint based on the global per claim inflation rate as a function of // the settlement amount for a particular claim(s) or session(s). -func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coin, *big.Float) { +func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk.Coin) (sdk.Coin, big.Float) { // Determine how much new uPOKT to mint based on global per claim inflation. // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) - newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimGlobalInflation)) + newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimedTokenGlobalInflation)) newMintAmtInt, _ := newMintAmtFloat.Int64() mintAmtCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt)) - return mintAmtCoin, newMintAmtFloat + return mintAmtCoin, *newMintAmtFloat } // calculateAllocationAmount does big float arithmetic to determine the absolute diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 6174ca72c..d8ac3ef5e 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/pokt-network/smt" "github.com/stretchr/testify/require" @@ -36,6 +37,9 @@ func init() { cmd.InitSDKConfig() } +// TODO_IMPROVE: Consider using a TestSuite, similar to `x/tokenomics/keeper/keeper_settle_pending_claims_test.go` +// for the TLM based tests in this file. + func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { // Test Parameters appInitialStake := math.NewInt(1000000) @@ -66,10 +70,10 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { require.NoError(t, err) // TODO_TECHDEBT: Setting inflation to zero so we are testing the BurnEqualsMint logic exclusively. // Once it is a governance param, update it using the keeper above. - prevInflationValue := tokenomicskeeper.MintPerClaimGlobalInflation - tokenomicskeeper.MintPerClaimGlobalInflation = 0 + prevInflationValue := tokenomicskeeper.MintPerClaimedTokenGlobalInflation + tokenomicskeeper.MintPerClaimedTokenGlobalInflation = 0 t.Cleanup(func() { - tokenomicskeeper.MintPerClaimGlobalInflation = prevInflationValue + tokenomicskeeper.MintPerClaimedTokenGlobalInflation = prevInflationValue }) // Add a new application with non-zero app stake end balance to assert against. @@ -193,10 +197,10 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxCl require.NoError(t, err) // TODO_TECHDEBT: Setting inflation to zero so we are testing the BurnEqualsMint logic exclusively. // Once it is a governance param, update it using the keeper above. - prevInflationValue := tokenomicskeeper.MintPerClaimGlobalInflation - tokenomicskeeper.MintPerClaimGlobalInflation = 0 + prevInflationValue := tokenomicskeeper.MintPerClaimedTokenGlobalInflation + tokenomicskeeper.MintPerClaimedTokenGlobalInflation = 0 t.Cleanup(func() { - tokenomicskeeper.MintPerClaimGlobalInflation = prevInflationValue + tokenomicskeeper.MintPerClaimedTokenGlobalInflation = prevInflationValue }) // Add a new application with non-zero app stake end balance to assert against. @@ -302,7 +306,118 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxCl require.Less(t, appBurn.Int64(), numTokensClaimed) } -func TestProcessTokenLogicModules_TLMGlobalMint_Valid_CorrectMintDistribution(t *testing.T) { +func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t *testing.T) { + // Test Parameters + appInitialStake := math.NewInt(1000000) + supplierInitialStake := math.NewInt(1000000) + supplierRevShareRatios := []float32{12.5, 37.5, 50} + globalComputeUnitsToTokensMultiplier := uint64(1) + serviceComputeUnitsPerRelay := uint64(1) + service := prepareTestService(serviceComputeUnitsPerRelay) + numRelays := uint64(1000) // By supplier for application in this session + numTokensClaimed := float64(numRelays * serviceComputeUnitsPerRelay * globalComputeUnitsToTokensMultiplier) + validatorConsAddr := sample.ConsAddress() + + // Prepare the keepers + keepers, ctx := testkeeper.NewTokenomicsModuleKeepers(t, nil, testkeeper.WithService(*service), testkeeper.WithProposerAddr(validatorConsAddr)) + keepers.SetService(ctx, *service) + + // Set compute_units_to_tokens_multiplier to simplify expectation calculations. + err := keepers.Keeper.SetParams(ctx, tokenomicstypes.Params{ + ComputeUnitsToTokensMultiplier: globalComputeUnitsToTokensMultiplier, + }) + require.NoError(t, err) + + // Add a new application with non-zero app stake end balance to assert against. + appStake := cosmostypes.NewCoin(volatile.DenomuPOKT, appInitialStake) + app := apptypes.Application{ + Address: sample.AccAddress(), + Stake: &appStake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{Service: service}}, + } + keepers.SetApplication(ctx, app) + + // Prepare the supplier revenue shares + supplierRevShares := make([]*sharedtypes.ServiceRevenueShare, len(supplierRevShareRatios)) + for i := range supplierRevShares { + shareHolderAddress := sample.AccAddress() + supplierRevShares[i] = &sharedtypes.ServiceRevenueShare{ + Address: shareHolderAddress, + RevSharePercentage: supplierRevShareRatios[i], + } + } + + // Add a new supplier. + supplierStake := cosmostypes.NewCoin(volatile.DenomuPOKT, supplierInitialStake) + supplier := sharedtypes.Supplier{ + // Make the first shareholder the supplier itself. + OwnerAddress: supplierRevShares[0].Address, + OperatorAddress: supplierRevShares[0].Address, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{{Service: service, RevShare: supplierRevShares}}, + } + keepers.SetSupplier(ctx, supplier) + + // Prepare the claim for which the supplier did work for the application + claim := prepareTestClaim(numRelays, service, &app, &supplier) + + // Prepare addresses + daoAddr := authtypes.NewModuleAddress(govtypes.ModuleName) + appAddress := app.Address + proposerAddress := sample.AccAddressFromConsAddress(validatorConsAddr) + // supplierOperatorAddr := supplier.OperatorAddress + + // Determine balances before inflation + daoBalanceBefore := getBalance(t, ctx, keepers, daoAddr.String()) + propBalanceBefore := getBalance(t, ctx, keepers, proposerAddress) + serviceOwnerBalanceBefore := getBalance(t, ctx, keepers, service.OwnerAddress) + appBalanceBefore := getBalance(t, ctx, keepers, appAddress) + supplierShareholderBalancesBefore := make(map[string]*sdk.Coin, len(supplierRevShares)) + for _, revShare := range supplierRevShares { + addr := revShare.Address + supplierShareholderBalancesBefore[addr] = getBalance(t, ctx, keepers, addr) + } + + // Process the token logic modules + err = keepers.ProcessTokenLogicModules(ctx, &claim) + require.NoError(t, err) + + // Determine balances after inflation + daoBalanceAfter := getBalance(t, ctx, keepers, daoAddr.String()) + propBalanceAfter := getBalance(t, ctx, keepers, proposerAddress) + serviceOwnerBalanceAfter := getBalance(t, ctx, keepers, service.OwnerAddress) + appBalanceAfter := getBalance(t, ctx, keepers, appAddress) + supplierShareholderBalancesAfter := make(map[string]*sdk.Coin, len(supplierRevShares)) + for _, revShare := range supplierRevShares { + addr := revShare.Address + supplierShareholderBalancesAfter[addr] = getBalance(t, ctx, keepers, addr) + } + + // Compute mint per actor + numTokensMinted := numTokensClaimed * tokenomicskeeper.MintPerClaimedTokenGlobalInflation + daoMint := math.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationDAO)) + propMint := math.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationProposer)) + serviceOwnerMint := math.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationSourceOwner)) + appMint := math.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationApplication)) + supplierMint := float32(numTokensMinted * tokenomicskeeper.MintAllocationSupplier) + + // Ensure the balance was increase be the appropriate amount + require.Equal(t, daoBalanceBefore.Amount.Add(daoMint), daoBalanceAfter.Amount) + require.Equal(t, propBalanceBefore.Amount.Add(propMint), propBalanceAfter.Amount) + require.Equal(t, serviceOwnerBalanceBefore.Amount.Add(serviceOwnerMint), serviceOwnerBalanceAfter.Amount) + require.Equal(t, appBalanceBefore.Amount.Add(appMint), appBalanceAfter.Amount) + for _, revShare := range supplierRevShares { + addr := revShare.Address + balanceBefore := supplierShareholderBalancesBefore[addr] + balanceAfter := supplierShareholderBalancesAfter[addr].Amount.Int64() + mintShare := int64(supplierMint * revShare.RevSharePercentage / 100) + rewardShare := int64(float32(numTokensClaimed) * revShare.RevSharePercentage / 100) + balanceIncrease := math.NewInt(mintShare + rewardShare) + expectedBalanceAfter := balanceBefore.Amount.Add(balanceIncrease).Int64() + // TODO_MAINNET: Remove the InDelta check and use the exact amount once the floating point arithmetic is fixed + acceptableRoundingDelta := tokenomicskeeper.MintDistributionAllowableTolerance * float64(balanceAfter) + require.InDelta(t, expectedBalanceAfter, balanceAfter, acceptableRoundingDelta) + } } func TestProcessTokenLogicModules_AppNotFound(t *testing.T) { diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 018c44601..f5f1c7e1a 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -34,4 +34,5 @@ var ( ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") ErrTokenomicsAmountMismatchTooLarge = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") + ErrTokenomicsMintAmountZero = sdkerrors.Register(ModuleName, 1128, "mint amount cannot be zero") ) From 1de13ba277dc23c6a34faa29dec3f58f5c6cff7e Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Sun, 25 Aug 2024 15:16:30 -0400 Subject: [PATCH 12/48] Updated comments in e2e/tests/0_settlement.feature --- e2e/tests/0_settlement.feature | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index 89ab2527c..ec7042940 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -7,7 +7,7 @@ Feature: Tokenomics Namespace - Scenario: Mint equals burn when a claim is created and a valid proof is submitted and required + Scenario: TLM Mint=Burn when a valid claim is within max limits Given the user has the pocketd binary installed # Network preparation and validation And an account exists for "supplier1" @@ -25,23 +25,12 @@ Feature: Tokenomics Namespace 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 - Scenario: - Given the user has the pocketd binary installed - # Network preparation - And an account exists for "supplier1" - And the "supplier" account for "supplier1" is staked - And an account exists for "app1" - And the "application" account for "app1" is staked - And the service "anvil" registered for application "app1" has a compute units per relay of "1" - # Start servicing relays - When the supplier "supplier1" has serviced a session with "10" relays for service "anvil" for application "app1" - # Wait for the Claim & Proof lifecycle - And the user should wait for the "tokenomics" module "ClaimSettled" end block event to be broadcast - - # TODO_IN_THIS_PR: Add the following test - # Scenario: Supplier overservices an application and gets paid for less work than claimed - # TODO_ADDTEST: Implement the following scenarios + # Scenario: Supplier revenue shares are properly distributedTestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime + # Scenario: TLM Mint=Burn when a valid claim is outside Max Limits + # - Ensure over serviced event is submitted + # Scenario: TLM GlobalMint properly distributes minted rewards to all actors + # - Ensure reimbursement request is submitted # Scenario: Mint equals burn when a claim is created and a valid proof is submitted but not required # Scenario: No emissions or burn when a claim is created and an invalid proof is submitted # Scenario: No emissions or burn when a claim is created and a proof is required but is not submitted From b8dff51a47556f6b65fc5cf081c50eb10b3e419e Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Sun, 25 Aug 2024 15:27:03 -0400 Subject: [PATCH 13/48] Fixed failing unit test --- e2e/tests/0_settlement.feature | 2 +- .../relay_mining_difficulty_test.go | 46 ++++++++++--------- testutil/integration/app.go | 7 +-- testutil/testrelayer/relays.go | 20 +++++++- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index ec7042940..2503b6a68 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -26,7 +26,7 @@ Feature: Tokenomics Namespace And the "application" stake of "app1" should be "420" uPOKT "less" than before # TODO_ADDTEST: Implement the following scenarios - # Scenario: Supplier revenue shares are properly distributedTestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime + # Scenario: Supplier revenue shares are properly distributed # Scenario: TLM Mint=Burn when a valid claim is outside Max Limits # - Ensure over serviced event is submitted # Scenario: TLM GlobalMint properly distributes minted rewards to all actors diff --git a/tests/integration/tokenomics/relay_mining_difficulty_test.go b/tests/integration/tokenomics/relay_mining_difficulty_test.go index 3b3a2d876..498486320 100644 --- a/tests/integration/tokenomics/relay_mining_difficulty_test.go +++ b/tests/integration/tokenomics/relay_mining_difficulty_test.go @@ -39,8 +39,9 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) session := getSession(t, integrationApp) sharedParams := getSharedParams(t, integrationApp) - // Prepare the trie with a single mined relay - trie := prepareSMST(t, sdkCtx, integrationApp, session) + // Prepare the trie with several mined relays + numRelays := uint64(100) + trie := prepareSMST(t, sdkCtx, integrationApp, session, numRelays) // Compute the number of blocks to wait between different events // TODO_BLOCKER(@bryanchriswhite): See this comment: https://github.com/pokt-network/poktroll/pull/610#discussion_r1645777322 @@ -118,8 +119,8 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) require.Equal(t, prooftypes.DefaultRelayDifficultyTargetHashHex, relayMiningEvent.NewTargetHashHexEncoded) // The previous EMA is the same as the current one if the service is new - require.Equal(t, uint64(1), relayMiningEvent.PrevNumRelaysEma) - require.Equal(t, uint64(1), relayMiningEvent.NewNumRelaysEma) + require.Equal(t, numRelays, relayMiningEvent.PrevNumRelaysEma) + require.Equal(t, numRelays, relayMiningEvent.NewNumRelaysEma) } func UpdateRelayMiningDifficulty_UpdatingMultipleServicesAtOnce(t *testing.T) {} @@ -164,11 +165,12 @@ func getSession(t *testing.T, integrationApp *testutil.App) *sessiontypes.Sessio return getSessionRes.Session } -// prepareSMST prepares an SMST with a single mined relay for the given session. +// prepareSMST prepares an SMST with a the number of mined relays specified. func prepareSMST( t *testing.T, ctx context.Context, integrationApp *testutil.App, session *sessiontypes.Session, + numRelays uint64, ) *smt.SMST { t.Helper() @@ -178,23 +180,25 @@ func prepareSMST( kvStore, err := pebble.NewKVStore("") require.NoError(t, err) - // NB: A signed mined relay is a MinedRelay type with the appropriate - // payload, signatures and metadata populated. - // - // It does not (as of writing) adhere to the actual on-chain difficulty (i.e. - // hash check) of the test service surrounding the scope of this test. - minedRelay := testrelayer.NewSignedMinedRelay(t, ctx, - session, - integrationApp.DefaultApplication.Address, - integrationApp.DefaultSupplier.OperatorAddress, - integrationApp.DefaultSupplierKeyringKeyringUid, - integrationApp.GetKeyRing(), - integrationApp.GetRingClient(), - ) - trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) - err = trie.Update(minedRelay.Hash, minedRelay.Bytes, 1) - require.NoError(t, err) + + for i := uint64(0); i < numRelays; i++ { + // DEV_NOTE: A signed mined relay is a MinedRelay type with the appropriate + // payload, signatures and metadata populated. + // It does not (as of writing) adhere to the actual on-chain difficulty (i.e. + // hash check) of the test service surrounding the scope of this test. + minedRelay := testrelayer.NewSignedMinedRelay(t, ctx, + session, + integrationApp.DefaultApplication.Address, + integrationApp.DefaultSupplier.OperatorAddress, + integrationApp.DefaultSupplierKeyringKeyringUid, + integrationApp.GetKeyRing(), + integrationApp.GetRingClient(), + ) + + err = trie.Update(minedRelay.Hash, minedRelay.Bytes, 1) + require.NoError(t, err) + } return trie } diff --git a/testutil/integration/app.go b/testutil/integration/app.go index ccd56beba..7f46755ca 100644 --- a/testutil/integration/app.go +++ b/testutil/integration/app.go @@ -509,9 +509,10 @@ func NewCompleteIntegrationApp(t *testing.T) *App { // Prepare a new default service defaultService := sharedtypes.Service{ - Id: "svc1", - Name: "svcName1", - OwnerAddress: sample.AccAddress(), + Id: "svc1", + Name: "svcName1", + ComputeUnitsPerRelay: 1, + OwnerAddress: sample.AccAddress(), } serviceKeeper.SetService(integrationApp.sdkCtx, defaultService) integrationApp.DefaultService = &defaultService diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go index 14da2aace..83bc75ab4 100644 --- a/testutil/testrelayer/relays.go +++ b/testutil/testrelayer/relays.go @@ -5,11 +5,13 @@ import ( "fmt" "strings" "testing" + "time" "github.com/cosmos/cosmos-sdk/crypto/keyring" cosmostypes "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/stretchr/testify/require" + "golang.org/x/exp/rand" "github.com/pokt-network/poktroll/pkg/crypto" "github.com/pokt-network/poktroll/pkg/crypto/protocol" @@ -93,13 +95,13 @@ func NewSignedMinedRelay( SessionHeader: session.Header, SupplierOperatorAddress: supplierOperatorAddr, }, - Payload: []byte("request_payload"), + Payload: randomPayload(), }, Res: &servicetypes.RelayResponse{ Meta: servicetypes.RelayResponseMetadata{ SessionHeader: session.Header, }, - Payload: []byte("response_payload"), + Payload: randomPayload(), }, } @@ -234,3 +236,17 @@ func NewEmptyRelay(reqHeader, resHeader *sessiontypes.SessionHeader, supplierOpe }, } } + +const ( + charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + payloadLength = 32 +) + +func randomPayload() []byte { + rand.Seed(uint64(time.Now().UnixNano())) + bz := make([]byte, payloadLength) + for i := range bz { + bz[i] = charset[rand.Intn(len(charset))] + } + return bz +} From 4c335e7dd53aa8f766d63cd9b854aa2fb29f15e3 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 26 Aug 2024 17:20:27 -0400 Subject: [PATCH 14/48] update compile proto --- x/tokenomics/types/tx.pb.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index 91f06eeff..5bc7d33e4 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -133,7 +133,6 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // // *MsgUpdateParam_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes From ccb4e12fda6d1387a429f41bad71ef36405c045c Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 18:08:22 -0400 Subject: [PATCH 15/48] Update proto/poktroll/tokenomics/event.proto Co-authored-by: Bryan White --- proto/poktroll/tokenomics/event.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index a536a1ae6..5602d73c0 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -44,7 +44,7 @@ message EventRelayMiningDifficultyUpdated { } // EventApplicationOverserviced is emitted when an application has less stake than -// what a supplier is claiming (i.e. burn is not high enough). +// what a supplier is claiming (i.e. amount available for burning is insufficient). message EventApplicationOverserviced { string application_addr = 1; string supplier_operator_addr = 2; From 7fce0fcd5250cb13ecdda82de318c79ebb9a3788 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 18:57:47 -0400 Subject: [PATCH 16/48] Update x/tokenomics/keeper/keeper_settle_pending_claims_test.go Co-authored-by: Bryan White --- x/tokenomics/keeper/keeper_settle_pending_claims_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index 94f873791..e748b4bc9 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -140,7 +140,7 @@ func (s *TestSuite) SetupTest() { )) require.NoError(t, err) - // Construct a valid session tree with 10 relays. + // Construct a valid session tree with 100 relays. s.numRelays = uint64(100) sessionTree := testtree.NewFilledSessionTree( sdkCtx, t, From f60cc46ace9c13985371b68552b90eb199fecb2c Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:26:22 -0400 Subject: [PATCH 17/48] WIP comments --- pkg/relayer/session/sessiontree.go | 11 +++++++++-- x/tokenomics/keeper/token_logic_modules.go | 7 +++---- x/tokenomics/keeper/update_relay_mining_difficulty.go | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 188a95a27..be810bfbe 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -69,8 +69,15 @@ type sessionTree struct { // NewSessionTree creates a new sessionTree from a Session and a storePrefix. It also takes a function // removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. // It returns an error if the KVStore fails to be created. -// TODO_BETA(@red-0ne): When starting a new session, check how many relays the app can handle. -// See the TODO next to the `sessionTree` struct definition for more details. +// +// TODO_BETA(@red-0ne): When starting a new session, check what the MaxClaimableAmount +// (in uPOKT) by the Supplier as a function of +// (app_stake, compute_units_per_relay_for_service, global_compute_units_to_token_multiplier). +// TODO_CONFIG_NOTE: Whether or not the RelayMiner stop handling requests when the max is reached should be +// configurable by the operator. +// TODO_ERROR_NOTE: If overservicing is set to false, create a new error that the relay is rejected +// specifically because the supplier has reached the max claimable amount, so the caller should relay +// the request to another supplier. func NewSessionTree( sessionHeader *sessiontypes.SessionHeader, supplierOperatorAddress *cosmostypes.AccAddress, diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index c41b046fc..61b3e25a6 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -475,7 +475,7 @@ func (k Keeper) sendRewardsToAccount( // Ref: https://arxiv.org/pdf/2305.10672 func (k Keeper) ensureClaimAmountLimits( ctx context.Context, - methodLogger log.Logger, + logger log.Logger, application *apptypes.Application, supplier *sharedtypes.Supplier, claimSettlementCoin cosmostypes.Coin, @@ -483,7 +483,7 @@ func (k Keeper) ensureClaimAmountLimits( actualSettlementCoins cosmostypes.Coin, err error, ) { - logger := methodLogger.With("helper", "ensureClaimAmountLimits") + logger = logger.With("helper", "ensureClaimAmountLimits") // TODO_BETA_OR_MAINNET(@red-0ne): The application stake gets reduced with every claim // settlement. Relay miners use the appStake at the beginning of a session to determine @@ -494,8 +494,7 @@ func (k Keeper) ensureClaimAmountLimits( // solution and implementation ends up being, make sure to KISS. appStake := application.GetStake() - // Determine the max claimable amount for the supplier based on the application's stake - // in this session. + // Determine the max claimable amount for the supplier based on the application's stake in this session. maxClaimableCoin := sdk.NewCoin(volatile.DenomuPOKT, appStake.Amount.Quo(math.NewInt(sessionkeeper.NumSupplierPerSession))) if maxClaimableCoin.Amount.GTE(claimSettlementCoin.Amount) { diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty.go b/x/tokenomics/keeper/update_relay_mining_difficulty.go index e93b1574d..ac866bbd1 100644 --- a/x/tokenomics/keeper/update_relay_mining_difficulty.go +++ b/x/tokenomics/keeper/update_relay_mining_difficulty.go @@ -188,11 +188,11 @@ func computeEma(alpha *big.Float, prevEma, currValue uint64) uint64 { // difficulty is being initialized for the first time. func newDefaultRelayMiningDifficulty( ctx context.Context, - methodLogger log.Logger, + logger log.Logger, serviceId string, numRelays uint64, ) tokenomicstypes.RelayMiningDifficulty { - logger := methodLogger.With("helper", "newDefaultRelayMiningDifficulty") + logger = logger.With("helper", "newDefaultRelayMiningDifficulty") logger.Warn(types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf( "No previous relay mining difficulty found for service %s. Creating a temporary relay mining difficulty with %d relays and default target hash %x", serviceId, numRelays, prooftypes.DefaultRelayDifficultyTargetHash).Error()) From 62987655600807cad3af82e52a022e0fdc809c53 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:26:32 -0400 Subject: [PATCH 18/48] WIP comments --- api/poktroll/tokenomics/event.pulsar.go | 2 +- pkg/relayer/session/sessiontree.go | 2 +- x/tokenomics/keeper/token_logic_modules.go | 13 +++---------- x/tokenomics/types/event.pb.go | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 944d6be99..843b8a75a 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2715,7 +2715,7 @@ func (x *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { } // EventApplicationOverserviced is emitted when an application has less stake than -// what a supplier is claiming (i.e. burn is not high enough). +// what a supplier is claiming (i.e. amount available for burning is insufficient). type EventApplicationOverserviced struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index be810bfbe..2fd0002e9 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -19,7 +19,7 @@ import ( var _ relayer.SessionTree = (*sessionTree)(nil) // sessionTree is an implementation of the SessionTree interface. -// TODO_BETA(@red-0ne): Per the Relay Mining paper, we need to optimistically store +// TODO_IN_THIS_PR_DISCUSS: Per the Relay Mining paper, we need to optimistically store // the number of requests that an application can pay for. This needs to be tracked // based on the app's stake in the beginning of a session and the number of nodes // per session. An operator should be able to specify "overservicing_okay" whereby diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 61b3e25a6..6680893a0 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -306,7 +306,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( logger.Info(fmt.Sprintf("minted (%v) coins in the supplier module", settlementCoin)) // Distribute the rewards to the supplier's shareholders based on the rev share percentage. - if err = k.distributeSupplierRewardsToShareHolders(ctx, ownerAddr.String(), service.Id, settlementCoin.Amount.Uint64()); err != nil { + if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, settlementCoin.Amount.Uint64()); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, @@ -547,20 +547,12 @@ func (k Keeper) numRelaysToCoin( // shareholders based on the rev share percentage of the supplier service config. func (k Keeper) distributeSupplierRewardsToShareHolders( ctx context.Context, - supplierOperatorAddr string, + supplier *sharedtypes.Supplier, serviceId string, amountToDistribute uint64, ) error { logger := k.Logger().With("method", "distributeSupplierRewardsToShareHolders") - supplier, supplierFound := k.supplierKeeper.GetSupplier(ctx, supplierOperatorAddr) - if !supplierFound { - return tokenomicstypes.ErrTokenomicsSupplierRevShareFailed.Wrapf( - "supplier with address %q not found", - supplierOperatorAddr, - ) - } - var serviceRevShare []*sharedtypes.ServiceRevenueShare for _, svc := range supplier.Services { if svc.Service.Id == serviceId { @@ -618,6 +610,7 @@ func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk // calculateAllocationAmount does big float arithmetic to determine the absolute // amount from amountFloat based on the allocation percentage provided. +// TODO_MAINNET() func calculateAllocationAmount( amountFloat *big.Float, allocationPercentage float64, diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 24d3052c8..7e21874e6 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -274,7 +274,7 @@ func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { } // EventApplicationOverserviced is emitted when an application has less stake than -// what a supplier is claiming (i.e. burn is not high enough). +// what a supplier is claiming (i.e. amount available for burning is insufficient). type EventApplicationOverserviced struct { ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` SupplierOperatorAddr string `protobuf:"bytes,2,opt,name=supplier_operator_addr,json=supplierOperatorAddr,proto3" json:"supplier_operator_addr,omitempty"` From b0266b0a184c6468757e669f3014d4a9632d09f3 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:30:02 -0400 Subject: [PATCH 19/48] Resolved a few simple comments --- x/session/keeper/session_hydrator.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go index 0433d06f2..f5ee590bb 100644 --- a/x/session/keeper/session_hydrator.go +++ b/x/session/keeper/session_hydrator.go @@ -20,10 +20,13 @@ import ( var SHA3HashLen = crypto.SHA3_256.Size() +// TODO_BETA(@bryanchriswhite): Make this a governance parameter const ( - // TODO_BETA(@bryanchriswhite): Make this a governance parameter - NumSupplierPerSession = 15 - SessionIDComponentDelimiter = "." + NumSupplierPerSession = 15 +) + +const ( + sessionIDComponentDelimiter = "." ) type sessionHydrator struct { @@ -305,7 +308,7 @@ func GetSessionId( sessionStartHeightBz := getSessionStartBlockHeightBz(sharedParams, blockHeight) sessionIdBz = concatWithDelimiter( - SessionIDComponentDelimiter, + sessionIDComponentDelimiter, blockHashBz, serviceIdBz, appAddrBz, From 754b52c8c16ecce16f48cc443c06ad90857f3b73 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:30:35 -0400 Subject: [PATCH 20/48] Apply suggestions from code review Co-authored-by: Redouane Lakrache --- proto/poktroll/tokenomics/event.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 5602d73c0..700051c32 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -55,6 +55,6 @@ message EventApplicationOverserviced { // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and // is a function of the relay mining algorithm. - // E.g. Te application's stake divided by the number of suppliers in a session. + // E.g. The application's stake divided by the number of suppliers in a session. cosmos.base.v1beta1.Coin effective_burn = 4; } \ No newline at end of file From e98ac7a74e0055e93b532ae616e12a9033c14496 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:36:17 -0400 Subject: [PATCH 21/48] Apply suggestions from code review Co-authored-by: Bryan White Co-authored-by: Redouane Lakrache --- x/tokenomics/keeper/token_logic_modules.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 6680893a0..3c854a12f 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -31,7 +31,7 @@ var ( ) const ( - // TODO_BETA(@bryanchriswhite): Make all of the governance params + // TODO_BETA(@bryanchriswhite): Make all of these governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 MintAllocationSupplier = 0.7 @@ -236,19 +236,19 @@ func (k Keeper) ProcessTokenLogicModules( } // Ensure the claim amount is within the limits set by Relay Mining. - // Update the settlement amount if not and emit any necessary events in doing so. + // If not, update the settlement amount and emit relevant events. actualSettlementCoin, err := k.ensureClaimAmountLimits(ctx, logger, &application, &supplier, claimSettlementCoin) if err != nil { return err } logger = logger.With("actual_settlement_upokt", actualSettlementCoin) - logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays equaling to (%s) upokt claimed", numRelays, actualSettlementCoin)) + logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) relays, equal to (%s) claimed", numRelays, actualSettlementCoin)) // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) - if err := tlmProcessor(k, ctx, &service, claim.SessionHeader, &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { - return err + if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { + return ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } @@ -258,7 +258,7 @@ func (k Keeper) ProcessTokenLogicModules( logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) // TODO_MAINNET: If the application stake has dropped to (near?) zero, should - // we unstake it? Should we use it's balance? Should their be a payee of last resort? + // we unstake it? Should we use it's balance? Should there be a payee of last resort? // Make sure to document whatever decision we come to. // State mutation: Update the suppliers's on-chain record @@ -361,7 +361,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Mint new uPOKT to the tokenomics module account if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { return tokenomicstypes.ErrTokenomicsModuleMintFailed.Wrapf( - "minting %s to the tokenomics module account: %v", newMintCoin, err) + "minting (%s) to the tokenomics module account: %v", newMintCoin, err) } logger.Info(fmt.Sprintf("minted (%v) coins in the tokenomics module", newMintCoin)) @@ -499,12 +499,12 @@ func (k Keeper) ensureClaimAmountLimits( if maxClaimableCoin.Amount.GTE(claimSettlementCoin.Amount) { logger.Info(fmt.Sprintf("Claim by supplier %s IS WITHIN LIMITS of servicing application %s. Max claimable amount >= Claim amount: %v >= %v", - supplier.OperatorAddress, application.Address, maxClaimableCoin, claimSettlementCoin.Amount)) + supplier.GetOperatorAddress(), application.GetAddress(), maxClaimableCoin, claimSettlementCoin.Amount)) return claimSettlementCoin, nil } logger.Warn(fmt.Sprintf("Claim by supplier %s EXCEEDS LIMITS for application %s. Max claimable amount < Claim amount: %v < %v", - supplier.OperatorAddress, application.Address, maxClaimableCoin, claimSettlementCoin.Amount)) + supplier.GetOperatorAddress(), application.GetAddress(), maxClaimableCoin, claimSettlementCoin.Amount)) // Reduce the settlement amount if the application was over-serviced actualSettlementCoins = maxClaimableCoin @@ -512,7 +512,7 @@ func (k Keeper) ensureClaimAmountLimits( // Prepare and emit the event for the application being overserviced applicationOverservicedEvent := &tokenomicstypes.EventApplicationOverserviced{ ApplicationAddr: application.Address, - SupplierOperatorAddr: supplier.OperatorAddress, + SupplierOperatorAddr: supplier.GetOperatorAddress(), ExpectedBurn: &claimSettlementCoin, EffectiveBurn: &maxClaimableCoin, } From 5065264d3f166aed68779b6a87f1b9242b7720e1 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:38:06 -0400 Subject: [PATCH 22/48] Apply suggestions from code review Co-authored-by: Bryan White Co-authored-by: Redouane Lakrache --- x/tokenomics/keeper/token_logic_modules.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 3c854a12f..c651da623 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -38,9 +38,9 @@ const ( MintAllocationSourceOwner = 0.15 MintAllocationApplication = 0.0 - // The percent difference that is allowable between the number of minted - // tokens in the tokenomics module and what is distributed to pocket network - // participants. + // MintDistributionAllowableTolerance is the percent difference that is allowable + // between the number of minted/ tokens in the tokenomics module and what is distributed + // to pocket network participants. // This internal constant SHOULD ONLY be used in TokenLogicModuleGlobalMint. // Due to floating point arithmetic, the total amount of minted coins may be slightly // larger than what is distributed to pocket network participants @@ -58,7 +58,7 @@ const ( TLMRelayBurnEqualsMint TokenLogicModule = iota // TLMGlobalMint is the token logic module that mints new tokens based on the - // on global governance parameters in order to reward the participants providing + // global governance parameters in order to reward the participants providing // services while keeping inflation in check. TLMGlobalMint ) @@ -78,10 +78,11 @@ func (tlm TokenLogicModule) EnumIndex() int { // TokenLogicModuleProcessor is the method signature that all token logic modules // are expected to implement. -// IMPORTANT_SIDE_EFFECTS: Please note that TLMs may update the application and supplier -// objects, which is why they are passed in as pointers. NOTE THAT THIS IS NOT PERSISTED. -// The persistence to the keeper is currently done by the TLM processor: ProcessTokenLogicModules. -// This design and separation of concerns may change in the future. +// IMPORTANT_SIDE_EFFECTS: Please note that TLMs may update the application and supplier objects, +// which is why they are passed in as pointers. NOTE: TLMs SHOULD NOT persist any state changes. +// Persistence of updated application and supplier to the keeper is currently done by the TLM +// processor in `ProcessTokenLogicModules()`. This design and separation of concerns may change +// in the future. type TokenLogicModuleProcessor func( Keeper, context.Context, From 7f098f4b1e7a934e3c664b8e2b1401bf39f6d06a Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:49:05 -0400 Subject: [PATCH 23/48] Apply suggestions from code review Co-authored-by: Bryan White Co-authored-by: Redouane Lakrache --- x/tokenomics/keeper/token_logic_modules.go | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index c651da623..180f2330a 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -107,10 +107,9 @@ func init() { } } -// ProcessTokenLogicModules is the main TLM processor. It is responsible for running -// all of the independent TLMs necessary to limit, burn, mint or transfer tokens -// as a result of the amount of work (i.e. relays, compute units) done in proportion -// to the global governance parameters. +// ProcessTokenLogicModules is the entrypoint for all TLM processing. It is responsible for running +// all the independent TLMs necessary to limit, burn, mint or transfer tokens as a result of the +// amount of work (i.e. relays, compute units) done in proportion to the global governance parameters. // IMPORTANT: It is assumed the proof for the claim has been validated BEFORE calling this function. func (k Keeper) ProcessTokenLogicModules( ctx context.Context, @@ -118,7 +117,7 @@ func (k Keeper) ProcessTokenLogicModules( ) (err error) { logger := k.Logger().With("method", "ProcessTokenLogicModules") - // Telemetry variable declaration to be emitted a the end of the function + // Telemetry variable declaration to be emitted at the end of the function claimSettlementCoin := cosmostypes.NewCoin("upokt", math.NewInt(0)) isSuccessful := false @@ -173,17 +172,17 @@ func (k Keeper) ProcessTokenLogicModules( TODO_POST_MAINNET: Because of how things have evolved, we are now using root.Count (numRelays) instead of root.Sum (numComputeUnits) to determine the amount of work done. This is because the compute_units_per_relay is - a service specific (not request specific) parameter that will be maintained + a service specific (not request specific) parameter that will be maintained by the service owner to capture the average amount of resources (i.e. compute, storage, bandwidth, electricity, etc...) per request. Modifying this on a per request basis has been deemed too complex and not a mainnet blocker. */ - // Retrieve the application address that is being charged; getting services and paying tokens + // Retrieve the application address that is being charged; getting services and paying tokens. applicationAddress, err := cosmostypes.AccAddressFromBech32(sessionHeader.GetApplicationAddress()) if err != nil || applicationAddress == nil { - return tokenomicstypes.ErrTokenomicsApplicationAddressInvalid + return tokenomicstypes.ErrTokenomicsApplicationAddressInvalid.Wrapf("address (%q)", sessionHeader.GetApplicationAddress()) } // Retrieve the on-chain staked application record @@ -196,7 +195,7 @@ func (k Keeper) ProcessTokenLogicModules( // Retrieve the supplier operator address that will be getting rewarded; providing services and earning tokens supplierOperatorAddr, err := cosmostypes.AccAddressFromBech32(claim.GetSupplierOperatorAddress()) if err != nil || supplierOperatorAddr == nil { - return tokenomicstypes.ErrTokenomicsSupplierOperatorAddressInvalid + return tokenomicstypes.ErrTokenomicsSupplierOperatorAddressInvalid.Wrapf("address (%q)", claim.GetSupplierOperatorAddress()) } // Retrieve the on-chain staked supplier record @@ -284,7 +283,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( logger := k.Logger().With("method", "TokenLogicModuleRelayBurnEqualsMint") // DEV_NOTE: We are doing a mint & burn + transfer, instead of a simple transfer - // of funds from the supplier to the application in order to enable second + // of funds from the application stake to the supplier balance in order to enable second // order economic effects with more optionality. This could include funds // going to pnf, delegators, enabling bonuses/rebates, etc... @@ -364,10 +363,10 @@ func (k Keeper) TokenLogicModuleGlobalMint( return tokenomicstypes.ErrTokenomicsModuleMintFailed.Wrapf( "minting (%s) to the tokenomics module account: %v", newMintCoin, err) } - logger.Info(fmt.Sprintf("minted (%v) coins in the tokenomics module", newMintCoin)) + logger.Info(fmt.Sprintf("minted (%s) to the tokenomics module account", newMintCoin)) // Send a portion of the rewards to the application - appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.Address, &newMintAmtFloat, MintAllocationApplication) + appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.GetAddress(), &newMintAmtFloat, MintAllocationApplication) if err != nil { return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to application: %v", err) } @@ -379,7 +378,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( // Send funds from the tokenomics module to the supplier module account if err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, tokenomicstypes.ModuleName, suppliertypes.ModuleName, sdk.NewCoins(supplierCoin)); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleSendFailed.Wrapf( - "sending %s from the tokenomics module to the supplier module account: %v", + "transferring (%s) from the tokenomics module account to the supplier module account: %v", supplierCoin, err, ) From f63a8dd67aaa866fea356134e5307df032c1fcd8 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:49:12 -0400 Subject: [PATCH 24/48] Tending to a partial set of comments --- proto/poktroll/tokenomics/event.proto | 1 + x/tokenomics/keeper/token_logic_modules.go | 58 ++++++++++++++++------ 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 700051c32..41b6b13ce 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -45,6 +45,7 @@ message EventRelayMiningDifficultyUpdated { // EventApplicationOverserviced is emitted when an application has less stake than // what a supplier is claiming (i.e. amount available for burning is insufficient). +// This means the following will ALWAYS be strictly true: effective_burn < expected_burn. message EventApplicationOverserviced { string application_addr = 1; string supplier_operator_addr = 2; diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 180f2330a..b55a0a05d 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -83,6 +83,8 @@ func (tlm TokenLogicModule) EnumIndex() int { // Persistence of updated application and supplier to the keeper is currently done by the TLM // processor in `ProcessTokenLogicModules()`. This design and separation of concerns may change // in the future. +// DEV_NOTE: As of writing this, this is only in anticipation of potentially unstaking +// actors if their stake falls below a certain threshold. type TokenLogicModuleProcessor func( Keeper, context.Context, @@ -105,6 +107,9 @@ func init() { if 1.0 != MintAllocationDAO+MintAllocationProposer+MintAllocationSupplier+MintAllocationSourceOwner+MintAllocationApplication { panic("mint allocation percentages do not add to 1.0") } + + // TODO_UPNEXT(@Olshansk): Ensure that if `TLMGlobalMint` is present in the map, + // then TLMGlobalMintReimbursementRequest will need to be there too. } // ProcessTokenLogicModules is the entrypoint for all TLM processing. It is responsible for running @@ -211,7 +216,7 @@ func (k Keeper) ProcessTokenLogicModules( return tokenomicstypes.ErrTokenomicsServiceNotFound.Wrapf("service with ID %q not found", sessionHeader.Service.Id) } - // Determine the total number of tokens being claimed (i.e. requested) + // Determine the total number of tokens being claimed (i.e. for the work completed) // by the supplier for the amount of work they did to service the application // in the session. claimSettlementCoin, err = k.numRelaysToCoin(ctx, numRelays, &service) @@ -384,7 +389,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( ) } // Distribute the rewards from within the supplier's module account. - if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier.OperatorAddress, service.Id, uint64(supplierCoinsToShareAmt)); err != nil { + if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, uint64(supplierCoinsToShareAmt)); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, @@ -417,24 +422,47 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the proposer with address %q", proposerCoin, proposerAddr)) // Check and log the total amount of coins distributed - totalMintDistributedCoin := appCoin.Add(supplierCoin).Add(*daoCoin).Add(*serviceCoin).Add(*proposerCoin) + if k.ensureMintedCoinsAreDistributed(logger, appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin, newMintCoin); err != nil { + return err + } + + return nil +} + +func (k Keeper) ensureMintedCoinsAreDistributed( + logger log.Logger, + appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin, newMintCoin cosmostypes.Coin, +) error { + // Compute the difference between the total distributed coins and the amount of newly minted coins + totalMintDistributedCoin := appCoin.Add(supplierCoin).Add(daoCoin).Add(serviceCoin).Add(proposerCoin) coinDifference := new(big.Int).Sub(totalMintDistributedCoin.Amount.BigInt(), newMintCoin.Amount.BigInt()) coinDifference = coinDifference.Abs(coinDifference) percentDifference := new(big.Float).Quo(new(big.Float).SetInt(coinDifference), new(big.Float).SetInt(newMintCoin.Amount.BigInt())) - if percentDifference.Cmp(big.NewFloat(MintDistributionAllowableTolerance)) > 0 { + + // Helper booleans for readability + isPercentDifferentTooLarge := percentDifference.Cmp(big.NewFloat(MintDistributionAllowableTolerance)) > 0 + doesDiscrepancyExist := coinDifference.Cmp(big.NewInt(0)) > 0 + + // No discrepancy, return early + logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalMintDistributedCoin)) + if !doesDiscrepancyExist { + return nil + } + + // Discrepancy exists and is too large, log and return an error + if isPercentDifferentTooLarge { return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", totalMintDistributedCoin, newMintCoin, percentDifference, appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin) - } else if coinDifference.Cmp(big.NewInt(0)) > 0 { - logger.Warn(fmt.Sprintf("Floating point arithmetic led to a discrepancy of %v (%f) between the total distributed coins (%v) and the amount of new minted coins (%v).\n"+ - "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", - coinDifference, percentDifference, totalMintDistributedCoin, newMintCoin, - appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin)) } - logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalMintDistributedCoin)) + // Discrepancy exists but is within tolerance, log and return nil + logger.Warn(fmt.Sprintf("Floating point arithmetic led to a discrepancy of %v (%f) between the total distributed coins (%v) and the amount of new minted coins (%v).\n"+ + "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", + coinDifference, percentDifference, totalMintDistributedCoin, newMintCoin, + appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin)) return nil } @@ -446,12 +474,12 @@ func (k Keeper) sendRewardsToAccount( destAdr string, settlementAmtFloat *big.Float, allocation float64, -) (*sdk.Coin, error) { +) (sdk.Coin, error) { logger := k.Logger().With("method", "mintRewardsToAccount") accountAddr, err := cosmostypes.AccAddressFromBech32(destAdr) if err != nil { - return nil, err + return sdk.Coin{}, err } coinsToAccAmt := calculateAllocationAmount(settlementAmtFloat, allocation) @@ -459,11 +487,11 @@ func (k Keeper) sendRewardsToAccount( if err := k.bankKeeper.SendCoinsFromModuleToAccount( ctx, srcModule, accountAddr, sdk.NewCoins(coinToAcc), ); err != nil { - return nil, err + return sdk.Coin{}, err } logger.Info(fmt.Sprintf("sent (%v) coins from the tokenomics module to the account with address %q", coinToAcc, destAdr)) - return &coinToAcc, nil + return coinToAcc, nil } // ensureClaimAmountLimits checks if the application was overserviced and handles @@ -610,7 +638,7 @@ func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk // calculateAllocationAmount does big float arithmetic to determine the absolute // amount from amountFloat based on the allocation percentage provided. -// TODO_MAINNET() +// TODO_MAINNET(@bryanchriswhite): Measure and limit the precision loss here. func calculateAllocationAmount( amountFloat *big.Float, allocationPercentage float64, From da081e9bcafea07bbd0f23cca526e2c9298639d6 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:56:27 -0400 Subject: [PATCH 25/48] Update testutil/testrelayer/relays.go Co-authored-by: Bryan White --- testutil/testrelayer/relays.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go index 83bc75ab4..f3d3f4458 100644 --- a/testutil/testrelayer/relays.go +++ b/testutil/testrelayer/relays.go @@ -243,10 +243,10 @@ const ( ) func randomPayload() []byte { - rand.Seed(uint64(time.Now().UnixNano())) + r := rand.New(rand.NewSource(time.Now().UnixNano())) bz := make([]byte, payloadLength) for i := range bz { - bz[i] = charset[rand.Intn(len(charset))] + bz[i] = charset[r.Intn(len(charset))] } return bz } From b32397d36ea529827a6274446ad4adb834950b11 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 19:56:36 -0400 Subject: [PATCH 26/48] Update tests/integration/tokenomics/relay_mining_difficulty_test.go Co-authored-by: Redouane Lakrache --- tests/integration/tokenomics/relay_mining_difficulty_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/tokenomics/relay_mining_difficulty_test.go b/tests/integration/tokenomics/relay_mining_difficulty_test.go index 498486320..75439892e 100644 --- a/tests/integration/tokenomics/relay_mining_difficulty_test.go +++ b/tests/integration/tokenomics/relay_mining_difficulty_test.go @@ -165,7 +165,7 @@ func getSession(t *testing.T, integrationApp *testutil.App) *sessiontypes.Sessio return getSessionRes.Session } -// prepareSMST prepares an SMST with a the number of mined relays specified. +// prepareSMST prepares an SMST with the given number of mined relays. func prepareSMST( t *testing.T, ctx context.Context, integrationApp *testutil.App, From 02fd89ce88f219e15a6e28a6014685702009a3ee Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 28 Aug 2024 20:21:38 -0400 Subject: [PATCH 27/48] Final set of comments --- api/poktroll/tokenomics/event.pulsar.go | 3 ++- pkg/crypto/rings/cache_test.go | 2 +- .../relay_mining_difficulty_test.go | 8 ++++---- testutil/sample/sample.go | 17 ++++++++++++++-- testutil/testrelayer/relays.go | 2 +- x/tokenomics/keeper/token_logic_modules.go | 20 ++++++++----------- x/tokenomics/types/errors.go | 1 + x/tokenomics/types/event.pb.go | 3 ++- 8 files changed, 34 insertions(+), 22 deletions(-) diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index 843b8a75a..9d9587ac1 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -2716,6 +2716,7 @@ func (x *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { // EventApplicationOverserviced is emitted when an application has less stake than // what a supplier is claiming (i.e. amount available for burning is insufficient). +// This means the following will ALWAYS be strictly true: effective_burn < expected_burn. type EventApplicationOverserviced struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2730,7 +2731,7 @@ type EventApplicationOverserviced struct { // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and // is a function of the relay mining algorithm. - // E.g. Te application's stake divided by the number of suppliers in a session. + // E.g. The application's stake divided by the number of suppliers in a session. EffectiveBurn *v1beta1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go index 0bc445b24..f48d8644a 100644 --- a/pkg/crypto/rings/cache_test.go +++ b/pkg/crypto/rings/cache_test.go @@ -38,7 +38,7 @@ func newAccount(curve string) account { var pubkey cryptotypes.PubKey switch curve { case "ed25519": - addr, pubkey = sample.AccAddressAndPubKeyEdd2519() + addr, pubkey = sample.AccAddressAndPubKeyEd2519() case "secp256k1": addr, pubkey = sample.AccAddressAndPubKey() } diff --git a/tests/integration/tokenomics/relay_mining_difficulty_test.go b/tests/integration/tokenomics/relay_mining_difficulty_test.go index 75439892e..17ca9f174 100644 --- a/tests/integration/tokenomics/relay_mining_difficulty_test.go +++ b/tests/integration/tokenomics/relay_mining_difficulty_test.go @@ -40,8 +40,8 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) sharedParams := getSharedParams(t, integrationApp) // Prepare the trie with several mined relays - numRelays := uint64(100) - trie := prepareSMST(t, sdkCtx, integrationApp, session, numRelays) + expectedNumRelays := uint64(100) + trie := prepareSMST(t, sdkCtx, integrationApp, session, expectedNumRelays) // Compute the number of blocks to wait between different events // TODO_BLOCKER(@bryanchriswhite): See this comment: https://github.com/pokt-network/poktroll/pull/610#discussion_r1645777322 @@ -119,8 +119,8 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) require.Equal(t, prooftypes.DefaultRelayDifficultyTargetHashHex, relayMiningEvent.NewTargetHashHexEncoded) // The previous EMA is the same as the current one if the service is new - require.Equal(t, numRelays, relayMiningEvent.PrevNumRelaysEma) - require.Equal(t, numRelays, relayMiningEvent.NewNumRelaysEma) + require.Equal(t, expectedNumRelays, relayMiningEvent.PrevNumRelaysEma) + require.Equal(t, expectedNumRelays, relayMiningEvent.NewNumRelaysEma) } func UpdateRelayMiningDifficulty_UpdatingMultipleServicesAtOnce(t *testing.T) {} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index c9b91d874..51a0165dc 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -23,8 +23,8 @@ func AccAddress() string { return addr } -// AccAddressAndPubKeyEdd2519 returns a sample account address and public key -func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { +// AccAddressAndPubKeyEd2519 returns a sample account address and public key +func AccAddressAndPubKeyEd2519() (string, cryptotypes.PubKey) { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() return sdk.AccAddress(addr).String(), pk @@ -39,6 +39,19 @@ func ConsAddress() string { return valAddress.String() } +// AccAddressFromConsAddress returns an account address (with the Bech32PrefixForAccount prefix) +// from a given consensus address (with the Bech32PrefixForValidator prefix). +// +// Reference: see initSDKConfig in `cmd/poktrolld/cmd`. +// +// Use case: in the native cosmos SDK mint module, we set inflation_rate_change to 0 +// because Pocket Network has a custom inflation mechanism. Data availability and +// block validation is a small part of the network's utility, so the majority of +// inflation comes from the relays serviced. Therefore, the validator's (block producer's) +// rewards are proportional to that as well. For this reason, we need a helper function +// to identify the proposer address from the validator consensus address. +// +// TODO_MAINNET: Add E2E tests to validate this works as expected. func AccAddressFromConsAddress(validatorConsAddr string) string { valAddr, _ := sdk.ValAddressFromBech32(validatorConsAddr) proposerAddress, _ := sdk.AccAddressFromHexUnsafe(hex.EncodeToString(valAddr.Bytes())) diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go index f3d3f4458..01223f7a5 100644 --- a/testutil/testrelayer/relays.go +++ b/testutil/testrelayer/relays.go @@ -3,6 +3,7 @@ package testrelayer import ( "context" "fmt" + "math/rand" "strings" "testing" "time" @@ -11,7 +12,6 @@ import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/stretchr/testify/require" - "golang.org/x/exp/rand" "github.com/pokt-network/poktroll/pkg/crypto" "github.com/pokt-network/poktroll/pkg/crypto/protocol" diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index b55a0a05d..17b1f8040 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -253,7 +253,7 @@ func (k Keeper) ProcessTokenLogicModules( for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { - return ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm err) + return tokenomictypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } @@ -292,14 +292,10 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( // order economic effects with more optionality. This could include funds // going to pnf, delegators, enabling bonuses/rebates, etc... - ownerAddr, err := cosmostypes.AccAddressFromBech32(supplier.OwnerAddress) - if err != nil { - return err - } - // Mint new uPOKT to the supplier module account. - // These funds will be transferred to the supplier below. - if err = k.bankKeeper.MintCoins( + // These funds will be transferred to the supplier's shareholders below. + // For reference, see operate/configs/supplier_staking_config.md. + if err := k.bankKeeper.MintCoins( ctx, suppliertypes.ModuleName, sdk.NewCoins(settlementCoin), ); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleSendFailed.Wrapf( @@ -311,7 +307,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( logger.Info(fmt.Sprintf("minted (%v) coins in the supplier module", settlementCoin)) // Distribute the rewards to the supplier's shareholders based on the rev share percentage. - if err = k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, settlementCoin.Amount.Uint64()); err != nil { + if err := k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, settlementCoin.Amount.Uint64()); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, @@ -322,7 +318,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( // Burn uPOKT from the application module account which was held in escrow // on behalf of the application account. - if err = k.bankKeeper.BurnCoins( + if err := k.bankKeeper.BurnCoins( ctx, apptypes.ModuleName, sdk.NewCoins(settlementCoin), ); err != nil { return tokenomicstypes.ErrTokenomicsApplicationModuleBurn.Wrapf("burning %s from the application module account: %v", settlementCoin, err) @@ -615,10 +611,10 @@ func (k Keeper) distributeSupplierRewardsToShareHolders( return err } - logger.Info(fmt.Sprintf("sent %s from the supplier module to the supplier shareholder with address %q", shareAmountCoin, supplierOperatorAddr)) + logger.Info(fmt.Sprintf("sent %s from the supplier module to the supplier shareholder with address %q", shareAmountCoin, supplier.GetOperatorAddress())) } - logger.Info(fmt.Sprintf("distributed %d uPOKT to supplier %q shareholders", amountToDistribute, supplierOperatorAddr)) + logger.Info(fmt.Sprintf("distributed %d uPOKT to supplier %q shareholders", amountToDistribute, supplier.GetOperatorAddress())) return nil } diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index f5f1c7e1a..043aa95f0 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -35,4 +35,5 @@ var ( ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") ErrTokenomicsAmountMismatchTooLarge = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") ErrTokenomicsMintAmountZero = sdkerrors.Register(ModuleName, 1128, "mint amount cannot be zero") + ErrTokenomicsTLMError = sdkerrors.Register(ModuleName, 1129, "failed to process TLM") ) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 7e21874e6..eef16187b 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -275,6 +275,7 @@ func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { // EventApplicationOverserviced is emitted when an application has less stake than // what a supplier is claiming (i.e. amount available for burning is insufficient). +// This means the following will ALWAYS be strictly true: effective_burn < expected_burn. type EventApplicationOverserviced struct { ApplicationAddr string `protobuf:"bytes,1,opt,name=application_addr,json=applicationAddr,proto3" json:"application_addr,omitempty"` SupplierOperatorAddr string `protobuf:"bytes,2,opt,name=supplier_operator_addr,json=supplierOperatorAddr,proto3" json:"supplier_operator_addr,omitempty"` @@ -285,7 +286,7 @@ type EventApplicationOverserviced struct { // Effective burn is the amount that is actually being paid to the supplier // for the work done. It is less than the expected burn (claim amount) and // is a function of the relay mining algorithm. - // E.g. Te application's stake divided by the number of suppliers in a session. + // E.g. The application's stake divided by the number of suppliers in a session. EffectiveBurn *types1.Coin `protobuf:"bytes,4,opt,name=effective_burn,json=effectiveBurn,proto3" json:"effective_burn,omitempty"` } From 73ea7e28d625a572aac16ff99cf7fec48572edae Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Tue, 3 Sep 2024 19:20:18 -0400 Subject: [PATCH 28/48] Reply to a few small review comments --- pkg/relayer/session/sessiontree.go | 3 ++- x/tokenomics/keeper/token_logic_modules.go | 2 +- x/tokenomics/keeper/token_logic_modules_test.go | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 2fd0002e9..73c0c86f8 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -19,11 +19,12 @@ import ( var _ relayer.SessionTree = (*sessionTree)(nil) // sessionTree is an implementation of the SessionTree interface. -// TODO_IN_THIS_PR_DISCUSS: Per the Relay Mining paper, we need to optimistically store +// TODO_BETA(@red-0ne): Per the Relay Mining paper, we need to optimistically store // the number of requests that an application can pay for. This needs to be tracked // based on the app's stake in the beginning of a session and the number of nodes // per session. An operator should be able to specify "overservicing_okay" whereby // it keeps replying to requests even though it may not get paid for them. +// Ref discussion: https://github.com/pokt-network/poktroll/pull/755#discussion_r1737287860 type sessionTree struct { // sessionMu is a mutex used to protect sessionTree operations from concurrent access. sessionMu *sync.Mutex diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 17b1f8040..93fcf2c18 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -418,7 +418,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the proposer with address %q", proposerCoin, proposerAddr)) // Check and log the total amount of coins distributed - if k.ensureMintedCoinsAreDistributed(logger, appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin, newMintCoin); err != nil { + if err := k.ensureMintedCoinsAreDistributed(logger, appCoin, supplierCoin, daoCoin, serviceCoin, proposerCoin, newMintCoin); err != nil { return err } diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index d8ac3ef5e..6d2bf122e 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -362,13 +362,12 @@ func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t claim := prepareTestClaim(numRelays, service, &app, &supplier) // Prepare addresses - daoAddr := authtypes.NewModuleAddress(govtypes.ModuleName) + daoAddress := authtypes.NewModuleAddress(govtypes.ModuleName) appAddress := app.Address proposerAddress := sample.AccAddressFromConsAddress(validatorConsAddr) - // supplierOperatorAddr := supplier.OperatorAddress // Determine balances before inflation - daoBalanceBefore := getBalance(t, ctx, keepers, daoAddr.String()) + daoBalanceBefore := getBalance(t, ctx, keepers, daoAddress.String()) propBalanceBefore := getBalance(t, ctx, keepers, proposerAddress) serviceOwnerBalanceBefore := getBalance(t, ctx, keepers, service.OwnerAddress) appBalanceBefore := getBalance(t, ctx, keepers, appAddress) @@ -383,7 +382,7 @@ func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t require.NoError(t, err) // Determine balances after inflation - daoBalanceAfter := getBalance(t, ctx, keepers, daoAddr.String()) + daoBalanceAfter := getBalance(t, ctx, keepers, daoAddress.String()) propBalanceAfter := getBalance(t, ctx, keepers, proposerAddress) serviceOwnerBalanceAfter := getBalance(t, ctx, keepers, service.OwnerAddress) appBalanceAfter := getBalance(t, ctx, keepers, appAddress) @@ -401,7 +400,7 @@ func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t appMint := math.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationApplication)) supplierMint := float32(numTokensMinted * tokenomicskeeper.MintAllocationSupplier) - // Ensure the balance was increase be the appropriate amount + // Ensure the balance was increased be the appropriate amount require.Equal(t, daoBalanceBefore.Amount.Add(daoMint), daoBalanceAfter.Amount) require.Equal(t, propBalanceBefore.Amount.Add(propMint), propBalanceAfter.Amount) require.Equal(t, serviceOwnerBalanceBefore.Amount.Add(serviceOwnerMint), serviceOwnerBalanceAfter.Amount) From b0578be3f6fa723ab8b960c5ac2760bb00507fe6 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Tue, 3 Sep 2024 19:20:47 -0400 Subject: [PATCH 29/48] Empty commit From 5d25b3e08febf9d35dac3917818f5f5f7e04051f Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:24:38 -0400 Subject: [PATCH 30/48] Update x/tokenomics/keeper/token_logic_modules.go Co-authored-by: Bryan White --- x/tokenomics/keeper/token_logic_modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 93fcf2c18..7919e0022 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -53,7 +53,7 @@ type TokenLogicModule int const ( // TLMRelayBurnEqualsMint is the token logic module that burns the application's // stake based on the amount of work done by the supplier. - // The same amount of tokens is minted and sent to the supplier. + // The same amount of tokens is minted and added to the supplier account balance. // When the network achieves equilibrium, this is theoretically the only TLM that will be necessary. TLMRelayBurnEqualsMint TokenLogicModule = iota From 7e078524c1d1539656717ea5160d287bd434462e Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:24:59 -0400 Subject: [PATCH 31/48] Update pkg/crypto/rings/cache_test.go Co-authored-by: Bryan White --- pkg/crypto/rings/cache_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go index f48d8644a..891406b97 100644 --- a/pkg/crypto/rings/cache_test.go +++ b/pkg/crypto/rings/cache_test.go @@ -38,7 +38,7 @@ func newAccount(curve string) account { var pubkey cryptotypes.PubKey switch curve { case "ed25519": - addr, pubkey = sample.AccAddressAndPubKeyEd2519() + addr, pubkey = sample.AccAddressAndPubKeyEd25519() case "secp256k1": addr, pubkey = sample.AccAddressAndPubKey() } From 05d78a6935e2f22caf44cd8ac0ab816c9923e2e8 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:25:15 -0400 Subject: [PATCH 32/48] Update testutil/sample/sample.go Co-authored-by: Bryan White --- testutil/sample/sample.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 51a0165dc..fe3561040 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -23,8 +23,8 @@ func AccAddress() string { return addr } -// AccAddressAndPubKeyEd2519 returns a sample account address and public key -func AccAddressAndPubKeyEd2519() (string, cryptotypes.PubKey) { +// AccAddressAndPubKeyEd25519 returns a sample account address and public key +func AccAddressAndPubKeyEd25519() (string, cryptotypes.PubKey) { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() return sdk.AccAddress(addr).String(), pk From 939d9139df2e2d32a13178c24d1f1ad584736a67 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:25:56 -0400 Subject: [PATCH 33/48] Update x/tokenomics/keeper/token_logic_modules.go Co-authored-by: Bryan White --- x/tokenomics/keeper/token_logic_modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 7919e0022..68e55f2f3 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -52,7 +52,7 @@ type TokenLogicModule int const ( // TLMRelayBurnEqualsMint is the token logic module that burns the application's - // stake based on the amount of work done by the supplier. + // stake balance based on the amount of work done by the supplier. // The same amount of tokens is minted and added to the supplier account balance. // When the network achieves equilibrium, this is theoretically the only TLM that will be necessary. TLMRelayBurnEqualsMint TokenLogicModule = iota From d0a89d825ee71c77b3eb45e1307c70ba8e476c93 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:31:04 -0400 Subject: [PATCH 34/48] Update x/tokenomics/keeper/token_logic_modules.go Co-authored-by: Bryan White --- x/tokenomics/keeper/token_logic_modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 68e55f2f3..233008099 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -445,7 +445,7 @@ func (k Keeper) ensureMintedCoinsAreDistributed( return nil } - // Discrepancy exists and is too large, log and return an error + // Discrepancy exists and is too large, return an error if isPercentDifferentTooLarge { return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ From 461d4afd5f27188de9c8219b4d3929b1bb6577bf Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:33:03 -0400 Subject: [PATCH 35/48] Update x/tokenomics/keeper/token_logic_modules.go Co-authored-by: Bryan White --- x/tokenomics/keeper/token_logic_modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 233008099..cecf7c17a 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -115,7 +115,7 @@ func init() { // ProcessTokenLogicModules is the entrypoint for all TLM processing. It is responsible for running // all the independent TLMs necessary to limit, burn, mint or transfer tokens as a result of the // amount of work (i.e. relays, compute units) done in proportion to the global governance parameters. -// IMPORTANT: It is assumed the proof for the claim has been validated BEFORE calling this function. +// IMPORTANT: It is assumed that the proof for the claim has been validated BEFORE calling this function. func (k Keeper) ProcessTokenLogicModules( ctx context.Context, claim *prooftypes.Claim, From a4d63752db87f32c640f4cf4cabd4e830d09cd30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:09:53 -0700 Subject: [PATCH 36/48] build(deps): bump webpack from 5.89.0 to 5.94.0 in /docusaurus (#775) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [webpack](https://github.com/webpack/webpack) from 5.89.0 to 5.94.0.
Release notes

Sourced from webpack's releases.

v5.94.0

Bug Fixes

  • Added runtime condition for harmony reexport checked
  • Handle properly data/http/https protocols in source maps
  • Make bigint optimistic when browserslist not found
  • Move @​types/eslint-scope to dev deps
  • Related in asset stats is now always an array when no related found
  • Handle ASI for export declarations
  • Mangle destruction incorrect with export named default properly
  • Fixed unexpected asi generation with sequence expression
  • Fixed a lot of types

New Features

  • Added new external type "module-import"
  • Support webpackIgnore for new URL() construction
  • [CSS] @import pathinfo support

Security

  • Fixed DOM clobbering in auto public path

v5.93.0

Bug Fixes

  • Generate correct relative path to runtime chunks
  • Makes DefinePlugin quieter under default log level
  • Fixed mangle destructuring default in namespace import
  • Fixed consumption of eager shared modules for module federation
  • Strip slash for pretty regexp
  • Calculate correct contenthash for CSS generator options

New Features

  • Added the binary generator option for asset modules to explicitly keep source maps produced by loaders
  • Added the modern-module library value for tree shakable output
  • Added the overrideStrict option to override strict or non-strict mode for javascript modules

v5.92.1

Bug Fixes

  • Doesn't crash with an error when the css experiment is enabled and contenthash is used

v5.92.0

Bug Fixes

  • Correct tidle range's comutation for module federation
  • Consider runtime for pure expression dependency update hash
  • Return value in the subtractRuntime function for runtime logic

... (truncated)

Commits
  • eabf85d chore(release): 5.94.0
  • 955e057 security: fix DOM clobbering in auto public path
  • 9822387 test: fix
  • cbb86ed test: fix
  • 5ac3d7f fix: unexpected asi generation with sequence expression
  • 2411661 security: fix DOM clobbering in auto public path
  • b8c03d4 fix: unexpected asi generation with sequence expression
  • f46a03c revert: do not use heuristic fallback for "module-import"
  • 60f1898 fix: do not use heuristic fallback for "module-import"
  • 66306aa Revert "fix: module-import get fallback from externalsPresets"
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=webpack&package-manager=npm_and_yarn&previous-version=5.89.0&new-version=5.94.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/pokt-network/poktroll/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docusaurus/package-lock.json | 198 ++++----- docusaurus/yarn.lock | 764 +++++++++++++++++++---------------- 2 files changed, 490 insertions(+), 472 deletions(-) diff --git a/docusaurus/package-lock.json b/docusaurus/package-lock.json index 2c3c5de69..c2c19f368 100644 --- a/docusaurus/package-lock.json +++ b/docusaurus/package-lock.json @@ -3920,26 +3920,6 @@ "@types/ms": "*" } }, - "node_modules/@types/eslint": { - "version": "8.44.8", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.8.tgz", - "integrity": "sha512-4K8GavROwhrYl2QXDXm0Rv9epkA8GBFu0EI+XrrnnuCl7u8CWBRusX7fXJfanhZTDWSAL24gDI/UqXyUM0Injw==", - "license": "MIT", - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "license": "MIT", - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -4265,10 +4245,9 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" }, "node_modules/@webassemblyjs/ast": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", - "integrity": "sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", + "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", "@webassemblyjs/helper-wasm-bytecode": "1.11.6" @@ -4277,26 +4256,22 @@ "node_modules/@webassemblyjs/floating-point-hex-parser": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", - "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", - "license": "MIT" + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", - "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", - "license": "MIT" + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==" }, "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz", - "integrity": "sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==", - "license": "MIT" + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", + "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", - "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", "@webassemblyjs/helper-api-error": "1.11.6", @@ -4306,26 +4281,23 @@ "node_modules/@webassemblyjs/helper-wasm-bytecode": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", - "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", - "license": "MIT" + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==" }, "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz", - "integrity": "sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", + "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6" + "@webassemblyjs/wasm-gen": "1.12.1" } }, "node_modules/@webassemblyjs/ieee754": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", - "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -4334,7 +4306,6 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", - "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" } @@ -4342,32 +4313,29 @@ "node_modules/@webassemblyjs/utf8": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", - "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", - "license": "MIT" + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==" }, "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz", - "integrity": "sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", + "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-opt": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6", - "@webassemblyjs/wast-printer": "1.11.6" + "@webassemblyjs/helper-wasm-section": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-opt": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1", + "@webassemblyjs/wast-printer": "1.12.1" } }, "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz", - "integrity": "sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", + "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", "@webassemblyjs/ieee754": "1.11.6", "@webassemblyjs/leb128": "1.11.6", @@ -4375,24 +4343,22 @@ } }, "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz", - "integrity": "sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", + "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6" + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1" } }, "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz", - "integrity": "sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", + "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-api-error": "1.11.6", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", "@webassemblyjs/ieee754": "1.11.6", @@ -4401,26 +4367,23 @@ } }, "node_modules/@webassemblyjs/wast-printer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz", - "integrity": "sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==", - "license": "MIT", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", + "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", "dependencies": { - "@webassemblyjs/ast": "1.11.6", + "@webassemblyjs/ast": "1.12.1", "@xtuc/long": "4.2.2" } }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "license": "BSD-3-Clause" + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "license": "Apache-2.0" + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, "node_modules/accepts": { "version": "1.3.8", @@ -4468,11 +4431,10 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-import-assertions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", - "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "license": "MIT", + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", "peerDependencies": { "acorn": "^8" } @@ -7077,10 +7039,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", - "license": "MIT", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -8067,8 +8028,7 @@ "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "license": "BSD-2-Clause" + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" }, "node_modules/global-dirs": { "version": "3.0.1", @@ -15778,16 +15738,15 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.9", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz", - "integrity": "sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==", - "license": "MIT", + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", + "@jridgewell/trace-mapping": "^0.3.20", "jest-worker": "^27.4.5", "schema-utils": "^3.1.1", "serialize-javascript": "^6.0.1", - "terser": "^5.16.8" + "terser": "^5.26.0" }, "engines": { "node": ">= 10.13.0" @@ -16587,10 +16546,9 @@ } }, "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "license": "MIT", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", + "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -16624,34 +16582,32 @@ "license": "Apache-2.0" }, "node_modules/webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", - "license": "MIT", - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "dependencies": { + "@types/estree": "^1.0.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "acorn-import-attributes": "^1.9.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", - "watchpack": "^2.4.0", + "terser-webpack-plugin": "^5.3.10", + "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { diff --git a/docusaurus/yarn.lock b/docusaurus/yarn.lock index e6556bd09..e4aaba8f6 100644 --- a/docusaurus/yarn.lock +++ b/docusaurus/yarn.lock @@ -84,7 +84,7 @@ "@algolia/requester-common" "4.23.2" "@algolia/transporter" "4.23.2" -"@algolia/client-search@>= 4.9.1 < 6", "@algolia/client-search@4.23.2": +"@algolia/client-search@4.23.2": version "4.23.2" resolved "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.23.2.tgz" integrity sha512-CxSB29OVGSE7l/iyoHvamMonzq7Ev8lnk/OkzleODZ1iBcCs3JC/XgTIKzN/4RSTrJ9QybsnlrN/bYCGufo7qw== @@ -176,7 +176,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.0.0-0 || ^8.0.0-0 <8.0.0", "@babel/core@^7.12.0", "@babel/core@^7.13.0", "@babel/core@^7.19.6", "@babel/core@^7.23.3", "@babel/core@^7.4.0 || ^8.0.0-0 <8.0.0": +"@babel/core@^7.19.6", "@babel/core@^7.23.3": version "7.23.5" resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz" integrity sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g== @@ -1232,7 +1232,7 @@ "@docsearch/css" "3.6.0" algoliasearch "^4.19.1" -"@docusaurus/core@^3.2.1", "@docusaurus/core@3.2.1": +"@docusaurus/core@3.2.1", "@docusaurus/core@^3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/core/-/core-3.2.1.tgz" integrity sha512-ZeMAqNvy0eBv2dThEeMuNzzuu+4thqMQakhxsgT5s02A8LqRcdkg+rbcnuNqUIpekQ4GRx3+M5nj0ODJhBXo9w== @@ -1356,7 +1356,7 @@ vfile "^6.0.1" webpack "^5.88.1" -"@docusaurus/module-type-aliases@^3.2.1", "@docusaurus/module-type-aliases@3.2.1": +"@docusaurus/module-type-aliases@3.2.1", "@docusaurus/module-type-aliases@^3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.2.1.tgz" integrity sha512-FyViV5TqhL1vsM7eh29nJ5NtbRE6Ra6LP1PDcPvhwPSlA7eiWGRKAn3jWwMUcmjkos5SYY+sr0/feCdbM3eQHQ== @@ -1393,7 +1393,7 @@ utility-types "^3.10.0" webpack "^5.88.1" -"@docusaurus/plugin-content-docs@^2 || ^3", "@docusaurus/plugin-content-docs@^3.2.1", "@docusaurus/plugin-content-docs@3.2.1": +"@docusaurus/plugin-content-docs@3.2.1", "@docusaurus/plugin-content-docs@^2 || ^3", "@docusaurus/plugin-content-docs@^3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.2.1.tgz" integrity sha512-GHe5b/lCskAR8QVbfWAfPAApvRZgqk7FN3sOHgjCtjzQACZxkHmq6QqyqZ8Jp45V7lVck4wt2Xw2IzBJ7Cz3bA== @@ -1545,7 +1545,7 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-common@^2 || ^3", "@docusaurus/theme-common@3.2.1": +"@docusaurus/theme-common@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.2.1.tgz" integrity sha512-d+adiD7L9xv6EvfaAwUqdKf4orsM3jqgeqAM+HAjgL/Ux0GkVVnfKr+tsoe+4ow4rHe6NUt+nkkW8/K8dKdilA== @@ -1601,7 +1601,7 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@^2 || ^3", "@docusaurus/theme-translations@3.2.1": +"@docusaurus/theme-translations@3.2.1", "@docusaurus/theme-translations@^2 || ^3": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.2.1.tgz" integrity sha512-jAUMkIkFfY+OAhJhv6mV8zlwY6J4AQxJPTgLdR2l+Otof9+QdJjHNh/ifVEu9q0lp3oSPlJj9l05AaP7Ref+cg== @@ -1609,7 +1609,7 @@ fs-extra "^11.1.1" tslib "^2.6.0" -"@docusaurus/types@*", "@docusaurus/types@^3.2.1", "@docusaurus/types@3.2.1": +"@docusaurus/types@3.2.1", "@docusaurus/types@^3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/types/-/types-3.2.1.tgz" integrity sha512-n/toxBzL2oxTtRTOFiGKsHypzn/Pm+sXyw+VSk1UbqbXQiHOwHwts55bpKwbcUgA530Is6kix3ELiFOv9GAMfw== @@ -1624,14 +1624,14 @@ webpack "^5.88.1" webpack-merge "^5.9.0" -"@docusaurus/utils-common@^2 || ^3", "@docusaurus/utils-common@3.2.1": +"@docusaurus/utils-common@3.2.1", "@docusaurus/utils-common@^2 || ^3": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.2.1.tgz" integrity sha512-N5vadULnRLiqX2QfTjVEU3u5vo6RG2EZTdyXvJdzDOdrLCGIZAfnf/VkssinFZ922sVfaFfQ4FnStdhn5TWdVg== dependencies: tslib "^2.6.0" -"@docusaurus/utils-validation@^2 || ^3", "@docusaurus/utils-validation@3.2.1": +"@docusaurus/utils-validation@3.2.1", "@docusaurus/utils-validation@^2 || ^3": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.2.1.tgz" integrity sha512-+x7IR9hNMXi62L1YAglwd0s95fR7+EtirjTxSN4kahYRWGqOi3jlQl1EV0az/yTEvKbxVvOPcdYicGu9dk4LJw== @@ -1643,7 +1643,7 @@ js-yaml "^4.1.0" tslib "^2.6.0" -"@docusaurus/utils@^2 || ^3", "@docusaurus/utils@3.2.1": +"@docusaurus/utils@3.2.1", "@docusaurus/utils@^2 || ^3": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.2.1.tgz" integrity sha512-DPkIS/EPc+pGAV798PUXgNzJFM3HJouoQXgr0KDZuJVz1EkWbDLOcQwLIz8Qx7liI9ddfkN/TXTRQdsTPZNakw== @@ -1698,6 +1698,28 @@ mark.js "^8.11.1" tslib "^2.4.0" +"@emnapi/core@^1.1.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.2.0.tgz#7b738e5033738132bf6af0b8fae7b05249bdcbd7" + integrity sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w== + dependencies: + "@emnapi/wasi-threads" "1.0.1" + tslib "^2.4.0" + +"@emnapi/runtime@^1.1.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.2.0.tgz#71d018546c3a91f3b51106530edbc056b9f2f2e3" + integrity sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.0.1.tgz#d7ae71fd2166b1c916c6cd2d0df2ef565a2e1a5b" + integrity sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw== + dependencies: + tslib "^2.4.0" + "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" @@ -1769,6 +1791,14 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jridgewell/trace-mapping@^0.3.20": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@leichtgewicht/ip-codec@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz" @@ -1810,11 +1840,87 @@ dependencies: "@types/mdx" "^2.0.0" +"@napi-rs/wasm-runtime@^0.1.1": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.1.2.tgz#cff8330e3728ab4447af82b67277f067132d341f" + integrity sha512-8JuczewTFIZ/XIjHQ+YlQUydHvlKx2hkcxtuGwh+t/t5zWyZct6YG4+xjHcq8xyc/e7FmFwf42Zj2YgICwmlvA== + dependencies: + "@emnapi/core" "^1.1.0" + "@emnapi/runtime" "^1.1.0" + "@tybys/wasm-util" "^0.8.1" + +"@node-rs/jieba-android-arm-eabi@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm-eabi/-/jieba-android-arm-eabi-1.10.0.tgz#ef351c295f2380fbcad386965830d56b3c62cf04" + integrity sha512-bzusJSLHm7I0qL8aQXGLt7IQ51Px35yGGEcQ/Ps4SEt0AxRSJ2/rxNET/8mlwBpOCZ5xiKE3BOBRfQajiPiI3g== + +"@node-rs/jieba-android-arm64@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm64/-/jieba-android-arm64-1.10.0.tgz#96386a880e21f227848c54270b8937e139fb6d41" + integrity sha512-g89Oq5U2RPmtlvuQhjNj8YZc5Gq033ODb7Ot4Z/OdIHvg2WMxi2M1GQhcdKu60dO79/tazc53W6I8/y691DUfQ== + "@node-rs/jieba-darwin-arm64@1.10.0": version "1.10.0" resolved "https://registry.npmjs.org/@node-rs/jieba-darwin-arm64/-/jieba-darwin-arm64-1.10.0.tgz" integrity sha512-IhR5r+XxFcfhVsF93zQ3uCJy8ndotRntXzoW/JCyKqOahUo/ITQRT6vTKHKMyD9xNmjl222OZonBSo2+mlI2fQ== +"@node-rs/jieba-darwin-x64@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-darwin-x64/-/jieba-darwin-x64-1.10.0.tgz#2eff70d7900941b6598742545555228659a40c0f" + integrity sha512-MBIs8ixKY4FPnifdZ7eTx6ht85TXE4kFBK4c8A/VDAbnmzBzpEyuV7tHUA2wAdfR0muC9j7/5FB4kQGZgYfc8g== + +"@node-rs/jieba-freebsd-x64@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-freebsd-x64/-/jieba-freebsd-x64-1.10.0.tgz#fa0c4f66a09afa2d91af4295fe43dbc42d5c68c2" + integrity sha512-MuY+1QEXONxo3I/uFLFju0/pSN5bzQORhJkIdP8CYv+jZaVB4Uz6rC7A5HrgjiAXOna6QsKlRgx2bYyHfaBUrA== + +"@node-rs/jieba-linux-arm-gnueabihf@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm-gnueabihf/-/jieba-linux-arm-gnueabihf-1.10.0.tgz#a9c302cd7d24b80e55434a1453aaf07ee03ca0c0" + integrity sha512-QfSBnwISdVuTqsi4iThAO1LSbKRSqSsIWiIJgCduhYsTDDiG9+pHyfiZtcTwSf73SDXHZ400QuBNONWLQ/dSag== + +"@node-rs/jieba-linux-arm64-gnu@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-gnu/-/jieba-linux-arm64-gnu-1.10.0.tgz#ca7d088604d5424531ee43f3f91048abb44d5c84" + integrity sha512-vzA2tX/6dReEd/7tZ9927glWQmKDausM6R9S5CqZx4BA4NSaWAK0xFdWsz0K7np459FXqNavLdNB5FVFJb4zzA== + +"@node-rs/jieba-linux-arm64-musl@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-musl/-/jieba-linux-arm64-musl-1.10.0.tgz#4adae202d08403c0d2e6e456b4548c9ce37d2b89" + integrity sha512-gxqoAVOQsn9sgYK6mFO9dsMZ/yOMvVecLZW5rGvLErjiugVvYUlESXIvCqxp2GSws8RtTqJj6p9u/lBmCCuvaw== + +"@node-rs/jieba-linux-x64-gnu@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-gnu/-/jieba-linux-x64-gnu-1.10.0.tgz#be258736b8591dcbd1211b73376b43beb3cdf7b6" + integrity sha512-rS5Shs8JITxJjFIjoIZ5a9O+GO21TJgKu03g2qwFE3QaN5ZOvXtz+/AqqyfT4GmmMhCujD83AGqfOGXDmItF9w== + +"@node-rs/jieba-linux-x64-musl@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-musl/-/jieba-linux-x64-musl-1.10.0.tgz#e674f5f58352f5a0bcb187e258982f0b45907bac" + integrity sha512-BvSiF2rR8Birh2oEVHcYwq0WGC1cegkEdddWsPrrSmpKmukJE2zyjcxaOOggq2apb8fIRsjyeeUh6X3R5AgjvA== + +"@node-rs/jieba-wasm32-wasi@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-wasm32-wasi/-/jieba-wasm32-wasi-1.10.0.tgz#9b22e08341e9021de8b4f7d025661b6ab648e73e" + integrity sha512-EzeAAbRrFTdYw61rd8Mfwdp/fA21d58z9vLY06CDbI+dqANfMFn1IUdwzKWi8S5J/MRhvbzonbbh3yHlz6F43Q== + dependencies: + "@napi-rs/wasm-runtime" "^0.1.1" + +"@node-rs/jieba-win32-arm64-msvc@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-arm64-msvc/-/jieba-win32-arm64-msvc-1.10.0.tgz#b3883e59e6c8a01577f95cbee5783cebed468345" + integrity sha512-eZjRLFUAvq1/E5+xXfJRqIB99Gu6BA+6+EXf/rCLuvEjXrDQuUunhmrSoOL5MjmUXTtazS+bXq9PXV5EFYyOPw== + +"@node-rs/jieba-win32-ia32-msvc@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-ia32-msvc/-/jieba-win32-ia32-msvc-1.10.0.tgz#1ed7909231773b9faf6f9cbcb0062696f851dc8b" + integrity sha512-DrfbeCN7UcLN+MiocZabWo74XZIjfpQsJ/WMOItZzVbU2gDcJSkSyAhML9+OqId66DhGCMFFlGinocElM8iIAw== + +"@node-rs/jieba-win32-x64-msvc@1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-x64-msvc/-/jieba-win32-x64-msvc-1.10.0.tgz#25e399f74a08a1cd2b0673ea45c5efabf4c5e7e4" + integrity sha512-RjBkBmjjHmj+bofiq5/han8wzbCkDk24OAPJ+YX8PX20GFSHmdjCiWapv3AooN8/RiKqlBfgodjS1JUngNWo5g== + "@node-rs/jieba@^1.6.0": version "1.10.0" resolved "https://registry.npmjs.org/@node-rs/jieba/-/jieba-1.10.0.tgz" @@ -1843,7 +1949,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -1977,7 +2083,7 @@ "@svgr/babel-plugin-transform-react-native-svg" "^6.5.1" "@svgr/babel-plugin-transform-svg-component" "^6.5.1" -"@svgr/core@*", "@svgr/core@^6.0.0", "@svgr/core@^6.5.1": +"@svgr/core@^6.5.1": version "6.5.1" resolved "https://registry.npmjs.org/@svgr/core/-/core-6.5.1.tgz" integrity sha512-/xdLSWxK5QkqG524ONSjvg3V/FkNyCv538OIBdQqPNaAta3AsXj/Bd2FbvR87yMbXO2hFSWiAe/Q6IkVPDw+mw== @@ -2041,6 +2147,13 @@ resolved "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@tybys/wasm-util@^0.8.1": + version "0.8.3" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.8.3.tgz#34dc6fd51bdc03524a27359137594bb15c59bba1" + integrity sha512-Z96T/L6dUFFxgFJ+pQtkPpne9q7i6kIPYCFnQBHSgSPV9idTsKfIhCss0h5iM9irweZCatkrdeP8yi5uM1eX6Q== + dependencies: + tslib "^2.4.0" + "@types/acorn@^4.0.0": version "4.0.6" resolved "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz" @@ -2102,22 +2215,6 @@ dependencies: "@types/ms" "*" -"@types/eslint-scope@^3.7.3": - version "3.7.7" - resolved "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "8.44.8" - resolved "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.8.tgz" - integrity sha512-4K8GavROwhrYl2QXDXm0Rv9epkA8GBFu0EI+XrrnnuCl7u8CWBRusX7fXJfanhZTDWSAL24gDI/UqXyUM0Injw== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - "@types/estree-jsx@^1.0.0": version "1.0.5" resolved "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz" @@ -2125,7 +2222,7 @@ dependencies: "@types/estree" "*" -"@types/estree@*", "@types/estree@^1.0.0": +"@types/estree@*", "@types/estree@^1.0.0", "@types/estree@^1.0.5": version "1.0.5" resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== @@ -2208,7 +2305,7 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -2312,7 +2409,7 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react@*", "@types/react@>= 16.8.0 < 19.0.0", "@types/react@>=16": +"@types/react@*": version "18.2.42" resolved "https://registry.npmjs.org/@types/react/-/react-18.2.42.tgz" integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA== @@ -2403,10 +2500,10 @@ resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@webassemblyjs/ast@^1.11.5", "@webassemblyjs/ast@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz" - integrity sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q== +"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb" + integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== dependencies: "@webassemblyjs/helper-numbers" "1.11.6" "@webassemblyjs/helper-wasm-bytecode" "1.11.6" @@ -2421,10 +2518,10 @@ resolved "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz" integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q== -"@webassemblyjs/helper-buffer@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz" - integrity sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA== +"@webassemblyjs/helper-buffer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz#6df20d272ea5439bf20ab3492b7fb70e9bfcb3f6" + integrity sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw== "@webassemblyjs/helper-numbers@1.11.6": version "1.11.6" @@ -2440,15 +2537,15 @@ resolved "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz" integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA== -"@webassemblyjs/helper-wasm-section@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz" - integrity sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g== +"@webassemblyjs/helper-wasm-section@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz#3da623233ae1a60409b509a52ade9bc22a37f7bf" + integrity sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g== dependencies: - "@webassemblyjs/ast" "1.11.6" - "@webassemblyjs/helper-buffer" "1.11.6" + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/wasm-gen" "1.11.6" + "@webassemblyjs/wasm-gen" "1.12.1" "@webassemblyjs/ieee754@1.11.6": version "1.11.6" @@ -2469,59 +2566,59 @@ resolved "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz" integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA== -"@webassemblyjs/wasm-edit@^1.11.5": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz" - integrity sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw== +"@webassemblyjs/wasm-edit@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz#9f9f3ff52a14c980939be0ef9d5df9ebc678ae3b" + integrity sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g== dependencies: - "@webassemblyjs/ast" "1.11.6" - "@webassemblyjs/helper-buffer" "1.11.6" + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/helper-wasm-section" "1.11.6" - "@webassemblyjs/wasm-gen" "1.11.6" - "@webassemblyjs/wasm-opt" "1.11.6" - "@webassemblyjs/wasm-parser" "1.11.6" - "@webassemblyjs/wast-printer" "1.11.6" - -"@webassemblyjs/wasm-gen@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz" - integrity sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA== - dependencies: - "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-wasm-section" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-opt" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" + "@webassemblyjs/wast-printer" "1.12.1" + +"@webassemblyjs/wasm-gen@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz#a6520601da1b5700448273666a71ad0a45d78547" + integrity sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w== + dependencies: + "@webassemblyjs/ast" "1.12.1" "@webassemblyjs/helper-wasm-bytecode" "1.11.6" "@webassemblyjs/ieee754" "1.11.6" "@webassemblyjs/leb128" "1.11.6" "@webassemblyjs/utf8" "1.11.6" -"@webassemblyjs/wasm-opt@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz" - integrity sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g== +"@webassemblyjs/wasm-opt@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz#9e6e81475dfcfb62dab574ac2dda38226c232bc5" + integrity sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg== dependencies: - "@webassemblyjs/ast" "1.11.6" - "@webassemblyjs/helper-buffer" "1.11.6" - "@webassemblyjs/wasm-gen" "1.11.6" - "@webassemblyjs/wasm-parser" "1.11.6" + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" -"@webassemblyjs/wasm-parser@^1.11.5", "@webassemblyjs/wasm-parser@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz" - integrity sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ== +"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz#c47acb90e6f083391e3fa61d113650eea1e95937" + integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== dependencies: - "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/ast" "1.12.1" "@webassemblyjs/helper-api-error" "1.11.6" "@webassemblyjs/helper-wasm-bytecode" "1.11.6" "@webassemblyjs/ieee754" "1.11.6" "@webassemblyjs/leb128" "1.11.6" "@webassemblyjs/utf8" "1.11.6" -"@webassemblyjs/wast-printer@1.11.6": - version "1.11.6" - resolved "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz" - integrity sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A== +"@webassemblyjs/wast-printer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz#bcecf661d7d1abdaf989d8341a4833e33e2b31ac" + integrity sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA== dependencies: - "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/ast" "1.12.1" "@xtuc/long" "4.2.2" "@xtuc/ieee754@^1.2.0": @@ -2542,10 +2639,10 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-import-assertions@^1.9.0: - version "1.9.0" - resolved "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz" - integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA== +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== acorn-jsx@^5.0.0: version "5.3.2" @@ -2557,7 +2654,7 @@ acorn-walk@^8.0.0: resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz" integrity sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw== -"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8, acorn@^8.0.0, acorn@^8.0.4, acorn@^8.7.1, acorn@^8.8.2: +acorn@^8.0.0, acorn@^8.0.4, acorn@^8.7.1, acorn@^8.8.2: version "8.11.2" resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz" integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== @@ -2582,12 +2679,7 @@ ajv-formats@^2.1.1: dependencies: ajv "^8.0.0" -ajv-keywords@^3.4.1: - version "3.5.2" - resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz" - integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== - -ajv-keywords@^3.5.2: +ajv-keywords@^3.4.1, ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== @@ -2599,7 +2691,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.12.2, ajv@^6.12.5, ajv@^6.9.1: +ajv@^6.12.2, ajv@^6.12.5: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2609,7 +2701,7 @@ ajv@^6.12.2, ajv@^6.12.5, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.8.2, ajv@^8.9.0: +ajv@^8.0.0, ajv@^8.9.0: version "8.12.0" resolved "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz" integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== @@ -2626,7 +2718,7 @@ algoliasearch-helper@^3.13.3: dependencies: "@algolia/events" "^4.0.1" -algoliasearch@^4.18.0, algoliasearch@^4.19.1, "algoliasearch@>= 3.1 < 6", "algoliasearch@>= 4.9.1 < 6": +algoliasearch@^4.18.0, algoliasearch@^4.19.1: version "4.23.2" resolved "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.23.2.tgz" integrity sha512-8aCl055IsokLuPU8BzLjwzXjb7ty9TPcUFFOk0pYOwsE5DMVhE3kwCMFtsCFKcnoPZK7oObm+H5mbnSO/9ioxQ== @@ -2713,16 +2805,16 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-flatten@^2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz" - integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== - array-flatten@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== +array-flatten@^2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz" + integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" @@ -2890,7 +2982,7 @@ braces@^3.0.3, braces@~3.0.2: dependencies: fill-range "^7.1.1" -browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4.21.9, browserslist@^4.22.2, browserslist@^4.23.0, "browserslist@>= 4.21.0": +browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4.21.9, browserslist@^4.22.2, browserslist@^4.23.0: version "4.23.0" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz" integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== @@ -2900,6 +2992,16 @@ browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.18.1, browserslist@^4 node-releases "^2.0.14" update-browserslist-db "^1.0.13" +browserslist@^4.21.10: + version "4.23.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" + integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== + dependencies: + caniuse-lite "^1.0.30001646" + electron-to-chromium "^1.5.4" + node-releases "^2.0.18" + update-browserslist-db "^1.1.0" + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" @@ -2982,6 +3084,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001608.tgz" integrity sha512-cjUJTQkk9fQlJR2s4HMuPMvTiRggl0rAVMtthQuyOlDWuqHXqN8azLq+pi8B2TjwKJ32diHjUqRIKeFX4z1FoA== +caniuse-lite@^1.0.30001646: + version "1.0.30001655" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz#0ce881f5a19a2dcfda2ecd927df4d5c1684b982f" + integrity sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg== + ccount@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz" @@ -3148,16 +3255,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + colord@^2.9.1: version "2.9.3" resolved "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz" @@ -3178,6 +3285,11 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== +commander@7, commander@^7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + commander@^10.0.0: version "10.0.1" resolved "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz" @@ -3193,21 +3305,11 @@ commander@^5.1.0: resolved "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== -commander@^7.2.0: - version "7.2.0" - resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" - integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== - commander@^8.3.0: version "8.3.0" resolved "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== -commander@7: - version "7.2.0" - resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" - integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== - common-path-prefix@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz" @@ -3558,7 +3660,7 @@ cytoscape-fcose@^2.1.0: dependencies: cose-base "^2.2.0" -cytoscape@^3.2.0, cytoscape@^3.23.0: +cytoscape@^3.23.0: version "3.27.0" resolved "https://registry.npmjs.org/cytoscape/-/cytoscape-3.27.0.tgz" integrity sha512-pPZJilfX9BxESwujODz5pydeGi+FBrXq1rcaB1mfhFXXFJ9GjE6CNndAk+8jPzoXGD+16LtSS4xlYEIUiW4Abg== @@ -3566,13 +3668,6 @@ cytoscape@^3.2.0, cytoscape@^3.23.0: heap "^0.2.6" lodash "^4.17.21" -d3-array@^3.2.0, "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3: - version "3.2.4" - resolved "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz" - integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== - dependencies: - internmap "1 - 2" - "d3-array@1 - 2": version "2.12.1" resolved "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz" @@ -3580,6 +3675,13 @@ d3-array@^3.2.0, "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", dependencies: internmap "^1.0.0" +"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: + version "3.2.4" + resolved "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz" + integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== + dependencies: + internmap "1 - 2" + d3-axis@3: version "3.0.0" resolved "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz" @@ -3689,16 +3791,16 @@ d3-hierarchy@3: dependencies: d3-color "1 - 3" -d3-path@^3.1.0, "d3-path@1 - 3", d3-path@3: - version "3.1.0" - resolved "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz" - integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== - d3-path@1: version "1.0.9" resolved "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz" integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== +"d3-path@1 - 3", d3-path@3, d3-path@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz" + integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== + d3-polygon@3: version "3.0.1" resolved "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz" @@ -3746,13 +3848,6 @@ d3-scale@4: resolved "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz" integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== -d3-shape@^1.2.0: - version "1.3.7" - resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz" - integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== - dependencies: - d3-path "1" - d3-shape@3: version "3.2.0" resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz" @@ -3760,6 +3855,13 @@ d3-shape@3: dependencies: d3-path "^3.1.0" +d3-shape@^1.2.0: + version "1.3.7" + resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz" + integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== + dependencies: + d3-path "1" + "d3-time-format@2 - 4", d3-time-format@4: version "4.1.0" resolved "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz" @@ -3855,27 +3957,20 @@ debounce@^1.2.1: resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz" integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== -debug@^2.6.0: +debug@2.6.9, debug@^2.6.0: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@4: +debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" -debug@2.6.9: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - decode-named-character-reference@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz" @@ -3956,16 +4051,16 @@ delaunator@5: dependencies: robust-predicates "^3.0.0" -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" - integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== - depd@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + dequal@^2.0.0: version "2.0.3" resolved "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz" @@ -4130,6 +4225,11 @@ electron-to-chromium@^1.4.668: resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.732.tgz" integrity sha512-nLrzr6UML+oqCyvseTxJ1WxLsnMSQPJCoHu+MuOuNiCp7BHEdG9AmCTw2Y9FU/wFFc/ETE0F6JVtzzPryEjecw== +electron-to-chromium@^1.5.4: + version "1.5.13" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" + integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== + elkjs@^0.8.2: version "0.8.2" resolved "https://registry.npmjs.org/elkjs/-/elkjs-0.8.2.tgz" @@ -4165,10 +4265,10 @@ encodeurl@~1.0.2: resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== -enhanced-resolve@^5.15.0: - version "5.15.0" - resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz" - integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== +enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -4212,6 +4312,11 @@ escalade@^3.1.1: resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== +escalade@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + escape-goat@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/escape-goat/-/escape-goat-4.0.0.tgz" @@ -4474,7 +4579,7 @@ feed@^4.2.2: dependencies: xml-js "^1.6.11" -file-loader@*, file-loader@^6.2.0: +file-loader@^6.2.0: version "6.2.0" resolved "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz" integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw== @@ -4777,16 +4882,16 @@ got@^12.1.0: p-cancelable "^3.0.0" responselike "^3.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: - version "4.2.11" - resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - graceful-fs@4.2.10: version "4.2.10" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + gray-matter@^4.0.3: version "4.0.3" resolved "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz" @@ -5088,16 +5193,6 @@ http-deceiver@^1.2.7: resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz" integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== -http-errors@~1.6.2: - version "1.6.3" - resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" - integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" - http-errors@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz" @@ -5109,6 +5204,16 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + http-parser-js@>=0.5.1: version "0.5.8" resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz" @@ -5224,7 +5329,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3, inherits@2, inherits@2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -5234,16 +5339,16 @@ inherits@2.0.3: resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== -ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: - version "1.3.8" - resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - ini@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: + version "1.3.8" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + inline-style-parser@0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz" @@ -5254,16 +5359,16 @@ inline-style-parser@0.2.3: resolved "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.3.tgz" integrity sha512-qlD8YNDqyTKTyuITrDOffsl6Tdhv+UC4hcdAVuQsK4IMQ99nSgd1MIA/Q+jQYoh9r3hVUXhYh7urSRmXPkW04g== -internmap@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz" - integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== - "internmap@1 - 2": version "2.0.3" resolved "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz" integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== + interpret@^1.0.0: version "1.4.0" resolved "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz" @@ -5276,16 +5381,16 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -ipaddr.js@^2.0.1: - version "2.1.0" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz" - integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== - ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== +ipaddr.js@^2.0.1: + version "2.1.0" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz" + integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== + is-alphabetical@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz" @@ -5461,16 +5566,16 @@ is-yarn-global@^0.4.0: resolved "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.4.1.tgz" integrity sha512-/kppl+R+LO5VmhYSEWARUFjodS25D68gvj8W7z0I7OWhUla5xWu8KL6CtB2V0R6yqhnRgbcaREMr4EEM6htLPQ== -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isarray@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -6702,7 +6807,7 @@ micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.3" picomatch "^2.3.1" -"mime-db@>= 1.43.0 < 2": +mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== @@ -6712,40 +6817,14 @@ mime-db@~1.33.0: resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz" integrity sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ== -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.27: - version "2.1.35" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime-types@^2.1.31: - version "2.1.35" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime-types@~2.1.17, mime-types@2.1.18: +mime-types@2.1.18, mime-types@~2.1.17: version "2.1.18" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz" integrity sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ== dependencies: mime-db "~1.33.0" -mime-types@~2.1.24: - version "2.1.35" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime-types@~2.1.34: +mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -6784,7 +6863,7 @@ minimalistic-assert@^1.0.0: resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@3.1.2: +minimatch@3.1.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -6872,6 +6951,11 @@ node-releases@^2.0.14: resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + non-layered-tidy-tree-layout@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz" @@ -7170,13 +7254,6 @@ path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-to-regexp@^1.7.0: - version "1.8.0" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" - integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== - dependencies: - isarray "0.0.1" - path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" @@ -7187,6 +7264,13 @@ path-to-regexp@2.2.1: resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz" integrity sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ== +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -7206,6 +7290,11 @@ picocolors@^1.0.0: resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" @@ -7506,7 +7595,7 @@ postcss-zindex@^5.1.0: resolved "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-5.1.0.tgz" integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== -"postcss@^7.0.0 || ^8.0.1", postcss@^8.0.9, postcss@^8.1.0, postcss@^8.2.15, postcss@^8.2.2, postcss@^8.4.16, postcss@^8.4.17, postcss@^8.4.21, postcss@^8.4.26: +postcss@^8.4.17, postcss@^8.4.21, postcss@^8.4.26: version "8.4.32" resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz" integrity sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw== @@ -7629,21 +7718,16 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - range-parser@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz" integrity sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A== +range-parser@^1.2.1, range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + raw-body@2.5.2: version "2.5.2" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz" @@ -7694,7 +7778,7 @@ react-dev-utils@^12.0.1: strip-ansi "^6.0.1" text-table "^0.2.0" -react-dom@*, "react-dom@^16.14.0 || 17 || ^18", "react-dom@^16.6.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, "react-dom@>= 16.8.0 < 19.0.0": +react-dom@^18.0.0: version "18.2.0" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -7740,7 +7824,7 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1: dependencies: "@babel/runtime" "^7.10.3" -react-loadable@*, "react-loadable@npm:@docusaurus/react-loadable@5.5.2": +"react-loadable@npm:@docusaurus/react-loadable@5.5.2": version "5.5.2" resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz" integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ== @@ -7779,7 +7863,7 @@ react-router-dom@^5.3.4: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react-router@^5.3.4, react-router@>=5, react-router@5.3.4: +react-router@5.3.4, react-router@^5.3.4: version "5.3.4" resolved "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz" integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA== @@ -7794,7 +7878,7 @@ react-router@^5.3.4, react-router@>=5, react-router@5.3.4: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react@*, "react@^16.13.1 || ^17.0.0 || ^18.0.0", "react@^16.14.0 || ^17 || ^18", "react@^16.6.0 || ^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16.8.0 < 19.0.0", react@>=15, react@>=16, react@>=16.0.0, react@>=16.6.0: +react@^18.0.0: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -8114,20 +8198,15 @@ sade@^1.7.3: dependencies: mri "^1.1.0" -safe-buffer@^5.1.0, safe-buffer@>=5.1.0, safe-buffer@~5.2.0, safe-buffer@5.2.1: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@5.1.2: - version "5.1.2" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" @@ -8146,25 +8225,16 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -schema-utils@^3.0.0: - version "3.3.0" - resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" - integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== - dependencies: - "@types/json-schema" "^7.0.8" - ajv "^6.12.5" - ajv-keywords "^3.5.2" - -schema-utils@^3.1.1: - version "3.3.0" - resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" - integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== +schema-utils@2.7.0: + version "2.7.0" + resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz" + integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== dependencies: - "@types/json-schema" "^7.0.8" - ajv "^6.12.5" - ajv-keywords "^3.5.2" + "@types/json-schema" "^7.0.4" + ajv "^6.12.2" + ajv-keywords "^3.4.1" -schema-utils@^3.2.0: +schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0: version "3.3.0" resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== @@ -8183,20 +8253,6 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.1.0" -schema-utils@2.7.0: - version "2.7.0" - resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz" - integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== - dependencies: - "@types/json-schema" "^7.0.4" - ajv "^6.12.2" - ajv-keywords "^3.4.1" - -"search-insights@>= 1 < 3": - version "2.13.0" - resolved "https://registry.npmjs.org/search-insights/-/search-insights-2.13.0.tgz" - integrity sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw== - section-matter@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz" @@ -8443,12 +8499,7 @@ source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -8458,11 +8509,6 @@ source-map@^0.7.0: resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz" integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== -source-map@~0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - space-separated-tokens@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz" @@ -8506,45 +8552,22 @@ stable@^0.1.8: resolved "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz" integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== -"statuses@>= 1.4.0 < 2": - version "1.5.0" - resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" - integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== - statuses@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== +"statuses@>= 1.4.0 < 2": + version "1.5.0" + resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + std-env@^3.0.1: version "3.6.0" resolved "https://registry.npmjs.org/std-env/-/std-env-3.6.0.tgz" integrity sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg== -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -string-width@^4.1.0: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.2.0: +string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -8562,6 +8585,20 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + stringify-entities@^4.0.0: version "4.0.4" resolved "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz" @@ -8694,7 +8731,18 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0: resolved "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== -terser-webpack-plugin@^5.3.7, terser-webpack-plugin@^5.3.9: +terser-webpack-plugin@^5.3.10: + version "5.3.10" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.20" + jest-worker "^27.4.5" + schema-utils "^3.1.1" + serialize-javascript "^6.0.1" + terser "^5.26.0" + +terser-webpack-plugin@^5.3.9: version "5.3.9" resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz" integrity sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA== @@ -8715,6 +8763,16 @@ terser@^5.10.0, terser@^5.15.1, terser@^5.16.8: commander "^2.20.0" source-map-support "~0.5.20" +terser@^5.26.0: + version "5.31.6" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.6.tgz#c63858a0f0703988d0266a82fcbf2d7ba76422b1" + integrity sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + text-table@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" @@ -8802,9 +8860,6 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -"typescript@>= 2.7", typescript@>=4.9.5: - version "5.3.3" - undici-types@~5.26.4: version "5.26.5" resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" @@ -8923,7 +8978,7 @@ universalify@^2.0.0: resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@~1.0.0, unpipe@1.0.0: +unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -8936,6 +8991,14 @@ update-browserslist-db@^1.0.13: escalade "^3.1.1" picocolors "^1.0.0" +update-browserslist-db@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== + dependencies: + escalade "^3.1.2" + picocolors "^1.0.1" + update-notifier@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/update-notifier/-/update-notifier-6.0.2.tgz" @@ -9047,10 +9110,10 @@ vfile@^6.0.0, vfile@^6.0.1: unist-util-stringify-position "^4.0.0" vfile-message "^4.0.0" -watchpack@^2.4.0: - version "2.4.0" - resolved "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz" - integrity sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg== +watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== dependencies: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" @@ -9152,34 +9215,33 @@ webpack-sources@^3.2.3: resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -"webpack@^4.0.0 || ^5.0.0", "webpack@^4.37.0 || ^5.0.0", webpack@^5.0.0, webpack@^5.1.0, webpack@^5.20.0, webpack@^5.88.1, "webpack@>= 4", "webpack@>=4.41.1 || 5.x", webpack@>=5, "webpack@3 || 4 || 5": - version "5.89.0" - resolved "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz" - integrity sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw== +webpack@^5.88.1: + version "5.94.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" + integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== dependencies: - "@types/eslint-scope" "^3.7.3" - "@types/estree" "^1.0.0" - "@webassemblyjs/ast" "^1.11.5" - "@webassemblyjs/wasm-edit" "^1.11.5" - "@webassemblyjs/wasm-parser" "^1.11.5" + "@types/estree" "^1.0.5" + "@webassemblyjs/ast" "^1.12.1" + "@webassemblyjs/wasm-edit" "^1.12.1" + "@webassemblyjs/wasm-parser" "^1.12.1" acorn "^8.7.1" - acorn-import-assertions "^1.9.0" - browserslist "^4.14.5" + acorn-import-attributes "^1.9.5" + browserslist "^4.21.10" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.15.0" + enhanced-resolve "^5.17.1" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" glob-to-regexp "^0.4.1" - graceful-fs "^4.2.9" + graceful-fs "^4.2.11" json-parse-even-better-errors "^2.3.1" loader-runner "^4.2.0" mime-types "^2.1.27" neo-async "^2.6.2" schema-utils "^3.2.0" tapable "^2.1.1" - terser-webpack-plugin "^5.3.7" - watchpack "^2.4.0" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.1" webpack-sources "^3.2.3" webpackbar@^5.0.2: @@ -9192,7 +9254,7 @@ webpackbar@^5.0.2: pretty-time "^1.1.0" std-env "^3.0.1" -websocket-driver@^0.7.4, websocket-driver@>=0.5.1: +websocket-driver@>=0.5.1, websocket-driver@^0.7.4: version "0.7.4" resolved "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz" integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== From 88f1d72f736625952fae19047c94fad71beef415 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 12:42:08 -0400 Subject: [PATCH 37/48] [Docs] Minor doc updates across the board (#792) - Updated compiled protobufs - Links to the Shannon TestNet RPC Nodes - Mention `consensus-breaking` in the PR template --- .github/pull_request_template.md | 3 +- docusaurus/docs/explore/roadmap.md | 2 +- docusaurus/docs/explore/rpc.md | 36 ++ docusaurus/docs/explore/tools.md | 2 +- docusaurus/yarn.lock | 625 +++++++++++++---------------- 5 files changed, 313 insertions(+), 355 deletions(-) create mode 100644 docusaurus/docs/explore/rpc.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4133e57ca..dba8e6fea 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -24,9 +24,10 @@ ## Type of change -Select one or more: +Select one or more from the following: - [ ] New feature, functionality or library +- [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation diff --git a/docusaurus/docs/explore/roadmap.md b/docusaurus/docs/explore/roadmap.md index 27eee4a4a..200b2d96b 100644 --- a/docusaurus/docs/explore/roadmap.md +++ b/docusaurus/docs/explore/roadmap.md @@ -3,7 +3,7 @@ title: Roadmap sidebar_position: 2 --- -# Roadmap +## Roadmap See the Alpha TestNet #3 Announcement [here](https://medium.com/decentralized-infrastructure/pocket-network-shannon-update-alpha-testnet-3-eca539a9e111). diff --git a/docusaurus/docs/explore/rpc.md b/docusaurus/docs/explore/rpc.md new file mode 100644 index 000000000..db5284514 --- /dev/null +++ b/docusaurus/docs/explore/rpc.md @@ -0,0 +1,36 @@ +--- +title: RPC Endpoints +sidebar_position: 3 +--- + +## TestNet RPC Endpoints + +We have provided `gRPC`, `JSON-RPC` and `REST` endpoints, which are available here: + +- `https://shannon-testnet-grove-seed-rpc.poktroll.com` +- `https://shannon-testnet-grove-seed-grpc.poktroll.com` +- `https://shannon-testnet-grove-seed-api.poktroll.com` + +You can review the difference between them in the [Cosmos SDK docs](https://docs.cosmos.network/main/learn/advanced/grpc_rest#comparison-table). + +### JSON-RPC + +Using `curl`: + +```bash +curl -X POST https://shannon-testnet-grove-seed-rpc.poktroll.com/block +``` + +Using the `poktrolld` binary: + +```bash +poktrolld query block --type=height 0 --node https://shannon-testnet-grove-seed-rpc.poktroll.com +``` + +### gRPC + +_TODO: Add a gRPC example_ + +### REST + +_TODO: Add a REST example_ diff --git a/docusaurus/docs/explore/tools.md b/docusaurus/docs/explore/tools.md index 1278149a4..68d28a7db 100644 --- a/docusaurus/docs/explore/tools.md +++ b/docusaurus/docs/explore/tools.md @@ -3,7 +3,7 @@ title: Tools & References sidebar_position: 1 --- -# 🛠️ Tools & References +## 🛠️ Tools & References - 🪙 [Shannon Token Faucet](https://faucet.testnet.pokt.network/) - 🗺️ [Shannon Explorer](https://shannon.testnet.pokt.network/poktroll/block) diff --git a/docusaurus/yarn.lock b/docusaurus/yarn.lock index e4aaba8f6..5c2dcf935 100644 --- a/docusaurus/yarn.lock +++ b/docusaurus/yarn.lock @@ -84,7 +84,7 @@ "@algolia/requester-common" "4.23.2" "@algolia/transporter" "4.23.2" -"@algolia/client-search@4.23.2": +"@algolia/client-search@>= 4.9.1 < 6", "@algolia/client-search@4.23.2": version "4.23.2" resolved "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.23.2.tgz" integrity sha512-CxSB29OVGSE7l/iyoHvamMonzq7Ev8lnk/OkzleODZ1iBcCs3JC/XgTIKzN/4RSTrJ9QybsnlrN/bYCGufo7qw== @@ -176,7 +176,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@^7.19.6", "@babel/core@^7.23.3": +"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.0.0-0 || ^8.0.0-0 <8.0.0", "@babel/core@^7.12.0", "@babel/core@^7.13.0", "@babel/core@^7.19.6", "@babel/core@^7.23.3", "@babel/core@^7.4.0 || ^8.0.0-0 <8.0.0": version "7.23.5" resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz" integrity sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g== @@ -1232,7 +1232,7 @@ "@docsearch/css" "3.6.0" algoliasearch "^4.19.1" -"@docusaurus/core@3.2.1", "@docusaurus/core@^3.2.1": +"@docusaurus/core@^3.2.1", "@docusaurus/core@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/core/-/core-3.2.1.tgz" integrity sha512-ZeMAqNvy0eBv2dThEeMuNzzuu+4thqMQakhxsgT5s02A8LqRcdkg+rbcnuNqUIpekQ4GRx3+M5nj0ODJhBXo9w== @@ -1356,7 +1356,7 @@ vfile "^6.0.1" webpack "^5.88.1" -"@docusaurus/module-type-aliases@3.2.1", "@docusaurus/module-type-aliases@^3.2.1": +"@docusaurus/module-type-aliases@^3.2.1", "@docusaurus/module-type-aliases@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.2.1.tgz" integrity sha512-FyViV5TqhL1vsM7eh29nJ5NtbRE6Ra6LP1PDcPvhwPSlA7eiWGRKAn3jWwMUcmjkos5SYY+sr0/feCdbM3eQHQ== @@ -1393,7 +1393,7 @@ utility-types "^3.10.0" webpack "^5.88.1" -"@docusaurus/plugin-content-docs@3.2.1", "@docusaurus/plugin-content-docs@^2 || ^3", "@docusaurus/plugin-content-docs@^3.2.1": +"@docusaurus/plugin-content-docs@^2 || ^3", "@docusaurus/plugin-content-docs@^3.2.1", "@docusaurus/plugin-content-docs@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.2.1.tgz" integrity sha512-GHe5b/lCskAR8QVbfWAfPAApvRZgqk7FN3sOHgjCtjzQACZxkHmq6QqyqZ8Jp45V7lVck4wt2Xw2IzBJ7Cz3bA== @@ -1545,7 +1545,7 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-common@3.2.1": +"@docusaurus/theme-common@^2 || ^3", "@docusaurus/theme-common@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.2.1.tgz" integrity sha512-d+adiD7L9xv6EvfaAwUqdKf4orsM3jqgeqAM+HAjgL/Ux0GkVVnfKr+tsoe+4ow4rHe6NUt+nkkW8/K8dKdilA== @@ -1601,7 +1601,7 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@3.2.1", "@docusaurus/theme-translations@^2 || ^3": +"@docusaurus/theme-translations@^2 || ^3", "@docusaurus/theme-translations@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/theme-translations/-/theme-translations-3.2.1.tgz" integrity sha512-jAUMkIkFfY+OAhJhv6mV8zlwY6J4AQxJPTgLdR2l+Otof9+QdJjHNh/ifVEu9q0lp3oSPlJj9l05AaP7Ref+cg== @@ -1609,7 +1609,7 @@ fs-extra "^11.1.1" tslib "^2.6.0" -"@docusaurus/types@3.2.1", "@docusaurus/types@^3.2.1": +"@docusaurus/types@*", "@docusaurus/types@^3.2.1", "@docusaurus/types@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/types/-/types-3.2.1.tgz" integrity sha512-n/toxBzL2oxTtRTOFiGKsHypzn/Pm+sXyw+VSk1UbqbXQiHOwHwts55bpKwbcUgA530Is6kix3ELiFOv9GAMfw== @@ -1624,14 +1624,14 @@ webpack "^5.88.1" webpack-merge "^5.9.0" -"@docusaurus/utils-common@3.2.1", "@docusaurus/utils-common@^2 || ^3": +"@docusaurus/utils-common@^2 || ^3", "@docusaurus/utils-common@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.2.1.tgz" integrity sha512-N5vadULnRLiqX2QfTjVEU3u5vo6RG2EZTdyXvJdzDOdrLCGIZAfnf/VkssinFZ922sVfaFfQ4FnStdhn5TWdVg== dependencies: tslib "^2.6.0" -"@docusaurus/utils-validation@3.2.1", "@docusaurus/utils-validation@^2 || ^3": +"@docusaurus/utils-validation@^2 || ^3", "@docusaurus/utils-validation@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.2.1.tgz" integrity sha512-+x7IR9hNMXi62L1YAglwd0s95fR7+EtirjTxSN4kahYRWGqOi3jlQl1EV0az/yTEvKbxVvOPcdYicGu9dk4LJw== @@ -1643,7 +1643,7 @@ js-yaml "^4.1.0" tslib "^2.6.0" -"@docusaurus/utils@3.2.1", "@docusaurus/utils@^2 || ^3": +"@docusaurus/utils@^2 || ^3", "@docusaurus/utils@3.2.1": version "3.2.1" resolved "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.2.1.tgz" integrity sha512-DPkIS/EPc+pGAV798PUXgNzJFM3HJouoQXgr0KDZuJVz1EkWbDLOcQwLIz8Qx7liI9ddfkN/TXTRQdsTPZNakw== @@ -1698,28 +1698,6 @@ mark.js "^8.11.1" tslib "^2.4.0" -"@emnapi/core@^1.1.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.2.0.tgz#7b738e5033738132bf6af0b8fae7b05249bdcbd7" - integrity sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w== - dependencies: - "@emnapi/wasi-threads" "1.0.1" - tslib "^2.4.0" - -"@emnapi/runtime@^1.1.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.2.0.tgz#71d018546c3a91f3b51106530edbc056b9f2f2e3" - integrity sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ== - dependencies: - tslib "^2.4.0" - -"@emnapi/wasi-threads@1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.0.1.tgz#d7ae71fd2166b1c916c6cd2d0df2ef565a2e1a5b" - integrity sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw== - dependencies: - tslib "^2.4.0" - "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" @@ -1783,7 +1761,7 @@ resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.9": version "0.3.20" resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz" integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== @@ -1791,14 +1769,6 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jridgewell/trace-mapping@^0.3.20": - version "0.3.25" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" - integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - "@leichtgewicht/ip-codec@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz" @@ -1840,87 +1810,11 @@ dependencies: "@types/mdx" "^2.0.0" -"@napi-rs/wasm-runtime@^0.1.1": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.1.2.tgz#cff8330e3728ab4447af82b67277f067132d341f" - integrity sha512-8JuczewTFIZ/XIjHQ+YlQUydHvlKx2hkcxtuGwh+t/t5zWyZct6YG4+xjHcq8xyc/e7FmFwf42Zj2YgICwmlvA== - dependencies: - "@emnapi/core" "^1.1.0" - "@emnapi/runtime" "^1.1.0" - "@tybys/wasm-util" "^0.8.1" - -"@node-rs/jieba-android-arm-eabi@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm-eabi/-/jieba-android-arm-eabi-1.10.0.tgz#ef351c295f2380fbcad386965830d56b3c62cf04" - integrity sha512-bzusJSLHm7I0qL8aQXGLt7IQ51Px35yGGEcQ/Ps4SEt0AxRSJ2/rxNET/8mlwBpOCZ5xiKE3BOBRfQajiPiI3g== - -"@node-rs/jieba-android-arm64@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm64/-/jieba-android-arm64-1.10.0.tgz#96386a880e21f227848c54270b8937e139fb6d41" - integrity sha512-g89Oq5U2RPmtlvuQhjNj8YZc5Gq033ODb7Ot4Z/OdIHvg2WMxi2M1GQhcdKu60dO79/tazc53W6I8/y691DUfQ== - "@node-rs/jieba-darwin-arm64@1.10.0": version "1.10.0" resolved "https://registry.npmjs.org/@node-rs/jieba-darwin-arm64/-/jieba-darwin-arm64-1.10.0.tgz" integrity sha512-IhR5r+XxFcfhVsF93zQ3uCJy8ndotRntXzoW/JCyKqOahUo/ITQRT6vTKHKMyD9xNmjl222OZonBSo2+mlI2fQ== -"@node-rs/jieba-darwin-x64@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-darwin-x64/-/jieba-darwin-x64-1.10.0.tgz#2eff70d7900941b6598742545555228659a40c0f" - integrity sha512-MBIs8ixKY4FPnifdZ7eTx6ht85TXE4kFBK4c8A/VDAbnmzBzpEyuV7tHUA2wAdfR0muC9j7/5FB4kQGZgYfc8g== - -"@node-rs/jieba-freebsd-x64@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-freebsd-x64/-/jieba-freebsd-x64-1.10.0.tgz#fa0c4f66a09afa2d91af4295fe43dbc42d5c68c2" - integrity sha512-MuY+1QEXONxo3I/uFLFju0/pSN5bzQORhJkIdP8CYv+jZaVB4Uz6rC7A5HrgjiAXOna6QsKlRgx2bYyHfaBUrA== - -"@node-rs/jieba-linux-arm-gnueabihf@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm-gnueabihf/-/jieba-linux-arm-gnueabihf-1.10.0.tgz#a9c302cd7d24b80e55434a1453aaf07ee03ca0c0" - integrity sha512-QfSBnwISdVuTqsi4iThAO1LSbKRSqSsIWiIJgCduhYsTDDiG9+pHyfiZtcTwSf73SDXHZ400QuBNONWLQ/dSag== - -"@node-rs/jieba-linux-arm64-gnu@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-gnu/-/jieba-linux-arm64-gnu-1.10.0.tgz#ca7d088604d5424531ee43f3f91048abb44d5c84" - integrity sha512-vzA2tX/6dReEd/7tZ9927glWQmKDausM6R9S5CqZx4BA4NSaWAK0xFdWsz0K7np459FXqNavLdNB5FVFJb4zzA== - -"@node-rs/jieba-linux-arm64-musl@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-musl/-/jieba-linux-arm64-musl-1.10.0.tgz#4adae202d08403c0d2e6e456b4548c9ce37d2b89" - integrity sha512-gxqoAVOQsn9sgYK6mFO9dsMZ/yOMvVecLZW5rGvLErjiugVvYUlESXIvCqxp2GSws8RtTqJj6p9u/lBmCCuvaw== - -"@node-rs/jieba-linux-x64-gnu@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-gnu/-/jieba-linux-x64-gnu-1.10.0.tgz#be258736b8591dcbd1211b73376b43beb3cdf7b6" - integrity sha512-rS5Shs8JITxJjFIjoIZ5a9O+GO21TJgKu03g2qwFE3QaN5ZOvXtz+/AqqyfT4GmmMhCujD83AGqfOGXDmItF9w== - -"@node-rs/jieba-linux-x64-musl@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-musl/-/jieba-linux-x64-musl-1.10.0.tgz#e674f5f58352f5a0bcb187e258982f0b45907bac" - integrity sha512-BvSiF2rR8Birh2oEVHcYwq0WGC1cegkEdddWsPrrSmpKmukJE2zyjcxaOOggq2apb8fIRsjyeeUh6X3R5AgjvA== - -"@node-rs/jieba-wasm32-wasi@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-wasm32-wasi/-/jieba-wasm32-wasi-1.10.0.tgz#9b22e08341e9021de8b4f7d025661b6ab648e73e" - integrity sha512-EzeAAbRrFTdYw61rd8Mfwdp/fA21d58z9vLY06CDbI+dqANfMFn1IUdwzKWi8S5J/MRhvbzonbbh3yHlz6F43Q== - dependencies: - "@napi-rs/wasm-runtime" "^0.1.1" - -"@node-rs/jieba-win32-arm64-msvc@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-arm64-msvc/-/jieba-win32-arm64-msvc-1.10.0.tgz#b3883e59e6c8a01577f95cbee5783cebed468345" - integrity sha512-eZjRLFUAvq1/E5+xXfJRqIB99Gu6BA+6+EXf/rCLuvEjXrDQuUunhmrSoOL5MjmUXTtazS+bXq9PXV5EFYyOPw== - -"@node-rs/jieba-win32-ia32-msvc@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-ia32-msvc/-/jieba-win32-ia32-msvc-1.10.0.tgz#1ed7909231773b9faf6f9cbcb0062696f851dc8b" - integrity sha512-DrfbeCN7UcLN+MiocZabWo74XZIjfpQsJ/WMOItZzVbU2gDcJSkSyAhML9+OqId66DhGCMFFlGinocElM8iIAw== - -"@node-rs/jieba-win32-x64-msvc@1.10.0": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-x64-msvc/-/jieba-win32-x64-msvc-1.10.0.tgz#25e399f74a08a1cd2b0673ea45c5efabf4c5e7e4" - integrity sha512-RjBkBmjjHmj+bofiq5/han8wzbCkDk24OAPJ+YX8PX20GFSHmdjCiWapv3AooN8/RiKqlBfgodjS1JUngNWo5g== - "@node-rs/jieba@^1.6.0": version "1.10.0" resolved "https://registry.npmjs.org/@node-rs/jieba/-/jieba-1.10.0.tgz" @@ -1949,7 +1843,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": +"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -2083,7 +1977,7 @@ "@svgr/babel-plugin-transform-react-native-svg" "^6.5.1" "@svgr/babel-plugin-transform-svg-component" "^6.5.1" -"@svgr/core@^6.5.1": +"@svgr/core@*", "@svgr/core@^6.0.0", "@svgr/core@^6.5.1": version "6.5.1" resolved "https://registry.npmjs.org/@svgr/core/-/core-6.5.1.tgz" integrity sha512-/xdLSWxK5QkqG524ONSjvg3V/FkNyCv538OIBdQqPNaAta3AsXj/Bd2FbvR87yMbXO2hFSWiAe/Q6IkVPDw+mw== @@ -2147,13 +2041,6 @@ resolved "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== -"@tybys/wasm-util@^0.8.1": - version "0.8.3" - resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.8.3.tgz#34dc6fd51bdc03524a27359137594bb15c59bba1" - integrity sha512-Z96T/L6dUFFxgFJ+pQtkPpne9q7i6kIPYCFnQBHSgSPV9idTsKfIhCss0h5iM9irweZCatkrdeP8yi5uM1eX6Q== - dependencies: - tslib "^2.4.0" - "@types/acorn@^4.0.0": version "4.0.6" resolved "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz" @@ -2409,7 +2296,7 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react@*": +"@types/react@*", "@types/react@>= 16.8.0 < 19.0.0", "@types/react@>=16": version "18.2.42" resolved "https://registry.npmjs.org/@types/react/-/react-18.2.42.tgz" integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA== @@ -2500,9 +2387,9 @@ resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": +"@webassemblyjs/ast@^1.12.1", "@webassemblyjs/ast@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb" + resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz" integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== dependencies: "@webassemblyjs/helper-numbers" "1.11.6" @@ -2520,7 +2407,7 @@ "@webassemblyjs/helper-buffer@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz#6df20d272ea5439bf20ab3492b7fb70e9bfcb3f6" + resolved "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz" integrity sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw== "@webassemblyjs/helper-numbers@1.11.6": @@ -2539,7 +2426,7 @@ "@webassemblyjs/helper-wasm-section@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz#3da623233ae1a60409b509a52ade9bc22a37f7bf" + resolved "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz" integrity sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2568,7 +2455,7 @@ "@webassemblyjs/wasm-edit@^1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz#9f9f3ff52a14c980939be0ef9d5df9ebc678ae3b" + resolved "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz" integrity sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2582,7 +2469,7 @@ "@webassemblyjs/wasm-gen@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz#a6520601da1b5700448273666a71ad0a45d78547" + resolved "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz" integrity sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2593,7 +2480,7 @@ "@webassemblyjs/wasm-opt@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz#9e6e81475dfcfb62dab574ac2dda38226c232bc5" + resolved "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz" integrity sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2601,9 +2488,9 @@ "@webassemblyjs/wasm-gen" "1.12.1" "@webassemblyjs/wasm-parser" "1.12.1" -"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": +"@webassemblyjs/wasm-parser@^1.12.1", "@webassemblyjs/wasm-parser@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz#c47acb90e6f083391e3fa61d113650eea1e95937" + resolved "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz" integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2615,7 +2502,7 @@ "@webassemblyjs/wast-printer@1.12.1": version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz#bcecf661d7d1abdaf989d8341a4833e33e2b31ac" + resolved "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz" integrity sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA== dependencies: "@webassemblyjs/ast" "1.12.1" @@ -2641,7 +2528,7 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: acorn-import-attributes@^1.9.5: version "1.9.5" - resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + resolved "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz" integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== acorn-jsx@^5.0.0: @@ -2654,7 +2541,7 @@ acorn-walk@^8.0.0: resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz" integrity sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw== -acorn@^8.0.0, acorn@^8.0.4, acorn@^8.7.1, acorn@^8.8.2: +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8, acorn@^8.0.0, acorn@^8.0.4, acorn@^8.7.1, acorn@^8.8.2: version "8.11.2" resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz" integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== @@ -2679,7 +2566,12 @@ ajv-formats@^2.1.1: dependencies: ajv "^8.0.0" -ajv-keywords@^3.4.1, ajv-keywords@^3.5.2: +ajv-keywords@^3.4.1: + version "3.5.2" + resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== @@ -2691,7 +2583,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.12.2, ajv@^6.12.5: +ajv@^6.12.2, ajv@^6.12.5, ajv@^6.9.1: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2701,7 +2593,7 @@ ajv@^6.12.2, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.9.0: +ajv@^8.0.0, ajv@^8.8.2, ajv@^8.9.0: version "8.12.0" resolved "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz" integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== @@ -2718,7 +2610,7 @@ algoliasearch-helper@^3.13.3: dependencies: "@algolia/events" "^4.0.1" -algoliasearch@^4.18.0, algoliasearch@^4.19.1: +algoliasearch@^4.18.0, algoliasearch@^4.19.1, "algoliasearch@>= 3.1 < 6", "algoliasearch@>= 4.9.1 < 6": version "4.23.2" resolved "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.23.2.tgz" integrity sha512-8aCl055IsokLuPU8BzLjwzXjb7ty9TPcUFFOk0pYOwsE5DMVhE3kwCMFtsCFKcnoPZK7oObm+H5mbnSO/9ioxQ== @@ -2805,16 +2697,16 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - array-flatten@^2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz" integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" @@ -2982,7 +2874,7 @@ braces@^3.0.3, braces@~3.0.2: dependencies: fill-range "^7.1.1" -browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4.21.9, browserslist@^4.22.2, browserslist@^4.23.0: +browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.10, browserslist@^4.21.4, browserslist@^4.21.9, browserslist@^4.22.2, browserslist@^4.23.0, "browserslist@>= 4.21.0": version "4.23.0" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz" integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== @@ -2992,16 +2884,6 @@ browserslist@^4.0.0, browserslist@^4.18.1, browserslist@^4.21.4, browserslist@^4 node-releases "^2.0.14" update-browserslist-db "^1.0.13" -browserslist@^4.21.10: - version "4.23.3" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.3.tgz#debb029d3c93ebc97ffbc8d9cbb03403e227c800" - integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== - dependencies: - caniuse-lite "^1.0.30001646" - electron-to-chromium "^1.5.4" - node-releases "^2.0.18" - update-browserslist-db "^1.1.0" - buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" @@ -3084,11 +2966,6 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001608.tgz" integrity sha512-cjUJTQkk9fQlJR2s4HMuPMvTiRggl0rAVMtthQuyOlDWuqHXqN8azLq+pi8B2TjwKJ32diHjUqRIKeFX4z1FoA== -caniuse-lite@^1.0.30001646: - version "1.0.30001655" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz#0ce881f5a19a2dcfda2ecd927df4d5c1684b982f" - integrity sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg== - ccount@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz" @@ -3255,16 +3132,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + colord@^2.9.1: version "2.9.3" resolved "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz" @@ -3285,11 +3162,6 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== -commander@7, commander@^7.2.0: - version "7.2.0" - resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" - integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== - commander@^10.0.0: version "10.0.1" resolved "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz" @@ -3305,11 +3177,21 @@ commander@^5.1.0: resolved "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== +commander@^7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + commander@^8.3.0: version "8.3.0" resolved "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== +commander@7: + version "7.2.0" + resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + common-path-prefix@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz" @@ -3660,7 +3542,7 @@ cytoscape-fcose@^2.1.0: dependencies: cose-base "^2.2.0" -cytoscape@^3.23.0: +cytoscape@^3.2.0, cytoscape@^3.23.0: version "3.27.0" resolved "https://registry.npmjs.org/cytoscape/-/cytoscape-3.27.0.tgz" integrity sha512-pPZJilfX9BxESwujODz5pydeGi+FBrXq1rcaB1mfhFXXFJ9GjE6CNndAk+8jPzoXGD+16LtSS4xlYEIUiW4Abg== @@ -3668,6 +3550,13 @@ cytoscape@^3.23.0: heap "^0.2.6" lodash "^4.17.21" +d3-array@^3.2.0, "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3: + version "3.2.4" + resolved "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz" + integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== + dependencies: + internmap "1 - 2" + "d3-array@1 - 2": version "2.12.1" resolved "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz" @@ -3675,13 +3564,6 @@ cytoscape@^3.23.0: dependencies: internmap "^1.0.0" -"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: - version "3.2.4" - resolved "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz" - integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== - dependencies: - internmap "1 - 2" - d3-axis@3: version "3.0.0" resolved "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz" @@ -3791,16 +3673,16 @@ d3-hierarchy@3: dependencies: d3-color "1 - 3" +d3-path@^3.1.0, "d3-path@1 - 3", d3-path@3: + version "3.1.0" + resolved "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz" + integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== + d3-path@1: version "1.0.9" resolved "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz" integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== -"d3-path@1 - 3", d3-path@3, d3-path@^3.1.0: - version "3.1.0" - resolved "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz" - integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== - d3-polygon@3: version "3.0.1" resolved "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz" @@ -3848,13 +3730,6 @@ d3-scale@4: resolved "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz" integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== -d3-shape@3: - version "3.2.0" - resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz" - integrity sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA== - dependencies: - d3-path "^3.1.0" - d3-shape@^1.2.0: version "1.3.7" resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz" @@ -3862,6 +3737,13 @@ d3-shape@^1.2.0: dependencies: d3-path "1" +d3-shape@3: + version "3.2.0" + resolved "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz" + integrity sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA== + dependencies: + d3-path "^3.1.0" + "d3-time-format@2 - 4", d3-time-format@4: version "4.1.0" resolved "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz" @@ -3957,20 +3839,27 @@ debounce@^1.2.1: resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz" integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== -debug@2.6.9, debug@^2.6.0: +debug@^2.6.0: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0: +debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@4: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" +debug@2.6.9: + version "2.6.9" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + decode-named-character-reference@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz" @@ -4051,16 +3940,16 @@ delaunator@5: dependencies: robust-predicates "^3.0.0" -depd@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - depd@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== +depd@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + dequal@^2.0.0: version "2.0.3" resolved "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz" @@ -4225,11 +4114,6 @@ electron-to-chromium@^1.4.668: resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.732.tgz" integrity sha512-nLrzr6UML+oqCyvseTxJ1WxLsnMSQPJCoHu+MuOuNiCp7BHEdG9AmCTw2Y9FU/wFFc/ETE0F6JVtzzPryEjecw== -electron-to-chromium@^1.5.4: - version "1.5.13" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" - integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== - elkjs@^0.8.2: version "0.8.2" resolved "https://registry.npmjs.org/elkjs/-/elkjs-0.8.2.tgz" @@ -4267,7 +4151,7 @@ encodeurl@~1.0.2: enhanced-resolve@^5.17.1: version "5.17.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz" integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== dependencies: graceful-fs "^4.2.4" @@ -4312,11 +4196,6 @@ escalade@^3.1.1: resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escalade@^3.1.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" - integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== - escape-goat@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/escape-goat/-/escape-goat-4.0.0.tgz" @@ -4579,7 +4458,7 @@ feed@^4.2.2: dependencies: xml-js "^1.6.11" -file-loader@^6.2.0: +file-loader@*, file-loader@^6.2.0: version "6.2.0" resolved "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz" integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw== @@ -4882,16 +4761,16 @@ got@^12.1.0: p-cancelable "^3.0.0" responselike "^3.0.0" -graceful-fs@4.2.10: - version "4.2.10" - resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +graceful-fs@4.2.10: + version "4.2.10" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + gray-matter@^4.0.3: version "4.0.3" resolved "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz" @@ -5193,6 +5072,16 @@ http-deceiver@^1.2.7: resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz" integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + http-errors@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz" @@ -5204,16 +5093,6 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" -http-errors@~1.6.2: - version "1.6.3" - resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" - integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" - http-parser-js@>=0.5.1: version "0.5.8" resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz" @@ -5329,7 +5208,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: +inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3, inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -5339,16 +5218,16 @@ inherits@2.0.3: resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== -ini@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz" - integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== - ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.8" resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== +ini@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz" + integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== + inline-style-parser@0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz" @@ -5359,16 +5238,16 @@ inline-style-parser@0.2.3: resolved "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.3.tgz" integrity sha512-qlD8YNDqyTKTyuITrDOffsl6Tdhv+UC4hcdAVuQsK4IMQ99nSgd1MIA/Q+jQYoh9r3hVUXhYh7urSRmXPkW04g== -"internmap@1 - 2": - version "2.0.3" - resolved "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz" - integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== - internmap@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz" integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== +"internmap@1 - 2": + version "2.0.3" + resolved "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz" + integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== + interpret@^1.0.0: version "1.4.0" resolved "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz" @@ -5381,16 +5260,16 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - ipaddr.js@^2.0.1: version "2.1.0" resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz" integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + is-alphabetical@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz" @@ -5566,16 +5445,16 @@ is-yarn-global@^0.4.0: resolved "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.4.1.tgz" integrity sha512-/kppl+R+LO5VmhYSEWARUFjodS25D68gvj8W7z0I7OWhUla5xWu8KL6CtB2V0R6yqhnRgbcaREMr4EEM6htLPQ== -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== - isarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -6807,7 +6686,7 @@ micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.3" picomatch "^2.3.1" -mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": +"mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== @@ -6817,14 +6696,40 @@ mime-db@~1.33.0: resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz" integrity sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ== -mime-types@2.1.18, mime-types@~2.1.17: +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.27: + version "2.1.35" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime-types@^2.1.31: + version "2.1.35" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime-types@~2.1.17, mime-types@2.1.18: version "2.1.18" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz" integrity sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ== dependencies: mime-db "~1.33.0" -mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@~2.1.24: + version "2.1.35" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime-types@~2.1.34: version "2.1.35" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -6863,7 +6768,7 @@ minimalistic-assert@^1.0.0: resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimatch@3.1.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -6951,11 +6856,6 @@ node-releases@^2.0.14: resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== -node-releases@^2.0.18: - version "2.0.18" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" - integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== - non-layered-tidy-tree-layout@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz" @@ -7254,6 +7154,13 @@ path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" @@ -7264,13 +7171,6 @@ path-to-regexp@2.2.1: resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz" integrity sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ== -path-to-regexp@^1.7.0: - version "1.8.0" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" - integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== - dependencies: - isarray "0.0.1" - path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -7290,11 +7190,6 @@ picocolors@^1.0.0: resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picocolors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" - integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== - picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" @@ -7595,7 +7490,7 @@ postcss-zindex@^5.1.0: resolved "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-5.1.0.tgz" integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== -postcss@^8.4.17, postcss@^8.4.21, postcss@^8.4.26: +"postcss@^7.0.0 || ^8.0.1", postcss@^8.0.9, postcss@^8.1.0, postcss@^8.2.15, postcss@^8.2.2, postcss@^8.4.16, postcss@^8.4.17, postcss@^8.4.21, postcss@^8.4.26: version "8.4.32" resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz" integrity sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw== @@ -7718,16 +7613,21 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz" - integrity sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A== +range-parser@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -range-parser@^1.2.1, range-parser@~1.2.1: +range-parser@~1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== +range-parser@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz" + integrity sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A== + raw-body@2.5.2: version "2.5.2" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz" @@ -7778,7 +7678,7 @@ react-dev-utils@^12.0.1: strip-ansi "^6.0.1" text-table "^0.2.0" -react-dom@^18.0.0: +react-dom@*, "react-dom@^16.14.0 || 17 || ^18", "react-dom@^16.6.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, "react-dom@>= 16.8.0 < 19.0.0": version "18.2.0" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -7824,7 +7724,7 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1: dependencies: "@babel/runtime" "^7.10.3" -"react-loadable@npm:@docusaurus/react-loadable@5.5.2": +react-loadable@*, "react-loadable@npm:@docusaurus/react-loadable@5.5.2": version "5.5.2" resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz" integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ== @@ -7863,7 +7763,7 @@ react-router-dom@^5.3.4: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react-router@5.3.4, react-router@^5.3.4: +react-router@^5.3.4, react-router@>=5, react-router@5.3.4: version "5.3.4" resolved "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz" integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA== @@ -7878,7 +7778,7 @@ react-router@5.3.4, react-router@^5.3.4: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" -react@^18.0.0: +react@*, "react@^16.13.1 || ^17.0.0 || ^18.0.0", "react@^16.14.0 || ^17 || ^18", "react@^16.6.0 || ^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16.8.0 < 19.0.0", react@>=15, react@>=16, react@>=16.0.0, react@>=16.6.0: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -8198,15 +8098,20 @@ sade@^1.7.3: dependencies: mri "^1.1.0" -safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@^5.1.0, safe-buffer@>=5.1.0, safe-buffer@~5.2.0, safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== +safe-buffer@5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" @@ -8225,16 +8130,25 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -schema-utils@2.7.0: - version "2.7.0" - resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz" - integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== +schema-utils@^3.0.0: + version "3.3.0" + resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== dependencies: - "@types/json-schema" "^7.0.4" - ajv "^6.12.2" - ajv-keywords "^3.4.1" + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + +schema-utils@^3.1.1: + version "3.3.0" + resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" -schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0: +schema-utils@^3.2.0: version "3.3.0" resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz" integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== @@ -8253,6 +8167,20 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.1.0" +schema-utils@2.7.0: + version "2.7.0" + resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz" + integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== + dependencies: + "@types/json-schema" "^7.0.4" + ajv "^6.12.2" + ajv-keywords "^3.4.1" + +"search-insights@>= 1 < 3": + version "2.13.0" + resolved "https://registry.npmjs.org/search-insights/-/search-insights-2.13.0.tgz" + integrity sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw== + section-matter@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz" @@ -8499,7 +8427,12 @@ source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0: +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +source-map@^0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -8509,6 +8442,11 @@ source-map@^0.7.0: resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz" integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== +source-map@~0.6.0: + version "0.6.1" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + space-separated-tokens@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz" @@ -8552,22 +8490,45 @@ stable@^0.1.8: resolved "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz" integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - "statuses@>= 1.4.0 < 2": version "1.5.0" resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + std-env@^3.0.1: version "3.6.0" resolved "https://registry.npmjs.org/std-env/-/std-env-3.6.0.tgz" integrity sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg== -string-width@^4.1.0, string-width@^4.2.0: +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +string-width@^4.1.0: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.2.0: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -8585,20 +8546,6 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - stringify-entities@^4.0.0: version "4.0.4" resolved "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz" @@ -8731,9 +8678,9 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0: resolved "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== -terser-webpack-plugin@^5.3.10: +terser-webpack-plugin@^5.3.10, terser-webpack-plugin@^5.3.9: version "5.3.10" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz" integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== dependencies: "@jridgewell/trace-mapping" "^0.3.20" @@ -8742,18 +8689,7 @@ terser-webpack-plugin@^5.3.10: serialize-javascript "^6.0.1" terser "^5.26.0" -terser-webpack-plugin@^5.3.9: - version "5.3.9" - resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz" - integrity sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.17" - jest-worker "^27.4.5" - schema-utils "^3.1.1" - serialize-javascript "^6.0.1" - terser "^5.16.8" - -terser@^5.10.0, terser@^5.15.1, terser@^5.16.8: +terser@^5.10.0, terser@^5.15.1, terser@^5.26.0: version "5.26.0" resolved "https://registry.npmjs.org/terser/-/terser-5.26.0.tgz" integrity sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ== @@ -8763,16 +8699,6 @@ terser@^5.10.0, terser@^5.15.1, terser@^5.16.8: commander "^2.20.0" source-map-support "~0.5.20" -terser@^5.26.0: - version "5.31.6" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.6.tgz#c63858a0f0703988d0266a82fcbf2d7ba76422b1" - integrity sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.8.2" - commander "^2.20.0" - source-map-support "~0.5.20" - text-table@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" @@ -8860,6 +8786,9 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +"typescript@>= 2.7", typescript@>=4.9.5: + version "5.3.3" + undici-types@~5.26.4: version "5.26.5" resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" @@ -8978,7 +8907,7 @@ universalify@^2.0.0: resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0, unpipe@~1.0.0: +unpipe@~1.0.0, unpipe@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -8991,14 +8920,6 @@ update-browserslist-db@^1.0.13: escalade "^3.1.1" picocolors "^1.0.0" -update-browserslist-db@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" - integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== - dependencies: - escalade "^3.1.2" - picocolors "^1.0.1" - update-notifier@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/update-notifier/-/update-notifier-6.0.2.tgz" @@ -9112,7 +9033,7 @@ vfile@^6.0.0, vfile@^6.0.1: watchpack@^2.4.1: version "2.4.2" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + resolved "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz" integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== dependencies: glob-to-regexp "^0.4.1" @@ -9215,9 +9136,9 @@ webpack-sources@^3.2.3: resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.88.1: +"webpack@^4.0.0 || ^5.0.0", "webpack@^4.37.0 || ^5.0.0", webpack@^5.0.0, webpack@^5.1.0, webpack@^5.20.0, webpack@^5.88.1, "webpack@>= 4", "webpack@>=4.41.1 || 5.x", webpack@>=5, "webpack@3 || 4 || 5": version "5.94.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" + resolved "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz" integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== dependencies: "@types/estree" "^1.0.5" @@ -9254,7 +9175,7 @@ webpackbar@^5.0.2: pretty-time "^1.1.0" std-env "^3.0.1" -websocket-driver@>=0.5.1, websocket-driver@^0.7.4: +websocket-driver@^0.7.4, websocket-driver@>=0.5.1: version "0.7.4" resolved "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz" integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== From 63573f26cf7d3f372f5d64d369603b36f5f4be0c Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Wed, 4 Sep 2024 21:10:27 +0200 Subject: [PATCH 38/48] [Tilt] Enable rest service by default in Tilt (#793) ## Summary Enable the `rest` service by default in Tilt ## Issue Since the `rest` service is used in E2E tests, it should be enabled by default to avoid non-edited `localnet_config.yaml` files to succeed E2E tests. ![image](https://github.com/user-attachments/assets/88ac37ca-bf9f-4146-83f1-2eafc2f3c829) ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [ ] I have tested my changes using the available tooling - [ ] I have commented my code - [ ] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --- Tiltfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tiltfile b/Tiltfile index 1843c0d36..e6d0e8bcf 100644 --- a/Tiltfile +++ b/Tiltfile @@ -53,7 +53,7 @@ localnet_config_defaults = { "model": "qwen:0.5b", }, "rest": { - "enabled": False, + "enabled": True, }, # By default, we use the `helm_repo` function below to point to the remote repository # but can update it to the locally cloned repo for testing & development From 4343be26373534fb68d9ecd0a6e62c8a1d737e7c Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:38:37 -0400 Subject: [PATCH 39/48] Reply to a few small review comments --- pkg/relayer/session/sessiontree.go | 5 +++-- x/tokenomics/keeper/token_logic_modules.go | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 73c0c86f8..18e3ec607 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -22,8 +22,9 @@ var _ relayer.SessionTree = (*sessionTree)(nil) // TODO_BETA(@red-0ne): Per the Relay Mining paper, we need to optimistically store // the number of requests that an application can pay for. This needs to be tracked // based on the app's stake in the beginning of a session and the number of nodes -// per session. An operator should be able to specify "overservicing_okay" whereby -// it keeps replying to requests even though it may not get paid for them. +// per session. An operator should be able to specify "overservicing_compute_units_limit" +// whereby an upper bound on how much it can overservice an application is set. The +// default value for this should be -1, implying "unlimited". // Ref discussion: https://github.com/pokt-network/poktroll/pull/755#discussion_r1737287860 type sessionTree struct { // sessionMu is a mutex used to protect sessionTree operations from concurrent access. diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index cecf7c17a..ca4c86c4b 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -54,7 +54,8 @@ const ( // TLMRelayBurnEqualsMint is the token logic module that burns the application's // stake balance based on the amount of work done by the supplier. // The same amount of tokens is minted and added to the supplier account balance. - // When the network achieves equilibrium, this is theoretically the only TLM that will be necessary. + // When the network achieves maturity in the far future, this is theoretically + // the only TLM that will be necessary. TLMRelayBurnEqualsMint TokenLogicModule = iota // TLMGlobalMint is the token logic module that mints new tokens based on the @@ -169,6 +170,8 @@ func (k Keeper) ProcessTokenLogicModules( if err != nil { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("%v", err) } + // TODO_MAINNET(@bryanchriswhite, @red-0ne): Fix the low-volume exploit here. + // https://www.notion.so/buildwithgrove/RelayMiningDifficulty-and-low-volume-7aab3edf6f324786933af369c2fa5f01?pvs=4 if numRelays == 0 { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrap("root hash has zero relays") } @@ -349,6 +352,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") if MintPerClaimedTokenGlobalInflation == 0 { + // TODO_UPNEXT(@olshansk): Make sure to skip GMRR TLM in this case as well. logger.Warn("global inflation is set to zero. Skipping Global Mint TLM.") return nil } From 4fd00d827313a6b26b8acecb26129acc1f8ebab7 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Wed, 4 Sep 2024 17:57:26 -0400 Subject: [PATCH 40/48] Reply to a few small review comments --- e2e/tests/init_test.go | 1 - x/session/types/types.pb.go | 16 ++++-- x/tokenomics/keeper/token_logic_modules.go | 61 ++++++++++++---------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 2fcad22b7..6f017504f 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -337,7 +337,6 @@ func (s *suite) getConfigFileContent( default: s.Fatalf("ERROR: unknown actor type %s", actorType) } - fmt.Println(yaml.NormalizeYAMLIndentation(configContent)) return yaml.NormalizeYAMLIndentation(configContent) } diff --git a/x/session/types/types.pb.go b/x/session/types/types.pb.go index 15401690c..c225922e4 100644 --- a/x/session/types/types.pb.go +++ b/x/session/types/types.pb.go @@ -5,14 +5,16 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + types1 "github.com/pokt-network/poktroll/x/application/types" types "github.com/pokt-network/poktroll/x/shared/types" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -106,7 +108,7 @@ func (m *SessionHeader) GetSessionEndBlockHeight() int64 { } // Session is a fully hydrated session object that contains all the information for the Session -// and its parcipants. +// and its participants. type Session struct { Header *SessionHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` @@ -114,6 +116,12 @@ type Session struct { NumBlocksPerSession int64 `protobuf:"varint,4,opt,name=num_blocks_per_session,json=numBlocksPerSession,proto3" json:"num_blocks_per_session,omitempty"` Application *types1.Application `protobuf:"bytes,5,opt,name=application,proto3" json:"application,omitempty"` Suppliers []*types.Supplier `protobuf:"bytes,6,rep,name=suppliers,proto3" json:"suppliers,omitempty"` + // TODO_MAINNET(@bryanchriswhite): Add a RelayMining field that can be used for UX/DevX + // purposes capturing things like: + // - The probability of a proof being required for this session + // - The threshold of the probability that triggers a proof definitively + // - The maximum claimable pokt per supplier in this session + // See the discussion here: https://github.com/pokt-network/poktroll/pull/755#discussion_r1743286043 } func (m *Session) Reset() { *m = Session{} } diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index ca4c86c4b..9df12ba5f 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -113,9 +113,14 @@ func init() { // then TLMGlobalMintReimbursementRequest will need to be there too. } -// ProcessTokenLogicModules is the entrypoint for all TLM processing. It is responsible for running -// all the independent TLMs necessary to limit, burn, mint or transfer tokens as a result of the +// ProcessTokenLogicModules is the entrypoint for all TLM processing. +// +// It is responsible for running all the independent TLMs necessary to limit, burn, mint or transfer tokens as a result of the // amount of work (i.e. relays, compute units) done in proportion to the global governance parameters. +// +// Prior to running the TLMs, it handles the business logic of converting the claimed +// amount to the actual settlement amount and handling the case for overserviced applications. +// // IMPORTANT: It is assumed that the proof for the claim has been validated BEFORE calling this function. func (k Keeper) ProcessTokenLogicModules( ctx context.Context, @@ -285,56 +290,56 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( _ *sessiontypes.SessionHeader, application *apptypes.Application, supplier *sharedtypes.Supplier, - settlementCoin cosmostypes.Coin, + actualSettlementCoin cosmostypes.Coin, // Note that actualSettlementCoin may differ from claimSettlementCoin; see ensureClaimAmountLimits for details. relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error { logger := k.Logger().With("method", "TokenLogicModuleRelayBurnEqualsMint") - // DEV_NOTE: We are doing a mint & burn + transfer, instead of a simple transfer + // DEV_NOTE: We are doing a burn & mint + transfer instead of a simple transfer // of funds from the application stake to the supplier balance in order to enable second // order economic effects with more optionality. This could include funds // going to pnf, delegators, enabling bonuses/rebates, etc... + // Update the application's on-chain stake + newAppStake, err := application.Stake.SafeSub(actualSettlementCoin) + if err != nil { + return tokenomicstypes.ErrTokenomicsApplicationNewStakeInvalid.Wrapf("application %q stake cannot be reduced to a negative amount %v", application.Address, newAppStake) + } + application.Stake = &newAppStake + logger.Info(fmt.Sprintf("updated application %q stake to %v", application.Address, newAppStake)) + + // Burn uPOKT from the application module account which was held in escrow + // on behalf of the application account. + if err := k.bankKeeper.BurnCoins( + ctx, apptypes.ModuleName, sdk.NewCoins(actualSettlementCoin), + ); err != nil { + return tokenomicstypes.ErrTokenomicsApplicationModuleBurn.Wrapf("burning %s from the application module account: %v", actualSettlementCoin, err) + } + logger.Info(fmt.Sprintf("burned (%v) from the application module account", actualSettlementCoin)) + // Mint new uPOKT to the supplier module account. // These funds will be transferred to the supplier's shareholders below. // For reference, see operate/configs/supplier_staking_config.md. if err := k.bankKeeper.MintCoins( - ctx, suppliertypes.ModuleName, sdk.NewCoins(settlementCoin), + ctx, suppliertypes.ModuleName, sdk.NewCoins(actualSettlementCoin), ); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleSendFailed.Wrapf( "minting %s to the supplier module account: %v", - settlementCoin, + actualSettlementCoin, err, ) } - logger.Info(fmt.Sprintf("minted (%v) coins in the supplier module", settlementCoin)) + logger.Info(fmt.Sprintf("minted (%v) coins in the supplier module", actualSettlementCoin)) // Distribute the rewards to the supplier's shareholders based on the rev share percentage. - if err := k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, settlementCoin.Amount.Uint64()); err != nil { + if err := k.distributeSupplierRewardsToShareHolders(ctx, supplier, service.Id, actualSettlementCoin.Amount.Uint64()); err != nil { return tokenomicstypes.ErrTokenomicsSupplierModuleMintFailed.Wrapf( "distributing rewards to supplier with operator address %s shareholders: %v", supplier.OperatorAddress, err, ) } - logger.Info(fmt.Sprintf("sent (%v) from the supplier module to the supplier account with address %q", settlementCoin, supplier.OperatorAddress)) - - // Burn uPOKT from the application module account which was held in escrow - // on behalf of the application account. - if err := k.bankKeeper.BurnCoins( - ctx, apptypes.ModuleName, sdk.NewCoins(settlementCoin), - ); err != nil { - return tokenomicstypes.ErrTokenomicsApplicationModuleBurn.Wrapf("burning %s from the application module account: %v", settlementCoin, err) - } - logger.Info(fmt.Sprintf("burned (%v) from the application module account", settlementCoin)) - - // Update the application's on-chain stake - newAppStake, err := application.Stake.SafeSub(settlementCoin) - if err != nil { - return tokenomicstypes.ErrTokenomicsApplicationNewStakeInvalid.Wrapf("application %q stake cannot be reduced to a negative amount %v", application.Address, newAppStake) - } - application.Stake = &newAppStake - logger.Info(fmt.Sprintf("updated application %q stake to %v", application.Address, newAppStake)) + logger.Info(fmt.Sprintf("sent (%v) from the supplier module to the supplier account with address %q", actualSettlementCoin, supplier.OperatorAddress)) return nil } @@ -346,7 +351,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( _ *sessiontypes.SessionHeader, application *apptypes.Application, supplier *sharedtypes.Supplier, - settlementCoin cosmostypes.Coin, + actualSettlementCoin cosmostypes.Coin, // Note that actualSettlementCoin may differ from claimSettlementCoin; see ensureClaimAmountLimits for details. relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error { logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") @@ -358,7 +363,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( } // Determine how much new uPOKT to mint based on global inflation - newMintCoin, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin) + newMintCoin, newMintAmtFloat := calculateGlobalPerClaimMintInflationFromSettlementAmount(actualSettlementCoin) if newMintCoin.Amount.Int64() == 0 { return tokenomicstypes.ErrTokenomicsMintAmountZero } From 8d5b08389556888c946d239a517939a052e772dc Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 5 Sep 2024 13:16:33 -0400 Subject: [PATCH 41/48] Updated compiled proto file --- x/session/types/types.pb.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/x/session/types/types.pb.go b/x/session/types/types.pb.go index c225922e4..15401690c 100644 --- a/x/session/types/types.pb.go +++ b/x/session/types/types.pb.go @@ -5,16 +5,14 @@ package types import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - types1 "github.com/pokt-network/poktroll/x/application/types" types "github.com/pokt-network/poktroll/x/shared/types" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -108,7 +106,7 @@ func (m *SessionHeader) GetSessionEndBlockHeight() int64 { } // Session is a fully hydrated session object that contains all the information for the Session -// and its participants. +// and its parcipants. type Session struct { Header *SessionHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` @@ -116,12 +114,6 @@ type Session struct { NumBlocksPerSession int64 `protobuf:"varint,4,opt,name=num_blocks_per_session,json=numBlocksPerSession,proto3" json:"num_blocks_per_session,omitempty"` Application *types1.Application `protobuf:"bytes,5,opt,name=application,proto3" json:"application,omitempty"` Suppliers []*types.Supplier `protobuf:"bytes,6,rep,name=suppliers,proto3" json:"suppliers,omitempty"` - // TODO_MAINNET(@bryanchriswhite): Add a RelayMining field that can be used for UX/DevX - // purposes capturing things like: - // - The probability of a proof being required for this session - // - The threshold of the probability that triggers a proof definitively - // - The maximum claimable pokt per supplier in this session - // See the discussion here: https://github.com/pokt-network/poktroll/pull/755#discussion_r1743286043 } func (m *Session) Reset() { *m = Session{} } From 4bd0aee8613ab4614d105139764ae977b128f574 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 5 Sep 2024 13:48:00 -0400 Subject: [PATCH 42/48] Empty commit From 66b687895085dee45af42c3f413a12acc8d2d569 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 10:58:00 -0700 Subject: [PATCH 43/48] Minor tx.pb.go fix --- x/tokenomics/types/tx.pb.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index e4fec264c..9f18a148c 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -125,7 +125,6 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // // *MsgUpdateParam_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes From a0dbd579862f346d32a4c064dd2687595d7a8804 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 11:11:43 -0700 Subject: [PATCH 44/48] Empty commit From 8d04dfdad7ea3c3e08fa639db7ca9a197149a20a Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 13:58:39 -0700 Subject: [PATCH 45/48] Added a TODO --- pkg/relayer/proxy/relay_verifier.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go index 50fd55bff..07f031c5e 100644 --- a/pkg/relayer/proxy/relay_verifier.go +++ b/pkg/relayer/proxy/relay_verifier.go @@ -49,6 +49,7 @@ func (rp *relayerProxy) VerifyRelayRequest( }). Msg("verifying relay request session") + // TODO_TECHDEBT(@red-0ne): Optimize this so we don't have to query the session for every relay request. // Query for the current session to check if relayRequest sessionId matches the current session. session, err := rp.sessionQuerier.GetSession( ctx, From d99209877fcbe73da45d194418e477513a57d2f9 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 14:46:48 -0700 Subject: [PATCH 46/48] E2E test fix --- e2e/tests/0_settlement.feature | 12 ++++++------ x/tokenomics/keeper/token_logic_modules.go | 14 ++++++++++---- x/tokenomics/keeper/token_logic_modules_test.go | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index a800079a1..966a3513e 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -16,25 +16,25 @@ Feature: Tokenomics Namespace And the "application" account for "app1" is staked And the service "anvil" registered for application "app1" has a compute units per relay of "1" # Start servicing relays - # Set proof_requirement_threshold to 9 < num_relays (10) * compute_units_per_relay (1) + # Set proof_requirement_threshold to 19 < num_relays (20) * compute_units_per_relay (1) # to make sure a proof is required. And the "proof" module parameters are set as follows | name | value | type | | relay_difficulty_target_hash | ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | bytes | | proof_request_probability | 0.25 | float | - | proof_requirement_threshold | 9 | int64 | + | proof_requirement_threshold | 19 | int64 | | proof_missing_penalty | 320 | coin | | proof_submission_fee | 1000000 | coin | - When the supplier "supplier1" has serviced a session with "10" relays for service "anvil" for application "app1" + When the supplier "supplier1" has serviced a session with "20" relays for service "anvil" for application "app1" # Wait for the Claim & Proof lifecycle 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 ClaimSettled event with "THRESHOLD" proof requirement to be broadcast # Validate the results - 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 + Then the account balance of "supplier1" should be "898" uPOKT "more" than before + And the "application" stake of "app1" should be "840" uPOKT "less" than before - Scenario: Emissions equals burn when a claim is created but a proof is not required + Scenario: TLM Mint=Burn when a valid claim is create but not required # Baseline Given the user has the pocketd binary installed # Network preparation diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 9df12ba5f..7efe8f553 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -38,14 +38,19 @@ const ( MintAllocationSourceOwner = 0.15 MintAllocationApplication = 0.0 - // MintDistributionAllowableTolerance is the percent difference that is allowable + // MintDistributionAllowableTolerancePercent is the percent difference that is allowable // between the number of minted/ tokens in the tokenomics module and what is distributed // to pocket network participants. // This internal constant SHOULD ONLY be used in TokenLogicModuleGlobalMint. // Due to floating point arithmetic, the total amount of minted coins may be slightly // larger than what is distributed to pocket network participants // TODO_MAINNET: Figure out if we can avoid this tolerance and use fixed point arithmetic. - MintDistributionAllowableTolerance = 0.02 + MintDistributionAllowableTolerancePercent = 0.02 // 2% + // MintDistributionAllowableToleranceAbsolution is similar to MintDistributionAllowableTolerancePercent + // but provides an absolute number where the % difference might no be + // meaningful for small absolute numbers. + // TODO_MAINNET: Figure out if we can avoid this tolerance and use fixed point arithmetic. + MintDistributionAllowableToleranceAbs = 5.0 // 5 uPOKT ) type TokenLogicModule int @@ -445,8 +450,9 @@ func (k Keeper) ensureMintedCoinsAreDistributed( percentDifference := new(big.Float).Quo(new(big.Float).SetInt(coinDifference), new(big.Float).SetInt(newMintCoin.Amount.BigInt())) // Helper booleans for readability - isPercentDifferentTooLarge := percentDifference.Cmp(big.NewFloat(MintDistributionAllowableTolerance)) > 0 doesDiscrepancyExist := coinDifference.Cmp(big.NewInt(0)) > 0 + isPercentDifferenceTooLarge := percentDifference.Cmp(big.NewFloat(MintDistributionAllowableTolerancePercent)) > 0 + isAbsDifferenceSignificant := coinDifference.Cmp(big.NewInt(int64(MintDistributionAllowableToleranceAbs))) > 0 // No discrepancy, return early logger.Info(fmt.Sprintf("distributed (%v) coins to the application, supplier, DAO, source owner, and proposer", totalMintDistributedCoin)) @@ -455,7 +461,7 @@ func (k Keeper) ensureMintedCoinsAreDistributed( } // Discrepancy exists and is too large, return an error - if isPercentDifferentTooLarge { + if isPercentDifferenceTooLarge && isAbsDifferenceSignificant { return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 6d2bf122e..3a0712c45 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -414,7 +414,7 @@ func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t balanceIncrease := math.NewInt(mintShare + rewardShare) expectedBalanceAfter := balanceBefore.Amount.Add(balanceIncrease).Int64() // TODO_MAINNET: Remove the InDelta check and use the exact amount once the floating point arithmetic is fixed - acceptableRoundingDelta := tokenomicskeeper.MintDistributionAllowableTolerance * float64(balanceAfter) + acceptableRoundingDelta := tokenomicskeeper.MintDistributionAllowableTolerancePercent * float64(balanceAfter) require.InDelta(t, expectedBalanceAfter, balanceAfter, acceptableRoundingDelta) } } From 5795b5efef922140a26413a976d0c076d2b3c31c Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 15:16:34 -0700 Subject: [PATCH 47/48] Increase run-e2e-tests timeout to 30 minutes from 20 --- .github/workflows/main-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 72f901046..8530c3d23 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -88,7 +88,7 @@ jobs: context: . run-e2e-tests: - timeout-minutes: 20 + timeout-minutes: 30 needs: build-push-container if: contains(github.event.pull_request.labels.*.name, 'devnet-test-e2e') runs-on: ubuntu-latest From 8a42835f4496c0c9308d24a9aaf44ceb49aa6cef Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 9 Sep 2024 15:23:31 -0700 Subject: [PATCH 48/48] Another attempt at fixing E2E tests --- e2e/tests/0_settlement.feature | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index 966a3513e..72d4c4a41 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -6,7 +6,7 @@ # that can be used to clear the state of the chain between tests. Feature: Tokenomics Namespace - Scenario: TLM Mint=Burn when a valid claim is within max limits and a valid proof is submitted and required via threshold + Scenario: Settle the session when a valid claim is within max limits and a valid proof is submitted and required via threshold # Baseline Given the user has the pocketd binary installed # Network preparation and validation @@ -31,10 +31,13 @@ Feature: Tokenomics Namespace And the user should wait for the "proof" module "SubmitProof" Message to be submitted And the user should wait for the ClaimSettled event with "THRESHOLD" proof requirement to be broadcast # Validate the results + # Please note that supplier mint is > app burn because of inflation + # TODO_TECHDEBT: Update this test such the the inflation is set and enforce that Mint=Burn + # Then add a separate test that only validates that inflation is enforced correctly Then the account balance of "supplier1" should be "898" uPOKT "more" than before And the "application" stake of "app1" should be "840" uPOKT "less" than before - Scenario: TLM Mint=Burn when a valid claim is create but not required + Scenario: Settle the session when a valid claim is create but not required # Baseline Given the user has the pocketd binary installed # Network preparation @@ -57,8 +60,10 @@ Feature: Tokenomics Namespace And the user should wait for the "proof" module "CreateClaim" Message to be submitted # No proof should be submitted, don't wait for one. And the user should wait for the ClaimSettled event with "NOT_REQUIRED" proof requirement to be broadcast - # Validate that mint equals burn - Then the account balance of "supplier1" should be "420" uPOKT "more" than before + # Validate the results + # Please note that supplier mint is > app burn because of inflation + # TODO_TECHDEBT: Update this test such the the inflation is set and enforce that Mint=Burn + Then the account balance of "supplier1" should be "449" uPOKT "more" than before And the "application" stake of "app1" should be "420" uPOKT "less" than before # TODO_ADDTEST: Implement the following scenarios