-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exception message to from #140
Add exception message to from #140
Conversation
dd7f3d7
to
e89fb45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor cleanup requested
eth_tester/backends/pyevm/main.py
Outdated
@@ -471,6 +472,8 @@ def _get_normalized_and_unsigned_evm_transaction(self, transaction, block_number | |||
return evm_transaction | |||
|
|||
def _get_normalized_and_signed_evm_transaction(self, transaction, block_number='latest'): | |||
if transaction['from'] not in self._key_lookup: | |||
raise ValidationError('"from" key not available, does this account exist?') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message seems like it could be improved a bit.
No
"from"
key was provided in the transaction which is required for transaction signing
A bit more concise and hints at how the user can fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am changing this message to No valid "from" key was provided...
the reason is that one can specify a public key, but the the key isn't available to use (this is how I found the error, I specified a public key of a contract) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to get really fancy, we could list the valid keys and show the actual key, but that shouldn't hold up this PR.
What was wrong?
When supplying an invalid from address, one would receive a KeyError.
How was it fixed?
Throws a more useful exception.
Cute Animal Picture