-
Notifications
You must be signed in to change notification settings - Fork 161
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
Implement signing data with intended validator as part of EIP 191 #56
Conversation
@pipermerriam could you please review? Thankyou. |
@kclowes I have a few doubts regarding this signing procedure. This PR aims to support the new signing mechanism as per
Could you please give me clarity on the above questions, so that I could do better testing with this /cc @pipermerriam |
@pipermerriam @kclowes, please correct me if my below stated claims are wrong anywhere.
The above claims of mine are based on the following reasons and scenario. Note: In the below description,
Requests and Confirmations
|
@Bhargavasomu sorry it has taken me so long to respond! I should have some time tomorrow and I'll definitely have time on Wednesday to review. |
@Bhargavasomu I need a little more time to wrap my head around the PR. I hope I'll be able to get you some feedback/answers to questions tomorrow! |
Yes, I think that's correct! |
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 is looking good, @Bhargavasomu! I left a few comments, mostly about wording. I also didn't see that this was just the implementation for EIP 191 at first so I left some comments about EIP 712. We can disregard the EIP 712 comments for now and take into account in the next PR.
40dc5b9
to
4b31d84
Compare
@kclowes done! Please review whenever you have time. Thankyou. |
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.
Looks good @Bhargavasomu!
My comments are mostly nitpicky comments on the docstring.
Can we add some more tests to make sure the signature version b'\x00' runs like we'd expect? I'd like to see a test for each type of message (text, bytestring, and hexstr) and a test to make sure that the TypeError gets raised if the address is different than 20 bytes long. Then I think we'll be good to merge! Thank you!
4b31d84
to
dfe87f9
Compare
dfe87f9
to
81438a2
Compare
@kclowes @pipermerriam could you please check if the |
@kclowes I have added the new tests also. Please have a look and let me know. Thankyou! |
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.
@Bhargavasomu I just left a few style nitpicks. Feel free to take or leave them. This is looking good!
d3e554c
to
9043d76
Compare
@kclowes done, review please. |
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.
Looks good to me! Thanks @Bhargavasomu!
@pipermerriam done. Please review again. Thankyou. |
eth_account/messages.py
Outdated
@@ -28,7 +28,7 @@ def defunct_hash_message( | |||
Currently you can only specify the ``signature_version`` as following. | |||
version ``0x45`` (version ``E``): ``b'\\x19Ethereum Signed Message:\\n'`` | |||
concatenated with the number of bytes in the message. | |||
NOTE: This is the defualt version followed, if the signature_version is not specified. | |||
.. note:: This is the defualt version followed, if the signature_version is not specified. | |||
version ``0x00`` (version ``0``): Sign data with intended validator (EIP 191). |
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.
@Bhargavasomu can you build the docs locally and verify this renders correctly. I'm thinking there's some whitespace needed here but not sure exactly where and how much.
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.
@pipermerriam I have fixed the docs, and the output is as follows.
828f3fb
to
321d676
Compare
@pipermerriam ready for another round of review. Thankyou. |
What was wrong?
EIP 191
needs to be implemented as part of ethereum/web3.py#1241How was it fixed?
signature version 0x00
(SigningData with intended validator
) by makingdefunct_hash_message
take thesignature_version
and theversion_specific_data
as arguments. Then thesignature_wrapper
function was modified to add support to thesesignature versions
.Cute Animal Picture