-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: correctly handle v values #13
Conversation
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.
yeah this should work
Note, this is likely a breaking change for the codec in Reth, meaning this would not work on Odyssey |
#[cfg_attr(feature = "serde", serde(rename = "yParity"))] | ||
y_parity: U8, |
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.
let's add some context here that any U8 is valid but will be invalid for evm?
#[cfg_attr(feature = "serde", serde(rename = "yParity"))] | ||
y_parity: U8, | ||
r: U256, | ||
s: U256, |
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.
I order to write them to disk on reth we also need getters for all the fields
we need ensure that we can do:
crates/eip7702/src/auth_list.rs
Outdated
} | ||
|
||
/// Returns the signature parity value. | ||
pub const fn y_parity(&self) -> U8 { |
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 we do u8
here so that the caller doesn't have to do this?
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.
last pedantic nit
crates/eip7702/src/auth_list.rs
Outdated
pub const fn signature(&self) -> &Signature { | ||
&self.signature | ||
/// Creates a new signed authorization from raw signature values. | ||
pub fn new_unchecked(inner: Authorization, y_parity: U8, r: U256, s: U256) -> Self { |
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.
pub fn new_unchecked(inner: Authorization, y_parity: U8, r: U256, s: U256) -> Self { | |
pub fn new_unchecked(inner: Authorization, y_parity: u8, r: U256, s: U256) -> Self { |
Motivation
For EIP-7702 authorization any
v
value <2**8 is valid during decoding and should be attempted for recovery. During recovery, only 0 and 1 values should be accepted.Solution
This removes inner
signature: Signature
field from authorization, replacing it with separate v, r, s fields.fn signature
now returns a result of conversion of vrs to signaturePR Checklist