Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 committed Jul 20, 2023
1 parent d4cac08 commit 9f0683a
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 28 deletions.
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ func (app *CentauriApp) setupUpgradeStoreLoaders() {
}

func (app *CentauriApp) customPreUpgradeHandler(upgradeInfo upgradetypes.Plan) {
switch upgradeInfo.Name {
default:
}
// switch upgradeInfo.Name {
// default:
// }
}

func (app *CentauriApp) setupUpgradeHandlers() {
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/notional-labs/centauri/v4/x/ibc-hooks/types"
)

func indexRunCmd(cmd *cobra.Command, args []string) error {
func indexRunCmd(cmd *cobra.Command, _ []string) error {
usageTemplate := `Usage:{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}
Expand Down
8 changes: 4 additions & 4 deletions x/ibc-hooks/hooks.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
// external libraries
Expand All @@ -14,13 +14,13 @@ import (
type Hooks interface{}

type OnChanOpenInitOverrideHooks interface {
OnChanOpenInitOverride(im IBCMiddleware, ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string) (string, error)
OnChanOpenInitOverride(im IBCMiddleware, ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string) (string, error)
}
type OnChanOpenInitBeforeHooks interface {
OnChanOpenInitBeforeHook(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string)
OnChanOpenInitBeforeHook(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string)
}
type OnChanOpenInitAfterHooks interface {
OnChanOpenInitAfterHook(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, finalVersion string, err error)
OnChanOpenInitAfterHook(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version, finalVersion string, err error)
}

// OnChanOpenTry Hooks
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/ibc_module.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
// external libraries
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/ics4_middleware.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
// external libraries
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ func (k Keeper) DeletePacketCallback(ctx sdk.Context, channel string, packetSequ
func DeriveIntermediateSender(channel, originalSender, bech32Prefix string) (string, error) {
senderStr := fmt.Sprintf("%s/%s", channel, originalSender)
senderHash32 := address.Hash(types.SenderPrefix, []byte(senderStr))
sender := sdk.AccAddress(senderHash32[:])
sender := sdk.AccAddress(senderHash32)
return sdk.Bech32ifyAddressBytes(bech32Prefix, sender)
}
4 changes: 2 additions & 2 deletions x/ibc-hooks/module.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
"encoding/json"
Expand Down Expand Up @@ -35,7 +35,7 @@ func (AppModuleBasic) Name() string {
}

// RegisterLegacyAminoCodec registers the ibc-hooks module's types on the given LegacyAmino codec.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {}

// RegisterInterfaces registers the module's interface types.
func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {}
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/relay_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks_test
package ibchooks_test

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/wasm_hook.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ibc_hooks
package ibchooks

import (
"encoding/json"
Expand Down
4 changes: 2 additions & 2 deletions x/ratelimit/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ func (im IBCMiddleware) WriteAcknowledgement(
}

// GetAppVersion returns the application version of the underlying application
func (i IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) {
return i.keeper.GetAppVersion(ctx, portID, channelID)
func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) {
return im.keeper.GetAppVersion(ctx, portID, channelID)
}
12 changes: 6 additions & 6 deletions x/ratelimit/keeper/rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// Get the rate limit byte key built from the denom and channelID
func GetRateLimitItemKey(denom string, channelID string) []byte {
func GetRateLimitItemKey(denom, channelID string) []byte {
return append(types.KeyPrefix(denom), types.KeyPrefix(channelID)...)
}

Expand Down Expand Up @@ -108,7 +108,7 @@ func (k Keeper) UndoSendPacket(ctx sdk.Context, channelID string, sequence uint6
// Reset the rate limit after expiration
// The inflow and outflow should get reset to 0, the channelValue should be updated,
// and all pending send packet sequence numbers should be removed
func (k Keeper) ResetRateLimit(ctx sdk.Context, denom string, channelID string) error {
func (k Keeper) ResetRateLimit(ctx sdk.Context, denom, channelID string) error {
if k.tfmwKeeper.HasParachainIBCTokenInfoByNativeDenom(ctx, denom) {
tokenInfo := k.tfmwKeeper.GetParachainIBCTokenInfoByNativeDenom(ctx, denom)
if channelID == tokenInfo.ChannelID {
Expand Down Expand Up @@ -144,7 +144,7 @@ func (k Keeper) SetRateLimit(ctx sdk.Context, rateLimit types.RateLimit) {
}

// Removes a rate limit object from the store using denom and channel-id
func (k Keeper) RemoveRateLimit(ctx sdk.Context, denom string, channelID string) error {
func (k Keeper) RemoveRateLimit(ctx sdk.Context, denom, channelID string) error {
if k.tfmwKeeper.HasParachainIBCTokenInfoByNativeDenom(ctx, denom) {
tokenInfo := k.tfmwKeeper.GetParachainIBCTokenInfoByNativeDenom(ctx, denom)
if channelID == tokenInfo.ChannelID {
Expand All @@ -165,7 +165,7 @@ func (k Keeper) RemoveRateLimit(ctx sdk.Context, denom string, channelID string)
}

// Grabs and returns a rate limit object from the store using denom and channel-id
func (k Keeper) GetRateLimit(ctx sdk.Context, denom string, channelID string) (rateLimit types.RateLimit, found bool) {
func (k Keeper) GetRateLimit(ctx sdk.Context, denom, channelID string) (rateLimit types.RateLimit, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.RateLimitKeyPrefix)

rateLimitKey := GetRateLimitItemKey(denom, channelID)
Expand Down Expand Up @@ -327,8 +327,8 @@ func (k Keeper) GetAllPendingSendPackets(ctx sdk.Context) []string {
channelID = strings.TrimRight(channelID, "\x00") // removes null bytes from suffix
sequence := binary.BigEndian.Uint64(key[types.PendingSendPacketChannelLength:])

packetId := fmt.Sprintf("%s/%d", channelID, sequence)
pendingPackets = append(pendingPackets, packetId)
packetID := fmt.Sprintf("%s/%d", channelID, sequence)
pendingPackets = append(pendingPackets, packetID)
}

return pendingPackets
Expand Down
4 changes: 2 additions & 2 deletions x/ratelimit/types/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
)

var (
DayEpoch = "hour"
EpochHourPeriod time.Duration = 24 * time.Hour
DayEpoch = "hour"
EpochHourPeriod = 24 * time.Hour
)

// Validate also validates epoch info.
Expand Down
2 changes: 0 additions & 2 deletions x/transfermiddleware/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ func (k Keeper) BeginBlocker(ctx sdk.Context) {
if ctx.BlockTime().After(removeList.RemoveTime) {
k.RemoveParachainIBCInfo(ctx, removeList.NativeDenom)
}

return false
})

}

0 comments on commit 9f0683a

Please sign in to comment.