From 7521b6d44f76d371326b8b7ebf5c08e415fdc279 Mon Sep 17 00:00:00 2001 From: mohitsethia <45464245+mohitsethia@users.noreply.github.com> Date: Tue, 16 Jul 2024 13:19:03 +0200 Subject: [PATCH] refactor: rename txHashList to txHash (#2476) * rename txHashList to txHash * run make generate * run make generate * change struct in test file too --- docs/openapi/openapi.swagger.yaml | 4 +- .../crosschain/outbound_tracker.proto | 4 +- .../crosschain/outbound_tracker_pb.d.ts | 20 ++-- .../keeper/msg_server_add_outbound_tracker.go | 4 +- .../msg_server_add_outbound_tracker_test.go | 10 +- x/crosschain/types/outbound_tracker.pb.go | 106 +++++++++--------- 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index a6ee4a79f3..ef6d1c39d6 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -57273,7 +57273,7 @@ definitions: type: array items: type: object - $ref: '#/definitions/crosschainTxHashList' + $ref: '#/definitions/crosschainTxHash' crosschainQueryAllCctxResponse: type: object properties: @@ -57502,7 +57502,7 @@ definitions: - NotFinalized: the corresponding tx is not finalized - Finalized: the corresponding tx is finalized but not executed yet - Executed: the corresponding tx is executed - crosschainTxHashList: + crosschainTxHash: type: object properties: tx_hash: diff --git a/proto/zetachain/zetacore/crosschain/outbound_tracker.proto b/proto/zetachain/zetacore/crosschain/outbound_tracker.proto index 4547703444..2599a0c7da 100644 --- a/proto/zetachain/zetacore/crosschain/outbound_tracker.proto +++ b/proto/zetachain/zetacore/crosschain/outbound_tracker.proto @@ -3,7 +3,7 @@ package zetachain.zetacore.crosschain; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; -message TxHashList { +message TxHash { string tx_hash = 1; string tx_signer = 2; bool proved = 3; @@ -12,5 +12,5 @@ message OutboundTracker { string index = 1; // format: "chain-nonce" int64 chain_id = 2; uint64 nonce = 3; - repeated TxHashList hash_list = 4; + repeated TxHash hash_list = 4; } diff --git a/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts b/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts index 58b98223c9..ddf1798fc8 100644 --- a/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts @@ -7,9 +7,9 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; /** - * @generated from message zetachain.zetacore.crosschain.TxHashList + * @generated from message zetachain.zetacore.crosschain.TxHash */ -export declare class TxHashList extends Message { +export declare class TxHash extends Message { /** * @generated from field: string tx_hash = 1; */ @@ -25,19 +25,19 @@ export declare class TxHashList extends Message { */ proved: boolean; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.TxHashList"; + static readonly typeName = "zetachain.zetacore.crosschain.TxHash"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): TxHashList; + static fromBinary(bytes: Uint8Array, options?: Partial): TxHash; - static fromJson(jsonValue: JsonValue, options?: Partial): TxHashList; + static fromJson(jsonValue: JsonValue, options?: Partial): TxHash; - static fromJsonString(jsonString: string, options?: Partial): TxHashList; + static fromJsonString(jsonString: string, options?: Partial): TxHash; - static equals(a: TxHashList | PlainMessage | undefined, b: TxHashList | PlainMessage | undefined): boolean; + static equals(a: TxHash | PlainMessage | undefined, b: TxHash | PlainMessage | undefined): boolean; } /** @@ -62,9 +62,9 @@ export declare class OutboundTracker extends Message { nonce: bigint; /** - * @generated from field: repeated zetachain.zetacore.crosschain.TxHashList hash_list = 4; + * @generated from field: repeated zetachain.zetacore.crosschain.TxHash hash_list = 4; */ - hashList: TxHashList[]; + hashList: TxHash[]; constructor(data?: PartialMessage); diff --git a/x/crosschain/keeper/msg_server_add_outbound_tracker.go b/x/crosschain/keeper/msg_server_add_outbound_tracker.go index 2bfb63d8ab..b82fba7f79 100644 --- a/x/crosschain/keeper/msg_server_add_outbound_tracker.go +++ b/x/crosschain/keeper/msg_server_add_outbound_tracker.go @@ -83,7 +83,7 @@ func (k msgServer) AddOutboundTracker( // fetch the tracker // if the tracker does not exist, initialize a new one tracker, found := k.GetOutboundTracker(ctx, msg.ChainId, msg.Nonce) - hash := types.TxHashList{ + hash := types.TxHash{ TxHash: msg.TxHash, TxSigner: msg.Creator, Proved: isProven, @@ -93,7 +93,7 @@ func (k msgServer) AddOutboundTracker( Index: "", ChainId: msg.ChainId, Nonce: msg.Nonce, - HashList: []*types.TxHashList{&hash}, + HashList: []*types.TxHash{&hash}, }) return &types.MsgAddOutboundTrackerResponse{}, nil } diff --git a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go index 7abe63fe15..b6cb5d4bff 100644 --- a/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_outbound_tracker_test.go @@ -117,7 +117,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: existinghHash, }, @@ -249,9 +249,9 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { observerMock.On("IsNonTombstonedObserver", mock.Anything, mock.Anything).Return(false) keepertest.MockCctxByNonce(t, ctx, *k, observerMock, types.CctxStatus_PendingOutbound, false) - hashes := make([]*types.TxHashList, keeper.MaxOutboundTrackerHashes) + hashes := make([]*types.TxHash, keeper.MaxOutboundTrackerHashes) for i := 0; i < keeper.MaxOutboundTrackerHashes; i++ { - hashes[i] = &types.TxHashList{ + hashes[i] = &types.TxHash{ TxHash: sample.Hash().Hex(), } } @@ -298,7 +298,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: existinghHash, }, @@ -397,7 +397,7 @@ func TestMsgServer_AddToOutboundTracker(t *testing.T) { k.SetOutboundTracker(ctx, types.OutboundTracker{ ChainId: chainID, Nonce: 42, - HashList: []*types.TxHashList{ + HashList: []*types.TxHash{ { TxHash: sample.Hash().Hex(), Proved: false, diff --git a/x/crosschain/types/outbound_tracker.pb.go b/x/crosschain/types/outbound_tracker.pb.go index d457726b91..03e17709f6 100644 --- a/x/crosschain/types/outbound_tracker.pb.go +++ b/x/crosschain/types/outbound_tracker.pb.go @@ -22,24 +22,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type TxHashList struct { +type TxHash struct { TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` TxSigner string `protobuf:"bytes,2,opt,name=tx_signer,json=txSigner,proto3" json:"tx_signer,omitempty"` Proved bool `protobuf:"varint,3,opt,name=proved,proto3" json:"proved,omitempty"` } -func (m *TxHashList) Reset() { *m = TxHashList{} } -func (m *TxHashList) String() string { return proto.CompactTextString(m) } -func (*TxHashList) ProtoMessage() {} -func (*TxHashList) Descriptor() ([]byte, []int) { +func (m *TxHash) Reset() { *m = TxHash{} } +func (m *TxHash) String() string { return proto.CompactTextString(m) } +func (*TxHash) ProtoMessage() {} +func (*TxHash) Descriptor() ([]byte, []int) { return fileDescriptor_77cb2cfe04eb42d9, []int{0} } -func (m *TxHashList) XXX_Unmarshal(b []byte) error { +func (m *TxHash) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TxHashList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *TxHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TxHashList.Marshal(b, m, deterministic) + return xxx_messageInfo_TxHash.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -49,33 +49,33 @@ func (m *TxHashList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *TxHashList) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxHashList.Merge(m, src) +func (m *TxHash) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxHash.Merge(m, src) } -func (m *TxHashList) XXX_Size() int { +func (m *TxHash) XXX_Size() int { return m.Size() } -func (m *TxHashList) XXX_DiscardUnknown() { - xxx_messageInfo_TxHashList.DiscardUnknown(m) +func (m *TxHash) XXX_DiscardUnknown() { + xxx_messageInfo_TxHash.DiscardUnknown(m) } -var xxx_messageInfo_TxHashList proto.InternalMessageInfo +var xxx_messageInfo_TxHash proto.InternalMessageInfo -func (m *TxHashList) GetTxHash() string { +func (m *TxHash) GetTxHash() string { if m != nil { return m.TxHash } return "" } -func (m *TxHashList) GetTxSigner() string { +func (m *TxHash) GetTxSigner() string { if m != nil { return m.TxSigner } return "" } -func (m *TxHashList) GetProved() bool { +func (m *TxHash) GetProved() bool { if m != nil { return m.Proved } @@ -83,10 +83,10 @@ func (m *TxHashList) GetProved() bool { } type OutboundTracker struct { - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - HashList []*TxHashList `protobuf:"bytes,4,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` + HashList []*TxHash `protobuf:"bytes,4,rep,name=hash_list,json=hashList,proto3" json:"hash_list,omitempty"` } func (m *OutboundTracker) Reset() { *m = OutboundTracker{} } @@ -143,7 +143,7 @@ func (m *OutboundTracker) GetNonce() uint64 { return 0 } -func (m *OutboundTracker) GetHashList() []*TxHashList { +func (m *OutboundTracker) GetHashList() []*TxHash { if m != nil { return m.HashList } @@ -151,7 +151,7 @@ func (m *OutboundTracker) GetHashList() []*TxHashList { } func init() { - proto.RegisterType((*TxHashList)(nil), "zetachain.zetacore.crosschain.TxHashList") + proto.RegisterType((*TxHash)(nil), "zetachain.zetacore.crosschain.TxHash") proto.RegisterType((*OutboundTracker)(nil), "zetachain.zetacore.crosschain.OutboundTracker") } @@ -160,29 +160,29 @@ func init() { } var fileDescriptor_77cb2cfe04eb42d9 = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xcd, 0x4a, 0x3b, 0x31, - 0x14, 0xc5, 0x9b, 0x7f, 0xfb, 0x6f, 0xa7, 0x71, 0x21, 0x04, 0xd1, 0x11, 0x31, 0x94, 0xae, 0xea, - 0xc2, 0x14, 0x3f, 0x9e, 0xc0, 0x85, 0x28, 0x0a, 0xc2, 0xd8, 0x55, 0x37, 0xc3, 0x7c, 0x84, 0x26, - 0xa8, 0xc9, 0x90, 0xdc, 0x91, 0xe8, 0x53, 0xf8, 0x08, 0x3e, 0x8e, 0xcb, 0x2e, 0x5d, 0xca, 0xcc, - 0x8b, 0x48, 0x33, 0xa3, 0x15, 0x17, 0xee, 0xee, 0xef, 0x5e, 0xce, 0xe1, 0xdc, 0x83, 0x4f, 0x9f, - 0x39, 0x24, 0x99, 0x48, 0xa4, 0x9a, 0xfa, 0x49, 0x1b, 0x3e, 0xcd, 0x8c, 0xb6, 0xb6, 0xd9, 0xe9, - 0x12, 0x52, 0x5d, 0xaa, 0x3c, 0x06, 0x93, 0x64, 0x77, 0xdc, 0xb0, 0xc2, 0x68, 0xd0, 0x64, 0xff, - 0x5b, 0xc5, 0xbe, 0x54, 0x6c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a9, 0x01, 0x00, 0x00, -} - -func (m *TxHashList) Marshal() (dAtA []byte, err error) { + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xcb, 0x4a, 0x03, 0x31, + 0x14, 0x86, 0x1b, 0x5b, 0xa7, 0xd3, 0xb8, 0x10, 0x82, 0xe8, 0x88, 0x18, 0x4a, 0x41, 0xe8, 0xc6, + 0x14, 0x2f, 0x4f, 0xd0, 0x95, 0xa2, 0x20, 0x8c, 0xc5, 0x85, 0x9b, 0x61, 0x3a, 0x13, 0x3a, 0x41, + 0x4d, 0x4a, 0x72, 0x46, 0xa2, 0x4f, 0xe1, 0x03, 0xf8, 0x40, 0x2e, 0xbb, 0x74, 0x29, 0x33, 0x2f, + 0x22, 0x93, 0x8c, 0x17, 0x5c, 0xb8, 0xcb, 0x97, 0xc3, 0x77, 0xf8, 0xcf, 0x8f, 0x4f, 0x9f, 0x39, + 0xa4, 0x59, 0x91, 0x0a, 0x39, 0x71, 0x2f, 0xa5, 0xf9, 0x24, 0xd3, 0xca, 0x18, 0xff, 0xa7, 0x4a, + 0x98, 0xab, 0x52, 0xe6, 0x09, 0xe8, 0x34, 0xbb, 0xe3, 0x9a, 0x2d, 0xb5, 0x02, 0x45, 0xf6, 0xbf, + 0x2d, 0xf6, 0x65, 0xb1, 0x1f, 0x6b, 0x74, 0x83, 0x83, 0x99, 0x3d, 0x4b, 0x4d, 0x41, 0x76, 0x70, + 0x1f, 0x6c, 0x52, 0xa4, 0xa6, 0x88, 0xd0, 0x10, 0x8d, 0x07, 0x71, 0x00, 0x7e, 0xb0, 0x87, 0x07, + 0x60, 0x13, 0x23, 0x16, 0x92, 0xeb, 0x68, 0xcd, 0x8d, 0x42, 0xb0, 0xd7, 0x8e, 0xc9, 0x36, 0x0e, + 0x96, 0x5a, 0x3d, 0xf2, 0x3c, 0xea, 0x0e, 0xd1, 0x38, 0x8c, 0x5b, 0x1a, 0xbd, 0x22, 0xbc, 0x79, + 0xd5, 0x26, 0x9a, 0xf9, 0x40, 0x64, 0x0b, 0xaf, 0x0b, 0x99, 0x73, 0xdb, 0xee, 0xf7, 0x40, 0x76, + 0x71, 0xe8, 0xa2, 0x24, 0x22, 0x77, 0xdb, 0xbb, 0x71, 0xdf, 0xf1, 0x79, 0xde, 0x08, 0x52, 0xc9, + 0x8c, 0xbb, 0xdd, 0xbd, 0xd8, 0x03, 0x99, 0xe2, 0x41, 0x93, 0x32, 0xb9, 0x17, 0x06, 0xa2, 0xde, + 0xb0, 0x3b, 0xde, 0x38, 0x3e, 0x60, 0xff, 0x5e, 0xc9, 0xfc, 0x89, 0x71, 0xd8, 0x78, 0x97, 0xc2, + 0xc0, 0xf4, 0xe2, 0xad, 0xa2, 0x68, 0x55, 0x51, 0xf4, 0x51, 0x51, 0xf4, 0x52, 0xd3, 0xce, 0xaa, + 0xa6, 0x9d, 0xf7, 0x9a, 0x76, 0x6e, 0x8f, 0x16, 0x02, 0x8a, 0x72, 0xce, 0x32, 0xf5, 0xe0, 0x6a, + 0x3e, 0xfc, 0xd3, 0xb8, 0xfd, 0xdd, 0x39, 0x3c, 0x2d, 0xb9, 0x99, 0x07, 0xae, 0xe9, 0x93, 0xcf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x29, 0xc8, 0x7e, 0xa1, 0x01, 0x00, 0x00, +} + +func (m *TxHash) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -192,12 +192,12 @@ func (m *TxHashList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TxHashList) MarshalTo(dAtA []byte) (int, error) { +func (m *TxHash) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TxHashList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TxHash) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -294,7 +294,7 @@ func encodeVarintOutboundTracker(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TxHashList) Size() (n int) { +func (m *TxHash) Size() (n int) { if m == nil { return 0 } @@ -345,7 +345,7 @@ func sovOutboundTracker(x uint64) (n int) { func sozOutboundTracker(x uint64) (n int) { return sovOutboundTracker(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TxHashList) Unmarshal(dAtA []byte) error { +func (m *TxHash) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -368,10 +368,10 @@ func (m *TxHashList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxHashList: wiretype end group for non-group") + return fmt.Errorf("proto: TxHash: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxHashList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TxHash: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -607,7 +607,7 @@ func (m *OutboundTracker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.HashList = append(m.HashList, &TxHashList{}) + m.HashList = append(m.HashList, &TxHash{}) if err := m.HashList[len(m.HashList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err }