Skip to content

Commit

Permalink
cleanup unused codes
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 5, 2024
1 parent ce39028 commit 55cf483
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 37 deletions.
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/api"
Expand All @@ -49,6 +50,7 @@ import (
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -68,8 +70,6 @@ import (
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"github.com/cosmos/cosmos-sdk/runtime"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper"
Expand Down Expand Up @@ -337,7 +337,7 @@ func NewMinitiaApp(
runtime.NewKVStoreService(keys[opchildtypes.StoreKey]),
app.AccountKeeper,
app.BankKeeper,
apphook.NewMoveBridgeHook(ac, app.MoveKeeper).Hook,
apphook.NewMoveBridgeHook(app.MoveKeeper).Hook,
app.MsgServiceRouter(),
authorityAddr,
vc,
Expand Down Expand Up @@ -588,7 +588,7 @@ func NewMinitiaApp(
// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect.

// TODO - add crisis?
// TODO - add crisis module
// skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

// NOTE: Any module instantiated in the module manager that is later modified
Expand Down Expand Up @@ -720,7 +720,7 @@ func NewMinitiaApp(
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: math.LegacyZeroDec(),
MaxTxs: 109,
MaxTxs: 100,
SignerExtractor: signerExtractor,
}
freeLane := initialanes.NewFreeLane(freeConfig, applanes.FreeLaneMatchHandler())
Expand Down
4 changes: 2 additions & 2 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/consensus"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/ibc-go/modules/capability"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"cosmossdk.io/x/upgrade"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/x/params"

ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
Expand Down Expand Up @@ -89,7 +89,6 @@ func TestInitGenesisOnMigration(t *testing.T) {
"bank": bank.AppModule{}.ConsensusVersion(),
"auth": auth.AppModule{}.ConsensusVersion(),
"authz": authzmodule.AppModule{}.ConsensusVersion(),
"params": params.AppModule{}.ConsensusVersion(),
"upgrade": upgrade.AppModule{}.ConsensusVersion(),
"capability": capability.AppModule{}.ConsensusVersion(),
"group": groupmodule.AppModule{}.ConsensusVersion(),
Expand Down Expand Up @@ -126,4 +125,5 @@ func TestGetKey(t *testing.T) {
db, nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{})

require.NotEmpty(t, app.GetKey(banktypes.StoreKey))
require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey))
}
33 changes: 4 additions & 29 deletions app/hook/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@ import (
"context"
"encoding/json"

"cosmossdk.io/core/address"
sdk "github.com/cosmos/cosmos-sdk/types"

movekeeper "github.com/initia-labs/initia/x/move/keeper"
movetypes "github.com/initia-labs/initia/x/move/types"
vmtypes "github.com/initia-labs/initiavm/types"
)

// bridge hook implementation for move
type MoveBridgeHook struct {
ac address.Codec
moveKeeper *movekeeper.Keeper
}

func NewMoveBridgeHook(ac address.Codec, moveKeeper *movekeeper.Keeper) MoveBridgeHook {
return MoveBridgeHook{ac, moveKeeper}
func NewMoveBridgeHook(moveKeeper *movekeeper.Keeper) MoveBridgeHook {
return MoveBridgeHook{moveKeeper}
}

func (mbh MoveBridgeHook) Hook(ctx context.Context, sender sdk.AccAddress, msgBytes []byte) error {
Expand All @@ -29,30 +26,8 @@ func (mbh MoveBridgeHook) Hook(ctx context.Context, sender sdk.AccAddress, msgBy
return err
}

senderAddr, err := vmtypes.NewAccountAddressFromBytes(sender)
if err != nil {
return err
}

moduleAddress, err := movetypes.AccAddressFromString(mbh.ac, msg.ModuleAddress)
if err != nil {
return err
}

typeArgs, err := movetypes.TypeTagsFromTypeArgs(msg.TypeArgs)
if err != nil {
return err
}

err = mbh.moveKeeper.ExecuteEntryFunction(
ctx,
senderAddr,
moduleAddress,
msg.ModuleName,
msg.FunctionName,
typeArgs,
msg.Args,
)
ms := movekeeper.NewMsgServerImpl(*mbh.moveKeeper)
_, err = ms.Execute(ctx, &msg)

return err
}
1 change: 0 additions & 1 deletion cmd/minitiad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
// NewRootCmd creates a new root command for initiad. It is called once in the
// main function.
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

sdkConfig := sdk.GetConfig()
sdkConfig.SetCoinType(minitiaapp.CoinType)

Expand Down

0 comments on commit 55cf483

Please sign in to comment.