Skip to content

Commit

Permalink
cosmos-50 running version
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 4, 2024
1 parent 4b0d3b4 commit 4fda780
Show file tree
Hide file tree
Showing 63 changed files with 868 additions and 935 deletions.
24 changes: 9 additions & 15 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
Expand Down Expand Up @@ -96,6 +95,8 @@ import (
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"

ibcnfttransfer "github.com/initia-labs/initia/x/ibc/nft-transfer"
ibcnfttransferkeeper "github.com/initia-labs/initia/x/ibc/nft-transfer/keeper"
Expand Down Expand Up @@ -179,8 +180,6 @@ var (
// this is only for testing
authtypes.Minter: {authtypes.Minter},
}

legacyCodecRegistered = false
)

var (
Expand Down Expand Up @@ -746,20 +745,22 @@ func NewInitiaApp(
staking.NewAppModule(appCodec, *app.StakingKeeper),
upgrade.NewAppModule(app.UpgradeKeeper, ac),
evidence.NewAppModule(*app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
authzmodule.NewAppModule(appCodec, *app.AuthzKeeper, app.interfaceRegistry),
groupmodule.NewAppModule(appCodec, *app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, *app.ConsensusParamsKeeper),
move.NewAppModule(appCodec, app.AccountKeeper, *app.MoveKeeper),
auction.NewAppModule(app.appCodec, *app.AuctionKeeper),
ophost.NewAppModule(appCodec, *app.OPHostKeeper),
// ibc modules
ibc.NewAppModule(app.IBCKeeper),
ibctransfer.NewAppModule(*app.TransferKeeper),
ibcnfttransfer.NewAppModule(appCodec, *app.NftTransferKeeper),
ica.NewAppModule(app.ICAControllerKeeper, app.ICAHostKeeper),
icaauth.NewAppModule(appCodec, *app.ICAAuthKeeper),
ibcfee.NewAppModule(*app.IBCFeeKeeper),
// router.NewAppModule(app.RouterKeeper),
ibcperm.NewAppModule(*app.IBCPermKeeper),
ophost.NewAppModule(appCodec, *app.OPHostKeeper),
ibctm.NewAppModule(),
solomachine.NewAppModule(),
)

// BasicModuleManager defines the module BasicManager is in charge of setting up basic,
Expand All @@ -769,18 +770,11 @@ func NewInitiaApp(
app.BasicModuleManager = module.NewBasicManagerFromManager(
app.ModuleManager,
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(),
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutil.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(appCodec),
})
app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino)
app.BasicModuleManager.RegisterInterfaces(interfaceRegistry)
if !legacyCodecRegistered {
// authz module use this codec to get signbytes.
// authz MsgExec can execute all message types,
// so legacy.Cdc need to register all amino messages to get proper signature
app.BasicModuleManager.RegisterLegacyAminoCodec(legacy.Cdc)
legacyCodecRegistered = true
}

// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
Expand Down
12 changes: 5 additions & 7 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

"cosmossdk.io/log"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/testutil/mock"
Expand All @@ -21,12 +23,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
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"

feegrantmodule "cosmossdk.io/x/feegrant/module"
"cosmossdk.io/x/upgrade"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/slashing"

ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
logger := log.NewLogger(os.Stdout)
app := NewInitiaApp(
logger, db, nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{})
ctx := app.NewContext(true)
ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})

// Create a mock module. This module will serve as the new module we're
// adding during a migration.
Expand All @@ -86,7 +86,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
mockModule := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
mockDefaultGenesis := json.RawMessage(`{"key": "value"}`)
mockModule.EXPECT().DefaultGenesis(gomock.Eq(app.appCodec)).Times(1).Return(mockDefaultGenesis)
mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.appCodec), gomock.Eq(mockDefaultGenesis)).Times(1).Return(nil)
mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.appCodec), gomock.Eq(mockDefaultGenesis)).Times(1)
mockModule.EXPECT().ConsensusVersion().Times(1).Return(uint64(0))

app.ModuleManager.Modules["mock"] = mockModule
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
app := SetupWithGenesisAccounts(nil, nil)

// make sure the upgrade keeper has version map in state
ctx := app.NewContext(false)
ctx := app.NewContext(true)
vm, err := app.UpgradeKeeper.GetModuleVersionMap(ctx)
require.NoError(t, err)

Expand All @@ -144,6 +144,4 @@ func TestGetKey(t *testing.T) {
db, nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{})

require.NotEmpty(t, app.GetKey(banktypes.StoreKey))
require.NotEmpty(t, app.GetTKey(paramstypes.TStoreKey))
require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey))
}
7 changes: 1 addition & 6 deletions cmd/initiad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"os"
"path"

rosettaCmd "cosmossdk.io/tools/rosetta/cmd"

tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -33,13 +31,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/genutil"
cosmosgenutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"

initiaapp "github.com/initia-labs/initia/app"
"github.com/initia-labs/initia/app/params"
movecmd "github.com/initia-labs/initia/cmd/move"
"github.com/initia-labs/initia/x/genutil"
genutilcli "github.com/initia-labs/initia/x/genutil/client/cli"
moveconfig "github.com/initia-labs/initia/x/move/config"
)
Expand Down Expand Up @@ -163,9 +161,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, b
keys.Commands(),
)

// add rosetta commands
rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))

// add move commands
rootCmd.AddCommand(movecmd.MoveCommand(encodingConfig.InterfaceRegistry.SigningContext().AddressCodec()))
}
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
cosmossdk.io/simapp v0.0.0-20231211060251-d8fb76d4c267
cosmossdk.io/store v1.0.1
cosmossdk.io/tools/confix v0.1.1
cosmossdk.io/tools/rosetta v0.2.1
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/feegrant v0.1.0
cosmossdk.io/x/tx v0.12.0
Expand Down Expand Up @@ -86,13 +85,11 @@ require (
github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
Expand Down
Loading

0 comments on commit 4fda780

Please sign in to comment.