From 1dfb09096a1d9ed08f27d5ddce514b8a22644b7a Mon Sep 17 00:00:00 2001 From: Runchao Han Date: Mon, 19 Aug 2024 15:46:49 +1000 Subject: [PATCH] fix lint --- testutil/datagen/tendermint.go | 11 ++++++----- x/zoneconcierge/keeper/grpc_query_test.go | 2 +- x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go | 2 +- x/zoneconcierge/keeper/keeper_test.go | 6 +++--- x/zoneconcierge/keeper/proof_btc_timestamp_test.go | 2 +- x/zoneconcierge/types/btc_timestamp_test.go | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/testutil/datagen/tendermint.go b/testutil/datagen/tendermint.go index 82985156d..8a40fc275 100644 --- a/testutil/datagen/tendermint.go +++ b/testutil/datagen/tendermint.go @@ -41,12 +41,13 @@ func GenRandomTMHeaderInfo(r *rand.Rand, chainID string, height uint64) *header. } } -func HeaderToHeaderInfo(header *ibctmtypes.Header) *zctypes.HeaderInfo { +func NewZCHeaderInfo(header *ibctmtypes.Header, clientID string) *zctypes.HeaderInfo { return &zctypes.HeaderInfo{ - AppHash: header.Header.AppHash, - ChainId: header.Header.ChainID, - Time: header.Header.Time, - Height: uint64(header.Header.Height), + ClientId: clientID, + AppHash: header.Header.AppHash, + ChainId: header.Header.ChainID, + Time: header.Header.Time, + Height: uint64(header.Header.Height), } } diff --git a/x/zoneconcierge/keeper/grpc_query_test.go b/x/zoneconcierge/keeper/grpc_query_test.go index 1b5d91e8e..b160119a0 100644 --- a/x/zoneconcierge/keeper/grpc_query_test.go +++ b/x/zoneconcierge/keeper/grpc_query_test.go @@ -48,7 +48,7 @@ func FuzzChainList(f *testing.F) { allConsumerIDs = append(allConsumerIDs, consumerID) } header := datagen.GenRandomIBCTMHeader(r, 0) - zcKeeper.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) + zcKeeper.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.NewZCHeaderInfo(header, consumerID), false) } limit := datagen.RandomInt(r, len(allConsumerIDs)) + 1 diff --git a/x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go b/x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go index 218d25ed6..447051973 100644 --- a/x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go +++ b/x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go @@ -231,7 +231,7 @@ func (k Keeper) BroadcastBTCTimestamps( // get the ID of the chain under this channel consumerID, err := k.getClientID(ctx, channel) if err != nil { - k.Logger(sdkCtx).Error("failed to get chain ID, skip sending BTC timestamp for this chain", "channelID", channel.ChannelId, "error", err) + k.Logger(sdkCtx).Error("failed to get client ID, skip sending BTC timestamp for this consumer", "channelID", channel.ChannelId, "error", err) continue } diff --git a/x/zoneconcierge/keeper/keeper_test.go b/x/zoneconcierge/keeper/keeper_test.go index d6a68a57e..a552219b8 100644 --- a/x/zoneconcierge/keeper/keeper_test.go +++ b/x/zoneconcierge/keeper/keeper_test.go @@ -16,7 +16,7 @@ func SimulateNewHeaders(ctx context.Context, r *rand.Rand, k *zckeeper.Keeper, c // invoke the hook a number of times to simulate a number of blocks for i := uint64(0); i < numHeaders; i++ { header := datagen.GenRandomIBCTMHeader(r, startHeight+i) - k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) + k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.NewZCHeaderInfo(header, consumerID), false) headers = append(headers, header) } return headers @@ -28,7 +28,7 @@ func SimulateNewHeadersAndForks(ctx context.Context, r *rand.Rand, k *zckeeper.K // invoke the hook a number of times to simulate a number of blocks for i := uint64(0); i < numHeaders; i++ { header := datagen.GenRandomIBCTMHeader(r, startHeight+i) - k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) + k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.NewZCHeaderInfo(header, consumerID), false) headers = append(headers, header) } @@ -36,7 +36,7 @@ func SimulateNewHeadersAndForks(ctx context.Context, r *rand.Rand, k *zckeeper.K forkHeaders := []*ibctmtypes.Header{} for i := uint64(0); i < numForkHeaders; i++ { header := datagen.GenRandomIBCTMHeader(r, startHeight+numHeaders-1) - k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), true) + k.HandleHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.NewZCHeaderInfo(header, consumerID), true) forkHeaders = append(forkHeaders, header) } return headers, forkHeaders diff --git a/x/zoneconcierge/keeper/proof_btc_timestamp_test.go b/x/zoneconcierge/keeper/proof_btc_timestamp_test.go index 535079d8f..97ef52fba 100644 --- a/x/zoneconcierge/keeper/proof_btc_timestamp_test.go +++ b/x/zoneconcierge/keeper/proof_btc_timestamp_test.go @@ -44,7 +44,7 @@ func FuzzProofCZHeaderInEpoch(f *testing.F) { consumerID := datagen.GenRandomHexStr(r, 10) height := datagen.RandomInt(r, 100) + 1 ibctmHeader := datagen.GenRandomIBCTMHeader(r, height) - headerInfo := datagen.HeaderToHeaderInfo(ibctmHeader) + headerInfo := datagen.NewZCHeaderInfo(ibctmHeader, consumerID) zck.HandleHeaderWithValidCommit(h.Ctx, datagen.GenRandomByteArray(r, 32), headerInfo, false) // ensure the header is successfully inserted diff --git a/x/zoneconcierge/types/btc_timestamp_test.go b/x/zoneconcierge/types/btc_timestamp_test.go index a0d8d8d46..4d62fe195 100644 --- a/x/zoneconcierge/types/btc_timestamp_test.go +++ b/x/zoneconcierge/types/btc_timestamp_test.go @@ -62,7 +62,7 @@ func FuzzBTCTimestamp(f *testing.F) { consumerID := datagen.GenRandomHexStr(r, 10) height := datagen.RandomInt(r, 100) + 1 ibctmHeader := datagen.GenRandomIBCTMHeader(r, height) - headerInfo := datagen.HeaderToHeaderInfo(ibctmHeader) + headerInfo := datagen.NewZCHeaderInfo(ibctmHeader, consumerID) zck.HandleHeaderWithValidCommit(h.Ctx, datagen.GenRandomByteArray(r, 32), headerInfo, false) // ensure the header is successfully inserted