Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Fix isValidSignature method #171

Merged
merged 3 commits into from
Feb 4, 2019
Merged

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Jan 4, 2019

This PR makes two changes.

This first is minor: the docs for isValidSignature say that v should be a Buffer, but the code assumes it is a number. This PR updates the doc, as changing the code would be a breaking change.

The second is a more significant bug. Prior to this PR, isValidSignature will return false if passed an s-value greater than secp256k1n/2 AND if homestead === false. However, the EIP that introduced this https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md was the primary homestead EIP. The code seems much more correct if we instead check that homestead is true. This is consistent with what is currently done in ethereumjs-tx (for example). This PR updates that line of code accordingly.

@coveralls
Copy link

coveralls commented Jan 4, 2019

Coverage Status

Coverage increased (+0.4%) to 99.611% when pulling 777241f on fix-isValidSignature-method into 9c4dbfe on master.

index.js Outdated Show resolved Hide resolved
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@holgerd77 holgerd77 merged commit fb864da into master Feb 4, 2019
@holgerd77 holgerd77 deleted the fix-isValidSignature-method branch February 4, 2019 13:31
@holgerd77 holgerd77 mentioned this pull request Feb 4, 2019
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.

None yet

3 participants