-
Notifications
You must be signed in to change notification settings - Fork 5
Began work on issue #22 - isValidSignatureForSolidity #24
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
base: master
Are you sure you want to change the base?
Conversation
NickChapman
left a comment
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 things but overall looks pretty good
servicesExternal/web3_single.py
Outdated
| Returns the keccak-256 hash of message, prefixed with the header used by the eth_sign RPC call | ||
| ethereumjs-util equivalent: https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#hashpersonalmessage | ||
| ''' | ||
| if type(message) != bytes: |
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.
You should use isinstance instead of type
servicesExternal/web3_single.py
Outdated
| def keccak(bytes) -> str: | ||
| return sha3.keccak_256(bytes).digest() | ||
|
|
||
| def message_hash(message) -> str: |
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.
All method names should be camel case instead of snake case.
servicesExternal/web3_single.py
Outdated
| ECDSA public key recovery from signature | ||
| ethereumjs-util equivalent: https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#ecrecover | ||
| ''' | ||
| assert len(hash) == 32 |
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.
For all of these asserts it would be nice if you could provide a description of why they are wrong so that people have an easier time debugging.
servicesExternal/web3_single.py
Outdated
| xc = r * r * r + 7 | ||
| return pow(xc, (SECP256K1P - 1) // 2, SECP256K1P) == 1 | ||
|
|
||
| def ecrecover_to_pub(hash, signature, chaincode = 27) -> str: |
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.
Can you add types to all of your function params (for all functions not just this one)
… snake_case to camelCase; added types to all function parameters
Addresses #22