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

Dependabot/cargo/secp256k1 0.21 #589

Merged
merged 2 commits into from
Jan 18, 2022
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ serde_json = "1.0.39"
tiny-keccak = { version = "2.0.1", features = ["keccak"] }
pin-project = "1.0"
# Optional deps
secp256k1 = { version = "0.20", features = ["recovery"], optional = true }
secp256k1 = { version = "0.21", features = ["recovery"], optional = true }
once_cell = { version = "1.8.0", optional = true }

## HTTP
Expand Down
8 changes: 4 additions & 4 deletions src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod feature_gated {
use once_cell::sync::Lazy;
pub(crate) use secp256k1::SecretKey;
use secp256k1::{
recovery::{RecoverableSignature, RecoveryId},
ecdsa::{RecoverableSignature, RecoveryId},
All, Message, PublicKey, Secp256k1,
};
use std::ops::Deref;
Expand Down Expand Up @@ -101,7 +101,7 @@ mod feature_gated {
impl<T: Deref<Target = SecretKey>> Key for T {
fn sign(&self, message: &[u8], chain_id: Option<u64>) -> Result<Signature, SigningError> {
let message = Message::from_slice(&message).map_err(|_| SigningError::InvalidMessage)?;
let (recovery_id, signature) = CONTEXT.sign_recoverable(&message, self).serialize_compact();
let (recovery_id, signature) = CONTEXT.sign_ecdsa_recoverable(&message, self).serialize_compact();

let standard_v = recovery_id.to_i32() as u64;
let v = if let Some(chain_id) = chain_id {
Expand All @@ -119,7 +119,7 @@ mod feature_gated {

fn sign_message(&self, message: &[u8]) -> Result<Signature, SigningError> {
let message = Message::from_slice(&message).map_err(|_| SigningError::InvalidMessage)?;
let (recovery_id, signature) = CONTEXT.sign_recoverable(&message, self).serialize_compact();
let (recovery_id, signature) = CONTEXT.sign_ecdsa_recoverable(&message, self).serialize_compact();

let v = recovery_id.to_i32() as u64;
let r = H256::from_slice(&signature[..32]);
Expand All @@ -142,7 +142,7 @@ mod feature_gated {
let signature =
RecoverableSignature::from_compact(&signature, recovery_id).map_err(|_| RecoveryError::InvalidSignature)?;
let public_key = CONTEXT
.recover(&message, &signature)
.recover_ecdsa(&message, &signature)
.map_err(|_| RecoveryError::InvalidSignature)?;

Ok(public_key_address(&public_key))
Expand Down