Skip to content

Commit 8733740

Browse files
committed
Merge #80: Update secp256k1 dependency
4fb4de3 ci: pin cc for MSRV (Andrew Poelstra) 9857edd bump secp256k1 dependency to 0.29 (Andrew Poelstra) 57f511d docs: fix doclinks (Andrew Poelstra) c92f00a clippy: fix various lints (Andrew Poelstra) 1928710 zkp-sys: replace external-symbols feature with cfg flag (Andrew Poelstra) Pull request description: ACKs for top commit: jonasnick: ACK 4fb4de3 Tree-SHA512: aa901d2fe3bdc27f415b6c1daf03db1ca99dca56076f9f140714ba9219fe99347b173271cc1f29bd4fd2e0d3af8df01c1c2661746261741f4f037ea230860973
2 parents 1e6dd22 + 4fb4de3 commit 8733740

File tree

11 files changed

+63
-59
lines changed

11 files changed

+63
-59
lines changed

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ jobs:
107107
toolchain: ${{ matrix.rust }}
108108
override: true
109109
- name: Running cargo in release mode
110-
run: cargo test --features="global-context" --release
110+
run: cargo update -p cc --precise 1.0.94 && cargo test --features="global-context" --release

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rand = ["actual-rand", "secp256k1/rand"]
3333
[dependencies]
3434
actual-serde = { package = "serde", version = "1.0", default-features = false, optional = true }
3535
actual-rand = { package = "rand", version = "0.8", default-features = false, optional = true }
36-
secp256k1 = "0.28.0"
36+
secp256k1 = "0.29.0"
3737
secp256k1-zkp-sys = { version = "0.9.0", default-features = false, path = "./secp256k1-zkp-sys" }
3838
internals = { package = "bitcoin-private", version = "0.1.0" }
3939

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

4747
[lib]
4848
crate-type = ["cdylib", "rlib"]
49+
50+
[lints.rust]
51+
unexpected_cfgs = { level = "deny", check-cfg = [ "cfg(rust_secp_fuzz)" ] }

contrib/test.sh

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ rustc --version
88
# Make all cargo invocations verbose
99
export CARGO_TERM_VERBOSE=true
1010

11+
# Pin dependencies as required if we are using MSRV toolchain.
12+
if cargo --version | grep "1\.56"; then
13+
cargo update -p cc --precise 1.0.94
14+
fi
15+
1116
# Defaults / sanity checks
1217
cargo build --all
1318
cargo test --all

secp256k1-zkp-sys/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ features = [ "recovery", "lowmemory" ]
2323
cc = "1.0.28"
2424

2525
[dependencies]
26-
secp256k1-sys = "0.9.0"
26+
secp256k1-sys = "0.10.0"
2727

2828
[features]
2929
default = ["std"]
3030
recovery = ["secp256k1-sys/recovery"]
3131
lowmemory = ["secp256k1-sys/lowmemory"]
3232
std = []
33+
34+
[lints.rust]
35+
unexpected_cfgs = { level = "deny", check-cfg = [ "cfg(rust_secp_zkp_no_symbol_renaming)" ] }

secp256k1-zkp-sys/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ revision the default branch is pointing to.
2727

2828
## Linking to external symbols
2929

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

3434
## Minimum Supported Rust Version
3535

secp256k1-zkp-sys/build.rs

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ extern crate cc;
2626
use std::env;
2727

2828
fn main() {
29-
if cfg!(feature = "external-symbols") {
30-
println!("cargo:rustc-link-lib=static=secp256k1zkp");
31-
return;
32-
}
33-
3429
// Actual build
3530
let mut base_config = cc::Build::new();
3631
base_config

secp256k1-zkp-sys/src/error_callbacks.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use secp256k1_sys::types::{c_char, c_void};
99

1010
#[no_mangle]
11-
#[cfg(not(feature = "external-symbols"))]
11+
#[cfg(not(rust_secp_zkp_no_symbol_renaming))]
1212
pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn(
1313
_: *const c_char,
1414
_data: *mut c_void,
@@ -17,7 +17,7 @@ pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn(
1717
}
1818

1919
#[no_mangle]
20-
#[cfg(not(feature = "external-symbols"))]
20+
#[cfg(not(rust_secp_zkp_no_symbol_renaming))]
2121
pub unsafe extern "C" fn rustsecp256k1zkp_v0_8_0_default_error_callback_fn(
2222
_: *const c_char,
2323
_data: *mut c_void,

secp256k1-zkp-sys/src/zkp.rs

+27-27
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub const WHITELIST_MAX_N_KEYS: size_t = 255;
1313

1414
extern "C" {
1515
#[cfg_attr(
16-
not(feature = "external-symbols"),
16+
not(rust_secp_zkp_no_symbol_renaming),
1717
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_commitment_parse"
1818
)]
1919
// Parse a 33-byte commitment into 64 byte internal commitment object
@@ -24,7 +24,7 @@ extern "C" {
2424
) -> c_int;
2525

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

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

5151
#[cfg_attr(
52-
not(feature = "external-symbols"),
52+
not(rust_secp_zkp_no_symbol_renaming),
5353
link_name = "rustsecp256k1zkp_v0_8_0_pedersen_blind_generator_blind_sum"
5454
)]
5555
/// Sets the final Pedersen blinding factor correctly when the generators themselves
@@ -91,7 +91,7 @@ extern "C" {
9191
) -> c_int;
9292

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

107107
#[cfg(feature = "std")]
108108
#[cfg_attr(
109-
not(feature = "external-symbols"),
109+
not(rust_secp_zkp_no_symbol_renaming),
110110
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_info"
111111
)]
112112
pub fn secp256k1_rangeproof_info(
@@ -121,7 +121,7 @@ extern "C" {
121121

122122
#[cfg(feature = "std")]
123123
#[cfg_attr(
124-
not(feature = "external-symbols"),
124+
not(rust_secp_zkp_no_symbol_renaming),
125125
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_rewind"
126126
)]
127127
pub fn secp256k1_rangeproof_rewind(
@@ -143,7 +143,7 @@ extern "C" {
143143

144144
#[cfg(feature = "std")]
145145
#[cfg_attr(
146-
not(feature = "external-symbols"),
146+
not(rust_secp_zkp_no_symbol_renaming),
147147
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_verify"
148148
)]
149149
pub fn secp256k1_rangeproof_verify(
@@ -160,7 +160,7 @@ extern "C" {
160160

161161
#[cfg(feature = "std")]
162162
#[cfg_attr(
163-
not(feature = "external-symbols"),
163+
not(rust_secp_zkp_no_symbol_renaming),
164164
link_name = "rustsecp256k1zkp_v0_8_0_rangeproof_sign"
165165
)]
166166
pub fn secp256k1_rangeproof_sign(
@@ -182,7 +182,7 @@ extern "C" {
182182
) -> c_int;
183183

184184
#[cfg_attr(
185-
not(feature = "external-symbols"),
185+
not(rust_secp_zkp_no_symbol_renaming),
186186
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_initialize"
187187
)]
188188
pub fn secp256k1_surjectionproof_initialize(
@@ -198,7 +198,7 @@ extern "C" {
198198
) -> c_int;
199199

200200
#[cfg_attr(
201-
not(feature = "external-symbols"),
201+
not(rust_secp_zkp_no_symbol_renaming),
202202
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_serialize"
203203
)]
204204
pub fn secp256k1_surjectionproof_serialize(
@@ -209,7 +209,7 @@ extern "C" {
209209
) -> c_int;
210210

211211
#[cfg_attr(
212-
not(feature = "external-symbols"),
212+
not(rust_secp_zkp_no_symbol_renaming),
213213
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_serialized_size"
214214
)]
215215
pub fn secp256k1_surjectionproof_serialized_size(
@@ -218,7 +218,7 @@ extern "C" {
218218
) -> size_t;
219219

220220
#[cfg_attr(
221-
not(feature = "external-symbols"),
221+
not(rust_secp_zkp_no_symbol_renaming),
222222
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_parse"
223223
)]
224224
pub fn secp256k1_surjectionproof_parse(
@@ -229,7 +229,7 @@ extern "C" {
229229
) -> c_int;
230230

231231
#[cfg_attr(
232-
not(feature = "external-symbols"),
232+
not(rust_secp_zkp_no_symbol_renaming),
233233
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_generate"
234234
)]
235235
pub fn secp256k1_surjectionproof_generate(
@@ -244,7 +244,7 @@ extern "C" {
244244
) -> c_int;
245245

246246
#[cfg_attr(
247-
not(feature = "external-symbols"),
247+
not(rust_secp_zkp_no_symbol_renaming),
248248
link_name = "rustsecp256k1zkp_v0_8_0_surjectionproof_verify"
249249
)]
250250
pub fn secp256k1_surjectionproof_verify(
@@ -256,7 +256,7 @@ extern "C" {
256256
) -> c_int;
257257

258258
#[cfg_attr(
259-
not(feature = "external-symbols"),
259+
not(rust_secp_zkp_no_symbol_renaming),
260260
link_name = "rustsecp256k1zkp_v0_8_0_generator_generate_blinded"
261261
)]
262262
pub fn secp256k1_generator_generate_blinded(
@@ -267,7 +267,7 @@ extern "C" {
267267
) -> c_int;
268268

269269
#[cfg_attr(
270-
not(feature = "external-symbols"),
270+
not(rust_secp_zkp_no_symbol_renaming),
271271
link_name = "rustsecp256k1zkp_v0_8_0_generator_serialize"
272272
)]
273273
pub fn secp256k1_generator_serialize(
@@ -277,7 +277,7 @@ extern "C" {
277277
) -> c_int;
278278

279279
#[cfg_attr(
280-
not(feature = "external-symbols"),
280+
not(rust_secp_zkp_no_symbol_renaming),
281281
link_name = "rustsecp256k1zkp_v0_8_0_generator_parse"
282282
)]
283283
pub fn secp256k1_generator_parse(
@@ -287,13 +287,13 @@ extern "C" {
287287
) -> c_int;
288288

289289
#[cfg_attr(
290-
not(feature = "external-symbols"),
290+
not(rust_secp_zkp_no_symbol_renaming),
291291
link_name = "rustsecp256k1zkp_v0_8_0_nonce_function_ecdsa_adaptor"
292292
)]
293293
pub static secp256k1_nonce_function_ecdsa_adaptor: EcdsaAdaptorNonceFn;
294294

295295
#[cfg_attr(
296-
not(feature = "external-symbols"),
296+
not(rust_secp_zkp_no_symbol_renaming),
297297
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_encrypt"
298298
)]
299299
pub fn secp256k1_ecdsa_adaptor_encrypt(
@@ -307,7 +307,7 @@ extern "C" {
307307
) -> c_int;
308308

309309
#[cfg_attr(
310-
not(feature = "external-symbols"),
310+
not(rust_secp_zkp_no_symbol_renaming),
311311
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_verify"
312312
)]
313313
pub fn secp256k1_ecdsa_adaptor_verify(
@@ -319,7 +319,7 @@ extern "C" {
319319
) -> c_int;
320320

321321
#[cfg_attr(
322-
not(feature = "external-symbols"),
322+
not(rust_secp_zkp_no_symbol_renaming),
323323
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_decrypt"
324324
)]
325325
pub fn secp256k1_ecdsa_adaptor_decrypt(
@@ -330,7 +330,7 @@ extern "C" {
330330
) -> c_int;
331331

332332
#[cfg_attr(
333-
not(feature = "external-symbols"),
333+
not(rust_secp_zkp_no_symbol_renaming),
334334
link_name = "rustsecp256k1zkp_v0_8_0_ecdsa_adaptor_recover"
335335
)]
336336
pub fn secp256k1_ecdsa_adaptor_recover(
@@ -342,7 +342,7 @@ extern "C" {
342342
) -> c_int;
343343

344344
#[cfg_attr(
345-
not(feature = "external-symbols"),
345+
not(rust_secp_zkp_no_symbol_renaming),
346346
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_signature_parse"
347347
)]
348348
pub fn secp256k1_whitelist_signature_parse(
@@ -353,7 +353,7 @@ extern "C" {
353353
) -> c_int;
354354

355355
#[cfg_attr(
356-
not(feature = "external-symbols"),
356+
not(rust_secp_zkp_no_symbol_renaming),
357357
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_signature_serialize"
358358
)]
359359
pub fn secp256k1_whitelist_signature_serialize(
@@ -364,7 +364,7 @@ extern "C" {
364364
) -> c_int;
365365

366366
#[cfg_attr(
367-
not(feature = "external-symbols"),
367+
not(rust_secp_zkp_no_symbol_renaming),
368368
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_sign"
369369
)]
370370
pub fn secp256k1_whitelist_sign(
@@ -380,7 +380,7 @@ extern "C" {
380380
) -> c_int;
381381

382382
#[cfg_attr(
383-
not(feature = "external-symbols"),
383+
not(rust_secp_zkp_no_symbol_renaming),
384384
link_name = "rustsecp256k1zkp_v0_8_0_whitelist_verify"
385385
)]
386386
pub fn secp256k1_whitelist_verify(

0 commit comments

Comments
 (0)