Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Aug 19, 2024
1 parent fe806a3 commit f543120
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 32 deletions.
4 changes: 1 addition & 3 deletions x/crosschain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
if found {
for _, elem := range genState.CrossChainTxs {
if elem != nil {
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, *elem, func(ctx sdk.Context) string {
return tss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, *elem, tss.TssPubkey)

Check warning on line 50 in x/crosschain/genesis.go

View check run for this annotation

Codecov / codecov/patch

x/crosschain/genesis.go#L48-L50

Added lines #L48 - L50 were not covered by tests
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions x/crosschain/keeper/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import (
func (k Keeper) SetCctxAndNonceToCctxAndInboundHashToCctx(
ctx sdk.Context,
cctx types.CrossChainTx,
tssFunc func(ctx sdk.Context) string,
tssPubkey string,
) {
// set mapping nonce => cctxIndex
tssPubkey := tssFunc(ctx)
if cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound ||
cctx.CctxStatus.Status == types.CctxStatus_PendingRevert {
k.GetObserverKeeper().SetNonceToCctx(ctx, observerTypes.NonceToCctx{
Expand Down
4 changes: 1 addition & 3 deletions x/crosschain/keeper/cctx_orchestrator_validate_inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ func (k Keeper) ValidateInbound(
if ok {
cctx.InboundParams.ObservedHash = inCctxIndex
}
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, func(ctx sdk.Context) string {
return tss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, tss.TssPubkey)

return &cctx, nil
}
Expand Down
8 changes: 2 additions & 6 deletions x/crosschain/keeper/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ func createNCctxWithStatus(
items[i].OutboundParams = []*types.OutboundParams{{Amount: math.ZeroUint()}}
items[i].RevertOptions = types.NewEmptyRevertOptions()

keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, items[i], func(ctx sdk.Context) string {
return tssPubkey
})
keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, items[i], tssPubkey)
}
return items
}
Expand Down Expand Up @@ -84,9 +82,7 @@ func createNCctx(keeper *keeper.Keeper, ctx sdk.Context, n int, tssPubkey string
items[i].Index = fmt.Sprintf("%d", i)
items[i].RevertOptions = types.NewEmptyRevertOptions()

keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, items[i], func(ctx sdk.Context) string {
return tssPubkey
})
keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, items[i], tssPubkey)
}
return items
}
Expand Down
4 changes: 1 addition & 3 deletions x/crosschain/keeper/grpc_query_inbound_hash_to_cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ func createInTxHashToCctxWithCctxs(
cctxs[i].InboundParams = &types.InboundParams{ObservedHash: fmt.Sprintf("%d", i), Amount: math.OneUint()}
cctxs[i].CctxStatus = &types.Status{Status: types.CctxStatus_PendingInbound}
cctxs[i].RevertOptions = types.NewEmptyRevertOptions()
keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctxs[i], func(ctx sdk.Context) string {
return tssPubkey
})
keeper.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctxs[i], tssPubkey)
}

var inboundHashToCctx types.InboundHashToCctx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ func (k msgServer) MigrateERC20CustodyFunds(
if err != nil {
return nil, err
}
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, func(ctx sdk.Context) string {
return tss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, tss.TssPubkey)

err = ctx.EventManager().EmitTypedEvent(
&types.EventERC20CustodyFundsMigration{
Expand Down
4 changes: 1 addition & 3 deletions x/crosschain/keeper/msg_server_migrate_tss_funds.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ func (k Keeper) initiateMigrateTSSFundsCCTX(
}
}

k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, func(ctx sdk.Context) string {
return currentTss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, currentTss.TssPubkey)
k.zetaObserverKeeper.SetFundMigrator(ctx, observertypes.TssFundMigratorInfo{
ChainId: chainID,
MigrationCctxIndex: cctx.Index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ func (k msgServer) UpdateERC20CustodyPauseStatus(
if err != nil {
return nil, err
}
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, func(ctx sdk.Context) string {
return tss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, tss.TssPubkey)

err = ctx.EventManager().EmitTypedEvent(
&types.EventERC20CustodyPausing{
Expand Down
4 changes: 1 addition & 3 deletions x/crosschain/keeper/msg_server_vote_outbound_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ func (k Keeper) SaveOutbound(ctx sdk.Context, cctx *types.CrossChainTx, tssPubke
k.RemoveOutboundTrackerFromStore(ctx, outboundParams.ReceiverChainId, outboundParams.TssNonce)
}
// This should set nonce to cctx only if a new revert is created.
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, *cctx, func(ctx sdk.Context) string {
return tssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, *cctx, tssPubkey)
}

func (k Keeper) ValidateOutboundMessage(ctx sdk.Context, msg types.MsgVoteOutbound) (types.CrossChainTx, error) {
Expand Down
4 changes: 1 addition & 3 deletions x/crosschain/keeper/msg_server_whitelist_erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ func (k msgServer) WhitelistERC20(
GasLimit: uint64(msg.GasLimit),
}
k.fungibleKeeper.SetForeignCoins(ctx, foreignCoin)
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, func(ctx sdk.Context) string {
return tss.TssPubkey
})
k.SetCctxAndNonceToCctxAndInboundHashToCctx(ctx, cctx, tss.TssPubkey)

commit()

Expand Down

0 comments on commit f543120

Please sign in to comment.