Skip to content
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

feat(primitives): Add y_parity_byte_non_eip155 to Parity #499

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

Evalir
Copy link
Contributor

@Evalir Evalir commented Jan 24, 2024

Motivation

In the case of a signature without EIP155 applied, the y_parity byte should be returned as 27 or 28. y_parity_byte only returns it as {0,1}.

Solution

This adds a fn y_parity_byte_non_eip155 which, when not having an EIP155 parity, we get 27 or 28, or None otherwise.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

defer to @prestwich here

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm, any follow up PR needed here to solve the bug in anvil?

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
@Evalir
Copy link
Contributor Author

Evalir commented Jan 25, 2024

yep @onbjerg, we'll need to change how the v value is represented on the signature as_bytes impl (namely, use y_parity_byte_non_eip155 and if None, fallback to y_parity_byte), and after, we'll need a minor release of core to bump on alloy-rs/alloy.

@onbjerg
Copy link
Member

onbjerg commented Jan 25, 2024

lgtm

@Evalir Evalir merged commit 6a3a043 into alloy-rs:main Jan 25, 2024
21 checks passed
@Evalir Evalir deleted the evalir/add-missing-sig-fn branch January 25, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants