Skip to content

Commit

Permalink
wip: add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
boodyvo committed Nov 13, 2024
1 parent 0b089cd commit 24e03bc
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 18 deletions.
85 changes: 80 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v8/modules/core/02-client/client/cli"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcporttypes "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"
"github.com/ethereum/go-ethereum/core/vm"
evmante "github.com/evmos/ethermint/app/ante"
Expand All @@ -128,12 +130,15 @@ import (
cdpkeeper "github.com/kava-labs/kava/x/cdp/keeper"
cdptypes "github.com/kava-labs/kava/x/cdp/types"
"github.com/kava-labs/kava/x/committee"
committeeclient "github.com/kava-labs/kava/x/committee/client"
committeekeeper "github.com/kava-labs/kava/x/committee/keeper"
committeetypes "github.com/kava-labs/kava/x/committee/types"
"github.com/kava-labs/kava/x/community"
communityclient "github.com/kava-labs/kava/x/community/client"
communitykeeper "github.com/kava-labs/kava/x/community/keeper"
communitytypes "github.com/kava-labs/kava/x/community/types"
earn "github.com/kava-labs/kava/x/earn"
earnclient "github.com/kava-labs/kava/x/earn/client"
earnkeeper "github.com/kava-labs/kava/x/earn/keeper"
earntypes "github.com/kava-labs/kava/x/earn/types"
evmutil "github.com/kava-labs/kava/x/evmutil"
Expand All @@ -149,6 +154,7 @@ import (
issuancekeeper "github.com/kava-labs/kava/x/issuance/keeper"
issuancetypes "github.com/kava-labs/kava/x/issuance/types"
"github.com/kava-labs/kava/x/kavadist"
kavadistclient "github.com/kava-labs/kava/x/kavadist/client"
kavadistkeeper "github.com/kava-labs/kava/x/kavadist/keeper"
kavadisttypes "github.com/kava-labs/kava/x/kavadist/types"
"github.com/kava-labs/kava/x/liquid"
Expand Down Expand Up @@ -189,6 +195,65 @@ var (
LegacyProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitUpgradeProposal(ac) })
LegacyCancelProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitCancelUpgradeProposal(ac) })

ModuleBasics = module.NewBasicManager(
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
auth.AppModuleBasic{},
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic([]govclient.ProposalHandler{
paramsclient.ProposalHandler,
LegacyProposalHandler,
LegacyCancelProposalHandler,
//upgradeclient.LegacyProposalHandler,
//upgradeclient.LegacyCancelProposalHandler,
govclient.NewProposalHandler(ibcclientclient.NewTxCmd),
//ibcclientclient,
kavadistclient.ProposalHandler,
committeeclient.ProposalHandler,
earnclient.DepositProposalHandler,
earnclient.WithdrawProposalHandler,
communityclient.LendDepositProposalHandler,
communityclient.LendWithdrawProposalHandler,
}),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
solomachine.AppModuleBasic{},
packetforward.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
authzmodule.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
evm.AppModuleBasic{},
feemarket.AppModuleBasic{},
kavadist.AppModuleBasic{},
auction.AppModuleBasic{},
issuance.AppModuleBasic{},
bep3.AppModuleBasic{},
pricefeed.AppModuleBasic{},
swap.AppModuleBasic{},
cdp.AppModuleBasic{},
hard.AppModuleBasic{},
committee.AppModuleBasic{},
incentive.AppModuleBasic{},
savings.AppModuleBasic{},
validatorvesting.AppModuleBasic{},
evmutil.AppModuleBasic{},
liquid.AppModuleBasic{},
earn.AppModuleBasic{},
router.AppModuleBasic{},
mint.AppModuleBasic{},
community.AppModuleBasic{},
metrics.AppModuleBasic{},
consensus.AppModuleBasic{},
precisebank.AppModuleBasic{},
)

// module account permissions
// If these are changed, the permissions stored in accounts
// must also be migrated during a chain upgrade.
Expand Down Expand Up @@ -861,11 +926,21 @@ func NewApp(
app.mm,
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
},
),
govtypes.ModuleName: gov.NewAppModuleBasic([]govclient.ProposalHandler{
paramsclient.ProposalHandler,
LegacyProposalHandler,
LegacyCancelProposalHandler,
//upgradeclient.LegacyProposalHandler,
//upgradeclient.LegacyCancelProposalHandler,
govclient.NewProposalHandler(ibcclientclient.NewTxCmd),
//ibcclientclient,
kavadistclient.ProposalHandler,
committeeclient.ProposalHandler,
earnclient.DepositProposalHandler,
earnclient.WithdrawProposalHandler,
communityclient.LendDepositProposalHandler,
communityclient.LendWithdrawProposalHandler,
}),
ibctm.ModuleName: ibctm.NewAppModule(),
})
app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino)
Expand Down
8 changes: 3 additions & 5 deletions cmd/kava/cmd/query.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"cosmossdk.io/log"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand Down Expand Up @@ -32,10 +30,10 @@ func newQueryCmd() *cobra.Command {
authcmd.QueryTxCmd(),
)

encodingConfig := app.MakeEncodingConfig()
tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions)
//encodingConfig := app.MakeEncodingConfig()
//tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions)

tempApp.BasicModuleManager.AddQueryCommands(cmd)
app.ModuleBasics.AddQueryCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

return cmd
Expand Down
10 changes: 5 additions & 5 deletions cmd/kava/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,22 @@ func dbOpener(opts servertypes.AppOptions, rootDir string, backend dbm.BackendTy

// addSubCmds registers all the sub commands used by kava.
func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, defaultNodeHome string) {
tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions)
//tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions)

gentxModule, ok := tempApp.BasicModuleManager[genutiltypes.ModuleName].(genutil.AppModuleBasic)
gentxModule, ok := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic)
if !ok {
panic(fmt.Errorf("expected %s module to be an instance of type %T", genutiltypes.ModuleName, genutil.AppModuleBasic{}))
}

rootCmd.AddCommand(
StatusCommand(),
ethermintclient.ValidateChainID(
genutilcli.InitCmd(tempApp.BasicModuleManager, defaultNodeHome),
genutilcli.InitCmd(app.ModuleBasics, defaultNodeHome),
),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome, gentxModule.GenTxValidator, encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()),
AssertInvariantsCmd(encodingConfig),
genutilcli.GenTxCmd(tempApp.BasicModuleManager, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome, encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()),
genutilcli.ValidateGenesisCmd(tempApp.BasicModuleManager),
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome, encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(defaultNodeHome),
tmcli.NewCompletionCmd(rootCmd, true), // TODO add other shells, drop tmcli dependency, unhide?
// testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), // TODO add
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ replace (
// Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support
//github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1
//github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.50.10-test-patch 5f9239e3147358ef034bfc4d19aacb34e5ea2064
github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241112215550-dfd34308fe09
github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16
//github.com/cosmos/cosmos-sdk => ../cosmos-sdk

//github.com/cosmos/cosmos-sdk/store => cosmossdk.io/store v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,8 @@ github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12 h1:RqnpnEGEuykj
github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12/go.mod h1:5awmm7t/X8LJ+Wd7/TXHcv4hLfFLcexy6fdS9WvOepA=
github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed h1:3FNJ3fcD9aA9oOwDphrSEJ8u2kBNj9YoYAwl16UKyv4=
github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed/go.mod h1:buPRZKyVp+u5fmwN7tDtOk1zc5xA2z9BJJTy61tNnws=
github.com/kava-labs/cosmos-sdk v0.0.0-20241112215550-dfd34308fe09 h1:x5NASpmOdjmPRP9POPz3qbxRxrGpPkplquMDXGG0wJY=
github.com/kava-labs/cosmos-sdk v0.0.0-20241112215550-dfd34308fe09/go.mod h1:Yf8jj8R5+9NWCbdot0IMId92WeAIF22Thc/pRR2hSoI=
github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16 h1:v/1pHMyrNV7zPPz50Zof7YkB0SRamC4PDFNzqyW93BE=
github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16/go.mod h1:Yf8jj8R5+9NWCbdot0IMId92WeAIF22Thc/pRR2hSoI=
github.com/kava-labs/ethermint v0.0.0-20241112214305-986ef503477d h1:AYN0gn9INsHew7bRtnwxmEsKCUjKiq+EPbuhe605/sA=
github.com/kava-labs/ethermint v0.0.0-20241112214305-986ef503477d/go.mod h1:Mr24kGiuG5TBUNS9d/velQrHofo3fdpz54aVL4bWeUM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
Expand Down

0 comments on commit 24e03bc

Please sign in to comment.