Skip to content

Commit

Permalink
Merge #732: Fix hashes version range in 0.29.1
Browse files Browse the repository at this point in the history
f74877a Release version 0.29.1 (Martin Habovstiak)
7ad2f2e Don't use `core::i32::MAX` (Martin Habovstiak)
05c5937 Update panic message handling (Martin Habovstiak)
938dba6 Whitelist known cfgs (Martin Habovstiak)
ad69619 Fix the `hashes` dependency range. (Martin Habovstiak)
caf2f1a Deprecate the `hashes` reexport (Martin Habovstiak)

Pull request description:

  See rust-bitcoin/rust-bitcoin#3296 (comment)

ACKs for top commit:
  apoelstra:
    ACK f74877a; tested final commit locally

Tree-SHA512: adebf04d91e46c7952b7bc3a2cfa64c2d372a6c7295e57c356be72862292e23e7d8e04be47843634cb7680272894f1c66414ebc1e724abaec025938312d89901
  • Loading branch information
apoelstra committed Sep 6, 2024
2 parents 6648126 + f74877a commit 1a1fc57
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 0.29.1 - 2024-09-06

* Deprecate `hashes` reexport

Because the reexport can have any of the *incompatible* versions using it is prone to breakage.
The `bitcoin_hashes` crate is not used in our API anyway, so you should just depend on it yourself
using a version range that's appropriate for your crate.
* Fix version range of the `bitcoin_hashes` crate.

# 0.29.0 - 2024-04-02

* Deprecate `ThirtyTwoByteHash` [#686](https://github.com/rust-bitcoin/rust-secp256k1/pull/686)
Expand Down
2 changes: 1 addition & 1 deletion Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"

[[package]]
name = "secp256k1"
version = "0.29.0"
version = "0.29.1"
dependencies = [
"bincode",
"bitcoin_hashes",
Expand Down
2 changes: 1 addition & 1 deletion Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"

[[package]]
name = "secp256k1"
version = "0.29.0"
version = "0.29.1"
dependencies = [
"bincode",
"bitcoin_hashes",
Expand Down
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "secp256k1"
version = "0.29.0"
version = "0.29.1"
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
"Andrew Poelstra <[email protected]>" ]
license = "CC0-1.0"
Expand Down Expand Up @@ -41,7 +41,7 @@ serde = { version = "1.0.103", default-features = false, optional = true }

# You likely only want to enable these if you explicitly do not want to use "std", otherwise enable
# the respective -std feature e.g., hashes-std
hashes = { package = "bitcoin_hashes", version = ">= 0.12, <= 0.14", default-features = false, optional = true }
hashes = { package = "bitcoin_hashes", version = ">= 0.12, < 0.15", default-features = false, optional = true }
rand = { version = "0.8", default-features = false, optional = true }

[dev-dependencies]
Expand All @@ -54,6 +54,8 @@ bincode = "1.3.3"
wasm-bindgen-test = "0.3"
getrandom = { version = "0.2", features = ["js"] }

[lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(secp256k1_fuzz)', 'cfg(rust_secp_no_symbol_renaming)'] }

[[example]]
name = "sign_verify_recovery"
Expand Down
7 changes: 3 additions & 4 deletions no_std_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#![feature(start)]
#![feature(core_intrinsics)]
#![feature(panic_info_message)]
#![feature(alloc_error_handler)]
#![no_std]
extern crate libc;
Expand All @@ -48,7 +47,7 @@ extern crate wee_alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

use core::fmt::{self, write, Write};
use core::fmt::{self, Write};
use core::intrinsics;
use core::panic::PanicInfo;

Expand Down Expand Up @@ -170,9 +169,9 @@ impl Write for Print {
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
unsafe { libc::printf("shi1\n\0".as_ptr() as _) };
let msg = info.message().unwrap();
let msg = info.message();
let mut buf = Print::new();
write(&mut buf, *msg).unwrap();
write!(&mut buf, "{}", msg).unwrap();
buf.print();
intrinsics::abort()
}
Expand Down
3 changes: 3 additions & 0 deletions secp256k1-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ recovery = []
lowmemory = []
std = ["alloc"]
alloc = []

[lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(secp256k1_fuzz)', 'cfg(rust_secp_no_symbol_renaming)'] }
3 changes: 1 addition & 2 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,9 @@ impl PublicKey {
/// # }
/// ```
pub fn combine_keys(keys: &[&PublicKey]) -> Result<PublicKey, Error> {
use core::i32::MAX;
use core::mem::transmute;

if keys.is_empty() || keys.len() > MAX as usize {
if keys.is_empty() || keys.len() > i32::MAX as usize {
return Err(InvalidPublicKeySum);
}

Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,12 @@ extern crate core;
#[cfg(bench)]
extern crate test;

/// Deprecated reexport of the `bitcoin-hashes` crate.
#[cfg(feature = "hashes")]
pub extern crate hashes;
#[deprecated(since = "0.29.1", note = "Depend on `hashes` in your own crate.")]
pub mod hashes {
pub use ::hashes::*;
}

#[macro_use]
mod macros;
Expand Down

0 comments on commit 1a1fc57

Please sign in to comment.