diff --git a/Cargo.toml b/Cargo.toml index 645b333..566c897 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,3 +49,6 @@ arbitrary = "1.3" # for 7702 signed authorization list arbitrary k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } rand = "0.8" + +[patch.crates-io] +alloy-primitives = { git = "https://github.com/alloy-rs/core", rev = "237cfc4" } diff --git a/crates/eip7702/src/auth_list.rs b/crates/eip7702/src/auth_list.rs index ab38a39..9ca812b 100644 --- a/crates/eip7702/src/auth_list.rs +++ b/crates/eip7702/src/auth_list.rs @@ -2,7 +2,7 @@ use core::ops::Deref; #[cfg(not(feature = "std"))] use alloc::vec::Vec; -use alloy_primitives::{keccak256, Address, PrimitiveSignature, SignatureError, B256, U256, U8}; +use alloy_primitives::{keccak256, Address, Signature, SignatureError, B256, U256, U8}; use alloy_rlp::{ length_of_length, BufMut, Decodable, Encodable, Header, Result as RlpResult, RlpDecodable, RlpEncodable, @@ -92,7 +92,7 @@ impl Authorization { } /// Convert to a signed authorization by adding a signature. - pub fn into_signed(self, signature: PrimitiveSignature) -> SignedAuthorization { + pub fn into_signed(self, signature: Signature) -> SignedAuthorization { SignedAuthorization { inner: self, r: signature.r(), @@ -130,9 +130,9 @@ impl SignedAuthorization { /// /// Note that this signature might still be invalid for recovery as it might have `s` value /// greater than [secp256k1n/2](crate::constants::SECP256K1N_HALF). - pub fn signature(&self) -> Result { + pub fn signature(&self) -> Result { if self.y_parity() <= 1 { - Ok(PrimitiveSignature::new(self.r, self.s, self.y_parity() == 1)) + Ok(Signature::new(self.r, self.s, self.y_parity() == 1)) } else { Err(SignatureError::InvalidParity(self.y_parity() as u64)) } @@ -291,7 +291,7 @@ impl<'a> arbitrary::Arbitrary<'a> for SignedAuthorization { let (recoverable_sig, recovery_id) = signing_key.sign_prehash(signature_hash.as_ref()).unwrap(); let signature = - PrimitiveSignature::from_signature_and_parity(recoverable_sig, recovery_id.is_y_odd()); + Signature::from_signature_and_parity(recoverable_sig, recovery_id.is_y_odd()); Ok(inner.into_signed(signature)) } @@ -397,7 +397,7 @@ mod tests { let auth = Authorization { chain_id: 1u64, address: Address::left_padding_from(&[6]), nonce: 1 }; - let auth = auth.into_signed(PrimitiveSignature::from_str("48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c8041b").unwrap()); + let auth = auth.into_signed(Signature::from_str("48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c8041b").unwrap()); let mut buf = Vec::new(); auth.encode(&mut buf);