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

refactor: use simple boolean for parity in signature #776

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ mod signed;
pub use signed::{BigIntConversionError, ParseSignedError, Sign, Signed};

mod signature;
pub use signature::{to_eip155_v, Parity, Signature, SignatureError};
pub use signature::{
normalize_v, to_eip155_v, Parity, PrimitiveSignature, Signature, SignatureError,
};

pub mod utils;
pub use utils::{eip191_hash_message, keccak256, Keccak256};
Expand Down
5 changes: 4 additions & 1 deletion crates/primitives/src/signature/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ mod sig;
pub use sig::Signature;

mod utils;
pub use utils::to_eip155_v;
pub use utils::{normalize_v, to_eip155_v};

mod primitive_sig;
pub use primitive_sig::PrimitiveSignature;
2 changes: 1 addition & 1 deletion crates/primitives/src/signature/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl Parity {
#[cfg(feature = "k256")]
pub const fn recid(&self) -> k256::ecdsa::RecoveryId {
let recid_opt = match self {
Self::Eip155(v) => Some(crate::signature::utils::normalize_v(*v)),
Self::Eip155(v) => Some(crate::signature::utils::normalize_v_to_recid(*v)),
Self::NonEip155(b) | Self::Parity(b) => k256::ecdsa::RecoveryId::from_byte(*b as u8),
};

Expand Down
Loading