feat(core): add TxValidator interface (#19950)

This commit is contained in:
Julien Robert 2024-04-04 12:56:32 +02:00 committed by GitHub
parent 6c6626712e
commit edd1c71072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -47,10 +47,10 @@ type HasEndBlocker interface {
EndBlock(context.Context) error
}
// HasTxValidation is the extension interface that modules should implement to run
// HasTxValidator is the extension interface that modules should implement to run
// custom logic for validating transactions.
// It was previously known as AnteHandler/Decorator.
type HasTxValidation[T transaction.Tx] interface {
type HasTxValidator[T transaction.Tx] interface {
AppModule
// TxValidator is a method that will be run on each transaction.

View File

@ -0,0 +1,13 @@
package appmodule
import (
"context"
"cosmossdk.io/core/transaction"
)
// TxValidator represent the method that a TxValidator should implement.
// It was previously known as AnteHandler/Decorator.AnteHandle
type TxValidator[T transaction.Tx] interface {
ValidateTx(ctx context.Context, tx T) error
}