validate

package
v0.52.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

x/validate

:::tip This module is only required when using runtime and runtime v2 and you want to make use of the pre-defined ante/poste handlers or tx validators. :::

The x/validate is an app module solely there to setup ante/post handlers on a runtime app (via baseapp options) and the global tx validators on a runtime/v2 app (via app module). Depinject will automatically inject the ante/post handlers and tx validators into the app. Module specific tx validators should be registered on their own modules.

Extra TxValidators

It is possible to add extra tx validators to the app. This is useful when you want to add extra tx validators that do not belong to one specific module. For example, you can add a tx validator that checks if the tx is signed by a specific address.

In your app.go, when using runtime/v2, supply the extra tx validators using depinject:

appConfig = depinject.Configs(
	AppConfig(),
	depinject.Supply(
        []appmodulev2.TxValidator[transaction.Tx]{
            // Add extra tx validators here
        }
    ),
)

Storage

This module has no store key. Do not forget to add the module name in the SkipStoreKeys runtime config present in the app config.

SkipStoreKeys: []string{
	authtxconfig.DepinjectModuleName,
	validate.ModuleName,
},

Documentation

Index

Constants

View Source
const ModuleName = "validate"

ModuleName is the name of the validate module.

Variables

This section is empty.

Functions

func ProvideConfig

func ProvideConfig(key depinject.OwnModuleKey) server.ModuleConfigMap

ProvideConfig specifies the configuration key for the minimum gas prices. During dependency injection, a configuration map is provided with the key set.

Types

type AppModule

type AppModule struct {
	// contains filtered or unexported fields
}

AppModule is a module that only implements tx validators. The goal of this module is to allow extensible registration of tx validators provided by chains without requiring a new modules. Additionally, it registers tx validators that do not really have a place in other modules. This module is only useful for chains using server/v2. Ante/Post handlers are setup via baseapp options in depinject.

func NewAppModule

func NewAppModule(
	sigVerification ante.SigVerificationDecorator,
	feeTxValidator *ante.DeductFeeDecorator,
	unorderTxValidator *ante.UnorderedTxDecorator,
	txValidators ...appmodulev2.TxValidator[transaction.Tx],
) AppModule

NewAppModule creates a new AppModule object.

func (AppModule) IsAppModule

func (a AppModule) IsAppModule()

IsAppModule implements appmodule.AppModule.

func (AppModule) IsOnePerModuleType

func (a AppModule) IsOnePerModuleType()

IsOnePerModuleType implements appmodule.AppModule.

func (AppModule) TxValidator

func (a AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error

TxValidator implements appmodule.HasTxValidator.

type ModuleInputs

type ModuleInputs struct {
	depinject.In

	ModuleConfig *modulev1.Module
	Environment  appmodulev2.Environment
	TxConfig     client.TxConfig
	ConfigMap    server.ConfigMap

	AccountKeeper            ante.AccountKeeper
	BankKeeper               authtypes.BankKeeper
	ConsensusKeeper          ante.ConsensusKeeper
	FeeGrantKeeper           ante.FeegrantKeeper                       `optional:"true"`
	AccountAbstractionKeeper ante.AccountAbstractionKeeper             `optional:"true"`
	ExtraTxValidators        []appmodulev2.TxValidator[transaction.Tx] `optional:"true"`
	UnorderedTxManager       *unorderedtx.Manager                      `optional:"true"`
	TxFeeChecker             ante.TxFeeChecker                         `optional:"true"`
}

type ModuleOutputs

type ModuleOutputs struct {
	depinject.Out

	Module        appmodulev2.AppModule // Only useful for chains using server/v2. It setup tx validators that don't belong to other modules.
	BaseAppOption runtime.BaseAppOption // Only useful for chains using baseapp. Server/v2 chains use TxValidator.
}

func ProvideModule

func ProvideModule(in ModuleInputs) ModuleOutputs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL