ante: don't skip EthSigVerificationDecorator for RecheckTx (#186)

Because it set the `From` field which is relied by other handlers

Closes #185
This commit is contained in:
yihuang 2021-06-25 21:28:28 +08:00 committed by GitHub
parent d937d2c9ce
commit fd19394fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -45,12 +45,10 @@ func NewEthSigVerificationDecorator(ek EVMKeeper) EthSigVerificationDecorator {
// AnteHandle validates checks that the registered chain id is the same as the one on the message, and // AnteHandle validates checks that the registered chain id is the same as the one on the message, and
// that the signer address matches the one defined on the message. // that the signer address matches the one defined on the message.
// It's not skipped for RecheckTx, because it set `From` address which is critical from other ante handler to work.
// Failure in RecheckTx will prevent tx to be included into block, especially when CheckTx succeed, in which case user
// won't see the error message.
func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
// no need to verify signatures on recheck tx
if ctx.IsReCheckTx() {
return next(ctx, tx, simulate)
}
if len(tx.GetMsgs()) != 1 { if len(tx.GetMsgs()) != 1 {
return ctx, stacktrace.Propagate( return ctx, stacktrace.Propagate(
sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "only 1 ethereum msg supported per tx, got %d", len(tx.GetMsgs())), sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "only 1 ethereum msg supported per tx, got %d", len(tx.GetMsgs())),

View File

@ -33,7 +33,7 @@ func (suite AnteTestSuite) TestEthSigVerificationDecorator() {
reCheckTx bool reCheckTx bool
expPass bool expPass bool
}{ }{
{"ReCheckTx", nil, true, true}, {"ReCheckTx", nil, true, false},
{"invalid transaction type", &invalidTx{}, false, false}, {"invalid transaction type", &invalidTx{}, false, false},
{ {
"invalid sender", "invalid sender",