Skip to content

Commit

Permalink
refactor: rename txHashList to txHash (#2476)
Browse files Browse the repository at this point in the history
* rename txHashList to txHash

* run make generate

* run make generate

* change struct in test file too
  • Loading branch information
mohitsethia authored Jul 16, 2024
1 parent fde03f7 commit 7521b6d
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 74 deletions.
4 changes: 2 additions & 2 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57273,7 +57273,7 @@ definitions:
type: array
items:
type: object
$ref: '#/definitions/crosschainTxHashList'
$ref: '#/definitions/crosschainTxHash'
crosschainQueryAllCctxResponse:
type: object
properties:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions proto/zetachain/zetacore/crosschain/outbound_tracker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
20 changes: 10 additions & 10 deletions typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TxHashList> {
export declare class TxHash extends Message<TxHash> {
/**
* @generated from field: string tx_hash = 1;
*/
Expand All @@ -25,19 +25,19 @@ export declare class TxHashList extends Message<TxHashList> {
*/
proved: boolean;

constructor(data?: PartialMessage<TxHashList>);
constructor(data?: PartialMessage<TxHash>);

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<BinaryReadOptions>): TxHashList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TxHash;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TxHashList;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TxHash;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TxHashList;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TxHash;

static equals(a: TxHashList | PlainMessage<TxHashList> | undefined, b: TxHashList | PlainMessage<TxHashList> | undefined): boolean;
static equals(a: TxHash | PlainMessage<TxHash> | undefined, b: TxHash | PlainMessage<TxHash> | undefined): boolean;
}

/**
Expand All @@ -62,9 +62,9 @@ export declare class OutboundTracker extends Message<OutboundTracker> {
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<OutboundTracker>);

Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/keeper/msg_server_add_outbound_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions x/crosschain/keeper/msg_server_add_outbound_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down
106 changes: 53 additions & 53 deletions x/crosschain/types/outbound_tracker.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7521b6d

Please sign in to comment.