Skip to content

Commit

Permalink
Add err log info for sig verification (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhou committed Aug 31, 2020
1 parent af5edde commit 54b0666
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion x/auth/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,18 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, "pubkey on account is not set")
}

// get accNum
genesis := ctx.BlockHeight() == 0
var accNum uint64
if !genesis {
accNum = signerAccs[i].GetAccountNumber()
}

// verify signature
if !simulate && !pubKey.VerifyBytes(signBytes, sig) {
return ctx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "signature verification failed; verify correct account sequence and chain-id")
return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized,
"signature verification failed; verify correct account sequence and chain-id; %s acct %s, accnum %d, seq %d",
signerAccs[i].GetAddress(), ctx.ChainID(), accNum, signerAccs[i].GetSequence())
}
}

Expand Down

0 comments on commit 54b0666

Please sign in to comment.