Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Aug 19, 2024
1 parent e2aa1ac commit 1dfb090
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions testutil/datagen/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/zoneconcierge/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/zoneconcierge/keeper/ibc_packet_btc_timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions x/zoneconcierge/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,15 +28,15 @@ 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)
}

// generate a number of fork headers
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
Expand Down
2 changes: 1 addition & 1 deletion x/zoneconcierge/keeper/proof_btc_timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/zoneconcierge/types/btc_timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1dfb090

Please sign in to comment.