Skip to content

Commit

Permalink
continue to lint in the same manner as IBC
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Dec 16, 2023
1 parent 1ee656e commit c929606
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ linters-settings:
- 'fmt.Println'
- name: import-shadowing
disabled: true
- name: get-return
disabled: true
- name: redundant-import-alias
disabled: true
16 changes: 8 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ import (
ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types"
"github.com/notional-labs/composable/v6/x/transfermiddleware"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"
txBoundary "github.com/notional-labs/composable/v6/x/tx-boundary"
txBoundaryTypes "github.com/notional-labs/composable/v6/x/tx-boundary/types"
txboundary "github.com/notional-labs/composable/v6/x/tx-boundary"
txboundarytypes "github.com/notional-labs/composable/v6/x/tx-boundary/types"
)

const (
Expand Down Expand Up @@ -199,7 +199,7 @@ var (
ica.AppModuleBasic{},
ibchooks.AppModuleBasic{},
transfermiddleware.AppModuleBasic{},
txBoundary.AppModuleBasic{},
txboundary.AppModuleBasic{},
ratelimitmodule.AppModuleBasic{},
consensus.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
Expand Down Expand Up @@ -311,12 +311,12 @@ func NewComposableApp(
transferModule := transfer.NewAppModule(app.TransferKeeper)
routerModule := router.NewAppModule(app.RouterKeeper)
transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper)
txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper)
txBoundaryModule := txboundary.NewAppModule(appCodec, app.TxBoundaryKeepper)
ratelimitModule := ratelimitmodule.NewAppModule(&app.RatelimitKeeper)
icqModule := icq.NewAppModule(app.ICQKeeper)
ibcHooksModule := ibchooks.NewAppModule()
icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper) // Only ICA Host
/**** Module Options ****/
// **** Module Options ****/

// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect.
Expand Down Expand Up @@ -378,7 +378,7 @@ func NewComposableApp(
ibctransfertypes.ModuleName,
routertypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
txboundarytypes.ModuleName,
ratelimitmoduletypes.ModuleName,
ibchookstypes.ModuleName,
icqtypes.ModuleName,
Expand Down Expand Up @@ -419,7 +419,7 @@ func NewComposableApp(
ibchost.ModuleName,
routertypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
txboundarytypes.ModuleName,
ratelimitmoduletypes.ModuleName,
ibchookstypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -456,7 +456,7 @@ func NewComposableApp(
icqtypes.ModuleName,
routertypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
txboundarytypes.ModuleName,
ratelimitmoduletypes.ModuleName,
ibchookstypes.ModuleName,
feegrant.ModuleName,
Expand Down
4 changes: 2 additions & 2 deletions app/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import (
composable "github.com/notional-labs/composable/v6/app"
"github.com/notional-labs/composable/v6/app/ibctesting/simapp"
ratelimitmodulekeeper "github.com/notional-labs/composable/v6/x/ratelimit/keeper"
routerKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
routerkeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
)

// TestChain is a testing struct that wraps a simapp with the last TM Header, the current ABCI
Expand Down Expand Up @@ -617,7 +617,7 @@ func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabili
return capability
}

func (chain *TestChain) TransferMiddleware() routerKeeper.Keeper {
func (chain *TestChain) TransferMiddleware() routerkeeper.Keeper {
return chain.GetTestSupport().TransferMiddleware()
}

Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/event_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func getAckPackets(evts []abci.Event) []PacketAck {
// for _, attr := range evt.Attributes {
// fmt.Printf(" %s = %s\n", string(attr.Key), string(attr.Value))
// }
//}
// }

func parsePacketFromEvent(evt abci.Event) channeltypes.Packet {
return channeltypes.Packet{
Expand Down
3 changes: 2 additions & 1 deletion app/ibctesting/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ import (
simappupgrades "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades"
v6 "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades/v6"
v7 "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades/v7"

// TODO: mint module not complete yet,
"github.com/notional-labs/composable/v6/x/mint"
mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper"
minttypes "github.com/notional-labs/composable/v6/x/mint/types"
transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware"
"github.com/notional-labs/composable/v6/x/transfermiddleware"
transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"
)
Expand Down
4 changes: 2 additions & 2 deletions app/ibctesting/simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"

sdkcmd "cosmossdk.io/simapp/simd/cmd"
rosettaCmd "cosmossdk.io/tools/rosetta/cmd"
rosettacmd "cosmossdk.io/tools/rosetta/cmd"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -189,7 +189,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
)

// add rosetta
rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))
rootCmd.AddCommand(rosettacmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))
}

func addModuleInitFlags(startCmd *cobra.Command) {
Expand Down
20 changes: 10 additions & 10 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
wasm08Keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
wasmclientkeeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasmclienttypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"

custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper"
ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks"
ibchooks "github.com/notional-labs/composable/v6/x/ibc-hooks"
ibchookskeeper "github.com/notional-labs/composable/v6/x/ibc-hooks/keeper"
ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types"
mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper"
Expand Down Expand Up @@ -112,11 +112,11 @@ type AppKeepers struct {
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
GroupKeeper groupkeeper.Keeper
Wasm08Keeper wasm08Keeper.Keeper // TODO: use this name ?
Wasm08Keeper wasmclientkeeper.Keeper
WasmKeeper wasm.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
Ics20WasmHooks *ibc_hooks.WasmHooks
HooksICS4Wrapper ibc_hooks.ICS4Middleware
Ics20WasmHooks *ibchooks.WasmHooks
HooksICS4Wrapper ibchooks.ICS4Middleware
// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -213,7 +213,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String()

appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasmtypes.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)
appKeepers.Wasm08Keeper = wasmclientkeeper.NewKeeper(appCodec, appKeepers.keys[wasmclienttypes.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)

// ICA Host keeper
appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
Expand All @@ -237,9 +237,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.IBCHooksKeeper = &hooksKeeper

composablePrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
wasmHooks := ibc_hooks.NewWasmHooks(&hooksKeeper, nil, composablePrefix) // The contract keeper needs to be set later
wasmHooks := ibchooks.NewWasmHooks(&hooksKeeper, nil, composablePrefix) // The contract keeper needs to be set later
appKeepers.Ics20WasmHooks = &wasmHooks
appKeepers.HooksICS4Wrapper = ibc_hooks.NewICS4Middleware(
appKeepers.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.Ics20WasmHooks,
)
Expand Down Expand Up @@ -318,7 +318,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
ratelimitMiddlewareStack := ratelimitmodule.NewIBCMiddleware(appKeepers.RatelimitKeeper, ibcMiddlewareStack)
hooksTransferMiddleware := ibc_hooks.NewIBCMiddleware(ratelimitMiddlewareStack, &appKeepers.HooksICS4Wrapper)
hooksTransferMiddleware := ibchooks.NewIBCMiddleware(ratelimitMiddlewareStack, &appKeepers.HooksICS4Wrapper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
Expand Down
4 changes: 2 additions & 2 deletions app/test_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"

ratelimitkeeper "github.com/notional-labs/composable/v6/x/ratelimit/keeper"
tfmdKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
tfmdkeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
)

type TestSupport struct {
Expand Down Expand Up @@ -84,7 +84,7 @@ func (s TestSupport) GetTxConfig() client.TxConfig {
return s.app.GetTxConfig()
}

func (s TestSupport) TransferMiddleware() tfmdKeeper.Keeper {
func (s TestSupport) TransferMiddleware() tfmdkeeper.Keeper {
return s.app.TransferMiddlewareKeeper
}

Expand Down
6 changes: 3 additions & 3 deletions bech32-migration/gov/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"

"github.com/notional-labs/composable/v6/bech32-migration/utils"
Expand All @@ -18,7 +18,7 @@ func MigrateAddressBech32(ctx sdk.Context, storeKey storetypes.StoreKey, cdc cod
vote := v1beta1.Vote{}
err := cdc.Unmarshal(bz, &vote)
if err != nil {
vote := v1.Vote{}
vote := govv1.Vote{}
cdc.MustUnmarshal(bz, &vote)
vote.Voter = utils.ConvertAccAddr(vote.Voter)
voteCount++
Expand All @@ -33,7 +33,7 @@ func MigrateAddressBech32(ctx sdk.Context, storeKey storetypes.StoreKey, cdc cod
deposit := v1beta1.Deposit{}
err := cdc.Unmarshal(bz, &deposit)
if err != nil {
vote := v1.Deposit{}
vote := govv1.Deposit{}
cdc.MustUnmarshal(bz, &vote)
deposit.Depositor = utils.ConvertAccAddr(deposit.Depositor)
depositCount++
Expand Down
2 changes: 1 addition & 1 deletion x/transfermiddleware/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

helpers "github.com/notional-labs/composable/v6/app/helpers"
"github.com/notional-labs/composable/v6/app/helpers"
"github.com/notional-labs/composable/v6/x/transfermiddleware/types"
)

Expand Down
5 changes: 4 additions & 1 deletion x/transfermiddleware/keeper/ics4wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ func (keeper Keeper) handleOverrideSendPacketTransferLogic(
}
// burn native token
// Get Coin from excrow address
keeper.bankKeeper.BurnCoins(ctx, transfertypes.ModuleName, sdk.NewCoins(nativeTransferToken))
err = keeper.bankKeeper.BurnCoins(ctx, transfertypes.ModuleName, sdk.NewCoins(nativeTransferToken))
if err != nil {
return 0, err
}

// release lock IBC token and send it to sender
// TODO: should we use a module address for this ?
Expand Down
2 changes: 1 addition & 1 deletion x/tx-boundary/types/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

import fmt "fmt"
import "fmt"

var (
DefaultDelegateBoundary = Boundary{
Expand Down

0 comments on commit c929606

Please sign in to comment.