Skip to content

Commit 0ee0afe

Browse files
authored
refactor: use simple boolean for parity in signature (#776)
* wip * fix doc * fmt
1 parent e715933 commit 0ee0afe

File tree

5 files changed

+605
-6
lines changed

5 files changed

+605
-6
lines changed

crates/primitives/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ mod signed;
5454
pub use signed::{BigIntConversionError, ParseSignedError, Sign, Signed};
5555

5656
mod signature;
57-
pub use signature::{to_eip155_v, Parity, Signature, SignatureError};
57+
pub use signature::{
58+
normalize_v, to_eip155_v, Parity, PrimitiveSignature, Signature, SignatureError,
59+
};
5860

5961
pub mod utils;
6062
pub use utils::{eip191_hash_message, keccak256, Keccak256};

crates/primitives/src/signature/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ mod sig;
88
pub use sig::Signature;
99

1010
mod utils;
11-
pub use utils::to_eip155_v;
11+
pub use utils::{normalize_v, to_eip155_v};
12+
13+
mod primitive_sig;
14+
pub use primitive_sig::PrimitiveSignature;

crates/primitives/src/signature/parity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl Parity {
143143
#[cfg(feature = "k256")]
144144
pub const fn recid(&self) -> k256::ecdsa::RecoveryId {
145145
let recid_opt = match self {
146-
Self::Eip155(v) => Some(crate::signature::utils::normalize_v(*v)),
146+
Self::Eip155(v) => Some(crate::signature::utils::normalize_v_to_recid(*v)),
147147
Self::NonEip155(b) | Self::Parity(b) => k256::ecdsa::RecoveryId::from_byte(*b as u8),
148148
};
149149

0 commit comments

Comments
 (0)