diff --git a/api/poktroll/migration/event.pulsar.go b/api/poktroll/migration/event.pulsar.go index c9cfc5543..d124164c8 100644 --- a/api/poktroll/migration/event.pulsar.go +++ b/api/poktroll/migration/event.pulsar.go @@ -3,11 +3,12 @@ package migration import ( _ "cosmossdk.io/api/cosmos/base/v1beta1" - _ "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + _ "github.com/pokt-network/poktroll/api/poktroll/shared" + prot protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -17,16 +18,18 @@ import ( ) var ( - md_EventCreateMorseAccountState protoreflect.MessageDescriptor - fd_EventCreateMorseAccountState_height protoreflect.FieldDescriptor - fd_EventCreateMorseAccountState_state_hash protoreflect.FieldDescriptor + md_EventCreateMorseAccountState protoreflect.MessageDescriptor + fd_EventCreateMorseAccountState_created_at_height protoreflect.FieldDescriptor + fd_EventCreateMorseAccountState_morse_account_state_hash protoreflect.FieldDescriptor + fd_EventCreateMorseAccountState_num_accounts protoreflect.FieldDescriptor ) func init() { file_poktroll_migration_event_proto_init() md_EventCreateMorseAccountState = File_poktroll_migration_event_proto.Messages().ByName("EventCreateMorseAccountState") - fd_EventCreateMorseAccountState_height = md_EventCreateMorseAccountState.Fields().ByName("height") - fd_EventCreateMorseAccountState_state_hash = md_EventCreateMorseAccountState.Fields().ByName("state_hash") + fd_EventCreateMorseAccountState_created_at_height = md_EventCreateMorseAccountState.Fields().ByName("created_at_height") + fd_EventCreateMorseAccountState_morse_account_state_hash = md_EventCreateMorseAccountState.Fields().ByName("morse_account_state_hash") + fd_EventCreateMorseAccountState_num_accounts = md_EventCreateMorseAccountState.Fields().ByName("num_accounts") } var _ protoreflect.Message = (*fastReflection_EventCreateMorseAccountState)(nil) @@ -94,15 +97,21 @@ func (x *fastReflection_EventCreateMorseAccountState) Interface() protoreflect.P // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateMorseAccountState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Height != int64(0) { - value := protoreflect.ValueOfInt64(x.Height) - if !f(fd_EventCreateMorseAccountState_height, value) { + if x.CreatedAtHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.CreatedAtHeight) + if !f(fd_EventCreateMorseAccountState_created_at_height, value) { + return + } + } + if len(x.MorseAccountStateHash) != 0 { + value := protoreflect.ValueOfBytes(x.MorseAccountStateHash) + if !f(fd_EventCreateMorseAccountState_morse_account_state_hash, value) { return } } - if len(x.StateHash) != 0 { - value := protoreflect.ValueOfBytes(x.StateHash) - if !f(fd_EventCreateMorseAccountState_state_hash, value) { + if x.NumAccounts != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumAccounts) + if !f(fd_EventCreateMorseAccountState_num_accounts, value) { return } } @@ -121,10 +130,12 @@ func (x *fastReflection_EventCreateMorseAccountState) Range(f func(protoreflect. // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateMorseAccountState) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": - return x.Height != int64(0) - case "poktroll.migration.EventCreateMorseAccountState.state_hash": - return len(x.StateHash) != 0 + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": + return x.CreatedAtHeight != int64(0) + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": + return len(x.MorseAccountStateHash) != 0 + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + return x.NumAccounts != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -141,10 +152,12 @@ func (x *fastReflection_EventCreateMorseAccountState) Has(fd protoreflect.FieldD // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateMorseAccountState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": - x.Height = int64(0) - case "poktroll.migration.EventCreateMorseAccountState.state_hash": - x.StateHash = nil + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": + x.CreatedAtHeight = int64(0) + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": + x.MorseAccountStateHash = nil + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + x.NumAccounts = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -161,12 +174,15 @@ func (x *fastReflection_EventCreateMorseAccountState) Clear(fd protoreflect.Fiel // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateMorseAccountState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": - value := x.Height + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": + value := x.CreatedAtHeight return protoreflect.ValueOfInt64(value) - case "poktroll.migration.EventCreateMorseAccountState.state_hash": - value := x.StateHash + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": + value := x.MorseAccountStateHash return protoreflect.ValueOfBytes(value) + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + value := x.NumAccounts + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -187,10 +203,12 @@ func (x *fastReflection_EventCreateMorseAccountState) Get(descriptor protoreflec // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateMorseAccountState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": - x.Height = value.Int() - case "poktroll.migration.EventCreateMorseAccountState.state_hash": - x.StateHash = value.Bytes() + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": + x.CreatedAtHeight = value.Int() + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": + x.MorseAccountStateHash = value.Bytes() + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + x.NumAccounts = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -211,10 +229,12 @@ func (x *fastReflection_EventCreateMorseAccountState) Set(fd protoreflect.FieldD // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateMorseAccountState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": - panic(fmt.Errorf("field height of message poktroll.migration.EventCreateMorseAccountState is not mutable")) - case "poktroll.migration.EventCreateMorseAccountState.state_hash": - panic(fmt.Errorf("field state_hash of message poktroll.migration.EventCreateMorseAccountState is not mutable")) + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": + panic(fmt.Errorf("field created_at_height of message poktroll.migration.EventCreateMorseAccountState is not mutable")) + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": + panic(fmt.Errorf("field morse_account_state_hash of message poktroll.migration.EventCreateMorseAccountState is not mutable")) + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + panic(fmt.Errorf("field num_accounts of message poktroll.migration.EventCreateMorseAccountState is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -228,10 +248,12 @@ func (x *fastReflection_EventCreateMorseAccountState) Mutable(fd protoreflect.Fi // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateMorseAccountState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.EventCreateMorseAccountState.height": + case "poktroll.migration.EventCreateMorseAccountState.created_at_height": return protoreflect.ValueOfInt64(int64(0)) - case "poktroll.migration.EventCreateMorseAccountState.state_hash": + case "poktroll.migration.EventCreateMorseAccountState.morse_account_state_hash": return protoreflect.ValueOfBytes(nil) + case "poktroll.migration.EventCreateMorseAccountState.num_accounts": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.EventCreateMorseAccountState")) @@ -301,13 +323,16 @@ func (x *fastReflection_EventCreateMorseAccountState) ProtoMethods() *protoiface var n int var l int _ = l - if x.Height != 0 { - n += 1 + runtime.Sov(uint64(x.Height)) + if x.CreatedAtHeight != 0 { + n += 1 + runtime.Sov(uint64(x.CreatedAtHeight)) } - l = len(x.StateHash) + l = len(x.MorseAccountStateHash) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.NumAccounts != 0 { + n += 1 + runtime.Sov(uint64(x.NumAccounts)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -337,15 +362,20 @@ func (x *fastReflection_EventCreateMorseAccountState) ProtoMethods() *protoiface i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.StateHash) > 0 { - i -= len(x.StateHash) - copy(dAtA[i:], x.StateHash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StateHash))) + if x.NumAccounts != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumAccounts)) + i-- + dAtA[i] = 0x18 + } + if len(x.MorseAccountStateHash) > 0 { + i -= len(x.MorseAccountStateHash) + copy(dAtA[i:], x.MorseAccountStateHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MorseAccountStateHash))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if x.Height != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Height)) + if x.CreatedAtHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.CreatedAtHeight)) i-- dAtA[i] = 0x8 } @@ -400,9 +430,9 @@ func (x *fastReflection_EventCreateMorseAccountState) ProtoMethods() *protoiface switch fieldNum { case 1: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreatedAtHeight", wireType) } - x.Height = 0 + x.CreatedAtHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -412,14 +442,14 @@ func (x *fastReflection_EventCreateMorseAccountState) ProtoMethods() *protoiface } b := dAtA[iNdEx] iNdEx++ - x.Height |= int64(b&0x7F) << shift + x.CreatedAtHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - case 3: + case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StateHash", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MorseAccountStateHash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -446,11 +476,30 @@ func (x *fastReflection_EventCreateMorseAccountState) ProtoMethods() *protoiface if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.StateHash = append(x.StateHash[:0], dAtA[iNdEx:postIndex]...) - if x.StateHash == nil { - x.StateHash = []byte{} + x.MorseAccountStateHash = append(x.MorseAccountStateHash[:0], dAtA[iNdEx:postIndex]...) + if x.MorseAccountStateHash == nil { + x.MorseAccountStateHash = []byte{} } iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumAccounts", wireType) + } + x.NumAccounts = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumAccounts |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -499,14 +548,19 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// EventUploadMorseState is emitted when a new state hash is uploaded. +// EventUploadMorseState is emitted when the MorseAccountState is created on-chain. type EventCreateMorseAccountState struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - StateHash []byte `protobuf:"bytes,3,opt,name=state_hash,json=stateHash,proto3" json:"state_hash,omitempty"` + // The height (on Shannon) at which the MorseAccountState was created on-chain. + CreatedAtHeight int64 `protobuf:"varint,1,opt,name=created_at_height,json=createdAtHeight,proto3" json:"created_at_height,omitempty"` + // The sha256 has of the MorseAccountState. + MorseAccountStateHash []byte `protobuf:"bytes,2,opt,name=morse_account_state_hash,json=morseAccountStateHash,proto3" json:"morse_account_state_hash,omitempty"` + // The number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. + NumAccounts uint64 `protobuf:"varint,3,opt,name=num_accounts,json=numAccounts,proto3" json:"num_accounts,omitempty"` } func (x *EventCreateMorseAccountState) Reset() { @@ -529,20 +583,27 @@ func (*EventCreateMorseAccountState) Descriptor() ([]byte, []int) { return file_poktroll_migration_event_proto_rawDescGZIP(), []int{0} } -func (x *EventCreateMorseAccountState) GetHeight() int64 { +func (x *EventCreateMorseAccountState) GetCreatedAtHeight() int64 { if x != nil { - return x.Height + return x.CreatedAtHeight } return 0 } -func (x *EventCreateMorseAccountState) GetStateHash() []byte { +func (x *EventCreateMorseAccountState) GetMorseAccountStateHash() []byte { if x != nil { - return x.StateHash + return x.MorseAccountStateHash } return nil } +func (x *EventCreateMorseAccountState) GetNumAccounts() uint64 { + if x != nil { + return x.NumAccounts + } + return 0 +} + var File_poktroll_migration_event_proto protoreflect.FileDescriptor var file_poktroll_migration_event_proto_rawDesc = []byte{ @@ -558,26 +619,34 @@ var file_poktroll_migration_event_proto_rawDesc = []byte{ 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x71, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x22, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0xea, 0xde, - 0x1f, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x09, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x42, 0xb6, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 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, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, - 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xed, 0x01, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x41, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x55, 0x0a, 0x18, 0x6d, 0x6f, 0x72, 0x73, + 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x1c, 0xea, 0xde, 0x1f, 0x18, + 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x15, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x33, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x10, 0xea, 0xde, 0x1f, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x42, 0xb6, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/migration/legacy.pulsar.go b/api/poktroll/migration/legacy.pulsar.go index 0d11253c0..22ddc0d33 100644 --- a/api/poktroll/migration/legacy.pulsar.go +++ b/api/poktroll/migration/legacy.pulsar.go @@ -1599,29 +1599,1071 @@ func (x *fastReflection_MorseApplications) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MorseAuth_1_list)(nil) + +type _MorseAuth_1_list struct { + list *[]*MorseAuthAccount +} + +func (x *_MorseAuth_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MorseAuth_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MorseAuth_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*MorseAuthAccount) + (*x.list)[i] = concreteValue +} + +func (x *_MorseAuth_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*MorseAuthAccount) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MorseAuth_1_list) AppendMutable() protoreflect.Value { + v := new(MorseAuthAccount) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MorseAuth_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MorseAuth_1_list) NewElement() protoreflect.Value { + v := new(MorseAuthAccount) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MorseAuth_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MorseAuth protoreflect.MessageDescriptor + fd_MorseAuth_accounts protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_migration_legacy_proto_init() + md_MorseAuth = File_poktroll_migration_legacy_proto.Messages().ByName("MorseAuth") + fd_MorseAuth_accounts = md_MorseAuth.Fields().ByName("accounts") +} + +var _ protoreflect.Message = (*fastReflection_MorseAuth)(nil) + +type fastReflection_MorseAuth MorseAuth + +func (x *MorseAuth) ProtoReflect() protoreflect.Message { + return (*fastReflection_MorseAuth)(x) +} + +func (x *MorseAuth) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_migration_legacy_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MorseAuth_messageType fastReflection_MorseAuth_messageType +var _ protoreflect.MessageType = fastReflection_MorseAuth_messageType{} + +type fastReflection_MorseAuth_messageType struct{} + +func (x fastReflection_MorseAuth_messageType) Zero() protoreflect.Message { + return (*fastReflection_MorseAuth)(nil) +} +func (x fastReflection_MorseAuth_messageType) New() protoreflect.Message { + return new(fastReflection_MorseAuth) +} +func (x fastReflection_MorseAuth_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MorseAuth +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MorseAuth) Descriptor() protoreflect.MessageDescriptor { + return md_MorseAuth +} + +// 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_MorseAuth) Type() protoreflect.MessageType { + return _fastReflection_MorseAuth_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MorseAuth) New() protoreflect.Message { + return new(fastReflection_MorseAuth) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MorseAuth) Interface() protoreflect.ProtoMessage { + return (*MorseAuth)(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_MorseAuth) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Accounts) != 0 { + value := protoreflect.ValueOfList(&_MorseAuth_1_list{list: &x.Accounts}) + if !f(fd_MorseAuth_accounts, 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_MorseAuth) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.migration.MorseAuth.accounts": + return len(x.Accounts) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.migration.MorseAuth.accounts": + x.Accounts = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.migration.MorseAuth.accounts": + if len(x.Accounts) == 0 { + return protoreflect.ValueOfList(&_MorseAuth_1_list{}) + } + listValue := &_MorseAuth_1_list{list: &x.Accounts} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.migration.MorseAuth.accounts": + lv := value.List() + clv := lv.(*_MorseAuth_1_list) + x.Accounts = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.migration.MorseAuth.accounts": + if x.Accounts == nil { + x.Accounts = []*MorseAuthAccount{} + } + value := &_MorseAuth_1_list{list: &x.Accounts} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.migration.MorseAuth.accounts": + list := []*MorseAuthAccount{} + return protoreflect.ValueOfList(&_MorseAuth_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuth 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_MorseAuth) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseAuth", 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_MorseAuth) 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_MorseAuth) 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_MorseAuth) 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_MorseAuth) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MorseAuth) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Accounts) > 0 { + for _, e := range x.Accounts { + l = options.Size(e) + 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().(*MorseAuth) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Accounts) > 0 { + for iNdEx := len(x.Accounts) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Accounts[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MorseAuth) + 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: MorseAuth: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuth: 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 Accounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Accounts = append(x.Accounts, &MorseAuthAccount{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Accounts[len(x.Accounts)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MorseAuthAccount protoreflect.MessageDescriptor + fd_MorseAuthAccount_Type protoreflect.FieldDescriptor + fd_MorseAuthAccount_Value protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_migration_legacy_proto_init() + md_MorseAuthAccount = File_poktroll_migration_legacy_proto.Messages().ByName("MorseAuthAccount") + fd_MorseAuthAccount_Type = md_MorseAuthAccount.Fields().ByName("Type") + fd_MorseAuthAccount_Value = md_MorseAuthAccount.Fields().ByName("Value") +} + +var _ protoreflect.Message = (*fastReflection_MorseAuthAccount)(nil) + +type fastReflection_MorseAuthAccount MorseAuthAccount + +func (x *MorseAuthAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_MorseAuthAccount)(x) +} + +func (x *MorseAuthAccount) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_migration_legacy_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_MorseAuthAccount_messageType fastReflection_MorseAuthAccount_messageType +var _ protoreflect.MessageType = fastReflection_MorseAuthAccount_messageType{} + +type fastReflection_MorseAuthAccount_messageType struct{} + +func (x fastReflection_MorseAuthAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_MorseAuthAccount)(nil) +} +func (x fastReflection_MorseAuthAccount_messageType) New() protoreflect.Message { + return new(fastReflection_MorseAuthAccount) +} +func (x fastReflection_MorseAuthAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MorseAuthAccount +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MorseAuthAccount) Descriptor() protoreflect.MessageDescriptor { + return md_MorseAuthAccount +} + +// 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_MorseAuthAccount) Type() protoreflect.MessageType { + return _fastReflection_MorseAuthAccount_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MorseAuthAccount) New() protoreflect.Message { + return new(fastReflection_MorseAuthAccount) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MorseAuthAccount) Interface() protoreflect.ProtoMessage { + return (*MorseAuthAccount)(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_MorseAuthAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Type_ != "" { + value := protoreflect.ValueOfString(x.Type_) + if !f(fd_MorseAuthAccount_Type, value) { + return + } + } + if x.Value != nil { + value := protoreflect.ValueOfMessage(x.Value.ProtoReflect()) + if !f(fd_MorseAuthAccount_Value, 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_MorseAuthAccount) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.migration.MorseAuthAccount.Type": + return x.Type_ != "" + case "poktroll.migration.MorseAuthAccount.Value": + return x.Value != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.migration.MorseAuthAccount.Type": + x.Type_ = "" + case "poktroll.migration.MorseAuthAccount.Value": + x.Value = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.migration.MorseAuthAccount.Type": + value := x.Type_ + return protoreflect.ValueOfString(value) + case "poktroll.migration.MorseAuthAccount.Value": + value := x.Value + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.migration.MorseAuthAccount.Type": + x.Type_ = value.Interface().(string) + case "poktroll.migration.MorseAuthAccount.Value": + x.Value = value.Message().Interface().(*MorseAccount) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.migration.MorseAuthAccount.Value": + if x.Value == nil { + x.Value = new(MorseAccount) + } + return protoreflect.ValueOfMessage(x.Value.ProtoReflect()) + case "poktroll.migration.MorseAuthAccount.Type": + panic(fmt.Errorf("field Type of message poktroll.migration.MorseAuthAccount is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.migration.MorseAuthAccount.Type": + return protoreflect.ValueOfString("") + case "poktroll.migration.MorseAuthAccount.Value": + m := new(MorseAccount) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + } + panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount 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_MorseAuthAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseAuthAccount", 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_MorseAuthAccount) 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_MorseAuthAccount) 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_MorseAuthAccount) 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_MorseAuthAccount) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MorseAuthAccount) + 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.Type_) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Value != nil { + l = options.Size(x.Value) + 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().(*MorseAuthAccount) + 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.Value != nil { + encoded, err := options.Marshal(x.Value) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Type_) > 0 { + i -= len(x.Type_) + copy(dAtA[i:], x.Type_) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Type_))) + 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().(*MorseAuthAccount) + 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: MorseAuthAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuthAccount: 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 Type_", 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.Type_ = 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 Value", 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.Value == nil { + x.Value = &MorseAccount{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Value); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_MorsePos_1_list)(nil) + +type _MorsePos_1_list struct { + list *[]*MorseValidator +} + +func (x *_MorsePos_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MorsePos_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MorsePos_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*MorseValidator) + (*x.list)[i] = concreteValue +} + +func (x *_MorsePos_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*MorseValidator) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MorsePos_1_list) AppendMutable() protoreflect.Value { + v := new(MorseValidator) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MorsePos_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MorsePos_1_list) NewElement() protoreflect.Value { + v := new(MorseValidator) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MorsePos_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_MorseAuthAccount protoreflect.MessageDescriptor - fd_MorseAuthAccount_Type protoreflect.FieldDescriptor - fd_MorseAuthAccount_Value protoreflect.FieldDescriptor + md_MorsePos protoreflect.MessageDescriptor + fd_MorsePos_validators protoreflect.FieldDescriptor ) func init() { file_poktroll_migration_legacy_proto_init() - md_MorseAuthAccount = File_poktroll_migration_legacy_proto.Messages().ByName("MorseAuthAccount") - fd_MorseAuthAccount_Type = md_MorseAuthAccount.Fields().ByName("Type") - fd_MorseAuthAccount_Value = md_MorseAuthAccount.Fields().ByName("Value") + md_MorsePos = File_poktroll_migration_legacy_proto.Messages().ByName("MorsePos") + fd_MorsePos_validators = md_MorsePos.Fields().ByName("validators") } -var _ protoreflect.Message = (*fastReflection_MorseAuthAccount)(nil) +var _ protoreflect.Message = (*fastReflection_MorsePos)(nil) -type fastReflection_MorseAuthAccount MorseAuthAccount +type fastReflection_MorsePos MorsePos -func (x *MorseAuthAccount) ProtoReflect() protoreflect.Message { - return (*fastReflection_MorseAuthAccount)(x) +func (x *MorsePos) ProtoReflect() protoreflect.Message { + return (*fastReflection_MorsePos)(x) } -func (x *MorseAuthAccount) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_migration_legacy_proto_msgTypes[3] +func (x *MorsePos) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_migration_legacy_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1632,43 +2674,43 @@ func (x *MorseAuthAccount) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MorseAuthAccount_messageType fastReflection_MorseAuthAccount_messageType -var _ protoreflect.MessageType = fastReflection_MorseAuthAccount_messageType{} +var _fastReflection_MorsePos_messageType fastReflection_MorsePos_messageType +var _ protoreflect.MessageType = fastReflection_MorsePos_messageType{} -type fastReflection_MorseAuthAccount_messageType struct{} +type fastReflection_MorsePos_messageType struct{} -func (x fastReflection_MorseAuthAccount_messageType) Zero() protoreflect.Message { - return (*fastReflection_MorseAuthAccount)(nil) +func (x fastReflection_MorsePos_messageType) Zero() protoreflect.Message { + return (*fastReflection_MorsePos)(nil) } -func (x fastReflection_MorseAuthAccount_messageType) New() protoreflect.Message { - return new(fastReflection_MorseAuthAccount) +func (x fastReflection_MorsePos_messageType) New() protoreflect.Message { + return new(fastReflection_MorsePos) } -func (x fastReflection_MorseAuthAccount_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MorseAuthAccount +func (x fastReflection_MorsePos_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MorsePos } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MorseAuthAccount) Descriptor() protoreflect.MessageDescriptor { - return md_MorseAuthAccount +func (x *fastReflection_MorsePos) Descriptor() protoreflect.MessageDescriptor { + return md_MorsePos } // 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_MorseAuthAccount) Type() protoreflect.MessageType { - return _fastReflection_MorseAuthAccount_messageType +func (x *fastReflection_MorsePos) Type() protoreflect.MessageType { + return _fastReflection_MorsePos_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MorseAuthAccount) New() protoreflect.Message { - return new(fastReflection_MorseAuthAccount) +func (x *fastReflection_MorsePos) New() protoreflect.Message { + return new(fastReflection_MorsePos) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MorseAuthAccount) Interface() protoreflect.ProtoMessage { - return (*MorseAuthAccount)(x) +func (x *fastReflection_MorsePos) Interface() protoreflect.ProtoMessage { + return (*MorsePos)(x) } // Range iterates over every populated field in an undefined order, @@ -1676,16 +2718,10 @@ func (x *fastReflection_MorseAuthAccount) Interface() protoreflect.ProtoMessage // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MorseAuthAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Type_ != "" { - value := protoreflect.ValueOfString(x.Type_) - if !f(fd_MorseAuthAccount_Type, value) { - return - } - } - if x.Value != nil { - value := protoreflect.ValueOfMessage(x.Value.ProtoReflect()) - if !f(fd_MorseAuthAccount_Value, value) { +func (x *fastReflection_MorsePos) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Validators) != 0 { + value := protoreflect.ValueOfList(&_MorsePos_1_list{list: &x.Validators}) + if !f(fd_MorsePos_validators, value) { return } } @@ -1702,17 +2738,15 @@ func (x *fastReflection_MorseAuthAccount) Range(f func(protoreflect.FieldDescrip // 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_MorseAuthAccount) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MorsePos) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.migration.MorseAuthAccount.Type": - return x.Type_ != "" - case "poktroll.migration.MorseAuthAccount.Value": - return x.Value != nil + case "poktroll.migration.MorsePos.validators": + return len(x.Validators) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) } } @@ -1722,17 +2756,15 @@ func (x *fastReflection_MorseAuthAccount) Has(fd protoreflect.FieldDescriptor) b // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuthAccount) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MorsePos) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.migration.MorseAuthAccount.Type": - x.Type_ = "" - case "poktroll.migration.MorseAuthAccount.Value": - x.Value = nil + case "poktroll.migration.MorsePos.validators": + x.Validators = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) } } @@ -1742,19 +2774,19 @@ func (x *fastReflection_MorseAuthAccount) Clear(fd protoreflect.FieldDescriptor) // 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_MorseAuthAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorsePos) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.migration.MorseAuthAccount.Type": - value := x.Type_ - return protoreflect.ValueOfString(value) - case "poktroll.migration.MorseAuthAccount.Value": - value := x.Value - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.migration.MorsePos.validators": + if len(x.Validators) == 0 { + return protoreflect.ValueOfList(&_MorsePos_1_list{}) + } + listValue := &_MorsePos_1_list{list: &x.Validators} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", descriptor.FullName())) } } @@ -1768,17 +2800,17 @@ func (x *fastReflection_MorseAuthAccount) Get(descriptor protoreflect.FieldDescr // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuthAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MorsePos) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.migration.MorseAuthAccount.Type": - x.Type_ = value.Interface().(string) - case "poktroll.migration.MorseAuthAccount.Value": - x.Value = value.Message().Interface().(*MorseAccount) + case "poktroll.migration.MorsePos.validators": + lv := value.List() + clv := lv.(*_MorsePos_1_list) + x.Validators = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) } } @@ -1792,48 +2824,45 @@ func (x *fastReflection_MorseAuthAccount) Set(fd protoreflect.FieldDescriptor, v // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuthAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorsePos) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorseAuthAccount.Value": - if x.Value == nil { - x.Value = new(MorseAccount) + case "poktroll.migration.MorsePos.validators": + if x.Validators == nil { + x.Validators = []*MorseValidator{} } - return protoreflect.ValueOfMessage(x.Value.ProtoReflect()) - case "poktroll.migration.MorseAuthAccount.Type": - panic(fmt.Errorf("field Type of message poktroll.migration.MorseAuthAccount is not mutable")) + value := &_MorsePos_1_list{list: &x.Validators} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos 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_MorseAuthAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorsePos) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorseAuthAccount.Type": - return protoreflect.ValueOfString("") - case "poktroll.migration.MorseAuthAccount.Value": - m := new(MorseAccount) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.migration.MorsePos.validators": + list := []*MorseValidator{} + return protoreflect.ValueOfList(&_MorsePos_1_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuthAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuthAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorsePos 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_MorseAuthAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MorsePos) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseAuthAccount", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorsePos", d.FullName())) } panic("unreachable") } @@ -1841,7 +2870,7 @@ func (x *fastReflection_MorseAuthAccount) WhichOneof(d protoreflect.OneofDescrip // 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_MorseAuthAccount) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MorsePos) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1852,7 +2881,7 @@ func (x *fastReflection_MorseAuthAccount) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuthAccount) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MorsePos) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1864,7 +2893,7 @@ func (x *fastReflection_MorseAuthAccount) SetUnknown(fields protoreflect.RawFiel // 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_MorseAuthAccount) IsValid() bool { +func (x *fastReflection_MorsePos) IsValid() bool { return x != nil } @@ -1874,9 +2903,9 @@ func (x *fastReflection_MorseAuthAccount) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MorseAuthAccount) + x := input.Message.Interface().(*MorsePos) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1888,13 +2917,11 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Type_) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Value != nil { - l = options.Size(x.Value) - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Validators) > 0 { + for _, e := range x.Validators { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1906,7 +2933,7 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MorseAuthAccount) + x := input.Message.Interface().(*MorsePos) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1925,26 +2952,21 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Value != nil { - encoded, err := options.Marshal(x.Value) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err + if len(x.Validators) > 0 { + for iNdEx := len(x.Validators) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Validators[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.Type_) > 0 { - i -= len(x.Type_) - copy(dAtA[i:], x.Type_) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Type_))) - i-- - dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1957,7 +2979,7 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MorseAuthAccount) + x := input.Message.Interface().(*MorsePos) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1989,47 +3011,15 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuthAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuthAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorsePos: wiretype end group for non-group") } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Type_", 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.Type_ = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorsePos: 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 Value", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2056,10 +3046,8 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Value == nil { - x.Value = &MorseAccount{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Value); err != nil { + x.Validators = append(x.Validators, &MorseValidator{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Validators[len(x.Validators)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2098,78 +3086,35 @@ func (x *fastReflection_MorseAuthAccount) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_MorseAuth_1_list)(nil) - -type _MorseAuth_1_list struct { - list *[]*MorseAuthAccount -} - -func (x *_MorseAuth_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MorseAuth_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MorseAuth_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*MorseAuthAccount) - (*x.list)[i] = concreteValue -} - -func (x *_MorseAuth_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*MorseAuthAccount) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MorseAuth_1_list) AppendMutable() protoreflect.Value { - v := new(MorseAuthAccount) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MorseAuth_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MorseAuth_1_list) NewElement() protoreflect.Value { - v := new(MorseAuthAccount) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MorseAuth_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_MorseAuth protoreflect.MessageDescriptor - fd_MorseAuth_accounts protoreflect.FieldDescriptor + md_MorseApplication protoreflect.MessageDescriptor + fd_MorseApplication_address protoreflect.FieldDescriptor + fd_MorseApplication_public_key protoreflect.FieldDescriptor + fd_MorseApplication_jailed protoreflect.FieldDescriptor + fd_MorseApplication_status protoreflect.FieldDescriptor + fd_MorseApplication_staked_tokens protoreflect.FieldDescriptor ) func init() { file_poktroll_migration_legacy_proto_init() - md_MorseAuth = File_poktroll_migration_legacy_proto.Messages().ByName("MorseAuth") - fd_MorseAuth_accounts = md_MorseAuth.Fields().ByName("accounts") + md_MorseApplication = File_poktroll_migration_legacy_proto.Messages().ByName("MorseApplication") + fd_MorseApplication_address = md_MorseApplication.Fields().ByName("address") + fd_MorseApplication_public_key = md_MorseApplication.Fields().ByName("public_key") + fd_MorseApplication_jailed = md_MorseApplication.Fields().ByName("jailed") + fd_MorseApplication_status = md_MorseApplication.Fields().ByName("status") + fd_MorseApplication_staked_tokens = md_MorseApplication.Fields().ByName("staked_tokens") } -var _ protoreflect.Message = (*fastReflection_MorseAuth)(nil) +var _ protoreflect.Message = (*fastReflection_MorseApplication)(nil) -type fastReflection_MorseAuth MorseAuth +type fastReflection_MorseApplication MorseApplication -func (x *MorseAuth) ProtoReflect() protoreflect.Message { - return (*fastReflection_MorseAuth)(x) +func (x *MorseApplication) ProtoReflect() protoreflect.Message { + return (*fastReflection_MorseApplication)(x) } -func (x *MorseAuth) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_migration_legacy_proto_msgTypes[4] +func (x *MorseApplication) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_migration_legacy_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2180,43 +3125,43 @@ func (x *MorseAuth) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MorseAuth_messageType fastReflection_MorseAuth_messageType -var _ protoreflect.MessageType = fastReflection_MorseAuth_messageType{} +var _fastReflection_MorseApplication_messageType fastReflection_MorseApplication_messageType +var _ protoreflect.MessageType = fastReflection_MorseApplication_messageType{} -type fastReflection_MorseAuth_messageType struct{} +type fastReflection_MorseApplication_messageType struct{} -func (x fastReflection_MorseAuth_messageType) Zero() protoreflect.Message { - return (*fastReflection_MorseAuth)(nil) +func (x fastReflection_MorseApplication_messageType) Zero() protoreflect.Message { + return (*fastReflection_MorseApplication)(nil) } -func (x fastReflection_MorseAuth_messageType) New() protoreflect.Message { - return new(fastReflection_MorseAuth) +func (x fastReflection_MorseApplication_messageType) New() protoreflect.Message { + return new(fastReflection_MorseApplication) } -func (x fastReflection_MorseAuth_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MorseAuth +func (x fastReflection_MorseApplication_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MorseApplication } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MorseAuth) Descriptor() protoreflect.MessageDescriptor { - return md_MorseAuth +func (x *fastReflection_MorseApplication) Descriptor() protoreflect.MessageDescriptor { + return md_MorseApplication } // 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_MorseAuth) Type() protoreflect.MessageType { - return _fastReflection_MorseAuth_messageType +func (x *fastReflection_MorseApplication) Type() protoreflect.MessageType { + return _fastReflection_MorseApplication_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MorseAuth) New() protoreflect.Message { - return new(fastReflection_MorseAuth) +func (x *fastReflection_MorseApplication) New() protoreflect.Message { + return new(fastReflection_MorseApplication) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MorseAuth) Interface() protoreflect.ProtoMessage { - return (*MorseAuth)(x) +func (x *fastReflection_MorseApplication) Interface() protoreflect.ProtoMessage { + return (*MorseApplication)(x) } // Range iterates over every populated field in an undefined order, @@ -2224,10 +3169,34 @@ func (x *fastReflection_MorseAuth) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MorseAuth) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Accounts) != 0 { - value := protoreflect.ValueOfList(&_MorseAuth_1_list{list: &x.Accounts}) - if !f(fd_MorseAuth_accounts, value) { +func (x *fastReflection_MorseApplication) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Address) != 0 { + value := protoreflect.ValueOfBytes(x.Address) + if !f(fd_MorseApplication_address, value) { + return + } + } + if len(x.PublicKey) != 0 { + value := protoreflect.ValueOfBytes(x.PublicKey) + if !f(fd_MorseApplication_public_key, value) { + return + } + } + if x.Jailed != false { + value := protoreflect.ValueOfBool(x.Jailed) + if !f(fd_MorseApplication_jailed, value) { + return + } + } + if x.Status != int32(0) { + value := protoreflect.ValueOfInt32(x.Status) + if !f(fd_MorseApplication_status, value) { + return + } + } + if x.StakedTokens != "" { + value := protoreflect.ValueOfString(x.StakedTokens) + if !f(fd_MorseApplication_staked_tokens, value) { return } } @@ -2244,15 +3213,23 @@ func (x *fastReflection_MorseAuth) Range(f func(protoreflect.FieldDescriptor, pr // 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_MorseAuth) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MorseApplication) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.migration.MorseAuth.accounts": - return len(x.Accounts) != 0 + case "poktroll.migration.MorseApplication.address": + return len(x.Address) != 0 + case "poktroll.migration.MorseApplication.public_key": + return len(x.PublicKey) != 0 + case "poktroll.migration.MorseApplication.jailed": + return x.Jailed != false + case "poktroll.migration.MorseApplication.status": + return x.Status != int32(0) + case "poktroll.migration.MorseApplication.staked_tokens": + return x.StakedTokens != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication does not contain field %s", fd.FullName())) } } @@ -2262,15 +3239,23 @@ func (x *fastReflection_MorseAuth) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuth) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MorseApplication) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.migration.MorseAuth.accounts": - x.Accounts = nil + case "poktroll.migration.MorseApplication.address": + x.Address = nil + case "poktroll.migration.MorseApplication.public_key": + x.PublicKey = nil + case "poktroll.migration.MorseApplication.jailed": + x.Jailed = false + case "poktroll.migration.MorseApplication.status": + x.Status = int32(0) + case "poktroll.migration.MorseApplication.staked_tokens": + x.StakedTokens = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication does not contain field %s", fd.FullName())) } } @@ -2280,19 +3265,28 @@ func (x *fastReflection_MorseAuth) Clear(fd protoreflect.FieldDescriptor) { // 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_MorseAuth) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseApplication) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.migration.MorseAuth.accounts": - if len(x.Accounts) == 0 { - return protoreflect.ValueOfList(&_MorseAuth_1_list{}) - } - listValue := &_MorseAuth_1_list{list: &x.Accounts} - return protoreflect.ValueOfList(listValue) + case "poktroll.migration.MorseApplication.address": + value := x.Address + return protoreflect.ValueOfBytes(value) + case "poktroll.migration.MorseApplication.public_key": + value := x.PublicKey + return protoreflect.ValueOfBytes(value) + case "poktroll.migration.MorseApplication.jailed": + value := x.Jailed + return protoreflect.ValueOfBool(value) + case "poktroll.migration.MorseApplication.status": + value := x.Status + return protoreflect.ValueOfInt32(value) + case "poktroll.migration.MorseApplication.staked_tokens": + value := x.StakedTokens + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication does not contain field %s", descriptor.FullName())) } } @@ -2306,17 +3300,23 @@ func (x *fastReflection_MorseAuth) Get(descriptor protoreflect.FieldDescriptor) // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuth) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MorseApplication) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.migration.MorseAuth.accounts": - lv := value.List() - clv := lv.(*_MorseAuth_1_list) - x.Accounts = *clv.list + case "poktroll.migration.MorseApplication.address": + x.Address = value.Bytes() + case "poktroll.migration.MorseApplication.public_key": + x.PublicKey = value.Bytes() + case "poktroll.migration.MorseApplication.jailed": + x.Jailed = value.Bool() + case "poktroll.migration.MorseApplication.status": + x.Status = int32(value.Int()) + case "poktroll.migration.MorseApplication.staked_tokens": + x.StakedTokens = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication does not contain field %s", fd.FullName())) } } @@ -2330,45 +3330,56 @@ func (x *fastReflection_MorseAuth) Set(fd protoreflect.FieldDescriptor, value pr // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuth) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseApplication) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorseAuth.accounts": - if x.Accounts == nil { - x.Accounts = []*MorseAuthAccount{} - } - value := &_MorseAuth_1_list{list: &x.Accounts} - return protoreflect.ValueOfList(value) + case "poktroll.migration.MorseApplication.address": + panic(fmt.Errorf("field address of message poktroll.migration.MorseApplication is not mutable")) + case "poktroll.migration.MorseApplication.public_key": + panic(fmt.Errorf("field public_key of message poktroll.migration.MorseApplication is not mutable")) + case "poktroll.migration.MorseApplication.jailed": + panic(fmt.Errorf("field jailed of message poktroll.migration.MorseApplication is not mutable")) + case "poktroll.migration.MorseApplication.status": + panic(fmt.Errorf("field status of message poktroll.migration.MorseApplication is not mutable")) + case "poktroll.migration.MorseApplication.staked_tokens": + panic(fmt.Errorf("field staked_tokens of message poktroll.migration.MorseApplication is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseAuth) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseApplication) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorseAuth.accounts": - list := []*MorseAuthAccount{} - return protoreflect.ValueOfList(&_MorseAuth_1_list{list: &list}) + case "poktroll.migration.MorseApplication.address": + return protoreflect.ValueOfBytes(nil) + case "poktroll.migration.MorseApplication.public_key": + return protoreflect.ValueOfBytes(nil) + case "poktroll.migration.MorseApplication.jailed": + return protoreflect.ValueOfBool(false) + case "poktroll.migration.MorseApplication.status": + return protoreflect.ValueOfInt32(int32(0)) + case "poktroll.migration.MorseApplication.staked_tokens": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseAuth")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) } - panic(fmt.Errorf("message poktroll.migration.MorseAuth does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseAuth) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MorseApplication) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseAuth", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseApplication", d.FullName())) } panic("unreachable") } @@ -2376,7 +3387,7 @@ func (x *fastReflection_MorseAuth) WhichOneof(d protoreflect.OneofDescriptor) pr // 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_MorseAuth) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MorseApplication) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2387,7 +3398,7 @@ func (x *fastReflection_MorseAuth) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorseAuth) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MorseApplication) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2399,7 +3410,7 @@ func (x *fastReflection_MorseAuth) SetUnknown(fields protoreflect.RawFields) { // 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_MorseAuth) IsValid() bool { +func (x *fastReflection_MorseApplication) IsValid() bool { return x != nil } @@ -2409,9 +3420,9 @@ func (x *fastReflection_MorseAuth) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MorseApplication) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MorseAuth) + x := input.Message.Interface().(*MorseApplication) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2423,11 +3434,23 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if len(x.Accounts) > 0 { - for _, e := range x.Accounts { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.PublicKey) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Jailed { + n += 2 + } + if x.Status != 0 { + n += 1 + runtime.Sov(uint64(x.Status)) + } + l = len(x.StakedTokens) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -2439,7 +3462,7 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MorseAuth) + x := input.Message.Interface().(*MorseApplication) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2458,21 +3481,41 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Accounts) > 0 { - for iNdEx := len(x.Accounts) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Accounts[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa + if len(x.StakedTokens) > 0 { + i -= len(x.StakedTokens) + copy(dAtA[i:], x.StakedTokens) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StakedTokens))) + i-- + dAtA[i] = 0x32 + } + if x.Status != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) + i-- + dAtA[i] = 0x20 + } + if x.Jailed { + i-- + if x.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x18 + } + if len(x.PublicKey) > 0 { + i -= len(x.PublicKey) + copy(dAtA[i:], x.PublicKey) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2485,7 +3528,7 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MorseAuth) + x := input.Message.Interface().(*MorseApplication) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2504,30 +3547,137 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow } - if iNdEx >= l { + 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: MorseApplication: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseApplication: 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 Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = append(x.Address[:0], dAtA[iNdEx:postIndex]...) + if x.Address == nil { + x.Address = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + x.PublicKey = append(x.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if x.PublicKey == nil { + x.PublicKey = []byte{} } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuth: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseAuth: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Jailed = bool(v != 0) + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + x.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Status |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2537,25 +3687,23 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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.Accounts = append(x.Accounts, &MorseAuthAccount{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Accounts[len(x.Accounts)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.StakedTokens = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2592,78 +3740,35 @@ func (x *fastReflection_MorseAuth) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_MorsePos_1_list)(nil) - -type _MorsePos_1_list struct { - list *[]*MorseValidator -} - -func (x *_MorsePos_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MorsePos_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MorsePos_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*MorseValidator) - (*x.list)[i] = concreteValue -} - -func (x *_MorsePos_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*MorseValidator) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MorsePos_1_list) AppendMutable() protoreflect.Value { - v := new(MorseValidator) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MorsePos_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MorsePos_1_list) NewElement() protoreflect.Value { - v := new(MorseValidator) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MorsePos_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_MorsePos protoreflect.MessageDescriptor - fd_MorsePos_validators protoreflect.FieldDescriptor + md_MorseValidator protoreflect.MessageDescriptor + fd_MorseValidator_Address protoreflect.FieldDescriptor + fd_MorseValidator_PublicKey protoreflect.FieldDescriptor + fd_MorseValidator_jailed protoreflect.FieldDescriptor + fd_MorseValidator_status protoreflect.FieldDescriptor + fd_MorseValidator_StakedTokens protoreflect.FieldDescriptor ) func init() { file_poktroll_migration_legacy_proto_init() - md_MorsePos = File_poktroll_migration_legacy_proto.Messages().ByName("MorsePos") - fd_MorsePos_validators = md_MorsePos.Fields().ByName("validators") + md_MorseValidator = File_poktroll_migration_legacy_proto.Messages().ByName("MorseValidator") + fd_MorseValidator_Address = md_MorseValidator.Fields().ByName("Address") + fd_MorseValidator_PublicKey = md_MorseValidator.Fields().ByName("PublicKey") + fd_MorseValidator_jailed = md_MorseValidator.Fields().ByName("jailed") + fd_MorseValidator_status = md_MorseValidator.Fields().ByName("status") + fd_MorseValidator_StakedTokens = md_MorseValidator.Fields().ByName("StakedTokens") } -var _ protoreflect.Message = (*fastReflection_MorsePos)(nil) +var _ protoreflect.Message = (*fastReflection_MorseValidator)(nil) -type fastReflection_MorsePos MorsePos +type fastReflection_MorseValidator MorseValidator -func (x *MorsePos) ProtoReflect() protoreflect.Message { - return (*fastReflection_MorsePos)(x) +func (x *MorseValidator) ProtoReflect() protoreflect.Message { + return (*fastReflection_MorseValidator)(x) } -func (x *MorsePos) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_migration_legacy_proto_msgTypes[5] +func (x *MorseValidator) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_migration_legacy_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2674,43 +3779,43 @@ func (x *MorsePos) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MorsePos_messageType fastReflection_MorsePos_messageType -var _ protoreflect.MessageType = fastReflection_MorsePos_messageType{} +var _fastReflection_MorseValidator_messageType fastReflection_MorseValidator_messageType +var _ protoreflect.MessageType = fastReflection_MorseValidator_messageType{} -type fastReflection_MorsePos_messageType struct{} +type fastReflection_MorseValidator_messageType struct{} -func (x fastReflection_MorsePos_messageType) Zero() protoreflect.Message { - return (*fastReflection_MorsePos)(nil) +func (x fastReflection_MorseValidator_messageType) Zero() protoreflect.Message { + return (*fastReflection_MorseValidator)(nil) } -func (x fastReflection_MorsePos_messageType) New() protoreflect.Message { - return new(fastReflection_MorsePos) +func (x fastReflection_MorseValidator_messageType) New() protoreflect.Message { + return new(fastReflection_MorseValidator) } -func (x fastReflection_MorsePos_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MorsePos +func (x fastReflection_MorseValidator_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MorseValidator } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MorsePos) Descriptor() protoreflect.MessageDescriptor { - return md_MorsePos +func (x *fastReflection_MorseValidator) Descriptor() protoreflect.MessageDescriptor { + return md_MorseValidator } // 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_MorsePos) Type() protoreflect.MessageType { - return _fastReflection_MorsePos_messageType +func (x *fastReflection_MorseValidator) Type() protoreflect.MessageType { + return _fastReflection_MorseValidator_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MorsePos) New() protoreflect.Message { - return new(fastReflection_MorsePos) +func (x *fastReflection_MorseValidator) New() protoreflect.Message { + return new(fastReflection_MorseValidator) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MorsePos) Interface() protoreflect.ProtoMessage { - return (*MorsePos)(x) +func (x *fastReflection_MorseValidator) Interface() protoreflect.ProtoMessage { + return (*MorseValidator)(x) } // Range iterates over every populated field in an undefined order, @@ -2718,10 +3823,34 @@ func (x *fastReflection_MorsePos) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MorsePos) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Validators) != 0 { - value := protoreflect.ValueOfList(&_MorsePos_1_list{list: &x.Validators}) - if !f(fd_MorsePos_validators, value) { +func (x *fastReflection_MorseValidator) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Address) != 0 { + value := protoreflect.ValueOfBytes(x.Address) + if !f(fd_MorseValidator_Address, value) { + return + } + } + if len(x.PublicKey) != 0 { + value := protoreflect.ValueOfBytes(x.PublicKey) + if !f(fd_MorseValidator_PublicKey, value) { + return + } + } + if x.Jailed != false { + value := protoreflect.ValueOfBool(x.Jailed) + if !f(fd_MorseValidator_jailed, value) { + return + } + } + if x.Status != int32(0) { + value := protoreflect.ValueOfInt32(x.Status) + if !f(fd_MorseValidator_status, value) { + return + } + } + if x.StakedTokens != "" { + value := protoreflect.ValueOfString(x.StakedTokens) + if !f(fd_MorseValidator_StakedTokens, value) { return } } @@ -2738,15 +3867,23 @@ func (x *fastReflection_MorsePos) Range(f func(protoreflect.FieldDescriptor, pro // 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_MorsePos) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MorseValidator) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.migration.MorsePos.validators": - return len(x.Validators) != 0 + case "poktroll.migration.MorseValidator.Address": + return len(x.Address) != 0 + case "poktroll.migration.MorseValidator.PublicKey": + return len(x.PublicKey) != 0 + case "poktroll.migration.MorseValidator.jailed": + return x.Jailed != false + case "poktroll.migration.MorseValidator.status": + return x.Status != int32(0) + case "poktroll.migration.MorseValidator.StakedTokens": + return x.StakedTokens != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator does not contain field %s", fd.FullName())) } } @@ -2756,15 +3893,23 @@ func (x *fastReflection_MorsePos) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorsePos) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MorseValidator) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.migration.MorsePos.validators": - x.Validators = nil + case "poktroll.migration.MorseValidator.Address": + x.Address = nil + case "poktroll.migration.MorseValidator.PublicKey": + x.PublicKey = nil + case "poktroll.migration.MorseValidator.jailed": + x.Jailed = false + case "poktroll.migration.MorseValidator.status": + x.Status = int32(0) + case "poktroll.migration.MorseValidator.StakedTokens": + x.StakedTokens = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator does not contain field %s", fd.FullName())) } } @@ -2774,19 +3919,28 @@ func (x *fastReflection_MorsePos) Clear(fd protoreflect.FieldDescriptor) { // 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_MorsePos) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseValidator) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.migration.MorsePos.validators": - if len(x.Validators) == 0 { - return protoreflect.ValueOfList(&_MorsePos_1_list{}) - } - listValue := &_MorsePos_1_list{list: &x.Validators} - return protoreflect.ValueOfList(listValue) + case "poktroll.migration.MorseValidator.Address": + value := x.Address + return protoreflect.ValueOfBytes(value) + case "poktroll.migration.MorseValidator.PublicKey": + value := x.PublicKey + return protoreflect.ValueOfBytes(value) + case "poktroll.migration.MorseValidator.jailed": + value := x.Jailed + return protoreflect.ValueOfBool(value) + case "poktroll.migration.MorseValidator.status": + value := x.Status + return protoreflect.ValueOfInt32(value) + case "poktroll.migration.MorseValidator.StakedTokens": + value := x.StakedTokens + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator does not contain field %s", descriptor.FullName())) } } @@ -2800,17 +3954,23 @@ func (x *fastReflection_MorsePos) Get(descriptor protoreflect.FieldDescriptor) p // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorsePos) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MorseValidator) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.migration.MorsePos.validators": - lv := value.List() - clv := lv.(*_MorsePos_1_list) - x.Validators = *clv.list + case "poktroll.migration.MorseValidator.Address": + x.Address = value.Bytes() + case "poktroll.migration.MorseValidator.PublicKey": + x.PublicKey = value.Bytes() + case "poktroll.migration.MorseValidator.jailed": + x.Jailed = value.Bool() + case "poktroll.migration.MorseValidator.status": + x.Status = int32(value.Int()) + case "poktroll.migration.MorseValidator.StakedTokens": + x.StakedTokens = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator does not contain field %s", fd.FullName())) } } @@ -2824,45 +3984,56 @@ func (x *fastReflection_MorsePos) Set(fd protoreflect.FieldDescriptor, value pro // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorsePos) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseValidator) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorsePos.validators": - if x.Validators == nil { - x.Validators = []*MorseValidator{} - } - value := &_MorsePos_1_list{list: &x.Validators} - return protoreflect.ValueOfList(value) + case "poktroll.migration.MorseValidator.Address": + panic(fmt.Errorf("field Address of message poktroll.migration.MorseValidator is not mutable")) + case "poktroll.migration.MorseValidator.PublicKey": + panic(fmt.Errorf("field PublicKey of message poktroll.migration.MorseValidator is not mutable")) + case "poktroll.migration.MorseValidator.jailed": + panic(fmt.Errorf("field jailed of message poktroll.migration.MorseValidator is not mutable")) + case "poktroll.migration.MorseValidator.status": + panic(fmt.Errorf("field status of message poktroll.migration.MorseValidator is not mutable")) + case "poktroll.migration.MorseValidator.StakedTokens": + panic(fmt.Errorf("field StakedTokens of message poktroll.migration.MorseValidator is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorsePos) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MorseValidator) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.migration.MorsePos.validators": - list := []*MorseValidator{} - return protoreflect.ValueOfList(&_MorsePos_1_list{list: &list}) + case "poktroll.migration.MorseValidator.Address": + return protoreflect.ValueOfBytes(nil) + case "poktroll.migration.MorseValidator.PublicKey": + return protoreflect.ValueOfBytes(nil) + case "poktroll.migration.MorseValidator.jailed": + return protoreflect.ValueOfBool(false) + case "poktroll.migration.MorseValidator.status": + return protoreflect.ValueOfInt32(int32(0)) + case "poktroll.migration.MorseValidator.StakedTokens": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorsePos")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) } - panic(fmt.Errorf("message poktroll.migration.MorsePos does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorsePos) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MorseValidator) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorsePos", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseValidator", d.FullName())) } panic("unreachable") } @@ -2870,7 +4041,7 @@ func (x *fastReflection_MorsePos) WhichOneof(d protoreflect.OneofDescriptor) pro // 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_MorsePos) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MorseValidator) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2881,7 +4052,7 @@ func (x *fastReflection_MorsePos) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MorsePos) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MorseValidator) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2893,7 +4064,7 @@ func (x *fastReflection_MorsePos) SetUnknown(fields protoreflect.RawFields) { // 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_MorsePos) IsValid() bool { +func (x *fastReflection_MorseValidator) IsValid() bool { return x != nil } @@ -2903,9 +4074,9 @@ func (x *fastReflection_MorsePos) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MorseValidator) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MorsePos) + x := input.Message.Interface().(*MorseValidator) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2917,11 +4088,23 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if len(x.Validators) > 0 { - for _, e := range x.Validators { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.PublicKey) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Jailed { + n += 2 + } + if x.Status != 0 { + n += 1 + runtime.Sov(uint64(x.Status)) + } + l = len(x.StakedTokens) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -2933,7 +4116,7 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MorsePos) + x := input.Message.Interface().(*MorseValidator) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2952,21 +4135,41 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Validators) > 0 { - for iNdEx := len(x.Validators) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Validators[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa + if len(x.StakedTokens) > 0 { + i -= len(x.StakedTokens) + copy(dAtA[i:], x.StakedTokens) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StakedTokens))) + i-- + dAtA[i] = 0x3a + } + if x.Status != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) + i-- + dAtA[i] = 0x20 + } + if x.Jailed { + i-- + if x.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x18 + } + if len(x.PublicKey) > 0 { + i -= len(x.PublicKey) + copy(dAtA[i:], x.PublicKey) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2979,7 +4182,7 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MorsePos) + x := input.Message.Interface().(*MorseValidator) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3011,17 +4214,17 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorsePos: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseValidator: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorsePos: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseValidator: 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 Validators", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -3031,25 +4234,130 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Validators = append(x.Validators, &MorseValidator{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Validators[len(x.Validators)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + x.Address = append(x.Address[:0], dAtA[iNdEx:postIndex]...) + if x.Address == nil { + x.Address = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.PublicKey = append(x.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if x.PublicKey == nil { + x.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Jailed = bool(v != 0) + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + x.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Status |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", 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.StakedTokens = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3093,10 +4401,13 @@ func (x *fastReflection_MorsePos) ProtoMethods() *protoiface.Methods { // source: poktroll/migration/legacy.proto // Types in this file are ONLY present to facilitate the verifiability of the -// migration state from Morse to Shannon. These types are used by the migration -// subcommand (e.g. `poktrolld migrate collect-morse-accounts ...) to transform -// the Morse state export into the Shannon state import. They ARE NOT persisted -// on-chain at any point. +// migration state from Morse to Shannon. +// +// These types are used by the migration subcommand to transform +// the Morse state export into the Shannon state import. +// Ref: `poktrolld migrate collect-morse-accounts ...` +// +// They ARE NOT persisted on-chain at any point.package poktroll.migration; const ( // Verify that this generated code is sufficiently up-to-date. @@ -3105,12 +4416,17 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// MorseStateExport is the data structure that is serialized and output when running +// `pocket util export-genesis-for-reset`. +// See: https://editor.swagger.io/?url=https://raw.githubusercontent.com/pokt-network/pocket-core/staging/doc/specs/rpc-spec.yaml#operations-query-post_query_state type MorseStateExport struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AppHash string `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + // app_hash is the Morse tendermint state hash. + AppHash string `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + // app_state is the entire Morse tendermint application state. AppState *MorseAppState `protobuf:"bytes,2,opt,name=app_state,json=appState,proto3" json:"app_state,omitempty"` } @@ -3148,6 +4464,8 @@ func (x *MorseStateExport) GetAppState() *MorseAppState { return nil } +// MorseAppState is the tendermint application state for the Morse tendermint +// application; not to be confused with the pokt protocol actor. type MorseAppState struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3199,6 +4517,7 @@ func (x *MorseAppState) GetPos() *MorsePos { return nil } +// A wrapper around the list of MorseApplications, necessary in order to conform to the Morse genesis structure. type MorseApplications struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3234,6 +4553,48 @@ func (x *MorseApplications) GetApplications() []*MorseApplication { return nil } +// A wrapper around a list of Morse accounts. +type MorseAuth struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Accounts []*MorseAuthAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` +} + +func (x *MorseAuth) Reset() { + *x = MorseAuth{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_migration_legacy_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MorseAuth) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MorseAuth) ProtoMessage() {} + +// Deprecated: Use MorseAuth.ProtoReflect.Descriptor instead. +func (*MorseAuth) Descriptor() ([]byte, []int) { + return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{3} +} + +func (x *MorseAuth) GetAccounts() []*MorseAuthAccount { + if x != nil { + return x.Accounts + } + return nil +} + +// A wrapper around Morse account information, necessary in order to to confirm to the Morse genesis +// structure. Morse originally serialized accounts as pb.Any types in order to support multiple +// account types. For the purposes of the Morse -> Shannon migration, we're only concerned with +// externally owned accounts (as opposed to module accounts). As a result, we're simplifying its +// representation in Shannon by avoiding usage of pb.Any. It is necessary in order too conform to +// the Morse genesis structure. type MorseAuthAccount struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3246,7 +4607,7 @@ type MorseAuthAccount struct { func (x *MorseAuthAccount) Reset() { *x = MorseAuthAccount{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_migration_legacy_proto_msgTypes[3] + mi := &file_poktroll_migration_legacy_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3260,7 +4621,7 @@ func (*MorseAuthAccount) ProtoMessage() {} // Deprecated: Use MorseAuthAccount.ProtoReflect.Descriptor instead. func (*MorseAuthAccount) Descriptor() ([]byte, []int) { - return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{3} + return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{4} } func (x *MorseAuthAccount) GetType_() string { @@ -3277,76 +4638,186 @@ func (x *MorseAuthAccount) GetValue() *MorseAccount { return nil } -type MorseAuth struct { +// A wrapper around the list of Morse suppliers (aka "validators", "nodes", of "servicers"). +// It is necessary to conform to the Morse genesis structure. +type MorsePos struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Accounts []*MorseAuthAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` + Validators []*MorseValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` } -func (x *MorseAuth) Reset() { - *x = MorseAuth{} +func (x *MorsePos) Reset() { + *x = MorsePos{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_migration_legacy_proto_msgTypes[4] + mi := &file_poktroll_migration_legacy_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MorseAuth) String() string { +func (x *MorsePos) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MorseAuth) ProtoMessage() {} +func (*MorsePos) ProtoMessage() {} -// Deprecated: Use MorseAuth.ProtoReflect.Descriptor instead. -func (*MorseAuth) Descriptor() ([]byte, []int) { - return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{4} +// Deprecated: Use MorsePos.ProtoReflect.Descriptor instead. +func (*MorsePos) Descriptor() ([]byte, []int) { + return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{5} } -func (x *MorseAuth) GetAccounts() []*MorseAuthAccount { +func (x *MorsePos) GetValidators() []*MorseValidator { if x != nil { - return x.Accounts + return x.Validators } return nil } -type MorsePos struct { +// MorseApplication is a subset of the Morse ProtoApplication type. +// It encapsulates the minimum information required to import Morse applications. +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 +type MorseApplication struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Validators []*MorseValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` + // Address is a hex-encoded string representation of the address corresponding + // to a Morse application's ed25519 public key. + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // PublicKey is the binary representation of a Morse application's ed25519 public key. + PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` + StakedTokens string `protobuf:"bytes,6,opt,name=staked_tokens,json=stakedTokens,proto3" json:"staked_tokens,omitempty"` } -func (x *MorsePos) Reset() { - *x = MorsePos{} +func (x *MorseApplication) Reset() { + *x = MorseApplication{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_migration_legacy_proto_msgTypes[5] + mi := &file_poktroll_migration_legacy_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MorsePos) String() string { +func (x *MorseApplication) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MorsePos) ProtoMessage() {} +func (*MorseApplication) ProtoMessage() {} -// Deprecated: Use MorsePos.ProtoReflect.Descriptor instead. -func (*MorsePos) Descriptor() ([]byte, []int) { - return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{5} +// Deprecated: Use MorseApplication.ProtoReflect.Descriptor instead. +func (*MorseApplication) Descriptor() ([]byte, []int) { + return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{6} } -func (x *MorsePos) GetValidators() []*MorseValidator { +func (x *MorseApplication) GetAddress() []byte { if x != nil { - return x.Validators + return x.Address + } + return nil +} + +func (x *MorseApplication) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *MorseApplication) GetJailed() bool { + if x != nil { + return x.Jailed + } + return false +} + +func (x *MorseApplication) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *MorseApplication) GetStakedTokens() string { + if x != nil { + return x.StakedTokens + } + return "" +} + +// MorseValidator is a subset of the Morse ProtoValidator type. +// It encapsulates the minimum information required to import Morse suppliers (aka "servicers" or "validators"). +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 +type MorseValidator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` + PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` + StakedTokens string `protobuf:"bytes,7,opt,name=StakedTokens,proto3" json:"StakedTokens,omitempty"` +} + +func (x *MorseValidator) Reset() { + *x = MorseValidator{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_migration_legacy_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MorseValidator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MorseValidator) ProtoMessage() {} + +// Deprecated: Use MorseValidator.ProtoReflect.Descriptor instead. +func (*MorseValidator) Descriptor() ([]byte, []int) { + return file_poktroll_migration_legacy_proto_rawDescGZIP(), []int{7} +} + +func (x *MorseValidator) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +func (x *MorseValidator) GetPublicKey() []byte { + if x != nil { + return x.PublicKey } return nil } +func (x *MorseValidator) GetJailed() bool { + if x != nil { + return x.Jailed + } + return false +} + +func (x *MorseValidator) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *MorseValidator) GetStakedTokens() string { + if x != nil { + return x.StakedTokens + } + return "" +} + var File_poktroll_migration_legacy_proto protoreflect.FileDescriptor var file_poktroll_migration_legacy_proto_rawDesc = []byte{ @@ -3386,38 +4857,81 @@ var file_poktroll_migration_legacy_proto_rawDesc = []byte{ 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x10, 0xea, 0xde, 0x1f, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x73, 0x0a, 0x10, 0x4d, - 0x6f, 0x72, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1c, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xea, - 0xde, 0x1f, 0x04, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, - 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x09, - 0xea, 0xde, 0x1f, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x5b, 0x0a, 0x09, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x4e, 0x0a, - 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x5e, 0x0a, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x5b, 0x0a, 0x09, 0x4d, + 0x6f, 0x72, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x4e, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x08, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x73, 0x0a, 0x10, 0x4d, 0x6f, 0x72, 0x73, + 0x65, 0x41, 0x75, 0x74, 0x68, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x04, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xea, 0xde, 0x1f, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x09, 0xea, 0xde, 0x1f, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x08, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x12, 0x52, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, - 0x73, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0xb7, 0x01, - 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x4c, 0x65, - 0x67, 0x61, 0x63, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x22, 0xe3, 0x02, + 0x0a, 0x10, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x66, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x42, 0x4c, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0xf2, 0xde, 0x1f, 0x0e, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0xfa, 0xde, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, + 0x66, 0x74, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x42, 0x0a, 0x0a, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x23, + 0xea, 0xde, 0x1f, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0xf2, 0xde, + 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, + 0x65, 0x79, 0x22, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x33, + 0x0a, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x1b, + 0xea, 0xde, 0x1f, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0xf2, 0xde, 0x1f, 0x0d, 0x79, 0x61, + 0x6d, 0x6c, 0x3a, 0x22, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x52, 0x06, 0x6a, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x42, 0x1b, 0xea, 0xde, 0x1f, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xf2, + 0xde, 0x1f, 0x0d, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2f, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x0c, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, + 0xa0, 0x1f, 0x01, 0x22, 0xc1, 0x02, 0x0a, 0x0e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x66, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x4c, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0xf2, 0xde, 0x1f, 0x0e, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xfa, 0xde, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x6f, + 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, + 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x23, 0xea, 0xde, 0x1f, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, + 0x79, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x52, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x12, 0x22, 0x0a, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x42, 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x52, 0x06, 0x6a, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x0c, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x0c, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3a, 0x0c, 0x88, 0xa0, 0x1f, 0x00, 0x98, + 0xa0, 0x1f, 0x01, 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xb7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, + 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3432,27 +4946,27 @@ func file_poktroll_migration_legacy_proto_rawDescGZIP() []byte { return file_poktroll_migration_legacy_proto_rawDescData } -var file_poktroll_migration_legacy_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_migration_legacy_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_poktroll_migration_legacy_proto_goTypes = []interface{}{ (*MorseStateExport)(nil), // 0: poktroll.migration.MorseStateExport (*MorseAppState)(nil), // 1: poktroll.migration.MorseAppState (*MorseApplications)(nil), // 2: poktroll.migration.MorseApplications - (*MorseAuthAccount)(nil), // 3: poktroll.migration.MorseAuthAccount - (*MorseAuth)(nil), // 4: poktroll.migration.MorseAuth + (*MorseAuth)(nil), // 3: poktroll.migration.MorseAuth + (*MorseAuthAccount)(nil), // 4: poktroll.migration.MorseAuthAccount (*MorsePos)(nil), // 5: poktroll.migration.MorsePos (*MorseApplication)(nil), // 6: poktroll.migration.MorseApplication - (*MorseAccount)(nil), // 7: poktroll.migration.MorseAccount - (*MorseValidator)(nil), // 8: poktroll.migration.MorseValidator + (*MorseValidator)(nil), // 7: poktroll.migration.MorseValidator + (*MorseAccount)(nil), // 8: poktroll.migration.MorseAccount } var file_poktroll_migration_legacy_proto_depIdxs = []int32{ 1, // 0: poktroll.migration.MorseStateExport.app_state:type_name -> poktroll.migration.MorseAppState 2, // 1: poktroll.migration.MorseAppState.application:type_name -> poktroll.migration.MorseApplications - 4, // 2: poktroll.migration.MorseAppState.auth:type_name -> poktroll.migration.MorseAuth + 3, // 2: poktroll.migration.MorseAppState.auth:type_name -> poktroll.migration.MorseAuth 5, // 3: poktroll.migration.MorseAppState.pos:type_name -> poktroll.migration.MorsePos 6, // 4: poktroll.migration.MorseApplications.applications:type_name -> poktroll.migration.MorseApplication - 7, // 5: poktroll.migration.MorseAuthAccount.Value:type_name -> poktroll.migration.MorseAccount - 3, // 6: poktroll.migration.MorseAuth.accounts:type_name -> poktroll.migration.MorseAuthAccount - 8, // 7: poktroll.migration.MorsePos.validators:type_name -> poktroll.migration.MorseValidator + 4, // 5: poktroll.migration.MorseAuth.accounts:type_name -> poktroll.migration.MorseAuthAccount + 8, // 6: poktroll.migration.MorseAuthAccount.Value:type_name -> poktroll.migration.MorseAccount + 7, // 7: poktroll.migration.MorsePos.validators:type_name -> poktroll.migration.MorseValidator 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -3504,7 +5018,7 @@ func file_poktroll_migration_legacy_proto_init() { } } file_poktroll_migration_legacy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MorseAuthAccount); i { + switch v := v.(*MorseAuth); i { case 0: return &v.state case 1: @@ -3516,7 +5030,7 @@ func file_poktroll_migration_legacy_proto_init() { } } file_poktroll_migration_legacy_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MorseAuth); i { + switch v := v.(*MorseAuthAccount); i { case 0: return &v.state case 1: @@ -3539,6 +5053,30 @@ func file_poktroll_migration_legacy_proto_init() { return nil } } + file_poktroll_migration_legacy_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MorseApplication); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_migration_legacy_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MorseValidator); 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{ @@ -3546,7 +5084,7 @@ func file_poktroll_migration_legacy_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_migration_legacy_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/api/poktroll/migration/query.pulsar.go b/api/poktroll/migration/query.pulsar.go index a55078adb..789e3d8bd 100644 --- a/api/poktroll/migration/query.pulsar.go +++ b/api/poktroll/migration/query.pulsar.go @@ -1675,6 +1675,7 @@ func (x *QueryParamsResponse) GetParams() *Params { return nil } +// Queries the MorseAccountState which was created with MsgCreateMorseAccountState. type QueryGetMorseAccountStateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1701,6 +1702,7 @@ func (*QueryGetMorseAccountStateRequest) Descriptor() ([]byte, []int) { return file_poktroll_migration_query_proto_rawDescGZIP(), []int{2} } +// Returns the MorseAccountState. If it has not yet been created, an error is returned. type QueryGetMorseAccountStateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/poktroll/migration/query_grpc.pb.go b/api/poktroll/migration/query_grpc.pb.go index 844fc9b41..cb56f319a 100644 --- a/api/poktroll/migration/query_grpc.pb.go +++ b/api/poktroll/migration/query_grpc.pb.go @@ -31,7 +31,7 @@ const ( type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a MorseAccountState by index. + // Queries the MorseAccountState. MorseAccountState(ctx context.Context, in *QueryGetMorseAccountStateRequest, opts ...grpc.CallOption) (*QueryGetMorseAccountStateResponse, error) } @@ -71,7 +71,7 @@ func (c *queryClient) MorseAccountState(ctx context.Context, in *QueryGetMorseAc type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a MorseAccountState by index. + // Queries the MorseAccountState. MorseAccountState(context.Context, *QueryGetMorseAccountStateRequest) (*QueryGetMorseAccountStateResponse, error) mustEmbedUnimplementedQueryServer() } diff --git a/api/poktroll/migration/tx.pulsar.go b/api/poktroll/migration/tx.pulsar.go index cab5731d7..6ba24cdde 100644 --- a/api/poktroll/migration/tx.pulsar.go +++ b/api/poktroll/migration/tx.pulsar.go @@ -873,9 +873,10 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } var ( - md_MsgCreateMorseAccountState protoreflect.MessageDescriptor - fd_MsgCreateMorseAccountState_authority protoreflect.FieldDescriptor - fd_MsgCreateMorseAccountState_morse_account_state protoreflect.FieldDescriptor + md_MsgCreateMorseAccountState protoreflect.MessageDescriptor + fd_MsgCreateMorseAccountState_authority protoreflect.FieldDescriptor + fd_MsgCreateMorseAccountState_morse_account_state protoreflect.FieldDescriptor + fd_MsgCreateMorseAccountState_morse_account_state_hash protoreflect.FieldDescriptor ) func init() { @@ -883,6 +884,7 @@ func init() { md_MsgCreateMorseAccountState = File_poktroll_migration_tx_proto.Messages().ByName("MsgCreateMorseAccountState") fd_MsgCreateMorseAccountState_authority = md_MsgCreateMorseAccountState.Fields().ByName("authority") fd_MsgCreateMorseAccountState_morse_account_state = md_MsgCreateMorseAccountState.Fields().ByName("morse_account_state") + fd_MsgCreateMorseAccountState_morse_account_state_hash = md_MsgCreateMorseAccountState.Fields().ByName("morse_account_state_hash") } var _ protoreflect.Message = (*fastReflection_MsgCreateMorseAccountState)(nil) @@ -962,6 +964,12 @@ func (x *fastReflection_MsgCreateMorseAccountState) Range(f func(protoreflect.Fi return } } + if len(x.MorseAccountStateHash) != 0 { + value := protoreflect.ValueOfBytes(x.MorseAccountStateHash) + if !f(fd_MsgCreateMorseAccountState_morse_account_state_hash, value) { + return + } + } } // Has reports whether a field is populated. @@ -981,6 +989,8 @@ func (x *fastReflection_MsgCreateMorseAccountState) Has(fd protoreflect.FieldDes return x.Authority != "" case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state": return x.MorseAccountState != nil + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + return len(x.MorseAccountStateHash) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1001,6 +1011,8 @@ func (x *fastReflection_MsgCreateMorseAccountState) Clear(fd protoreflect.FieldD x.Authority = "" case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state": x.MorseAccountState = nil + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + x.MorseAccountStateHash = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1023,6 +1035,9 @@ func (x *fastReflection_MsgCreateMorseAccountState) Get(descriptor protoreflect. case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state": value := x.MorseAccountState return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + value := x.MorseAccountStateHash + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1047,6 +1062,8 @@ func (x *fastReflection_MsgCreateMorseAccountState) Set(fd protoreflect.FieldDes x.Authority = value.Interface().(string) case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state": x.MorseAccountState = value.Message().Interface().(*MorseAccountState) + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + x.MorseAccountStateHash = value.Bytes() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1074,6 +1091,8 @@ func (x *fastReflection_MsgCreateMorseAccountState) Mutable(fd protoreflect.Fiel return protoreflect.ValueOfMessage(x.MorseAccountState.ProtoReflect()) case "poktroll.migration.MsgCreateMorseAccountState.authority": panic(fmt.Errorf("field authority of message poktroll.migration.MsgCreateMorseAccountState is not mutable")) + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + panic(fmt.Errorf("field morse_account_state_hash of message poktroll.migration.MsgCreateMorseAccountState is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1092,6 +1111,8 @@ func (x *fastReflection_MsgCreateMorseAccountState) NewField(fd protoreflect.Fie case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state": m := new(MorseAccountState) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.migration.MsgCreateMorseAccountState.morse_account_state_hash": + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MsgCreateMorseAccountState")) @@ -1169,6 +1190,10 @@ func (x *fastReflection_MsgCreateMorseAccountState) ProtoMethods() *protoiface.M l = options.Size(x.MorseAccountState) n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.MorseAccountStateHash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1198,6 +1223,13 @@ func (x *fastReflection_MsgCreateMorseAccountState) ProtoMethods() *protoiface.M i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.MorseAccountStateHash) > 0 { + i -= len(x.MorseAccountStateHash) + copy(dAtA[i:], x.MorseAccountStateHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MorseAccountStateHash))) + i-- + dAtA[i] = 0x1a + } if x.MorseAccountState != nil { encoded, err := options.Marshal(x.MorseAccountState) if err != nil { @@ -1336,6 +1368,40 @@ func (x *fastReflection_MsgCreateMorseAccountState) ProtoMethods() *protoiface.M return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MorseAccountStateHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.MorseAccountStateHash = append(x.MorseAccountStateHash[:0], dAtA[iNdEx:postIndex]...) + if x.MorseAccountStateHash == nil { + x.MorseAccountStateHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2979,14 +3045,24 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_migration_tx_proto_rawDescGZIP(), []int{1} } +// MsgCreateMorseAccountState is used to create the on-chain MorseAccountState ONLY ONCE (per network / re-genesis). type MsgCreateMorseAccountState struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // the account state derived from the Morse state export and the `poktrolld migrate collect-morse-accounts` command. MorseAccountState *MorseAccountState `protobuf:"bytes,2,opt,name=morse_account_state,json=morseAccountState,proto3" json:"morse_account_state,omitempty"` + // expected sha256 hash of the morse_account_state. If this hash does not match the on-chain + // computation, the transaction will fail. Social consensus regarding the correctness of + // morse_account_state should have be achieved off-chain and can be verified on-chain by + // comparing this hash with that of a locally derived Morse state export: + // E.g., `poktrolld migrate collect-morse-accounts $<(pocket util export-genesis-for-reset)`. + // See: `pocket util export-genesis-for-migration --help` & `poktrolld migrate collect-morse-accounts --help` + // for more details. + MorseAccountStateHash []byte `protobuf:"bytes,3,opt,name=morse_account_state_hash,json=morseAccountStateHash,proto3" json:"morse_account_state_hash,omitempty"` } func (x *MsgCreateMorseAccountState) Reset() { @@ -3023,12 +3099,23 @@ func (x *MsgCreateMorseAccountState) GetMorseAccountState() *MorseAccountState { return nil } +func (x *MsgCreateMorseAccountState) GetMorseAccountStateHash() []byte { + if x != nil { + return x.MorseAccountStateHash + } + return nil +} + +// MsgCreateMorseAccountStateResponse represents an on-chain summary of the result of the corresponding MsgCreateMorseAccountState. type MsgCreateMorseAccountStateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StateHash []byte `protobuf:"bytes,1,opt,name=state_hash,json=stateHash,proto3" json:"state_hash,omitempty"` + // On-chain computed sha256 hash of the morse_account_state provided in the corresponding MsgCreateMorseAccountState. + StateHash []byte `protobuf:"bytes,1,opt,name=state_hash,json=stateHash,proto3" json:"state_hash,omitempty"` + // Number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. NumAccounts uint64 `protobuf:"varint,2,opt,name=num_accounts,json=numAccounts,proto3" json:"num_accounts,omitempty"` } @@ -3192,8 +3279,8 @@ var file_poktroll_migration_tx_proto_rawDesc = []byte{ 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd8, - 0x01, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xaf, + 0x02, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, @@ -3205,77 +3292,82 @@ var file_poktroll_migration_tx_proto_rawDesc = []byte{ 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x1b, 0xc8, 0xde, 0x1f, 0x00, 0xea, 0xde, 0x1f, 0x13, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x11, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x88, 0x01, 0x0a, 0x22, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, - 0x68, 0x61, 0x73, 0x68, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x33, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x10, 0xea, 0xde, 0x1f, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x22, 0x93, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, - 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x12, 0x62, 0x0a, 0x14, 0x73, 0x68, - 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x30, 0xea, 0xde, 0x1f, 0x14, 0x73, 0x68, - 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x73, 0x68, 0x61, 0x6e, - 0x6e, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, - 0x0a, 0x11, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6d, - 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x0f, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x53, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x3c, 0x0a, 0x0f, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x13, 0xea, 0xde, 0x1f, 0x0f, - 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x0e, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x3a, - 0x19, 0x82, 0xe7, 0xb0, 0x2a, 0x14, 0x73, 0x68, 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, - 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x19, 0x4d, - 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, - 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, - 0xea, 0xde, 0x1f, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x09, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x32, 0xda, 0x02, 0x0a, 0x03, 0x4d, 0x73, - 0x67, 0x12, 0x60, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, - 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, - 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, - 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, + 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x55, 0x0a, 0x18, 0x6d, 0x6f, 0x72, + 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x1c, 0xea, 0xde, 0x1f, + 0x18, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x15, 0x6d, 0x6f, 0x72, 0x73, 0x65, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, + 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x22, 0x88, 0x01, 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x0e, 0x43, 0x6c, 0x61, 0x69, 0x6d, - 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, - 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0xea, 0xde, 0x1f, + 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x09, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x33, 0x0a, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x10, 0xea, 0xde, + 0x1f, 0x0c, 0x6e, 0x75, 0x6d, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x0b, + 0x6e, 0x75, 0x6d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x93, 0x02, 0x0a, 0x11, + 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, + 0x74, 0x12, 0x62, 0x0a, 0x14, 0x73, 0x68, 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, + 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x30, 0xea, 0xde, 0x1f, 0x14, 0x73, 0x68, 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, + 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x12, 0x73, 0x68, 0x61, 0x6e, 0x6e, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, + 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x72, 0x63, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0f, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x53, 0x72, + 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3c, 0x0a, 0x0f, 0x6d, 0x6f, 0x72, 0x73, + 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x13, 0xea, 0xde, 0x1f, 0x0f, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0e, 0x6d, 0x6f, 0x72, 0x73, 0x65, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x3a, 0x19, 0x82, 0xe7, 0xb0, 0x2a, 0x14, 0x73, 0x68, 0x61, + 0x6e, 0x6e, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, + 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x40, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, + 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, + 0x32, 0xda, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x60, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2b, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x17, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, + 0x0a, 0x0e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, + 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, - 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, - 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb3, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, - 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, + 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x50, 0x6f, 0x6b, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb3, 0x01, + 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, + 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/migration/types.pulsar.go b/api/poktroll/migration/types.pulsar.go index 48a6ca42a..1a1090c0a 100644 --- a/api/poktroll/migration/types.pulsar.go +++ b/api/poktroll/migration/types.pulsar.go @@ -1570,1314 +1570,6 @@ func (x *fastReflection_MorsePublicKey) ProtoMethods() *protoiface.Methods { } } -var ( - md_MorseApplication protoreflect.MessageDescriptor - fd_MorseApplication_address protoreflect.FieldDescriptor - fd_MorseApplication_public_key protoreflect.FieldDescriptor - fd_MorseApplication_jailed protoreflect.FieldDescriptor - fd_MorseApplication_status protoreflect.FieldDescriptor - fd_MorseApplication_staked_tokens protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_migration_types_proto_init() - md_MorseApplication = File_poktroll_migration_types_proto.Messages().ByName("MorseApplication") - fd_MorseApplication_address = md_MorseApplication.Fields().ByName("address") - fd_MorseApplication_public_key = md_MorseApplication.Fields().ByName("public_key") - fd_MorseApplication_jailed = md_MorseApplication.Fields().ByName("jailed") - fd_MorseApplication_status = md_MorseApplication.Fields().ByName("status") - fd_MorseApplication_staked_tokens = md_MorseApplication.Fields().ByName("staked_tokens") -} - -var _ protoreflect.Message = (*fastReflection_MorseApplication)(nil) - -type fastReflection_MorseApplication MorseApplication - -func (x *MorseApplication) ProtoReflect() protoreflect.Message { - return (*fastReflection_MorseApplication)(x) -} - -func (x *MorseApplication) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_migration_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MorseApplication_messageType fastReflection_MorseApplication_messageType -var _ protoreflect.MessageType = fastReflection_MorseApplication_messageType{} - -type fastReflection_MorseApplication_messageType struct{} - -func (x fastReflection_MorseApplication_messageType) Zero() protoreflect.Message { - return (*fastReflection_MorseApplication)(nil) -} -func (x fastReflection_MorseApplication_messageType) New() protoreflect.Message { - return new(fastReflection_MorseApplication) -} -func (x fastReflection_MorseApplication_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MorseApplication -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MorseApplication) Descriptor() protoreflect.MessageDescriptor { - return md_MorseApplication -} - -// 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_MorseApplication) Type() protoreflect.MessageType { - return _fastReflection_MorseApplication_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MorseApplication) New() protoreflect.Message { - return new(fastReflection_MorseApplication) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MorseApplication) Interface() protoreflect.ProtoMessage { - return (*MorseApplication)(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_MorseApplication) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Address) != 0 { - value := protoreflect.ValueOfBytes(x.Address) - if !f(fd_MorseApplication_address, value) { - return - } - } - if len(x.PublicKey) != 0 { - value := protoreflect.ValueOfBytes(x.PublicKey) - if !f(fd_MorseApplication_public_key, value) { - return - } - } - if x.Jailed != false { - value := protoreflect.ValueOfBool(x.Jailed) - if !f(fd_MorseApplication_jailed, value) { - return - } - } - if x.Status != int32(0) { - value := protoreflect.ValueOfInt32(x.Status) - if !f(fd_MorseApplication_status, value) { - return - } - } - if x.StakedTokens != "" { - value := protoreflect.ValueOfString(x.StakedTokens) - if !f(fd_MorseApplication_staked_tokens, 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_MorseApplication) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.migration.MorseApplication.address": - return len(x.Address) != 0 - case "poktroll.migration.MorseApplication.public_key": - return len(x.PublicKey) != 0 - case "poktroll.migration.MorseApplication.jailed": - return x.Jailed != false - case "poktroll.migration.MorseApplication.status": - return x.Status != int32(0) - case "poktroll.migration.MorseApplication.staked_tokens": - return x.StakedTokens != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.migration.MorseApplication.address": - x.Address = nil - case "poktroll.migration.MorseApplication.public_key": - x.PublicKey = nil - case "poktroll.migration.MorseApplication.jailed": - x.Jailed = false - case "poktroll.migration.MorseApplication.status": - x.Status = int32(0) - case "poktroll.migration.MorseApplication.staked_tokens": - x.StakedTokens = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.migration.MorseApplication.address": - value := x.Address - return protoreflect.ValueOfBytes(value) - case "poktroll.migration.MorseApplication.public_key": - value := x.PublicKey - return protoreflect.ValueOfBytes(value) - case "poktroll.migration.MorseApplication.jailed": - value := x.Jailed - return protoreflect.ValueOfBool(value) - case "poktroll.migration.MorseApplication.status": - value := x.Status - return protoreflect.ValueOfInt32(value) - case "poktroll.migration.MorseApplication.staked_tokens": - value := x.StakedTokens - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.migration.MorseApplication.address": - x.Address = value.Bytes() - case "poktroll.migration.MorseApplication.public_key": - x.PublicKey = value.Bytes() - case "poktroll.migration.MorseApplication.jailed": - x.Jailed = value.Bool() - case "poktroll.migration.MorseApplication.status": - x.Status = int32(value.Int()) - case "poktroll.migration.MorseApplication.staked_tokens": - x.StakedTokens = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.migration.MorseApplication.address": - panic(fmt.Errorf("field address of message poktroll.migration.MorseApplication is not mutable")) - case "poktroll.migration.MorseApplication.public_key": - panic(fmt.Errorf("field public_key of message poktroll.migration.MorseApplication is not mutable")) - case "poktroll.migration.MorseApplication.jailed": - panic(fmt.Errorf("field jailed of message poktroll.migration.MorseApplication is not mutable")) - case "poktroll.migration.MorseApplication.status": - panic(fmt.Errorf("field status of message poktroll.migration.MorseApplication is not mutable")) - case "poktroll.migration.MorseApplication.staked_tokens": - panic(fmt.Errorf("field staked_tokens of message poktroll.migration.MorseApplication is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.migration.MorseApplication.address": - return protoreflect.ValueOfBytes(nil) - case "poktroll.migration.MorseApplication.public_key": - return protoreflect.ValueOfBytes(nil) - case "poktroll.migration.MorseApplication.jailed": - return protoreflect.ValueOfBool(false) - case "poktroll.migration.MorseApplication.status": - return protoreflect.ValueOfInt32(int32(0)) - case "poktroll.migration.MorseApplication.staked_tokens": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseApplication")) - } - panic(fmt.Errorf("message poktroll.migration.MorseApplication 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_MorseApplication) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseApplication", 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_MorseApplication) 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_MorseApplication) 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_MorseApplication) 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_MorseApplication) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MorseApplication) - 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.Address) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.PublicKey) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Jailed { - n += 2 - } - if x.Status != 0 { - n += 1 + runtime.Sov(uint64(x.Status)) - } - l = len(x.StakedTokens) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MorseApplication) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.StakedTokens) > 0 { - i -= len(x.StakedTokens) - copy(dAtA[i:], x.StakedTokens) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StakedTokens))) - i-- - dAtA[i] = 0x32 - } - if x.Status != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) - i-- - dAtA[i] = 0x20 - } - if x.Jailed { - i-- - if x.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(x.PublicKey) > 0 { - i -= len(x.PublicKey) - copy(dAtA[i:], x.PublicKey) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PublicKey))) - i-- - dAtA[i] = 0x12 - } - if len(x.Address) > 0 { - i -= len(x.Address) - copy(dAtA[i:], x.Address) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) - 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().(*MorseApplication) - 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: MorseApplication: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseApplication: 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 Address", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Address = append(x.Address[:0], dAtA[iNdEx:postIndex]...) - if x.Address == nil { - x.Address = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.PublicKey = append(x.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if x.PublicKey == nil { - x.PublicKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Jailed = bool(v != 0) - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - x.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Status |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", 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.StakedTokens = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MorseValidator protoreflect.MessageDescriptor - fd_MorseValidator_Address protoreflect.FieldDescriptor - fd_MorseValidator_PublicKey protoreflect.FieldDescriptor - fd_MorseValidator_jailed protoreflect.FieldDescriptor - fd_MorseValidator_status protoreflect.FieldDescriptor - fd_MorseValidator_StakedTokens protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_migration_types_proto_init() - md_MorseValidator = File_poktroll_migration_types_proto.Messages().ByName("MorseValidator") - fd_MorseValidator_Address = md_MorseValidator.Fields().ByName("Address") - fd_MorseValidator_PublicKey = md_MorseValidator.Fields().ByName("PublicKey") - fd_MorseValidator_jailed = md_MorseValidator.Fields().ByName("jailed") - fd_MorseValidator_status = md_MorseValidator.Fields().ByName("status") - fd_MorseValidator_StakedTokens = md_MorseValidator.Fields().ByName("StakedTokens") -} - -var _ protoreflect.Message = (*fastReflection_MorseValidator)(nil) - -type fastReflection_MorseValidator MorseValidator - -func (x *MorseValidator) ProtoReflect() protoreflect.Message { - return (*fastReflection_MorseValidator)(x) -} - -func (x *MorseValidator) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_migration_types_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_MorseValidator_messageType fastReflection_MorseValidator_messageType -var _ protoreflect.MessageType = fastReflection_MorseValidator_messageType{} - -type fastReflection_MorseValidator_messageType struct{} - -func (x fastReflection_MorseValidator_messageType) Zero() protoreflect.Message { - return (*fastReflection_MorseValidator)(nil) -} -func (x fastReflection_MorseValidator_messageType) New() protoreflect.Message { - return new(fastReflection_MorseValidator) -} -func (x fastReflection_MorseValidator_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MorseValidator -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MorseValidator) Descriptor() protoreflect.MessageDescriptor { - return md_MorseValidator -} - -// 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_MorseValidator) Type() protoreflect.MessageType { - return _fastReflection_MorseValidator_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MorseValidator) New() protoreflect.Message { - return new(fastReflection_MorseValidator) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MorseValidator) Interface() protoreflect.ProtoMessage { - return (*MorseValidator)(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_MorseValidator) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Address) != 0 { - value := protoreflect.ValueOfBytes(x.Address) - if !f(fd_MorseValidator_Address, value) { - return - } - } - if len(x.PublicKey) != 0 { - value := protoreflect.ValueOfBytes(x.PublicKey) - if !f(fd_MorseValidator_PublicKey, value) { - return - } - } - if x.Jailed != false { - value := protoreflect.ValueOfBool(x.Jailed) - if !f(fd_MorseValidator_jailed, value) { - return - } - } - if x.Status != int32(0) { - value := protoreflect.ValueOfInt32(x.Status) - if !f(fd_MorseValidator_status, value) { - return - } - } - if x.StakedTokens != "" { - value := protoreflect.ValueOfString(x.StakedTokens) - if !f(fd_MorseValidator_StakedTokens, 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_MorseValidator) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.migration.MorseValidator.Address": - return len(x.Address) != 0 - case "poktroll.migration.MorseValidator.PublicKey": - return len(x.PublicKey) != 0 - case "poktroll.migration.MorseValidator.jailed": - return x.Jailed != false - case "poktroll.migration.MorseValidator.status": - return x.Status != int32(0) - case "poktroll.migration.MorseValidator.StakedTokens": - return x.StakedTokens != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.migration.MorseValidator.Address": - x.Address = nil - case "poktroll.migration.MorseValidator.PublicKey": - x.PublicKey = nil - case "poktroll.migration.MorseValidator.jailed": - x.Jailed = false - case "poktroll.migration.MorseValidator.status": - x.Status = int32(0) - case "poktroll.migration.MorseValidator.StakedTokens": - x.StakedTokens = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.migration.MorseValidator.Address": - value := x.Address - return protoreflect.ValueOfBytes(value) - case "poktroll.migration.MorseValidator.PublicKey": - value := x.PublicKey - return protoreflect.ValueOfBytes(value) - case "poktroll.migration.MorseValidator.jailed": - value := x.Jailed - return protoreflect.ValueOfBool(value) - case "poktroll.migration.MorseValidator.status": - value := x.Status - return protoreflect.ValueOfInt32(value) - case "poktroll.migration.MorseValidator.StakedTokens": - value := x.StakedTokens - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.migration.MorseValidator.Address": - x.Address = value.Bytes() - case "poktroll.migration.MorseValidator.PublicKey": - x.PublicKey = value.Bytes() - case "poktroll.migration.MorseValidator.jailed": - x.Jailed = value.Bool() - case "poktroll.migration.MorseValidator.status": - x.Status = int32(value.Int()) - case "poktroll.migration.MorseValidator.StakedTokens": - x.StakedTokens = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.migration.MorseValidator.Address": - panic(fmt.Errorf("field Address of message poktroll.migration.MorseValidator is not mutable")) - case "poktroll.migration.MorseValidator.PublicKey": - panic(fmt.Errorf("field PublicKey of message poktroll.migration.MorseValidator is not mutable")) - case "poktroll.migration.MorseValidator.jailed": - panic(fmt.Errorf("field jailed of message poktroll.migration.MorseValidator is not mutable")) - case "poktroll.migration.MorseValidator.status": - panic(fmt.Errorf("field status of message poktroll.migration.MorseValidator is not mutable")) - case "poktroll.migration.MorseValidator.StakedTokens": - panic(fmt.Errorf("field StakedTokens of message poktroll.migration.MorseValidator is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.migration.MorseValidator.Address": - return protoreflect.ValueOfBytes(nil) - case "poktroll.migration.MorseValidator.PublicKey": - return protoreflect.ValueOfBytes(nil) - case "poktroll.migration.MorseValidator.jailed": - return protoreflect.ValueOfBool(false) - case "poktroll.migration.MorseValidator.status": - return protoreflect.ValueOfInt32(int32(0)) - case "poktroll.migration.MorseValidator.StakedTokens": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.migration.MorseValidator")) - } - panic(fmt.Errorf("message poktroll.migration.MorseValidator 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_MorseValidator) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.migration.MorseValidator", 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_MorseValidator) 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_MorseValidator) 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_MorseValidator) 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_MorseValidator) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MorseValidator) - 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.Address) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.PublicKey) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Jailed { - n += 2 - } - if x.Status != 0 { - n += 1 + runtime.Sov(uint64(x.Status)) - } - l = len(x.StakedTokens) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MorseValidator) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.StakedTokens) > 0 { - i -= len(x.StakedTokens) - copy(dAtA[i:], x.StakedTokens) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StakedTokens))) - i-- - dAtA[i] = 0x3a - } - if x.Status != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) - i-- - dAtA[i] = 0x20 - } - if x.Jailed { - i-- - if x.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(x.PublicKey) > 0 { - i -= len(x.PublicKey) - copy(dAtA[i:], x.PublicKey) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PublicKey))) - i-- - dAtA[i] = 0x12 - } - if len(x.Address) > 0 { - i -= len(x.Address) - copy(dAtA[i:], x.Address) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) - 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().(*MorseValidator) - 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: MorseValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MorseValidator: 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 Address", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Address = append(x.Address[:0], dAtA[iNdEx:postIndex]...) - if x.Address == nil { - x.Address = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.PublicKey = append(x.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if x.PublicKey == nil { - x.PublicKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Jailed = bool(v != 0) - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - x.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Status |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", 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.StakedTokens = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3018,146 +1710,6 @@ func (x *MorsePublicKey) GetValue() []byte { return nil } -// MorseApplication is a subset of the Morse ProtoApplication type. It encapsulates -// the minimum information required to import Morse applications. -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 -type MorseApplication struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` - StakedTokens string `protobuf:"bytes,6,opt,name=staked_tokens,json=stakedTokens,proto3" json:"staked_tokens,omitempty"` -} - -func (x *MorseApplication) Reset() { - *x = MorseApplication{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_migration_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MorseApplication) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MorseApplication) ProtoMessage() {} - -// Deprecated: Use MorseApplication.ProtoReflect.Descriptor instead. -func (*MorseApplication) Descriptor() ([]byte, []int) { - return file_poktroll_migration_types_proto_rawDescGZIP(), []int{3} -} - -func (x *MorseApplication) GetAddress() []byte { - if x != nil { - return x.Address - } - return nil -} - -func (x *MorseApplication) GetPublicKey() []byte { - if x != nil { - return x.PublicKey - } - return nil -} - -func (x *MorseApplication) GetJailed() bool { - if x != nil { - return x.Jailed - } - return false -} - -func (x *MorseApplication) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *MorseApplication) GetStakedTokens() string { - if x != nil { - return x.StakedTokens - } - return "" -} - -// MorseValidator is a subset of the Morse ProtoValidator type. It encapsulates the -// minimum information required to import Morse suppliers (aka "servicers" or "validators"). -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 -type MorseValidator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` - PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` - StakedTokens string `protobuf:"bytes,7,opt,name=StakedTokens,proto3" json:"StakedTokens,omitempty"` -} - -func (x *MorseValidator) Reset() { - *x = MorseValidator{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_migration_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MorseValidator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MorseValidator) ProtoMessage() {} - -// Deprecated: Use MorseValidator.ProtoReflect.Descriptor instead. -func (*MorseValidator) Descriptor() ([]byte, []int) { - return file_poktroll_migration_types_proto_rawDescGZIP(), []int{4} -} - -func (x *MorseValidator) GetAddress() []byte { - if x != nil { - return x.Address - } - return nil -} - -func (x *MorseValidator) GetPublicKey() []byte { - if x != nil { - return x.PublicKey - } - return nil -} - -func (x *MorseValidator) GetJailed() bool { - if x != nil { - return x.Jailed - } - return false -} - -func (x *MorseValidator) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *MorseValidator) GetStakedTokens() string { - if x != nil { - return x.StakedTokens - } - return "" -} - var File_poktroll_migration_types_proto protoreflect.FileDescriptor var file_poktroll_migration_types_proto_rawDesc = []byte{ @@ -3197,61 +1749,19 @@ var file_poktroll_migration_types_proto_rawDesc = []byte{ 0x79, 0x12, 0x32, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x1c, 0xfa, 0xde, 0x1f, 0x18, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd7, 0x02, 0x0a, 0x10, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x66, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x4c, 0xea, 0xde, 0x1f, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xf2, 0xde, 0x1f, 0x0e, 0x79, 0x61, 0x6d, 0x6c, - 0x3a, 0x22, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xfa, 0xde, 0x1f, 0x2b, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, - 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, - 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x42, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x23, 0xea, 0xde, 0x1f, 0x0a, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x52, 0x09, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x1b, 0xea, 0xde, 0x1f, 0x06, 0x6a, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0xf2, 0xde, 0x1f, 0x0d, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6a, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0x22, 0x52, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x1b, 0xea, 0xde, 0x1f, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0xf2, 0xde, 0x1f, 0x0d, 0x79, 0x61, 0x6d, 0x6c, 0x3a, - 0x22, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x64, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x22, - 0xc1, 0x02, 0x0a, 0x0e, 0x4d, 0x6f, 0x72, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x6f, 0x72, 0x12, 0x66, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x42, 0x4c, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0xf2, 0xde, 0x1f, 0x0e, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0xfa, 0xde, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, 0x66, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x65, 0x74, 0x62, - 0x66, 0x74, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x23, 0xea, - 0xde, 0x1f, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0xf2, 0xde, 0x1f, - 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x22, 0x52, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x22, 0x0a, - 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42, 0x0a, 0xea, - 0xde, 0x1f, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x52, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, - 0x64, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x05, 0x42, 0x0a, 0xea, 0xde, 0x1f, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x64, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xea, 0xde, 0x1f, - 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x64, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3a, 0x0c, 0x88, 0xa0, 0x1f, 0x00, 0x98, 0xa0, 0x1f, 0x01, 0xe8, - 0xa0, 0x1f, 0x01, 0x42, 0xb6, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x23, 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, 0x6d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, 0x02, 0x12, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xb6, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x16, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x23, 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, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x4d, 0x58, 0xaa, 0x02, 0x12, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0xca, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x4d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3266,19 +1776,17 @@ func file_poktroll_migration_types_proto_rawDescGZIP() []byte { return file_poktroll_migration_types_proto_rawDescData } -var file_poktroll_migration_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_poktroll_migration_types_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_poktroll_migration_types_proto_goTypes = []interface{}{ (*MorseAccountState)(nil), // 0: poktroll.migration.MorseAccountState (*MorseAccount)(nil), // 1: poktroll.migration.MorseAccount (*MorsePublicKey)(nil), // 2: poktroll.migration.MorsePublicKey - (*MorseApplication)(nil), // 3: poktroll.migration.MorseApplication - (*MorseValidator)(nil), // 4: poktroll.migration.MorseValidator - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*v1beta1.Coin)(nil), // 3: cosmos.base.v1beta1.Coin } var file_poktroll_migration_types_proto_depIdxs = []int32{ 1, // 0: poktroll.migration.MorseAccountState.accounts:type_name -> poktroll.migration.MorseAccount 2, // 1: poktroll.migration.MorseAccount.pub_key:type_name -> poktroll.migration.MorsePublicKey - 5, // 2: poktroll.migration.MorseAccount.coins:type_name -> cosmos.base.v1beta1.Coin + 3, // 2: poktroll.migration.MorseAccount.coins:type_name -> cosmos.base.v1beta1.Coin 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name @@ -3328,30 +1836,6 @@ func file_poktroll_migration_types_proto_init() { return nil } } - file_poktroll_migration_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MorseApplication); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_poktroll_migration_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MorseValidator); 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{ @@ -3359,7 +1843,7 @@ func file_poktroll_migration_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_migration_types_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/api/poktroll/proof/event.pulsar.go b/api/poktroll/proof/event.pulsar.go index 2954b58b7..9ec8937e5 100644 --- a/api/poktroll/proof/event.pulsar.go +++ b/api/poktroll/proof/event.pulsar.go @@ -2804,6 +2804,601 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { } } +var ( + md_EventProofValidityChecked protoreflect.MessageDescriptor + fd_EventProofValidityChecked_proof protoreflect.FieldDescriptor + fd_EventProofValidityChecked_block_height protoreflect.FieldDescriptor + fd_EventProofValidityChecked_proof_status protoreflect.FieldDescriptor + fd_EventProofValidityChecked_failure_reason protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_event_proto_init() + md_EventProofValidityChecked = File_poktroll_proof_event_proto.Messages().ByName("EventProofValidityChecked") + fd_EventProofValidityChecked_proof = md_EventProofValidityChecked.Fields().ByName("proof") + fd_EventProofValidityChecked_block_height = md_EventProofValidityChecked.Fields().ByName("block_height") + fd_EventProofValidityChecked_proof_status = md_EventProofValidityChecked.Fields().ByName("proof_status") + fd_EventProofValidityChecked_failure_reason = md_EventProofValidityChecked.Fields().ByName("failure_reason") +} + +var _ protoreflect.Message = (*fastReflection_EventProofValidityChecked)(nil) + +type fastReflection_EventProofValidityChecked EventProofValidityChecked + +func (x *EventProofValidityChecked) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventProofValidityChecked)(x) +} + +func (x *EventProofValidityChecked) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_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_EventProofValidityChecked_messageType fastReflection_EventProofValidityChecked_messageType +var _ protoreflect.MessageType = fastReflection_EventProofValidityChecked_messageType{} + +type fastReflection_EventProofValidityChecked_messageType struct{} + +func (x fastReflection_EventProofValidityChecked_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventProofValidityChecked)(nil) +} +func (x fastReflection_EventProofValidityChecked_messageType) New() protoreflect.Message { + return new(fastReflection_EventProofValidityChecked) +} +func (x fastReflection_EventProofValidityChecked_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofValidityChecked +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventProofValidityChecked) Descriptor() protoreflect.MessageDescriptor { + return md_EventProofValidityChecked +} + +// 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_EventProofValidityChecked) Type() protoreflect.MessageType { + return _fastReflection_EventProofValidityChecked_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventProofValidityChecked) New() protoreflect.Message { + return new(fastReflection_EventProofValidityChecked) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventProofValidityChecked) Interface() protoreflect.ProtoMessage { + return (*EventProofValidityChecked)(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_EventProofValidityChecked) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Proof != nil { + value := protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + if !f(fd_EventProofValidityChecked_proof, value) { + return + } + } + if x.BlockHeight != uint64(0) { + value := protoreflect.ValueOfUint64(x.BlockHeight) + if !f(fd_EventProofValidityChecked_block_height, value) { + return + } + } + if x.ProofStatus != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ProofStatus)) + if !f(fd_EventProofValidityChecked_proof_status, value) { + return + } + } + if x.FailureReason != "" { + value := protoreflect.ValueOfString(x.FailureReason) + if !f(fd_EventProofValidityChecked_failure_reason, 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_EventProofValidityChecked) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + return x.Proof != nil + case "poktroll.proof.EventProofValidityChecked.block_height": + return x.BlockHeight != uint64(0) + case "poktroll.proof.EventProofValidityChecked.proof_status": + return x.ProofStatus != 0 + case "poktroll.proof.EventProofValidityChecked.failure_reason": + return x.FailureReason != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + x.Proof = nil + case "poktroll.proof.EventProofValidityChecked.block_height": + x.BlockHeight = uint64(0) + case "poktroll.proof.EventProofValidityChecked.proof_status": + x.ProofStatus = 0 + case "poktroll.proof.EventProofValidityChecked.failure_reason": + x.FailureReason = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + value := x.Proof + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.EventProofValidityChecked.block_height": + value := x.BlockHeight + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofValidityChecked.proof_status": + value := x.ProofStatus + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.proof.EventProofValidityChecked.failure_reason": + value := x.FailureReason + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + x.Proof = value.Message().Interface().(*Proof) + case "poktroll.proof.EventProofValidityChecked.block_height": + x.BlockHeight = value.Uint() + case "poktroll.proof.EventProofValidityChecked.proof_status": + x.ProofStatus = (ClaimProofStatus)(value.Enum()) + case "poktroll.proof.EventProofValidityChecked.failure_reason": + x.FailureReason = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + if x.Proof == nil { + x.Proof = new(Proof) + } + return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + case "poktroll.proof.EventProofValidityChecked.block_height": + panic(fmt.Errorf("field block_height of message poktroll.proof.EventProofValidityChecked is not mutable")) + case "poktroll.proof.EventProofValidityChecked.proof_status": + panic(fmt.Errorf("field proof_status of message poktroll.proof.EventProofValidityChecked is not mutable")) + case "poktroll.proof.EventProofValidityChecked.failure_reason": + panic(fmt.Errorf("field failure_reason of message poktroll.proof.EventProofValidityChecked is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.EventProofValidityChecked.proof": + m := new(Proof) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.EventProofValidityChecked.block_height": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofValidityChecked.proof_status": + return protoreflect.ValueOfEnum(0) + case "poktroll.proof.EventProofValidityChecked.failure_reason": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofValidityChecked")) + } + panic(fmt.Errorf("message poktroll.proof.EventProofValidityChecked 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_EventProofValidityChecked) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.EventProofValidityChecked", 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_EventProofValidityChecked) 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_EventProofValidityChecked) 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_EventProofValidityChecked) 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_EventProofValidityChecked) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventProofValidityChecked) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Proof != nil { + l = options.Size(x.Proof) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.BlockHeight)) + } + if x.ProofStatus != 0 { + n += 1 + runtime.Sov(uint64(x.ProofStatus)) + } + l = len(x.FailureReason) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventProofValidityChecked) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.FailureReason) > 0 { + i -= len(x.FailureReason) + copy(dAtA[i:], x.FailureReason) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FailureReason))) + i-- + dAtA[i] = 0x22 + } + if x.ProofStatus != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProofStatus)) + i-- + dAtA[i] = 0x18 + } + if x.BlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if x.Proof != nil { + encoded, err := options.Marshal(x.Proof) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + 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().(*EventProofValidityChecked) + 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: EventProofValidityChecked: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventProofValidityChecked: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Proof == nil { + x.Proof = &Proof{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proof); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + x.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofStatus", wireType) + } + x.ProofStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ProofStatus |= ClaimProofStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FailureReason", 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.FailureReason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3103,6 +3698,69 @@ func (x *EventProofUpdated) GetClaimedUpokt() *v1beta1.Coin { return nil } +// Event emitted after a proof has been checked for validity in the proof module's +// EndBlocker. +type EventProofValidityChecked struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + ProofStatus ClaimProofStatus `protobuf:"varint,3,opt,name=proof_status,json=proofStatus,proto3,enum=poktroll.proof.ClaimProofStatus" json:"proof_status,omitempty"` + // reason is the string representation of the error that led to the proof being + // marked as invalid (e.g. "invalid closest merkle proof", "invalid relay request signature") + FailureReason string `protobuf:"bytes,4,opt,name=failure_reason,json=failureReason,proto3" json:"failure_reason,omitempty"` +} + +func (x *EventProofValidityChecked) Reset() { + *x = EventProofValidityChecked{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_event_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventProofValidityChecked) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventProofValidityChecked) ProtoMessage() {} + +// Deprecated: Use EventProofValidityChecked.ProtoReflect.Descriptor instead. +func (*EventProofValidityChecked) Descriptor() ([]byte, []int) { + return file_poktroll_proof_event_proto_rawDescGZIP(), []int{4} +} + +func (x *EventProofValidityChecked) GetProof() *Proof { + if x != nil { + return x.Proof + } + return nil +} + +func (x *EventProofValidityChecked) GetBlockHeight() uint64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +func (x *EventProofValidityChecked) GetProofStatus() ClaimProofStatus { + if x != nil { + return x.ProofStatus + } + return ClaimProofStatus_PENDING_VALIDATION +} + +func (x *EventProofValidityChecked) GetFailureReason() string { + if x != nil { + return x.FailureReason + } + return "" +} + var File_poktroll_proof_event_proto protoreflect.FileDescriptor var file_poktroll_proof_event_proto_rawDesc = []byte{ @@ -3219,18 +3877,35 @@ var file_poktroll_proof_event_proto_rawDesc = []byte{ 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, - 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, - 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x9a, 0x02, 0x0a, 0x19, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, + 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x33, + 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x10, 0xea, 0xde, 0x1f, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x12, 0x55, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x10, 0xea, 0xde, 0x1f, + 0x0c, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x39, 0x0a, 0x0e, 0x66, 0x61, + 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x12, 0xea, 0xde, 0x1f, 0x0e, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, + 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, + 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3245,32 +3920,36 @@ func file_poktroll_proof_event_proto_rawDescGZIP() []byte { return file_poktroll_proof_event_proto_rawDescData } -var file_poktroll_proof_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_proof_event_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_poktroll_proof_event_proto_goTypes = []interface{}{ - (*EventClaimCreated)(nil), // 0: poktroll.proof.EventClaimCreated - (*EventClaimUpdated)(nil), // 1: poktroll.proof.EventClaimUpdated - (*EventProofSubmitted)(nil), // 2: poktroll.proof.EventProofSubmitted - (*EventProofUpdated)(nil), // 3: poktroll.proof.EventProofUpdated - (*Claim)(nil), // 4: poktroll.proof.Claim - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin - (*Proof)(nil), // 6: poktroll.proof.Proof + (*EventClaimCreated)(nil), // 0: poktroll.proof.EventClaimCreated + (*EventClaimUpdated)(nil), // 1: poktroll.proof.EventClaimUpdated + (*EventProofSubmitted)(nil), // 2: poktroll.proof.EventProofSubmitted + (*EventProofUpdated)(nil), // 3: poktroll.proof.EventProofUpdated + (*EventProofValidityChecked)(nil), // 4: poktroll.proof.EventProofValidityChecked + (*Claim)(nil), // 5: poktroll.proof.Claim + (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin + (*Proof)(nil), // 7: poktroll.proof.Proof + (ClaimProofStatus)(0), // 8: poktroll.proof.ClaimProofStatus } var file_poktroll_proof_event_proto_depIdxs = []int32{ - 4, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim - 5, // 1: poktroll.proof.EventClaimCreated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin - 4, // 2: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim - 5, // 3: poktroll.proof.EventClaimUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin - 4, // 4: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim - 6, // 5: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof - 5, // 6: poktroll.proof.EventProofSubmitted.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin - 4, // 7: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim - 6, // 8: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof - 5, // 9: poktroll.proof.EventProofUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 5, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim + 6, // 1: poktroll.proof.EventClaimCreated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 2: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim + 6, // 3: poktroll.proof.EventClaimUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 4: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim + 7, // 5: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof + 6, // 6: poktroll.proof.EventProofSubmitted.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 7: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim + 7, // 8: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof + 6, // 9: poktroll.proof.EventProofUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin + 7, // 10: poktroll.proof.EventProofValidityChecked.proof:type_name -> poktroll.proof.Proof + 8, // 11: poktroll.proof.EventProofValidityChecked.proof_status:type_name -> poktroll.proof.ClaimProofStatus + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_poktroll_proof_event_proto_init() } @@ -3328,6 +4007,18 @@ func file_poktroll_proof_event_proto_init() { return nil } } + file_poktroll_proof_event_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventProofValidityChecked); 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{ @@ -3335,7 +4026,7 @@ func file_poktroll_proof_event_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_proof_event_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/api/poktroll/proof/types.pulsar.go b/api/poktroll/proof/types.pulsar.go index ac6d5b248..a49834e88 100644 --- a/api/poktroll/proof/types.pulsar.go +++ b/api/poktroll/proof/types.pulsar.go @@ -585,6 +585,7 @@ var ( fd_Claim_supplier_operator_address protoreflect.FieldDescriptor fd_Claim_session_header protoreflect.FieldDescriptor fd_Claim_root_hash protoreflect.FieldDescriptor + fd_Claim_proof_validation_status protoreflect.FieldDescriptor ) func init() { @@ -593,6 +594,7 @@ func init() { fd_Claim_supplier_operator_address = md_Claim.Fields().ByName("supplier_operator_address") fd_Claim_session_header = md_Claim.Fields().ByName("session_header") fd_Claim_root_hash = md_Claim.Fields().ByName("root_hash") + fd_Claim_proof_validation_status = md_Claim.Fields().ByName("proof_validation_status") } var _ protoreflect.Message = (*fastReflection_Claim)(nil) @@ -678,6 +680,12 @@ func (x *fastReflection_Claim) Range(f func(protoreflect.FieldDescriptor, protor return } } + if x.ProofValidationStatus != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ProofValidationStatus)) + if !f(fd_Claim_proof_validation_status, value) { + return + } + } } // Has reports whether a field is populated. @@ -699,6 +707,8 @@ func (x *fastReflection_Claim) Has(fd protoreflect.FieldDescriptor) bool { return x.SessionHeader != nil case "poktroll.proof.Claim.root_hash": return len(x.RootHash) != 0 + case "poktroll.proof.Claim.proof_validation_status": + return x.ProofValidationStatus != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -721,6 +731,8 @@ func (x *fastReflection_Claim) Clear(fd protoreflect.FieldDescriptor) { x.SessionHeader = nil case "poktroll.proof.Claim.root_hash": x.RootHash = nil + case "poktroll.proof.Claim.proof_validation_status": + x.ProofValidationStatus = 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -746,6 +758,9 @@ func (x *fastReflection_Claim) Get(descriptor protoreflect.FieldDescriptor) prot case "poktroll.proof.Claim.root_hash": value := x.RootHash return protoreflect.ValueOfBytes(value) + case "poktroll.proof.Claim.proof_validation_status": + value := x.ProofValidationStatus + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -772,6 +787,8 @@ func (x *fastReflection_Claim) Set(fd protoreflect.FieldDescriptor, value protor x.SessionHeader = value.Message().Interface().(*session.SessionHeader) case "poktroll.proof.Claim.root_hash": x.RootHash = value.Bytes() + case "poktroll.proof.Claim.proof_validation_status": + x.ProofValidationStatus = (ClaimProofStatus)(value.Enum()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -801,6 +818,8 @@ func (x *fastReflection_Claim) Mutable(fd protoreflect.FieldDescriptor) protoref panic(fmt.Errorf("field supplier_operator_address of message poktroll.proof.Claim is not mutable")) case "poktroll.proof.Claim.root_hash": panic(fmt.Errorf("field root_hash of message poktroll.proof.Claim is not mutable")) + case "poktroll.proof.Claim.proof_validation_status": + panic(fmt.Errorf("field proof_validation_status of message poktroll.proof.Claim is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -821,6 +840,8 @@ func (x *fastReflection_Claim) NewField(fd protoreflect.FieldDescriptor) protore return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.proof.Claim.root_hash": return protoreflect.ValueOfBytes(nil) + case "poktroll.proof.Claim.proof_validation_status": + return protoreflect.ValueOfEnum(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) @@ -902,6 +923,9 @@ func (x *fastReflection_Claim) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.ProofValidationStatus != 0 { + n += 1 + runtime.Sov(uint64(x.ProofValidationStatus)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -931,6 +955,11 @@ func (x *fastReflection_Claim) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ProofValidationStatus != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProofValidationStatus)) + i-- + dAtA[i] = 0x20 + } if len(x.RootHash) > 0 { i -= len(x.RootHash) copy(dAtA[i:], x.RootHash) @@ -1110,6 +1139,25 @@ func (x *fastReflection_Claim) ProtoMethods() *protoiface.Methods { x.RootHash = []byte{} } iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofValidationStatus", wireType) + } + x.ProofValidationStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ProofValidationStatus |= ClaimProofStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1263,6 +1311,57 @@ func (ClaimProofStage) EnumDescriptor() ([]byte, []int) { return file_poktroll_proof_types_proto_rawDescGZIP(), []int{1} } +// Status of proof validation for a claim +// Default is PENDING_VALIDATION regardless of proof requirement +type ClaimProofStatus int32 + +const ( + ClaimProofStatus_PENDING_VALIDATION ClaimProofStatus = 0 + ClaimProofStatus_VALIDATED ClaimProofStatus = 1 + ClaimProofStatus_INVALID ClaimProofStatus = 2 +) + +// Enum value maps for ClaimProofStatus. +var ( + ClaimProofStatus_name = map[int32]string{ + 0: "PENDING_VALIDATION", + 1: "VALIDATED", + 2: "INVALID", + } + ClaimProofStatus_value = map[string]int32{ + "PENDING_VALIDATION": 0, + "VALIDATED": 1, + "INVALID": 2, + } +) + +func (x ClaimProofStatus) Enum() *ClaimProofStatus { + p := new(ClaimProofStatus) + *p = x + return p +} + +func (x ClaimProofStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClaimProofStatus) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_proof_types_proto_enumTypes[2].Descriptor() +} + +func (ClaimProofStatus) Type() protoreflect.EnumType { + return &file_poktroll_proof_types_proto_enumTypes[2] +} + +func (x ClaimProofStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClaimProofStatus.Descriptor instead. +func (ClaimProofStatus) EnumDescriptor() ([]byte, []int) { + return file_poktroll_proof_types_proto_rawDescGZIP(), []int{2} +} + type Proof struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1323,11 +1422,14 @@ type Claim struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Address of the supplier's operator that submitted this claim. SupplierOperatorAddress string `protobuf:"bytes,1,opt,name=supplier_operator_address,json=supplierOperatorAddress,proto3" json:"supplier_operator_address,omitempty"` // the address of the supplier's operator that submitted this claim - // The session header of the session that this claim is for. + // Session header this claim is for. SessionHeader *session.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` - // Root hash returned from smt.SMST#Root(). + // Root hash from smt.SMST#Root(). RootHash []byte `protobuf:"bytes,3,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` + // Important: This field MUST only be set by proofKeeper#EnsureValidProofSignaturesAndClosestPath + ProofValidationStatus ClaimProofStatus `protobuf:"varint,4,opt,name=proof_validation_status,json=proofValidationStatus,proto3,enum=poktroll.proof.ClaimProofStatus" json:"proof_validation_status,omitempty"` } func (x *Claim) Reset() { @@ -1371,6 +1473,13 @@ func (x *Claim) GetRootHash() []byte { return nil } +func (x *Claim) GetProofValidationStatus() ClaimProofStatus { + if x != nil { + return x.ProofValidationStatus + } + return ClaimProofStatus_PENDING_VALIDATION +} + var File_poktroll_proof_types_proto protoreflect.FileDescriptor var file_poktroll_proof_types_proto_rawDesc = []byte{ @@ -1395,7 +1504,7 @@ var file_poktroll_proof_types_proto_rawDesc = []byte{ 0x64, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x72, 0x6b, 0x6c, 0x65, - 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0xc2, 0x01, 0x0a, 0x05, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x9c, 0x02, 0x0a, 0x05, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x54, 0x0a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, @@ -1407,27 +1516,37 @@ var file_poktroll_proof_types_proto_rawDesc = []byte{ 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x2a, 0x4c, 0x0a, 0x16, 0x50, 0x72, - 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x0c, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, - 0x49, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x42, 0x41, 0x42, - 0x49, 0x4c, 0x49, 0x53, 0x54, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, - 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x02, 0x2a, 0x44, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x69, - 0x6d, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, - 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x52, 0x4f, 0x56, - 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, - 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x42, 0x9e, - 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, - 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, - 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x58, 0x0a, 0x17, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, + 0x69, 0x6d, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x15, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x2a, 0x4c, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x10, + 0x0a, 0x0c, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x42, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x53, 0x54, 0x49, + 0x43, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, + 0x10, 0x02, 0x2a, 0x44, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x52, 0x4f, 0x56, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x45, 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x45, + 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x46, 0x0a, 0x10, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, + 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, + 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x54, 0x79, 0x70, + 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, + 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, + 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1442,23 +1561,25 @@ func file_poktroll_proof_types_proto_rawDescGZIP() []byte { return file_poktroll_proof_types_proto_rawDescData } -var file_poktroll_proof_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_poktroll_proof_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_poktroll_proof_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_poktroll_proof_types_proto_goTypes = []interface{}{ (ProofRequirementReason)(0), // 0: poktroll.proof.ProofRequirementReason (ClaimProofStage)(0), // 1: poktroll.proof.ClaimProofStage - (*Proof)(nil), // 2: poktroll.proof.Proof - (*Claim)(nil), // 3: poktroll.proof.Claim - (*session.SessionHeader)(nil), // 4: poktroll.session.SessionHeader + (ClaimProofStatus)(0), // 2: poktroll.proof.ClaimProofStatus + (*Proof)(nil), // 3: poktroll.proof.Proof + (*Claim)(nil), // 4: poktroll.proof.Claim + (*session.SessionHeader)(nil), // 5: poktroll.session.SessionHeader } var file_poktroll_proof_types_proto_depIdxs = []int32{ - 4, // 0: poktroll.proof.Proof.session_header:type_name -> poktroll.session.SessionHeader - 4, // 1: poktroll.proof.Claim.session_header:type_name -> poktroll.session.SessionHeader - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 5, // 0: poktroll.proof.Proof.session_header:type_name -> poktroll.session.SessionHeader + 5, // 1: poktroll.proof.Claim.session_header:type_name -> poktroll.session.SessionHeader + 2, // 2: poktroll.proof.Claim.proof_validation_status:type_name -> poktroll.proof.ClaimProofStatus + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_proof_types_proto_init() } @@ -1497,7 +1618,7 @@ func file_poktroll_proof_types_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_proof_types_proto_rawDesc, - NumEnums: 2, + NumEnums: 3, NumMessages: 2, NumExtensions: 0, NumServices: 0, diff --git a/app/app.go b/app/app.go index 6e9cff698..7a9100f29 100644 --- a/app/app.go +++ b/app/app.go @@ -1,7 +1,6 @@ package app import ( - migrationmodulekeeper "github.com/pokt-network/poktroll/x/migration/keeper" // this line is used by starport scaffolding # stargate/app/moduleImport "io" "os" @@ -70,9 +69,9 @@ type App struct { // simulation manager sm *module.SimulationManager - MigrationKeeper migrationmodulekeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration - // Ignite CLI adds keepers here when scaffolding new modules. Please move the created keeper to the `keepers` package. + // MUST_READ_DEV_NOTE: Ignite CLI adds keepers here when scaffolding new modules. + // MUST_READ_DEV_ACTION_ITEM: Please move the created keeper to the `keepers` package. } func init() { @@ -216,9 +215,10 @@ func New( &app.Keepers.ProofKeeper, &app.Keepers.TokenomicsKeeper, &app.Keepers.SharedKeeper, - &app.MigrationKeeper, + &app.Keepers.MigrationKeeper, // this line is used by starport scaffolding # stargate/app/keeperDefinition - // Ignite CLI adds keepers here when scaffolding new modules. Please move the created keeper to the `keepers` package. + // MUST_READ_DEV_NOTE: Ignite CLI adds keepers here when scaffolding new modules. + // MUST_READ_DEV_ACTION_ITEM: Please move the created keeper to the `keepers` package. ); err != nil { panic(err) } diff --git a/app/keepers/types.go b/app/keepers/types.go index 2125523c5..f169bc7ff 100644 --- a/app/keepers/types.go +++ b/app/keepers/types.go @@ -32,6 +32,7 @@ import ( applicationmodulekeeper "github.com/pokt-network/poktroll/x/application/keeper" gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" + migrationmodulekeeper "github.com/pokt-network/poktroll/x/migration/keeper" proofmodulekeeper "github.com/pokt-network/poktroll/x/proof/keeper" servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" sessionmodulekeeper "github.com/pokt-network/poktroll/x/session/keeper" @@ -82,4 +83,5 @@ type Keepers struct { ProofKeeper proofmodulekeeper.Keeper TokenomicsKeeper tokenomicsmodulekeeper.Keeper SharedKeeper sharedmodulekeeper.Keeper + MigrationKeeper migrationmodulekeeper.Keeper } diff --git a/cmd/poktrolld/cmd/migrate/errors.go b/cmd/poktrolld/cmd/migrate/errors.go new file mode 100644 index 000000000..dc21a7f0c --- /dev/null +++ b/cmd/poktrolld/cmd/migrate/errors.go @@ -0,0 +1,14 @@ +package migrate + +import sdkerrors "cosmossdk.io/errors" + +const codespace = "poktrolld/migrate" + +var ( + // ErrInvalidUsage usage is returned when the CLI arguments are invalid. + ErrInvalidUsage = sdkerrors.Register(codespace, 1100, "invalid usage") + // ErrMorseExportState is returned with the JSON generated from `pocket util export-genesis-for-reset` is invalid. + ErrMorseExportState = sdkerrors.Register(codespace, 1101, "morse export state") + // ErrMorseStateTransform is returned upon general failure when transforming the MorseExportState into the MorseAccountState. + ErrMorseStateTransform = sdkerrors.Register(codespace, 1102, "morse state transform") +) diff --git a/cmd/poktrolld/cmd/migrate/migrate.go b/cmd/poktrolld/cmd/migrate/migrate.go index ae0cccddc..cd803a304 100644 --- a/cmd/poktrolld/cmd/migrate/migrate.go +++ b/cmd/poktrolld/cmd/migrate/migrate.go @@ -2,6 +2,7 @@ package migrate import ( "fmt" + "io" "os" cosmosmath "cosmossdk.io/math" @@ -9,65 +10,116 @@ import ( "github.com/spf13/cobra" "github.com/pokt-network/poktroll/app/volatile" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" migrationtypes "github.com/pokt-network/poktroll/x/migration/types" ) -var collectMorseAccountsCmd = &cobra.Command{ - Use: "collect-morse-accounts [morse-state-path] [morse-accounts-path]", - Args: cobra.ExactArgs(2), - Short: "Collect all account balances and corresponding stakes from the JSON file at [morse-state-path] and outputs them as JSON to [morse-accounts-path]", - Long: `Collects the account balances and corresponding stakes from the MorseStateExport JSON file at morse-state-path +var ( + flagDebugAccountsPerLog int + flagLogLevel string + flagLogOutput string + logger polylog.Logger + + collectMorseAccountsCmd = &cobra.Command{ + Use: "collect-morse-accounts [morse-state-export-path] [morse-account-state-path]", + Args: cobra.ExactArgs(2), + Short: "Collect all account balances and corresponding stakes from the JSON file at [morse-state-export-path] and outputs them as JSON to [morse-account-state-path]", + Long: `Collects the account balances and corresponding stakes from the MorseStateExport JSON file at morse-state-path and outputs them as a MorseAccountState JSON to morse-accounts-path for use with Shannon's MsgUploadMorseState. The Morse state export is generated via the Morse CLI: pocket util export-genesis-for-reset [height] [new-chain-id] > morse-state-export.json`, - RunE: runCollectMorseAccounts, -} + PreRunE: func(cmd *cobra.Command, args []string) error { + var ( + logOutput io.Writer + err error + ) + logLevel := polyzero.ParseLevel(flagLogLevel) + if flagLogOutput == "-" { + logOutput = os.Stderr + } else { + logOutput, err = os.Open(flagLogOutput) + if err != nil { + return err + } + } + + logger = polyzero.NewLogger( + polyzero.WithLevel(logLevel), + polyzero.WithOutput(logOutput), + ).With("cmd", "migrate") + return nil + }, + RunE: runCollectMorseAccounts, + } +) func MigrateCmd() *cobra.Command { - cmd := &cobra.Command{ + migrateCmd := &cobra.Command{ Use: "migrate", Short: "Migration commands", } - cmd.AddCommand(collectMorseAccountsCmd) + migrateCmd.AddCommand(collectMorseAccountsCmd) + migrateCmd.PersistentFlags().StringVar(&flagLogLevel, "log-level", "info", "The logging level (debug|info|warn|error)") + migrateCmd.PersistentFlags().StringVar(&flagLogOutput, "log-output", "-", "The logging output (file path); defaults to stdout") + + collectMorseAccountsCmd.Flags().IntVar(&flagDebugAccountsPerLog, "debug-accounts-per-log", 0, "The number of accounts to log per debug message") - return cmd + return migrateCmd } // runCollectedMorseAccounts is run by the `poktrolld migrate collect-morse-accounts` command. -func runCollectMorseAccounts(cmd *cobra.Command, args []string) error { - inputPath := args[0] - outputPath := args[1] +func runCollectMorseAccounts(_ *cobra.Command, args []string) error { + // DEV_NOTE: No need to check args length due to cobra.ExactArgs(2). + morseStateExportPath := args[0] + morseAccountStatePath := args[1] - return collectMorseAccounts(inputPath, outputPath) -} + logger.Info(). + Str("morse_state_export_path", morseStateExportPath). + Str("morse_account_state_path", morseAccountStatePath). + Msg("collecting Morse accounts...") -// collectMorseAccounts transforms the JSON serialized MorseStateExport at -// inputStatePath into a JSON serialized MorseAccountState at outputStatePath. -func collectMorseAccounts(inputStatePath, outputStatePath string) error { - if err := validatePathIsFile(inputStatePath); err != nil { + morseWorkspace, err := collectMorseAccounts(morseStateExportPath, morseAccountStatePath) + if err != nil { return err } - inputStateJSON, err := os.ReadFile(inputStatePath) + return morseWorkspace.infoLogComplete() +} + +// collectMorseAccounts reads and transforms the JSON serialized MorseStateExport +// at morseStateExportPath into a JSON serialized MorseAccountState, and then writes +// it to morseAccountStatePath. +func collectMorseAccounts(morseStateExportPath, morseAccountStatePath string) (*morseImportWorkspace, error) { + if err := validatePathIsFile(morseStateExportPath); err != nil { + return nil, err + } + + inputStateJSON, err := os.ReadFile(morseStateExportPath) if err != nil { - return err + return nil, err } inputState := new(migrationtypes.MorseStateExport) if err = cmtjson.Unmarshal(inputStateJSON, inputState); err != nil { - return err + return nil, err } - outputStateJSON, err := transformMorseState(inputState) + morseWorkspace := newMorseImportWorkspace() + if err = transformMorseState(inputState, morseWorkspace); err != nil { + return nil, err + } + + outputStateJSONBz, err := cmtjson.Marshal(morseWorkspace.accountState) if err != nil { - return err + return nil, err } - if err = os.WriteFile(outputStatePath, outputStateJSON, 0644); err != nil { - return err + if err = os.WriteFile(morseAccountStatePath, outputStateJSONBz, 0644); err != nil { + return nil, err } - return nil + return morseWorkspace, nil } // validatePathIsFile returns an error if the given path does not exist or is not a file. @@ -78,51 +130,62 @@ func validatePathIsFile(path string) error { } if info.IsDir() { - return fmt.Errorf("[morse-JSON-input-path] cannot be a directory") + return ErrInvalidUsage.Wrapf("[morse-JSON-input-path] cannot be a directory: %s", path) } - return nil } // transformMorseState consolidates the Morse account balance, application stake, // and supplier stake for each account as an entry in the resulting MorseAccountState. -func transformMorseState(inputState *migrationtypes.MorseStateExport) ([]byte, error) { - morseWorkspace := &morseImportWorkspace{ - addressToIdx: make(map[string]uint64), - accounts: make([]*migrationtypes.MorseAccount, 0), - } - +func transformMorseState( + inputState *migrationtypes.MorseStateExport, + morseWorkspace *morseImportWorkspace, +) error { // Iterate over accounts and copy the balances. + logger.Info().Msg("collecting account balances...") if err := collectInputAccountBalances(inputState, morseWorkspace); err != nil { - return nil, err + return err } // Iterate over applications and add the stakes to the corresponding account balances. + logger.Info().Msg("collecting application stakes...") if err := collectInputApplicationStakes(inputState, morseWorkspace); err != nil { - return nil, err + return err } // Iterate over suppliers and add the stakes to the corresponding account balances. + logger.Info().Msg("collecting supplier stakes...") err := collectInputSupplierStakes(inputState, morseWorkspace) if err != nil { - return nil, err + return err } - morseAccountState := &migrationtypes.MorseAccountState{Accounts: morseWorkspace.accounts} - return cmtjson.Marshal(morseAccountState) + morseWorkspace.accountState = &migrationtypes.MorseAccountState{Accounts: morseWorkspace.accounts} + return nil } // collectInputAccountBalances iterates over the accounts in the inputState and // adds the balances to the corresponding account balances in the morseWorkspace. func collectInputAccountBalances(inputState *migrationtypes.MorseStateExport, morseWorkspace *morseImportWorkspace) error { - for _, exportAccount := range inputState.AppState.Auth.Accounts { + for exportAccountIdx, exportAccount := range inputState.AppState.Auth.Accounts { + if shouldDebugLogProgress(exportAccountIdx) { + morseWorkspace.debugLogProgress(exportAccountIdx) + } + // DEV_NOTE: Ignore module accounts. if exportAccount.Type != "posmint/Account" { + logger.Warn(). + Str("type", exportAccount.Type). + Str("address", exportAccount.Value.Address.String()). + Str("coins", fmt.Sprintf("%s", exportAccount.Value.Coins)). + Msg("ignoring non-EOA account") continue } - addr := exportAccount.Value.Address.String() - morseWorkspace.ensureAccount(addr, exportAccount) + accountAddr := exportAccount.Value.Address.String() + if _, _, err := morseWorkspace.ensureAccount(accountAddr, exportAccount); err != nil { + return err + } coins := exportAccount.Value.Coins if len(coins) == 0 { @@ -130,37 +193,56 @@ func collectInputAccountBalances(inputState *migrationtypes.MorseStateExport, mo } // DEV_NOTE: SHOULD ONLY be one denom (upokt). + if len(coins) != 1 { + return ErrMorseExportState.Wrapf( + "account %q has %d token denominations, expected upokt only: %s", + accountAddr, len(coins), coins, + ) + } + coin := coins[0] if coin.Denom != volatile.DenomuPOKT { - return fmt.Errorf("unsupported denom %q", coin.Denom) + return ErrMorseExportState.Wrapf("unsupported denom %q", coin.Denom) } - if err := morseWorkspace.addUpokt(addr, coin.Amount); err != nil { - return err + if err := morseWorkspace.addUpokt(accountAddr, coin.Amount); err != nil { + return fmt.Errorf( + "adding morse account balance (%s) to account balance of address %q: %w", + coin, accountAddr, err, + ) } } return nil } +// shouldDebugLogProgress returns true if the given exportAccountIdx should be logged +// via debugLogProgress. +func shouldDebugLogProgress(exportAccountIdx int) bool { + return flagDebugAccountsPerLog > 0 && + exportAccountIdx%flagDebugAccountsPerLog == 0 +} + // collectInputApplicationStakes iterates over the applications in the inputState and // adds the stake to the corresponding account balances in the morseWorkspace. func collectInputApplicationStakes(inputState *migrationtypes.MorseStateExport, morseWorkspace *morseImportWorkspace) error { for _, exportApplication := range inputState.AppState.Application.Applications { - addr := exportApplication.Address.String() + appAddr := exportApplication.Address.String() // DEV_NOTE: An account SHOULD exist for each actor. - if !morseWorkspace.hasAccount(addr) { - // TODO_IN_THIS_COMMIT: consolidate error types... - return fmt.Errorf("account %q not found", addr) + if !morseWorkspace.hasAccount(appAddr) { + return ErrMorseExportState.Wrapf("account not found corresponding to application with address %q", appAddr) } appStakeAmtUpokt, ok := cosmosmath.NewIntFromString(exportApplication.StakedTokens) if !ok { - return fmt.Errorf("failed to parse application stake amount %q", exportApplication.StakedTokens) + return ErrMorseExportState.Wrapf("failed to parse application stake amount %q", exportApplication.StakedTokens) } - if err := morseWorkspace.addUpokt(addr, appStakeAmtUpokt); err != nil { - return err + if err := morseWorkspace.addUpokt(appAddr, appStakeAmtUpokt); err != nil { + return fmt.Errorf( + "adding application stake amount to account balance of address %q: %w", + appAddr, err, + ) } } return nil @@ -170,21 +252,23 @@ func collectInputApplicationStakes(inputState *migrationtypes.MorseStateExport, // adds the stake to the corresponding account balances in the morseWorkspace. func collectInputSupplierStakes(inputState *migrationtypes.MorseStateExport, morseWorkspace *morseImportWorkspace) error { for _, exportSupplier := range inputState.AppState.Pos.Validators { - addr := exportSupplier.Address.String() + supplierAddr := exportSupplier.Address.String() // DEV_NOTE: An account SHOULD exist for each actor. - if !morseWorkspace.hasAccount(addr) { - // TODO_IN_THIS_COMMIT: consolidate error types... - return fmt.Errorf("account %q not found", addr) + if !morseWorkspace.hasAccount(supplierAddr) { + return ErrMorseExportState.Wrapf("account not found corresponding to supplier with address %q", supplierAddr) } supplierStakeAmtUpokt, ok := cosmosmath.NewIntFromString(exportSupplier.StakedTokens) if !ok { - return fmt.Errorf("failed to parse supplier stake amount %q", exportSupplier.StakedTokens) + return ErrMorseExportState.Wrapf("failed to parse supplier stake amount %q", exportSupplier.StakedTokens) } - if err := morseWorkspace.addUpokt(addr, supplierStakeAmtUpokt); err != nil { - return err + if err := morseWorkspace.addUpokt(supplierAddr, supplierStakeAmtUpokt); err != nil { + return fmt.Errorf( + "adding supplier stake amount to account balance of address %q: %w", + supplierAddr, err, + ) } } return nil diff --git a/cmd/poktrolld/cmd/migrate/migrate_test.go b/cmd/poktrolld/cmd/migrate/migrate_test.go index 4216d363c..3e26c507e 100644 --- a/cmd/poktrolld/cmd/migrate/migrate_test.go +++ b/cmd/poktrolld/cmd/migrate/migrate_test.go @@ -11,10 +11,16 @@ import ( cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" "github.com/pokt-network/poktroll/testutil/testmigration" migrationtypes "github.com/pokt-network/poktroll/x/migration/types" ) +func init() { + logger = polyzero.NewLogger(polyzero.WithLevel(polyzero.DebugLevel)) + flagDebugAccountsPerLog = 1 +} + func TestCollectMorseAccounts(t *testing.T) { tmpDir := t.TempDir() outputPath := filepath.Join(tmpDir, "morse-state-output.json") @@ -29,7 +35,7 @@ func TestCollectMorseAccounts(t *testing.T) { require.NoError(t, err) // Call the function under test. - err = collectMorseAccounts(inputFile.Name(), outputPath) + _, err = collectMorseAccounts(inputFile.Name(), outputPath) require.NoError(t, err) outputJSON, err := os.ReadFile(outputPath) @@ -58,14 +64,12 @@ func TestNewTestMorseStateExport(t *testing.T) { require.Equal(t, i, len(exportAccounts)) expectedShannonBalance := fmt.Sprintf("%d%d%d0%d%d%d", i, i, i, i, i, i) - morseAccountState := new(migrationtypes.MorseAccountState) - morseAccountStateBz, err := transformMorseState(morseStateExport) - require.NoError(t, err) - - err = cmtjson.Unmarshal(morseAccountStateBz, morseAccountState) + morseWorkspace := newMorseImportWorkspace() + err = transformMorseState(morseStateExport, morseWorkspace) require.NoError(t, err) - require.Equal(t, expectedShannonBalance, morseAccountState.Accounts[i-1].Coins[0].Amount.String()) + morseAccounts := morseWorkspace.accountState.Accounts[i-1] + require.Equal(t, expectedShannonBalance, morseAccounts.Coins[0].Amount.String()) }) } } @@ -79,13 +83,102 @@ func BenchmarkTransformMorseState(b *testing.B) { require.NoError(b, err) b.Run(fmt.Sprintf("num_accounts=%d", numAccounts), func(b *testing.B) { + morseWorkspace := newMorseImportWorkspace() // Call the function under test. b.ResetTimer() for i := 0; i < b.N; i++ { - _, err = transformMorseState(morseStateExport) + err = transformMorseState(morseStateExport, morseWorkspace) require.NoError(b, err) } }) } } + +// TODO_CONSIDERATION: Test/benchmark execution speed can be optimized by refactoring this to a pre-generate fixture. +func newMorseStateExportAndAccountState( + t gocuke.TestingT, + numAccounts int, +) (morseStateExportBz []byte, morseAccountStateBz []byte) { + morseStateExport := &migrationtypes.MorseStateExport{ + AppHash: "", + AppState: &migrationtypes.MorseAppState{ + Application: &migrationtypes.MorseApplications{}, + Auth: &migrationtypes.MorseAuth{}, + Pos: &migrationtypes.MorsePos{}, + }, + } + + morseAccountState := &migrationtypes.MorseAccountState{ + Accounts: make([]*migrationtypes.MorseAccount, numAccounts), + } + + for i := 1; i < numAccounts+1; i++ { + seedUint := rand.Uint64() + seedBz := make([]byte, 8) + binary.LittleEndian.PutUint64(seedBz, seedUint) + privKey := cometcrypto.GenPrivKeyFromSecret(seedBz) + pubKey := privKey.PubKey() + balanceAmount := int64(1e6*i + i) // i_000_00i + appStakeAmount := int64(1e5*i + (i * 10)) // i00_0i0 + supplierStakeAmount := int64(1e4*i + (i * 100)) // i0_i00 + sumAmount := balanceAmount + appStakeAmount + supplierStakeAmount // i_ii0_iii + + // Add an account. + morseStateExport.AppState.Auth.Accounts = append( + morseStateExport.AppState.Auth.Accounts, + &migrationtypes.MorseAuthAccount{ + Type: "posmint/Account", + Value: &migrationtypes.MorseAccount{ + Address: pubKey.Address(), + Coins: cosmostypes.NewCoins(cosmostypes.NewInt64Coin(volatile.DenomuPOKT, balanceAmount)), + PubKey: &migrationtypes.MorsePublicKey{ + Value: pubKey.Bytes(), + }, + }, + }, + ) + + // Add an application. + morseStateExport.AppState.Application.Applications = append( + morseStateExport.AppState.Application.Applications, + &migrationtypes.MorseApplication{ + Address: pubKey.Address(), + PublicKey: pubKey.Bytes(), + Jailed: false, + Status: 2, + StakedTokens: fmt.Sprintf("%d", appStakeAmount), + }, + ) + + // Add a supplier. + morseStateExport.AppState.Pos.Validators = append( + morseStateExport.AppState.Pos.Validators, + &migrationtypes.MorseValidator{ + Address: pubKey.Address(), + PublicKey: pubKey.Bytes(), + Jailed: false, + Status: 2, + StakedTokens: fmt.Sprintf("%d", supplierStakeAmount), + }, + ) + + // Add the account to the morseAccountState. + morseAccountState.Accounts[i-1] = &migrationtypes.MorseAccount{ + Address: pubKey.Address(), + Coins: cosmostypes.NewCoins(cosmostypes.NewInt64Coin(volatile.DenomuPOKT, sumAmount)), + PubKey: &migrationtypes.MorsePublicKey{ + Value: pubKey.Bytes(), + }, + } + } + + var err error + morseStateExportBz, err = cmtjson.Marshal(morseStateExport) + require.NoError(t, err) + + morseAccountStateBz, err = cmtjson.Marshal(morseAccountState) + require.NoError(t, err) + + return morseStateExportBz, morseAccountStateBz +} diff --git a/cmd/poktrolld/cmd/migrate/types.go b/cmd/poktrolld/cmd/migrate/types.go index 6356fb2a7..828137ce4 100644 --- a/cmd/poktrolld/cmd/migrate/types.go +++ b/cmd/poktrolld/cmd/migrate/types.go @@ -10,11 +10,49 @@ import ( migrationtypes "github.com/pokt-network/poktroll/x/migration/types" ) +// newMorseImportWorkspace returns a new morseImportWorkspace with fields initialized to their zero values. +func newMorseImportWorkspace() *morseImportWorkspace { + return &morseImportWorkspace{ + addressToIdx: make(map[string]uint64), + accounts: make([]*migrationtypes.MorseAccount, 0), + lastAccTotalBalance: cosmosmath.ZeroInt(), + lastAccTotalAppStake: cosmosmath.ZeroInt(), + lastAccTotalSupplierStake: cosmosmath.ZeroInt(), + } +} + // morseImportWorkspace is a helper struct that is used to consolidate the Morse account balance, // application stake, and supplier stake for each account as an entry in the resulting MorseAccountState. type morseImportWorkspace struct { + // addressToIdx is a map from the Shannon bech32 address to the index of the + // corresponding MorseAccount in the accounts slice. addressToIdx map[string]uint64 - accounts []*migrationtypes.MorseAccount + // accounts is a slice of MorseAccount objects that, when populated, will be + // used to construct the final MorseAccountState. + accounts []*migrationtypes.MorseAccount + + // accountState is the final MorseAccountState that will be imported into Shannon. + accountState *migrationtypes.MorseAccountState + + // lastAccAccountIdx is the index at which the most recent accumulation/totaling + // (of actor counts, balances, and stakes) was performed such that the next + // accumulation/totaling operation may reuse previous accumulations values. + lastAccAccountIdx uint64 + // lastAccTotalBalance is the most recently accumulated balances of all Morse + // accounts which have been processed. + lastAccTotalBalance cosmosmath.Int + // lastAccTotalAppStake is the most recently accumulated application stakes of + // all Morse accounts which have been processed. + lastAccTotalAppStake cosmosmath.Int + // lastAccTotalSupplierStake is the most recently accumulated supplier stakes of + // all Morse accounts which have been processed. + lastAccTotalSupplierStake cosmosmath.Int + // numAccounts is the number of accounts that have been processed. + numAccounts uint64 + // numApplications is the number of applications that have been processed. + numApplications uint64 + // numSuppliers is the number of suppliers that have been processed. + numSuppliers uint64 } // nextIdx returns the next index to be used when appending a new account to the accounts slice. @@ -28,22 +66,100 @@ func (miw *morseImportWorkspace) hasAccount(addr string) bool { return ok } +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) debugLogProgress(accountIdx int) { + totalBalance := miw.totalBalance() + totalAppStake := miw.totalAppStake() + totalSupplierStake := miw.totalSupplierStake() + grandTotal := totalBalance.Add(totalAppStake).Add(totalSupplierStake) + + logger.Debug(). + Int("account_idx", accountIdx). + Uint64("num_accounts", miw.numAccounts). + Uint64("num_applications", miw.numApplications). + Uint64("num_suppliers", miw.numSuppliers). + Str("total_balance", totalBalance.String()). + Str("total_app_stake", totalAppStake.String()). + Str("total_supplier_stake", totalSupplierStake.String()). + Str("grand_total", grandTotal.String()). + Msg("processing accounts...") +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) infoLogComplete() error { + accountStateHash, err := miw.accountState.GetHash() + if err != nil { + return err + } + + logger.Info(). + Uint64("num_accounts", miw.numAccounts). + Uint64("num_applications", miw.numApplications). + Uint64("num_suppliers", miw.numSuppliers). + Str("total_balance", miw.totalBalance().String()). + Str("total_app_stake", miw.totalAppStake().String()). + Str("total_supplier_stake", miw.totalSupplierStake().String()). + Str("grand_total", miw.grandTotal().String()). + Str("morse_account_state_hash", fmt.Sprintf("%x", accountStateHash)). + Msg("processing accounts...") + return nil +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) totalBalance() cosmosmath.Int { + miw.accumulateTotals() + return miw.lastAccTotalBalance +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) totalAppStake() cosmosmath.Int { + miw.accumulateTotals() + return miw.lastAccTotalAppStake +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) totalSupplierStake() cosmosmath.Int { + miw.accumulateTotals() + return miw.lastAccTotalSupplierStake +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) grandTotal() cosmosmath.Int { + return miw.totalBalance(). + Add(miw.totalAppStake()). + Add(miw.totalSupplierStake()) +} + +// TODO_IN_THIS_COMMIT: godoc... +func (miw *morseImportWorkspace) accumulateTotals() { + for idx, account := range miw.accounts[miw.lastAccAccountIdx:] { + miw.lastAccTotalBalance = miw.lastAccTotalBalance.Add(account.Coins[0].Amount) + miw.lastAccTotalAppStake = miw.lastAccTotalAppStake.Add(account.Coins[0].Amount) + miw.lastAccTotalSupplierStake = miw.lastAccTotalSupplierStake.Add(account.Coins[0].Amount) + miw.lastAccAccountIdx = uint64(idx) + } +} + // ensureAccount ensures that the given address is present in the accounts slice // and that its corresponding address is in the addressToIdx map. If the address // is not present, it is added to the accounts slice and the addressToIdx map. func (miw *morseImportWorkspace) ensureAccount( addr string, exportAccount *migrationtypes.MorseAuthAccount, -) (accountIdx uint64, balance cosmostypes.Coin) { +) (accountIdx uint64, balance cosmostypes.Coin, err error) { var ok bool balance = cosmostypes.NewCoin(volatile.DenomuPOKT, cosmosmath.ZeroInt()) if accountIdx, ok = miw.addressToIdx[addr]; ok { + logger.Warn().Str("address", addr).Msg("unexpected workspace state: account already exists") + importAccount := miw.accounts[accountIdx] - // TODO_IN_THIS_COMMIT: comment... SHOULD ONLY be one denom (upokt). - if len(importAccount.Coins) != 0 { - balance = importAccount.Coins[0] + // Each account should have EXACTLY one token denomination. + if len(importAccount.Coins) != 1 { + err := ErrMorseStateTransform.Wrapf("account %q has multiple token denominations: %s", addr, importAccount.Coins) + return 0, cosmostypes.Coin{}, err } + balance = importAccount.Coins[0] } else { accountIdx = miw.nextIdx() importAccount := &migrationtypes.MorseAccount{ @@ -55,18 +171,32 @@ func (miw *morseImportWorkspace) ensureAccount( miw.addressToIdx[addr] = accountIdx } - return accountIdx, balance + return accountIdx, balance, nil } // addUpokt adds the given amount to the corresponding account balances in the morseWorkspace. func (miw *morseImportWorkspace) addUpokt(addr string, amount cosmosmath.Int) error { importAccountIdx, hasAccountAddr := miw.addressToIdx[addr] if !hasAccountAddr { - return fmt.Errorf("account %q not found", addr) + return ErrMorseStateTransform.Wrapf("account %q not found", addr) } account := miw.accounts[importAccountIdx] - account.Coins[0].Amount = account.Coins[0].Amount.Add(amount) + if len(account.Coins) != 1 { + return ErrMorseStateTransform.Wrapf( + "account %q has %d token denominations, expected upokt only: %s", + addr, len(account.Coins), account.Coins, + ) + } + upoktCoins := account.Coins[0] + if upoktCoins.Denom != volatile.DenomuPOKT { + return fmt.Errorf( + "account %q has %s token denomination, expected upokt only: %s", + addr, upoktCoins.Denom, account.Coins, + ) + } + + account.Coins[0].Amount = account.Coins[0].Amount.Add(amount) return nil } diff --git a/e2e/tests/node.go b/e2e/tests/node.go index 6620c995e..d49970d8c 100644 --- a/e2e/tests/node.go +++ b/e2e/tests/node.go @@ -187,7 +187,7 @@ func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { return r, err } -// runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided +// runCurlCmd is a helper to run a command using the local pocketd binary with the flags provided func (p *pocketdBin) runCurlCmd(rpcBaseURL, service, method, path, appAddr, data string, args ...string) (*commandResult, error) { rpcUrl, err := url.Parse(rpcBaseURL) if err != nil { diff --git a/e2e/tests/reset_params_test.go b/e2e/tests/reset_params_test.go index 404ecd176..3b0c0ab1d 100644 --- a/e2e/tests/reset_params_test.go +++ b/e2e/tests/reset_params_test.go @@ -28,7 +28,7 @@ func (s *suite) resetAllModuleParamsToDefaults() { s.sendAuthzExecTx(s.granteeName, resetTxJSONFile.Name()) } -// allMoudlesMsgUpdateParamsToDefaultsAny returns a slice of Any messages, each corresponding +// allModulesMsgUpdateParamsToDefaultsAny returns a slice of Any messages, each corresponding // to a MsgUpdateParams for a module, populated with the respective default values. func (s *suite) allModulesMsgUpdateParamsToDefaultsAny() []*codectypes.Any { s.Helper() diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index 27c0be4d0..7c08a182b 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -15,14 +15,14 @@ import ( "github.com/regen-network/gocuke" "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/api/poktroll/application" - "github.com/pokt-network/poktroll/api/poktroll/gateway" - "github.com/pokt-network/poktroll/api/poktroll/proof" - "github.com/pokt-network/poktroll/api/poktroll/service" - "github.com/pokt-network/poktroll/api/poktroll/session" - "github.com/pokt-network/poktroll/api/poktroll/shared" - "github.com/pokt-network/poktroll/api/poktroll/supplier" - "github.com/pokt-network/poktroll/api/poktroll/tokenomics" + /// "github.com/pokt-network/poktroll/api/poktroll/application" + /// "github.com/pokt-network/poktroll/api/poktroll/gateway" + /// "github.com/pokt-network/poktroll/api/poktroll/proof" + /// "github.com/pokt-network/poktroll/api/poktroll/service" + /// "github.com/pokt-network/poktroll/api/poktroll/session" + /// "github.com/pokt-network/poktroll/api/poktroll/shared" + /// "github.com/pokt-network/poktroll/api/poktroll/supplier" + /// "github.com/pokt-network/poktroll/api/poktroll/tokenomics" apptypes "github.com/pokt-network/poktroll/x/application/types" gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" diff --git a/pkg/crypto/protocol/hasher.go b/pkg/crypto/protocol/hasher.go index 918c576bf..db95bc6f7 100644 --- a/pkg/crypto/protocol/hasher.go +++ b/pkg/crypto/protocol/hasher.go @@ -1,6 +1,10 @@ package protocol -import "crypto/sha256" +import ( + "crypto/sha256" + + "github.com/pokt-network/smt" +) const ( RelayHasherSize = sha256.Size @@ -15,3 +19,7 @@ var ( NewRelayHasher = sha256.New NewTrieHasher = sha256.New ) + +func SMTValueHasher() smt.TrieSpecOption { + return smt.WithValueHasher(nil) +} diff --git a/pkg/crypto/protocol/proof_path.go b/pkg/crypto/protocol/proof_path.go index 61f7e23ce..1a3dce465 100644 --- a/pkg/crypto/protocol/proof_path.go +++ b/pkg/crypto/protocol/proof_path.go @@ -1,33 +1,28 @@ package protocol import ( - "crypto/sha256" - "github.com/pokt-network/smt" ) -// SMT specification used for the proof verification. -var ( - newHasher = sha256.New - SmtSpec smt.TrieSpec -) - -func init() { - // Use a spec that does not prehash values in the smst. This returns a nil value - // hasher for the proof verification in order to avoid hashing the value twice. - SmtSpec = smt.NewTrieSpec( - newHasher(), true, - smt.WithValueHasher(nil), - ) -} - // GetPathForProof computes the path to be used for proof validation by hashing // the block hash and session id. func GetPathForProof(blockHash []byte, sessionId string) []byte { - hasher := newHasher() + hasher := NewTrieHasher() if _, err := hasher.Write(append(blockHash, []byte(sessionId)...)); err != nil { panic(err) } return hasher.Sum(nil) } + +// NewSMTSpec returns the SMT specification used for proof verification. +// A new hasher is created for each call to prevent concurrency issues +// from shared state. +func NewSMTSpec() *smt.TrieSpec { + trieSpec := smt.NewTrieSpec( + NewTrieHasher(), true, + SMTValueHasher(), + ) + + return &trieSpec +} diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go index a9017bcad..03cbf00ed 100644 --- a/pkg/relayer/session/session_test.go +++ b/pkg/relayer/session/session_test.go @@ -73,9 +73,9 @@ func requireProofCountEqualsExpectedValueFromProofParams(t *testing.T, proofPara } supplierOperatorAddress := sample.AccAddress() // Set the supplier operator balance to be able to submit the expected number of proofs. - feePerProof := prooftypes.DefaultParams().ProofSubmissionFee.Amount.Int64() + claimAndFeeGasCost := session.ClamAndProofGasCost.Amount.Int64() numExpectedProofs := int64(2) - supplierOperatorBalance := feePerProof * numExpectedProofs + supplierOperatorBalance := claimAndFeeGasCost * numExpectedProofs supplierClientMap := testsupplier.NewClaimProofSupplierClientMap(ctx, t, supplierOperatorAddress, proofCount) blockPublishCh, minedRelaysPublishCh := setupDependencies(t, ctx, supplierClientMap, emptyBlockHash, proofParams, supplierOperatorBalance) diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 42269c973..a5a56137c 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -2,7 +2,6 @@ package session import ( "bytes" - "crypto/sha256" "fmt" "os" "path/filepath" @@ -94,7 +93,7 @@ func NewSessionTree( // Create the SMST from the KVStore and a nil value hasher so the proof would // contain a non-hashed Relay that could be used to validate the proof onchain. - trie := smt.NewSparseMerkleSumTrie(treeStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) + trie := smt.NewSparseMerkleSumTrie(treeStore, protocol.NewTrieHasher(), protocol.SMTValueHasher()) logger = logger.With( "store_path", storePath, @@ -175,7 +174,7 @@ func (st *sessionTree) ProveClosest(path []byte) (compactProof *smt.SparseCompac return nil, err } - sessionSMT := smt.ImportSparseMerkleSumTrie(st.treeStore, sha256.New(), st.claimedRoot, smt.WithValueHasher(nil)) + sessionSMT := smt.ImportSparseMerkleSumTrie(st.treeStore, protocol.NewTrieHasher(), st.claimedRoot, protocol.SMTValueHasher()) // Generate the proof and cache it along with the path for which it was generated. // There is no ProveClosest variant that generates a compact proof directly. diff --git a/pkg/relayer/session/sessiontree_test.go b/pkg/relayer/session/sessiontree_test.go index 762ebcb1b..c42e6d568 100644 --- a/pkg/relayer/session/sessiontree_test.go +++ b/pkg/relayer/session/sessiontree_test.go @@ -39,7 +39,7 @@ func TestSessionTree_CompactProofsAreSmallerThanNonCompactProofs(t *testing.T) { kvStore, err := pebble.NewKVStore("") require.NoError(t, err) - trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) + trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), protocol.SMTValueHasher()) // Insert numLeaf random leaves. for i := 0; i < numLeafs; i++ { diff --git a/proto/poktroll/migration/event.proto b/proto/poktroll/migration/event.proto index d1b9cc900..dd701e6bc 100644 --- a/proto/poktroll/migration/event.proto +++ b/proto/poktroll/migration/event.proto @@ -11,8 +11,13 @@ import "cosmos/base/v1beta1/coin.proto"; import "poktroll/shared/service.proto"; import "poktroll/migration/types.proto"; -// EventUploadMorseState is emitted when a new state hash is uploaded. +// EventUploadMorseState is emitted when the MorseAccountState is created on-chain. message EventCreateMorseAccountState { - int64 height = 1 [(gogoproto.jsontag) = "height"]; - bytes state_hash = 3 [(gogoproto.jsontag) = "state_hash"]; + // The height (on Shannon) at which the MorseAccountState was created on-chain. + int64 created_at_height = 1 [(gogoproto.jsontag) = "created_at_height"]; + // The sha256 has of the MorseAccountState. + bytes morse_account_state_hash = 2 [(gogoproto.jsontag) = "morse_account_state_hash"]; + // The number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. + uint64 num_accounts = 3 [(gogoproto.jsontag) = "num_accounts"]; } diff --git a/proto/poktroll/migration/legacy.proto b/proto/poktroll/migration/legacy.proto index 17ec0b955..75c7882ae 100644 --- a/proto/poktroll/migration/legacy.proto +++ b/proto/poktroll/migration/legacy.proto @@ -1,10 +1,13 @@ syntax = "proto3"; // Types in this file are ONLY present to facilitate the verifiability of the -// migration state from Morse to Shannon. These types are used by the migration -// subcommand (e.g. `poktrolld migrate collect-morse-accounts ...) to transform -// the Morse state export into the Shannon state import. They ARE NOT persisted -// on-chain at any point. +// migration state from Morse to Shannon. +// +// These types are used by the migration subcommand to transform +// the Morse state export into the Shannon state import. +// Ref: `poktrolld migrate collect-morse-accounts ...` +// +// They ARE NOT persisted on-chain at any point.package poktroll.migration; package poktroll.migration; import "gogoproto/gogo.proto"; @@ -13,30 +16,79 @@ import "poktroll/migration/types.proto"; option go_package = "github.com/pokt-network/poktroll/x/migration/types"; option (gogoproto.stable_marshaler_all) = true; +// MorseStateExport is the data structure that is serialized and output when running +// `pocket util export-genesis-for-reset`. +// See: https://editor.swagger.io/?url=https://raw.githubusercontent.com/pokt-network/pocket-core/staging/doc/specs/rpc-spec.yaml#operations-query-post_query_state message MorseStateExport { + // app_hash is the Morse tendermint state hash. string app_hash = 1 [(gogoproto.jsontag) = "app_hash"]; + // app_state is the entire Morse tendermint application state. MorseAppState app_state = 2 [(gogoproto.jsontag) = "app_state"]; } +// MorseAppState is the tendermint application state for the Morse tendermint +// application; not to be confused with the pokt protocol actor. message MorseAppState { MorseApplications application = 1 [(gogoproto.jsontag) = "application"]; MorseAuth auth = 2 [(gogoproto.jsontag) = "auth"]; MorsePos pos = 3 [(gogoproto.jsontag) = "pos"]; } +// A wrapper around the list of MorseApplications, necessary in order to conform to the Morse genesis structure. message MorseApplications { repeated MorseApplication applications = 1 [(gogoproto.jsontag) = "applications"]; } +// A wrapper around a list of Morse accounts. +message MorseAuth { + repeated MorseAuthAccount accounts = 1 [(gogoproto.jsontag) = "accounts"]; +} + +// A wrapper around Morse account information, necessary in order to to confirm to the Morse genesis +// structure. Morse originally serialized accounts as pb.Any types in order to support multiple +// account types. For the purposes of the Morse -> Shannon migration, we're only concerned with +// externally owned accounts (as opposed to module accounts). As a result, we're simplifying its +// representation in Shannon by avoiding usage of pb.Any. It is necessary in order too conform to +// the Morse genesis structure. message MorseAuthAccount { string Type = 1 [(gogoproto.jsontag) = "type"]; MorseAccount Value = 2 [(gogoproto.jsontag) = "value"]; } -message MorseAuth { - repeated MorseAuthAccount accounts = 1 [(gogoproto.jsontag) = "accounts"]; -} - +// A wrapper around the list of Morse suppliers (aka "validators", "nodes", of "servicers"). +// It is necessary to conform to the Morse genesis structure. message MorsePos { repeated MorseValidator validators = 1 [(gogoproto.jsontag) = "validators"]; } + +// MorseApplication is a subset of the Morse ProtoApplication type. +// It encapsulates the minimum information required to import Morse applications. +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 +message MorseApplication { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + + // Address is a hex-encoded string representation of the address corresponding + // to a Morse application's ed25519 public key. + bytes address = 1 [(gogoproto.casttype) = "github.com/cometbft/cometbft/crypto.Address", (gogoproto.jsontag) = "address", (gogoproto.moretags) = "yaml:\"address\""]; + // PublicKey is the binary representation of a Morse application's ed25519 public key. + bytes public_key = 2 [(gogoproto.jsontag) = "public_key", (gogoproto.moretags) = "yaml:\"public_key\""]; + bool jailed = 3[(gogoproto.jsontag) = "jailed", (gogoproto.moretags) = "yaml:\"jailed\""]; + int32 status = 4 [(gogoproto.jsontag) = "status", (gogoproto.moretags) = "yaml:\"status\""]; + string staked_tokens = 6 [(gogoproto.jsontag) = "tokens"]; +} + +// MorseValidator is a subset of the Morse ProtoValidator type. +// It encapsulates the minimum information required to import Morse suppliers (aka "servicers" or "validators"). +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 +message MorseValidator { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; + + bytes Address = 1 [(gogoproto.casttype) = "github.com/cometbft/cometbft/crypto.Address", (gogoproto.moretags) = "yaml:\"address\"", (gogoproto.jsontag) = "address"]; + bytes PublicKey = 2 [(gogoproto.moretags) = "yaml:\"public_key\"", (gogoproto.jsontag) = "public_key"]; + bool jailed = 3 [(gogoproto.jsontag) = "jailed"]; + int32 status = 4 [(gogoproto.jsontag) = "status"]; + string StakedTokens = 7 [(gogoproto.jsontag) = "tokens"]; +} diff --git a/proto/poktroll/migration/params.proto b/proto/poktroll/migration/params.proto index b20062256..9b7b71a61 100644 --- a/proto/poktroll/migration/params.proto +++ b/proto/poktroll/migration/params.proto @@ -11,6 +11,4 @@ option (gogoproto.stable_marshaler_all) = true; message Params { option (amino.name) = "poktroll/x/migration/Params"; option (gogoproto.equal) = true; - - } \ No newline at end of file diff --git a/proto/poktroll/migration/query.proto b/proto/poktroll/migration/query.proto index adadca6e9..09336c175 100644 --- a/proto/poktroll/migration/query.proto +++ b/proto/poktroll/migration/query.proto @@ -21,7 +21,7 @@ service Query { } - // Queries a MorseAccountState by index. + // Queries the MorseAccountState. rpc MorseAccountState (QueryGetMorseAccountStateRequest) returns (QueryGetMorseAccountStateResponse) { option (google.api.http).get = "/pokt-network/poktroll/migration/morse_account_state"; @@ -37,8 +37,10 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } +// Queries the MorseAccountState which was created with MsgCreateMorseAccountState. message QueryGetMorseAccountStateRequest {} +// Returns the MorseAccountState. If it has not yet been created, an error is returned. message QueryGetMorseAccountStateResponse { MorseAccountState MorseAccountState = 1 [(gogoproto.nullable) = false]; } diff --git a/proto/poktroll/migration/tx.proto b/proto/poktroll/migration/tx.proto index 5382d559e..0f41accab 100644 --- a/proto/poktroll/migration/tx.proto +++ b/proto/poktroll/migration/tx.proto @@ -41,16 +41,30 @@ message MsgUpdateParams { // MsgUpdateParams message. message MsgUpdateParamsResponse {} +// MsgCreateMorseAccountState is used to create the on-chain MorseAccountState ONLY ONCE (per network / re-genesis). message MsgCreateMorseAccountState { option (cosmos.msg.v1.signer) = "authority"; // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the account state derived from the Morse state export and the `poktrolld migrate collect-morse-accounts` command. MorseAccountState morse_account_state = 2 [(gogoproto.jsontag) = "morse_account_state", (gogoproto.nullable) = false]; + // expected sha256 hash of the morse_account_state. If this hash does not match the on-chain + // computation, the transaction will fail. Social consensus regarding the correctness of + // morse_account_state should have be achieved off-chain and can be verified on-chain by + // comparing this hash with that of a locally derived Morse state export: + // E.g., `poktrolld migrate collect-morse-accounts $<(pocket util export-genesis-for-reset)`. + // See: `pocket util export-genesis-for-migration --help` & `poktrolld migrate collect-morse-accounts --help` + // for more details. + bytes morse_account_state_hash = 3 [(gogoproto.jsontag) = "morse_account_state_hash"]; } +// MsgCreateMorseAccountStateResponse represents an on-chain summary of the result of the corresponding MsgCreateMorseAccountState. message MsgCreateMorseAccountStateResponse { + // On-chain computed sha256 hash of the morse_account_state provided in the corresponding MsgCreateMorseAccountState. bytes state_hash = 1 [(gogoproto.jsontag) = "state_hash"]; + // Number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. uint64 num_accounts = 2 [(gogoproto.jsontag) = "num_accounts"]; } diff --git a/proto/poktroll/migration/types.proto b/proto/poktroll/migration/types.proto index 7b1d64fcb..c978151e5 100644 --- a/proto/poktroll/migration/types.proto +++ b/proto/poktroll/migration/types.proto @@ -33,42 +33,3 @@ message MorseAccount { message MorsePublicKey { bytes value = 2 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; } - -// MorseApplication is a subset of the Morse ProtoApplication type. It encapsulates -// the minimum information required to import Morse applications. -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 -message MorseApplication { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - - bytes address = 1 [ - (gogoproto.casttype) = "github.com/cometbft/cometbft/crypto.Address", - (gogoproto.jsontag) = "address", - (gogoproto.moretags) = "yaml:\"address\"" - ]; - bytes public_key = 2 [ - (gogoproto.jsontag) = "public_key", - (gogoproto.moretags) = "yaml:\"public_key\""]; - bool jailed = 3[ - (gogoproto.jsontag) = "jailed", - (gogoproto.moretags) = "yaml:\"jailed\""]; - int32 status = 4 [ - (gogoproto.jsontag) = "status", - (gogoproto.moretags) = "yaml:\"status\""]; - string staked_tokens = 6; -} - -// MorseValidator is a subset of the Morse ProtoValidator type. It encapsulates the -// minimum information required to import Morse suppliers (aka "servicers" or "validators"). -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 -message MorseValidator { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = true; - option (gogoproto.goproto_getters) = false; - - bytes Address = 1 [(gogoproto.casttype) = "github.com/cometbft/cometbft/crypto.Address", (gogoproto.moretags) = "yaml:\"address\"", (gogoproto.jsontag) = "address"]; - bytes PublicKey = 2 [(gogoproto.moretags) = "yaml:\"public_key\"", (gogoproto.jsontag) = "public_key"]; - bool jailed = 3 [(gogoproto.jsontag) = "jailed"]; - int32 status = 4 [(gogoproto.jsontag) = "status"]; - string StakedTokens = 7 [(gogoproto.jsontag) = "tokens"]; -} diff --git a/proto/poktroll/proof/event.proto b/proto/poktroll/proof/event.proto index b4e99aad9..f14fbd8b5 100644 --- a/proto/poktroll/proof/event.proto +++ b/proto/poktroll/proof/event.proto @@ -43,3 +43,14 @@ message EventProofUpdated { uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } + +// Event emitted after a proof has been checked for validity in the proof module's +// EndBlocker. +message EventProofValidityChecked { + poktroll.proof.Proof proof = 1 [(gogoproto.jsontag) = "proof"]; + uint64 block_height = 2 [(gogoproto.jsontag) = "block_height"]; + poktroll.proof.ClaimProofStatus proof_status = 3 [(gogoproto.jsontag) = "proof_status"]; + // reason is the string representation of the error that led to the proof being + // marked as invalid (e.g. "invalid closest merkle proof", "invalid relay request signature") + string failure_reason = 4 [(gogoproto.jsontag) = "failure_reason"]; +} diff --git a/proto/poktroll/proof/types.proto b/proto/poktroll/proof/types.proto index d131adf90..c35b08fb8 100644 --- a/proto/poktroll/proof/types.proto +++ b/proto/poktroll/proof/types.proto @@ -24,11 +24,17 @@ message Proof { // Claim is the serialized object stored onchain for claims pending to be proven message Claim { + // Address of the supplier's operator that submitted this claim. string supplier_operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the address of the supplier's operator that submitted this claim - // The session header of the session that this claim is for. + + // Session header this claim is for. poktroll.session.SessionHeader session_header = 2; - // Root hash returned from smt.SMST#Root(). + + // Root hash from smt.SMST#Root(). bytes root_hash = 3; + + // Important: This field MUST only be set by proofKeeper#EnsureValidProofSignaturesAndClosestPath + ClaimProofStatus proof_validation_status = 4; } enum ProofRequirementReason { @@ -43,3 +49,11 @@ enum ClaimProofStage { SETTLED = 2; EXPIRED = 3; } + +// Status of proof validation for a claim +// Default is PENDING_VALIDATION regardless of proof requirement +enum ClaimProofStatus { + PENDING_VALIDATION = 0; + VALIDATED = 1; + INVALID = 2; +} \ No newline at end of file diff --git a/tests/integration/service/relay_mining_difficulty_test.go b/tests/integration/service/relay_mining_difficulty_test.go index 050b8328c..1a171e5c3 100644 --- a/tests/integration/service/relay_mining_difficulty_test.go +++ b/tests/integration/service/relay_mining_difficulty_test.go @@ -200,7 +200,7 @@ func prepareSMST( // TODO_TECHDEBT(#446): Centralize the configuration for the SMT spec. kvStore, err := pebble.NewKVStore("") require.NoError(t, err) - trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) + trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), protocol.SMTValueHasher()) for i := uint64(0); i < numRelays; i++ { // DEV_NOTE: A signed mined relay is a MinedRelay type with the appropriate diff --git a/tests/integration/tokenomics/relay_mining_integration_test.go b/tests/integration/tokenomics/relay_mining_integration_test.go index 3a9231c4a..f0d1dfa17 100644 --- a/tests/integration/tokenomics/relay_mining_integration_test.go +++ b/tests/integration/tokenomics/relay_mining_integration_test.go @@ -214,7 +214,7 @@ func prepareRealClaim( require.NoError(t, err) // Prepare an SMST - trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) + trie := smt.NewSparseMerkleSumTrie(kvStore, protocol.NewTrieHasher(), protocol.SMTValueHasher()) // Insert the mined relays into the SMST for i := uint64(0); i < numRelays; i++ { diff --git a/testutil/testmigration/fixtures.go b/testutil/testmigration/fixtures.go index fb36d92ba..363330be9 100644 --- a/testutil/testmigration/fixtures.go +++ b/testutil/testmigration/fixtures.go @@ -15,10 +15,16 @@ import ( migrationtypes "github.com/pokt-network/poktroll/x/migration/types" ) -// NewMorseStateExportAndAccountStateBytes returns a serialized `MorseStateExport` -// and its corresponding `MorseAccountState`, populated dynamically with randomized -// account addresses, and monotonically increasing balances/stakes. For each account, -// one application and supplier are also added to the states. +// NewMorseStateExportAndAccountStateBytes returns: +// - A serialized MorseStateExport +// - Its corresponding MorseAccountState +// +// The states are populated with: +// - Random account addresses +// - Monotonically increasing balances/stakes +// - One application per account +// - One supplier per account +// // TODO_CONSIDERATION: Test/benchmark execution speed can be optimized by refactoring this to a pre-generate fixture. func NewMorseStateExportAndAccountStateBytes( t gocuke.TestingT, @@ -36,10 +42,12 @@ func NewMorseStateExportAndAccountStateBytes( return morseStateExportBz, morseAccountStateBz } -// NewMorseStateExportAndAccountState returns a `MorseStateExport` and its -// corresponding `MorseAccountState`, populated dynamically with randomized -// account addresses, and monotonically increasing balances/stakes. For each account, -// one application and supplier are also added to the states. +// NewMorseStateExportAndAccountState returns MorseStateExport and MorseAccountState +// structs populated with: +// - Random account addresses +// - Monotonically increasing balances/stakes +// - One application per account +// - One supplier per account func NewMorseStateExportAndAccountState( t gocuke.TestingT, numAccounts int, ) (export *migrationtypes.MorseStateExport, state *migrationtypes.MorseAccountState) { diff --git a/testutil/testtree/tree.go b/testutil/testtree/tree.go index 737e710d0..6252926e2 100644 --- a/testutil/testtree/tree.go +++ b/testutil/testtree/tree.go @@ -152,5 +152,6 @@ func NewClaim( SupplierOperatorAddress: supplierOperatorAddr, SessionHeader: sessionHeader, RootHash: rootHash, + ProofValidationStatus: prooftypes.ClaimProofStatus_PENDING_VALIDATION, } } diff --git a/x/migration/keeper/morse_account_state.go b/x/migration/keeper/morse_account_state.go index b88311d16..d985e186f 100644 --- a/x/migration/keeper/morse_account_state.go +++ b/x/migration/keeper/morse_account_state.go @@ -9,26 +9,26 @@ import ( "github.com/pokt-network/poktroll/x/migration/types" ) -// SetMorseAccountState set morseAccountState in the store +// SetMorseAccountState sets morseAccountState in the store func (k Keeper) SetMorseAccountState(ctx context.Context, morseAccountState types.MorseAccountState) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey)) - b := k.cdc.MustMarshal(&morseAccountState) - store.Set([]byte{0}, b) + morseAccountStateBz := k.cdc.MustMarshal(&morseAccountState) + store.Set([]byte{0}, morseAccountStateBz) } // GetMorseAccountState returns morseAccountState -func (k Keeper) GetMorseAccountState(ctx context.Context) (val types.MorseAccountState, found bool) { +func (k Keeper) GetMorseAccountState(ctx context.Context) (morseAccountState types.MorseAccountState, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey)) - b := store.Get([]byte{0}) - if b == nil { - return val, false + morseAccountStateBz := store.Get([]byte{0}) + if morseAccountStateBz == nil { + return morseAccountState, false } - k.cdc.MustUnmarshal(b, &val) - return val, true + k.cdc.MustUnmarshal(morseAccountStateBz, &morseAccountState) + return morseAccountState, true } // RemoveMorseAccountState removes morseAccountState from the store diff --git a/x/migration/keeper/msg_server_morse_account_state.go b/x/migration/keeper/msg_server_morse_account_state.go index 75ecfa7a6..185ebc326 100644 --- a/x/migration/keeper/msg_server_morse_account_state.go +++ b/x/migration/keeper/msg_server_morse_account_state.go @@ -4,49 +4,51 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/pokt-network/poktroll/x/migration/types" + migrationtypes "github.com/pokt-network/poktroll/x/migration/types" ) -func (k msgServer) CreateMorseAccountState(ctx context.Context, msg *types.MsgCreateMorseAccountState) (*types.MsgCreateMorseAccountStateResponse, error) { +// CreateMorseAccountState creates the on-chain MorseAccountState ONLY ONCE (per network / re-genesis). +func (k msgServer) CreateMorseAccountState( + ctx context.Context, + msg *migrationtypes.MsgCreateMorseAccountState, +) (*migrationtypes.MsgCreateMorseAccountStateResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) + logger := sdkCtx.Logger().With("method", "CreateMorseAccountState") if err := msg.ValidateBasic(); err != nil { - return nil, err + logger.Info(err.Error()) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the value already exists - _, isFound := k.GetMorseAccountState(sdkCtx) - if isFound { - return nil, status.Error( - codes.FailedPrecondition, - sdkerrors.ErrInvalidRequest.Wrap("already set").Error(), - ) + if _, isFound := k.GetMorseAccountState(sdkCtx); isFound { + err := migrationtypes.ErrMorseAccountState.Wrap("already set") + logger.Info(err.Error()) + return nil, status.Error(codes.FailedPrecondition, err.Error()) } - k.SetMorseAccountState( - sdkCtx, - msg.MorseAccountState, - ) + k.SetMorseAccountState(sdkCtx, msg.MorseAccountState) stateHash, err := msg.MorseAccountState.GetHash() if err != nil { - return nil, err + logger.Info(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } if err = sdkCtx.EventManager().EmitTypedEvent( - &types.EventCreateMorseAccountState{ - Height: sdkCtx.BlockHeight(), - StateHash: stateHash, + &migrationtypes.EventCreateMorseAccountState{ + CreatedAtHeight: sdkCtx.BlockHeight(), + MorseAccountStateHash: stateHash, }, ); err != nil { + logger.Info(err.Error()) return nil, err } - return &types.MsgCreateMorseAccountStateResponse{ + return &migrationtypes.MsgCreateMorseAccountStateResponse{ StateHash: stateHash, NumAccounts: uint64(len(msg.MorseAccountState.Accounts)), }, nil diff --git a/x/migration/keeper/msg_server_morse_account_state_test.go b/x/migration/keeper/msg_server_morse_account_state_test.go index a4f811b48..0b9152543 100644 --- a/x/migration/keeper/msg_server_morse_account_state_test.go +++ b/x/migration/keeper/msg_server_morse_account_state_test.go @@ -27,10 +27,13 @@ func TestMorseAccountStateMsgServerCreate_Success(t *testing.T) { _, isFound := k.GetMorseAccountState(ctx) require.False(t, isFound) - res, err := srv.CreateMorseAccountState(ctx, &migrationtypes.MsgCreateMorseAccountState{ - Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), - MorseAccountState: *accountState, - }) + msgCreateMorseAccountState, err := migrationtypes.NewMsgCreateMorseAccountState( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + *accountState, + ) + require.NoError(t, err) + + res, err := srv.CreateMorseAccountState(ctx, msgCreateMorseAccountState) require.NoError(t, err) expectedUploadMsg := &migrationtypes.MsgCreateMorseAccountState{ @@ -62,8 +65,8 @@ func TestMorseAccountStateMsgServerCreate_Success(t *testing.T) { require.Equal(t, 1, len(filteredEvts)) expectedEvent := &migrationtypes.EventCreateMorseAccountState{ - Height: ctx.BlockHeight(), - StateHash: expectedStateHash, + CreatedAtHeight: ctx.BlockHeight(), + MorseAccountStateHash: expectedStateHash, } require.Equal(t, expectedEvent, filteredEvts[0]) } @@ -81,12 +84,13 @@ func TestMorseAccountStateMsgServerCreate_Error(t *testing.T) { require.True(t, isFound) // Assert that the MorseAccountState can ONLY be set once. - _, err := srv.CreateMorseAccountState(ctx, &migrationtypes.MsgCreateMorseAccountState{ - Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), - MorseAccountState: *accountState, - }) - t.Log(err) + msgCreateMorseAccountState, err := migrationtypes.NewMsgCreateMorseAccountState( + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + *accountState, + ) + require.NoError(t, err) + _, err = srv.CreateMorseAccountState(ctx, msgCreateMorseAccountState) stat := status.Convert(err) require.Equal(t, codes.FailedPrecondition, stat.Code()) require.ErrorContains(t, err, "already set") diff --git a/x/migration/keeper/query_morse_account_state.go b/x/migration/keeper/query_morse_account_state.go index c61fff565..0d3a0e6a9 100644 --- a/x/migration/keeper/query_morse_account_state.go +++ b/x/migration/keeper/query_morse_account_state.go @@ -10,16 +10,18 @@ import ( "github.com/pokt-network/poktroll/x/migration/types" ) +// MorseAccountState returns the morseAccountState, if one has been created; +// otherwise, an error is returned. func (k Keeper) MorseAccountState(goCtx context.Context, req *types.QueryGetMorseAccountStateRequest) (*types.QueryGetMorseAccountStateResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - val, found := k.GetMorseAccountState(ctx) - if !found { + morseAccountState, isFound := k.GetMorseAccountState(ctx) + if !isFound { return nil, status.Error(codes.NotFound, "not found") } - return &types.QueryGetMorseAccountStateResponse{MorseAccountState: val}, nil + return &types.QueryGetMorseAccountStateResponse{MorseAccountState: morseAccountState}, nil } diff --git a/x/migration/types/errors.go b/x/migration/types/errors.go index ca50b521e..e7889ff78 100644 --- a/x/migration/types/errors.go +++ b/x/migration/types/errors.go @@ -8,6 +8,6 @@ import ( // x/migration module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrMorseAccountState = sdkerrors.Register(ModuleName, 1101, "morse account state is invalid") ) diff --git a/x/migration/types/event.pb.go b/x/migration/types/event.pb.go index 4960740bc..a71844632 100644 --- a/x/migration/types/event.pb.go +++ b/x/migration/types/event.pb.go @@ -26,10 +26,15 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// EventUploadMorseState is emitted when a new state hash is uploaded. +// EventUploadMorseState is emitted when the MorseAccountState is created on-chain. type EventCreateMorseAccountState struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height"` - StateHash []byte `protobuf:"bytes,3,opt,name=state_hash,json=stateHash,proto3" json:"state_hash"` + // The height (on Shannon) at which the MorseAccountState was created on-chain. + CreatedAtHeight int64 `protobuf:"varint,1,opt,name=created_at_height,json=createdAtHeight,proto3" json:"created_at_height"` + // The sha256 has of the MorseAccountState. + MorseAccountStateHash []byte `protobuf:"bytes,2,opt,name=morse_account_state_hash,json=morseAccountStateHash,proto3" json:"morse_account_state_hash"` + // The number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. + NumAccounts uint64 `protobuf:"varint,3,opt,name=num_accounts,json=numAccounts,proto3" json:"num_accounts"` } func (m *EventCreateMorseAccountState) Reset() { *m = EventCreateMorseAccountState{} } @@ -61,20 +66,27 @@ func (m *EventCreateMorseAccountState) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateMorseAccountState proto.InternalMessageInfo -func (m *EventCreateMorseAccountState) GetHeight() int64 { +func (m *EventCreateMorseAccountState) GetCreatedAtHeight() int64 { if m != nil { - return m.Height + return m.CreatedAtHeight } return 0 } -func (m *EventCreateMorseAccountState) GetStateHash() []byte { +func (m *EventCreateMorseAccountState) GetMorseAccountStateHash() []byte { if m != nil { - return m.StateHash + return m.MorseAccountStateHash } return nil } +func (m *EventCreateMorseAccountState) GetNumAccounts() uint64 { + if m != nil { + return m.NumAccounts + } + return 0 +} + func init() { proto.RegisterType((*EventCreateMorseAccountState)(nil), "poktroll.migration.EventCreateMorseAccountState") } @@ -82,26 +94,29 @@ func init() { func init() { proto.RegisterFile("poktroll/migration/event.proto", fileDescriptor_d5b0bc9ed37905e1) } var fileDescriptor_d5b0bc9ed37905e1 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x8f, 0xcf, 0x4a, 0x33, 0x31, - 0x14, 0xc5, 0x1b, 0x0a, 0x85, 0x2f, 0x7c, 0xb8, 0x18, 0x5c, 0xd4, 0xa2, 0x69, 0xe9, 0xaa, 0x9b, - 0x36, 0x54, 0x9f, 0xc0, 0x8a, 0xe0, 0x46, 0x90, 0xba, 0x73, 0x53, 0x32, 0xf1, 0x32, 0x09, 0x6d, - 0xe7, 0x8e, 0xc9, 0xed, 0xa8, 0x6f, 0xe1, 0x63, 0xb9, 0xec, 0xb2, 0xab, 0x22, 0x33, 0xbb, 0x3e, - 0x85, 0xcc, 0x9f, 0x0e, 0x22, 0xae, 0x72, 0x72, 0xce, 0x09, 0xf9, 0x1d, 0x2e, 0x12, 0x5c, 0x92, - 0xc3, 0xd5, 0x4a, 0xae, 0x6d, 0xe4, 0x14, 0x59, 0x8c, 0x25, 0xa4, 0x10, 0xd3, 0x24, 0x71, 0x48, - 0x18, 0x04, 0xc7, 0x7c, 0xd2, 0xe4, 0xbd, 0x33, 0x8d, 0x7e, 0x8d, 0x7e, 0x51, 0x36, 0x64, 0x75, - 0xa9, 0xea, 0xbd, 0xd3, 0x08, 0x23, 0xac, 0xfc, 0x42, 0xd5, 0xae, 0xa8, 0x3a, 0x32, 0x54, 0x1e, - 0x64, 0x3a, 0x0d, 0x81, 0xd4, 0x54, 0x6a, 0xb4, 0x71, 0x9d, 0x5f, 0x34, 0x10, 0xde, 0x28, 0x07, - 0xcf, 0xd2, 0x83, 0x4b, 0xad, 0x86, 0xe3, 0xf3, 0x3f, 0x18, 0xe9, 0x3d, 0x81, 0xfa, 0xd3, 0xe1, - 0x0b, 0x3f, 0xbf, 0x2d, 0x90, 0x6f, 0x1c, 0x28, 0x82, 0x7b, 0x74, 0x1e, 0xae, 0xb5, 0xc6, 0x4d, - 0x4c, 0x8f, 0xa4, 0x08, 0x82, 0x21, 0xef, 0x18, 0xb0, 0x91, 0xa1, 0x2e, 0x1b, 0xb0, 0x51, 0x7b, - 0xc6, 0x0f, 0xfb, 0x7e, 0xed, 0xcc, 0xeb, 0x33, 0x18, 0x73, 0xee, 0x8b, 0xf2, 0xc2, 0x28, 0x6f, - 0xba, 0xed, 0x01, 0x1b, 0xfd, 0x9f, 0x9d, 0x1c, 0xf6, 0xfd, 0x1f, 0xee, 0xfc, 0x5f, 0xa9, 0xef, - 0x94, 0x37, 0xb3, 0x87, 0xcf, 0x4c, 0xb0, 0x6d, 0x26, 0xd8, 0x2e, 0x13, 0xec, 0x2b, 0x13, 0xec, - 0x23, 0x17, 0xad, 0x6d, 0x2e, 0x5a, 0xbb, 0x5c, 0xb4, 0x9e, 0x2e, 0x23, 0x4b, 0x66, 0x13, 0x4e, - 0x34, 0xae, 0x65, 0xc1, 0x3e, 0x8e, 0x81, 0x5e, 0xd1, 0x2d, 0x65, 0x33, 0xe4, 0xed, 0xf7, 0x94, - 0xb0, 0x53, 0x6e, 0xb9, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x52, 0xd7, 0x04, 0x91, 0x01, - 0x00, 0x00, + // 337 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x50, 0x4d, 0x4b, 0x02, 0x41, + 0x18, 0x76, 0x32, 0x3a, 0x6c, 0x42, 0xb5, 0x24, 0x6c, 0x62, 0xa3, 0x74, 0xf2, 0x92, 0x83, 0xf9, + 0x0b, 0xdc, 0x08, 0xbc, 0x04, 0x61, 0x74, 0xe9, 0xb2, 0xcc, 0xae, 0x2f, 0xbb, 0x8b, 0xee, 0xbe, + 0x32, 0xf3, 0xae, 0xd5, 0xbf, 0xe8, 0x67, 0x75, 0xf4, 0xe8, 0x49, 0x62, 0xbd, 0x09, 0xfd, 0x87, + 0xd8, 0x0f, 0x85, 0xac, 0x6e, 0x33, 0xcf, 0xd7, 0xfb, 0xf0, 0x18, 0x7c, 0x86, 0x13, 0x52, 0x38, + 0x9d, 0x8a, 0x28, 0xf4, 0x95, 0xa4, 0x10, 0x63, 0x01, 0x73, 0x88, 0xa9, 0x3b, 0x53, 0x48, 0x68, + 0x9a, 0x5b, 0xbe, 0xbb, 0xe3, 0x1b, 0x17, 0x1e, 0xea, 0x08, 0xb5, 0x93, 0x2b, 0x44, 0xf1, 0x29, + 0xe4, 0x8d, 0x73, 0x1f, 0x7d, 0x2c, 0xf0, 0xec, 0x55, 0xa2, 0xbc, 0xd0, 0x08, 0x57, 0x6a, 0x10, + 0xf3, 0x9e, 0x0b, 0x24, 0x7b, 0xc2, 0xc3, 0x30, 0x2e, 0xf9, 0xcb, 0x5d, 0x09, 0x1d, 0x48, 0x05, + 0x63, 0xa1, 0x41, 0xcd, 0x43, 0x0f, 0xb6, 0xf6, 0x3f, 0x3a, 0xd2, 0xdb, 0x0c, 0xca, 0xa3, 0x57, + 0x5f, 0xcc, 0x68, 0xde, 0x65, 0x9d, 0x6f, 0x15, 0x48, 0x82, 0x7b, 0x54, 0x1a, 0x06, 0x9e, 0x87, + 0x49, 0x4c, 0x8f, 0x24, 0x09, 0xcc, 0x81, 0x71, 0xe6, 0xe5, 0xd4, 0xd8, 0x91, 0xe4, 0x04, 0x10, + 0xfa, 0x01, 0x59, 0xac, 0xcd, 0x3a, 0x55, 0xbb, 0xbe, 0x59, 0xb5, 0x7e, 0x93, 0xa3, 0x93, 0x12, + 0x1a, 0xd0, 0x30, 0x07, 0xcc, 0x27, 0xc3, 0x8a, 0xb2, 0x5c, 0x47, 0x16, 0xc1, 0x8e, 0xce, 0x92, + 0x9d, 0x40, 0xea, 0xc0, 0x3a, 0x68, 0xb3, 0x4e, 0xcd, 0x6e, 0x6e, 0x56, 0xad, 0x7f, 0x35, 0xa3, + 0x7a, 0xb4, 0xdf, 0x6a, 0x28, 0x75, 0x60, 0xf6, 0x8d, 0x5a, 0x9c, 0x44, 0x5b, 0x83, 0xb6, 0xaa, + 0x6d, 0xd6, 0x39, 0xb4, 0x4f, 0x37, 0xab, 0xd6, 0x0f, 0x7c, 0x74, 0x1c, 0x27, 0x51, 0x69, 0xd6, + 0xf6, 0xc3, 0x47, 0xca, 0xd9, 0x22, 0xe5, 0x6c, 0x99, 0x72, 0xf6, 0x99, 0x72, 0xf6, 0xbe, 0xe6, + 0x95, 0xc5, 0x9a, 0x57, 0x96, 0x6b, 0x5e, 0x79, 0xbe, 0xf1, 0x43, 0x0a, 0x12, 0xb7, 0xeb, 0x61, + 0x24, 0xb2, 0xe1, 0xae, 0x63, 0xa0, 0x17, 0x54, 0x13, 0xb1, 0x5b, 0xf1, 0x75, 0x7f, 0x47, 0xf7, + 0x28, 0x1f, 0xb2, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x60, 0x3c, 0xa1, 0x67, 0x0e, 0x02, 0x00, + 0x00, } func (m *EventCreateMorseAccountState) Marshal() (dAtA []byte, err error) { @@ -124,15 +139,20 @@ func (m *EventCreateMorseAccountState) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if len(m.StateHash) > 0 { - i -= len(m.StateHash) - copy(dAtA[i:], m.StateHash) - i = encodeVarintEvent(dAtA, i, uint64(len(m.StateHash))) + if m.NumAccounts != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumAccounts)) + i-- + dAtA[i] = 0x18 + } + if len(m.MorseAccountStateHash) > 0 { + i -= len(m.MorseAccountStateHash) + copy(dAtA[i:], m.MorseAccountStateHash) + i = encodeVarintEvent(dAtA, i, uint64(len(m.MorseAccountStateHash))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if m.Height != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.Height)) + if m.CreatedAtHeight != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.CreatedAtHeight)) i-- dAtA[i] = 0x8 } @@ -156,13 +176,16 @@ func (m *EventCreateMorseAccountState) Size() (n int) { } var l int _ = l - if m.Height != 0 { - n += 1 + sovEvent(uint64(m.Height)) + if m.CreatedAtHeight != 0 { + n += 1 + sovEvent(uint64(m.CreatedAtHeight)) } - l = len(m.StateHash) + l = len(m.MorseAccountStateHash) if l > 0 { n += 1 + l + sovEvent(uint64(l)) } + if m.NumAccounts != 0 { + n += 1 + sovEvent(uint64(m.NumAccounts)) + } return n } @@ -203,9 +226,9 @@ func (m *EventCreateMorseAccountState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAtHeight", wireType) } - m.Height = 0 + m.CreatedAtHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -215,14 +238,14 @@ func (m *EventCreateMorseAccountState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= int64(b&0x7F) << shift + m.CreatedAtHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MorseAccountStateHash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -249,11 +272,30 @@ func (m *EventCreateMorseAccountState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StateHash = append(m.StateHash[:0], dAtA[iNdEx:postIndex]...) - if m.StateHash == nil { - m.StateHash = []byte{} + m.MorseAccountStateHash = append(m.MorseAccountStateHash[:0], dAtA[iNdEx:postIndex]...) + if m.MorseAccountStateHash == nil { + m.MorseAccountStateHash = []byte{} } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumAccounts", wireType) + } + m.NumAccounts = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumAccounts |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) diff --git a/x/migration/types/legacy.pb.go b/x/migration/types/legacy.pb.go index ab8f15b5c..78a752ab4 100644 --- a/x/migration/types/legacy.pb.go +++ b/x/migration/types/legacy.pb.go @@ -2,15 +2,20 @@ // source: poktroll/migration/legacy.proto // Types in this file are ONLY present to facilitate the verifiability of the -// migration state from Morse to Shannon. These types are used by the migration -// subcommand (e.g. `poktrolld migrate collect-morse-accounts ...) to transform -// the Morse state export into the Shannon state import. They ARE NOT persisted -// on-chain at any point. +// migration state from Morse to Shannon. +// +// These types are used by the migration subcommand to transform +// the Morse state export into the Shannon state import. +// Ref: `poktrolld migrate collect-morse-accounts ...` +// +// They ARE NOT persisted on-chain at any point.package poktroll.migration; package types import ( + bytes "bytes" fmt "fmt" + github_com_cometbft_cometbft_crypto "github.com/cometbft/cometbft/crypto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -29,8 +34,13 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MorseStateExport is the data structure that is serialized and output when running +// `pocket util export-genesis-for-reset`. +// See: https://editor.swagger.io/?url=https://raw.githubusercontent.com/pokt-network/pocket-core/staging/doc/specs/rpc-spec.yaml#operations-query-post_query_state type MorseStateExport struct { - AppHash string `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash"` + // app_hash is the Morse tendermint state hash. + AppHash string `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash"` + // app_state is the entire Morse tendermint application state. AppState *MorseAppState `protobuf:"bytes,2,opt,name=app_state,json=appState,proto3" json:"app_state"` } @@ -77,6 +87,8 @@ func (m *MorseStateExport) GetAppState() *MorseAppState { return nil } +// MorseAppState is the tendermint application state for the Morse tendermint +// application; not to be confused with the pokt protocol actor. type MorseAppState struct { Application *MorseApplications `protobuf:"bytes,1,opt,name=application,proto3" json:"application"` Auth *MorseAuth `protobuf:"bytes,2,opt,name=auth,proto3" json:"auth"` @@ -133,6 +145,7 @@ func (m *MorseAppState) GetPos() *MorsePos { return nil } +// A wrapper around the list of MorseApplications, necessary in order to conform to the Morse genesis structure. type MorseApplications struct { Applications []*MorseApplication `protobuf:"bytes,1,rep,name=applications,proto3" json:"applications"` } @@ -173,6 +186,53 @@ func (m *MorseApplications) GetApplications() []*MorseApplication { return nil } +// A wrapper around a list of Morse accounts. +type MorseAuth struct { + Accounts []*MorseAuthAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` +} + +func (m *MorseAuth) Reset() { *m = MorseAuth{} } +func (m *MorseAuth) String() string { return proto.CompactTextString(m) } +func (*MorseAuth) ProtoMessage() {} +func (*MorseAuth) Descriptor() ([]byte, []int) { + return fileDescriptor_3ba469df9d72c7fc, []int{3} +} +func (m *MorseAuth) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MorseAuth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MorseAuth) XXX_Merge(src proto.Message) { + xxx_messageInfo_MorseAuth.Merge(m, src) +} +func (m *MorseAuth) XXX_Size() int { + return m.Size() +} +func (m *MorseAuth) XXX_DiscardUnknown() { + xxx_messageInfo_MorseAuth.DiscardUnknown(m) +} + +var xxx_messageInfo_MorseAuth proto.InternalMessageInfo + +func (m *MorseAuth) GetAccounts() []*MorseAuthAccount { + if m != nil { + return m.Accounts + } + return nil +} + +// A wrapper around Morse account information, necessary in order to to confirm to the Morse genesis +// structure. Morse originally serialized accounts as pb.Any types in order to support multiple +// account types. For the purposes of the Morse -> Shannon migration, we're only concerned with +// externally owned accounts (as opposed to module accounts). As a result, we're simplifying its +// representation in Shannon by avoiding usage of pb.Any. It is necessary in order too conform to +// the Morse genesis structure. type MorseAuthAccount struct { Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"type"` Value *MorseAccount `protobuf:"bytes,2,opt,name=Value,proto3" json:"value"` @@ -182,7 +242,7 @@ func (m *MorseAuthAccount) Reset() { *m = MorseAuthAccount{} } func (m *MorseAuthAccount) String() string { return proto.CompactTextString(m) } func (*MorseAuthAccount) ProtoMessage() {} func (*MorseAuthAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_3ba469df9d72c7fc, []int{3} + return fileDescriptor_3ba469df9d72c7fc, []int{4} } func (m *MorseAuthAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -221,20 +281,22 @@ func (m *MorseAuthAccount) GetValue() *MorseAccount { return nil } -type MorseAuth struct { - Accounts []*MorseAuthAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` +// A wrapper around the list of Morse suppliers (aka "validators", "nodes", of "servicers"). +// It is necessary to conform to the Morse genesis structure. +type MorsePos struct { + Validators []*MorseValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` } -func (m *MorseAuth) Reset() { *m = MorseAuth{} } -func (m *MorseAuth) String() string { return proto.CompactTextString(m) } -func (*MorseAuth) ProtoMessage() {} -func (*MorseAuth) Descriptor() ([]byte, []int) { - return fileDescriptor_3ba469df9d72c7fc, []int{4} +func (m *MorsePos) Reset() { *m = MorsePos{} } +func (m *MorsePos) String() string { return proto.CompactTextString(m) } +func (*MorsePos) ProtoMessage() {} +func (*MorsePos) Descriptor() ([]byte, []int) { + return fileDescriptor_3ba469df9d72c7fc, []int{5} } -func (m *MorseAuth) XXX_Unmarshal(b []byte) error { +func (m *MorsePos) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MorseAuth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MorsePos) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -242,39 +304,49 @@ func (m *MorseAuth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { } return b[:n], nil } -func (m *MorseAuth) XXX_Merge(src proto.Message) { - xxx_messageInfo_MorseAuth.Merge(m, src) +func (m *MorsePos) XXX_Merge(src proto.Message) { + xxx_messageInfo_MorsePos.Merge(m, src) } -func (m *MorseAuth) XXX_Size() int { +func (m *MorsePos) XXX_Size() int { return m.Size() } -func (m *MorseAuth) XXX_DiscardUnknown() { - xxx_messageInfo_MorseAuth.DiscardUnknown(m) +func (m *MorsePos) XXX_DiscardUnknown() { + xxx_messageInfo_MorsePos.DiscardUnknown(m) } -var xxx_messageInfo_MorseAuth proto.InternalMessageInfo +var xxx_messageInfo_MorsePos proto.InternalMessageInfo -func (m *MorseAuth) GetAccounts() []*MorseAuthAccount { +func (m *MorsePos) GetValidators() []*MorseValidator { if m != nil { - return m.Accounts + return m.Validators } return nil } -type MorsePos struct { - Validators []*MorseValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` +// MorseApplication is a subset of the Morse ProtoApplication type. +// It encapsulates the minimum information required to import Morse applications. +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 +type MorseApplication struct { + // Address is a hex-encoded string representation of the address corresponding + // to a Morse application's ed25519 public key. + Address github_com_cometbft_cometbft_crypto.Address `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cometbft/cometbft/crypto.Address" json:"address" yaml:"address"` + // PublicKey is the binary representation of a Morse application's ed25519 public key. + PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key" yaml:"public_key"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed" yaml:"jailed"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status" yaml:"status"` + StakedTokens string `protobuf:"bytes,6,opt,name=staked_tokens,json=stakedTokens,proto3" json:"tokens"` } -func (m *MorsePos) Reset() { *m = MorsePos{} } -func (m *MorsePos) String() string { return proto.CompactTextString(m) } -func (*MorsePos) ProtoMessage() {} -func (*MorsePos) Descriptor() ([]byte, []int) { - return fileDescriptor_3ba469df9d72c7fc, []int{5} +func (m *MorseApplication) Reset() { *m = MorseApplication{} } +func (m *MorseApplication) String() string { return proto.CompactTextString(m) } +func (*MorseApplication) ProtoMessage() {} +func (*MorseApplication) Descriptor() ([]byte, []int) { + return fileDescriptor_3ba469df9d72c7fc, []int{6} } -func (m *MorsePos) XXX_Unmarshal(b []byte) error { +func (m *MorseApplication) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MorsePos) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MorseApplication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -282,71 +354,193 @@ func (m *MorsePos) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { } return b[:n], nil } -func (m *MorsePos) XXX_Merge(src proto.Message) { - xxx_messageInfo_MorsePos.Merge(m, src) +func (m *MorseApplication) XXX_Merge(src proto.Message) { + xxx_messageInfo_MorseApplication.Merge(m, src) } -func (m *MorsePos) XXX_Size() int { +func (m *MorseApplication) XXX_Size() int { return m.Size() } -func (m *MorsePos) XXX_DiscardUnknown() { - xxx_messageInfo_MorsePos.DiscardUnknown(m) +func (m *MorseApplication) XXX_DiscardUnknown() { + xxx_messageInfo_MorseApplication.DiscardUnknown(m) } -var xxx_messageInfo_MorsePos proto.InternalMessageInfo +var xxx_messageInfo_MorseApplication proto.InternalMessageInfo -func (m *MorsePos) GetValidators() []*MorseValidator { - if m != nil { - return m.Validators +// MorseValidator is a subset of the Morse ProtoValidator type. +// It encapsulates the minimum information required to import Morse suppliers (aka "servicers" or "validators"). +// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 +type MorseValidator struct { + Address github_com_cometbft_cometbft_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,casttype=github.com/cometbft/cometbft/crypto.Address" json:"address" yaml:"address"` + PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"public_key" yaml:"public_key"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status"` + StakedTokens string `protobuf:"bytes,7,opt,name=StakedTokens,proto3" json:"tokens"` +} + +func (m *MorseValidator) Reset() { *m = MorseValidator{} } +func (m *MorseValidator) String() string { return proto.CompactTextString(m) } +func (*MorseValidator) ProtoMessage() {} +func (*MorseValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_3ba469df9d72c7fc, []int{7} +} +func (m *MorseValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MorseValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - return nil + return b[:n], nil +} +func (m *MorseValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MorseValidator.Merge(m, src) +} +func (m *MorseValidator) XXX_Size() int { + return m.Size() } +func (m *MorseValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MorseValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MorseValidator proto.InternalMessageInfo func init() { proto.RegisterType((*MorseStateExport)(nil), "poktroll.migration.MorseStateExport") proto.RegisterType((*MorseAppState)(nil), "poktroll.migration.MorseAppState") proto.RegisterType((*MorseApplications)(nil), "poktroll.migration.MorseApplications") - proto.RegisterType((*MorseAuthAccount)(nil), "poktroll.migration.MorseAuthAccount") proto.RegisterType((*MorseAuth)(nil), "poktroll.migration.MorseAuth") + proto.RegisterType((*MorseAuthAccount)(nil), "poktroll.migration.MorseAuthAccount") proto.RegisterType((*MorsePos)(nil), "poktroll.migration.MorsePos") + proto.RegisterType((*MorseApplication)(nil), "poktroll.migration.MorseApplication") + proto.RegisterType((*MorseValidator)(nil), "poktroll.migration.MorseValidator") } func init() { proto.RegisterFile("poktroll/migration/legacy.proto", fileDescriptor_3ba469df9d72c7fc) } var fileDescriptor_3ba469df9d72c7fc = []byte{ - // 483 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xcd, 0x92, 0x96, 0x26, 0x93, 0x16, 0xca, 0x8a, 0x43, 0x54, 0x15, 0x3b, 0x58, 0x20, 0x72, - 0xc1, 0x96, 0xc2, 0x81, 0x03, 0xa7, 0xac, 0x84, 0xc4, 0xa5, 0xa8, 0x5a, 0x50, 0x85, 0x8a, 0x04, - 0xda, 0x1a, 0xcb, 0xb6, 0xea, 0x66, 0x57, 0xde, 0x75, 0x69, 0xfe, 0x02, 0x27, 0x7e, 0x16, 0xc7, - 0x1e, 0x7b, 0x32, 0x28, 0xb9, 0xf9, 0x57, 0xa0, 0x5d, 0x7f, 0xd4, 0xa1, 0xa4, 0xea, 0xc5, 0xda, - 0x9d, 0x79, 0xef, 0xcd, 0x1b, 0xcf, 0x0e, 0xd8, 0x82, 0x9f, 0xaa, 0x94, 0x27, 0x89, 0x77, 0x16, - 0x87, 0x29, 0x53, 0x31, 0x9f, 0x79, 0x49, 0x10, 0x32, 0x7f, 0xee, 0x8a, 0x94, 0x2b, 0x8e, 0x71, - 0x0d, 0x70, 0x1b, 0xc0, 0xde, 0xe3, 0x90, 0x87, 0xdc, 0xa4, 0x3d, 0x7d, 0x2a, 0x91, 0x7b, 0xd6, - 0x7f, 0xa4, 0xd4, 0x5c, 0x04, 0xb2, 0xcc, 0x3b, 0x3f, 0x10, 0xec, 0x1e, 0xf0, 0x54, 0x06, 0x1f, - 0x14, 0x53, 0xc1, 0xdb, 0x0b, 0xc1, 0x53, 0x85, 0x5f, 0x40, 0x8f, 0x09, 0xf1, 0x35, 0x62, 0x32, - 0x1a, 0xa2, 0x11, 0x1a, 0xf7, 0xc9, 0x76, 0x91, 0xdb, 0x4d, 0x8c, 0x6e, 0x31, 0x21, 0xde, 0x31, - 0x19, 0xe1, 0x03, 0xe8, 0xeb, 0xa0, 0xd4, 0xdc, 0xe1, 0xbd, 0x11, 0x1a, 0x0f, 0x26, 0x4f, 0xdd, - 0x9b, 0xde, 0x5c, 0x53, 0x61, 0x2a, 0x84, 0x29, 0x42, 0x76, 0x8a, 0xdc, 0xbe, 0xe6, 0x51, 0xad, - 0x6b, 0x12, 0xce, 0x6f, 0x04, 0x3b, 0x2b, 0x50, 0xfc, 0x09, 0x06, 0x4c, 0x88, 0x24, 0xf6, 0x8d, - 0x8e, 0x31, 0x33, 0x98, 0x3c, 0xbf, 0xad, 0x44, 0x8d, 0x95, 0xe4, 0x61, 0x91, 0xdb, 0x6d, 0x36, - 0x6d, 0x5f, 0xf0, 0x1b, 0xd8, 0x60, 0x99, 0x8a, 0x2a, 0xd7, 0x4f, 0xd6, 0x4b, 0x66, 0x2a, 0x22, - 0xbd, 0x22, 0xb7, 0x0d, 0x9c, 0x9a, 0x2f, 0x7e, 0x0d, 0x5d, 0xc1, 0xe5, 0xb0, 0x6b, 0xb8, 0xfb, - 0x6b, 0xb9, 0x87, 0x5c, 0x92, 0xad, 0x22, 0xb7, 0x35, 0x98, 0xea, 0x8f, 0xc3, 0xe1, 0xd1, 0x0d, - 0xa3, 0xf8, 0x18, 0xb6, 0x5b, 0xce, 0xe4, 0x10, 0x8d, 0xba, 0xe3, 0xc1, 0xe4, 0xd9, 0x5d, 0xba, - 0x24, 0xbb, 0x45, 0x6e, 0xaf, 0xb0, 0xe9, 0xca, 0xcd, 0x91, 0xd5, 0x78, 0x75, 0x1b, 0x53, 0xdf, - 0xe7, 0xd9, 0x4c, 0xe1, 0x7d, 0xd8, 0xf8, 0x38, 0x17, 0x41, 0x35, 0x5a, 0xd3, 0x9b, 0x7e, 0x12, - 0xd4, 0x44, 0xf1, 0x14, 0x36, 0x8f, 0x58, 0x92, 0xd5, 0xf3, 0x1c, 0xad, 0xb7, 0x51, 0xca, 0x91, - 0x7e, 0x91, 0xdb, 0x9b, 0xe7, 0x9a, 0x42, 0x4b, 0xa6, 0xf3, 0x19, 0xfa, 0x4d, 0x51, 0xfc, 0x1e, - 0x7a, 0xac, 0x44, 0xde, 0xa1, 0xb3, 0x6b, 0x97, 0xd5, 0x93, 0xab, 0x98, 0xb4, 0x39, 0x39, 0x5f, - 0xa0, 0x57, 0xff, 0x5c, 0x4c, 0x01, 0xce, 0x59, 0x12, 0x7f, 0x63, 0x8a, 0xa7, 0xb5, 0xba, 0xb3, - 0x56, 0xfd, 0xa8, 0x86, 0x92, 0x07, 0x45, 0x6e, 0xb7, 0x98, 0xb4, 0x75, 0x26, 0x87, 0xbf, 0x16, - 0x16, 0xba, 0x5c, 0x58, 0xe8, 0x6a, 0x61, 0xa1, 0x3f, 0x0b, 0x0b, 0xfd, 0x5c, 0x5a, 0x9d, 0xcb, - 0xa5, 0xd5, 0xb9, 0x5a, 0x5a, 0x9d, 0xe3, 0x49, 0x18, 0xab, 0x28, 0x3b, 0x71, 0x7d, 0x7e, 0xe6, - 0xe9, 0x3a, 0x2f, 0x67, 0x81, 0xfa, 0xce, 0xd3, 0x53, 0xaf, 0xd9, 0xb3, 0x8b, 0x7f, 0x37, 0xed, - 0xe4, 0xbe, 0x59, 0xb5, 0x57, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xf5, 0x9c, 0x74, 0xd7, - 0x03, 0x00, 0x00, + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xbd, 0x6b, 0x1b, 0x49, + 0x14, 0xd7, 0xfa, 0x4b, 0xd2, 0x48, 0xf2, 0xd9, 0xc3, 0x15, 0xc2, 0xe7, 0xdb, 0xd1, 0xcd, 0xdd, + 0x11, 0x41, 0x88, 0x04, 0x72, 0x11, 0x70, 0x2a, 0x2d, 0x04, 0x02, 0x89, 0x83, 0x19, 0x1b, 0x13, + 0x1c, 0x88, 0x19, 0x49, 0x6b, 0x49, 0xd1, 0x4a, 0x33, 0xec, 0xcc, 0x3a, 0xd6, 0x7f, 0x10, 0x52, + 0xa5, 0x4c, 0xe9, 0x7f, 0x25, 0x5d, 0x4a, 0x97, 0xae, 0x36, 0x41, 0x6a, 0xc2, 0x96, 0x2e, 0x53, + 0x85, 0x99, 0xfd, 0xd0, 0xca, 0x8e, 0x82, 0x53, 0xa4, 0x59, 0xe6, 0xbd, 0xf7, 0xfb, 0xbd, 0x8f, + 0xdf, 0xbc, 0x65, 0x00, 0xe2, 0x6c, 0x20, 0x5d, 0xe6, 0x38, 0xf5, 0x61, 0xbf, 0xeb, 0x52, 0xd9, + 0x67, 0xa3, 0xba, 0x63, 0x77, 0x69, 0x7b, 0x5c, 0xe3, 0x2e, 0x93, 0x0c, 0xc2, 0x18, 0x50, 0x4b, + 0x00, 0x5b, 0x7f, 0x76, 0x59, 0x97, 0xe9, 0x70, 0x5d, 0x9d, 0x42, 0xe4, 0x96, 0xf9, 0x83, 0x54, + 0x72, 0xcc, 0x6d, 0x11, 0xc6, 0xf1, 0x3b, 0x03, 0x6c, 0xec, 0x31, 0x57, 0xd8, 0x07, 0x92, 0x4a, + 0xfb, 0xf1, 0x39, 0x67, 0xae, 0x84, 0xf7, 0x40, 0x8e, 0x72, 0x7e, 0xd2, 0xa3, 0xa2, 0x57, 0x36, + 0x2a, 0x46, 0x35, 0x6f, 0x15, 0x03, 0x1f, 0x25, 0x3e, 0x92, 0xa5, 0x9c, 0x3f, 0xa1, 0xa2, 0x07, + 0xf7, 0x40, 0x5e, 0x39, 0x85, 0xe2, 0x96, 0x97, 0x2a, 0x46, 0xb5, 0xd0, 0xf8, 0xa7, 0x76, 0xbb, + 0xb7, 0x9a, 0xae, 0xd0, 0xe4, 0x5c, 0x17, 0xb1, 0x4a, 0x81, 0x8f, 0x66, 0x3c, 0xa2, 0xf2, 0xea, + 0x00, 0xfe, 0x6c, 0x80, 0xd2, 0x1c, 0x14, 0xbe, 0x00, 0x05, 0xca, 0xb9, 0xd3, 0x6f, 0xeb, 0x3c, + 0xba, 0x99, 0x42, 0xe3, 0xff, 0x9f, 0x95, 0x88, 0xb1, 0xc2, 0xfa, 0x23, 0xf0, 0x51, 0x9a, 0x4d, + 0xd2, 0x06, 0x7c, 0x04, 0x56, 0xa8, 0x27, 0x7b, 0x51, 0xd7, 0x7f, 0x2f, 0x4e, 0xe9, 0xc9, 0x9e, + 0x95, 0x0b, 0x7c, 0xa4, 0xe1, 0x44, 0x7f, 0xe1, 0x43, 0xb0, 0xcc, 0x99, 0x28, 0x2f, 0x6b, 0xee, + 0xf6, 0x42, 0xee, 0x3e, 0x13, 0x56, 0x36, 0xf0, 0x91, 0x02, 0x13, 0xf5, 0xc1, 0x0c, 0x6c, 0xde, + 0x6a, 0x14, 0x1e, 0x83, 0x62, 0xaa, 0x33, 0x51, 0x36, 0x2a, 0xcb, 0xd5, 0x42, 0xe3, 0xbf, 0xbb, + 0x4c, 0x69, 0x6d, 0x04, 0x3e, 0x9a, 0x63, 0x93, 0x39, 0x0b, 0xbf, 0x04, 0xf9, 0x64, 0x0c, 0xf8, + 0x1c, 0xe4, 0x68, 0xbb, 0xcd, 0xbc, 0x91, 0xbc, 0x43, 0x11, 0x4f, 0xf6, 0x9a, 0x21, 0x38, 0xba, + 0xfd, 0x88, 0x49, 0x92, 0x13, 0x16, 0xd1, 0xee, 0xa4, 0xb0, 0x70, 0x1b, 0xac, 0x1c, 0x8e, 0xb9, + 0x1d, 0xed, 0x8d, 0x16, 0x4e, 0xed, 0x1b, 0xd1, 0x5e, 0xd8, 0x04, 0xab, 0x47, 0xd4, 0xf1, 0xe2, + 0x65, 0xa9, 0x2c, 0x2e, 0x1f, 0x95, 0xce, 0x07, 0x3e, 0x5a, 0x3d, 0x53, 0x14, 0x12, 0x32, 0xf1, + 0x2b, 0x90, 0x8b, 0xc5, 0x85, 0x04, 0x80, 0x33, 0xea, 0xf4, 0x3b, 0x54, 0x32, 0x37, 0x1e, 0x09, + 0x2f, 0xcc, 0x79, 0x14, 0x43, 0xad, 0xf5, 0xc0, 0x47, 0x29, 0x26, 0x49, 0x9d, 0xf1, 0x74, 0x29, + 0x9e, 0x2a, 0xb5, 0x2d, 0xa7, 0x20, 0x4b, 0x3b, 0x1d, 0xd7, 0x16, 0x42, 0x0f, 0x56, 0xb4, 0x9e, + 0x05, 0x3e, 0x8a, 0x5d, 0xd7, 0x3e, 0x5a, 0x1f, 0xd3, 0xa1, 0xb3, 0x8b, 0x23, 0x07, 0xfe, 0xe6, + 0xa3, 0xfb, 0xdd, 0xbe, 0xec, 0x79, 0xad, 0x5a, 0x9b, 0x0d, 0xeb, 0x6d, 0x36, 0xb4, 0x65, 0xeb, + 0x54, 0xa6, 0x0e, 0xee, 0x98, 0x4b, 0x56, 0x6b, 0x86, 0x78, 0x12, 0x67, 0x82, 0x16, 0x00, 0xdc, + 0x6b, 0x39, 0xfd, 0xf6, 0xc9, 0xc0, 0x1e, 0x6b, 0x91, 0x8a, 0xd6, 0xbf, 0xaa, 0xd9, 0x99, 0xf7, + 0xda, 0x47, 0x9b, 0x61, 0xb5, 0x99, 0x0f, 0x93, 0x7c, 0x68, 0x3c, 0xb5, 0xc7, 0x70, 0x07, 0xac, + 0xbd, 0xa6, 0x7d, 0xc7, 0xee, 0xe8, 0xfd, 0xcc, 0x59, 0x7f, 0x05, 0x3e, 0x8a, 0x3c, 0xd7, 0x3e, + 0x2a, 0x85, 0xdc, 0xd0, 0xc6, 0x24, 0x0a, 0x28, 0x92, 0xfa, 0x1b, 0x3d, 0x51, 0x5e, 0xa9, 0x18, + 0xd5, 0xd5, 0x90, 0x14, 0x7a, 0x66, 0xa4, 0xd0, 0xc6, 0x24, 0x0a, 0xc0, 0x3a, 0x28, 0x09, 0x49, + 0x07, 0x76, 0xe7, 0x44, 0xb2, 0x81, 0x3d, 0x12, 0xe5, 0x35, 0x7d, 0xe9, 0x40, 0x71, 0x43, 0x0f, + 0x29, 0x86, 0x80, 0x43, 0x6d, 0xed, 0xe6, 0xde, 0x5e, 0xa0, 0xcc, 0xd7, 0x0b, 0x64, 0xe0, 0x8f, + 0x4b, 0x60, 0x7d, 0xfe, 0x52, 0x94, 0xc6, 0xcd, 0xdf, 0xa9, 0x71, 0x74, 0x80, 0x4d, 0x90, 0xdf, + 0x8f, 0xc5, 0xfa, 0x25, 0x89, 0x13, 0x16, 0xc4, 0x37, 0x24, 0x06, 0x33, 0x89, 0x13, 0x45, 0xf1, + 0x0d, 0x45, 0xc1, 0x4c, 0xd1, 0x44, 0xc0, 0x1a, 0x28, 0x1e, 0xa4, 0xf4, 0x29, 0x67, 0x6f, 0xeb, + 0x97, 0x8e, 0xef, 0x16, 0x95, 0x7e, 0x1f, 0x2e, 0x90, 0xa1, 0x34, 0xb4, 0xf6, 0x3f, 0x4d, 0x4c, + 0xe3, 0x72, 0x62, 0x1a, 0x57, 0x13, 0xd3, 0xf8, 0x32, 0x31, 0x8d, 0xf7, 0x53, 0x33, 0x73, 0x39, + 0x35, 0x33, 0x57, 0x53, 0x33, 0x73, 0xdc, 0x48, 0x89, 0xa3, 0xfe, 0x88, 0x07, 0x23, 0x5b, 0xbe, + 0x61, 0xee, 0xa0, 0x9e, 0xbc, 0x08, 0xe7, 0x37, 0xdf, 0x84, 0xd6, 0x9a, 0x7e, 0x14, 0x76, 0xbe, + 0x07, 0x00, 0x00, 0xff, 0xff, 0x70, 0x19, 0x49, 0x20, 0x81, 0x06, 0x00, 0x00, +} + +func (this *MorseApplication) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MorseApplication) + if !ok { + that2, ok := that.(MorseApplication) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Address, that1.Address) { + return false + } + if !bytes.Equal(this.PublicKey, that1.PublicKey) { + return false + } + if this.Jailed != that1.Jailed { + return false + } + if this.Status != that1.Status { + return false + } + if this.StakedTokens != that1.StakedTokens { + return false + } + return true } +func (this *MorseValidator) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + that1, ok := that.(*MorseValidator) + if !ok { + that2, ok := that.(MorseValidator) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Address, that1.Address) { + return false + } + if !bytes.Equal(this.PublicKey, that1.PublicKey) { + return false + } + if this.Jailed != that1.Jailed { + return false + } + if this.Status != that1.Status { + return false + } + if this.StakedTokens != that1.StakedTokens { + return false + } + return true +} func (m *MorseStateExport) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -485,6 +679,43 @@ func (m *MorseApplications) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MorseAuth) 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 *MorseAuth) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MorseAuth) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLegacy(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *MorseAuthAccount) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -527,7 +758,7 @@ func (m *MorseAuthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MorseAuth) Marshal() (dAtA []byte, err error) { +func (m *MorsePos) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -537,20 +768,20 @@ func (m *MorseAuth) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MorseAuth) MarshalTo(dAtA []byte) (int, error) { +func (m *MorsePos) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MorseAuth) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MorsePos) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Accounts) > 0 { - for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -564,7 +795,7 @@ func (m *MorseAuth) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MorsePos) Marshal() (dAtA []byte, err error) { +func (m *MorseApplication) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -574,29 +805,110 @@ func (m *MorsePos) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MorsePos) MarshalTo(dAtA []byte) (int, error) { +func (m *MorseApplication) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MorsePos) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MorseApplication) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintLegacy(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + if len(m.StakedTokens) > 0 { + i -= len(m.StakedTokens) + copy(dAtA[i:], m.StakedTokens) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.StakedTokens))) + i-- + dAtA[i] = 0x32 + } + if m.Status != 0 { + i = encodeVarintLegacy(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MorseValidator) 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 *MorseValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MorseValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StakedTokens) > 0 { + i -= len(m.StakedTokens) + copy(dAtA[i:], m.StakedTokens) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.StakedTokens))) + i-- + dAtA[i] = 0x3a + } + if m.Status != 0 { + i = encodeVarintLegacy(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x18 + } + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintLegacy(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -665,34 +977,34 @@ func (m *MorseApplications) Size() (n int) { return n } -func (m *MorseAuthAccount) Size() (n int) { +func (m *MorseAuth) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovLegacy(uint64(l)) - } - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovLegacy(uint64(l)) + if len(m.Accounts) > 0 { + for _, e := range m.Accounts { + l = e.Size() + n += 1 + l + sovLegacy(uint64(l)) + } } return n } -func (m *MorseAuth) Size() (n int) { +func (m *MorseAuthAccount) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Accounts) > 0 { - for _, e := range m.Accounts { - l = e.Size() - n += 1 + l + sovLegacy(uint64(l)) - } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovLegacy(uint64(l)) } return n } @@ -712,6 +1024,60 @@ func (m *MorsePos) Size() (n int) { return n } +func (m *MorseApplication) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovLegacy(uint64(m.Status)) + } + l = len(m.StakedTokens) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + return n +} + +func (m *MorseValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + l = len(m.PublicKey) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovLegacy(uint64(m.Status)) + } + l = len(m.StakedTokens) + if l > 0 { + n += 1 + l + sovLegacy(uint64(l)) + } + return n +} + func sovLegacy(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1078,6 +1444,90 @@ func (m *MorseApplications) Unmarshal(dAtA []byte) error { } return nil } +func (m *MorseAuth) 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 ErrIntOverflowLegacy + } + 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: MorseAuth: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MorseAuth: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLegacy + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Accounts = append(m.Accounts, &MorseAuthAccount{}) + if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLegacy(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLegacy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MorseAuthAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1196,7 +1646,7 @@ func (m *MorseAuthAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *MorseAuth) Unmarshal(dAtA []byte) error { +func (m *MorsePos) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1219,15 +1669,15 @@ func (m *MorseAuth) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MorseAuth: wiretype end group for non-group") + return fmt.Errorf("proto: MorsePos: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MorseAuth: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MorsePos: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1254,8 +1704,8 @@ func (m *MorseAuth) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Accounts = append(m.Accounts, &MorseAuthAccount{}) - if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Validators = append(m.Validators, &MorseValidator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1280,7 +1730,7 @@ func (m *MorseAuth) Unmarshal(dAtA []byte) error { } return nil } -func (m *MorsePos) Unmarshal(dAtA []byte) error { +func (m *MorseApplication) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1303,17 +1753,17 @@ func (m *MorsePos) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MorsePos: wiretype end group for non-group") + return fmt.Errorf("proto: MorseApplication: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MorsePos: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MorseApplication: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowLegacy @@ -1323,25 +1773,319 @@ func (m *MorsePos) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthLegacy } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthLegacy } if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, &MorseValidator{}) - if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthLegacy + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + 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 ErrInvalidLengthLegacy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakedTokens = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLegacy(dAtA[iNdEx:]) + if err != nil { return err } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLegacy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MorseValidator) 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 ErrIntOverflowLegacy + } + 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: MorseValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MorseValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthLegacy + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthLegacy + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.PublicKey == nil { + m.PublicKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLegacy + } + 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 ErrInvalidLengthLegacy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLegacy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakedTokens = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/migration/types/messages_morse_account_state.go b/x/migration/types/messages_morse_account_state.go index 28081eab6..2edd6b63e 100644 --- a/x/migration/types/messages_morse_account_state.go +++ b/x/migration/types/messages_morse_account_state.go @@ -1,24 +1,53 @@ package types import ( - errorsmod "cosmossdk.io/errors" + "bytes" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var _ sdk.Msg = &MsgCreateMorseAccountState{} -func NewMsgCreateMorseAccountState(authority string, morseAccountState MorseAccountState) *MsgCreateMorseAccountState { - return &MsgCreateMorseAccountState{ - Authority: authority, - MorseAccountState: morseAccountState, +func NewMsgCreateMorseAccountState( + authority string, + morseAccountState MorseAccountState, +) (*MsgCreateMorseAccountState, error) { + morseAccountStateHash, err := morseAccountState.GetHash() + if err != nil { + return nil, err } + + return &MsgCreateMorseAccountState{ + Authority: authority, + MorseAccountState: morseAccountState, + MorseAccountStateHash: morseAccountStateHash, + }, nil } func (msg *MsgCreateMorseAccountState) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Authority) + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address (%s)", err) + } + + // TODO_UPNEXT(@bryanchriswhite): add validation. + + actualHash, err := msg.MorseAccountState.GetHash() if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return err + } + + expectedHash := msg.GetMorseAccountStateHash() + if len(expectedHash) == 0 { + return ErrMorseAccountState.Wrapf("expected hash is empty") } + + if !bytes.Equal(actualHash, expectedHash) { + return ErrMorseAccountState.Wrapf( + "Morse account state hash (%x) doesn't match expected: (%x)", + actualHash, expectedHash, + ) + } + return nil } diff --git a/x/migration/types/messages_morse_account_state_test.go b/x/migration/types/messages_morse_account_state_test.go index f877b22a5..6f1caed63 100644 --- a/x/migration/types/messages_morse_account_state_test.go +++ b/x/migration/types/messages_morse_account_state_test.go @@ -10,6 +10,9 @@ import ( ) func TestMsgCreateMorseAccountState_ValidateBasic(t *testing.T) { + validMsg, err := NewMsgCreateMorseAccountState(sample.AccAddress(), MorseAccountState{}) + require.NoError(t, err) + tests := []struct { name string msg MsgCreateMorseAccountState @@ -23,14 +26,12 @@ func TestMsgCreateMorseAccountState_ValidateBasic(t *testing.T) { err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: MsgCreateMorseAccountState{ - Authority: sample.AccAddress(), - }, + msg: *validMsg, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() + err = tt.msg.ValidateBasic() if tt.err != nil { require.ErrorIs(t, err, tt.err) return diff --git a/x/migration/types/morse_account_state.go b/x/migration/types/morse_account_state.go index d1a9763fa..da5dca020 100644 --- a/x/migration/types/morse_account_state.go +++ b/x/migration/types/morse_account_state.go @@ -6,6 +6,8 @@ import ( "github.com/cosmos/gogoproto/proto" ) +// GetHash calculates the sha256 hash of the MorseAccountState. +// It is intended to be used to verify the integrity of the MorseAccountState. func (m MorseAccountState) GetHash() ([]byte, error) { accountStateBz, err := proto.Marshal(&m) if err != nil { diff --git a/x/migration/types/query.pb.go b/x/migration/types/query.pb.go index a9f299c3d..9b9248c9b 100644 --- a/x/migration/types/query.pb.go +++ b/x/migration/types/query.pb.go @@ -106,6 +106,7 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// Queries the MorseAccountState which was created with MsgCreateMorseAccountState. type QueryGetMorseAccountStateRequest struct { } @@ -138,6 +139,7 @@ func (m *QueryGetMorseAccountStateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryGetMorseAccountStateRequest proto.InternalMessageInfo +// Returns the MorseAccountState. If it has not yet been created, an error is returned. type QueryGetMorseAccountStateResponse struct { MorseAccountState MorseAccountState `protobuf:"bytes,1,opt,name=MorseAccountState,proto3" json:"MorseAccountState"` } @@ -232,7 +234,7 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a MorseAccountState by index. + // Queries the MorseAccountState. MorseAccountState(ctx context.Context, in *QueryGetMorseAccountStateRequest, opts ...grpc.CallOption) (*QueryGetMorseAccountStateResponse, error) } @@ -266,7 +268,7 @@ func (c *queryClient) MorseAccountState(ctx context.Context, in *QueryGetMorseAc type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a MorseAccountState by index. + // Queries the MorseAccountState. MorseAccountState(context.Context, *QueryGetMorseAccountStateRequest) (*QueryGetMorseAccountStateResponse, error) } diff --git a/x/migration/types/tx.pb.go b/x/migration/types/tx.pb.go index 1df2b7573..74c8a77b1 100644 --- a/x/migration/types/tx.pb.go +++ b/x/migration/types/tx.pb.go @@ -117,10 +117,20 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgCreateMorseAccountState is used to create the on-chain MorseAccountState ONLY ONCE (per network / re-genesis). type MsgCreateMorseAccountState struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // the account state derived from the Morse state export and the `poktrolld migrate collect-morse-accounts` command. MorseAccountState MorseAccountState `protobuf:"bytes,2,opt,name=morse_account_state,json=morseAccountState,proto3" json:"morse_account_state"` + // expected sha256 hash of the morse_account_state. If this hash does not match the on-chain + // computation, the transaction will fail. Social consensus regarding the correctness of + // morse_account_state should have be achieved off-chain and can be verified on-chain by + // comparing this hash with that of a locally derived Morse state export: + // E.g., `poktrolld migrate collect-morse-accounts $<(pocket util export-genesis-for-reset)`. + // See: `pocket util export-genesis-for-migration --help` & `poktrolld migrate collect-morse-accounts --help` + // for more details. + MorseAccountStateHash []byte `protobuf:"bytes,3,opt,name=morse_account_state_hash,json=morseAccountStateHash,proto3" json:"morse_account_state_hash"` } func (m *MsgCreateMorseAccountState) Reset() { *m = MsgCreateMorseAccountState{} } @@ -166,8 +176,19 @@ func (m *MsgCreateMorseAccountState) GetMorseAccountState() MorseAccountState { return MorseAccountState{} } +func (m *MsgCreateMorseAccountState) GetMorseAccountStateHash() []byte { + if m != nil { + return m.MorseAccountStateHash + } + return nil +} + +// MsgCreateMorseAccountStateResponse represents an on-chain summary of the result of the corresponding MsgCreateMorseAccountState. type MsgCreateMorseAccountStateResponse struct { - StateHash []byte `protobuf:"bytes,1,opt,name=state_hash,json=stateHash,proto3" json:"state_hash"` + // On-chain computed sha256 hash of the morse_account_state provided in the corresponding MsgCreateMorseAccountState. + StateHash []byte `protobuf:"bytes,1,opt,name=state_hash,json=stateHash,proto3" json:"state_hash"` + // Number of accounts (EOAs) which were collected from the Morse state export, which may be claimed. + // NOTE: Application and supplier actor stakes are consolidated into their corresponding account balances. NumAccounts uint64 `protobuf:"varint,2,opt,name=num_accounts,json=numAccounts,proto3" json:"num_accounts"` } @@ -331,52 +352,53 @@ func init() { func init() { proto.RegisterFile("poktroll/migration/tx.proto", fileDescriptor_21658240592266b6) } var fileDescriptor_21658240592266b6 = []byte{ - // 709 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4a, - 0x14, 0xb5, 0x9c, 0xf7, 0xf2, 0xf0, 0x38, 0x38, 0x2f, 0x4a, 0x4a, 0x6c, 0x05, 0xa4, 0xe0, 0x36, - 0x10, 0x52, 0x2c, 0x35, 0x0e, 0xa4, 0x10, 0x5a, 0x68, 0x94, 0x2e, 0xba, 0x31, 0x04, 0x85, 0x6e, - 0xba, 0x51, 0xc7, 0xf2, 0x54, 0x16, 0xb1, 0x66, 0xcc, 0xcc, 0x38, 0x4d, 0x76, 0x6d, 0x57, 0xa5, - 0x74, 0x51, 0xe8, 0x4f, 0x74, 0x99, 0x45, 0x7f, 0xa0, 0xbb, 0x2c, 0x43, 0x57, 0xa1, 0x0b, 0x51, - 0x9c, 0x45, 0x40, 0x5f, 0x51, 0x24, 0x8d, 0x94, 0xd8, 0x96, 0x69, 0xda, 0x8d, 0x3d, 0x33, 0xe7, - 0xcc, 0xb9, 0xf7, 0x9e, 0xab, 0xb9, 0x60, 0xa5, 0x4f, 0x0e, 0x39, 0x25, 0xbd, 0x9e, 0xe1, 0x7b, - 0x2e, 0x85, 0xdc, 0x23, 0xd8, 0xe0, 0xc7, 0x7a, 0x9f, 0x12, 0x4e, 0x64, 0x39, 0x05, 0xf5, 0x0c, - 0x54, 0x16, 0xa0, 0xef, 0x61, 0x62, 0xc4, 0xbf, 0x09, 0x4d, 0x59, 0x76, 0x08, 0xf3, 0x09, 0x33, - 0x7c, 0xe6, 0x1a, 0x47, 0x9b, 0xd1, 0x9f, 0x00, 0x6a, 0x09, 0x60, 0xc7, 0x3b, 0x23, 0xd9, 0x08, - 0x48, 0x15, 0x77, 0xda, 0x90, 0x21, 0xe3, 0x68, 0xb3, 0x8d, 0x38, 0xdc, 0x34, 0x1c, 0xe2, 0x61, - 0x81, 0x2f, 0xb9, 0xc4, 0x25, 0xc9, 0xbd, 0x68, 0x25, 0x4e, 0xb5, 0x9c, 0x6c, 0xfb, 0x90, 0x42, - 0x3f, 0x93, 0xcd, 0x2b, 0xe7, 0xa4, 0x8f, 0x04, 0x5e, 0xff, 0x26, 0x81, 0xf9, 0x16, 0x73, 0x9f, - 0xf7, 0x3b, 0x90, 0xa3, 0xfd, 0xf8, 0xa6, 0xbc, 0x0d, 0x4a, 0x70, 0xc0, 0xbb, 0x84, 0x7a, 0xfc, - 0xa4, 0x2a, 0xad, 0x4a, 0xeb, 0x25, 0xb3, 0xfa, 0xfd, 0x6b, 0x63, 0x49, 0xe4, 0xbb, 0xdb, 0xe9, - 0x50, 0xc4, 0xd8, 0x01, 0xa7, 0x1e, 0x76, 0xad, 0x6b, 0xaa, 0xfc, 0x18, 0xcc, 0x26, 0xb1, 0xab, - 0xc5, 0x55, 0x69, 0xbd, 0xdc, 0x54, 0xf4, 0x49, 0xbb, 0xf4, 0x24, 0x86, 0x59, 0x3a, 0x0b, 0xb4, - 0xc2, 0x97, 0xab, 0xd3, 0x0d, 0xc9, 0x12, 0x97, 0x76, 0x1e, 0xbe, 0xbb, 0x3a, 0xdd, 0xb8, 0x96, - 0xfb, 0x70, 0x75, 0xba, 0x71, 0x2f, 0xcb, 0xfe, 0xf8, 0x46, 0xfe, 0x63, 0xf9, 0xd6, 0x6b, 0x60, - 0x79, 0xec, 0xc8, 0x42, 0xac, 0x4f, 0x30, 0x43, 0xf5, 0x0b, 0x09, 0x28, 0x2d, 0xe6, 0xee, 0x51, - 0x04, 0x39, 0x6a, 0x11, 0xca, 0xd0, 0xae, 0xe3, 0x90, 0x01, 0xe6, 0x07, 0x1c, 0x72, 0xf4, 0xd7, - 0x95, 0x52, 0xb0, 0xe8, 0x47, 0x62, 0x36, 0x4c, 0xd4, 0x6c, 0x16, 0xc9, 0x89, 0xb2, 0xd7, 0xf2, - 0xca, 0x9e, 0x88, 0x6d, 0xae, 0x44, 0x0e, 0x84, 0x81, 0x96, 0xa7, 0x64, 0x2d, 0xf8, 0xe3, 0xfc, - 0x9d, 0xca, 0xa8, 0x3d, 0xf5, 0xf7, 0x12, 0xa8, 0x4f, 0x2f, 0x2d, 0x75, 0x40, 0x6e, 0x00, 0x10, - 0x4b, 0xda, 0x5d, 0xc8, 0xba, 0x71, 0x8d, 0x73, 0x66, 0x25, 0x0c, 0xb4, 0x1b, 0xa7, 0x56, 0x29, - 0x5e, 0x3f, 0x83, 0xac, 0x2b, 0x6f, 0x81, 0x39, 0x3c, 0xf0, 0xd3, 0x6c, 0x92, 0x4e, 0xfe, 0x63, - 0xfe, 0x1f, 0x06, 0xda, 0xc8, 0xb9, 0x55, 0xc6, 0x03, 0x5f, 0xc4, 0x63, 0xf5, 0xcf, 0x45, 0xb0, - 0x10, 0xa5, 0xd2, 0x83, 0x9e, 0x1f, 0x67, 0xb2, 0x4f, 0x0e, 0xb9, 0xdc, 0x06, 0x4b, 0xac, 0x0b, - 0x31, 0x26, 0xd8, 0xee, 0x20, 0xc6, 0x6d, 0x98, 0xb8, 0x29, 0x7c, 0x7e, 0x10, 0x06, 0x5a, 0x2e, - 0x3e, 0xd5, 0x7f, 0x59, 0xb0, 0x9f, 0x22, 0xc6, 0x05, 0x22, 0xef, 0x82, 0xc4, 0x29, 0x9b, 0x51, - 0x27, 0x0b, 0x50, 0x8c, 0x03, 0xdc, 0x09, 0x03, 0x6d, 0x12, 0xb4, 0xe6, 0xe3, 0xa3, 0x03, 0xea, - 0xa4, 0x12, 0x8f, 0xc0, 0xbc, 0x60, 0x79, 0x2e, 0x86, 0x7c, 0x40, 0x51, 0x75, 0x26, 0x76, 0x69, - 0x31, 0x0c, 0xb4, 0x71, 0xc8, 0xaa, 0x24, 0xd7, 0xd3, 0xfd, 0x4e, 0x2d, 0xea, 0x4a, 0x6e, 0x1d, - 0xf5, 0x8f, 0x12, 0xa8, 0x4d, 0xb8, 0x92, 0xf5, 0xe5, 0x09, 0xf8, 0xaf, 0x0d, 0x7b, 0x10, 0x3b, - 0x28, 0x36, 0xa4, 0xdc, 0xac, 0xe9, 0xa2, 0xea, 0x68, 0x02, 0xe8, 0x62, 0x02, 0xe8, 0x7b, 0xc4, - 0xc3, 0x66, 0x39, 0x0c, 0xb4, 0x94, 0x6d, 0xa5, 0x8b, 0xb1, 0xce, 0x16, 0x7f, 0xd3, 0xd9, 0xe6, - 0x8f, 0x22, 0x98, 0x69, 0x31, 0x57, 0x7e, 0x09, 0xe6, 0x46, 0x5e, 0xfb, 0xdd, 0xdc, 0xcf, 0x75, - 0xf4, 0x3d, 0x29, 0xf7, 0x6f, 0x41, 0xca, 0x4a, 0x7b, 0x2b, 0x81, 0xe5, 0x69, 0x2f, 0x4e, 0x9f, - 0x22, 0x34, 0x85, 0xaf, 0x6c, 0xff, 0x19, 0x3f, 0xcb, 0xe1, 0x15, 0xa8, 0x8c, 0x7d, 0x8e, 0x6b, - 0xd3, 0x94, 0x46, 0x68, 0x4a, 0xe3, 0x56, 0xb4, 0x34, 0x8e, 0xf2, 0xef, 0x9b, 0x68, 0x86, 0x99, - 0xfb, 0x67, 0x43, 0x55, 0x3a, 0x1f, 0xaa, 0xd2, 0xc5, 0x50, 0x95, 0x7e, 0x0e, 0x55, 0xe9, 0xd3, - 0xa5, 0x5a, 0x38, 0xbf, 0x54, 0x0b, 0x17, 0x97, 0x6a, 0xe1, 0x45, 0xd3, 0xf5, 0x78, 0x77, 0xd0, - 0xd6, 0x1d, 0xe2, 0x1b, 0x91, 0x7a, 0x03, 0x23, 0xfe, 0x9a, 0xd0, 0x43, 0x23, 0x77, 0xbc, 0xc5, - 0xe3, 0xb9, 0x3d, 0x1b, 0xcf, 0xe7, 0xad, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xee, 0xe3, - 0xc0, 0x90, 0x06, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x4e, 0xdb, 0x4a, + 0x14, 0xcd, 0x84, 0xf7, 0x78, 0xca, 0x04, 0x85, 0x87, 0x01, 0x91, 0x98, 0xca, 0x46, 0x69, 0x91, + 0x10, 0x55, 0xec, 0x12, 0x24, 0x2a, 0xa1, 0x56, 0x2a, 0xa1, 0x8b, 0x6e, 0x22, 0x21, 0x23, 0x36, + 0xdd, 0xa4, 0x13, 0x67, 0xea, 0x58, 0xc4, 0x33, 0xd1, 0xcc, 0x84, 0xc2, 0xae, 0xed, 0xaa, 0xaa, + 0xba, 0xa8, 0xd4, 0x9f, 0xe8, 0xae, 0x2c, 0xfa, 0x03, 0xdd, 0xb1, 0x44, 0x5d, 0xa1, 0x2e, 0xac, + 0x2a, 0x2c, 0x90, 0xfc, 0x15, 0x95, 0xed, 0x71, 0x20, 0x89, 0xa3, 0xd2, 0x6e, 0x12, 0x7b, 0xce, + 0xb9, 0xe7, 0x9e, 0x7b, 0xaf, 0xe7, 0xc2, 0xe5, 0x2e, 0x3d, 0x14, 0x8c, 0x76, 0x3a, 0xa6, 0xe7, + 0x3a, 0x0c, 0x09, 0x97, 0x12, 0x53, 0x1c, 0x1b, 0x5d, 0x46, 0x05, 0x55, 0x94, 0x04, 0x34, 0x06, + 0xa0, 0x3a, 0x87, 0x3c, 0x97, 0x50, 0x33, 0xfa, 0x8d, 0x69, 0xea, 0x92, 0x4d, 0xb9, 0x47, 0xb9, + 0xe9, 0x71, 0xc7, 0x3c, 0xda, 0x08, 0xff, 0x24, 0x50, 0x8a, 0x81, 0x46, 0xf4, 0x66, 0xc6, 0x2f, + 0x12, 0xd2, 0x64, 0x4c, 0x13, 0x71, 0x6c, 0x1e, 0x6d, 0x34, 0xb1, 0x40, 0x1b, 0xa6, 0x4d, 0x5d, + 0x22, 0xf1, 0x05, 0x87, 0x3a, 0x34, 0x8e, 0x0b, 0x9f, 0xe4, 0xa9, 0x9e, 0xe2, 0xb6, 0x8b, 0x18, + 0xf2, 0x06, 0xb2, 0x69, 0xe5, 0x9c, 0x74, 0xb1, 0xc4, 0xcb, 0xdf, 0x00, 0x9c, 0xad, 0x73, 0xe7, + 0xa0, 0xdb, 0x42, 0x02, 0xef, 0x45, 0x91, 0xca, 0x16, 0xcc, 0xa1, 0x9e, 0x68, 0x53, 0xe6, 0x8a, + 0x93, 0x22, 0x58, 0x01, 0x6b, 0xb9, 0x5a, 0xf1, 0xfb, 0xd7, 0xca, 0x82, 0xf4, 0xbb, 0xd3, 0x6a, + 0x31, 0xcc, 0xf9, 0xbe, 0x60, 0x2e, 0x71, 0xac, 0x6b, 0xaa, 0xf2, 0x18, 0x4e, 0xc7, 0xb9, 0x8b, + 0xd9, 0x15, 0xb0, 0x96, 0xaf, 0xaa, 0xc6, 0x78, 0xbb, 0x8c, 0x38, 0x47, 0x2d, 0x77, 0xe6, 0xeb, + 0x99, 0xcf, 0x57, 0xa7, 0xeb, 0xc0, 0x92, 0x41, 0xdb, 0x0f, 0xdf, 0x5e, 0x9d, 0xae, 0x5f, 0xcb, + 0xbd, 0xbf, 0x3a, 0x5d, 0xbf, 0x37, 0x70, 0x7f, 0x7c, 0xc3, 0xff, 0x88, 0xdf, 0x72, 0x09, 0x2e, + 0x8d, 0x1c, 0x59, 0x98, 0x77, 0x29, 0xe1, 0xb8, 0xfc, 0x25, 0x0b, 0xd5, 0x3a, 0x77, 0x76, 0x19, + 0x46, 0x02, 0xd7, 0x29, 0xe3, 0x78, 0xc7, 0xb6, 0x69, 0x8f, 0x88, 0x7d, 0x81, 0x04, 0xfe, 0xeb, + 0x4a, 0x19, 0x9c, 0xf7, 0x42, 0xb1, 0x06, 0x8a, 0xd5, 0x1a, 0x3c, 0x94, 0x93, 0x65, 0xaf, 0xa6, + 0x95, 0x3d, 0x96, 0xbb, 0xb6, 0x1c, 0x76, 0x20, 0xf0, 0xf5, 0x34, 0x25, 0x6b, 0xce, 0x1b, 0xf3, + 0x7a, 0x00, 0x8b, 0x29, 0xcc, 0x46, 0x1b, 0xf1, 0x76, 0x71, 0x6a, 0x05, 0xac, 0xcd, 0xd4, 0xee, + 0x04, 0xbe, 0x3e, 0x91, 0x63, 0x2d, 0x8e, 0x49, 0x3e, 0x43, 0xbc, 0xbd, 0x5d, 0x18, 0xee, 0x7a, + 0xf9, 0x1d, 0x80, 0xe5, 0xc9, 0x1d, 0x4b, 0x1a, 0xab, 0x54, 0x20, 0xbc, 0x91, 0x1f, 0x44, 0xf9, + 0x0b, 0x81, 0xaf, 0xdf, 0x38, 0xb5, 0x72, 0x3c, 0xc9, 0xa2, 0x6c, 0xc2, 0x19, 0xd2, 0xf3, 0x12, + 0x5b, 0xf1, 0x07, 0xf2, 0x4f, 0xed, 0xff, 0xc0, 0xd7, 0x87, 0xce, 0xad, 0x3c, 0xe9, 0x79, 0x32, + 0x1f, 0x2f, 0x7f, 0xca, 0xc2, 0xb9, 0xd0, 0x4a, 0x07, 0xb9, 0x5e, 0xe4, 0x64, 0x8f, 0x1e, 0x0a, + 0xa5, 0x09, 0x17, 0x78, 0x1b, 0x11, 0x42, 0x49, 0xa3, 0x85, 0xb9, 0x68, 0xa0, 0x78, 0x48, 0x72, + 0x7c, 0x0f, 0x02, 0x5f, 0x4f, 0xc5, 0x27, 0x8e, 0x55, 0x91, 0xec, 0xa7, 0x98, 0x0b, 0x89, 0x28, + 0x3b, 0x30, 0x1e, 0x40, 0x83, 0x33, 0x7b, 0x90, 0x20, 0x1b, 0x25, 0x58, 0x0c, 0x7c, 0x7d, 0x1c, + 0xb4, 0x66, 0xa3, 0xa3, 0x7d, 0x66, 0x27, 0x12, 0x8f, 0xe0, 0xac, 0x64, 0xb9, 0x0e, 0x41, 0xa2, + 0xc7, 0xb0, 0x9c, 0xd2, 0x7c, 0xe0, 0xeb, 0xa3, 0x90, 0x55, 0x88, 0xc3, 0x93, 0xf7, 0xed, 0x52, + 0x38, 0x95, 0xd4, 0x3a, 0xca, 0x1f, 0x00, 0x2c, 0x8d, 0x75, 0x65, 0x30, 0x97, 0x27, 0xf0, 0xbf, + 0x26, 0xea, 0x20, 0x62, 0xe3, 0xa8, 0x21, 0xf9, 0x6a, 0xc9, 0x90, 0x55, 0x87, 0x8b, 0xc5, 0x90, + 0x8b, 0xc5, 0xd8, 0xa5, 0x2e, 0xa9, 0xe5, 0x03, 0x5f, 0x4f, 0xd8, 0x56, 0xf2, 0x30, 0x32, 0xd9, + 0xec, 0x6f, 0x26, 0x5b, 0xfd, 0x91, 0x85, 0x53, 0x75, 0xee, 0x28, 0x2f, 0xe0, 0xcc, 0xd0, 0x12, + 0xb9, 0x9b, 0x7a, 0x0b, 0x86, 0xaf, 0xa9, 0x7a, 0xff, 0x16, 0xa4, 0x41, 0x69, 0x6f, 0x00, 0x5c, + 0x9a, 0x74, 0x91, 0x8d, 0x09, 0x42, 0x13, 0xf8, 0xea, 0xd6, 0x9f, 0xf1, 0x07, 0x1e, 0x5e, 0xc2, + 0xc2, 0xc8, 0xe7, 0xb8, 0x3a, 0x49, 0x69, 0x88, 0xa6, 0x56, 0x6e, 0x45, 0x4b, 0xf2, 0xa8, 0xff, + 0xbe, 0x0e, 0x57, 0x63, 0x6d, 0xef, 0xac, 0xaf, 0x81, 0xf3, 0xbe, 0x06, 0x2e, 0xfa, 0x1a, 0xf8, + 0xd9, 0xd7, 0xc0, 0xc7, 0x4b, 0x2d, 0x73, 0x7e, 0xa9, 0x65, 0x2e, 0x2e, 0xb5, 0xcc, 0xf3, 0xaa, + 0xe3, 0x8a, 0x76, 0xaf, 0x69, 0xd8, 0xd4, 0x33, 0x43, 0xf5, 0x0a, 0xc1, 0xe2, 0x15, 0x65, 0x87, + 0x66, 0xea, 0xd6, 0x8c, 0xb6, 0x7e, 0x73, 0x3a, 0x5a, 0xfb, 0x9b, 0xbf, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x80, 0x76, 0xa4, 0xd3, 0xe7, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -618,6 +640,13 @@ func (m *MsgCreateMorseAccountState) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + if len(m.MorseAccountStateHash) > 0 { + i -= len(m.MorseAccountStateHash) + copy(dAtA[i:], m.MorseAccountStateHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.MorseAccountStateHash))) + i-- + dAtA[i] = 0x1a + } { size, err := m.MorseAccountState.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -806,6 +835,10 @@ func (m *MsgCreateMorseAccountState) Size() (n int) { } l = m.MorseAccountState.Size() n += 1 + l + sovTx(uint64(l)) + l = len(m.MorseAccountStateHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1128,6 +1161,40 @@ func (m *MsgCreateMorseAccountState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MorseAccountStateHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MorseAccountStateHash = append(m.MorseAccountStateHash[:0], dAtA[iNdEx:postIndex]...) + if m.MorseAccountStateHash == nil { + m.MorseAccountStateHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/migration/types/types.pb.go b/x/migration/types/types.pb.go index 3d9399d1c..91a2f7d54 100644 --- a/x/migration/types/types.pb.go +++ b/x/migration/types/types.pb.go @@ -4,7 +4,6 @@ package types import ( - bytes "bytes" crypto_ed25519 "crypto/ed25519" fmt "fmt" github_com_cometbft_cometbft_crypto "github.com/cometbft/cometbft/crypto" @@ -153,212 +152,46 @@ func (m *MorsePublicKey) GetValue() crypto_ed25519.PublicKey { return nil } -// MorseApplication is a subset of the Morse ProtoApplication type. It encapsulates -// the minimum information required to import Morse applications. -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/apps/apps.proto#L16 -type MorseApplication struct { - Address github_com_cometbft_cometbft_crypto.Address `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cometbft/cometbft/crypto.Address" json:"address" yaml:"address"` - PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key" yaml:"public_key"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed" yaml:"jailed"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status" yaml:"status"` - StakedTokens string `protobuf:"bytes,6,opt,name=staked_tokens,json=stakedTokens,proto3" json:"staked_tokens,omitempty"` -} - -func (m *MorseApplication) Reset() { *m = MorseApplication{} } -func (m *MorseApplication) String() string { return proto.CompactTextString(m) } -func (*MorseApplication) ProtoMessage() {} -func (*MorseApplication) Descriptor() ([]byte, []int) { - return fileDescriptor_7ed31f79aa0bc330, []int{3} -} -func (m *MorseApplication) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MorseApplication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *MorseApplication) XXX_Merge(src proto.Message) { - xxx_messageInfo_MorseApplication.Merge(m, src) -} -func (m *MorseApplication) XXX_Size() int { - return m.Size() -} -func (m *MorseApplication) XXX_DiscardUnknown() { - xxx_messageInfo_MorseApplication.DiscardUnknown(m) -} - -var xxx_messageInfo_MorseApplication proto.InternalMessageInfo - -// MorseValidator is a subset of the Morse ProtoValidator type. It encapsulates the -// minimum information required to import Morse suppliers (aka "servicers" or "validators"). -// See: https://github.com/pokt-network/pocket-core/blob/staging/proto/x/pos/types.proto#L16 -type MorseValidator struct { - Address github_com_cometbft_cometbft_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,casttype=github.com/cometbft/cometbft/crypto.Address" json:"address" yaml:"address"` - PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"public_key" yaml:"public_key"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status"` - StakedTokens string `protobuf:"bytes,7,opt,name=StakedTokens,proto3" json:"tokens"` -} - -func (m *MorseValidator) Reset() { *m = MorseValidator{} } -func (m *MorseValidator) String() string { return proto.CompactTextString(m) } -func (*MorseValidator) ProtoMessage() {} -func (*MorseValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_7ed31f79aa0bc330, []int{4} -} -func (m *MorseValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MorseValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *MorseValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_MorseValidator.Merge(m, src) -} -func (m *MorseValidator) XXX_Size() int { - return m.Size() -} -func (m *MorseValidator) XXX_DiscardUnknown() { - xxx_messageInfo_MorseValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_MorseValidator proto.InternalMessageInfo - func init() { proto.RegisterType((*MorseAccountState)(nil), "poktroll.migration.MorseAccountState") proto.RegisterType((*MorseAccount)(nil), "poktroll.migration.MorseAccount") proto.RegisterType((*MorsePublicKey)(nil), "poktroll.migration.MorsePublicKey") - proto.RegisterType((*MorseApplication)(nil), "poktroll.migration.MorseApplication") - proto.RegisterType((*MorseValidator)(nil), "poktroll.migration.MorseValidator") } func init() { proto.RegisterFile("poktroll/migration/types.proto", fileDescriptor_7ed31f79aa0bc330) } var fileDescriptor_7ed31f79aa0bc330 = []byte{ - // 639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x69, 0x9b, 0xb4, 0x57, 0xb7, 0xa2, 0x16, 0x12, 0x6e, 0x41, 0xbe, 0xe8, 0xba, - 0x44, 0x42, 0xb5, 0xd5, 0x54, 0x1d, 0xc8, 0x16, 0xc3, 0x44, 0x41, 0xaa, 0xdc, 0x8a, 0x81, 0x25, - 0x9c, 0x9d, 0x6b, 0x30, 0x71, 0x72, 0x96, 0xef, 0x5c, 0xc8, 0x37, 0xe8, 0xc8, 0x84, 0x18, 0x2b, - 0x3e, 0x03, 0x5f, 0x80, 0xad, 0x62, 0xea, 0x46, 0x27, 0x0b, 0xa5, 0x0b, 0xca, 0x98, 0xb1, 0x13, - 0xb2, 0xcf, 0x71, 0xdc, 0x20, 0x24, 0x40, 0x62, 0xbb, 0xf7, 0x7f, 0xff, 0x7f, 0xf4, 0xde, 0xef, - 0x9c, 0x83, 0x7a, 0xc0, 0x7a, 0x22, 0x64, 0xbe, 0x6f, 0xf6, 0xbd, 0x6e, 0x48, 0x84, 0xc7, 0x06, - 0xa6, 0x18, 0x06, 0x94, 0x1b, 0x41, 0xc8, 0x04, 0x53, 0xd5, 0x69, 0xdf, 0xc8, 0xfb, 0x5b, 0x9b, - 0x2e, 0xe3, 0x7d, 0xc6, 0xdb, 0xa9, 0xc3, 0x94, 0x85, 0xb4, 0x6f, 0xe9, 0xb2, 0x32, 0x1d, 0xc2, - 0xa9, 0x79, 0xba, 0xeb, 0x50, 0x41, 0x76, 0x4d, 0x97, 0x79, 0x83, 0xac, 0x7f, 0xb7, 0xcb, 0xba, - 0x4c, 0xe6, 0x92, 0x93, 0x54, 0x71, 0x1b, 0x6e, 0x3c, 0x67, 0x21, 0xa7, 0x2d, 0xd7, 0x65, 0xd1, - 0x40, 0x1c, 0x09, 0x22, 0xa8, 0xfa, 0x14, 0x2e, 0x13, 0x59, 0x73, 0x0d, 0xd4, 0x16, 0xea, 0xab, - 0x8d, 0x9a, 0xf1, 0xeb, 0x30, 0x46, 0x31, 0x68, 0x29, 0xe3, 0x18, 0xe5, 0x29, 0x3b, 0x3f, 0xe1, - 0x0f, 0x65, 0xa8, 0x14, 0x8d, 0xea, 0x31, 0xac, 0x92, 0x4e, 0x27, 0xa4, 0x3c, 0xf9, 0x6d, 0x50, - 0x57, 0xac, 0xe6, 0x38, 0x46, 0x53, 0xe9, 0x26, 0x46, 0x0f, 0xbb, 0x9e, 0x78, 0x1d, 0x39, 0x86, - 0xcb, 0xfa, 0xa6, 0xcb, 0xfa, 0x54, 0x38, 0x27, 0xa2, 0x70, 0x08, 0x87, 0x81, 0x60, 0x46, 0x4b, - 0xda, 0xed, 0x69, 0x4e, 0x7d, 0x05, 0xab, 0x41, 0xe4, 0xb4, 0x7b, 0x74, 0xa8, 0x95, 0x6b, 0xa0, - 0xbe, 0xda, 0xc0, 0xbf, 0x9d, 0xf8, 0x30, 0x72, 0x7c, 0xcf, 0x3d, 0xa0, 0x43, 0x6b, 0x7b, 0x1c, - 0x23, 0x18, 0xa4, 0x65, 0x92, 0x9c, 0xc4, 0x68, 0x63, 0x48, 0xfa, 0x7e, 0x13, 0xcf, 0x34, 0x6c, - 0x57, 0x82, 0xc8, 0x39, 0xa0, 0x43, 0x75, 0x1f, 0x2e, 0x25, 0x34, 0xb9, 0xb6, 0x90, 0x12, 0xd9, - 0x34, 0x32, 0xfa, 0x09, 0x6f, 0x23, 0xe3, 0x6d, 0x3c, 0x66, 0xde, 0xc0, 0x5a, 0xbc, 0x88, 0x51, - 0xc9, 0x96, 0xee, 0xe6, 0xbd, 0xb3, 0x73, 0x54, 0xfa, 0x78, 0x8e, 0xc0, 0xd9, 0x27, 0x04, 0xbe, - 0x7e, 0xde, 0xa9, 0x66, 0x1c, 0xf0, 0x13, 0xb8, 0x7e, 0x7b, 0x1c, 0xb5, 0x01, 0x97, 0x4e, 0x89, - 0x1f, 0xd1, 0x74, 0x03, 0xc5, 0x7a, 0x70, 0x13, 0x23, 0x4d, 0xee, 0x6b, 0xd2, 0x4e, 0x63, 0x7f, - 0x7f, 0xf7, 0x91, 0x91, 0x9b, 0x6d, 0x69, 0xc5, 0xdf, 0xca, 0xf0, 0x8e, 0xc4, 0x1b, 0x04, 0xbe, - 0xe7, 0xa6, 0x6b, 0xaa, 0x27, 0xf3, 0x88, 0x9f, 0x15, 0x10, 0x4f, 0x62, 0xb4, 0x2e, 0xb7, 0xcc, - 0x04, 0xfc, 0xcf, 0xd0, 0x2d, 0x58, 0xa0, 0x97, 0x4d, 0xfd, 0x47, 0x4c, 0x57, 0x82, 0x7c, 0xe9, - 0x3d, 0x58, 0x79, 0x43, 0x3c, 0x9f, 0x76, 0xb4, 0x85, 0x1a, 0xa8, 0x2f, 0x5b, 0xf7, 0xc7, 0x31, - 0xca, 0x94, 0x49, 0x8c, 0xd6, 0x64, 0x56, 0xd6, 0xd8, 0xce, 0x1a, 0x49, 0x88, 0x0b, 0x22, 0x22, - 0xae, 0x2d, 0xd6, 0x40, 0x7d, 0x49, 0x86, 0xa4, 0x32, 0x0b, 0xc9, 0x1a, 0xdb, 0x59, 0x43, 0xdd, - 0x86, 0x6b, 0x5c, 0x90, 0x1e, 0xed, 0xb4, 0x05, 0xeb, 0xd1, 0x01, 0xd7, 0x2a, 0x35, 0x50, 0x5f, - 0xb1, 0x15, 0x29, 0x1e, 0xa7, 0x5a, 0x73, 0x39, 0xb9, 0xae, 0x1f, 0xe7, 0x08, 0xe0, 0x2f, 0xe5, - 0xec, 0x82, 0x5e, 0x10, 0xdf, 0xeb, 0x10, 0xc1, 0xc2, 0x84, 0x6b, 0xeb, 0x7f, 0x72, 0xcd, 0x0e, - 0x6a, 0x0b, 0xae, 0xe4, 0x17, 0xfd, 0x57, 0x58, 0x67, 0xdf, 0x12, 0x9e, 0xc3, 0x0a, 0x67, 0x58, - 0x73, 0x8a, 0x78, 0x8e, 0x22, 0x9c, 0x51, 0xcc, 0xa1, 0x19, 0x50, 0x39, 0x2a, 0xf0, 0xd1, 0xaa, - 0x09, 0x33, 0xe9, 0x94, 0x14, 0xed, 0x5b, 0xfd, 0xa6, 0x32, 0xfd, 0xdc, 0x13, 0x86, 0xd6, 0xe1, - 0xc5, 0x48, 0x07, 0x97, 0x23, 0x1d, 0x5c, 0x8d, 0x74, 0xf0, 0x7d, 0xa4, 0x83, 0xf7, 0xd7, 0x7a, - 0xe9, 0xf2, 0x5a, 0x2f, 0x5d, 0x5d, 0xeb, 0xa5, 0x97, 0x8d, 0x02, 0x9c, 0xe4, 0xcf, 0xba, 0x33, - 0xa0, 0xe2, 0x2d, 0x0b, 0x7b, 0x66, 0xfe, 0x30, 0xbe, 0x9b, 0x7f, 0x1a, 0x9d, 0x4a, 0xfa, 0x6c, - 0xed, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xca, 0x85, 0x60, 0x2e, 0x3d, 0x05, 0x00, 0x00, + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x7d, 0x2d, 0x6d, 0xd0, 0x35, 0x42, 0xaa, 0x85, 0x44, 0x5a, 0xa1, 0xbb, 0xc8, 0x2c, + 0x91, 0x50, 0xef, 0x14, 0xa3, 0x0c, 0x64, 0xab, 0x61, 0xa2, 0x42, 0xaa, 0x0c, 0x13, 0x4b, 0xb0, + 0x9d, 0x23, 0x58, 0xb1, 0xfd, 0x2c, 0xdf, 0xb9, 0xe0, 0x6f, 0xd0, 0x91, 0x09, 0x31, 0x56, 0x7c, + 0x06, 0x3e, 0x44, 0xc5, 0xd4, 0xb1, 0x93, 0x85, 0x92, 0x2d, 0x23, 0x63, 0x26, 0x64, 0x5f, 0x62, + 0x0c, 0x88, 0xed, 0xfd, 0xdf, 0xfb, 0xff, 0x4f, 0xef, 0x7e, 0x7a, 0x98, 0xa4, 0x30, 0x57, 0x19, + 0x44, 0x11, 0x8f, 0xc3, 0x59, 0xe6, 0xa9, 0x10, 0x12, 0xae, 0x8a, 0x54, 0x48, 0x96, 0x66, 0xa0, + 0xc0, 0x34, 0xb7, 0x73, 0xd6, 0xcc, 0x8f, 0x8f, 0x02, 0x90, 0x31, 0xc8, 0x49, 0xed, 0xe0, 0x5a, + 0x68, 0xfb, 0x31, 0xd1, 0x8a, 0xfb, 0x9e, 0x14, 0xfc, 0x62, 0xe8, 0x0b, 0xe5, 0x0d, 0x79, 0x00, + 0x61, 0xb2, 0x99, 0xdf, 0x9f, 0xc1, 0x0c, 0x74, 0xae, 0xaa, 0x74, 0xd7, 0x9a, 0xe0, 0xc3, 0x97, + 0x90, 0x49, 0x71, 0x1a, 0x04, 0x90, 0x27, 0xea, 0x95, 0xf2, 0x94, 0x30, 0x5f, 0xe0, 0xbb, 0x9e, + 0xd6, 0xb2, 0x87, 0xfa, 0xbb, 0x83, 0x03, 0xbb, 0xcf, 0xfe, 0x5d, 0x86, 0xb5, 0x83, 0x4e, 0x77, + 0x55, 0xd2, 0x26, 0xe5, 0x36, 0x95, 0xf5, 0x79, 0x07, 0x77, 0xdb, 0x46, 0xf3, 0x35, 0xee, 0x78, + 0xd3, 0x69, 0x26, 0x64, 0xf5, 0x36, 0x1a, 0x74, 0x9d, 0xf1, 0xaa, 0xa4, 0xdb, 0xd6, 0xba, 0xa4, + 0x8f, 0x67, 0xa1, 0x7a, 0x9f, 0xfb, 0x2c, 0x80, 0x98, 0x07, 0x10, 0x0b, 0xe5, 0xbf, 0x53, 0xad, + 0x22, 0x2b, 0x52, 0x05, 0xec, 0x54, 0xdb, 0xdd, 0x6d, 0xce, 0x7c, 0x8b, 0x3b, 0x69, 0xee, 0x4f, + 0xe6, 0xa2, 0xe8, 0xed, 0xf4, 0xd1, 0xe0, 0xc0, 0xb6, 0xfe, 0xbb, 0xf1, 0x79, 0xee, 0x47, 0x61, + 0x70, 0x26, 0x0a, 0xe7, 0xd1, 0xaa, 0xa4, 0x38, 0xad, 0x65, 0x95, 0xfc, 0x59, 0xd2, 0xc3, 0xc2, + 0x8b, 0xa3, 0xb1, 0xf5, 0xbb, 0x67, 0xb9, 0xfb, 0x69, 0xee, 0x9f, 0x89, 0xc2, 0x1c, 0xe1, 0xbd, + 0x8a, 0xa6, 0xec, 0xed, 0xd6, 0x44, 0x8e, 0xd8, 0x86, 0x7e, 0xc5, 0x9b, 0x6d, 0x78, 0xb3, 0x67, + 0x10, 0x26, 0xce, 0x9d, 0xeb, 0x92, 0x1a, 0xae, 0x76, 0x8f, 0x1f, 0x5c, 0x5e, 0x51, 0xe3, 0xcb, + 0x15, 0x45, 0x97, 0x5f, 0x29, 0xfa, 0xfe, 0xed, 0xa4, 0xb3, 0xe1, 0x60, 0x3d, 0xc7, 0xf7, 0xfe, + 0x5c, 0xc7, 0xb4, 0xf1, 0xde, 0x85, 0x17, 0xe5, 0xa2, 0xfe, 0x41, 0xd7, 0x79, 0xb8, 0x2e, 0x69, + 0x4f, 0xff, 0x97, 0x8b, 0xa9, 0x3d, 0x1a, 0x0d, 0x9f, 0xb2, 0xc6, 0xec, 0x6a, 0xab, 0x73, 0x7e, + 0xbd, 0x20, 0xe8, 0x66, 0x41, 0xd0, 0xed, 0x82, 0xa0, 0x1f, 0x0b, 0x82, 0x3e, 0x2d, 0x89, 0x71, + 0xb3, 0x24, 0xc6, 0xed, 0x92, 0x18, 0x6f, 0xec, 0x16, 0xcb, 0x0a, 0xc7, 0x49, 0x22, 0xd4, 0x07, + 0xc8, 0xe6, 0xbc, 0x39, 0xbd, 0x8f, 0x7f, 0x1f, 0x9f, 0xbf, 0x5f, 0x1f, 0xc6, 0x93, 0x5f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xd9, 0x80, 0x8f, 0x0e, 0x9f, 0x02, 0x00, 0x00, } -func (this *MorseApplication) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MorseApplication) - if !ok { - that2, ok := that.(MorseApplication) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Address, that1.Address) { - return false - } - if !bytes.Equal(this.PublicKey, that1.PublicKey) { - return false - } - if this.Jailed != that1.Jailed { - return false - } - if this.Status != that1.Status { - return false - } - if this.StakedTokens != that1.StakedTokens { - return false - } - return true -} -func (this *MorseValidator) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MorseValidator) - if !ok { - that2, ok := that.(MorseValidator) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Address, that1.Address) { - return false - } - if !bytes.Equal(this.PublicKey, that1.PublicKey) { - return false - } - if this.Jailed != that1.Jailed { - return false - } - if this.Status != that1.Status { - return false - } - if this.StakedTokens != that1.StakedTokens { - return false - } - return true -} func (m *MorseAccountState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -482,124 +315,6 @@ func (m *MorsePublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MorseApplication) 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 *MorseApplication) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MorseApplication) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StakedTokens) > 0 { - i -= len(m.StakedTokens) - copy(dAtA[i:], m.StakedTokens) - i = encodeVarintTypes(dAtA, i, uint64(len(m.StakedTokens))) - i-- - dAtA[i] = 0x32 - } - if m.Status != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.Jailed { - i-- - if m.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MorseValidator) 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 *MorseValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MorseValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.StakedTokens) > 0 { - i -= len(m.StakedTokens) - copy(dAtA[i:], m.StakedTokens) - i = encodeVarintTypes(dAtA, i, uint64(len(m.StakedTokens))) - i-- - dAtA[i] = 0x3a - } - if m.Status != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.Jailed { - i-- - if m.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.PublicKey) > 0 { - i -= len(m.PublicKey) - copy(dAtA[i:], m.PublicKey) - i = encodeVarintTypes(dAtA, i, uint64(len(m.PublicKey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -662,60 +377,6 @@ func (m *MorsePublicKey) Size() (n int) { return n } -func (m *MorseApplication) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Jailed { - n += 2 - } - if m.Status != 0 { - n += 1 + sovTypes(uint64(m.Status)) - } - l = len(m.StakedTokens) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - -func (m *MorseValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Jailed { - n += 2 - } - if m.Status != 0 { - n += 1 + sovTypes(uint64(m.Status)) - } - l = len(m.StakedTokens) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1044,384 +705,6 @@ func (m *MorsePublicKey) Unmarshal(dAtA []byte) error { } return nil } -func (m *MorseApplication) 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 ErrIntOverflowTypes - } - 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: MorseApplication: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MorseApplication: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) - if m.Address == nil { - m.Address = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Jailed = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StakedTokens = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MorseValidator) 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 ErrIntOverflowTypes - } - 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: MorseValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MorseValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) - if m.Address == nil { - m.Address = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Jailed = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StakedTokens = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index 5952eb94b..30030a818 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -19,84 +19,87 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -// SubmitProof is the server handler to submit and store a proof onchain. -// A proof that's stored onchain is what leads to rewards (i.e. inflation) -// downstream, making this a critical part of the protocol. +// SubmitProof is the server message handler that stores a valid +// proof onchain, enabling downstream reward distribution. // -// Note that the validation of the proof is done in `EnsureValidProof`. However, -// preliminary checks are done in the handler to prevent sybil or DoS attacks on -// full nodes because storing and validating proofs is expensive. +// IMPORTANT: Full proof validation occurs in EnsureValidProofSignaturesAndClosestPath. +// This handler performs preliminary validation to prevent sybil/DoS attacks. // -// We are playing a balance of security and efficiency here, where enough validation -// is done on proof submission, and exhaustive validation is done during session -// settlement. +// There is a security & performance balance and tradeoff between the handler and end blocker: +// - Basic validation on submission (here) +// - Exhaustive validation in endblocker (EnsureValidProofSignaturesAndClosestPath) // -// The entity sending the SubmitProof messages does not necessarily need -// to correspond to the supplier signing the proof. For example, a single entity -// could (theoretically) batch multiple proofs (signed by the corresponding supplier) -// into one transaction to save on transaction fees. +// Note: Proof submitter may differ from supplier signer, allowing batched submissions +// to optimize transaction fees. func (k msgServer) SubmitProof( ctx context.Context, msg *types.MsgSubmitProof, ) (_ *types.MsgSubmitProofResponse, err error) { + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + // Declare claim to reference in telemetry. var ( - claim = new(types.Claim) + claim *types.Claim isExistingProof bool numRelays uint64 numClaimComputeUnits uint64 + sessionHeader *sessiontypes.SessionHeader ) logger := k.Logger().With("method", "SubmitProof") - sdkCtx := cosmostypes.UnwrapSDKContext(ctx) logger.Info("About to start submitting proof") // Basic validation of the SubmitProof message. if err = msg.ValidateBasic(); err != nil { + logger.Error("failed to validate the submitProof message") return nil, status.Error(codes.InvalidArgument, err.Error()) } - logger.Info("validated the submitProof message") - // Compare msg session header w/ onchain session header. - session, err := k.queryAndValidateSessionHeader(ctx, msg.GetSessionHeader(), msg.GetSupplierOperatorAddress()) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } + sessionHeader = msg.GetSessionHeader() + supplierOperatorAddress := msg.GetSupplierOperatorAddress() - // Defer telemetry calls so that they reference the final values the relevant variables. - defer k.finalizeSubmitProofTelemetry(session, msg, isExistingProof, numRelays, numClaimComputeUnits, err) + logger = logger.With( + "session_id", sessionHeader.GetSessionId(), + "application_address", sessionHeader.GetApplicationAddress(), + "service_id", sessionHeader.GetServiceId(), + "session_end_height", sessionHeader.GetSessionEndBlockHeight(), + "supplier_operator_address", supplierOperatorAddress, + ) + logger.Info("validated the submitProof message") - if err = k.deductProofSubmissionFee(ctx, msg.GetSupplierOperatorAddress()); err != nil { - logger.Error(fmt.Sprintf("failed to deduct proof submission fee: %v", err)) + // Defer telemetry calls so that they reference the final values the relevant variables. + defer k.finalizeSubmitProofTelemetry(sessionHeader, msg, isExistingProof, numRelays, numClaimComputeUnits, err) + + // Construct the proof from the message. + proof := newProofFromMsg(msg) + + // EnsureWellFormedProof ensures proper proof formation by verifying: + // - Proof structure + // - Associated claim + // - Relay session headers + // - Submission timing within required window + if err = k.EnsureWellFormedProof(ctx, proof); err != nil { + logger.Error(fmt.Sprintf("failed to ensure well-formed proof: %v", err)) return nil, status.Error(codes.FailedPrecondition, err.Error()) } - - // Construct the proof - proof := types.Proof{ - SupplierOperatorAddress: msg.GetSupplierOperatorAddress(), - SessionHeader: session.GetHeader(), - ClosestMerkleProof: msg.GetProof(), + logger.Info("ensured the proof is well-formed") + + // Retrieve the claim associated with the proof. + // The claim should ALWAYS exist since the proof validation in EnsureWellFormedProof + // retrieves and validates the associated claim. + foundClaim, claimFound := k.GetClaim(ctx, sessionHeader.GetSessionId(), supplierOperatorAddress) + if !claimFound { + logger.Error("failed to find the claim associated with the proof") + return nil, status.Error(codes.FailedPrecondition, types.ErrProofClaimNotFound.Error()) } - // Helpers for logging the same metadata throughout this function calls - logger = logger.With( - "session_id", proof.SessionHeader.SessionId, - "session_end_height", proof.SessionHeader.SessionEndBlockHeight, - "supplier_operator_address", proof.SupplierOperatorAddress) + claim = &foundClaim - // Validate proof message commit height is within the respective session's - // proof submission window using the onchain session header. - if err = k.validateProofWindow(ctx, proof.SessionHeader, proof.SupplierOperatorAddress); err != nil { + if err = k.deductProofSubmissionFee(ctx, supplierOperatorAddress); err != nil { + logger.Error(fmt.Sprintf("failed to deduct proof submission fee: %v", err)) return nil, status.Error(codes.FailedPrecondition, err.Error()) } - // Retrieve the corresponding claim for the proof submitted so it can be - // used in the proof validation below. - claim, err = k.queryAndValidateClaimForProof(ctx, proof.SessionHeader, proof.SupplierOperatorAddress) - if err != nil { - return nil, status.Error(codes.Internal, types.ErrProofClaimNotFound.Wrap(err.Error()).Error()) - } - // Check if a proof is required for the claim. proofRequirement, err := k.ProofRequirementForClaim(ctx, claim) if err != nil { @@ -120,7 +123,7 @@ func (k msgServer) SubmitProof( } // Get the service ID relayMiningDifficulty to calculate the claimed uPOKT. - serviceId := session.GetHeader().GetServiceId() + serviceId := sessionHeader.GetServiceId() sharedParams := k.sharedKeeper.GetParams(ctx) relayMiningDifficulty, _ := k.serviceKeeper.GetRelayMiningDifficulty(ctx, serviceId) @@ -131,7 +134,7 @@ func (k msgServer) SubmitProof( _, isExistingProof = k.GetProof(ctx, proof.SessionHeader.SessionId, proof.SupplierOperatorAddress) // Upsert the proof - k.UpsertProof(ctx, proof) + k.UpsertProof(ctx, *proof) logger.Info("successfully upserted the proof") // Emit the appropriate event based on whether the claim was created or updated. @@ -141,7 +144,7 @@ func (k msgServer) SubmitProof( proofUpsertEvent = proto.Message( &types.EventProofUpdated{ Claim: claim, - Proof: &proof, + Proof: proof, NumRelays: numRelays, NumClaimedComputeUnits: numClaimComputeUnits, NumEstimatedComputeUnits: numEstimatedComputUnits, @@ -152,7 +155,7 @@ func (k msgServer) SubmitProof( proofUpsertEvent = proto.Message( &types.EventProofSubmitted{ Claim: claim, - Proof: &proof, + Proof: proof, NumRelays: numRelays, NumClaimedComputeUnits: numClaimComputeUnits, NumEstimatedComputeUnits: numEstimatedComputUnits, @@ -160,6 +163,7 @@ func (k msgServer) SubmitProof( }, ) } + if err = sdkCtx.EventManager().EmitTypedEvent(proofUpsertEvent); err != nil { return nil, status.Error( codes.Internal, @@ -172,7 +176,7 @@ func (k msgServer) SubmitProof( } return &types.MsgSubmitProofResponse{ - Proof: &proof, + Proof: proof, }, nil } @@ -322,10 +326,17 @@ func (k Keeper) getProofRequirementSeedBlockHash( // finalizeSubmitProofTelemetry finalizes telemetry updates for SubmitProof, incrementing counters as needed. // Meant to run deferred. -func (k msgServer) finalizeSubmitProofTelemetry(session *sessiontypes.Session, msg *types.MsgSubmitProof, isExistingProof bool, numRelays, numClaimComputeUnits uint64, err error) { +func (k msgServer) finalizeSubmitProofTelemetry( + sessionHeader *sessiontypes.SessionHeader, + msg *types.MsgSubmitProof, + isExistingProof bool, + numRelays, + numClaimComputeUnits uint64, + err error, +) { if !isExistingProof { - serviceId := session.Header.ServiceId - applicationAddress := session.Header.ApplicationAddress + serviceId := sessionHeader.ServiceId + applicationAddress := sessionHeader.ApplicationAddress supplierOperatorAddress := msg.GetSupplierOperatorAddress() claimProofStage := types.ClaimProofStage_PROVEN.String() @@ -337,7 +348,11 @@ func (k msgServer) finalizeSubmitProofTelemetry(session *sessiontypes.Session, m // finalizeProofRequirementTelemetry finalizes telemetry updates for proof requirements. // Meant to run deferred. -func (k Keeper) finalizeProofRequirementTelemetry(requirementReason types.ProofRequirementReason, claim *types.Claim, err error) { +func (k Keeper) finalizeProofRequirementTelemetry( + requirementReason types.ProofRequirementReason, + claim *types.Claim, + err error, +) { telemetry.ProofRequirementCounter( requirementReason.String(), claim.SessionHeader.ServiceId, @@ -346,3 +361,12 @@ func (k Keeper) finalizeProofRequirementTelemetry(requirementReason types.ProofR err, ) } + +// newProofFromMsg creates a new proof from a MsgSubmitProof message. +func newProofFromMsg(msg *types.MsgSubmitProof) *types.Proof { + return &types.Proof{ + SupplierOperatorAddress: msg.GetSupplierOperatorAddress(), + SessionHeader: msg.GetSessionHeader(), + ClosestMerkleProof: msg.GetProof(), + } +} diff --git a/x/proof/keeper/msg_server_submit_proof_test.go b/x/proof/keeper/msg_server_submit_proof_test.go index 191fdff5d..dbea95aa7 100644 --- a/x/proof/keeper/msg_server_submit_proof_test.go +++ b/x/proof/keeper/msg_server_submit_proof_test.go @@ -630,7 +630,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, msgSubmitProofToExpectedErrorFn: func(msgSubmitProof *prooftypes.MsgSubmitProof) error { return status.Error( - codes.InvalidArgument, + codes.FailedPrecondition, prooftypes.ErrProofInvalidSessionId.Wrapf( "session ID does not match onchain session ID; expected %q, got %q", validSessionHeader.GetSessionId(), @@ -652,7 +652,7 @@ func TestMsgServer_SubmitProof_Error(t *testing.T) { }, msgSubmitProofToExpectedErrorFn: func(msgSubmitProof *prooftypes.MsgSubmitProof) error { return status.Error( - codes.InvalidArgument, + codes.FailedPrecondition, prooftypes.ErrProofNotFound.Wrapf( "supplier operator address %q not found in session ID %q", wrongSupplierOperatorAddr, diff --git a/x/proof/keeper/proof.go b/x/proof/keeper/proof.go index 915803199..9a32ddd83 100644 --- a/x/proof/keeper/proof.go +++ b/x/proof/keeper/proof.go @@ -91,11 +91,16 @@ func (k Keeper) RemoveProof(ctx context.Context, sessionId, supplierOperatorAddr ) } -// GetAllProofs returns all proof -func (k Keeper) GetAllProofs(ctx context.Context) (proofs []types.Proof) { +// GetAllProofsIterator returns an iterator for all proofs in the store +func (k Keeper) GetAllProofsIterator(ctx context.Context) storetypes.Iterator { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - iterator := storetypes.KVStorePrefixIterator(primaryStore, []byte{}) + return storetypes.KVStorePrefixIterator(primaryStore, []byte{}) +} + +// GetAllProofs returns all proofs in the store +func (k Keeper) GetAllProofs(ctx context.Context) (proofs []types.Proof) { + iterator := k.GetAllProofsIterator(ctx) defer iterator.Close() diff --git a/x/proof/keeper/proof_validation.go b/x/proof/keeper/proof_validation.go index bb45be1aa..bf55d2e3c 100644 --- a/x/proof/keeper/proof_validation.go +++ b/x/proof/keeper/proof_validation.go @@ -31,6 +31,7 @@ package keeper import ( "bytes" "context" + "fmt" cosmostelemetry "github.com/cosmos/cosmos-sdk/telemetry" "github.com/pokt-network/smt" @@ -42,39 +43,31 @@ import ( sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) -// EnsureValidProof validates the proof submitted by the supplier is correct with -// respect to an onchain claim. +// EnsureWellFormedProof validates a supplier's proof for: +// 1. Valid session header +// 2. Submission height within window +// 3. Matching relay request/response headers +// 4. Relay Mining difficulty above reward threshold // -// This function should be called during session settlement (i.e. EndBlocker) -// rather than during proof submission (i.e. SubmitProof) because: -// 1. RPC requests should be quick, lightweight and only do basic validation -// 2. Validators are the ones responsible for the heavy processing & validation during state transitions -// 3. This creates an opportunity to slash suppliers who submit false proofs, whereas -// they can keep retrying if it takes place in the SubmitProof handler. +// EnsureWellFormedProof does not validate computationally expensive operations like: +// 1. Proof relay signatures +// 2. ClosestMerkleProof // -// Note that some of the validation here is redundant with the validation done in -// SubmitProof (in the handler). The reason for this is because were are trying -// to find a balance between preventing sybil or DoS attacks on full nodes -// during proof submission, but being completely exhaustive in all the checks done here. -func (k Keeper) EnsureValidProof( - ctx context.Context, - proof *types.Proof, -) error { - // Telemetry: measure execution time. - defer cosmostelemetry.MeasureSince(cosmostelemetry.Now(), telemetry.MetricNameKeys("proof", "validation")...) - - logger := k.Logger().With("method", "ValidateProof") +// Additional developer context as of #1031: +// - This function is expected to be called from the SubmitProof messages handler +// - Computationally expensive operations are left to the block's EndBlocker +// +// NOTE: Full validation requires passing both: +// 1. EnsureWellFormedProof (this function) +// 2. EnsureValidProofSignaturesAndClosestPath +func (k Keeper) EnsureWellFormedProof(ctx context.Context, proof *types.Proof) error { + logger := k.Logger().With("method", "EnsureWellFormedProof") - // Retrieve the supplier operator's public key. supplierOperatorAddr := proof.SupplierOperatorAddress - supplierOperatorPubKey, err := k.accountQuerier.GetPubKeyFromAddress(ctx, supplierOperatorAddr) - if err != nil { - return err - } // Validate the session header. var onChainSession *sessiontypes.Session - onChainSession, err = k.queryAndValidateSessionHeader(ctx, proof.SessionHeader, supplierOperatorAddr) + onChainSession, err := k.queryAndValidateSessionHeader(ctx, proof.SessionHeader, supplierOperatorAddr) if err != nil { return err } @@ -85,53 +78,63 @@ func (k Keeper) EnsureValidProof( // header which can be derived from known values (e.g. session end height). sessionHeader := onChainSession.GetHeader() + logger = logger.With( + "session_id", sessionHeader.GetSessionId(), + "application_address", sessionHeader.GetApplicationAddress(), + "service_id", sessionHeader.GetServiceId(), + "session_end_height", sessionHeader.GetSessionEndBlockHeight(), + "supplier_operator_address", supplierOperatorAddr, + ) + // Validate proof message commit height is within the respective session's // proof submission window using the onchain session header. if err = k.validateProofWindow(ctx, sessionHeader, supplierOperatorAddr); err != nil { + logger.Error(fmt.Sprintf("failed to validate proof window due to error: %v", err)) return err } if len(proof.ClosestMerkleProof) == 0 { - return types.ErrProofInvalidProof.Wrap("proof cannot be empty") + logger.Error("closest merkle proof cannot be empty") + return types.ErrProofInvalidProof.Wrap("closest merkle proof cannot be empty") } - // Unmarshal the closest merkle proof from the message. + // Unmarshal the sparse compact closest merkle proof from the message. sparseCompactMerkleClosestProof := &smt.SparseCompactMerkleClosestProof{} if err = sparseCompactMerkleClosestProof.Unmarshal(proof.ClosestMerkleProof); err != nil { - return types.ErrProofInvalidProof.Wrapf( - "failed to unmarshal closest merkle proof: %s", - err, - ) + logger.Error(fmt.Sprintf("failed to unmarshal sparse compact merkle closest proof due to error: %v", err)) + return types.ErrProofInvalidProof.Wrapf("failed to unmarshal sparse compact merkle closest proof: %s", err) } // SparseCompactMerkeClosestProof does not implement GetValueHash, so we need to decompact it. - sparseMerkleClosestProof, err := smt.DecompactClosestProof(sparseCompactMerkleClosestProof, &protocol.SmtSpec) + sparseMerkleClosestProof, err := smt.DecompactClosestProof(sparseCompactMerkleClosestProof, protocol.NewSMTSpec()) if err != nil { - return types.ErrProofInvalidProof.Wrapf( - "failed to decompact closest merkle proof: %s", - err, - ) + logger.Error(fmt.Sprintf("failed to decompact sparse merkle closest proof due to error: %v", err)) + return types.ErrProofInvalidProof.Wrapf("failed to decompact sparse erkle closest proof: %s", err) } // Get the relay request and response from the proof.GetClosestMerkleProof. - relayBz := sparseMerkleClosestProof.GetValueHash(&protocol.SmtSpec) + relayBz := sparseMerkleClosestProof.GetValueHash(protocol.NewSMTSpec()) relay := &servicetypes.Relay{} if err = k.cdc.Unmarshal(relayBz, relay); err != nil { - return types.ErrProofInvalidRelay.Wrapf( - "failed to unmarshal relay: %s", - err, - ) + logger.Error(fmt.Sprintf("failed to unmarshal relay due to error: %v", err)) + return types.ErrProofInvalidRelay.Wrapf("failed to unmarshal relay: %s", err) } // Basic validation of the relay request. relayReq := relay.GetReq() if err = relayReq.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("failed to validate relay request due to error: %v", err)) return err } logger.Debug("successfully validated relay request") // Make sure that the supplier operator address in the proof matches the one in the relay request. if supplierOperatorAddr != relayReq.Meta.SupplierOperatorAddress { + logger.Error(fmt.Sprintf( + "supplier operator address mismatch; proof: %s, relay request: %s", + supplierOperatorAddr, + relayReq.Meta.SupplierOperatorAddress, + )) return types.ErrProofSupplierMismatch.Wrapf("supplier type mismatch") } logger.Debug("the proof supplier operator address matches the relay request supplier operator address") @@ -139,34 +142,25 @@ func (k Keeper) EnsureValidProof( // Basic validation of the relay response. relayRes := relay.GetRes() if err = relayRes.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("failed to validate relay response due to error: %v", err)) return err } logger.Debug("successfully validated relay response") // Verify that the relay request session header matches the proof session header. if err = compareSessionHeaders(sessionHeader, relayReq.Meta.GetSessionHeader()); err != nil { + logger.Error(fmt.Sprintf("relay request and proof session header mismatch: %v", err)) return err } logger.Debug("successfully compared relay request session header") // Verify that the relay response session header matches the proof session header. if err = compareSessionHeaders(sessionHeader, relayRes.Meta.GetSessionHeader()); err != nil { + logger.Error(fmt.Sprintf("relay response and proof session header mismatch: %v", err)) return err } logger.Debug("successfully compared relay response session header") - // Verify the relay request's signature. - if err = k.ringClient.VerifyRelayRequestSignature(ctx, relayReq); err != nil { - return err - } - logger.Debug("successfully verified relay request signature") - - // Verify the relay response's signature. - if err = relayRes.VerifySupplierOperatorSignature(supplierOperatorPubKey); err != nil { - return err - } - logger.Debug("successfully verified relay response signature") - // Get the service's relay mining difficulty. serviceRelayDifficulty, _ := k.serviceKeeper.GetRelayMiningDifficulty(ctx, sessionHeader.GetServiceId()) @@ -175,10 +169,96 @@ func (k Keeper) EnsureValidProof( relayBz, serviceRelayDifficulty.GetTargetHash(), ); err != nil { + logger.Error(fmt.Sprintf("failed to validate relay difficulty due to error: %v", err)) return types.ErrProofInvalidRelayDifficulty.Wrapf("failed to validate relay difficulty for service %s due to: %v", sessionHeader.ServiceId, err) } logger.Debug("successfully validated relay mining difficulty") + // Retrieve the corresponding claim for the proof submitted + if err := k.validateSessionClaim(ctx, sessionHeader, supplierOperatorAddr); err != nil { + return err + } + logger.Debug("successfully retrieved and validated claim") + + return nil +} + +// EnsureValidProofSignaturesAndClosestPath validates: +// 1. Proof signatures from the supplier +// 2. Valid relay request/response signatures from the application/supplier respectively +// 3. Closest path validation against onchain claim +// +// Execution requirements: +// 1. Must run in the EndBlocker of the proof submission height +// 2. Cannot run during SubmitProof due to computational cost +// +// NOTE: Full validation requires passing both: +// 1. EnsureWellFormedProof +// 2. EnsureValidProofSignaturesAndClosestPath (this function) +func (k Keeper) EnsureValidProofSignaturesAndClosestPath( + ctx context.Context, + claim *types.Claim, + proof *types.Proof, +) error { + // Telemetry: measure execution time. + defer cosmostelemetry.MeasureSince(cosmostelemetry.Now(), telemetry.MetricNameKeys("proof", "validation")...) + + sessionHeader := proof.GetSessionHeader() + supplierOperatorAddr := proof.SupplierOperatorAddress + + logger := k.Logger().With( + "method", "EnsureValidProofSignaturesAndClosestPath", + "session_id", sessionHeader.GetSessionId(), + "application_address", sessionHeader.GetApplicationAddress(), + "service_id", sessionHeader.GetServiceId(), + "session_end_height", sessionHeader.GetSessionEndBlockHeight(), + "supplier_operator_address", supplierOperatorAddr, + ) + + // Retrieve the supplier operator's public key. + supplierOperatorPubKey, err := k.accountQuerier.GetPubKeyFromAddress(ctx, supplierOperatorAddr) + if err != nil { + logger.Error(fmt.Sprintf("failed to retrieve supplier operator public key due to error: %v", err)) + return err + } + + // Unmarshal the sparse compact merkle closest proof from the message. + sparseCompactMerkleClosestProof := &smt.SparseCompactMerkleClosestProof{} + if err = sparseCompactMerkleClosestProof.Unmarshal(proof.ClosestMerkleProof); err != nil { + logger.Error(fmt.Sprintf("failed to unmarshal sparse compact merkle closest proof due to error: %v", err)) + return types.ErrProofInvalidProof.Wrapf("failed to unmarshal sparse compact merkle closest proof: %s", err) + } + + // SparseCompactMerkeClosestProof was intentionally compacted to reduce its onchain state size + // so it must be decompacted rather than just retrieving the value via GetValueHash (not implemented). + sparseMerkleClosestProof, err := smt.DecompactClosestProof(sparseCompactMerkleClosestProof, protocol.NewSMTSpec()) + if err != nil { + logger.Error(fmt.Sprintf("failed to decompact sparse merkle closest proof due to error: %v", err)) + return types.ErrProofInvalidProof.Wrapf("failed to decompact sparse merkle closest proof: %s", err) + } + + // Get the relay request and response from the proof.GetClosestMerkleProof. + relayBz := sparseMerkleClosestProof.GetValueHash(protocol.NewSMTSpec()) + relay := &servicetypes.Relay{} + if err = k.cdc.Unmarshal(relayBz, relay); err != nil { + logger.Error(fmt.Sprintf("failed to unmarshal relay due to error: %v", err)) + return types.ErrProofInvalidRelay.Wrapf("failed to unmarshal relay: %s", err) + } + + // Verify the relay request's signature. + if err = k.ringClient.VerifyRelayRequestSignature(ctx, relay.GetReq()); err != nil { + logger.Error(fmt.Sprintf("failed to verify relay request signature due to error: %v", err)) + return err + } + logger.Debug("successfully verified relay request signature") + + // Verify the relay response's signature. + if err = relay.GetRes().VerifySupplierOperatorSignature(supplierOperatorPubKey); err != nil { + logger.Error(fmt.Sprintf("failed to verify relay response signature due to error: %v", err)) + return err + } + logger.Debug("successfully verified relay response signature") + // Validate that path the proof is submitted for matches the expected one // based on the pseudo-random onchain data associated with the header. if err = k.validateClosestPath( @@ -187,24 +267,17 @@ func (k Keeper) EnsureValidProof( sessionHeader, supplierOperatorAddr, ); err != nil { + logger.Error(fmt.Sprintf("failed to validate closest path due to error: %v", err)) return err } logger.Debug("successfully validated proof path") - // Retrieve the corresponding claim for the proof submitted so it can be - // used in the proof validation below. - claim, err := k.queryAndValidateClaimForProof(ctx, sessionHeader, supplierOperatorAddr) - if err != nil { - return err - } - - logger.Debug("successfully retrieved and validated claim") - - // Verify the proof's closest merkle proof. + // Verify the proof's sparse merkle closest proof. if err = verifyClosestProof(sparseMerkleClosestProof, claim.GetRootHash()); err != nil { + logger.Error(fmt.Sprintf("failed to verify sparse merkle closest proof due to error: %v", err)) return err } - logger.Debug("successfully verified closest merkle proof") + logger.Debug("successfully verified sparse merkle closest proof") return nil } @@ -258,21 +331,19 @@ func (k Keeper) validateClosestPath( return nil } -// queryAndValidateClaimForProof ensures that a claim corresponding to the given -// proof's session exists & has a matching supplier operator address and session header, -// it then returns the corresponding claim if the validation is successful. -func (k Keeper) queryAndValidateClaimForProof( +// validateSessionClaim ensures that the given session header and supplierOperatorAddress +// have a corresponding claim. +func (k Keeper) validateSessionClaim( ctx context.Context, sessionHeader *sessiontypes.SessionHeader, supplierOperatorAddr string, -) (*types.Claim, error) { +) error { sessionId := sessionHeader.SessionId - // NB: no need to assert the testSessionId or supplier operator address as it is retrieved - // by respective values of the given proof. I.e., if the claim exists, then these - // values are guaranteed to match. + + // Retrieve the claim corresponding to the session ID and supplier operator address. foundClaim, found := k.GetClaim(ctx, sessionId, supplierOperatorAddr) if !found { - return nil, types.ErrProofClaimNotFound.Wrapf( + return types.ErrProofClaimNotFound.Wrapf( "no claim found for session ID %q and supplier %q", sessionId, supplierOperatorAddr, @@ -280,45 +351,44 @@ func (k Keeper) queryAndValidateClaimForProof( } claimSessionHeader := foundClaim.GetSessionHeader() - proofSessionHeader := sessionHeader // Ensure session start heights match. - if claimSessionHeader.GetSessionStartBlockHeight() != proofSessionHeader.GetSessionStartBlockHeight() { - return nil, types.ErrProofInvalidSessionStartHeight.Wrapf( + if claimSessionHeader.GetSessionStartBlockHeight() != sessionHeader.GetSessionStartBlockHeight() { + return types.ErrProofInvalidSessionStartHeight.Wrapf( "claim session start height %d does not match proof session start height %d", claimSessionHeader.GetSessionStartBlockHeight(), - proofSessionHeader.GetSessionStartBlockHeight(), + sessionHeader.GetSessionStartBlockHeight(), ) } // Ensure session end heights match. - if claimSessionHeader.GetSessionEndBlockHeight() != proofSessionHeader.GetSessionEndBlockHeight() { - return nil, types.ErrProofInvalidSessionEndHeight.Wrapf( + if claimSessionHeader.GetSessionEndBlockHeight() != sessionHeader.GetSessionEndBlockHeight() { + return types.ErrProofInvalidSessionEndHeight.Wrapf( "claim session end height %d does not match proof session end height %d", claimSessionHeader.GetSessionEndBlockHeight(), - proofSessionHeader.GetSessionEndBlockHeight(), + sessionHeader.GetSessionEndBlockHeight(), ) } // Ensure application addresses match. - if claimSessionHeader.GetApplicationAddress() != proofSessionHeader.GetApplicationAddress() { - return nil, types.ErrProofInvalidAddress.Wrapf( + if claimSessionHeader.GetApplicationAddress() != sessionHeader.GetApplicationAddress() { + return types.ErrProofInvalidAddress.Wrapf( "claim application address %q does not match proof application address %q", claimSessionHeader.GetApplicationAddress(), - proofSessionHeader.GetApplicationAddress(), + sessionHeader.GetApplicationAddress(), ) } // Ensure service IDs match. - if claimSessionHeader.GetServiceId() != proofSessionHeader.GetServiceId() { - return nil, types.ErrProofInvalidService.Wrapf( + if claimSessionHeader.GetServiceId() != sessionHeader.GetServiceId() { + return types.ErrProofInvalidService.Wrapf( "claim service ID %q does not match proof service ID %q", claimSessionHeader.GetServiceId(), - proofSessionHeader.GetServiceId(), + sessionHeader.GetServiceId(), ) } - return &foundClaim, nil + return nil } // compareSessionHeaders compares a session header against an expected session header. @@ -379,7 +449,7 @@ func verifyClosestProof( proof *smt.SparseMerkleClosestProof, claimRootHash []byte, ) error { - valid, err := smt.VerifyClosestProof(proof, claimRootHash, &protocol.SmtSpec) + valid, err := smt.VerifyClosestProof(proof, claimRootHash, protocol.NewSMTSpec()) if err != nil { return err } diff --git a/x/proof/keeper/proof_validation_test.go b/x/proof/keeper/proof_validation_test.go index f6c3fa970..f2701db84 100644 --- a/x/proof/keeper/proof_validation_test.go +++ b/x/proof/keeper/proof_validation_test.go @@ -285,7 +285,7 @@ func TestEnsureValidProof_Error(t *testing.T) { return proof }, expectedErr: prooftypes.ErrProofInvalidProof.Wrapf( - "failed to unmarshal closest merkle proof: %s", + "failed to unmarshal sparse compact merkle closest proof: %s", expectedInvalidProofUnmarshalErr, ), }, @@ -611,10 +611,10 @@ func TestEnsureValidProof_Error(t *testing.T) { err = sparseCompactMerkleClosestProof.Unmarshal(proof.ClosestMerkleProof) require.NoError(t, err) var sparseMerkleClosestProof *smt.SparseMerkleClosestProof - sparseMerkleClosestProof, err = smt.DecompactClosestProof(sparseCompactMerkleClosestProof, &protocol.SmtSpec) + sparseMerkleClosestProof, err = smt.DecompactClosestProof(sparseCompactMerkleClosestProof, protocol.NewSMTSpec()) require.NoError(t, err) - relayBz := sparseMerkleClosestProof.GetValueHash(&protocol.SmtSpec) + relayBz := sparseMerkleClosestProof.GetValueHash(protocol.NewSMTSpec()) relayHashArr := protocol.GetRelayHashFromBytes(relayBz) relayHash := relayHashArr[:] @@ -753,6 +753,9 @@ func TestEnsureValidProof_Error(t *testing.T) { for _, test := range tests { t.Run(test.desc, func(t *testing.T) { proof := test.newProof(t) + sessionId := proof.GetSessionHeader().GetSessionId() + supplierOperatorAddr := proof.GetSupplierOperatorAddress() + foundClaim, _ := keepers.GetClaim(ctx, sessionId, supplierOperatorAddr) // Advance the block height to the proof path seed height. earliestSupplierProofCommitHeight := sharedtypes.GetEarliestSupplierProofCommitHeight( @@ -769,8 +772,23 @@ func TestEnsureValidProof_Error(t *testing.T) { // Advance the block height to the earliest proof commit height. ctx = keepertest.SetBlockHeight(ctx, earliestSupplierProofCommitHeight) - err := keepers.EnsureValidProof(ctx, proof) - require.ErrorContains(t, err, test.expectedErr.Error()) + + // A proof is valid IFF it is: + // 1. Well-formed; session header and other metadata + // 2. Has valid relay signatures + // 3. Satisfies the closest merkle path + + // Ensure the proof is well-formed. + if err := keepers.EnsureWellFormedProof(ctx, proof); err != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + return + } + + // Ensure the proof satisfies the closest merkle path and has valid relay signatures. + if err := keepers.EnsureValidProofSignaturesAndClosestPath(ctx, &foundClaim, proof); err != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + return + } }) } } diff --git a/x/proof/keeper/validate_proofs.go b/x/proof/keeper/validate_proofs.go new file mode 100644 index 000000000..b6627aeb3 --- /dev/null +++ b/x/proof/keeper/validate_proofs.go @@ -0,0 +1,206 @@ +package keeper + +import ( + "context" + "fmt" + "runtime" + "sync" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// proofValidationTaskCoordinator is a helper struct to coordinate parallel proof +// validation tasks. +type proofValidationTaskCoordinator struct { + // sem is a semaphore to limit the number of concurrent goroutines. + sem chan struct{} + + // wg is a wait group to wait for all goroutines to finish before returning. + wg *sync.WaitGroup + + // processedProofs is a map of supplier operator addresses to the session IDs + // whose proofs that have been processed. + processedProofs map[string][]string + + // numValidProofs and numInvalidProofs are counters to keep track of proof validation results. + numValidProofs, + numInvalidProofs uint64 + + // coordinatorMu protects the coordinator fields. + coordinatorMu *sync.Mutex +} + +// numCPU caches runtime.NumCPU() to avoid being retrieved on every ValidateSubmittedProofs call. +var numCPU int + +func init() { + // Initialize the number of CPU cores available on the machine. + numCPU = runtime.NumCPU() +} + +// ValidateSubmittedProofs performs concurrent proof validation, updating claims' +// proof validation states and removing processed proofs from storage. +func (k Keeper) ValidateSubmittedProofs(ctx sdk.Context) (numValidProofs, numInvalidProofs uint64, err error) { + logger := k.Logger().With("method", "ValidateSubmittedProofs") + + logger.Info(fmt.Sprintf("Number of CPU cores used for parallel proof validation: %d\n", numCPU)) + + // Iterate over proofs using an iterator to prevent OOM issues caused by bulk fetching. + proofIterator := k.GetAllProofsIterator(ctx) + + proofValidationCoordinator := &proofValidationTaskCoordinator{ + // Parallelize proof validation across CPU cores since they are independent from one another. + // Use semaphores to limit concurrent goroutines and prevent memory issues. + sem: make(chan struct{}, numCPU), + // Use a wait group to wait for all goroutines to finish before returning. + wg: &sync.WaitGroup{}, + + processedProofs: make(map[string][]string), + coordinatorMu: &sync.Mutex{}, + } + + for ; proofIterator.Valid(); proofIterator.Next() { + proofBz := proofIterator.Value() + + // Acquire a semaphore to limit the number of goroutines. + // This will block if the sem channel is full. + proofValidationCoordinator.sem <- struct{}{} + + // Increment the wait group to wait for proof validation to finish. + proofValidationCoordinator.wg.Add(1) + + go k.validateProof(ctx, proofBz, proofValidationCoordinator) + } + + // Wait for all goroutines to finish before returning. + proofValidationCoordinator.wg.Wait() + + // Close the proof iterator before deleting the processed proofs. + proofIterator.Close() + + // Delete all the processed proofs from the store since they are no longer needed. + logger.Info("removing processed proofs from the store") + for supplierOperatorAddr, processedProofs := range proofValidationCoordinator.processedProofs { + for _, sessionId := range processedProofs { + k.RemoveProof(ctx, sessionId, supplierOperatorAddr) + logger.Info(fmt.Sprintf( + "removing proof for supplier %s with session ID %s", + supplierOperatorAddr, + sessionId, + )) + } + } + + return proofValidationCoordinator.numValidProofs, proofValidationCoordinator.numInvalidProofs, nil +} + +// validateProof validates a proof submitted by a supplier. +// It marks the corresponding claim as valid or invalid based on the proof validation. +// It is meant to be called concurrently by multiple goroutines to parallelize +// proof validation. +func (k Keeper) validateProof( + ctx context.Context, + proofBz []byte, + coordinator *proofValidationTaskCoordinator, +) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + logger := k.Logger().With("method", "validateProof") + + // Decrement the wait group when the goroutine finishes. + defer coordinator.wg.Done() + + // Release the semaphore after the goroutine finishes which unblocks another one. + defer func() { <-coordinator.sem }() + + var proof types.Proof + // proofBz is not expected to fail unmarshalling since it is should have + // passed EnsureWellFormedProof validation in MsgSubmitProof handler. + // Panic if it fails unmarshalling. + // If a failure occurs, it indicates either a bug in the code or data corruption. + // In either case, panicking is an appropriate response since both panics and + // returning an error would halt block production. + k.cdc.MustUnmarshal(proofBz, &proof) + + sessionHeader := proof.GetSessionHeader() + supplierOperatorAddr := proof.GetSupplierOperatorAddress() + + logger = logger.With( + "session_id", sessionHeader.GetSessionId(), + "application_address", sessionHeader.GetApplicationAddress(), + "service_id", sessionHeader.GetServiceId(), + "session_end_height", sessionHeader.GetSessionEndBlockHeight(), + "supplier_operator_address", supplierOperatorAddr, + ) + + // Retrieve the corresponding claim for the proof submitted so it can be + // used in the proof validation below. + // EnsureWellFormedProof which is called in MsgSubmitProof handler has already validated + // that the claim referenced by the proof exists and has a matching session header. + claim, claimFound := k.GetClaim(ctx, sessionHeader.GetSessionId(), supplierOperatorAddr) + if !claimFound { + // DEV_NOTE: This should never happen since EnsureWellFormedProof has already checked + // that the proof has a corresponding claim. + logger.Error("no claim found for the corresponding proof") + return + } + logger.Debug("successfully retrieved claim") + + // Set the proof status to valid by default. + proofStatus := types.ClaimProofStatus_VALIDATED + // Set the invalidity reason to an empty string by default. + invalidProofReason := "" + + if err := k.EnsureValidProofSignaturesAndClosestPath(ctx, &claim, &proof); err != nil { + // Set the proof status to invalid. + proofStatus = types.ClaimProofStatus_INVALID + + // Set the invalidity reason to the error message. + invalidProofReason = err.Error() + + logger.Info(fmt.Sprintf("invalid proof due to error: %v", err)) + } + logger.Info(fmt.Sprintf("proof checked, validation result: %s", proofStatus)) + + // Create and emit an event for the proof validation result. + eventProofValidityChecked := types.EventProofValidityChecked{ + Proof: &proof, + BlockHeight: uint64(sdkCtx.BlockHeight()), + ProofStatus: proofStatus, + FailureReason: invalidProofReason, + } + + if err := sdkCtx.EventManager().EmitTypedEvent(&eventProofValidityChecked); err != nil { + logger.Error(fmt.Sprintf("failed to emit proof validity check event due to: %v", err)) + return + } + + // Protect the subsequent operations from concurrent access. + coordinator.coordinatorMu.Lock() + defer coordinator.coordinatorMu.Unlock() + + // Update the claim to reflect the validation result of the associated proof. + // + // It will be used later by the SettlePendingClaims routine to determine whether: + // 1. The claim should be settled or not + // 2. The corresponding supplier should be slashed or not + claim.ProofValidationStatus = proofStatus + k.UpsertClaim(ctx, claim) + + // Collect the processed proofs info to delete them after the proofIterator is closed + // to prevent iterator invalidation. + coordinator.processedProofs[supplierOperatorAddr] = append( + coordinator.processedProofs[supplierOperatorAddr], + sessionHeader.GetSessionId(), + ) + + if proofStatus == types.ClaimProofStatus_INVALID { + // Increment the number of invalid proofs. + coordinator.numInvalidProofs++ + } else { + // Increment the number of valid proofs. + coordinator.numValidProofs++ + } +} diff --git a/x/proof/module/abci.go b/x/proof/module/abci.go new file mode 100644 index 000000000..5c4f02d4b --- /dev/null +++ b/x/proof/module/abci.go @@ -0,0 +1,37 @@ +package proof + +import ( + "fmt" + + cosmostelemetry "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +// EndBlocker is called at every block and handles proof-related operations. +func EndBlocker(ctx sdk.Context, k keeper.Keeper) (err error) { + // Telemetry: measure the end-block execution time following standard cosmos-sdk practices. + defer cosmostelemetry.ModuleMeasureSince(types.ModuleName, cosmostelemetry.Now(), cosmostelemetry.MetricKeyEndBlocker) + + logger := k.Logger().With("method", "EndBlocker") + + // Iterates through all proofs submitted in this block and: + // 1. Updates the proof validation status in the associated claim + // 2. Removes all processed proofs from onchain state + numValidProofs, numInvalidProofs, err := k.ValidateSubmittedProofs(ctx) + if err != nil { + logger.Error(fmt.Sprintf("could not validate submitted proofs due to error %v", err)) + return err + } + + logger.Info(fmt.Sprintf( + "checked %d proofs: %d valid, %d invalid", + numValidProofs+numInvalidProofs, + numValidProofs, + numInvalidProofs, + )) + + return nil +} diff --git a/x/proof/module/module.go b/x/proof/module/module.go index 2cc495194..82d9b04d0 100644 --- a/x/proof/module/module.go +++ b/x/proof/module/module.go @@ -149,8 +149,9 @@ func (am AppModule) BeginBlock(_ context.Context) error { // EndBlock contains the logic that is automatically triggered at the end of each block. // The end block implementation is optional. -func (am AppModule) EndBlock(_ context.Context) error { - return nil +func (am AppModule) EndBlock(goCtx context.Context) error { + ctx := sdk.UnwrapSDKContext(goCtx) + return EndBlocker(ctx, am.keeper) } // IsOnePerModuleType implements the depinject.OnePerModuleType interface. diff --git a/x/proof/types/event.pb.go b/x/proof/types/event.pb.go index 8e467c0c5..3d0e25004 100644 --- a/x/proof/types/event.pb.go +++ b/x/proof/types/event.pb.go @@ -330,46 +330,122 @@ func (m *EventProofUpdated) GetClaimedUpokt() *types.Coin { return nil } +// Event emitted after a proof has been checked for validity in the proof module's +// EndBlocker. +type EventProofValidityChecked struct { + Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof"` + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height"` + ProofStatus ClaimProofStatus `protobuf:"varint,3,opt,name=proof_status,json=proofStatus,proto3,enum=poktroll.proof.ClaimProofStatus" json:"proof_status"` + // reason is the string representation of the error that led to the proof being + // marked as invalid (e.g. "invalid closest merkle proof", "invalid relay request signature") + FailureReason string `protobuf:"bytes,4,opt,name=failure_reason,json=failureReason,proto3" json:"failure_reason"` +} + +func (m *EventProofValidityChecked) Reset() { *m = EventProofValidityChecked{} } +func (m *EventProofValidityChecked) String() string { return proto.CompactTextString(m) } +func (*EventProofValidityChecked) ProtoMessage() {} +func (*EventProofValidityChecked) Descriptor() ([]byte, []int) { + return fileDescriptor_dd4c19e04487fbec, []int{4} +} +func (m *EventProofValidityChecked) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventProofValidityChecked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EventProofValidityChecked) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProofValidityChecked.Merge(m, src) +} +func (m *EventProofValidityChecked) XXX_Size() int { + return m.Size() +} +func (m *EventProofValidityChecked) XXX_DiscardUnknown() { + xxx_messageInfo_EventProofValidityChecked.DiscardUnknown(m) +} + +var xxx_messageInfo_EventProofValidityChecked proto.InternalMessageInfo + +func (m *EventProofValidityChecked) GetProof() *Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *EventProofValidityChecked) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *EventProofValidityChecked) GetProofStatus() ClaimProofStatus { + if m != nil { + return m.ProofStatus + } + return ClaimProofStatus_PENDING_VALIDATION +} + +func (m *EventProofValidityChecked) GetFailureReason() string { + if m != nil { + return m.FailureReason + } + return "" +} + func init() { proto.RegisterType((*EventClaimCreated)(nil), "poktroll.proof.EventClaimCreated") proto.RegisterType((*EventClaimUpdated)(nil), "poktroll.proof.EventClaimUpdated") proto.RegisterType((*EventProofSubmitted)(nil), "poktroll.proof.EventProofSubmitted") proto.RegisterType((*EventProofUpdated)(nil), "poktroll.proof.EventProofUpdated") + proto.RegisterType((*EventProofValidityChecked)(nil), "poktroll.proof.EventProofValidityChecked") } func init() { proto.RegisterFile("poktroll/proof/event.proto", fileDescriptor_dd4c19e04487fbec) } var fileDescriptor_dd4c19e04487fbec = []byte{ - // 451 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0x3f, 0x8f, 0xd3, 0x30, - 0x18, 0xc6, 0x1b, 0x7a, 0x3d, 0xe9, 0x0c, 0x9c, 0x74, 0xe1, 0x8f, 0x72, 0x45, 0x38, 0x27, 0xa6, - 0x5b, 0xce, 0x56, 0x41, 0xea, 0x07, 0x48, 0xd4, 0x8d, 0x01, 0x82, 0x2a, 0x21, 0x06, 0xaa, 0x24, - 0x35, 0x25, 0x6a, 0x6c, 0x47, 0x89, 0x5d, 0xe8, 0x27, 0x60, 0xe5, 0x1b, 0x21, 0x36, 0xc6, 0x8e, - 0x9d, 0x22, 0x94, 0x6e, 0xf9, 0x14, 0xc8, 0x76, 0x83, 0xda, 0x08, 0x90, 0x50, 0x25, 0x58, 0x3a, - 0xc5, 0x7e, 0x9f, 0xe7, 0xb1, 0x9d, 0xf7, 0x27, 0xcb, 0xa0, 0x9f, 0xf1, 0xb9, 0xc8, 0x79, 0x9a, - 0xe2, 0x2c, 0xe7, 0xfc, 0x1d, 0x26, 0x0b, 0xc2, 0x04, 0xca, 0x72, 0x2e, 0xb8, 0x7d, 0xde, 0x68, - 0x48, 0x6b, 0x7d, 0x18, 0xf3, 0x82, 0xf2, 0x02, 0x47, 0x61, 0x41, 0xf0, 0x62, 0x10, 0x11, 0x11, - 0x0e, 0x70, 0xcc, 0x13, 0x66, 0xfc, 0xfd, 0xfb, 0x33, 0x3e, 0xe3, 0x7a, 0x88, 0xd5, 0x68, 0x5b, - 0x6d, 0xef, 0x20, 0x96, 0x19, 0x29, 0x8c, 0xf6, 0xe4, 0x53, 0x17, 0x5c, 0x8c, 0xd4, 0x8e, 0x7e, - 0x1a, 0x26, 0xd4, 0xcf, 0x49, 0x28, 0xc8, 0xd4, 0x1e, 0x82, 0x5e, 0xac, 0xe6, 0x8e, 0x75, 0x65, - 0x5d, 0xdf, 0x7e, 0xfa, 0x00, 0xed, 0x9f, 0x03, 0x69, 0xb3, 0x77, 0x56, 0x97, 0xae, 0xf1, 0x05, - 0xe6, 0x63, 0xdf, 0x00, 0xc0, 0x24, 0x9d, 0xe4, 0x24, 0x0d, 0x97, 0x85, 0x73, 0xeb, 0xca, 0xba, - 0x3e, 0xf1, 0xce, 0xeb, 0xd2, 0xdd, 0xa9, 0x06, 0x67, 0x4c, 0xd2, 0x40, 0x0f, 0xed, 0xd7, 0xe0, - 0x52, 0x09, 0x3a, 0x4b, 0xa6, 0x93, 0x98, 0xd3, 0x4c, 0x0a, 0x32, 0x91, 0x2c, 0x11, 0x85, 0x73, - 0xa2, 0xd3, 0x8f, 0xeb, 0xd2, 0xfd, 0xbd, 0x29, 0x78, 0xc8, 0x24, 0xf5, 0x8d, 0xe2, 0x1b, 0x61, - 0xac, 0xea, 0xf6, 0x5b, 0xf0, 0x48, 0x85, 0x48, 0x21, 0x12, 0xaa, 0xfe, 0xa8, 0xb5, 0x76, 0x4f, - 0xaf, 0xed, 0xd6, 0xa5, 0xfb, 0x27, 0x5b, 0xe0, 0x30, 0x49, 0x47, 0x8d, 0xb6, 0xb7, 0xfe, 0x4b, - 0x70, 0xb7, 0x39, 0x90, 0x54, 0xbd, 0x71, 0x4e, 0x75, 0xa3, 0x2e, 0x91, 0x01, 0x84, 0x14, 0x20, - 0xb4, 0x05, 0x84, 0x7c, 0x9e, 0x30, 0xef, 0xa2, 0x2e, 0xdd, 0xfd, 0x4c, 0x70, 0x67, 0x3b, 0x1d, - 0xab, 0x59, 0x8b, 0xc4, 0x38, 0x9b, 0x1e, 0x49, 0xfc, 0x27, 0x12, 0x5f, 0xbb, 0xe0, 0x9e, 0x26, - 0xf1, 0x42, 0xb5, 0xf8, 0x95, 0x8c, 0x68, 0x22, 0x0e, 0x61, 0x31, 0x04, 0x3d, 0x6d, 0xd0, 0x18, - 0x7e, 0x91, 0xd3, 0xdb, 0x98, 0x9c, 0x2e, 0x04, 0xe6, 0xd3, 0x62, 0xd8, 0x3d, 0x32, 0xfc, 0x0b, - 0x86, 0x5f, 0x9a, 0xdb, 0xa4, 0x9b, 0x7b, 0xe8, 0x6d, 0x3a, 0x12, 0xfc, 0xe7, 0x04, 0xbd, 0xe7, - 0xdf, 0x2a, 0x68, 0xad, 0x2a, 0x68, 0xad, 0x2b, 0x68, 0x7d, 0xaf, 0xa0, 0xf5, 0x79, 0x03, 0x3b, - 0xab, 0x0d, 0xec, 0xac, 0x37, 0xb0, 0xf3, 0x06, 0xcd, 0x12, 0xf1, 0x5e, 0x46, 0x28, 0xe6, 0x14, - 0x2b, 0xfb, 0x0d, 0x23, 0xe2, 0x03, 0xcf, 0xe7, 0xf8, 0xe7, 0x5b, 0xf7, 0x71, 0xf7, 0xb5, 0x8b, - 0x4e, 0xf5, 0x73, 0xf7, 0xec, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x12, 0xa3, 0x30, 0x6e, - 0x07, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x96, 0xb1, 0x6f, 0xd3, 0x4e, + 0x14, 0xc7, 0xe3, 0xa6, 0xa9, 0x94, 0x4b, 0x1a, 0xfd, 0xea, 0x1f, 0xa0, 0x24, 0x08, 0x3b, 0x62, + 0xea, 0x52, 0x5b, 0x6d, 0xa5, 0x4a, 0xac, 0xb1, 0x2a, 0x31, 0x30, 0xc0, 0xa1, 0x20, 0xc4, 0x80, + 0x65, 0x3b, 0xd7, 0xe4, 0x14, 0xfb, 0xce, 0xb2, 0xef, 0x0a, 0xf9, 0x0b, 0x58, 0x99, 0xf9, 0x67, + 0x10, 0x1b, 0x63, 0xc7, 0x4e, 0x16, 0x4a, 0x36, 0xff, 0x15, 0xe8, 0xde, 0x25, 0x34, 0x89, 0x0a, + 0x52, 0x55, 0x09, 0x96, 0x4c, 0xbe, 0xf7, 0xbe, 0xef, 0xfb, 0xee, 0xf2, 0x3e, 0xb1, 0x75, 0xa8, + 0x9b, 0xf2, 0x89, 0xc8, 0x78, 0x1c, 0xbb, 0x69, 0xc6, 0xf9, 0x85, 0x4b, 0x2e, 0x09, 0x13, 0x4e, + 0x9a, 0x71, 0xc1, 0xcd, 0xd6, 0x52, 0x73, 0x40, 0xeb, 0x5a, 0x11, 0xcf, 0x13, 0x9e, 0xbb, 0x61, + 0x90, 0x13, 0xf7, 0xf2, 0x38, 0x24, 0x22, 0x38, 0x76, 0x23, 0x4e, 0x99, 0xae, 0xef, 0x3e, 0x18, + 0xf1, 0x11, 0x87, 0xa5, 0xab, 0x56, 0x8b, 0xec, 0xe6, 0x0e, 0x62, 0x9a, 0x92, 0x5c, 0x6b, 0x4f, + 0x3f, 0x55, 0xd1, 0xc1, 0xb9, 0xda, 0xd1, 0x8b, 0x03, 0x9a, 0x78, 0x19, 0x09, 0x04, 0x19, 0x9a, + 0x67, 0xa8, 0x16, 0xa9, 0xb8, 0x6d, 0xf4, 0x8c, 0xc3, 0xc6, 0xc9, 0x43, 0x67, 0xfd, 0x1c, 0x0e, + 0x14, 0xf7, 0xeb, 0x65, 0x61, 0xeb, 0x3a, 0xac, 0x1f, 0xe6, 0x11, 0x42, 0x4c, 0x26, 0x7e, 0x46, + 0xe2, 0x60, 0x9a, 0xb7, 0x77, 0x7a, 0xc6, 0xe1, 0x6e, 0xbf, 0x55, 0x16, 0xf6, 0x4a, 0x16, 0xd7, + 0x99, 0x4c, 0x30, 0x2c, 0xcd, 0xb7, 0xa8, 0xa3, 0x04, 0xf0, 0x92, 0xa1, 0x1f, 0xf1, 0x24, 0x95, + 0x82, 0xf8, 0x92, 0x51, 0x91, 0xb7, 0x77, 0xc1, 0xfd, 0xa4, 0x2c, 0xec, 0xdf, 0x17, 0xe1, 0x47, + 0x4c, 0x26, 0x9e, 0x56, 0x3c, 0x2d, 0x0c, 0x54, 0xde, 0x7c, 0x8f, 0x1e, 0x2b, 0x13, 0xc9, 0x05, + 0x4d, 0xd4, 0x2f, 0xda, 0xe8, 0x5d, 0x83, 0xde, 0x76, 0x59, 0xd8, 0x7f, 0x2a, 0xc3, 0x6d, 0x26, + 0x93, 0xf3, 0xa5, 0xb6, 0xd6, 0xff, 0x15, 0xda, 0x5f, 0x1e, 0x48, 0xaa, 0xd9, 0xb4, 0xf7, 0x60, + 0x50, 0x1d, 0x47, 0x03, 0x72, 0x14, 0x20, 0x67, 0x01, 0xc8, 0xf1, 0x38, 0x65, 0xfd, 0x83, 0xb2, + 0xb0, 0xd7, 0x3d, 0xb8, 0xb9, 0x08, 0x07, 0x2a, 0xda, 0x20, 0x31, 0x48, 0x87, 0x5b, 0x12, 0xff, + 0x88, 0xc4, 0xb7, 0x2a, 0xfa, 0x1f, 0x48, 0xbc, 0x54, 0x23, 0x7e, 0x2d, 0xc3, 0x84, 0x8a, 0xfb, + 0xb0, 0x38, 0x43, 0x35, 0x28, 0x00, 0x0c, 0xb7, 0xf8, 0x60, 0x1b, 0xed, 0x83, 0x04, 0xd6, 0x8f, + 0x0d, 0x86, 0xd5, 0x2d, 0xc3, 0x3b, 0x30, 0xfc, 0xba, 0x7c, 0x9b, 0x60, 0xb8, 0xf7, 0x7d, 0x9b, + 0xb6, 0x04, 0xff, 0x3e, 0xc1, 0x2f, 0x3b, 0xa8, 0x73, 0x43, 0xf0, 0x4d, 0x10, 0xd3, 0x21, 0x15, + 0x53, 0x6f, 0x4c, 0xa2, 0x89, 0x26, 0xa9, 0x89, 0x18, 0x77, 0x23, 0x72, 0x8a, 0x9a, 0x61, 0xcc, + 0xa3, 0x89, 0x3f, 0x26, 0x74, 0x34, 0x16, 0x8b, 0x2f, 0xe3, 0x7f, 0x65, 0x61, 0xaf, 0xe5, 0x71, + 0x03, 0xa2, 0xe7, 0x10, 0x98, 0x03, 0xd4, 0x04, 0xb7, 0x9f, 0x8b, 0x40, 0x48, 0x0d, 0xb2, 0x75, + 0xd2, 0xbb, 0xf5, 0xdf, 0xa3, 0xbf, 0x19, 0x50, 0xa7, 0xdb, 0xae, 0x3a, 0x71, 0x23, 0xbd, 0x91, + 0xcd, 0x67, 0xa8, 0x75, 0x11, 0xd0, 0x58, 0x66, 0xc4, 0xcf, 0x48, 0x90, 0x73, 0x06, 0x8c, 0xeb, + 0x7d, 0xb3, 0x2c, 0xec, 0x0d, 0x05, 0xef, 0x2f, 0x62, 0x0c, 0x61, 0xff, 0xc5, 0xf7, 0x99, 0x65, + 0x5c, 0xcd, 0x2c, 0xe3, 0x7a, 0x66, 0x19, 0x3f, 0x66, 0x96, 0xf1, 0x79, 0x6e, 0x55, 0xae, 0xe6, + 0x56, 0xe5, 0x7a, 0x6e, 0x55, 0xde, 0x39, 0x23, 0x2a, 0xc6, 0x32, 0x74, 0x22, 0x9e, 0xb8, 0xea, + 0x8c, 0x47, 0x8c, 0x88, 0x0f, 0x3c, 0x9b, 0xb8, 0xbf, 0x2e, 0x02, 0x1f, 0x57, 0xaf, 0x02, 0xe1, + 0x1e, 0xdc, 0x05, 0x4e, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xda, 0x61, 0x57, 0x8b, 0x08, + 0x00, 0x00, } func (m *EventClaimCreated) Marshal() (dAtA []byte, err error) { @@ -644,6 +720,58 @@ func (m *EventProofUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventProofValidityChecked) 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 *EventProofValidityChecked) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventProofValidityChecked) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FailureReason) > 0 { + i -= len(m.FailureReason) + copy(dAtA[i:], m.FailureReason) + i = encodeVarintEvent(dAtA, i, uint64(len(m.FailureReason))) + i-- + dAtA[i] = 0x22 + } + if m.ProofStatus != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.ProofStatus)) + i-- + dAtA[i] = 0x18 + } + if m.BlockHeight != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { offset -= sovEvent(v) base := offset @@ -767,6 +895,29 @@ func (m *EventProofUpdated) Size() (n int) { return n } +func (m *EventProofValidityChecked) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovEvent(uint64(l)) + } + if m.BlockHeight != 0 { + n += 1 + sovEvent(uint64(m.BlockHeight)) + } + if m.ProofStatus != 0 { + n += 1 + sovEvent(uint64(m.ProofStatus)) + } + l = len(m.FailureReason) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + func sovEvent(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1561,6 +1712,162 @@ func (m *EventProofUpdated) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventProofValidityChecked) 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: EventProofValidityChecked: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventProofValidityChecked: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofStatus", wireType) + } + m.ProofStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofStatus |= ClaimProofStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FailureReason", 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.FailureReason = string(dAtA[iNdEx:postIndex]) + 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/proof/types/params.go b/x/proof/types/params.go index 9647651d1..11869057b 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -36,7 +36,7 @@ var ( ParamProofSubmissionFee = "proof_submission_fee" // TODO_MAINNET: Determine a sensible default value for the proof submission fee. // MinProofSubmissionFee is the default and minimum fee for submitting a proof. - MinProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(1000000)) + MinProofSubmissionFee = cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(100)) ) // ParamKeyTable the param key table for launch module diff --git a/x/proof/types/query.pb.go b/x/proof/types/query.pb.go index ebe21a473..c27b6d9c2 100644 --- a/x/proof/types/query.pb.go +++ b/x/proof/types/query.pb.go @@ -436,7 +436,6 @@ func (m *QueryGetProofResponse) GetProof() Proof { type QueryAllProofsRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` // Types that are valid to be assigned to Filter: - // // *QueryAllProofsRequest_SupplierOperatorAddress // *QueryAllProofsRequest_SessionId // *QueryAllProofsRequest_SessionEndHeight diff --git a/x/proof/types/types.pb.go b/x/proof/types/types.pb.go index 088ac987e..dc594d9e0 100644 --- a/x/proof/types/types.pb.go +++ b/x/proof/types/types.pb.go @@ -84,6 +84,36 @@ func (ClaimProofStage) EnumDescriptor() ([]byte, []int) { return fileDescriptor_b75ef15dfd4d6998, []int{1} } +// Status of proof validation for a claim +// Default is PENDING_VALIDATION regardless of proof requirement +type ClaimProofStatus int32 + +const ( + ClaimProofStatus_PENDING_VALIDATION ClaimProofStatus = 0 + ClaimProofStatus_VALIDATED ClaimProofStatus = 1 + ClaimProofStatus_INVALID ClaimProofStatus = 2 +) + +var ClaimProofStatus_name = map[int32]string{ + 0: "PENDING_VALIDATION", + 1: "VALIDATED", + 2: "INVALID", +} + +var ClaimProofStatus_value = map[string]int32{ + "PENDING_VALIDATION": 0, + "VALIDATED": 1, + "INVALID": 2, +} + +func (x ClaimProofStatus) String() string { + return proto.EnumName(ClaimProofStatus_name, int32(x)) +} + +func (ClaimProofStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b75ef15dfd4d6998, []int{2} +} + type Proof struct { // Address of the supplier's operator that submitted this proof. SupplierOperatorAddress string `protobuf:"bytes,1,opt,name=supplier_operator_address,json=supplierOperatorAddress,proto3" json:"supplier_operator_address,omitempty"` @@ -145,11 +175,14 @@ func (m *Proof) GetClosestMerkleProof() []byte { // Claim is the serialized object stored onchain for claims pending to be proven type Claim struct { + // Address of the supplier's operator that submitted this claim. SupplierOperatorAddress string `protobuf:"bytes,1,opt,name=supplier_operator_address,json=supplierOperatorAddress,proto3" json:"supplier_operator_address,omitempty"` - // The session header of the session that this claim is for. + // Session header this claim is for. SessionHeader *types.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` - // Root hash returned from smt.SMST#Root(). + // Root hash from smt.SMST#Root(). RootHash []byte `protobuf:"bytes,3,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` + // Important: This field MUST only be set by proofKeeper#EnsureValidProofSignaturesAndClosestPath + ProofValidationStatus ClaimProofStatus `protobuf:"varint,4,opt,name=proof_validation_status,json=proofValidationStatus,proto3,enum=poktroll.proof.ClaimProofStatus" json:"proof_validation_status,omitempty"` } func (m *Claim) Reset() { *m = Claim{} } @@ -202,9 +235,17 @@ func (m *Claim) GetRootHash() []byte { return nil } +func (m *Claim) GetProofValidationStatus() ClaimProofStatus { + if m != nil { + return m.ProofValidationStatus + } + return ClaimProofStatus_PENDING_VALIDATION +} + func init() { proto.RegisterEnum("poktroll.proof.ProofRequirementReason", ProofRequirementReason_name, ProofRequirementReason_value) proto.RegisterEnum("poktroll.proof.ClaimProofStage", ClaimProofStage_name, ClaimProofStage_value) + proto.RegisterEnum("poktroll.proof.ClaimProofStatus", ClaimProofStatus_name, ClaimProofStatus_value) proto.RegisterType((*Proof)(nil), "poktroll.proof.Proof") proto.RegisterType((*Claim)(nil), "poktroll.proof.Claim") } @@ -212,36 +253,41 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/types.proto", fileDescriptor_b75ef15dfd4d6998) } var fileDescriptor_b75ef15dfd4d6998 = []byte{ - // 452 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x92, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xb3, 0xa9, 0x5a, 0xc8, 0xb6, 0x29, 0x66, 0x15, 0x41, 0x1a, 0x90, 0x89, 0x7a, 0x8a, - 0x2a, 0xd5, 0x46, 0xf0, 0x04, 0xf9, 0x63, 0x14, 0x4b, 0x6e, 0x1d, 0xd6, 0x06, 0x21, 0x2e, 0x96, - 0x9b, 0x2c, 0xb6, 0x15, 0xdb, 0x63, 0x76, 0x37, 0x02, 0xde, 0x82, 0x87, 0xe1, 0x09, 0x38, 0x71, - 0xac, 0xb8, 0xd0, 0x23, 0x72, 0x5e, 0x04, 0x79, 0xed, 0x46, 0x79, 0x04, 0x4e, 0xf6, 0xcc, 0x6f, - 0xe6, 0x9b, 0xfd, 0x46, 0x83, 0x07, 0x05, 0xac, 0x25, 0x87, 0x34, 0x35, 0x0b, 0x0e, 0xf0, 0xc9, - 0x94, 0xdf, 0x0a, 0x26, 0x8c, 0x82, 0x83, 0x04, 0x72, 0x7a, 0xcf, 0x0c, 0xc5, 0x06, 0x67, 0x4b, - 0x10, 0x19, 0x88, 0x40, 0x51, 0xb3, 0x0e, 0xea, 0xd2, 0xc1, 0xf3, 0x9d, 0x8c, 0x60, 0x42, 0x24, - 0x90, 0xef, 0x0b, 0x0d, 0x7a, 0x11, 0x44, 0x50, 0x77, 0x55, 0x7f, 0x75, 0xf6, 0xfc, 0x0f, 0xc2, - 0x87, 0x8b, 0x4a, 0x98, 0xf8, 0xf8, 0x4c, 0x6c, 0x8a, 0x22, 0x4d, 0x18, 0x0f, 0xa0, 0x60, 0x3c, - 0x94, 0xc0, 0x83, 0x70, 0xb5, 0xe2, 0x4c, 0x88, 0x3e, 0x1a, 0xa2, 0x51, 0x67, 0xd2, 0xff, 0xfd, - 0xe3, 0xb2, 0xd7, 0x8c, 0x1c, 0xd7, 0xc4, 0x93, 0x3c, 0xc9, 0x23, 0xfa, 0xf4, 0xbe, 0xd5, 0x6d, - 0x3a, 0x1b, 0x4c, 0xde, 0xe0, 0xd3, 0xe6, 0x31, 0x41, 0xcc, 0xc2, 0x15, 0xe3, 0xfd, 0xf6, 0x10, - 0x8d, 0x8e, 0x5f, 0xbd, 0x30, 0x76, 0xbe, 0x1a, 0x6e, 0x78, 0xf5, 0x77, 0xae, 0xca, 0x68, 0x57, - 0xec, 0x87, 0xe4, 0x25, 0xee, 0x2d, 0x53, 0x10, 0x4c, 0xc8, 0x20, 0x63, 0x7c, 0x9d, 0xb2, 0x40, - 0xad, 0xa3, 0x7f, 0x30, 0x44, 0xa3, 0x13, 0x4a, 0x1a, 0x76, 0xa5, 0x90, 0xf2, 0x73, 0xfe, 0x13, - 0xe1, 0xc3, 0x69, 0x1a, 0x26, 0xd9, 0x7f, 0xee, 0xec, 0x19, 0xee, 0x70, 0x00, 0x19, 0xc4, 0xa1, - 0x88, 0x1b, 0x3b, 0x0f, 0xab, 0xc4, 0x3c, 0x14, 0xf1, 0x85, 0x83, 0x9f, 0x28, 0x37, 0x94, 0x7d, - 0xde, 0x24, 0x9c, 0x65, 0x2c, 0x97, 0x94, 0x85, 0x02, 0x72, 0xa2, 0xe1, 0x93, 0x6b, 0xd7, 0x0f, - 0xa8, 0xf5, 0xf6, 0x9d, 0x4d, 0xad, 0x99, 0xd6, 0x22, 0x8f, 0x71, 0x77, 0x41, 0xdd, 0xc9, 0x78, - 0x62, 0x3b, 0xb6, 0xe7, 0xdb, 0x53, 0x0d, 0x91, 0x2e, 0xee, 0xf8, 0x73, 0x6a, 0x79, 0x73, 0xd7, - 0x99, 0x69, 0xed, 0x8b, 0x19, 0x7e, 0xa4, 0x36, 0xa2, 0x24, 0x3d, 0x19, 0x46, 0x8c, 0x1c, 0xe3, - 0x07, 0x53, 0x67, 0x6c, 0x5f, 0x29, 0x05, 0x8c, 0x8f, 0x16, 0xd4, 0x7d, 0x6f, 0x5d, 0x6b, 0xa8, - 0x02, 0x9e, 0xe5, 0xfb, 0x8e, 0x35, 0xd3, 0xda, 0x55, 0x60, 0x7d, 0x58, 0xa8, 0x39, 0x07, 0x13, - 0xe7, 0x57, 0xa9, 0xa3, 0xdb, 0x52, 0x47, 0x77, 0xa5, 0x8e, 0xfe, 0x96, 0x3a, 0xfa, 0xbe, 0xd5, - 0x5b, 0xb7, 0x5b, 0xbd, 0x75, 0xb7, 0xd5, 0x5b, 0x1f, 0x8d, 0x28, 0x91, 0xf1, 0xe6, 0xc6, 0x58, - 0x42, 0x66, 0x56, 0x8b, 0xb8, 0xcc, 0x99, 0xfc, 0x02, 0x7c, 0x6d, 0xee, 0x8e, 0xf3, 0xeb, 0xfe, - 0x95, 0xdf, 0x1c, 0xa9, 0x3b, 0x7c, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x74, 0x9b, 0x7a, 0x80, - 0x04, 0x03, 0x00, 0x00, + // 533 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0x5f, 0x6e, 0xda, 0x4e, + 0x10, 0x66, 0xc9, 0x2f, 0xf9, 0x95, 0x4d, 0xa0, 0xee, 0x8a, 0x26, 0x84, 0x56, 0x2e, 0xca, 0x13, + 0x42, 0x8a, 0xa9, 0xd2, 0x13, 0x00, 0x76, 0x8a, 0x25, 0xc7, 0xa6, 0x6b, 0x17, 0x45, 0x7d, 0xb1, + 0x36, 0xb0, 0x05, 0x0b, 0xe3, 0x75, 0x77, 0x97, 0xfe, 0xb9, 0x45, 0x0f, 0xd0, 0x63, 0xf4, 0x10, + 0x7d, 0x8c, 0xfa, 0xd2, 0x3c, 0x56, 0x70, 0x91, 0xca, 0x6b, 0x07, 0x91, 0x9e, 0xa0, 0x4f, 0xf6, + 0x7c, 0xdf, 0xcc, 0x37, 0xf3, 0x8d, 0x76, 0x60, 0x33, 0x65, 0x0b, 0xc9, 0x59, 0x1c, 0x77, 0x53, + 0xce, 0xd8, 0xfb, 0xae, 0xfc, 0x92, 0x52, 0x61, 0xa4, 0x9c, 0x49, 0x86, 0x6a, 0xf7, 0x9c, 0xa1, + 0xb8, 0xe6, 0xe9, 0x84, 0x89, 0x25, 0x13, 0xa1, 0x62, 0xbb, 0x79, 0x90, 0xa7, 0x36, 0x9f, 0x6f, + 0x65, 0x04, 0x15, 0x22, 0x62, 0xc9, 0xae, 0x50, 0xb3, 0x3e, 0x63, 0x33, 0x96, 0x57, 0x65, 0x7f, + 0x39, 0x7a, 0xf6, 0x0b, 0xc0, 0xfd, 0x51, 0x26, 0x8c, 0x02, 0x78, 0x2a, 0x56, 0x69, 0x1a, 0x47, + 0x94, 0x87, 0x2c, 0xa5, 0x9c, 0x48, 0xc6, 0x43, 0x32, 0x9d, 0x72, 0x2a, 0x44, 0x03, 0xb4, 0x40, + 0xbb, 0xd2, 0x6f, 0xfc, 0xfc, 0x7e, 0x5e, 0x2f, 0x5a, 0xf6, 0x72, 0xc6, 0x97, 0x3c, 0x4a, 0x66, + 0xf8, 0xe4, 0xbe, 0xd4, 0x2b, 0x2a, 0x0b, 0x1a, 0x5d, 0xc2, 0x5a, 0x31, 0x4c, 0x38, 0xa7, 0x64, + 0x4a, 0x79, 0xa3, 0xdc, 0x02, 0xed, 0xc3, 0x8b, 0x17, 0xc6, 0xd6, 0x57, 0xc1, 0x1b, 0x7e, 0xfe, + 0x1d, 0xaa, 0x34, 0x5c, 0x15, 0xbb, 0x21, 0x7a, 0x09, 0xeb, 0x93, 0x98, 0x09, 0x2a, 0x64, 0xb8, + 0xa4, 0x7c, 0x11, 0xd3, 0x50, 0xad, 0xa3, 0xb1, 0xd7, 0x02, 0xed, 0x23, 0x8c, 0x0a, 0xee, 0x4a, + 0x51, 0xca, 0xcf, 0xd9, 0xb7, 0x32, 0xdc, 0x1f, 0xc4, 0x24, 0x5a, 0xfe, 0xe3, 0xce, 0x9e, 0xc1, + 0x0a, 0x67, 0x4c, 0x86, 0x73, 0x22, 0xe6, 0x85, 0x9d, 0x47, 0x19, 0x30, 0x24, 0x62, 0x8e, 0xae, + 0xe1, 0x89, 0xf2, 0x19, 0x7e, 0x24, 0x71, 0x34, 0x25, 0x32, 0xeb, 0x26, 0x24, 0x91, 0x2b, 0xd1, + 0xf8, 0xaf, 0x05, 0xda, 0xb5, 0x8b, 0x96, 0xf1, 0xf0, 0x7d, 0x18, 0xca, 0xb2, 0xda, 0x80, 0xaf, + 0xf2, 0xf0, 0x53, 0x85, 0x8f, 0xb7, 0xf5, 0x39, 0xdc, 0x71, 0xe0, 0xb1, 0xca, 0xc2, 0xf4, 0xc3, + 0x2a, 0xe2, 0x74, 0x49, 0x13, 0x89, 0x29, 0x11, 0x2c, 0x41, 0x1a, 0x3c, 0x72, 0xbd, 0x20, 0xc4, + 0xd6, 0x9b, 0xb7, 0x36, 0xb6, 0x4c, 0xad, 0x84, 0x9e, 0xc0, 0xea, 0x08, 0x7b, 0xfd, 0x5e, 0xdf, + 0x76, 0x6c, 0x3f, 0xb0, 0x07, 0x1a, 0x40, 0x55, 0x58, 0x09, 0x86, 0xd8, 0xf2, 0x87, 0x9e, 0x63, + 0x6a, 0xe5, 0x8e, 0x09, 0x1f, 0x3f, 0x68, 0x3c, 0xa3, 0xe8, 0x10, 0xfe, 0x3f, 0x70, 0x7a, 0xf6, + 0x95, 0x52, 0x80, 0xf0, 0x60, 0x84, 0xbd, 0xb1, 0xe5, 0x6a, 0x20, 0x23, 0x7c, 0x2b, 0x08, 0x1c, + 0xcb, 0xd4, 0xca, 0x59, 0x60, 0x5d, 0x8f, 0x54, 0x9f, 0xbd, 0xce, 0x25, 0xd4, 0xfe, 0x1e, 0x1f, + 0x1d, 0x43, 0x34, 0xb2, 0x5c, 0xd3, 0x76, 0x5f, 0x87, 0xe3, 0x9e, 0x63, 0x9b, 0xbd, 0xc0, 0xf6, + 0x5c, 0xad, 0x94, 0x0d, 0x50, 0xc4, 0x96, 0x99, 0x8b, 0xda, 0xae, 0x02, 0xb4, 0x72, 0xdf, 0xf9, + 0xb1, 0xd6, 0xc1, 0xed, 0x5a, 0x07, 0x77, 0x6b, 0x1d, 0xfc, 0x5e, 0xeb, 0xe0, 0xeb, 0x46, 0x2f, + 0xdd, 0x6e, 0xf4, 0xd2, 0xdd, 0x46, 0x2f, 0xbd, 0x33, 0x66, 0x91, 0x9c, 0xaf, 0x6e, 0x8c, 0x09, + 0x5b, 0x76, 0xb3, 0xe5, 0x9d, 0x27, 0x54, 0x7e, 0x62, 0x7c, 0xd1, 0xdd, 0x9e, 0xcf, 0xe7, 0xdd, + 0x3b, 0xbc, 0x39, 0x50, 0x97, 0xf2, 0xea, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x4b, 0xbc, + 0x6b, 0xa6, 0x03, 0x00, 0x00, } func (m *Proof) Marshal() (dAtA []byte, err error) { @@ -313,6 +359,11 @@ func (m *Claim) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProofValidationStatus != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProofValidationStatus)) + i-- + dAtA[i] = 0x20 + } if len(m.RootHash) > 0 { i -= len(m.RootHash) copy(dAtA[i:], m.RootHash) @@ -392,6 +443,9 @@ func (m *Claim) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.ProofValidationStatus != 0 { + n += 1 + sovTypes(uint64(m.ProofValidationStatus)) + } return n } @@ -684,6 +738,25 @@ func (m *Claim) Unmarshal(dAtA []byte) error { m.RootHash = []byte{} } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofValidationStatus", wireType) + } + m.ProofValidationStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofValidationStatus |= ClaimProofStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index 076663cce..46daae103 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -384,12 +384,15 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide s.keepers.UpsertClaim(ctx, s.claim) s.keepers.UpsertProof(ctx, s.proof) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + s.keepers.ValidateSubmittedProofs(sdkCtx) + // Settle pending claims after proof window closes // Expectation: All (1) claims should be claimed. // NB: proofs should be rejected when the current height equals the proof window close height. sessionEndHeight := s.claim.SessionHeader.SessionEndBlockHeight blockHeight := sharedtypes.GetProofWindowCloseHeight(&sharedParams, sessionEndHeight) - sdkCtx := cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) + sdkCtx = cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) settledResult, expiredResult, err := s.keepers.SettlePendingClaims(sdkCtx) require.NoError(t, err) @@ -440,12 +443,15 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequired_InvalidOn s.keepers.UpsertClaim(ctx, s.claim) s.keepers.UpsertProof(ctx, proof) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + s.keepers.ValidateSubmittedProofs(sdkCtx) + // Settle pending claims after proof window closes // Expectation: All (1) claims should be expired. // NB: proofs should be rejected when the current height equals the proof window close height. sessionEndHeight := s.claim.SessionHeader.SessionEndBlockHeight blockHeight := sharedtypes.GetProofWindowCloseHeight(&sharedParams, sessionEndHeight) - sdkCtx := cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) + sdkCtx = sdkCtx.WithBlockHeight(blockHeight) settledResults, expiredResults, err := s.keepers.SettlePendingClaims(sdkCtx) require.NoError(t, err) @@ -469,10 +475,15 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequired_InvalidOn // Confirm an expiration event was emitted events := sdkCtx.EventManager().Events() - require.Equal(t, 12, len(events)) // minting, burning, settling, etc.. + require.Equal(t, 13, len(events)) // minting, burning, settling, etc.. + expectedClaimExpiredEvents := testutilevents.FilterEvents[*tokenomicstypes.EventClaimExpired](t, events) require.Equal(t, 1, len(expectedClaimExpiredEvents)) + // Confirm an invalid proof removed event was emitted + expectedProofValidityCheckedEvents := testutilevents.FilterEvents[*prooftypes.EventProofValidityChecked](t, events) + require.Equal(t, 1, len(expectedProofValidityCheckedEvents)) + // Validate the event expectedClaimExpiredEvent := expectedClaimExpiredEvents[0] require.Equal(t, tokenomicstypes.ClaimExpirationReason_PROOF_INVALID, expectedClaimExpiredEvent.GetExpirationReason()) @@ -481,6 +492,9 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequired_InvalidOn require.Equal(t, s.numEstimatedComputeUnits, expectedClaimExpiredEvent.GetNumEstimatedComputeUnits()) require.Equal(t, s.claimedUpokt, *expectedClaimExpiredEvent.GetClaimedUpokt()) + expectedProofValidityCheckedEvent := expectedProofValidityCheckedEvents[0] + require.Equal(t, prooftypes.ClaimProofStatus_INVALID, expectedProofValidityCheckedEvent.GetProofStatus()) + // Confirm that a slashing event was emitted expectedSlashingEvents := testutilevents.FilterEvents[*tokenomicstypes.EventSupplierSlashed](t, events) require.Equal(t, 1, len(expectedSlashingEvents)) @@ -516,12 +530,15 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi s.keepers.UpsertClaim(ctx, s.claim) s.keepers.UpsertProof(ctx, s.proof) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + s.keepers.ValidateSubmittedProofs(sdkCtx) + // Settle pending claims after proof window closes // Expectation: All (1) claims should be claimed. // NB: proof window has definitely closed at this point sessionEndHeight := s.claim.SessionHeader.SessionEndBlockHeight blockHeight := sharedtypes.GetProofWindowCloseHeight(&sharedParams, sessionEndHeight) - sdkCtx := cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) + sdkCtx = cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) settledResults, expiredResults, err := s.keepers.SettlePendingClaims(sdkCtx) require.NoError(t, err) @@ -571,12 +588,15 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { // Upsert the claim only (not the proof) s.keepers.UpsertClaim(ctx, s.claim) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) + s.keepers.ValidateSubmittedProofs(sdkCtx) + // Settle pending claims after proof window closes // Expectation: All (1) claims should be claimed. // NB: proofs should be rejected when the current height equals the proof window close height. sessionEndHeight := s.claim.SessionHeader.SessionEndBlockHeight blockHeight := sharedtypes.GetProofWindowCloseHeight(&sharedParams, sessionEndHeight) - sdkCtx := cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) + sdkCtx = cosmostypes.UnwrapSDKContext(ctx).WithBlockHeight(blockHeight) settledResults, expiredResults, err := s.keepers.SettlePendingClaims(sdkCtx) require.NoError(t, err) @@ -771,7 +791,7 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_SupplierUnstaked() { // Validate the EventSupplierUnbondingBegin event. unbondingEndHeight := sharedtypes.GetSupplierUnbondingEndHeight(&sharedParams, &slashedSupplier) slashedSupplier.ServicesActivationHeightsMap = make(map[string]uint64) - for i, _ := range slashedSupplier.GetServices() { + for i := range slashedSupplier.GetServices() { slashedSupplier.Services[i].Endpoints = make([]*sharedtypes.SupplierEndpoint, 0) } expectedUnbondingBeginEvent := &suppliertypes.EventSupplierUnbondingBegin{ diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index c6ecd397a..722d328d6 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -112,7 +112,6 @@ func (k Keeper) SettlePendingClaims(ctx cosmostypes.Context) ( return settledResults, expiredResults, err } - proof, isProofFound := k.proofKeeper.GetProof(ctx, sessionId, claim.SupplierOperatorAddress) // Using the probabilistic proofs approach, determine if this expiring // claim required an onchain proof proofRequirement, err = k.proofKeeper.ProofRequirementForClaim(ctx, &claim) @@ -135,19 +134,25 @@ func (k Keeper) SettlePendingClaims(ctx cosmostypes.Context) ( proofIsRequired := proofRequirement != prooftypes.ProofRequirementReason_NOT_REQUIRED if proofIsRequired { - expirationReason := tokenomicstypes.ClaimExpirationReason_EXPIRATION_REASON_UNSPECIFIED // EXPIRATION_REASON_UNSPECIFIED is the default - - if isProofFound { - if err = k.proofKeeper.EnsureValidProof(ctx, &proof); err != nil { - logger.Warn(fmt.Sprintf("Proof was found but is invalid due to %v", err)) - expirationReason = tokenomicstypes.ClaimExpirationReason_PROOF_INVALID - } - } else { + // IMPORTANT: Proof validation and claims settlement timing: + // - Proof validation (proof end blocker): Executes WITHIN proof submission window + // - Claims settlement (tokenomics end blocker): Executes AFTER window closes + // This ensures proofs are validated before claims are settled + + var expirationReason tokenomicstypes.ClaimExpirationReason + switch claim.ProofValidationStatus { + // If the proof is required and not found, the claim is expired. + case prooftypes.ClaimProofStatus_PENDING_VALIDATION: expirationReason = tokenomicstypes.ClaimExpirationReason_PROOF_MISSING + // If the proof is required and invalid, the claim is expired. + case prooftypes.ClaimProofStatus_INVALID: + expirationReason = tokenomicstypes.ClaimExpirationReason_PROOF_INVALID + // If the proof is required and valid, the claim is settled. + case prooftypes.ClaimProofStatus_VALIDATED: + expirationReason = tokenomicstypes.ClaimExpirationReason_EXPIRATION_REASON_UNSPECIFIED } - // If the proof is missing or invalid -> expire it - if expirationReason != tokenomicstypes.ClaimExpirationReason_EXPIRATION_REASON_UNSPECIFIED { + if claim.ProofValidationStatus != prooftypes.ClaimProofStatus_VALIDATED { // TODO_BETA(@red-0ne): Slash the supplier in proportion to their stake. // TODO_POST_MAINNET: Consider allowing suppliers to RemoveClaim via a new // message in case it was sent by accident @@ -177,12 +182,8 @@ func (k Keeper) SettlePendingClaims(ctx cosmostypes.Context) ( // have other valid claims and the protocol might want to touch the supplier // owner or operator balances if the stake is negative. - // The claim & proof are no longer necessary, so there's no need for them - // to take up onchain space. + // The claim is no longer necessary, so there's no need for it to take up onchain space. k.proofKeeper.RemoveClaim(ctx, sessionId, claim.SupplierOperatorAddress) - if isProofFound { - k.proofKeeper.RemoveProof(ctx, sessionId, claim.SupplierOperatorAddress) - } // Append the settlement result to the expired results. expiredResults.Append(ClaimSettlementResult) @@ -245,13 +246,6 @@ func (k Keeper) SettlePendingClaims(ctx cosmostypes.Context) ( // The claim & proof are no longer necessary, so there's no need for them // to take up onchain space. k.proofKeeper.RemoveClaim(ctx, sessionId, claim.SupplierOperatorAddress) - // Whether or not the proof is required, the supplier may have submitted one - // so we need to delete it either way. If we don't have the if structure, - // a safe error will be printed, but it can be confusing to the operator - // or developer. - if isProofFound { - k.proofKeeper.RemoveProof(ctx, sessionId, claim.SupplierOperatorAddress) - } logger.Debug(fmt.Sprintf("Successfully settled claim for session ID %q at block height %d", claim.SessionHeader.SessionId, blockHeight)) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index 9d555f4e2..dac960fa4 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -56,10 +56,10 @@ type ProofKeeper interface { RemoveProof(ctx context.Context, sessionId, supplierOperatorAddr string) AllClaims(ctx context.Context, req *prooftypes.QueryAllClaimsRequest) (*prooftypes.QueryAllClaimsResponse, error) - EnsureValidProof(ctx context.Context, proof *prooftypes.Proof) error ProofRequirementForClaim(ctx context.Context, claim *prooftypes.Claim) (prooftypes.ProofRequirementReason, error) // Only used for testing & simulation + ValidateSubmittedProofs(ctx cosmostypes.Context) (numValidProofs, numInvalidProofs uint64, err error) GetAllProofs(ctx context.Context) []prooftypes.Proof UpsertClaim(ctx context.Context, claim prooftypes.Claim) UpsertProof(ctx context.Context, claim prooftypes.Proof)