From 85eef7c5c3086048fdb1c1dc64cb0676f6ef1d1c Mon Sep 17 00:00:00 2001 From: lumtis Date: Mon, 22 Jul 2024 14:03:29 +0200 Subject: [PATCH] address from comments --- .../zetacore/observer/chain_nonces.proto | 3 +- .../zetacore/observer/chain_nonces_pb.d.ts | 3 +- x/observer/migrations/v8/migrate_test.go | 4 +- x/observer/types/chain_nonces.pb.go | 39 ++++++++++--------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/proto/zetachain/zetacore/observer/chain_nonces.proto b/proto/zetachain/zetacore/observer/chain_nonces.proto index 60cf5f8a82..e3a3144601 100644 --- a/proto/zetachain/zetacore/observer/chain_nonces.proto +++ b/proto/zetachain/zetacore/observer/chain_nonces.proto @@ -9,7 +9,8 @@ message ChainNonces { string creator = 1; // deprecated(v19): index has been replaced by chain_id for unique identifier - string index = 2 [deprecated = true];; + string index = 2 [ deprecated = true ]; + ; int64 chain_id = 3; uint64 nonce = 4; diff --git a/typescript/zetachain/zetacore/observer/chain_nonces_pb.d.ts b/typescript/zetachain/zetacore/observer/chain_nonces_pb.d.ts index 11501e5457..ffbe8e7a23 100644 --- a/typescript/zetachain/zetacore/observer/chain_nonces_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/chain_nonces_pb.d.ts @@ -18,7 +18,8 @@ export declare class ChainNonces extends Message { /** * deprecated(v19): index has been replaced by chain_id for unique identifier * - * @generated from field: string index = 2; + * @generated from field: string index = 2 [deprecated = true]; + * @deprecated */ index: string; diff --git a/x/observer/migrations/v8/migrate_test.go b/x/observer/migrations/v8/migrate_test.go index 8a2aba9a87..b4a055a026 100644 --- a/x/observer/migrations/v8/migrate_test.go +++ b/x/observer/migrations/v8/migrate_test.go @@ -92,14 +92,14 @@ func TestMigrateStore(t *testing.T) { allChainNonces = k.GetAllChainNonces(ctx) require.Len(t, allChainNonces, 10) - chainIDMap := make(map[int64]bool) + chainIDMap := make(map[int64]struct{}) // all chain nonces can be found in the store for _, chainNonces := range allChainNonces { // chain all chain IDs are different _, found := chainIDMap[chainNonces.ChainId] require.False(t, found) - chainIDMap[chainNonces.ChainId] = true + chainIDMap[chainNonces.ChainId] = struct{}{} // check value retrievedChainNonces, found := k.GetChainNonces(ctx, chainNonces.ChainId) diff --git a/x/observer/types/chain_nonces.pb.go b/x/observer/types/chain_nonces.pb.go index 324b473ae4..e450e70f5b 100644 --- a/x/observer/types/chain_nonces.pb.go +++ b/x/observer/types/chain_nonces.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ChainNonces struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` // deprecated(v19): index has been replaced by chain_id for unique identifier - Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"` + Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"` // Deprecated: Do not use. ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` Nonce uint64 `protobuf:"varint,4,opt,name=nonce,proto3" json:"nonce,omitempty"` Signers []string `protobuf:"bytes,5,rep,name=signers,proto3" json:"signers,omitempty"` @@ -73,6 +73,7 @@ func (m *ChainNonces) GetCreator() string { return "" } +// Deprecated: Do not use. func (m *ChainNonces) GetIndex() string { if m != nil { return m.Index @@ -117,24 +118,24 @@ func init() { } var fileDescriptor_d8bc11608907ed56 = []byte{ - // 266 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x3d, 0x4e, 0xc4, 0x30, - 0x10, 0x85, 0xd7, 0x64, 0x7f, 0xc0, 0x14, 0x48, 0xd1, 0x16, 0x06, 0x24, 0x2b, 0xa2, 0x4a, 0x83, - 0x5d, 0x70, 0x03, 0x68, 0xd8, 0x86, 0x22, 0x25, 0x0d, 0xca, 0xcf, 0xe0, 0x58, 0x02, 0x7b, 0x65, - 0x1b, 0xb4, 0xec, 0x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25, 0x6a, 0xfb, 0x8c, 0x95, 0x5d, 0xee, - 0xb5, 0xb7, 0xf9, 0xef, 0x2f, 0xbc, 0xad, 0xc1, 0x57, 0x73, 0xac, 0xe1, 0xea, 0x27, 0x00, 0x00, - 0xff, 0xff, 0x6c, 0x72, 0x2e, 0x5e, 0x6b, 0x01, 0x00, 0x00, + // 272 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0xeb, 0xa6, 0x69, 0xc1, 0x0c, 0x48, 0x56, 0x07, 0x03, 0x92, 0x15, 0x31, 0x65, 0xc1, + 0x1e, 0x78, 0x83, 0xb2, 0xd0, 0x85, 0x21, 0x23, 0x0b, 0xca, 0xcf, 0xc5, 0xb1, 0x04, 0x76, 0x65, + 0x1b, 0x54, 0xfa, 0x14, 0x3c, 0x0d, 0xcf, 0xc0, 0xd8, 0x91, 0x11, 0x25, 0x2f, 0x82, 0xec, 0x10, + 0x90, 0xba, 0xdd, 0x73, 0x74, 0xce, 0xbd, 0x57, 0x1f, 0xe6, 0x3b, 0xf0, 0x65, 0xdd, 0x96, 0x4a, + 0x8b, 0x38, 0x19, 0x0b, 0xc2, 0x54, 0x0e, 0xec, 0x2b, 0x58, 0x11, 0xfd, 0x07, 0x6d, 0x74, 0x0d, + 0x8e, 0x6f, 0xac, 0xf1, 0x86, 0x5c, 0xfc, 0xe5, 0xf9, 0x98, 0xe7, 0x63, 0xfe, 0x7c, 0x29, 0x8d, + 0x34, 0x31, 0x27, 0xc2, 0x34, 0x54, 0x2e, 0x3f, 0x10, 0x3e, 0xb9, 0x09, 0x8d, 0xbb, 0xb8, 0x88, + 0x50, 0xbc, 0xa8, 0x2d, 0x94, 0xde, 0x58, 0x8a, 0x32, 0x94, 0x1f, 0x17, 0xa3, 0x24, 0x14, 0xa7, + 0x4a, 0x37, 0xb0, 0xa5, 0xd3, 0xe0, 0xaf, 0xa6, 0x14, 0x15, 0x83, 0x41, 0xce, 0xf0, 0xd1, 0xf0, + 0x8c, 0x6a, 0x68, 0x92, 0xa1, 0x3c, 0x29, 0x16, 0x51, 0xaf, 0x1b, 0xb2, 0xc4, 0x69, 0xfc, 0x90, + 0xce, 0x32, 0x94, 0xcf, 0x8a, 0x41, 0x84, 0x23, 0x4e, 0x49, 0x0d, 0xd6, 0xd1, 0x34, 0x4b, 0xc2, + 0x91, 0x5f, 0x49, 0x72, 0x7c, 0xfa, 0xa8, 0x74, 0xf9, 0xa4, 0x76, 0xd0, 0xdc, 0x82, 0x92, 0xad, + 0xa7, 0xf3, 0xd8, 0x3c, 0xb4, 0x57, 0xeb, 0xcf, 0x8e, 0xa1, 0x7d, 0xc7, 0xd0, 0x77, 0xc7, 0xd0, + 0x7b, 0xcf, 0x26, 0xfb, 0x9e, 0x4d, 0xbe, 0x7a, 0x36, 0xb9, 0x17, 0x52, 0xf9, 0xf6, 0xa5, 0xe2, + 0xb5, 0x79, 0x8e, 0xd8, 0xae, 0x0e, 0x08, 0x6e, 0xff, 0x19, 0xfa, 0xb7, 0x0d, 0xb8, 0x6a, 0x1e, + 0x51, 0x5c, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x59, 0x6a, 0x82, 0x3e, 0x6f, 0x01, 0x00, 0x00, } func (m *ChainNonces) Marshal() (dAtA []byte, err error) {