Skip to content

Update secp256k1 dependency #875

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

Merged
merged 1 commit into from
Mar 12, 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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
bech32 = { version = "0.8.1", default-features = false }
bitcoin_hashes = { version = "0.10.0", default-features = false }
secp256k1 = { version = "0.21.2", default-features = false }
secp256k1 = { version = "0.22.0", default-features = false }
core2 = { version = "0.3.0", optional = true, default-features = false }

base64-compat = { version = "1.0.0", optional = true }
Expand All @@ -47,7 +47,7 @@ hashbrown = { version = "0.8", optional = true }
[dev-dependencies]
serde_json = "<1.0.45"
serde_test = "1"
secp256k1 = { version = "0.21.2", features = [ "recovery", "rand-std" ] }
secp256k1 = { version = "0.22.0", features = [ "recovery", "rand-std" ] }
bincode = "1.3.1"
# We need to pin ryu (transitive dep from serde_json) to stay compatible with Rust 1.22.0
ryu = "<1.0.5"
Expand Down
2 changes: 1 addition & 1 deletion src/util/schnorr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl TweakedPublicKey {
/// the y-coordinate is represented by only a single bit, as x determines
/// it up to one bit.
#[inline]
pub fn serialize(&self) -> [u8; constants::SCHNORRSIG_PUBLIC_KEY_SIZE] {
pub fn serialize(&self) -> [u8; constants::SCHNORR_PUBLIC_KEY_SIZE] {
self.0.serialize()
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,8 @@ impl ControlBlock {
{
return Err(TaprootError::InvalidControlBlockSize(sl.len()));
}
let output_key_parity = secp256k1::Parity::from((sl[0] & 1) as i32);
let output_key_parity = secp256k1::Parity::from_i32((sl[0] & 1) as i32)
.map_err(TaprootError::InvalidParity)?;
let leaf_version = LeafVersion::from_consensus(sl[0] & TAPROOT_LEAF_MASK)?;
let internal_key = UntweakedPublicKey::from_slice(&sl[1..TAPROOT_CONTROL_BASE_SIZE])
.map_err(TaprootError::InvalidInternalKey)?;
Expand Down Expand Up @@ -970,6 +971,8 @@ pub enum TaprootError {
InvalidControlBlockSize(usize),
/// Invalid taproot internal key
InvalidInternalKey(secp256k1::Error),
/// Invalid parity for internal key
InvalidParity(secp256k1::InvalidParityValue),
/// Empty TapTree
EmptyTree,
}
Expand Down Expand Up @@ -999,6 +1002,7 @@ impl fmt::Display for TaprootError {
),
// TODO: add source when in MSRV
TaprootError::InvalidInternalKey(e) => write!(f, "Invalid Internal XOnly key : {}", e),
TaprootError::InvalidParity(e) => write!(f, "Invalid parity value for internal key: {}", e),
TaprootError::EmptyTree => write!(f, "Taproot Tree must contain at least one script"),
}
}
Expand Down