From c79b7bea7d4d24f73560ee7766f7b876183a0607 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 28 Feb 2024 04:34:58 +0000 Subject: [PATCH] Setup hooks between laconic modules (#9) - Implement auction and bond module hooks in registry module - Code cleanup Reviewed-on: https://git.vdb.to/deep-stack/laconic2d/pulls/9 Co-authored-by: Prathamesh Musale Co-committed-by: Prathamesh Musale --- api/cerc/auction/v1/query.pulsar.go | 6 +- api/cerc/auction/v1/tx.pulsar.go | 4 +- api/cerc/registry/v1/registry.pulsar.go | 1781 +---------------------- app/app.go | 4 +- go.mod | 2 +- proto/cerc/auction/v1/query.proto | 6 +- proto/cerc/auction/v1/tx.proto | 4 +- proto/cerc/registry/v1/registry.proto | 16 - scripts/init.sh | 1 + x/auction/events.go | 2 +- x/auction/expected_keeper.go | 21 + x/auction/keeper/keeper.go | 110 +- x/auction/keeper/msg_server.go | 8 +- x/auction/keeper/query_server.go | 4 +- x/auction/module/abci.go | 2 +- x/auction/module/depinject.go | 31 +- x/auction/module/module.go | 6 +- x/auction/msgs.go | 4 +- x/auction/query.pb.go | 6 +- x/auction/tx.pb.go | 4 +- x/auction/types.go | 4 +- x/bond/expected_keeper.go | 19 + x/bond/keeper/keeper.go | 28 +- x/bond/keeper/msg_server.go | 4 +- x/bond/keeper/query_server.go | 4 +- x/bond/module/depinject.go | 27 +- x/bond/module/module.go | 6 +- x/registry/keeper/genesis.go | 6 - x/registry/keeper/keeper.go | 47 +- x/registry/keeper/naming_keeper.go | 46 +- x/registry/keeper/record_keeper.go | 121 +- x/registry/module/depinject.go | 18 +- x/registry/registry.pb.go | 826 +---------- 33 files changed, 495 insertions(+), 2683 deletions(-) create mode 100644 x/auction/expected_keeper.go create mode 100644 x/bond/expected_keeper.go diff --git a/api/cerc/auction/v1/query.pulsar.go b/api/cerc/auction/v1/query.pulsar.go index 9eae3487..ff4466a4 100644 --- a/api/cerc/auction/v1/query.pulsar.go +++ b/api/cerc/auction/v1/query.pulsar.go @@ -7169,7 +7169,7 @@ type QueryAuctionRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Auction ID + // Auction id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -7243,7 +7243,7 @@ type QueryBidRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` // Bidder address Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` @@ -7326,7 +7326,7 @@ type QueryBidsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` } diff --git a/api/cerc/auction/v1/tx.pulsar.go b/api/cerc/auction/v1/tx.pulsar.go index 937a77a6..0ced8408 100644 --- a/api/cerc/auction/v1/tx.pulsar.go +++ b/api/cerc/auction/v1/tx.pulsar.go @@ -3371,7 +3371,7 @@ type MsgCommitBid struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` // Commit Hash CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` @@ -3463,7 +3463,7 @@ type MsgRevealBid struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` // Commit Hash Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty"` diff --git a/api/cerc/registry/v1/registry.pulsar.go b/api/cerc/registry/v1/registry.pulsar.go index 06aa874e..497fb74f 100644 --- a/api/cerc/registry/v1/registry.pulsar.go +++ b/api/cerc/registry/v1/registry.pulsar.go @@ -5586,1528 +5586,6 @@ func (x *fastReflection_Signature) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_BlockChangeSet_2_list)(nil) - -type _BlockChangeSet_2_list struct { - list *[]string -} - -func (x *_BlockChangeSet_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_BlockChangeSet_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_BlockChangeSet_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_BlockChangeSet_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_BlockChangeSet_2_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message BlockChangeSet at list field Records as it is not of Message kind")) -} - -func (x *_BlockChangeSet_2_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_BlockChangeSet_2_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_BlockChangeSet_2_list) IsValid() bool { - return x.list != nil -} - -var _ protoreflect.List = (*_BlockChangeSet_3_list)(nil) - -type _BlockChangeSet_3_list struct { - list *[]string -} - -func (x *_BlockChangeSet_3_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_BlockChangeSet_3_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_BlockChangeSet_3_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_BlockChangeSet_3_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_BlockChangeSet_3_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message BlockChangeSet at list field Auctions as it is not of Message kind")) -} - -func (x *_BlockChangeSet_3_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_BlockChangeSet_3_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_BlockChangeSet_3_list) IsValid() bool { - return x.list != nil -} - -var _ protoreflect.List = (*_BlockChangeSet_4_list)(nil) - -type _BlockChangeSet_4_list struct { - list *[]*AuctionBidInfo -} - -func (x *_BlockChangeSet_4_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_BlockChangeSet_4_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_BlockChangeSet_4_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AuctionBidInfo) - (*x.list)[i] = concreteValue -} - -func (x *_BlockChangeSet_4_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AuctionBidInfo) - *x.list = append(*x.list, concreteValue) -} - -func (x *_BlockChangeSet_4_list) AppendMutable() protoreflect.Value { - v := new(AuctionBidInfo) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_BlockChangeSet_4_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_BlockChangeSet_4_list) NewElement() protoreflect.Value { - v := new(AuctionBidInfo) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_BlockChangeSet_4_list) IsValid() bool { - return x.list != nil -} - -var _ protoreflect.List = (*_BlockChangeSet_5_list)(nil) - -type _BlockChangeSet_5_list struct { - list *[]string -} - -func (x *_BlockChangeSet_5_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_BlockChangeSet_5_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_BlockChangeSet_5_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_BlockChangeSet_5_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_BlockChangeSet_5_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message BlockChangeSet at list field Authorities as it is not of Message kind")) -} - -func (x *_BlockChangeSet_5_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_BlockChangeSet_5_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_BlockChangeSet_5_list) IsValid() bool { - return x.list != nil -} - -var _ protoreflect.List = (*_BlockChangeSet_6_list)(nil) - -type _BlockChangeSet_6_list struct { - list *[]string -} - -func (x *_BlockChangeSet_6_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_BlockChangeSet_6_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_BlockChangeSet_6_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_BlockChangeSet_6_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_BlockChangeSet_6_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message BlockChangeSet at list field Names as it is not of Message kind")) -} - -func (x *_BlockChangeSet_6_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_BlockChangeSet_6_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_BlockChangeSet_6_list) IsValid() bool { - return x.list != nil -} - -var ( - md_BlockChangeSet protoreflect.MessageDescriptor - fd_BlockChangeSet_height protoreflect.FieldDescriptor - fd_BlockChangeSet_records protoreflect.FieldDescriptor - fd_BlockChangeSet_auctions protoreflect.FieldDescriptor - fd_BlockChangeSet_auction_bids protoreflect.FieldDescriptor - fd_BlockChangeSet_authorities protoreflect.FieldDescriptor - fd_BlockChangeSet_names protoreflect.FieldDescriptor -) - -func init() { - file_cerc_registry_v1_registry_proto_init() - md_BlockChangeSet = File_cerc_registry_v1_registry_proto.Messages().ByName("BlockChangeSet") - fd_BlockChangeSet_height = md_BlockChangeSet.Fields().ByName("height") - fd_BlockChangeSet_records = md_BlockChangeSet.Fields().ByName("records") - fd_BlockChangeSet_auctions = md_BlockChangeSet.Fields().ByName("auctions") - fd_BlockChangeSet_auction_bids = md_BlockChangeSet.Fields().ByName("auction_bids") - fd_BlockChangeSet_authorities = md_BlockChangeSet.Fields().ByName("authorities") - fd_BlockChangeSet_names = md_BlockChangeSet.Fields().ByName("names") -} - -var _ protoreflect.Message = (*fastReflection_BlockChangeSet)(nil) - -type fastReflection_BlockChangeSet BlockChangeSet - -func (x *BlockChangeSet) ProtoReflect() protoreflect.Message { - return (*fastReflection_BlockChangeSet)(x) -} - -func (x *BlockChangeSet) slowProtoReflect() protoreflect.Message { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[8] - 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_BlockChangeSet_messageType fastReflection_BlockChangeSet_messageType -var _ protoreflect.MessageType = fastReflection_BlockChangeSet_messageType{} - -type fastReflection_BlockChangeSet_messageType struct{} - -func (x fastReflection_BlockChangeSet_messageType) Zero() protoreflect.Message { - return (*fastReflection_BlockChangeSet)(nil) -} -func (x fastReflection_BlockChangeSet_messageType) New() protoreflect.Message { - return new(fastReflection_BlockChangeSet) -} -func (x fastReflection_BlockChangeSet_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_BlockChangeSet -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_BlockChangeSet) Descriptor() protoreflect.MessageDescriptor { - return md_BlockChangeSet -} - -// 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_BlockChangeSet) Type() protoreflect.MessageType { - return _fastReflection_BlockChangeSet_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_BlockChangeSet) New() protoreflect.Message { - return new(fastReflection_BlockChangeSet) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_BlockChangeSet) Interface() protoreflect.ProtoMessage { - return (*BlockChangeSet)(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_BlockChangeSet) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Height != int64(0) { - value := protoreflect.ValueOfInt64(x.Height) - if !f(fd_BlockChangeSet_height, value) { - return - } - } - if len(x.Records) != 0 { - value := protoreflect.ValueOfList(&_BlockChangeSet_2_list{list: &x.Records}) - if !f(fd_BlockChangeSet_records, value) { - return - } - } - if len(x.Auctions) != 0 { - value := protoreflect.ValueOfList(&_BlockChangeSet_3_list{list: &x.Auctions}) - if !f(fd_BlockChangeSet_auctions, value) { - return - } - } - if len(x.AuctionBids) != 0 { - value := protoreflect.ValueOfList(&_BlockChangeSet_4_list{list: &x.AuctionBids}) - if !f(fd_BlockChangeSet_auction_bids, value) { - return - } - } - if len(x.Authorities) != 0 { - value := protoreflect.ValueOfList(&_BlockChangeSet_5_list{list: &x.Authorities}) - if !f(fd_BlockChangeSet_authorities, value) { - return - } - } - if len(x.Names) != 0 { - value := protoreflect.ValueOfList(&_BlockChangeSet_6_list{list: &x.Names}) - if !f(fd_BlockChangeSet_names, 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_BlockChangeSet) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cerc.registry.v1.BlockChangeSet.height": - return x.Height != int64(0) - case "cerc.registry.v1.BlockChangeSet.records": - return len(x.Records) != 0 - case "cerc.registry.v1.BlockChangeSet.auctions": - return len(x.Auctions) != 0 - case "cerc.registry.v1.BlockChangeSet.auction_bids": - return len(x.AuctionBids) != 0 - case "cerc.registry.v1.BlockChangeSet.authorities": - return len(x.Authorities) != 0 - case "cerc.registry.v1.BlockChangeSet.names": - return len(x.Names) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cerc.registry.v1.BlockChangeSet.height": - x.Height = int64(0) - case "cerc.registry.v1.BlockChangeSet.records": - x.Records = nil - case "cerc.registry.v1.BlockChangeSet.auctions": - x.Auctions = nil - case "cerc.registry.v1.BlockChangeSet.auction_bids": - x.AuctionBids = nil - case "cerc.registry.v1.BlockChangeSet.authorities": - x.Authorities = nil - case "cerc.registry.v1.BlockChangeSet.names": - x.Names = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cerc.registry.v1.BlockChangeSet.height": - value := x.Height - return protoreflect.ValueOfInt64(value) - case "cerc.registry.v1.BlockChangeSet.records": - if len(x.Records) == 0 { - return protoreflect.ValueOfList(&_BlockChangeSet_2_list{}) - } - listValue := &_BlockChangeSet_2_list{list: &x.Records} - return protoreflect.ValueOfList(listValue) - case "cerc.registry.v1.BlockChangeSet.auctions": - if len(x.Auctions) == 0 { - return protoreflect.ValueOfList(&_BlockChangeSet_3_list{}) - } - listValue := &_BlockChangeSet_3_list{list: &x.Auctions} - return protoreflect.ValueOfList(listValue) - case "cerc.registry.v1.BlockChangeSet.auction_bids": - if len(x.AuctionBids) == 0 { - return protoreflect.ValueOfList(&_BlockChangeSet_4_list{}) - } - listValue := &_BlockChangeSet_4_list{list: &x.AuctionBids} - return protoreflect.ValueOfList(listValue) - case "cerc.registry.v1.BlockChangeSet.authorities": - if len(x.Authorities) == 0 { - return protoreflect.ValueOfList(&_BlockChangeSet_5_list{}) - } - listValue := &_BlockChangeSet_5_list{list: &x.Authorities} - return protoreflect.ValueOfList(listValue) - case "cerc.registry.v1.BlockChangeSet.names": - if len(x.Names) == 0 { - return protoreflect.ValueOfList(&_BlockChangeSet_6_list{}) - } - listValue := &_BlockChangeSet_6_list{list: &x.Names} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cerc.registry.v1.BlockChangeSet.height": - x.Height = value.Int() - case "cerc.registry.v1.BlockChangeSet.records": - lv := value.List() - clv := lv.(*_BlockChangeSet_2_list) - x.Records = *clv.list - case "cerc.registry.v1.BlockChangeSet.auctions": - lv := value.List() - clv := lv.(*_BlockChangeSet_3_list) - x.Auctions = *clv.list - case "cerc.registry.v1.BlockChangeSet.auction_bids": - lv := value.List() - clv := lv.(*_BlockChangeSet_4_list) - x.AuctionBids = *clv.list - case "cerc.registry.v1.BlockChangeSet.authorities": - lv := value.List() - clv := lv.(*_BlockChangeSet_5_list) - x.Authorities = *clv.list - case "cerc.registry.v1.BlockChangeSet.names": - lv := value.List() - clv := lv.(*_BlockChangeSet_6_list) - x.Names = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cerc.registry.v1.BlockChangeSet.records": - if x.Records == nil { - x.Records = []string{} - } - value := &_BlockChangeSet_2_list{list: &x.Records} - return protoreflect.ValueOfList(value) - case "cerc.registry.v1.BlockChangeSet.auctions": - if x.Auctions == nil { - x.Auctions = []string{} - } - value := &_BlockChangeSet_3_list{list: &x.Auctions} - return protoreflect.ValueOfList(value) - case "cerc.registry.v1.BlockChangeSet.auction_bids": - if x.AuctionBids == nil { - x.AuctionBids = []*AuctionBidInfo{} - } - value := &_BlockChangeSet_4_list{list: &x.AuctionBids} - return protoreflect.ValueOfList(value) - case "cerc.registry.v1.BlockChangeSet.authorities": - if x.Authorities == nil { - x.Authorities = []string{} - } - value := &_BlockChangeSet_5_list{list: &x.Authorities} - return protoreflect.ValueOfList(value) - case "cerc.registry.v1.BlockChangeSet.names": - if x.Names == nil { - x.Names = []string{} - } - value := &_BlockChangeSet_6_list{list: &x.Names} - return protoreflect.ValueOfList(value) - case "cerc.registry.v1.BlockChangeSet.height": - panic(fmt.Errorf("field height of message cerc.registry.v1.BlockChangeSet is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cerc.registry.v1.BlockChangeSet.height": - return protoreflect.ValueOfInt64(int64(0)) - case "cerc.registry.v1.BlockChangeSet.records": - list := []string{} - return protoreflect.ValueOfList(&_BlockChangeSet_2_list{list: &list}) - case "cerc.registry.v1.BlockChangeSet.auctions": - list := []string{} - return protoreflect.ValueOfList(&_BlockChangeSet_3_list{list: &list}) - case "cerc.registry.v1.BlockChangeSet.auction_bids": - list := []*AuctionBidInfo{} - return protoreflect.ValueOfList(&_BlockChangeSet_4_list{list: &list}) - case "cerc.registry.v1.BlockChangeSet.authorities": - list := []string{} - return protoreflect.ValueOfList(&_BlockChangeSet_5_list{list: &list}) - case "cerc.registry.v1.BlockChangeSet.names": - list := []string{} - return protoreflect.ValueOfList(&_BlockChangeSet_6_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.BlockChangeSet")) - } - panic(fmt.Errorf("message cerc.registry.v1.BlockChangeSet 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_BlockChangeSet) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cerc.registry.v1.BlockChangeSet", 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_BlockChangeSet) 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_BlockChangeSet) 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_BlockChangeSet) 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_BlockChangeSet) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*BlockChangeSet) - 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.Height != 0 { - n += 1 + runtime.Sov(uint64(x.Height)) - } - if len(x.Records) > 0 { - for _, s := range x.Records { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.Auctions) > 0 { - for _, s := range x.Auctions { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.AuctionBids) > 0 { - for _, e := range x.AuctionBids { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.Authorities) > 0 { - for _, s := range x.Authorities { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.Names) > 0 { - for _, s := range x.Names { - l = len(s) - 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().(*BlockChangeSet) - 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.Names) > 0 { - for iNdEx := len(x.Names) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Names[iNdEx]) - copy(dAtA[i:], x.Names[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Names[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(x.Authorities) > 0 { - for iNdEx := len(x.Authorities) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Authorities[iNdEx]) - copy(dAtA[i:], x.Authorities[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authorities[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if len(x.AuctionBids) > 0 { - for iNdEx := len(x.AuctionBids) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.AuctionBids[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] = 0x22 - } - } - if len(x.Auctions) > 0 { - for iNdEx := len(x.Auctions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Auctions[iNdEx]) - copy(dAtA[i:], x.Auctions[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Auctions[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(x.Records) > 0 { - for iNdEx := len(x.Records) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Records[iNdEx]) - copy(dAtA[i:], x.Records[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Records[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if x.Height != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Height)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*BlockChangeSet) - 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: BlockChangeSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BlockChangeSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - x.Height = 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.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Records", 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.Records = append(x.Records, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Auctions", 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.Auctions = append(x.Auctions, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AuctionBids", 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.AuctionBids = append(x.AuctionBids, &AuctionBidInfo{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AuctionBids[len(x.AuctionBids)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authorities", 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.Authorities = append(x.Authorities, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Names", 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.Names = append(x.Names, 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_AuctionBidInfo protoreflect.MessageDescriptor - fd_AuctionBidInfo_auction_id protoreflect.FieldDescriptor - fd_AuctionBidInfo_bidder_address protoreflect.FieldDescriptor -) - -func init() { - file_cerc_registry_v1_registry_proto_init() - md_AuctionBidInfo = File_cerc_registry_v1_registry_proto.Messages().ByName("AuctionBidInfo") - fd_AuctionBidInfo_auction_id = md_AuctionBidInfo.Fields().ByName("auction_id") - fd_AuctionBidInfo_bidder_address = md_AuctionBidInfo.Fields().ByName("bidder_address") -} - -var _ protoreflect.Message = (*fastReflection_AuctionBidInfo)(nil) - -type fastReflection_AuctionBidInfo AuctionBidInfo - -func (x *AuctionBidInfo) ProtoReflect() protoreflect.Message { - return (*fastReflection_AuctionBidInfo)(x) -} - -func (x *AuctionBidInfo) slowProtoReflect() protoreflect.Message { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[9] - 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_AuctionBidInfo_messageType fastReflection_AuctionBidInfo_messageType -var _ protoreflect.MessageType = fastReflection_AuctionBidInfo_messageType{} - -type fastReflection_AuctionBidInfo_messageType struct{} - -func (x fastReflection_AuctionBidInfo_messageType) Zero() protoreflect.Message { - return (*fastReflection_AuctionBidInfo)(nil) -} -func (x fastReflection_AuctionBidInfo_messageType) New() protoreflect.Message { - return new(fastReflection_AuctionBidInfo) -} -func (x fastReflection_AuctionBidInfo_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AuctionBidInfo -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AuctionBidInfo) Descriptor() protoreflect.MessageDescriptor { - return md_AuctionBidInfo -} - -// 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_AuctionBidInfo) Type() protoreflect.MessageType { - return _fastReflection_AuctionBidInfo_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AuctionBidInfo) New() protoreflect.Message { - return new(fastReflection_AuctionBidInfo) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AuctionBidInfo) Interface() protoreflect.ProtoMessage { - return (*AuctionBidInfo)(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_AuctionBidInfo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.AuctionId != "" { - value := protoreflect.ValueOfString(x.AuctionId) - if !f(fd_AuctionBidInfo_auction_id, value) { - return - } - } - if x.BidderAddress != "" { - value := protoreflect.ValueOfString(x.BidderAddress) - if !f(fd_AuctionBidInfo_bidder_address, 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_AuctionBidInfo) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - return x.AuctionId != "" - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - return x.BidderAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - x.AuctionId = "" - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - x.BidderAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - value := x.AuctionId - return protoreflect.ValueOfString(value) - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - value := x.BidderAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - x.AuctionId = value.Interface().(string) - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - x.BidderAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - panic(fmt.Errorf("field auction_id of message cerc.registry.v1.AuctionBidInfo is not mutable")) - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - panic(fmt.Errorf("field bidder_address of message cerc.registry.v1.AuctionBidInfo is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "cerc.registry.v1.AuctionBidInfo.auction_id": - return protoreflect.ValueOfString("") - case "cerc.registry.v1.AuctionBidInfo.bidder_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.registry.v1.AuctionBidInfo")) - } - panic(fmt.Errorf("message cerc.registry.v1.AuctionBidInfo 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_AuctionBidInfo) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in cerc.registry.v1.AuctionBidInfo", 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_AuctionBidInfo) 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_AuctionBidInfo) 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_AuctionBidInfo) 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_AuctionBidInfo) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AuctionBidInfo) - 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.AuctionId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.BidderAddress) - 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().(*AuctionBidInfo) - 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.BidderAddress) > 0 { - i -= len(x.BidderAddress) - copy(dAtA[i:], x.BidderAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BidderAddress))) - i-- - dAtA[i] = 0x12 - } - if len(x.AuctionId) > 0 { - i -= len(x.AuctionId) - copy(dAtA[i:], x.AuctionId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AuctionId))) - 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().(*AuctionBidInfo) - 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: AuctionBidInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AuctionBidInfo: 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 AuctionId", 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.AuctionId = 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 BidderAddress", 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.BidderAddress = 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 _ protoreflect.List = (*_ExpiryQueue_2_list)(nil) type _ExpiryQueue_2_list struct { @@ -7176,7 +5654,7 @@ func (x *ExpiryQueue) ProtoReflect() protoreflect.Message { } func (x *ExpiryQueue) slowProtoReflect() protoreflect.Message { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[10] + mi := &file_cerc_registry_v1_registry_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8188,126 +6666,6 @@ func (x *Signature) GetPubKey() string { return "" } -// BlockChangeSet -type BlockChangeSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Records []string `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"` - Auctions []string `protobuf:"bytes,3,rep,name=auctions,proto3" json:"auctions,omitempty"` - AuctionBids []*AuctionBidInfo `protobuf:"bytes,4,rep,name=auction_bids,json=auctionBids,proto3" json:"auction_bids,omitempty"` - Authorities []string `protobuf:"bytes,5,rep,name=authorities,proto3" json:"authorities,omitempty"` - Names []string `protobuf:"bytes,6,rep,name=names,proto3" json:"names,omitempty"` -} - -func (x *BlockChangeSet) Reset() { - *x = BlockChangeSet{} - if protoimpl.UnsafeEnabled { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BlockChangeSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BlockChangeSet) ProtoMessage() {} - -// Deprecated: Use BlockChangeSet.ProtoReflect.Descriptor instead. -func (*BlockChangeSet) Descriptor() ([]byte, []int) { - return file_cerc_registry_v1_registry_proto_rawDescGZIP(), []int{8} -} - -func (x *BlockChangeSet) GetHeight() int64 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *BlockChangeSet) GetRecords() []string { - if x != nil { - return x.Records - } - return nil -} - -func (x *BlockChangeSet) GetAuctions() []string { - if x != nil { - return x.Auctions - } - return nil -} - -func (x *BlockChangeSet) GetAuctionBids() []*AuctionBidInfo { - if x != nil { - return x.AuctionBids - } - return nil -} - -func (x *BlockChangeSet) GetAuthorities() []string { - if x != nil { - return x.Authorities - } - return nil -} - -func (x *BlockChangeSet) GetNames() []string { - if x != nil { - return x.Names - } - return nil -} - -// AuctionBidInfo -type AuctionBidInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` - BidderAddress string `protobuf:"bytes,2,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty"` -} - -func (x *AuctionBidInfo) Reset() { - *x = AuctionBidInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuctionBidInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuctionBidInfo) ProtoMessage() {} - -// Deprecated: Use AuctionBidInfo.ProtoReflect.Descriptor instead. -func (*AuctionBidInfo) Descriptor() ([]byte, []int) { - return file_cerc_registry_v1_registry_proto_rawDescGZIP(), []int{9} -} - -func (x *AuctionBidInfo) GetAuctionId() string { - if x != nil { - return x.AuctionId - } - return "" -} - -func (x *AuctionBidInfo) GetBidderAddress() string { - if x != nil { - return x.BidderAddress - } - return "" -} - // ExpiryQueue: record / authority expiry queue type // id: expiry time // value: array of ids (record cids / authority names) @@ -8323,7 +6681,7 @@ type ExpiryQueue struct { func (x *ExpiryQueue) Reset() { *x = ExpiryQueue{} if protoimpl.UnsafeEnabled { - mi := &file_cerc_registry_v1_registry_proto_msgTypes[10] + mi := &file_cerc_registry_v1_registry_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8337,7 +6695,7 @@ func (*ExpiryQueue) ProtoMessage() {} // Deprecated: Use ExpiryQueue.ProtoReflect.Descriptor instead. func (*ExpiryQueue) Descriptor() ([]byte, []int) { - return file_cerc_registry_v1_registry_proto_rawDescGZIP(), []int{10} + return file_cerc_registry_v1_registry_proto_rawDescGZIP(), []int{8} } func (x *ExpiryQueue) GetId() string { @@ -8571,51 +6929,23 @@ var file_cerc_registry_v1_registry_proto_rawDesc = []byte{ 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xf2, 0xde, 0x1f, 0x1d, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, - 0x22, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x88, 0x02, 0x0a, 0x0e, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x70, 0x0a, 0x0c, 0x61, 0x75, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x64, 0x49, 0x6e, - 0x66, 0x6f, 0x42, 0x2b, 0xf2, 0xde, 0x1f, 0x27, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x69, 0x64, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, - 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x69, 0x64, 0x73, 0x22, 0x52, - 0x0b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x64, 0x73, 0x12, 0x20, 0x0a, 0x0b, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x0e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x69, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x75, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xf2, 0xde, 0x1f, - 0x23, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x22, 0x52, 0x09, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, - 0x56, 0x0a, 0x0e, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2f, 0xf2, 0xde, 0x1f, 0x2b, 0x6a, 0x73, 0x6f, - 0x6e, 0x3a, 0x22, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0d, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x33, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x69, 0x72, - 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xc5, 0x01, 0x0a, - 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, - 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, - 0x69, 0x63, 0x32, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x79, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x52, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x65, 0x72, - 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, - 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x1c, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x12, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x33, 0x0a, 0x0b, 0x45, 0x78, 0x70, + 0x69, 0x72, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xc5, + 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, + 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, + 0x6f, 0x6e, 0x69, 0x63, 0x32, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x52, 0x58, 0xaa, 0x02, 0x10, 0x43, + 0x65, 0x72, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x10, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x12, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -8630,7 +6960,7 @@ func file_cerc_registry_v1_registry_proto_rawDescGZIP() []byte { return file_cerc_registry_v1_registry_proto_rawDescData } -var file_cerc_registry_v1_registry_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_cerc_registry_v1_registry_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_cerc_registry_v1_registry_proto_goTypes = []interface{}{ (*Params)(nil), // 0: cerc.registry.v1.Params (*Record)(nil), // 1: cerc.registry.v1.Record @@ -8640,35 +6970,32 @@ var file_cerc_registry_v1_registry_proto_goTypes = []interface{}{ (*NameRecord)(nil), // 5: cerc.registry.v1.NameRecord (*NameRecordEntry)(nil), // 6: cerc.registry.v1.NameRecordEntry (*Signature)(nil), // 7: cerc.registry.v1.Signature - (*BlockChangeSet)(nil), // 8: cerc.registry.v1.BlockChangeSet - (*AuctionBidInfo)(nil), // 9: cerc.registry.v1.AuctionBidInfo - (*ExpiryQueue)(nil), // 10: cerc.registry.v1.ExpiryQueue - (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin - (*durationpb.Duration)(nil), // 12: google.protobuf.Duration - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*ExpiryQueue)(nil), // 8: cerc.registry.v1.ExpiryQueue + (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin + (*durationpb.Duration)(nil), // 10: google.protobuf.Duration + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp } var file_cerc_registry_v1_registry_proto_depIdxs = []int32{ - 11, // 0: cerc.registry.v1.Params.record_rent:type_name -> cosmos.base.v1beta1.Coin - 12, // 1: cerc.registry.v1.Params.record_rent_duration:type_name -> google.protobuf.Duration - 11, // 2: cerc.registry.v1.Params.authority_rent:type_name -> cosmos.base.v1beta1.Coin - 12, // 3: cerc.registry.v1.Params.authority_rent_duration:type_name -> google.protobuf.Duration - 12, // 4: cerc.registry.v1.Params.authority_grace_period:type_name -> google.protobuf.Duration - 12, // 5: cerc.registry.v1.Params.authority_auction_commits_duration:type_name -> google.protobuf.Duration - 12, // 6: cerc.registry.v1.Params.authority_auction_reveals_duration:type_name -> google.protobuf.Duration - 11, // 7: cerc.registry.v1.Params.authority_auction_commit_fee:type_name -> cosmos.base.v1beta1.Coin - 11, // 8: cerc.registry.v1.Params.authority_auction_reveal_fee:type_name -> cosmos.base.v1beta1.Coin - 11, // 9: cerc.registry.v1.Params.authority_auction_minimum_bid:type_name -> cosmos.base.v1beta1.Coin + 9, // 0: cerc.registry.v1.Params.record_rent:type_name -> cosmos.base.v1beta1.Coin + 10, // 1: cerc.registry.v1.Params.record_rent_duration:type_name -> google.protobuf.Duration + 9, // 2: cerc.registry.v1.Params.authority_rent:type_name -> cosmos.base.v1beta1.Coin + 10, // 3: cerc.registry.v1.Params.authority_rent_duration:type_name -> google.protobuf.Duration + 10, // 4: cerc.registry.v1.Params.authority_grace_period:type_name -> google.protobuf.Duration + 10, // 5: cerc.registry.v1.Params.authority_auction_commits_duration:type_name -> google.protobuf.Duration + 10, // 6: cerc.registry.v1.Params.authority_auction_reveals_duration:type_name -> google.protobuf.Duration + 9, // 7: cerc.registry.v1.Params.authority_auction_commit_fee:type_name -> cosmos.base.v1beta1.Coin + 9, // 8: cerc.registry.v1.Params.authority_auction_reveal_fee:type_name -> cosmos.base.v1beta1.Coin + 9, // 9: cerc.registry.v1.Params.authority_auction_minimum_bid:type_name -> cosmos.base.v1beta1.Coin 3, // 10: cerc.registry.v1.AuthorityEntry.entry:type_name -> cerc.registry.v1.NameAuthority - 13, // 11: cerc.registry.v1.NameAuthority.expiry_time:type_name -> google.protobuf.Timestamp + 11, // 11: cerc.registry.v1.NameAuthority.expiry_time:type_name -> google.protobuf.Timestamp 5, // 12: cerc.registry.v1.NameEntry.entry:type_name -> cerc.registry.v1.NameRecord 6, // 13: cerc.registry.v1.NameRecord.latest:type_name -> cerc.registry.v1.NameRecordEntry 6, // 14: cerc.registry.v1.NameRecord.history:type_name -> cerc.registry.v1.NameRecordEntry - 9, // 15: cerc.registry.v1.BlockChangeSet.auction_bids:type_name -> cerc.registry.v1.AuctionBidInfo - 16, // [16:16] is the sub-list for method output_type - 16, // [16:16] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_cerc_registry_v1_registry_proto_init() } @@ -8774,30 +7101,6 @@ func file_cerc_registry_v1_registry_proto_init() { } } file_cerc_registry_v1_registry_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BlockChangeSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cerc_registry_v1_registry_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuctionBidInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cerc_registry_v1_registry_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExpiryQueue); i { case 0: return &v.state @@ -8816,7 +7119,7 @@ func file_cerc_registry_v1_registry_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cerc_registry_v1_registry_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/app/app.go b/app/app.go index d83c40cf..13bcb96b 100644 --- a/app/app.go +++ b/app/app.go @@ -76,8 +76,8 @@ type LaconicApp struct { ConsensusParamsKeeper consensuskeeper.Keeper // laconic keepers - AuctionKeeper auctionkeeper.Keeper - BondKeeper bondkeeper.Keeper + AuctionKeeper *auctionkeeper.Keeper // (Use * as per ProvideModule implementation) + BondKeeper *bondkeeper.Keeper RegistryKeeper registrykeeper.Keeper // RegistryRecordKeeper registrykeeper.RecordKeeper diff --git a/go.mod b/go.mod index e29a85a6..e4386920 100644 --- a/go.mod +++ b/go.mod @@ -37,6 +37,7 @@ require ( github.com/ipld/go-ipld-prime v0.21.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.17.0 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -169,7 +170,6 @@ require ( go.etcd.io/bbolt v1.3.8 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.16.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.15.0 // indirect diff --git a/proto/cerc/auction/v1/query.proto b/proto/cerc/auction/v1/query.proto index 7d3575b7..cd88fc20 100644 --- a/proto/cerc/auction/v1/query.proto +++ b/proto/cerc/auction/v1/query.proto @@ -77,7 +77,7 @@ message QueryAuctionsResponse { // AuctionRequest is the format for querying a specific auction message QueryAuctionRequest { - // Auction ID + // Auction id string id = 1; } @@ -89,7 +89,7 @@ message QueryAuctionResponse { // BidRequest is the format for querying a specific bid in an auction message QueryBidRequest { - // Auction ID + // Auction id string auction_id = 1; // Bidder address string bidder = 2; @@ -103,7 +103,7 @@ message QueryBidResponse { // BidsRequest is the format for querying all bids in an auction message QueryBidsRequest { - // Auction ID + // Auction id string auction_id = 1; } diff --git a/proto/cerc/auction/v1/tx.proto b/proto/cerc/auction/v1/tx.proto index 33dc750e..ee6a7148 100644 --- a/proto/cerc/auction/v1/tx.proto +++ b/proto/cerc/auction/v1/tx.proto @@ -85,7 +85,7 @@ message MsgCommitBid { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // Auction ID + // Auction id string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; // Commit Hash @@ -109,7 +109,7 @@ message MsgRevealBid { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // Auction ID + // Auction id string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; // Commit Hash diff --git a/proto/cerc/registry/v1/registry.proto b/proto/cerc/registry/v1/registry.proto index 6861ecb7..001a6ea5 100644 --- a/proto/cerc/registry/v1/registry.proto +++ b/proto/cerc/registry/v1/registry.proto @@ -131,22 +131,6 @@ message Signature { string pub_key = 2 [(gogoproto.moretags) = "json:\"pub_key\" yaml:\"pub_key\""]; } -// BlockChangeSet -message BlockChangeSet { - int64 height = 1; - repeated string records = 2; - repeated string auctions = 3; - repeated AuctionBidInfo auction_bids = 4 [(gogoproto.moretags) = "json:\"auction_bids\" yaml:\"auction_bids\""]; - repeated string authorities = 5; - repeated string names = 6; -} - -// AuctionBidInfo -message AuctionBidInfo { - string auction_id = 1 [(gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\""]; - string bidder_address = 2 [(gogoproto.moretags) = "json:\"bidder_address\" yaml:\"bidder_address\""]; -} - // ExpiryQueue: record / authority expiry queue type // id: expiry time // value: array of ids (record cids / authority names) diff --git a/scripts/init.sh b/scripts/init.sh index 0f9a788a..abde54cd 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -3,6 +3,7 @@ rm -r ~/.laconic2d || true LACONIC2D_BIN=$(which laconic2d) # configure laconic2d +$LACONIC2D_BIN config set config log_level "*:error,p2p:info,state:info,auction:info,bond:info,registry:info" --skip-validate $LACONIC2D_BIN config set client chain-id demo $LACONIC2D_BIN config set client keyring-backend test $LACONIC2D_BIN keys add alice diff --git a/x/auction/events.go b/x/auction/events.go index af130741..b60264f5 100644 --- a/x/auction/events.go +++ b/x/auction/events.go @@ -11,7 +11,7 @@ const ( AttributeKeyRevealFee = "reveal-fee" AttributeKeyMinimumBid = "minimum-bid" AttributeKeySigner = "signer" - AttributeKeyAuctionID = "auction-id" + AttributeKeyAuctionId = "auction-id" AttributeKeyCommitHash = "commit-hash" AttributeKeyReveal = "reveal" diff --git a/x/auction/expected_keeper.go b/x/auction/expected_keeper.go new file mode 100644 index 00000000..c158245c --- /dev/null +++ b/x/auction/expected_keeper.go @@ -0,0 +1,21 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AuctionUsageKeeper keep track of auction usage in other modules. +// Used to, for example, prevent deletion of a auction that's in use. +type AuctionUsageKeeper interface { + ModuleName() string + UsesAuction(ctx sdk.Context, auctionId string) bool + + OnAuctionWinnerSelected(ctx sdk.Context, auctionId string) +} + +// AuctionHooksWrapper is a wrapper for modules to inject AuctionUsageKeeper using depinject. +// Reference: https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/core/appmodule#resolving-circular-dependencies +type AuctionHooksWrapper struct{ AuctionUsageKeeper } + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AuctionHooksWrapper) IsOnePerModuleType() {} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index e9ae55fd..edcb72ba 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/collections/indexes" storetypes "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -62,8 +63,6 @@ func newBidsIndexes(sb *collections.SchemaBuilder) BidsIndexes { } } -// TODO: Add required methods - type Keeper struct { // Codecs cdc codec.BinaryCodec @@ -73,7 +72,7 @@ type Keeper struct { bankKeeper bank.Keeper // Track auction usage in other cosmos-sdk modules (more like a usage tracker). - // usageKeepers []types.AuctionUsageKeeper + usageKeepers []auctiontypes.AuctionUsageKeeper // state management Schema collections.Schema @@ -88,7 +87,7 @@ func NewKeeper( storeService storetypes.KVStoreService, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, -) Keeper { +) *Keeper { sb := collections.NewSchemaBuilder(storeService) k := Keeper{ cdc: cdc, @@ -97,7 +96,7 @@ func NewKeeper( Params: collections.NewItem(sb, auctiontypes.ParamsPrefix, "params", codec.CollValue[auctiontypes.Params](cdc)), Auctions: collections.NewIndexedMap(sb, auctiontypes.AuctionsPrefix, "auctions", collections.StringKey, codec.CollValue[auctiontypes.Auction](cdc), newAuctionIndexes(sb)), Bids: collections.NewIndexedMap(sb, auctiontypes.BidsPrefix, "bids", collections.PairKeyCodec(collections.StringKey, collections.StringKey), codec.CollValue[auctiontypes.Bid](cdc), newBidsIndexes(sb)), - // usageKeepers: usageKeepers, + usageKeepers: nil, } schema, err := sb.Build() @@ -107,22 +106,29 @@ func NewKeeper( k.Schema = schema - return k + return &k } -// func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) { -// k.usageKeepers = usageKeepers -// } +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return logger(ctx) +} + +func logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", auctiontypes.ModuleName) +} + +func (k *Keeper) SetUsageKeepers(usageKeepers []auctiontypes.AuctionUsageKeeper) { + if k.usageKeepers != nil { + panic("cannot set auction hooks twice") + } + + k.usageKeepers = usageKeepers +} // SaveAuction - saves a auction to the store. func (k Keeper) SaveAuction(ctx sdk.Context, auction *auctiontypes.Auction) error { return k.Auctions.Set(ctx, auction.Id, *auction) - - // // Notify interested parties. - // for _, keeper := range k.usageKeepers { - // keeper.OnAuction(ctx, auction.Id) - // } - // return nil } // DeleteAuction - deletes the auction. @@ -154,12 +160,6 @@ func (k Keeper) HasAuction(ctx sdk.Context, id string) (bool, error) { func (k Keeper) SaveBid(ctx sdk.Context, bid *auctiontypes.Bid) error { key := collections.Join(bid.AuctionId, bid.BidderAddress) return k.Bids.Set(ctx, key, *bid) - - // // Notify interested parties. - // for _, keeper := range k.usageKeepers { - // keeper.OnAuctionBid(ctx, bid.AuctionId, bid.BidderAddress) - // } - // return nil } func (k Keeper) DeleteBid(ctx sdk.Context, bid auctiontypes.Bid) error { @@ -191,7 +191,6 @@ func (k Keeper) GetBid(ctx sdk.Context, id string, bidder string) (auctiontypes. func (k Keeper) GetBids(ctx sdk.Context, id string) ([]*auctiontypes.Bid, error) { var bids []*auctiontypes.Bid - // TODO: Optimize using return by value? err := k.Bids.Walk(ctx, collections.NewPrefixedPairRange[string, string](id), func(key collections.Pair[string, string], value auctiontypes.Bid) (stop bool, err error) { bids = append(bids, &value) return false, nil @@ -463,13 +462,13 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auct return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Reveal JSON unmarshal error.") } - chainID, err := wnsUtils.GetAttributeAsString(reveal, "chainId") - if err != nil || chainID != ctx.ChainID() { + chainId, err := wnsUtils.GetAttributeAsString(reveal, "chainId") + if err != nil || chainId != ctx.ChainID() { return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal chainID.") } - auctionID, err := wnsUtils.GetAttributeAsString(reveal, "auctionId") - if err != nil || auctionID != msg.AuctionId { + auctionId, err := wnsUtils.GetAttributeAsString(reveal, "auctionId") + if err != nil || auctionId != msg.AuctionId { return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal auction Id.") } @@ -557,7 +556,7 @@ func (k Keeper) processAuctionPhases(ctx sdk.Context) error { return err } - ctx.Logger().Info(fmt.Sprintf("Moved auction %s to reveal phase.", auction.Id)) + k.Logger(ctx).Info(fmt.Sprintf("Moved auction %s to reveal phase.", auction.Id)) } // Reveal -> Expired state. @@ -567,7 +566,7 @@ func (k Keeper) processAuctionPhases(ctx sdk.Context) error { return err } - ctx.Logger().Info(fmt.Sprintf("Moved auction %s to expired state.", auction.Id)) + k.Logger(ctx).Info(fmt.Sprintf("Moved auction %s to expired state.", auction.Id)) } // If auction has expired, pick a winner from revealed bids. @@ -592,7 +591,7 @@ func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) error { } for _, auction := range auctions { - ctx.Logger().Info(fmt.Sprintf("Deleting completed auction %s after timeout.", auction.Id)) + k.Logger(ctx).Info(fmt.Sprintf("Deleting completed auction %s after timeout.", auction.Id)) if err := k.DeleteAuction(ctx, *auction); err != nil { return err } @@ -602,7 +601,7 @@ func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) error { } func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction) error { - ctx.Logger().Info(fmt.Sprintf("Picking auction %s winner.", auction.Id)) + k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winner.", auction.Id)) var highestBid *auctiontypes.Bid var secondHighestBid *auctiontypes.Bid @@ -613,38 +612,38 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction } for _, bid := range bids { - ctx.Logger().Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String())) // Only consider revealed bids. if bid.Status != auctiontypes.BidStatusRevealed { - ctx.Logger().Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String())) continue } // Init highest bid. if highestBid == nil { highestBid = bid - ctx.Logger().Info(fmt.Sprintf("Initializing 1st bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Initializing 1st bid %s %s", bid.BidderAddress, bid.BidAmount.String())) continue } //nolint: all if highestBid.BidAmount.IsLT(bid.BidAmount) { - ctx.Logger().Info(fmt.Sprintf("New highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("New highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) secondHighestBid = highestBid highestBid = bid - ctx.Logger().Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String())) - ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) } else if secondHighestBid == nil || secondHighestBid.BidAmount.IsLT(bid.BidAmount) { - ctx.Logger().Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) secondHighestBid = bid - ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) } else { - ctx.Logger().Info(fmt.Sprintf("Ignoring bid as it doesn't affect 1st/2nd price %s %s", bid.BidderAddress, bid.BidAmount.String())) + k.Logger(ctx).Info(fmt.Sprintf("Ignoring bid as it doesn't affect 1st/2nd price %s %s", bid.BidderAddress, bid.BidAmount.String())) } } @@ -660,11 +659,11 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction if secondHighestBid != nil { auction.WinningPrice = secondHighestBid.BidAmount } - ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress)) - ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String())) - ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String())) + k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress)) + k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String())) + k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String())) } else { - ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) + k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) } if err := k.SaveAuction(ctx, auction); err != nil { @@ -674,7 +673,7 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction for _, bid := range bids { bidderAddress, err := sdk.AccAddressFromBech32(bid.BidderAddress) if err != nil { - ctx.Logger().Error(fmt.Sprintf("Invalid bidderAddress address. %v", err)) + k.Logger(ctx).Error(fmt.Sprintf("Invalid bidderAddress address. %v", err)) panic("Invalid bidder address.") } @@ -682,7 +681,7 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction // Send reveal fee back to bidders that've revealed the bid. sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidderAddress, sdk.NewCoins(bid.RevealFee)) if sdkErr != nil { - ctx.Logger().Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr)) + k.Logger(ctx).Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr)) panic(sdkErr) } } @@ -690,7 +689,7 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction // Send back locked bid amount to all bidders. sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidderAddress, sdk.NewCoins(bid.BidAmount)) if sdkErr != nil { - ctx.Logger().Error(fmt.Sprintf("Auction error returning bid amount: %v", sdkErr)) + k.Logger(ctx).Error(fmt.Sprintf("Auction error returning bid amount: %v", sdkErr)) panic(sdkErr) } } @@ -699,39 +698,38 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction if auction.WinnerAddress != "" { winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddress) if err != nil { - ctx.Logger().Error(fmt.Sprintf("Invalid winner address. %v", err)) + k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err)) panic("Invalid winner address.") } // Take 2nd price from winner. sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, winnerAddress, auctiontypes.ModuleName, sdk.NewCoins(auction.WinningPrice)) if sdkErr != nil { - ctx.Logger().Error(fmt.Sprintf("Auction error taking funds from winner: %v", sdkErr)) + k.Logger(ctx).Error(fmt.Sprintf("Auction error taking funds from winner: %v", sdkErr)) panic(sdkErr) } // Burn anything over the min. bid amount. amountToBurn := auction.WinningPrice.Sub(auction.MinimumBid) if amountToBurn.IsNegative() { - ctx.Logger().Error("Auction coins to burn cannot be negative.") + k.Logger(ctx).Error("Auction coins to burn cannot be negative.") panic("Auction coins to burn cannot be negative.") } // Use auction burn module account instead of actually burning coins to better keep track of supply. sdkErr = k.bankKeeper.SendCoinsFromModuleToModule(ctx, auctiontypes.ModuleName, auctiontypes.AuctionBurnModuleAccountName, sdk.NewCoins(amountToBurn)) if sdkErr != nil { - ctx.Logger().Error(fmt.Sprintf("Auction error burning coins: %v", sdkErr)) + k.Logger(ctx).Error(fmt.Sprintf("Auction error burning coins: %v", sdkErr)) panic(sdkErr) } } - // TODO // Notify other modules (hook). - // ctx.Logger().Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers))) - // for _, keeper := range k.usageKeepers { - // ctx.Logger().Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName())) - // keeper.OnAuctionWinnerSelected(ctx, auction.Id) - // } + k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers))) + for _, keeper := range k.usageKeepers { + k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName())) + keeper.OnAuctionWinnerSelected(ctx, auction.Id) + } return nil } diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go index 1339c206..b2035a9e 100644 --- a/x/auction/keeper/msg_server.go +++ b/x/auction/keeper/msg_server.go @@ -10,11 +10,11 @@ import ( var _ auctiontypes.MsgServer = msgServer{} type msgServer struct { - k Keeper + k *Keeper } // NewMsgServerImpl returns an implementation of the module MsgServer interface. -func NewMsgServerImpl(keeper Keeper) auctiontypes.MsgServer { +func NewMsgServerImpl(keeper *Keeper) auctiontypes.MsgServer { return &msgServer{k: keeper} } @@ -67,7 +67,7 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( auctiontypes.EventTypeCommitBid, - sdk.NewAttribute(auctiontypes.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId), sdk.NewAttribute(auctiontypes.AttributeKeyCommitHash, msg.CommitHash), ), sdk.NewEvent( @@ -98,7 +98,7 @@ func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( auctiontypes.EventTypeRevealBid, - sdk.NewAttribute(auctiontypes.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId), sdk.NewAttribute(auctiontypes.AttributeKeyReveal, msg.Reveal), ), sdk.NewEvent( diff --git a/x/auction/keeper/query_server.go b/x/auction/keeper/query_server.go index 4bcfc824..6b1b3ed3 100644 --- a/x/auction/keeper/query_server.go +++ b/x/auction/keeper/query_server.go @@ -13,11 +13,11 @@ import ( var _ auctiontypes.QueryServer = queryServer{} type queryServer struct { - k Keeper + k *Keeper } // NewQueryServerImpl returns an implementation of the module QueryServer. -func NewQueryServerImpl(k Keeper) auctiontypes.QueryServer { +func NewQueryServerImpl(k *Keeper) auctiontypes.QueryServer { return queryServer{k} } diff --git a/x/auction/module/abci.go b/x/auction/module/abci.go index 63701487..f95b7669 100644 --- a/x/auction/module/abci.go +++ b/x/auction/module/abci.go @@ -9,7 +9,7 @@ import ( ) // EndBlocker is called every block -func EndBlocker(ctx context.Context, k keeper.Keeper) error { +func EndBlocker(ctx context.Context, k *keeper.Keeper) error { sdkCtx := sdk.UnwrapSDKContext(ctx) return k.EndBlockerProcessAuctions(sdkCtx) diff --git a/x/auction/module/depinject.go b/x/auction/module/depinject.go index 8679d8af..764f04ab 100644 --- a/x/auction/module/depinject.go +++ b/x/auction/module/depinject.go @@ -4,12 +4,14 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/store" "cosmossdk.io/depinject" + "golang.org/x/exp/maps" "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/auction/module/v1" + "git.vdb.to/cerc-io/laconic2d/x/auction" "git.vdb.to/cerc-io/laconic2d/x/auction/keeper" ) @@ -25,6 +27,7 @@ func init() { appmodule.Register( &modulev1.Module{}, appmodule.Provide(ProvideModule), + appmodule.Invoke(InvokeSetAuctionHooks), ) } @@ -41,7 +44,11 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - Keeper keeper.Keeper + // Use * as required by InvokeSetAuctionHooks + // https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/core/appmodule#invoker-invocation-details + // https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/core/appmodule#regular-golang-types + Keeper *keeper.Keeper + Module appmodule.AppModule } @@ -51,3 +58,25 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { return ModuleOutputs{Module: m, Keeper: k} } + +func InvokeSetAuctionHooks( + config *modulev1.Module, + keeper *keeper.Keeper, + auctionHooks map[string]auction.AuctionHooksWrapper, +) error { + // all arguments to invokers are optional + if keeper == nil || config == nil { + return nil + } + + var usageKeepers []auction.AuctionUsageKeeper + + for _, modName := range maps.Keys(auctionHooks) { + hook := auctionHooks[modName] + usageKeepers = append(usageKeepers, hook) + } + + keeper.SetUsageKeepers(usageKeepers) + + return nil +} diff --git a/x/auction/module/module.go b/x/auction/module/module.go index 8105f88f..7eb54db0 100644 --- a/x/auction/module/module.go +++ b/x/auction/module/module.go @@ -20,8 +20,6 @@ import ( "git.vdb.to/cerc-io/laconic2d/x/auction/keeper" ) -// TODO: Port remaining AppModule methods - var ( _ module.AppModuleBasic = AppModule{} _ appmodule.AppModule = AppModule{} @@ -36,11 +34,11 @@ const ConsensusVersion = 1 type AppModule struct { cdc codec.Codec - keeper keeper.Keeper + keeper *keeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper) AppModule { return AppModule{ cdc: cdc, keeper: keeper, diff --git a/x/auction/msgs.go b/x/auction/msgs.go index 8e8aab2e..6aa4f798 100644 --- a/x/auction/msgs.go +++ b/x/auction/msgs.go @@ -25,9 +25,9 @@ func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction } // NewMsgCommitBid is the constructor function for MsgCommitBid. -func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid { +func NewMsgCommitBid(auctionId string, commitHash string, signer sdk.AccAddress) MsgCommitBid { return MsgCommitBid{ - AuctionId: auctionID, + AuctionId: auctionId, CommitHash: commitHash, Signer: signer.String(), } diff --git a/x/auction/query.pb.go b/x/auction/query.pb.go index 2b05203a..d3603b9f 100644 --- a/x/auction/query.pb.go +++ b/x/auction/query.pb.go @@ -217,7 +217,7 @@ func (m *QueryAuctionsResponse) GetPagination() *query.PageRequest { // AuctionRequest is the format for querying a specific auction type QueryAuctionRequest struct { - // Auction ID + // Auction id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -309,7 +309,7 @@ func (m *QueryAuctionResponse) GetAuction() *Auction { // BidRequest is the format for querying a specific bid in an auction type QueryBidRequest struct { - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` // Bidder address Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` @@ -410,7 +410,7 @@ func (m *QueryBidResponse) GetBid() *Bid { // BidsRequest is the format for querying all bids in an auction type QueryBidsRequest struct { - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` } diff --git a/x/auction/tx.pb.go b/x/auction/tx.pb.go index 4bf59e74..c16f93bb 100644 --- a/x/auction/tx.pb.go +++ b/x/auction/tx.pb.go @@ -125,7 +125,7 @@ var xxx_messageInfo_MsgCreateAuctionResponse proto.InternalMessageInfo // CommitBid defines the message to commit a bid type MsgCommitBid struct { - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"` // Commit Hash CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty" json:"commit_hash" yaml:"commit_hash"` @@ -207,7 +207,7 @@ var xxx_messageInfo_MsgCommitBidResponse proto.InternalMessageInfo // RevealBid defines the message to reveal a bid type MsgRevealBid struct { - // Auction ID + // Auction id AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"` // Commit Hash Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty" json:"reveal" yaml:"reveal"` diff --git a/x/auction/types.go b/x/auction/types.go index 93536356..4dc53e06 100644 --- a/x/auction/types.go +++ b/x/auction/types.go @@ -29,14 +29,14 @@ const ( BidStatusRevealed = "reveal" ) -// AuctionId simplifies generation of auction IDs. +// AuctionId simplifies generation of auction ids. type AuctionId struct { Address sdk.Address AccNum uint64 Sequence uint64 } -// Generate creates the auction ID. +// Generate creates the auction id. func (auctionId AuctionId) Generate() string { hasher := sha256.New() str := fmt.Sprintf("%s:%d:%d", auctionId.Address.String(), auctionId.AccNum, auctionId.Sequence) diff --git a/x/bond/expected_keeper.go b/x/bond/expected_keeper.go new file mode 100644 index 00000000..bba62a12 --- /dev/null +++ b/x/bond/expected_keeper.go @@ -0,0 +1,19 @@ +package bond + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BondUsageKeeper keep track of bond usage in other modules. +// Used to, for example, prevent deletion of a bond that's in use. +type BondUsageKeeper interface { + ModuleName() string + UsesBond(ctx sdk.Context, bondId string) bool +} + +// BondHooksWrapper is a wrapper for modules to inject BondUsageKeeper using depinject. +// Reference: https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/core/appmodule#resolving-circular-dependencies +type BondHooksWrapper struct{ BondUsageKeeper } + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (BondHooksWrapper) IsOnePerModuleType() {} diff --git a/x/bond/keeper/keeper.go b/x/bond/keeper/keeper.go index ae5ae6d2..59cc68ba 100644 --- a/x/bond/keeper/keeper.go +++ b/x/bond/keeper/keeper.go @@ -49,7 +49,7 @@ type Keeper struct { bankKeeper bank.Keeper // Track bond usage in other cosmos-sdk modules (more like a usage tracker). - // usageKeepers []types.BondUsageKeeper + usageKeepers []bondtypes.BondUsageKeeper // State management Schema collections.Schema @@ -63,8 +63,7 @@ func NewKeeper( storeService store.KVStoreService, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, - // usageKeepers []types.BondUsageKeeper, -) Keeper { +) *Keeper { sb := collections.NewSchemaBuilder(storeService) k := Keeper{ cdc: cdc, @@ -72,7 +71,7 @@ func NewKeeper( bankKeeper: bankKeeper, Params: collections.NewItem(sb, bondtypes.ParamsPrefix, "params", codec.CollValue[bondtypes.Params](cdc)), Bonds: collections.NewIndexedMap(sb, bondtypes.BondsPrefix, "bonds", collections.StringKey, codec.CollValue[bondtypes.Bond](cdc), newBondIndexes(sb)), - // usageKeepers: usageKeepers, + usageKeepers: nil, } schema, err := sb.Build() @@ -82,7 +81,15 @@ func NewKeeper( k.Schema = schema - return k + return &k +} + +func (k *Keeper) SetUsageKeepers(usageKeepers []bondtypes.BondUsageKeeper) { + if k.usageKeepers != nil { + panic("cannot set bond hooks twice") + } + + k.usageKeepers = usageKeepers } // BondId simplifies generation of bond Ids. @@ -318,13 +325,12 @@ func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") } - // TODO // Check if bond is used in other modules. - // for _, usageKeeper := range k.usageKeepers { - // if usageKeeper.UsesBond(ctx, id) { - // return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, fmt.Sprintf("Bond in use by the '%s' module.", usageKeeper.ModuleName())) - // } - // } + for _, usageKeeper := range k.usageKeepers { + if usageKeeper.UsesBond(ctx, id) { + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, fmt.Sprintf("Bond in use by the '%s' module.", usageKeeper.ModuleName())) + } + } // Move funds from the bond into the account. err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, bondtypes.ModuleName, ownerAddress, bond.Balance) diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go index 3827e73b..2a28cb67 100644 --- a/x/bond/keeper/msg_server.go +++ b/x/bond/keeper/msg_server.go @@ -11,11 +11,11 @@ import ( var _ bond.MsgServer = msgServer{} type msgServer struct { - k Keeper + k *Keeper } // NewMsgServerImpl returns an implementation of the module MsgServer interface. -func NewMsgServerImpl(keeper Keeper) bond.MsgServer { +func NewMsgServerImpl(keeper *Keeper) bond.MsgServer { return &msgServer{k: keeper} } diff --git a/x/bond/keeper/query_server.go b/x/bond/keeper/query_server.go index 9f9a1033..7c0066da 100644 --- a/x/bond/keeper/query_server.go +++ b/x/bond/keeper/query_server.go @@ -13,11 +13,11 @@ import ( var _ bondtypes.QueryServer = queryServer{} type queryServer struct { - k Keeper + k *Keeper } // NewQueryServerImpl returns an implementation of the module QueryServer. -func NewQueryServerImpl(k Keeper) bondtypes.QueryServer { +func NewQueryServerImpl(k *Keeper) bondtypes.QueryServer { return queryServer{k} } diff --git a/x/bond/module/depinject.go b/x/bond/module/depinject.go index db48f83d..01d07b3d 100644 --- a/x/bond/module/depinject.go +++ b/x/bond/module/depinject.go @@ -4,12 +4,14 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/store" "cosmossdk.io/depinject" + "golang.org/x/exp/maps" "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/bond/module/v1" + "git.vdb.to/cerc-io/laconic2d/x/bond" "git.vdb.to/cerc-io/laconic2d/x/bond/keeper" ) @@ -25,6 +27,7 @@ func init() { appmodule.Register( &modulev1.Module{}, appmodule.Provide(ProvideModule), + appmodule.Invoke(InvokeSetBondHooks), ) } @@ -41,7 +44,7 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - Keeper keeper.Keeper + Keeper *keeper.Keeper Module appmodule.AppModule } @@ -51,3 +54,25 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { return ModuleOutputs{Module: m, Keeper: k} } + +func InvokeSetBondHooks( + config *modulev1.Module, + keeper *keeper.Keeper, + bondHooks map[string]bond.BondHooksWrapper, +) error { + // all arguments to invokers are optional + if keeper == nil || config == nil { + return nil + } + + var usageKeepers []bond.BondUsageKeeper + + for _, modName := range maps.Keys(bondHooks) { + hook := bondHooks[modName] + usageKeepers = append(usageKeepers, hook) + } + + keeper.SetUsageKeepers(usageKeepers) + + return nil +} diff --git a/x/bond/module/module.go b/x/bond/module/module.go index 2fb5b834..073f5224 100644 --- a/x/bond/module/module.go +++ b/x/bond/module/module.go @@ -18,8 +18,6 @@ import ( "git.vdb.to/cerc-io/laconic2d/x/bond/keeper" ) -// TODO: Port remaining AppModule methods - var ( _ module.AppModuleBasic = AppModule{} _ appmodule.AppModule = AppModule{} @@ -33,11 +31,11 @@ const ConsensusVersion = 1 type AppModule struct { cdc codec.Codec - keeper keeper.Keeper + keeper *keeper.Keeper } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper) AppModule { return AppModule{ cdc: cdc, keeper: keeper, diff --git a/x/registry/keeper/genesis.go b/x/registry/keeper/genesis.go index 7d61cf5e..39766ad4 100644 --- a/x/registry/keeper/genesis.go +++ b/x/registry/keeper/genesis.go @@ -43,12 +43,6 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, data *registry.GenesisState) error if err := k.insertAuthorityExpiryQueue(ctx, authority.Name, authority.Entry.ExpiryTime); err != nil { return err } - - // TODO - // Note: Bond genesis runs first, so bonds will already be present. - // if authority.Entry.BondId != "" { - // k.AddBondToAuthorityIndexEntry(ctx, authority.Entry.BondId, authority.Name) - // } } } diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index b542fb2f..2d9c2c32 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/collections/indexes" storetypes "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,8 +29,6 @@ import ( "git.vdb.to/cerc-io/laconic2d/x/registry/helpers" ) -// TODO: Add required methods - type RecordsIndexes struct { BondId *indexes.Multi[string, string, registrytypes.Record] } @@ -50,16 +49,24 @@ func newRecordIndexes(sb *collections.SchemaBuilder) RecordsIndexes { } } -// TODO type AuthoritiesIndexes struct { + AuctionId *indexes.Multi[string, string, registrytypes.NameAuthority] } -func (b AuthoritiesIndexes) IndexesList() []collections.Index[string, registrytypes.NameAuthority] { - return []collections.Index[string, registrytypes.NameAuthority]{} +func (a AuthoritiesIndexes) IndexesList() []collections.Index[string, registrytypes.NameAuthority] { + return []collections.Index[string, registrytypes.NameAuthority]{a.AuctionId} } func newAuthorityIndexes(sb *collections.SchemaBuilder) AuthoritiesIndexes { - return AuthoritiesIndexes{} + return AuthoritiesIndexes{ + AuctionId: indexes.NewMulti( + sb, registrytypes.AuthoritiesByAuctionIdIndexPrefix, "authorities_by_auction_id", + collections.StringKey, collections.StringKey, + func(name string, v registrytypes.NameAuthority) (string, error) { + return v.AuctionId, nil + }, + ), + } } type NameRecordsIndexes struct { @@ -87,9 +94,8 @@ type Keeper struct { accountKeeper auth.AccountKeeper bankKeeper bank.Keeper - recordKeeper RecordKeeper - bondKeeper bondkeeper.Keeper - auctionKeeper auctionkeeper.Keeper + bondKeeper *bondkeeper.Keeper + auctionKeeper *auctionkeeper.Keeper // state management Schema collections.Schema @@ -107,16 +113,14 @@ func NewKeeper( storeService storetypes.KVStoreService, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, - recordKeeper RecordKeeper, - bondKeeper bondkeeper.Keeper, - auctionKeeper auctionkeeper.Keeper, + bondKeeper *bondkeeper.Keeper, + auctionKeeper *auctionkeeper.Keeper, ) Keeper { sb := collections.NewSchemaBuilder(storeService) k := Keeper{ cdc: cdc, accountKeeper: accountKeeper, bankKeeper: bankKeeper, - recordKeeper: recordKeeper, bondKeeper: bondKeeper, auctionKeeper: auctionKeeper, Params: collections.NewItem(sb, registrytypes.ParamsPrefix, "params", codec.CollValue[registrytypes.Params](cdc)), @@ -155,6 +159,15 @@ func NewKeeper( return k } +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return logger(ctx) +} + +func logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", registrytypes.ModuleName) +} + // HasRecord - checks if a record by the given id exists. func (k Keeper) HasRecord(ctx sdk.Context, id string) (bool, error) { has, err := k.Records.Has(ctx, id) @@ -230,9 +243,6 @@ func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*registrytyp // PutRecord - saves a record to the store. func (k Keeper) SaveRecord(ctx sdk.Context, record registrytypes.Record) error { return k.Records.Set(ctx, record.Id, record) - - // TODO - // k.updateBlockChangeSetForRecord(ctx, record.Id) } // ProcessSetRecord creates a record. @@ -274,7 +284,7 @@ func (k Keeper) SetRecord(ctx sdk.Context, msg registrytypes.MsgSetRecord) (*reg // Sort owners list. sort.Strings(record.Owners) - sdkErr := k.processRecord(ctx, &record, false) + sdkErr := k.processRecord(ctx, &record) if sdkErr != nil { return nil, sdkErr } @@ -282,7 +292,7 @@ func (k Keeper) SetRecord(ctx sdk.Context, msg registrytypes.MsgSetRecord) (*reg return &record, nil } -func (k Keeper) processRecord(ctx sdk.Context, record *registrytypes.ReadableRecord, isRenewal bool) error { +func (k Keeper) processRecord(ctx sdk.Context, record *registrytypes.ReadableRecord) error { params, err := k.GetParams(ctx) if err != nil { return err @@ -420,7 +430,6 @@ func (k Keeper) GetModuleBalances(ctx sdk.Context) []*registrytypes.AccountBalan // ProcessRecordExpiryQueue tries to renew expiring records (by collecting rent) else marks them as deleted. func (k Keeper) ProcessRecordExpiryQueue(ctx sdk.Context) error { - // TODO: process expired records cids, err := k.getAllExpiredRecords(ctx, ctx.BlockHeader().Time) if err != nil { return err diff --git a/x/registry/keeper/naming_keeper.go b/x/registry/keeper/naming_keeper.go index d4722102..fbf2bd28 100644 --- a/x/registry/keeper/naming_keeper.go +++ b/x/registry/keeper/naming_keeper.go @@ -132,16 +132,7 @@ func (k Keeper) SaveNameRecord(ctx sdk.Context, crn string, id string) error { Height: uint64(ctx.BlockHeight()), } - // TODO: Check if index gets updated on entry updates - if err := k.NameRecords.Set(ctx, crn, nameRecord); err != nil { - return err - } - - // TODO - // Update changeSet for name. - // k.updateBlockChangeSetForName(ctx, crn) - - return nil + return k.NameRecords.Set(ctx, crn, nameRecord) } // SetName creates a CRN -> Record ID mapping. @@ -169,9 +160,6 @@ func (k Keeper) SetName(ctx sdk.Context, msg registrytypes.MsgSetName) error { // SaveNameAuthority creates the NameAuthority record. func (k Keeper) SaveNameAuthority(ctx sdk.Context, name string, authority *registrytypes.NameAuthority) error { return k.Authorities.Set(ctx, name, *authority) - - // TODO - // updateBlockChangeSetForNameAuthority(ctx, codec, store, name) } // ReserveAuthority reserves a name authority. @@ -282,12 +270,9 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo // If auctions are enabled, clear out owner fields. They will be set after a winner is picked. authority.OwnerAddress = "" authority.OwnerPublicKey = "" + // Reset bond ID if required. - if authority.BondId != "" || len(authority.BondId) != 0 { - // TODO - // k.RemoveBondToAuthorityIndexEntry(ctx, authority.BondId, name) - authority.BondId = "" - } + authority.BondId = "" params := auctiontypes.Params{ CommitsDuration: moduleParams.AuthorityAuctionCommitsDuration, @@ -305,10 +290,6 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo return sdkErr } - // TODO - // Create auction ID -> authority name index. - // k.AddAuctionToAuthorityMapping(ctx, auction.Id, name) - authority.Status = registrytypes.AuthorityUnderAuction authority.AuctionId = auction.Id authority.ExpiryTime = auction.RevealsEndTime.Add(moduleParams.AuthorityGracePeriod) @@ -362,22 +343,12 @@ func (k Keeper) SetAuthorityBond(ctx sdk.Context, msg registrytypes.MsgSetAuthor return nil } - // TODO - // Remove old bond ID mapping, if any. - // if authority.BondId != "" { - // k.RemoveBondToAuthorityIndexEntry(ctx, authority.BondId, name) - // } - // Update bond id and save name authority in store. authority.BondId = bond.Id if err = k.SaveNameAuthority(ctx, name, &authority); err != nil { return err } - // TODO - // Add new bond ID mapping. - // k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name) - return nil } @@ -546,8 +517,7 @@ func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context) error { return err } - // TODO: Setup logger - // k.Logger(ctx).Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name)) + k.Logger(ctx).Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name)) return nil } @@ -620,7 +590,7 @@ func (k Keeper) deleteAuthorityExpiryQueue(ctx sdk.Context, name string, authori // tryTakeAuthorityRent tries to take rent from the authority bond. func (k Keeper) tryTakeAuthorityRent(ctx sdk.Context, name string, authority registrytypes.NameAuthority) error { - // k.Logger(ctx).Info(fmt.Sprintf("Trying to take rent for authority: %s", name)) + k.Logger(ctx).Info(fmt.Sprintf("Trying to take rent for authority: %s", name)) params, err := k.GetParams(ctx) if err != nil { @@ -636,7 +606,8 @@ func (k Keeper) tryTakeAuthorityRent(ctx sdk.Context, name string, authority reg return err } - // k.Logger(ctx).Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name)) + k.Logger(ctx).Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name)) + return k.deleteAuthorityExpiryQueue(ctx, name, authority) } @@ -653,7 +624,8 @@ func (k Keeper) tryTakeAuthorityRent(ctx sdk.Context, name string, authority reg // Save authority. authority.Status = registrytypes.AuthorityActive - // k.Logger(ctx).Info(fmt.Sprintf("Authority rent paid successfully: %s", name)) + k.Logger(ctx).Info(fmt.Sprintf("Authority rent paid successfully: %s", name)) + return k.SaveNameAuthority(ctx, name, &authority) } diff --git a/x/registry/keeper/record_keeper.go b/x/registry/keeper/record_keeper.go index cd7a884d..f0c9c643 100644 --- a/x/registry/keeper/record_keeper.go +++ b/x/registry/keeper/record_keeper.go @@ -1,24 +1,137 @@ package keeper import ( + "errors" + "fmt" "time" + "cosmossdk.io/collections" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auctiontypes "git.vdb.to/cerc-io/laconic2d/x/auction" auctionkeeper "git.vdb.to/cerc-io/laconic2d/x/auction/keeper" + bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond" registrytypes "git.vdb.to/cerc-io/laconic2d/x/registry" ) -// TODO: Add methods +// Record keeper implements the bond usage keeper interface. +var ( + _ auctiontypes.AuctionUsageKeeper = RecordKeeper{} + _ bondtypes.BondUsageKeeper = RecordKeeper{} +) // RecordKeeper exposes the bare minimal read-only API for other modules. type RecordKeeper struct { cdc codec.BinaryCodec // The wire codec for binary encoding/decoding. - auctionKeeper auctionkeeper.Keeper - // storeKey storetypes.StoreKey // Unexposed key to access store from sdk.Context + k *Keeper + auctionKeeper *auctionkeeper.Keeper +} + +// NewRecordKeeper creates new instances of the registry RecordKeeper +func NewRecordKeeper(cdc codec.BinaryCodec, k *Keeper, auctionKeeper *auctionkeeper.Keeper) RecordKeeper { + return RecordKeeper{ + cdc: cdc, + k: k, + auctionKeeper: auctionKeeper, + } +} + +// ModuleName returns the module name. +func (rk RecordKeeper) ModuleName() string { + return registrytypes.ModuleName +} + +func (rk RecordKeeper) UsesAuction(ctx sdk.Context, auctionId string) bool { + iter, err := rk.k.Authorities.Indexes.AuctionId.MatchExact(ctx, auctionId) + if err != nil { + panic(err) + } + + return iter.Valid() +} + +func (rk RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string) { + // Update authority status based on auction status/winner. + iter, err := rk.k.Authorities.Indexes.AuctionId.MatchExact(ctx, auctionId) + if err != nil && !errors.Is(err, collections.ErrNotFound) { + panic(err) + } + names, err := iter.PrimaryKeys() + if err != nil { + panic(err) + } + + if len(names) == 0 { + // We don't know about this auction, ignore. + logger(ctx).Info(fmt.Sprintf("Ignoring auction notification, name mapping not found: %s", auctionId)) + return + } + + // Take the first one as an auction (non-empty) will map to only one name + // MultiIndex being used as there can be multiple entries with empty auction id ("") + name := names[0] + if has, err := rk.k.HasNameAuthority(ctx, name); !has { + if err != nil { + panic(err) + } + + // We don't know about this authority, ignore. + logger(ctx).Info(fmt.Sprintf("Ignoring auction notification, authority not found: %s", auctionId)) + return + } + + authority, err := rk.k.GetNameAuthority(ctx, name) + if err != nil { + panic(err) + } + + auctionObj, err := rk.auctionKeeper.GetAuctionById(ctx, auctionId) + if err != nil { + panic(err) + } + + if auctionObj.Status == auctiontypes.AuctionStatusCompleted { + if auctionObj.WinnerAddress != "" { + // Mark authority owner and change status to active. + authority.OwnerAddress = auctionObj.WinnerAddress + authority.Status = registrytypes.AuthorityActive + + // Reset bond id if required, as owner has changed. + authority.BondId = "" + + // Update height for updated/changed authority (owner). + // Can be used to check if names are older than the authority itself (stale names). + authority.Height = uint64(ctx.BlockHeight()) + + logger(ctx).Info(fmt.Sprintf("Winner selected, marking authority as active: %s", name)) + } else { + // Mark as expired. + authority.Status = registrytypes.AuthorityExpired + logger(ctx).Info(fmt.Sprintf("No winner, marking authority as expired: %s", name)) + } + + // Forget about this auction now, we no longer need it. + authority.AuctionId = "" + + if err = rk.k.SaveNameAuthority(ctx, name, &authority); err != nil { + panic(err) + } + } else { + logger(ctx).Info(fmt.Sprintf("Ignoring auction notification, status: %s", auctionObj.Status)) + } +} + +// UsesBond returns true if the bond has associated records. +func (rk RecordKeeper) UsesBond(ctx sdk.Context, bondId string) bool { + iter, err := rk.k.Records.Indexes.BondId.MatchExact(ctx, bondId) + if err != nil { + panic(err) + } + + return iter.Valid() } // RenewRecord renews a record. @@ -46,7 +159,7 @@ func (k Keeper) RenewRecord(ctx sdk.Context, msg registrytypes.MsgRenewRecord) e } readableRecord := record.ToReadableRecord() - return k.processRecord(ctx, &readableRecord, true) + return k.processRecord(ctx, &readableRecord) } // AssociateBond associates a record with a bond. diff --git a/x/registry/module/depinject.go b/x/registry/module/depinject.go index 200d02c1..40e8428a 100644 --- a/x/registry/module/depinject.go +++ b/x/registry/module/depinject.go @@ -10,7 +10,9 @@ import ( bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/registry/module/v1" + "git.vdb.to/cerc-io/laconic2d/x/auction" auctionkeeper "git.vdb.to/cerc-io/laconic2d/x/auction/keeper" + "git.vdb.to/cerc-io/laconic2d/x/bond" bondkeeper "git.vdb.to/cerc-io/laconic2d/x/bond/keeper" "git.vdb.to/cerc-io/laconic2d/x/registry/keeper" ) @@ -39,8 +41,8 @@ type ModuleInputs struct { AccountKeeper auth.AccountKeeper BankKeeper bank.Keeper - BondKeeper bondkeeper.Keeper - AuctionKeeper auctionkeeper.Keeper + BondKeeper *bondkeeper.Keeper + AuctionKeeper *auctionkeeper.Keeper } type ModuleOutputs struct { @@ -48,6 +50,9 @@ type ModuleOutputs struct { Keeper keeper.Keeper Module appmodule.AppModule + + AuctionHooks auction.AuctionHooksWrapper + BondHooks bond.BondHooksWrapper } func ProvideModule(in ModuleInputs) ModuleOutputs { @@ -56,11 +61,16 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.StoreService, in.AccountKeeper, in.BankKeeper, - keeper.RecordKeeper{}, in.BondKeeper, in.AuctionKeeper, ) m := NewAppModule(in.Cdc, k) - return ModuleOutputs{Module: m, Keeper: k} + recordKeeper := keeper.NewRecordKeeper(in.Cdc, &k, in.AuctionKeeper) + + return ModuleOutputs{ + Module: m, Keeper: k, + AuctionHooks: auction.AuctionHooksWrapper{AuctionUsageKeeper: recordKeeper}, + BondHooks: bond.BondHooksWrapper{BondUsageKeeper: recordKeeper}, + } } diff --git a/x/registry/registry.pb.go b/x/registry/registry.pb.go index 21912a83..3fff0fa0 100644 --- a/x/registry/registry.pb.go +++ b/x/registry/registry.pb.go @@ -624,144 +624,6 @@ func (m *Signature) GetPubKey() string { return "" } -// BlockChangeSet -type BlockChangeSet struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Records []string `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"` - Auctions []string `protobuf:"bytes,3,rep,name=auctions,proto3" json:"auctions,omitempty"` - AuctionBids []*AuctionBidInfo `protobuf:"bytes,4,rep,name=auction_bids,json=auctionBids,proto3" json:"auction_bids,omitempty" json:"auction_bids" yaml:"auction_bids"` - Authorities []string `protobuf:"bytes,5,rep,name=authorities,proto3" json:"authorities,omitempty"` - Names []string `protobuf:"bytes,6,rep,name=names,proto3" json:"names,omitempty"` -} - -func (m *BlockChangeSet) Reset() { *m = BlockChangeSet{} } -func (m *BlockChangeSet) String() string { return proto.CompactTextString(m) } -func (*BlockChangeSet) ProtoMessage() {} -func (*BlockChangeSet) Descriptor() ([]byte, []int) { - return fileDescriptor_d792f2373089b5b9, []int{8} -} -func (m *BlockChangeSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlockChangeSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlockChangeSet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BlockChangeSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockChangeSet.Merge(m, src) -} -func (m *BlockChangeSet) XXX_Size() int { - return m.Size() -} -func (m *BlockChangeSet) XXX_DiscardUnknown() { - xxx_messageInfo_BlockChangeSet.DiscardUnknown(m) -} - -var xxx_messageInfo_BlockChangeSet proto.InternalMessageInfo - -func (m *BlockChangeSet) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *BlockChangeSet) GetRecords() []string { - if m != nil { - return m.Records - } - return nil -} - -func (m *BlockChangeSet) GetAuctions() []string { - if m != nil { - return m.Auctions - } - return nil -} - -func (m *BlockChangeSet) GetAuctionBids() []*AuctionBidInfo { - if m != nil { - return m.AuctionBids - } - return nil -} - -func (m *BlockChangeSet) GetAuthorities() []string { - if m != nil { - return m.Authorities - } - return nil -} - -func (m *BlockChangeSet) GetNames() []string { - if m != nil { - return m.Names - } - return nil -} - -// AuctionBidInfo -type AuctionBidInfo struct { - AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"` - BidderAddress string `protobuf:"bytes,2,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty" json:"bidder_address" yaml:"bidder_address"` -} - -func (m *AuctionBidInfo) Reset() { *m = AuctionBidInfo{} } -func (m *AuctionBidInfo) String() string { return proto.CompactTextString(m) } -func (*AuctionBidInfo) ProtoMessage() {} -func (*AuctionBidInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_d792f2373089b5b9, []int{9} -} -func (m *AuctionBidInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuctionBidInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuctionBidInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AuctionBidInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuctionBidInfo.Merge(m, src) -} -func (m *AuctionBidInfo) XXX_Size() int { - return m.Size() -} -func (m *AuctionBidInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AuctionBidInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AuctionBidInfo proto.InternalMessageInfo - -func (m *AuctionBidInfo) GetAuctionId() string { - if m != nil { - return m.AuctionId - } - return "" -} - -func (m *AuctionBidInfo) GetBidderAddress() string { - if m != nil { - return m.BidderAddress - } - return "" -} - // ExpiryQueue: record / authority expiry queue type // id: expiry time // value: array of ids (record cids / authority names) @@ -774,7 +636,7 @@ func (m *ExpiryQueue) Reset() { *m = ExpiryQueue{} } func (m *ExpiryQueue) String() string { return proto.CompactTextString(m) } func (*ExpiryQueue) ProtoMessage() {} func (*ExpiryQueue) Descriptor() ([]byte, []int) { - return fileDescriptor_d792f2373089b5b9, []int{10} + return fileDescriptor_d792f2373089b5b9, []int{8} } func (m *ExpiryQueue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -826,101 +688,90 @@ func init() { proto.RegisterType((*NameRecord)(nil), "cerc.registry.v1.NameRecord") proto.RegisterType((*NameRecordEntry)(nil), "cerc.registry.v1.NameRecordEntry") proto.RegisterType((*Signature)(nil), "cerc.registry.v1.Signature") - proto.RegisterType((*BlockChangeSet)(nil), "cerc.registry.v1.BlockChangeSet") - proto.RegisterType((*AuctionBidInfo)(nil), "cerc.registry.v1.AuctionBidInfo") proto.RegisterType((*ExpiryQueue)(nil), "cerc.registry.v1.ExpiryQueue") } func init() { proto.RegisterFile("cerc/registry/v1/registry.proto", fileDescriptor_d792f2373089b5b9) } var fileDescriptor_d792f2373089b5b9 = []byte{ - // 1365 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xc6, 0x89, 0x13, 0x3f, 0x37, 0xa1, 0x1a, 0xd2, 0xd6, 0x09, 0xad, 0x37, 0x35, 0x42, - 0x69, 0x55, 0xd5, 0xab, 0x34, 0x42, 0x55, 0x5b, 0x71, 0xc8, 0x86, 0x34, 0x0a, 0x15, 0xd0, 0x4e, - 0x2a, 0x0e, 0x20, 0x64, 0xed, 0x9f, 0xa9, 0x33, 0xd4, 0xbb, 0x6b, 0xed, 0xce, 0x9a, 0xfa, 0x88, - 0xc4, 0x01, 0x6e, 0x3d, 0xf6, 0xc0, 0x37, 0xe0, 0x00, 0xdf, 0x82, 0x1e, 0x7b, 0xe4, 0x82, 0x41, - 0x8d, 0xc4, 0x07, 0xf0, 0x27, 0x40, 0xf3, 0x67, 0xff, 0xda, 0xae, 0x81, 0xde, 0xf6, 0xfd, 0xfb, - 0xcd, 0x6f, 0xde, 0xbc, 0xf7, 0x66, 0x16, 0x74, 0x87, 0x84, 0x8e, 0x11, 0x92, 0x2e, 0x8d, 0x58, - 0x38, 0x34, 0x06, 0xbb, 0xe9, 0x77, 0xbb, 0x1f, 0x06, 0x2c, 0x40, 0xe7, 0xb9, 0x43, 0x3b, 0x55, - 0x0e, 0x76, 0xb7, 0x9a, 0xdd, 0x20, 0xe8, 0xf6, 0x88, 0x21, 0xec, 0x76, 0xfc, 0xc4, 0x70, 0xe3, - 0xd0, 0x62, 0x34, 0xf0, 0x65, 0xc4, 0x96, 0x5e, 0xb6, 0x33, 0xea, 0x91, 0x88, 0x59, 0x5e, 0x5f, - 0x39, 0x6c, 0x74, 0x83, 0x6e, 0x20, 0x3e, 0x0d, 0xfe, 0xa5, 0xb4, 0x4d, 0x27, 0x88, 0xbc, 0x20, - 0x32, 0x6c, 0x2b, 0x22, 0xc6, 0x60, 0xd7, 0x26, 0xcc, 0xda, 0x35, 0x9c, 0x80, 0x2a, 0xd8, 0xd6, - 0x1f, 0x6b, 0x50, 0x7d, 0x68, 0x85, 0x96, 0x17, 0x21, 0x0a, 0xf5, 0x90, 0x38, 0x41, 0xe8, 0x76, - 0x42, 0xe2, 0xb3, 0x86, 0xb6, 0xad, 0x5d, 0xab, 0xdf, 0xda, 0x6c, 0x4b, 0x80, 0x36, 0x07, 0x68, - 0x2b, 0x80, 0xf6, 0x41, 0x40, 0x7d, 0xf3, 0xe6, 0xcb, 0x91, 0xbe, 0x30, 0x1e, 0xe9, 0x1f, 0x7c, - 0x13, 0x05, 0xfe, 0xdd, 0x56, 0x2e, 0xb6, 0xb5, 0x3d, 0xb4, 0xbc, 0x5e, 0x51, 0x85, 0x41, 0x4a, - 0x98, 0xf8, 0x0c, 0x3d, 0xd7, 0x60, 0x23, 0x67, 0xec, 0x24, 0x7b, 0x6d, 0x2c, 0xaa, 0x45, 0xe5, - 0x66, 0xdb, 0xc9, 0x66, 0xdb, 0x1f, 0x2b, 0x07, 0xf3, 0x40, 0x2d, 0x7a, 0x7b, 0x62, 0xd1, 0x14, - 0x64, 0xca, 0xea, 0x99, 0xed, 0xc5, 0x9f, 0xba, 0x86, 0x51, 0x46, 0x25, 0x01, 0x46, 0x31, 0xac, - 0x5b, 0x31, 0x3b, 0x0d, 0x42, 0xca, 0x86, 0x32, 0x01, 0x95, 0x79, 0x09, 0xd8, 0x53, 0x5c, 0x6e, - 0x48, 0x2e, 0xc5, 0xf0, 0x84, 0x45, 0x49, 0x8b, 0xd7, 0x52, 0x85, 0xc8, 0xc4, 0x4f, 0x1a, 0x5c, - 0x2a, 0xba, 0x64, 0xc9, 0x58, 0x9a, 0x97, 0x8c, 0x63, 0x45, 0xe0, 0xa3, 0x69, 0x04, 0x26, 0xf2, - 0x31, 0xcb, 0x2c, 0x52, 0x72, 0xa1, 0x40, 0x2b, 0xcd, 0xca, 0x0b, 0x0d, 0x2e, 0x66, 0x71, 0xdd, - 0xd0, 0x72, 0x48, 0xa7, 0x4f, 0x42, 0x1a, 0xb8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 0x31, 0x51, 0xe7, 0x25, 0x05, 0x73, 0xff, 0xe5, - 0xeb, 0xa6, 0xf6, 0xea, 0x75, 0x53, 0xfb, 0xeb, 0x75, 0x53, 0x7b, 0x7e, 0xd6, 0x5c, 0x78, 0x75, - 0xd6, 0x5c, 0xf8, 0xfd, 0xac, 0xb9, 0xf0, 0xe5, 0x4e, 0x97, 0xb2, 0xf6, 0xc0, 0xb5, 0xdb, 0x2c, - 0x30, 0xf8, 0xf9, 0xdc, 0xa4, 0x81, 0xd1, 0xb3, 0x9c, 0xc0, 0xa7, 0xce, 0x2d, 0xd7, 0x78, 0x96, - 0xfe, 0x83, 0xdb, 0x55, 0x31, 0x15, 0xf6, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x85, 0xe1, - 0xaf, 0xa7, 0x0f, 0x00, 0x00, + // 1221 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcb, 0x6e, 0xdb, 0x46, + 0x17, 0x36, 0x6d, 0x59, 0xb6, 0x8e, 0x63, 0xff, 0xc1, 0xfc, 0x4e, 0x22, 0xbb, 0xb1, 0xe8, 0xa8, + 0x28, 0xec, 0x20, 0x30, 0x09, 0xd9, 0x28, 0x82, 0x24, 0xe8, 0xc2, 0x72, 0x1d, 0xc3, 0x0d, 0xda, + 0x3a, 0xe3, 0xac, 0x5a, 0x14, 0x02, 0x2f, 0x13, 0x79, 0x5a, 0x91, 0x14, 0xc8, 0xa1, 0x1a, 0x2d, + 0x0b, 0x74, 0xd3, 0x9d, 0x97, 0x59, 0xf4, 0x0d, 0xba, 0xe8, 0x63, 0x34, 0xcb, 0x2c, 0xbb, 0x29, + 0x5b, 0xd8, 0x40, 0x1f, 0x40, 0x4f, 0x50, 0x70, 0x66, 0x78, 0x95, 0x14, 0xb5, 0xc8, 0x8e, 0xe7, + 0xf6, 0xcd, 0x37, 0xdf, 0x9c, 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 0x06, 0x4d, 0x41, 0x26, + 0x8c, 0x9e, 0xc5, 0x5e, 0xff, 0xa9, 0x2a, 0x18, 0x65, 0x54, 0x12, 0x60, 0x14, 0xc2, 0x9a, 0x11, + 0xb2, 0x0b, 0xcf, 0xa7, 0x6c, 0x28, 0x04, 0x58, 0x98, 0x25, 0xc0, 0x81, 0xe4, 0xf2, 0x40, 0x70, + 0x29, 0x96, 0x27, 0x2c, 0x4a, 0x5e, 0xbc, 0x9a, 0x3a, 0xb8, 0x12, 0x3f, 0x2b, 0x70, 0xa7, 0x98, + 0x92, 0x89, 0x51, 0x99, 0x25, 0xc6, 0xa9, 0x24, 0xf0, 0xc9, 0x24, 0x02, 0x63, 0x7a, 0x4c, 0x0b, + 0x73, 0x49, 0x6e, 0x15, 0x68, 0xa5, 0xaa, 0xbc, 0x56, 0xe0, 0x76, 0x56, 0xd7, 0xf5, 0x0d, 0x8b, + 0x74, 0xfa, 0xc4, 0xa7, 0x9e, 0x5d, 0x5f, 0x9c, 0xc5, 0xee, 0x44, 0xb2, 0x7b, 0x52, 0x66, 0x97, + 0x87, 0x19, 0x27, 0x57, 0x88, 0x72, 0x6e, 0xeb, 0x69, 0xf0, 0x24, 0x8e, 0x9d, 0xf1, 0x10, 0xfa, + 0x41, 0x81, 0x8d, 0xac, 0xca, 0x08, 0xad, 0x78, 0xd0, 0x0e, 0x71, 0x0d, 0xb3, 0x47, 0xec, 0x7a, + 0x75, 0x5b, 0xd9, 0x5d, 0x6e, 0x1f, 0x8f, 0x22, 0xf5, 0xb0, 0x3c, 0x7c, 0x29, 0x75, 0x9c, 0x41, + 0x39, 0x01, 0x67, 0x2b, 0x74, 0x28, 0x42, 0xc7, 0x22, 0x82, 0x7e, 0x53, 0x60, 0x42, 0x9d, 0xe5, + 0x39, 0x0e, 0x65, 0x41, 0xb6, 0x90, 0x4b, 0xb3, 0xa4, 0xea, 0x48, 0xa9, 0xce, 0xa7, 0x71, 0x2d, + 0x43, 0x4e, 0x27, 0x3d,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xd2, + 0xbf, 0x38, 0xb3, 0xca, 0xfb, 0xea, 0xe0, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xef, 0x57, + 0x0f, 0xe9, 0x0d, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1415,121 +1266,6 @@ func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *BlockChangeSet) 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 *BlockChangeSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlockChangeSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Names) > 0 { - for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Names[iNdEx]) - copy(dAtA[i:], m.Names[iNdEx]) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.Names[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Authorities) > 0 { - for iNdEx := len(m.Authorities) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Authorities[iNdEx]) - copy(dAtA[i:], m.Authorities[iNdEx]) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.Authorities[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if len(m.AuctionBids) > 0 { - for iNdEx := len(m.AuctionBids) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AuctionBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegistry(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Auctions) > 0 { - for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Auctions[iNdEx]) - copy(dAtA[i:], m.Auctions[iNdEx]) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.Auctions[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Records[iNdEx]) - copy(dAtA[i:], m.Records[iNdEx]) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.Records[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if m.Height != 0 { - i = encodeVarintRegistry(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AuctionBidInfo) 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 *AuctionBidInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuctionBidInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BidderAddress) > 0 { - i -= len(m.BidderAddress) - copy(dAtA[i:], m.BidderAddress) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.BidderAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.AuctionId) > 0 { - i -= len(m.AuctionId) - copy(dAtA[i:], m.AuctionId) - i = encodeVarintRegistry(dAtA, i, uint64(len(m.AuctionId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *ExpiryQueue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1780,65 +1516,6 @@ func (m *Signature) Size() (n int) { return n } -func (m *BlockChangeSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovRegistry(uint64(m.Height)) - } - if len(m.Records) > 0 { - for _, s := range m.Records { - l = len(s) - n += 1 + l + sovRegistry(uint64(l)) - } - } - if len(m.Auctions) > 0 { - for _, s := range m.Auctions { - l = len(s) - n += 1 + l + sovRegistry(uint64(l)) - } - } - if len(m.AuctionBids) > 0 { - for _, e := range m.AuctionBids { - l = e.Size() - n += 1 + l + sovRegistry(uint64(l)) - } - } - if len(m.Authorities) > 0 { - for _, s := range m.Authorities { - l = len(s) - n += 1 + l + sovRegistry(uint64(l)) - } - } - if len(m.Names) > 0 { - for _, s := range m.Names { - l = len(s) - n += 1 + l + sovRegistry(uint64(l)) - } - } - return n -} - -func (m *AuctionBidInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AuctionId) - if l > 0 { - n += 1 + l + sovRegistry(uint64(l)) - } - l = len(m.BidderAddress) - if l > 0 { - n += 1 + l + sovRegistry(uint64(l)) - } - return n -} - func (m *ExpiryQueue) Size() (n int) { if m == nil { return 0 @@ -3425,351 +3102,6 @@ func (m *Signature) Unmarshal(dAtA []byte) error { } return nil } -func (m *BlockChangeSet) 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 ErrIntOverflowRegistry - } - 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: BlockChangeSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlockChangeSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Auctions = append(m.Auctions, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuctionBids", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRegistry - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuctionBids = append(m.AuctionBids, &AuctionBidInfo{}) - if err := m.AuctionBids[len(m.AuctionBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authorities", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authorities = append(m.Authorities, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegistry(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegistry - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AuctionBidInfo) 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 ErrIntOverflowRegistry - } - 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: AuctionBidInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuctionBidInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuctionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidderAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRegistry - } - 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 ErrInvalidLengthRegistry - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRegistry - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BidderAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRegistry(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRegistry - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ExpiryQueue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0