clear up error message.

This commit is contained in:
Raúl Kripalani 2023-01-11 23:01:36 +00:00 committed by raulk
parent 08ae1391ad
commit 1c7db7c782

View File

@ -19,7 +19,8 @@ import (
func AuthenticateMessage(msg *types.SignedMessage, signer address.Address) error { func AuthenticateMessage(msg *types.SignedMessage, signer address.Address) error {
var digest []byte var digest []byte
switch typ := msg.Signature.Type; typ { typ := msg.Signature.Type
switch typ {
case crypto.SigTypeDelegated: case crypto.SigTypeDelegated:
txArgs, err := ethtypes.NewEthTxArgsFromMessage(&msg.Message) txArgs, err := ethtypes.NewEthTxArgsFromMessage(&msg.Message)
if err != nil { if err != nil {
@ -35,7 +36,7 @@ func AuthenticateMessage(msg *types.SignedMessage, signer address.Address) error
} }
if err := sigs.Verify(&msg.Signature, signer, digest); err != nil { if err := sigs.Verify(&msg.Signature, signer, digest); err != nil {
return xerrors.Errorf("secpk message %s has invalid signature: %w", msg.Cid(), err) return xerrors.Errorf("message %s has invalid signature (type %d): %w", msg.Cid(), typ, err)
} }
return nil return nil
} }