Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Aug 28, 2024
1 parent 46cef74 commit 0c5f774
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions x/auth/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// TxFeeChecker checks if the provided fee is enough and returns the effective fee and tx priority.
// The effective fee should be deducted later, and the priority should be returned in the ABCI response.
type TxFeeChecker func(ctx context.Context, tx sdk.Tx) (sdk.Coins, int64, error)
type TxFeeChecker func(ctx context.Context, tx transaction.Tx) (sdk.Coins, int64, error)

// DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx.
// If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error.
Expand Down Expand Up @@ -63,7 +63,7 @@ func (dfd *DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, ne
return next(newCtx, tx, false)
}

func (dfd *DeductFeeDecorator) innerValidateTx(ctx context.Context, tx sdk.Tx) (priority int64, err error) {
func (dfd *DeductFeeDecorator) innerValidateTx(ctx context.Context, tx transaction.Tx) (priority int64, err error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must implement the FeeTx interface")
Expand Down Expand Up @@ -93,7 +93,7 @@ func (dfd *DeductFeeDecorator) innerValidateTx(ctx context.Context, tx sdk.Tx) (

// ValidateTx implements an TxValidator for DeductFeeDecorator
// Note: This method is applicable only for transactions that implement the sdk.FeeTx interface.
func (dfd *DeductFeeDecorator) ValidateTx(ctx context.Context, tx sdk.Tx) error {
func (dfd *DeductFeeDecorator) ValidateTx(ctx context.Context, tx transaction.Tx) error {
_, err := dfd.innerValidateTx(ctx, tx)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion x/auth/ante/validator_tx_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per
// unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price.
func (dfd *DeductFeeDecorator) checkTxFeeWithValidatorMinGasPrices(ctx context.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
func (dfd *DeductFeeDecorator) checkTxFeeWithValidatorMinGasPrices(ctx context.Context, tx transaction.Tx) (sdk.Coins, int64, error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
Expand Down
4 changes: 4 additions & 0 deletions x/auth/tx/config/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@ func (a AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error {
}
}

if err := a.feeTxValidator.ValidateTx(ctx, tx); err != nil {
return err
}

return a.sigVerification.ValidateTx(ctx, tx)
}

0 comments on commit 0c5f774

Please sign in to comment.