2020-04-01 18:49:21 +00:00
|
|
|
|
package ante
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
|
|
|
|
import (
|
2018-12-18 16:10:04 +00:00
|
|
|
|
"fmt"
|
|
|
|
|
"math/big"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-11-04 20:45:02 +00:00
|
|
|
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
2020-04-16 15:47:39 +00:00
|
|
|
|
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
2019-07-04 19:46:54 +00:00
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
"github.com/cosmos/ethermint/crypto"
|
2019-07-04 19:46:54 +00:00
|
|
|
|
emint "github.com/cosmos/ethermint/types"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
evmtypes "github.com/cosmos/ethermint/x/evm/types"
|
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
ethcore "github.com/ethereum/go-ethereum/core"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
tmcrypto "github.com/tendermint/tendermint/crypto"
|
2018-11-28 22:19:22 +00:00
|
|
|
|
)
|
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
const (
|
2019-11-04 20:45:02 +00:00
|
|
|
|
// TODO: Use this cost per byte through parameter or overriding NewConsumeGasForTxSizeDecorator
|
|
|
|
|
// which currently defaults at 10, if intended
|
|
|
|
|
// memoCostPerByte sdk.Gas = 3
|
|
|
|
|
secp256k1VerifyCost uint64 = 21000
|
2018-12-18 16:10:04 +00:00
|
|
|
|
)
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// NewAnteHandler returns an ante handler responsible for attempting to route an
|
2018-11-28 22:19:22 +00:00
|
|
|
|
// Ethereum or SDK transaction to an internal ante handler for performing
|
|
|
|
|
// transaction-level processing (e.g. fee payment, signature verification) before
|
|
|
|
|
// being passed onto it's respective handler.
|
2019-07-04 19:46:54 +00:00
|
|
|
|
func NewAnteHandler(ak auth.AccountKeeper, sk types.SupplyKeeper) sdk.AnteHandler {
|
2018-11-28 22:19:22 +00:00
|
|
|
|
return func(
|
|
|
|
|
ctx sdk.Context, tx sdk.Tx, sim bool,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
) (newCtx sdk.Context, err error) {
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
switch castTx := tx.(type) {
|
|
|
|
|
case auth.StdTx:
|
2019-11-04 20:45:02 +00:00
|
|
|
|
stdAnte := sdk.ChainAnteDecorators(
|
2020-04-16 15:47:39 +00:00
|
|
|
|
authante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
|
|
|
|
|
authante.NewMempoolFeeDecorator(),
|
|
|
|
|
authante.NewValidateBasicDecorator(),
|
|
|
|
|
authante.NewValidateMemoDecorator(ak),
|
|
|
|
|
authante.NewConsumeGasForTxSizeDecorator(ak),
|
|
|
|
|
authante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators
|
|
|
|
|
authante.NewValidateSigCountDecorator(ak),
|
|
|
|
|
authante.NewDeductFeeDecorator(ak, sk),
|
|
|
|
|
authante.NewSigGasConsumeDecorator(ak, sigGasConsumer),
|
|
|
|
|
authante.NewSigVerificationDecorator(ak),
|
|
|
|
|
authante.NewIncrementSequenceDecorator(ak), // innermost AnteDecorator
|
2019-11-04 20:45:02 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return stdAnte(ctx, tx, sim)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
2020-04-01 18:49:21 +00:00
|
|
|
|
case evmtypes.MsgEthereumTx:
|
|
|
|
|
return ethAnteHandler(ctx, ak, sk, &castTx, sim)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type: %T", tx)
|
2019-07-04 19:46:54 +00:00
|
|
|
|
}
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-01 18:49:21 +00:00
|
|
|
|
// sigGasConsumer overrides the DefaultSigVerificationGasConsumer from the x/auth
|
|
|
|
|
// module on the SDK. It doesn't allow ed25519 nor multisig thresholds.
|
|
|
|
|
func sigGasConsumer(
|
2019-11-04 20:45:02 +00:00
|
|
|
|
meter sdk.GasMeter, sig []byte, pubkey tmcrypto.PubKey, params types.Params,
|
|
|
|
|
) error {
|
2018-12-18 16:10:04 +00:00
|
|
|
|
switch pubkey.(type) {
|
|
|
|
|
case crypto.PubKeySecp256k1:
|
|
|
|
|
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: secp256k1")
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2019-08-19 15:31:40 +00:00
|
|
|
|
case tmcrypto.PubKey:
|
|
|
|
|
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: tendermint secp256k1")
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2018-12-18 16:10:04 +00:00
|
|
|
|
default:
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
|
2018-11-28 22:19:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
// Ethereum Ante Handler
|
|
|
|
|
|
|
|
|
|
// ethAnteHandler defines an internal ante handler for an Ethereum transaction
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// ethTxMsg. During CheckTx, the transaction is passed through a series of
|
|
|
|
|
// pre-message execution validation checks such as signature and account
|
|
|
|
|
// verification in addition to minimum fees being checked. Otherwise, during
|
|
|
|
|
// DeliverTx, the transaction is simply passed to the EVM which will also
|
|
|
|
|
// perform the same series of checks. The distinction is made in CheckTx to
|
|
|
|
|
// prevent spam and DoS attacks.
|
2018-11-28 22:19:22 +00:00
|
|
|
|
func ethAnteHandler(
|
2019-10-18 23:14:38 +00:00
|
|
|
|
ctx sdk.Context, ak auth.AccountKeeper, sk types.SupplyKeeper,
|
2020-04-01 18:49:21 +00:00
|
|
|
|
ethTxMsg *evmtypes.MsgEthereumTx, sim bool,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
) (newCtx sdk.Context, err error) {
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
var senderAddr sdk.AccAddress
|
|
|
|
|
|
|
|
|
|
// This is done to ignore costs in Ante handler checks
|
|
|
|
|
ctx = ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())
|
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
if ctx.IsCheckTx() {
|
|
|
|
|
// Only perform pre-message (Ethereum transaction) execution validation
|
|
|
|
|
// during CheckTx. Otherwise, during DeliverTx the EVM will handle them.
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if senderAddr, err = validateEthTxCheckTx(ctx, ak, ethTxMsg); err != nil {
|
|
|
|
|
return ctx, err
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// This is still currently needed to retrieve the sender address
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if senderAddr, err = validateSignature(ctx, ethTxMsg); err != nil {
|
|
|
|
|
return ctx, err
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Explicit nonce check is also needed in case of multiple txs with same nonce not being handled
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err := checkNonce(ctx, ak, ethTxMsg, senderAddr); err != nil {
|
|
|
|
|
return ctx, err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// Recover and catch out of gas error
|
|
|
|
|
defer func() {
|
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
|
switch rType := r.(type) {
|
|
|
|
|
case sdk.ErrorOutOfGas:
|
2020-04-16 15:47:39 +00:00
|
|
|
|
err = sdkerrors.Wrapf(
|
|
|
|
|
sdkerrors.ErrOutOfGas,
|
|
|
|
|
"out of gas in location: %v; gasUsed: %d",
|
2020-04-01 18:49:21 +00:00
|
|
|
|
rType.Descriptor, ctx.GasMeter().GasConsumed(),
|
|
|
|
|
)
|
2019-10-18 23:14:38 +00:00
|
|
|
|
default:
|
|
|
|
|
panic(r)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}()
|
2018-11-28 22:19:22 +00:00
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// Fetch sender account from signature
|
2019-11-04 20:45:02 +00:00
|
|
|
|
senderAcc, err := auth.GetSignerAcc(ctx, ak, senderAddr)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return ctx, err
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// Charge sender for gas up to limit
|
|
|
|
|
if ethTxMsg.Data.GasLimit != 0 {
|
|
|
|
|
// Cost calculates the fees paid to validators based on gas limit and price
|
|
|
|
|
cost := new(big.Int).Mul(ethTxMsg.Data.Price, new(big.Int).SetUint64(ethTxMsg.Data.GasLimit))
|
|
|
|
|
|
2020-04-01 18:49:21 +00:00
|
|
|
|
feeAmt := sdk.NewCoins(
|
2019-10-18 23:14:38 +00:00
|
|
|
|
sdk.NewCoin(emint.DenomDefault, sdk.NewIntFromBigInt(cost)),
|
2020-04-01 18:49:21 +00:00
|
|
|
|
)
|
2019-10-18 23:14:38 +00:00
|
|
|
|
|
2019-11-12 21:07:34 +00:00
|
|
|
|
err = auth.DeductFees(sk, ctx, senderAcc, feeAmt)
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err != nil {
|
|
|
|
|
return ctx, err
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// Set gas meter after ante handler to ignore gaskv costs
|
|
|
|
|
newCtx = auth.SetGasMeter(sim, ctx, ethTxMsg.Data.GasLimit)
|
|
|
|
|
|
2019-10-29 15:52:26 +00:00
|
|
|
|
gas, _ := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
2019-10-18 23:14:38 +00:00
|
|
|
|
newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas")
|
|
|
|
|
|
2020-01-07 21:13:19 +00:00
|
|
|
|
// Increment sequence of sender
|
|
|
|
|
acc := ak.GetAccount(ctx, senderAddr)
|
|
|
|
|
if err := acc.SetSequence(acc.GetSequence() + 1); err != nil {
|
|
|
|
|
panic(err)
|
2019-11-15 17:02:13 +00:00
|
|
|
|
}
|
2020-01-07 21:13:19 +00:00
|
|
|
|
ak.SetAccount(ctx, acc)
|
2019-11-15 17:02:13 +00:00
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return newCtx, nil
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func validateEthTxCheckTx(
|
2020-04-01 18:49:21 +00:00
|
|
|
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.MsgEthereumTx,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
) (sdk.AccAddress, error) {
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// Validate sufficient fees have been provided that meet a minimum threshold
|
|
|
|
|
// defined by the proposer (for mempool purposes during CheckTx).
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err := ensureSufficientMempoolFees(ctx, ethTxMsg); err != nil {
|
|
|
|
|
return nil, err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validate enough intrinsic gas
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err := validateIntrinsicGas(ethTxMsg); err != nil {
|
|
|
|
|
return nil, err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
signer, err := validateSignature(ctx, ethTxMsg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validate account (nonce and balance checks)
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err := validateAccount(ctx, ak, ethTxMsg, signer); err != nil {
|
|
|
|
|
return nil, err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return sdk.AccAddress(signer.Bytes()), nil
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validates signature and returns sender address
|
2020-04-01 18:49:21 +00:00
|
|
|
|
func validateSignature(ctx sdk.Context, ethTxMsg *evmtypes.MsgEthereumTx) (sdk.AccAddress, error) {
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// parse the chainID from a string to a base-10 integer
|
|
|
|
|
chainID, ok := new(big.Int).SetString(ctx.ChainID(), 10)
|
|
|
|
|
if !ok {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return nil, sdkerrors.Wrap(emint.ErrInvalidChainID, ctx.ChainID())
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validate sender/signature
|
|
|
|
|
signer, err := ethTxMsg.VerifySig(chainID)
|
|
|
|
|
if err != nil {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return nil, sdkerrors.Wrap(err, "signature verification failed")
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return sdk.AccAddress(signer.Bytes()), nil
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validateIntrinsicGas validates that the Ethereum tx message has enough to
|
|
|
|
|
// cover intrinsic gas. Intrinsic gas for a transaction is the amount of gas
|
|
|
|
|
// that the transaction uses before the transaction is executed. The gas is a
|
|
|
|
|
// constant value of 21000 plus any cost inccured by additional bytes of data
|
|
|
|
|
// supplied with the transaction.
|
2020-04-01 18:49:21 +00:00
|
|
|
|
func validateIntrinsicGas(ethTxMsg *evmtypes.MsgEthereumTx) error {
|
2019-10-29 15:52:26 +00:00
|
|
|
|
gas, err := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
if err != nil {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return sdkerrors.Wrap(err, "failed to compute intrinsic gas cost")
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ethTxMsg.Data.GasLimit < gas {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return fmt.Errorf(
|
|
|
|
|
"intrinsic gas too low: %d < %d", ethTxMsg.Data.GasLimit, gas,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validateAccount validates the account nonce and that the account has enough
|
|
|
|
|
// funds to cover the tx cost.
|
|
|
|
|
func validateAccount(
|
2020-04-01 18:49:21 +00:00
|
|
|
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.MsgEthereumTx, signer sdk.AccAddress,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
) error {
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
acc := ak.GetAccount(ctx, signer)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
|
|
|
|
// on InitChain make sure account number == 0
|
|
|
|
|
if ctx.BlockHeight() == 0 && acc.GetAccountNumber() != 0 {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return sdkerrors.Wrapf(
|
|
|
|
|
sdkerrors.ErrInvalidSequence,
|
|
|
|
|
"invalid account number for height zero (got %d)", acc.GetAccountNumber(),
|
2020-04-01 18:49:21 +00:00
|
|
|
|
)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
// Validate nonce is correct
|
2019-11-04 20:45:02 +00:00
|
|
|
|
if err := checkNonce(ctx, ak, ethTxMsg, signer); err != nil {
|
|
|
|
|
return err
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validate sender has enough funds
|
2019-07-04 19:46:54 +00:00
|
|
|
|
balance := acc.GetCoins().AmountOf(emint.DenomDefault)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
if balance.BigInt().Cmp(ethTxMsg.Cost()) < 0 {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return sdkerrors.Wrapf(
|
|
|
|
|
sdkerrors.ErrInsufficientFunds,
|
|
|
|
|
"%s < %s%s", balance.String(), ethTxMsg.Cost().String(), emint.DenomDefault,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2018-12-18 16:10:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 23:14:38 +00:00
|
|
|
|
func checkNonce(
|
2020-04-01 18:49:21 +00:00
|
|
|
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.MsgEthereumTx, signer sdk.AccAddress,
|
2019-11-04 20:45:02 +00:00
|
|
|
|
) error {
|
2019-10-18 23:14:38 +00:00
|
|
|
|
acc := ak.GetAccount(ctx, signer)
|
|
|
|
|
// Validate the transaction nonce is valid (equivalent to the sender account’s
|
|
|
|
|
// current nonce).
|
|
|
|
|
seq := acc.GetSequence()
|
|
|
|
|
if ethTxMsg.Data.AccountNonce != seq {
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return sdkerrors.Wrapf(
|
|
|
|
|
sdkerrors.ErrInvalidSequence,
|
|
|
|
|
"got nonce %d, expected %d", ethTxMsg.Data.AccountNonce, seq,
|
2020-04-01 18:49:21 +00:00
|
|
|
|
)
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2019-10-18 23:14:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// ensureSufficientMempoolFees verifies that enough fees have been provided by the
|
|
|
|
|
// Ethereum transaction that meet the minimum threshold set by the block
|
|
|
|
|
// proposer.
|
|
|
|
|
//
|
|
|
|
|
// NOTE: This should only be ran during a CheckTx mode.
|
2020-04-01 18:49:21 +00:00
|
|
|
|
func ensureSufficientMempoolFees(ctx sdk.Context, ethTxMsg *evmtypes.MsgEthereumTx) error {
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// fee = GP * GL
|
2019-07-04 19:46:54 +00:00
|
|
|
|
fee := sdk.NewDecCoinFromCoin(sdk.NewInt64Coin(emint.DenomDefault, ethTxMsg.Fee().Int64()))
|
|
|
|
|
|
|
|
|
|
minGasPrices := ctx.MinGasPrices()
|
|
|
|
|
allGTE := true
|
|
|
|
|
for _, v := range minGasPrices {
|
|
|
|
|
if !fee.IsGTE(v) {
|
|
|
|
|
allGTE = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
|
|
|
|
// it is assumed that the minimum fees will only include the single valid denom
|
2019-07-04 19:46:54 +00:00
|
|
|
|
if !ctx.MinGasPrices().IsZero() && !allGTE {
|
2018-12-18 16:10:04 +00:00
|
|
|
|
// reject the transaction that does not meet the minimum fee
|
2020-04-16 15:47:39 +00:00
|
|
|
|
return sdkerrors.Wrapf(
|
|
|
|
|
sdkerrors.ErrInsufficientFee,
|
|
|
|
|
"got: %q required: %q", fee, ctx.MinGasPrices(),
|
2019-11-04 20:45:02 +00:00
|
|
|
|
)
|
2018-11-28 22:19:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-04 20:45:02 +00:00
|
|
|
|
return nil
|
2018-11-28 22:19:22 +00:00
|
|
|
|
}
|