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

Update secp256k1 dependency #80

Merged
merged 5 commits into from
Jul 2, 2024
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 .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true
- name: Running cargo in release mode
run: cargo test --features="global-context" --release
run: cargo update -p cc --precise 1.0.94 && cargo test --features="global-context" --release
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rand = ["actual-rand", "secp256k1/rand"]
[dependencies]
actual-serde = { package = "serde", version = "1.0", default-features = false, optional = true }
actual-rand = { package = "rand", version = "0.8", default-features = false, optional = true }
secp256k1 = "0.28.0"
secp256k1 = "0.29.0"
secp256k1-zkp-sys = { version = "0.9.0", default-features = false, path = "./secp256k1-zkp-sys" }
internals = { package = "bitcoin-private", version = "0.1.0" }

Expand All @@ -46,3 +46,6 @@ getrandom = { version = "0.2", features = ["js"] }

[lib]
crate-type = ["cdylib", "rlib"]

[lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = [ "cfg(rust_secp_fuzz)" ] }
5 changes: 5 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ rustc --version
# Make all cargo invocations verbose
export CARGO_TERM_VERBOSE=true

# Pin dependencies as required if we are using MSRV toolchain.
if cargo --version | grep "1\.56"; then
cargo update -p cc --precise 1.0.94
fi

# Defaults / sanity checks
cargo build --all
cargo test --all
Expand Down
5 changes: 4 additions & 1 deletion secp256k1-zkp-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ features = [ "recovery", "lowmemory" ]
cc = "1.0.28"

[dependencies]
secp256k1-sys = "0.9.0"
secp256k1-sys = "0.10.0"

[features]
default = ["std"]
recovery = ["secp256k1-sys/recovery"]
lowmemory = ["secp256k1-sys/lowmemory"]
std = []

[lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = [ "cfg(rust_secp_zkp_no_symbol_renaming)" ] }
6 changes: 3 additions & 3 deletions secp256k1-zkp-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ revision the default branch is pointing to.

## Linking to external symbols

For the more exotic use cases, this crate can be used with existing libsecp256k1-zkp
symbols by using the `external-symbols` feature. How to setup rustc to link
against those existing symbols is left as an exercise to the reader.
If you want to compile this library without using the bundled symbols (which may
be required for integration into other build systems), you can do so by adding
`--cfg=rust_secp_no_symbol_renaming'` to your `RUSTFLAGS` variable.

## Minimum Supported Rust Version

Expand Down
5 changes: 0 additions & 5 deletions secp256k1-zkp-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ extern crate cc;
use std::env;

fn main() {
if cfg!(feature = "external-symbols") {
println!("cargo:rustc-link-lib=static=secp256k1zkp");
return;
}

// Actual build
let mut base_config = cc::Build::new();
base_config
Expand Down
4 changes: 2 additions & 2 deletions secp256k1-zkp-sys/src/error_callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use secp256k1_sys::types::{c_char, c_void};

#[no_mangle]
#[cfg(not(feature = "external-symbols"))]
#[cfg(not(rust_secp_zkp_no_symbol_renaming))]
pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn(
_: *const c_char,
_data: *mut c_void,
Expand All @@ -17,7 +17,7 @@ pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn(
}

#[no_mangle]
#[cfg(not(feature = "external-symbols"))]
#[cfg(not(rust_secp_zkp_no_symbol_renaming))]
pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_error_callback_fn(
_: *const c_char,
_data: *mut c_void,
Expand Down
54 changes: 27 additions & 27 deletions secp256k1-zkp-sys/src/zkp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub const WHITELIST_MAX_N_KEYS: size_t = 255;

extern "C" {
#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_commitment_parse"
)]
// Parse a 33-byte commitment into 64 byte internal commitment object
Expand All @@ -24,7 +24,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_commitment_serialize"
)]
// Serialize a 64-byte commit object into a 33 byte serialized byte sequence
Expand All @@ -35,7 +35,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_commit"
)]
// Generates a pedersen commitment: *commit = blind * G + value * G2.
Expand All @@ -49,7 +49,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_blind_generator_blind_sum"
)]
/// Sets the final Pedersen blinding factor correctly when the generators themselves
Expand Down Expand Up @@ -91,7 +91,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_verify_tally"
)]
// Takes two list of 64-byte commitments and sums the first set and
Expand All @@ -106,7 +106,7 @@ extern "C" {

#[cfg(feature = "std")]
#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_info"
)]
pub fn secp256k1_rangeproof_info(
Expand All @@ -121,7 +121,7 @@ extern "C" {

#[cfg(feature = "std")]
#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_rewind"
)]
pub fn secp256k1_rangeproof_rewind(
Expand All @@ -143,7 +143,7 @@ extern "C" {

#[cfg(feature = "std")]
#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_verify"
)]
pub fn secp256k1_rangeproof_verify(
Expand All @@ -160,7 +160,7 @@ extern "C" {

#[cfg(feature = "std")]
#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_sign"
)]
pub fn secp256k1_rangeproof_sign(
Expand All @@ -182,7 +182,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_initialize"
)]
pub fn secp256k1_surjectionproof_initialize(
Expand All @@ -198,7 +198,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_serialize"
)]
pub fn secp256k1_surjectionproof_serialize(
Expand All @@ -209,7 +209,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_serialized_size"
)]
pub fn secp256k1_surjectionproof_serialized_size(
Expand All @@ -218,7 +218,7 @@ extern "C" {
) -> size_t;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_parse"
)]
pub fn secp256k1_surjectionproof_parse(
Expand All @@ -229,7 +229,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_generate"
)]
pub fn secp256k1_surjectionproof_generate(
Expand All @@ -244,7 +244,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_verify"
)]
pub fn secp256k1_surjectionproof_verify(
Expand All @@ -256,7 +256,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_generator_generate_blinded"
)]
pub fn secp256k1_generator_generate_blinded(
Expand All @@ -267,7 +267,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_generator_serialize"
)]
pub fn secp256k1_generator_serialize(
Expand All @@ -277,7 +277,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_generator_parse"
)]
pub fn secp256k1_generator_parse(
Expand All @@ -287,13 +287,13 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_nonce_function_ecdsa_adaptor"
)]
pub static secp256k1_nonce_function_ecdsa_adaptor: EcdsaAdaptorNonceFn;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_encrypt"
)]
pub fn secp256k1_ecdsa_adaptor_encrypt(
Expand All @@ -307,7 +307,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_verify"
)]
pub fn secp256k1_ecdsa_adaptor_verify(
Expand All @@ -319,7 +319,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_decrypt"
)]
pub fn secp256k1_ecdsa_adaptor_decrypt(
Expand All @@ -330,7 +330,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_recover"
)]
pub fn secp256k1_ecdsa_adaptor_recover(
Expand All @@ -342,7 +342,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_signature_parse"
)]
pub fn secp256k1_whitelist_signature_parse(
Expand All @@ -353,7 +353,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_signature_serialize"
)]
pub fn secp256k1_whitelist_signature_serialize(
Expand All @@ -364,7 +364,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_sign"
)]
pub fn secp256k1_whitelist_sign(
Expand All @@ -380,7 +380,7 @@ extern "C" {
) -> c_int;

#[cfg_attr(
not(feature = "external-symbols"),
not(rust_secp_zkp_no_symbol_renaming),
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_verify"
)]
pub fn secp256k1_whitelist_verify(
Expand Down
Loading
Loading