func processSig(
	ctx sdk.Context, acc types.Account, sig auth.StdSignature, signBytes []byte, simulate bool,
	sigGasConsumer SignatureVerificationGasConsumer,
) (updatedAcc Account, res sdk.Result) {
	if res := sigGasConsumer(ctx.GasMeter(), acc.PubKey); !res.IsOK() {
		return acc, res
	}
	if !simulate && !acc.PubKey.VerifyBytes(signBytes, sig.Signature) {
		return acc, sdk.ErrUnauthorized(
			"Signature verification failed; verify correct account sequence and chain-id").Result()
	}
	acc.Sequence++
	return acc, res
}
verify the signature and increment the sequence.
package auth
import (
	"fmt"
	sdk "github.com/cosmos/cosmos-sdk/types"
	"github.com/cosmos/cosmos-sdk/x/auth"
	"github.com/tendermint/tendermint/crypto"
	"github.com/tendermint/tendermint/crypto/ed25519"
	"github.com/tendermint/tendermint/crypto/secp256k1"
	"github.com/zigbee-alliance/distributed-compliance-ledger/x/auth/internal/types"
)
type SignatureVerificationGasConsumer = func(meter sdk.GasMeter, pubkey crypto.PubKey) sdk.Result
func NewAnteHandler(ak Keeper, sigGasConsumer SignatureVerificationGasConsumer) sdk.AnteHandler {
	return func(
		ctx sdk.Context, tx sdk.Tx, simulate bool,
	) (newCtx sdk.Context, res sdk.Result, abort bool) {
		stdTx, ok := tx.(auth.StdTx)
		if !ok {
			newCtx = SetGasMeter(simulate, ctx, 0)
			return newCtx, sdk.ErrInternal("tx must be StdTx").Result(), true
		}
		newCtx = SetGasMeter(simulate, ctx, stdTx.Fee.Gas)
		defer func() {
			if r := recover(); r != nil {
				switch rType := r.(type) {
				case sdk.ErrorOutOfGas:
					log := fmt.Sprintf(
						"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
						rType.Descriptor, stdTx.Fee.Gas, newCtx.GasMeter().GasConsumed(),
					)
					res = sdk.ErrOutOfGas(log).Result()
					res.GasWanted = stdTx.Fee.Gas
					res.GasUsed = newCtx.GasMeter().GasConsumed()
					abort = true
				default:
					panic(r)
				}
			}
		}()
		if err := tx.ValidateBasic(); err != nil {
			return newCtx, err.Result(), true
		}
		newCtx.GasMeter().ConsumeGas(types.TxSizeCostPerByte*sdk.Gas(len(newCtx.TxBytes())), "txSize")
		if res := ValidateMemo(stdTx); !res.IsOK() {
			return newCtx, res, true
		}
		signers := stdTx.GetSigners()
		signatures := stdTx.GetSignatures()
		isGenesis := ctx.BlockHeight() == 0
		for i, signature := range signatures {
			account, res := GetSignerAcc(newCtx, ak, signers[i])
			if !res.IsOK() {
				return newCtx, res, true
			}
			signBytes := GetSignBytes(newCtx.ChainID(), stdTx, account, isGenesis)
			account, res = processSig(newCtx, account, signature, signBytes, simulate, sigGasConsumer)
			if !res.IsOK() {
				return newCtx, res, true
			}
			ak.SetAccount(newCtx, account)
		}
		return newCtx, sdk.Result{GasWanted: stdTx.Fee.Gas}, false  
	}
}
func GetSignerAcc(ctx sdk.Context, keeper Keeper, address sdk.AccAddress) (acc types.Account, res sdk.Result) {
	if !keeper.IsAccountPresent(ctx, address) {
		return acc, types.ErrAccountDoesNotExist(address).Result()
	}
	acc = keeper.GetAccount(ctx, address)
	return acc, sdk.Result{}
}
func ValidateMemo(stdTx auth.StdTx) sdk.Result {
	memoLength := len(stdTx.GetMemo())
	if uint64(memoLength) > types.MaxMemoCharacters {
		return sdk.ErrMemoTooLarge(
			fmt.Sprintf(
				"maximum number of characters is %d but received %d characters",
				types.MaxMemoCharacters, memoLength,
			),
		).Result()
	}
	return sdk.Result{}
}