Code that wants to verify signatures is required to both do error handling and return value checking when calling Signature.verify_msg due to the function returning a boolean and potentially raising a BadSignature in the event of a corrupt signature.
How can it be fixed?
The naive thing to do is have that method convert BadSignature to a False return but I think that is wrong since it conflates a corrupt signature with a signature that doesn't validate.
This probably needs to be split into a two part check so that the two concepts remain distinct, allowing the user to check if the signature itself is valid in isolation and then to check if it is a valid signature for a message.
What was wrong?
https://github.com/ethereum/trinity/pull/586/files#r287599483
Code that wants to verify signatures is required to both do error handling and return value checking when calling
Signature.verify_msg
due to the function returning a boolean and potentially raising aBadSignature
in the event of a corrupt signature.How can it be fixed?
The naive thing to do is have that method convert
BadSignature
to aFalse
return but I think that is wrong since it conflates a corrupt signature with a signature that doesn't validate.This probably needs to be split into a two part check so that the two concepts remain distinct, allowing the user to check if the signature itself is valid in isolation and then to check if it is a valid signature for a message.