Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Create public key validation function#88

Merged
pipermerriam merged 2 commits intomasterfrom
unknown repository
Sep 6, 2017
Merged

Create public key validation function#88
pipermerriam merged 2 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Sep 5, 2017

What was wrong?

The same code for validating public keys was used in two different places.

How was it fixed?

That code was extracted into a new function in evm.validation.validate_raw_public_key

Cute Animal Picture

image

put a cute animal picture here.

left = big_endian_to_int(public_key[0:32])
right = big_endian_to_int(public_key[32:64])
return left, right
if validate_raw_public_key(public_key):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be nested in an if statement. Instead it should just be called at the beginning of the function. Same with the other applications of this validator.



def validate_raw_public_key(value):
if len(value) != 64 or validate_is_bytes(value):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the validate_is_bytes call from this statement and place it on it's own line above this line.

@ghost
Copy link
Author

ghost commented Sep 6, 2017

@pipermerriam Committed the requested changes.

@pipermerriam pipermerriam merged commit f8fa8cb into ethereum:master Sep 6, 2017
@ghost ghost deleted the public_key_validation_function branch September 6, 2017 02:49
pacrob added a commit to pacrob/py-evm that referenced this pull request Dec 18, 2023
* remove testall because it doesnt work
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants