Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
type HandlerOptions struct {
ante.HandlerOptions
IBCKeeper *ibckeeper.Keeper
WasmKeeper *wasmkeeper.Keeper
NodeConfig *wasmtypes.NodeConfig
TXCounterStoreService corestoretypes.KVStoreService

Expand Down Expand Up @@ -44,14 +45,12 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}
options.SigVerifyOptions = []ante.SigVerificationDecoratorOption{
ante.WithUnorderedTxGasCost(ante.DefaultUnorderedTxGasCost),
ante.WithMaxUnorderedTxTimeoutDuration(ante.DefaultMaxTimeoutDuration),
}
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
wasmkeeper.NewLimitSimulationGasDecorator(options.NodeConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService),
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()),
wasmkeeper.NewTxContractsDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
Expand Down
16 changes: 8 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import (
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/spf13/cast"

Expand Down Expand Up @@ -172,11 +171,7 @@ func NewApplication(
}
app.txConfig = txConfig

// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
// we prefer to be more strict in what arguments the modules expect.
skipGenesisInvariants := cast.ToBool(applicationOptions.Get(crisis.FlagSkipGenesisInvariants))

app.moduleManager = module.NewManager(appModules(app, app.appCodec, app.txConfig, skipGenesisInvariants)...)
app.moduleManager = module.NewManager(appModules(app, app.appCodec, app.txConfig)...)

app.ModuleBasicManager = module.NewBasicManagerFromManager(app.moduleManager,
map[string]module.AppModuleBasic{
Expand Down Expand Up @@ -204,7 +199,7 @@ func NewApplication(

app.simulationManager = module.NewSimulationManagerFromAppModules(
app.moduleManager.Modules,
overrideSimulationModules(app, app.appCodec, skipGenesisInvariants),
overrideSimulationModules(app, app.appCodec),
)
app.simulationManager.RegisterStoreDecoders()

Expand Down Expand Up @@ -260,10 +255,15 @@ func (app *Application) setupAnteHandler(nodeConfig wasmtypes.NodeConfig) {
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeegrantKeeper: app.FeegrantKeeper,
SignModeHandler: app.txConfig.SignModeHandler(),
SignModeHandler: app.TxConfig().SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
SigVerifyOptions: []ante.SigVerificationDecoratorOption{
ante.WithUnorderedTxGasCost(ante.DefaultUnorderedTxGasCost),
ante.WithMaxUnorderedTxTimeoutDuration(ante.DefaultMaxTimeoutDuration),
},
},
IBCKeeper: app.IBCKeeper,
WasmKeeper: app.WasmKeeper,
NodeConfig: &nodeConfig,
TXCounterStoreService: runtime.NewKVStoreService(app.GetKVStoreKey()[wasmtypes.StoreKey]),

Expand Down
4 changes: 1 addition & 3 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func appModules(
app *Application,
appCodec codec.Codec,
txCfg client.TxConfig,
skipGenesisInvariants bool,
) []module.AppModule {

return []module.AppModule{
Expand Down Expand Up @@ -108,15 +107,14 @@ func appModules(
epochs.NewAppModule(*app.EpochsKeeper),
liquid.NewAppModule(appCodec, app.LiquidKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
liquidstake.NewAppModule(*app.LiquidStakeKeeper),
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
crisis.NewAppModule(app.CrisisKeeper, false, app.GetSubspace(crisistypes.ModuleName)), // skipGenesisInvariants: false, always be last to make sure that it checks for all invariants and not only part of them
ibctm.NewAppModule(app.TMLightClientModule),
}
}

func overrideSimulationModules(
app *Application,
appCodec codec.Codec,
_ bool,
) map[string]module.AppModuleSimulation {
return map[string]module.AppModuleSimulation{
authtypes.ModuleName: auth.NewAppModule(appCodec, *app.AccountKeeper, authsimulation.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
Expand Down
32 changes: 25 additions & 7 deletions cmd/persistenceCore/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ import (
"io"
"os"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/snapshot"
"github.com/persistenceOne/persistenceCore/v16/app/constants"

"cosmossdk.io/log"
confixcmd "cosmossdk.io/tools/confix/cmd"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
cmtcfg "github.com/cometbft/cometbft/config"
cmtcli "github.com/cometbft/cometbft/libs/cli"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/snapshot"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/version"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
Expand All @@ -40,6 +41,7 @@ import (
"github.com/spf13/cobra"

"github.com/persistenceOne/persistenceCore/v16/app"
"github.com/persistenceOne/persistenceCore/v16/app/constants"
"github.com/persistenceOne/persistenceCore/v16/app/params"
)

Expand Down Expand Up @@ -67,7 +69,6 @@ func NewRootCmd() *cobra.Command {
WithLegacyAmino(tempApp.LegacyAmino()).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithBroadcastMode(flags.BroadcastSync).
WithHomeDir(app.DefaultNodeHome).
WithViper("")

Expand All @@ -80,6 +81,7 @@ func NewRootCmd() *cobra.Command {
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())

initClientCtx = initClientCtx.WithCmdContext(cmd.Context())
initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags())
if err != nil {
return err
Expand All @@ -89,6 +91,22 @@ func NewRootCmd() *cobra.Command {
if err != nil {
return err
}
if !initClientCtx.Offline {
enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
txConfig, err := tx.NewTxConfigWithOptions(
initClientCtx.Codec,
txConfigOpts,
)
if err != nil {
return err
}

initClientCtx = initClientCtx.WithTxConfig(txConfig)
}

if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
Expand Down
Loading