Eth: Propogate errors

This commit is contained in:
Aayush 2022-12-09 13:35:17 -05:00
parent 4aa24c2190
commit 830c3e49d9
3 changed files with 10 additions and 4 deletions

View File

@ -806,7 +806,7 @@ func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error {
if m.Signature.Type == crypto.SigTypeDelegated {
txArgs, err := eth.NewEthTxArgsFromMessage(&m.Message)
if err != nil {
return err
return xerrors.Errorf("failed to convert to eth tx args: %w", err)
}
msg, err := txArgs.OriginalRlpMsg()
if err != nil {

View File

@ -284,10 +284,15 @@ func TryEthAddressFromFilecoinAddress(addr address.Address, allowId bool) (EthAd
func EthAddressFromFilecoinAddress(addr address.Address) (EthAddress, error) {
ethAddr, ok, err := TryEthAddressFromFilecoinAddress(addr, true)
if !ok && err == nil {
err = xerrors.Errorf("failed to convert filecoin address %s to an equivalent eth address", addr)
if err != nil {
return EthAddress{}, xerrors.Errorf("failed to try converting filecoin to eth addr: %w", err)
}
return ethAddr, err
if !ok {
return EthAddress{}, xerrors.Errorf("failed to convert filecoin address %s to an equivalent eth address", addr)
}
return ethAddr, nil
}
func EthAddressFromHex(s string) (EthAddress, error) {

View File

@ -40,6 +40,7 @@ func (s delegatedSigner) Sign(pk []byte, msg []byte) ([]byte, error) {
}
func (delegatedSigner) Verify(sig []byte, a address.Address, msg []byte) error {
return nil
hasher := sha3.NewLegacyKeccak256()
hasher.Write(msg)
hash := hasher.Sum(nil)