Skip to content

Commit

Permalink
Merge pull request #101 from AssetMantle/deepanshutr/master
Browse files Browse the repository at this point in the history
Deepanshutr/master
  • Loading branch information
deepanshutr authored Jun 24, 2024
2 parents 01e1137 + 7e1b8bb commit 00cfaa8
Show file tree
Hide file tree
Showing 28 changed files with 1,007 additions and 827 deletions.
2 changes: 1 addition & 1 deletion .run/start node.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="start node" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="start">
<module name="node" />
<working_directory value="$PROJECT_DIR$/" />
<parameters value="start" />
<parameters value="start --minimum-gas-prices 0.01stake"/>
<kind value="FILE" />
<package value="github.com/AssetMantle/node" />
<directory value="$PROJECT_DIR$/" />
Expand Down
8 changes: 5 additions & 3 deletions application/commands/addGenesisAccountCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
}

// attempt to lookup address from Keybase if no address was provided
kb, err := keyring.New(sdkTypes.KeyringServiceName(), keyringBackend, clientContext.HomeDir, inBuf)
kb, err := keyring.New(sdkTypes.KeyringServiceName(), keyringBackend, clientContext.HomeDir, inBuf, clientContext.Codec)
if err != nil {
return err
}
Expand All @@ -65,7 +65,9 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return fmt.Errorf("failed to get address from Keybase: %w", err)
}

addr = info.GetAddress()
if addr, err = info.GetAddress(); err != nil {
return fmt.Errorf("failed to get address %w", err)
}
}

coins, err := sdkTypes.ParseCoinsNormalized(args[1])
Expand Down Expand Up @@ -141,7 +143,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
}

// Add the new account to the set of genesis accounts and sanitize the
// accounts afterwards.
// accounts afterward.
accounts = append(accounts, genAccount)
accounts = authTypes.SanitizeGenesisAccounts(accounts)

Expand Down
13 changes: 6 additions & 7 deletions application/commands/rootCommand.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package commands

import (
"github.com/cosmos/cosmos-sdk/client/snapshot"
"os"

"github.com/AssetMantle/modules/helpers"
"github.com/AssetMantle/modules/helpers/base"
tmcfg "github.com/cometbft/cometbft/config"
tendermintCLI "github.com/cometbft/cometbft/libs/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
Expand All @@ -20,7 +23,6 @@ import (
bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types"
sdkClientCLI "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cobra"
tendermintCLI "github.com/tendermint/tendermint/libs/cli"

"github.com/AssetMantle/node/application"
"github.com/AssetMantle/node/application/internal/configurations"
Expand Down Expand Up @@ -62,31 +64,28 @@ func RootCommand() (*cobra.Command, helpers.Codec) {
ServerConfig.API.Enable = true
ServerConfig.API.Swagger = true

return server.InterceptConfigsPreRunHandler(cmd, serverConfig.DefaultConfigTemplate, &ServerConfig)
return server.InterceptConfigsPreRunHandler(cmd, serverConfig.DefaultConfigTemplate, &ServerConfig, tmcfg.DefaultConfig())
},
}

configurations.SetAndSealSDKConfig()

rootCmd.AddCommand(
sdkClientCLI.InitCmd(configurations.ModuleBasicManager, application.Prototype.GetDefaultNodeHome()),
sdkClientCLI.CollectGenTxsCmd(bankTypes.GenesisBalancesIterator{}, application.Prototype.GetDefaultNodeHome()),
sdkClientCLI.MigrateGenesisCmd(),
sdkClientCLI.GenTxCmd(configurations.ModuleBasicManager, codec, bankTypes.GenesisBalancesIterator{}, application.Prototype.GetDefaultNodeHome()),
sdkClientCLI.ValidateGenesisCmd(configurations.ModuleBasicManager),
AddGenesisAccountCommand(application.Prototype.GetDefaultNodeHome()),
tendermintCLI.NewCompletionCmd(rootCmd, true),
debug.Cmd(),
config.Cmd(),
pruning.PruningCmd(application.Prototype.AppCreator),
TestnetCommand(configurations.ModuleBasicManager, bankTypes.GenesisBalancesIterator{}),
snapshot.Cmd(application.Prototype.AppCreator),
version.NewVersionCommand(),
)

server.AddCommands(rootCmd, application.Prototype.GetDefaultNodeHome(), application.Prototype.AppCreator, application.Prototype.AppExporter, application.Prototype.ModuleInitFlags)

rootCmd.AddCommand(
rpc.StatusCommand(),
sdkClientCLI.GenesisCoreCommand(context.TxConfig, configurations.ModuleBasicManager, application.Prototype.GetDefaultNodeHome()),
queryCommand(),
txCommand(),
keys.Commands(application.Prototype.GetDefaultNodeHome()),
Expand Down
18 changes: 9 additions & 9 deletions application/commands/testnetCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
"os"
"path/filepath"

tendermintConfig "github.com/cometbft/cometbft/config"
tendermintOS "github.com/cometbft/cometbft/libs/os"
tendermintRand "github.com/cometbft/cometbft/libs/rand"
"github.com/cometbft/cometbft/types"
tendermintTime "github.com/cometbft/cometbft/types/time"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -25,11 +30,6 @@ import (
genutilTypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/spf13/cobra"
tendermintConfig "github.com/tendermint/tendermint/config"
tendermintOS "github.com/tendermint/tendermint/libs/os"
tendermintRand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tendermintTime "github.com/tendermint/tendermint/types/time"
)

var (
Expand Down Expand Up @@ -90,7 +90,7 @@ Example:
if err != nil {
return err
}
algo, err := cmd.Flags().GetString(flags.FlagKeyAlgorithm)
algo, err := cmd.Flags().GetString(flags.FlagKeyType)
if err != nil {
return err
}
Expand All @@ -110,7 +110,7 @@ Example:
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdkTypes.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")

return cmd
}
Expand Down Expand Up @@ -192,7 +192,7 @@ func InitTestnet(
memo := fmt.Sprintf("%s@%s:26656", nodeIDs[i], ip)
genFiles = append(genFiles, nodeConfig.GenesisFile())

kb, err := keyring.New(sdkTypes.KeyringServiceName(), keyringBackend, nodeDir, inBuf)
kb, err := keyring.New(sdkTypes.KeyringServiceName(), keyringBackend, nodeDir, inBuf, clientCtx.Codec)
if err != nil {
return err
}
Expand Down Expand Up @@ -362,7 +362,7 @@ func collectGenFiles(
return err
}

nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator)
nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutilTypes.DefaultMessageValidator)
if err != nil {
return err
}
Expand Down
25 changes: 13 additions & 12 deletions application/internal/configurations/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ import (
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
distributionClient "github.com/cosmos/cosmos-sdk/x/distribution/client"
"github.com/cosmos/cosmos-sdk/x/evidence"
feegrantModule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
govClient "github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
paramsClient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeClient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcClientClient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibcClientClient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
)

var ModuleBasicManager = module.NewBasicManager(
Expand All @@ -47,12 +47,13 @@ var ModuleBasicManager = module.NewBasicManager(
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
gov.NewAppModuleBasic(
paramsClient.ProposalHandler,
distributionClient.ProposalHandler,
upgradeClient.ProposalHandler,
upgradeClient.CancelProposalHandler,
ibcClientClient.UpdateClientProposalHandler,
ibcClientClient.UpgradeProposalHandler,
[]govClient.ProposalHandler{
paramsClient.ProposalHandler,
upgradeClient.LegacyProposalHandler,
upgradeClient.LegacyCancelProposalHandler,
ibcClientClient.UpdateClientProposalHandler,
ibcClientClient.UpgradeProposalHandler,
},
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down
4 changes: 2 additions & 2 deletions application/internal/configurations/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
govTypes "github.com/cosmos/cosmos-sdk/x/gov/types"
mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
icaTypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
ibcTransferTypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
icaTypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
ibcTransferTypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
)

var ModuleAccountPermissions = map[string][]string{
Expand Down
26 changes: 13 additions & 13 deletions application/types/applications/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
package applications

import (
storeTypes "github.com/cosmos/cosmos-sdk/store/types"
"io"

tendermintDB "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
tendermintLog "github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/baseapp"
serverTypes "github.com/cosmos/cosmos-sdk/server/types"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/log"
tendermintLog "github.com/tendermint/tendermint/libs/log"
tendermintDB "github.com/tendermint/tm-db"

"github.com/AssetMantle/modules/helpers"
)
Expand All @@ -27,23 +27,23 @@ type Application interface {
GetCodec() helpers.Codec

LoadHeight(int64) error
ExportApplicationStateAndValidators(bool, []string) (serverTypes.ExportedApp, error)
ExportApplicationStateAndValidators(bool, []string, []string) (serverTypes.ExportedApp, error)

Name() string
Logger() log.Logger
MountStores(keys ...sdkTypes.StoreKey)
MountKVStores(keys map[string]*sdkTypes.KVStoreKey)
MountTransientStores(keys map[string]*sdkTypes.TransientStoreKey)
MountStore(key sdkTypes.StoreKey, typ sdkTypes.StoreType)
LastCommitID() sdkTypes.CommitID
MountStores(keys ...storeTypes.StoreKey)
MountKVStores(keys map[string]*storeTypes.KVStoreKey)
MountTransientStores(keys map[string]*storeTypes.TransientStoreKey)
MountStore(key storeTypes.StoreKey, typ storeTypes.StoreType)
LastCommitID() storeTypes.CommitID
LastBlockHeight() int64
Router() sdkTypes.Router
QueryRouter() sdkTypes.QueryRouter
//Router() storeTypes.Router
//QueryRouter() sdkTypes.QueryRouter
Seal()
IsSealed() bool

AppCreator(log.Logger, tendermintDB.DB, io.Writer, serverTypes.AppOptions) serverTypes.Application
AppExporter(log.Logger, tendermintDB.DB, io.Writer, int64, bool, []string, serverTypes.AppOptions) (serverTypes.ExportedApp, error)
AppExporter(log.Logger, tendermintDB.DB, io.Writer, int64, bool, []string, serverTypes.AppOptions, []string) (serverTypes.ExportedApp, error)
ModuleInitFlags(startCmd *cobra.Command)

Initialize(logger tendermintLog.Logger, db tendermintDB.DB, traceStore io.Writer, loadLatest bool, invCheckPeriod uint, skipUpgradeHeights map[int64]bool, home string, appOptions serverTypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp)) Application
Expand Down
25 changes: 9 additions & 16 deletions application/types/applications/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
distributionClient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distributionTypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
feeGrantModule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
govClient "github.com/cosmos/cosmos-sdk/x/gov/client"
govTypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/mint"
mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
Expand All @@ -35,13 +35,13 @@ import (
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeClient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icaTypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibcTransferTypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcClientClient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icaTypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibcTransferTypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibcClientClient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"

"github.com/AssetMantle/modules/x/metas"
)
Expand All @@ -56,14 +56,7 @@ var ModuleBasicManagers = module.NewBasicManager(
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
gov.NewAppModuleBasic(
paramsClient.ProposalHandler,
distributionClient.ProposalHandler,
upgradeClient.ProposalHandler,
upgradeClient.CancelProposalHandler,
ibcClientClient.UpdateClientProposalHandler,
ibcClientClient.UpgradeProposalHandler,
),
gov.NewAppModuleBasic([]govClient.ProposalHandler{paramsClient.ProposalHandler, upgradeClient.LegacyProposalHandler, upgradeClient.LegacyCancelProposalHandler, ibcClientClient.UpdateClientProposalHandler, ibcClientClient.UpgradeProposalHandler}),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
Expand Down
10 changes: 5 additions & 5 deletions application/types/applications/simulationApplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/simapp"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
storeTypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/types/module"
crisisKeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
paramsTypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/ibc-go/v7/testing/simapp"
)

type SimulationApplication interface {
Expand All @@ -23,9 +23,9 @@ type SimulationApplication interface {
GetBaseApp() *baseapp.BaseApp
GetAppCodec() helpers.Codec
InterfaceRegistry() codecTypes.InterfaceRegistry
GetKey(storeKey string) *sdkTypes.KVStoreKey
GetTKey(storeKey string) *sdkTypes.TransientStoreKey
GetMemKey(storeKey string) *sdkTypes.MemoryStoreKey
GetKey(storeKey string) *storeTypes.KVStoreKey
GetTKey(storeKey string) *storeTypes.TransientStoreKey
GetMemKey(storeKey string) *storeTypes.MemoryStoreKey
GetSubspace(moduleName string) paramsTypes.Subspace
SimulationManager() *module.SimulationManager
RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
Expand Down
Loading

0 comments on commit 00cfaa8

Please sign in to comment.