Skip to content

Commit

Permalink
Dependabot/cargo/secp256k1 0.21 (#589)
Browse files Browse the repository at this point in the history
* Update secp256k1 requirement from 0.20 to 0.21

Updates the requirements on [secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) to permit the latest version.
- [Release notes](https://github.com/rust-bitcoin/rust-secp256k1/releases)
- [Changelog](https://github.com/rust-bitcoin/rust-secp256k1/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-bitcoin/rust-secp256k1/commits)

---
updated-dependencies:
- dependency-name: secp256k1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove usage of deprecated functions in secp256k1

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
palango and dependabot[bot] authored Jan 18, 2022
1 parent 81c41ae commit 83b4490
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 83b4490

Please sign in to comment.