Skip to content

Commit 8d1942f

Browse files
committed
Merge #64: Replace revendoring script; update to upstream 1d256089004a19bdbead7c5676e52c8e07b09fce
8e2d798 add CHANGELOG message; update CI MSRV so rust-secp will build (Andrew Poelstra) acd7758 Update to upstream 0.27.0 (Andrew Poelstra) 76db255 update to upstream 1d256089004a19bdbead7c5676e52c8e07b09fce (Andrew Poelstra) ceb92f4 secp256k1-zkp-sys: add new revendoring script (Andrew Poelstra) Pull request description: The first commit copies the new revendoring script from rust-secp; it can be verified by just diffing the two files. There are minimal changes. The other two commits are copies of #63 which can be verified using `git range-diff`. (The commit which updates upstream was actually created fresh using the new revendoring script; but the result is identical, as expected.) ACKs for top commit: sanket1729: ACK 8e2d798 Tree-SHA512: a8f8ef844be7269b15f2cc9f080661579e563d1169bc5fff416199105be418962555b95fbd756158d37eda6435f09a382979aab2bfeb577466376ef32246fab2
2 parents f2fd733 + 8e2d798 commit 8d1942f

File tree

177 files changed

+13423
-10343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+13423
-10343
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ jobs:
7171
strategy:
7272
matrix:
7373
rust:
74-
- 1.41.1
74+
- 1.48.0
7575
- beta
7676
- stable
7777
os: [ ubuntu-latest, macos-latest ]
7878
exclude:
79-
- rust: 1.41.1
79+
- rust: 1.48.0
8080
os: macos-latest
8181
runs-on: ${{ matrix.os }}
8282
steps:
@@ -103,12 +103,12 @@ jobs:
103103
strategy:
104104
matrix:
105105
rust:
106-
- 1.41.1
106+
- 1.48.0
107107
- beta
108108
- stable
109109
os: [ ubuntu-latest, macos-latest ]
110110
exclude:
111-
- rust: 1.41.1
111+
- rust: 1.48.0
112112
os: macos-latest
113113
runs-on: ${{ matrix.os }}
114114
steps:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Unreleased
22

3+
# 0.8.0 - 2023-04-13
4+
5+
- Increment MSRV to 1.48.0
6+
- Increment `secp256k1` dependency to 0.27.0
7+
- Update upstream to 1d256089004a19bdbead7c5676e52c8e07b09fce
8+
39
# 0.7.0 - 2022-09-27
410

511
- Increment MSRV to 1.41.1 and edition to 2018

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1-zkp"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
55
"Andrew Poelstra <[email protected]>",
66
"Lucas Soriano <[email protected]>",
@@ -31,10 +31,11 @@ use-serde = ["serde", "secp256k1/serde"]
3131
use-rand = ["rand", "secp256k1/rand"]
3232

3333
[dependencies]
34-
secp256k1 = "0.26.0"
35-
secp256k1-zkp-sys = { version = "0.7.0", default-features = false, path = "./secp256k1-zkp-sys" }
34+
secp256k1 = "0.27.0"
35+
secp256k1-zkp-sys = { version = "0.8.0", default-features = false, path = "./secp256k1-zkp-sys" }
3636
rand = { version = "0.8", default-features = false, optional = true }
3737
serde = { version = "1.0", default-features = false, optional = true }
38+
bitcoin-private = "0.1.0"
3839

3940
[dev-dependencies]
4041
rand = "0.8"

secp256k1-zkp-sys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1-zkp-sys"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
55
"Andrew Poelstra <[email protected]>",
66
"Steven Roose <[email protected]>",
@@ -13,7 +13,7 @@ description = "FFI for `libsecp256k1-zkp` library."
1313
keywords = [ "secp256k1", "libsecp256k1-zkp", "ffi" ]
1414
readme = "README.md"
1515
build = "build.rs"
16-
links = "rustsecp256k1zkp_v0_7_0"
16+
links = "rustsecp256k1zkp_v0_8_0"
1717

1818
# Should make docs.rs show all functions, even those behind non-default features
1919
[package.metadata.docs.rs]

secp256k1-zkp-sys/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@ This prefix ensures that no symbol collision can happen:
1818
To update the vendored sources, use the `vendor-libsecp.sh` script:
1919

2020
```
21-
$ ./vendor-libsecp.sh depend <version-code> <rev>
21+
$ ./vendor-libsecp.sh <rev>
2222
```
2323

24-
- Where `<version-code>` is the secp256k1-zkp-sys version number underscored: `0_1_2`.
25-
- Where `<rev>` is the git revision of libsecp256k1-zkp to checkout.
24+
Where `<rev>` is the git revision of libsecp256k1 to checkout. If you do not
25+
specify a revision, the script will simply clone the repo and use whatever
26+
revision the default branch is pointing to.
2627

2728
## Linking to external symbols
2829

2930
For the more exotic use cases, this crate can be used with existing libsecp256k1-zkp
3031
symbols by using the `external-symbols` feature. How to setup rustc to link
3132
against those existing symbols is left as an exercise to the reader.
33+
34+
## Minimum Supported Rust Version
35+
36+
This library should always compile with any combination of features on **Rust 1.48.0**.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# This file was automatically created by ./vendor-libsecp.sh
2-
d22774e248c703a191049b78f8d04f37d6fcfa05
1+
# This file was automatically created by vendor-libsecp.sh
2+
1d256089004a19bdbead7c5676e52c8e07b09fce

secp256k1-zkp-sys/depend/secp256k1/.cirrus.yml

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ env:
2323
WHITELIST: no
2424
MUSIG: no
2525
ECDSAADAPTOR: no
26+
BPPP: no
2627
### test options
2728
SECP256K1_TEST_ITERS:
2829
BENCH: yes
@@ -72,12 +73,12 @@ task:
7273
<< : *LINUX_CONTAINER
7374
matrix: &ENV_MATRIX
7475
- env: {WIDEMUL: int64, RECOVERY: yes}
75-
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
76+
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes}
7677
- env: {WIDEMUL: int128}
7778
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes}
78-
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
79+
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes}
7980
- env: {WIDEMUL: int128, ASM: x86_64}
80-
- env: { RECOVERY: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes}
81+
- env: { RECOVERY: yes, SCHNORRSIG: yes, EXPERIMENTAL: yes, ECDSA_S2C: yes, RANGEPROOF: yes, WHITELIST: yes, GENERATOR: yes, MUSIG: yes, ECDSAADAPTOR: yes, BPPP: yes}
8182
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
8283
- env: {CPPFLAGS: -DDETERMINISTIC}
8384
- env: {CFLAGS: -O0, CTIMETEST: no}
@@ -108,6 +109,7 @@ task:
108109
GENERATOR: yes
109110
MUSIG: yes
110111
ECDSAADAPTOR: yes
112+
BPPP: yes
111113
matrix:
112114
- env:
113115
CC: i686-linux-gnu-gcc
@@ -119,63 +121,29 @@ task:
119121
<< : *CAT_LOGS
120122

121123
task:
122-
name: "x86_64: macOS Catalina"
124+
name: "arm64: macOS Ventura"
123125
macos_instance:
124-
image: catalina-base
126+
image: ghcr.io/cirruslabs/macos-ventura-base:latest
125127
# tasks with valgrind enabled take about 90 minutes
126128
timeout_in: 120m
127129
env:
128130
HOMEBREW_NO_AUTO_UPDATE: 1
129131
HOMEBREW_NO_INSTALL_CLEANUP: 1
130-
# Cirrus gives us a fixed number of 12 virtual CPUs. Not that we even have that many jobs at the moment...
131-
MAKEFLAGS: -j13
132+
# Cirrus gives us a fixed number of 4 virtual CPUs. Not that we even have that many jobs at the moment...
133+
MAKEFLAGS: -j5
132134
matrix:
133135
<< : *ENV_MATRIX
136+
env:
137+
ASM: no
138+
WITH_VALGRIND: no
139+
CTIMETEST: no
134140
matrix:
135141
- env:
136-
CC: gcc-9
142+
CC: gcc
137143
- env:
138144
CC: clang
139-
# Update Command Line Tools
140-
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
141-
# See https://apple.stackexchange.com/a/195963 for the implementation.
142-
## update_clt_script:
143-
## - system_profiler SPSoftwareDataType
144-
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
145-
## - |-
146-
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
147-
## # For debugging
148-
## - softwareupdate -l && echo "PROD: $PROD"
149-
## - softwareupdate -i "$PROD" --verbose
150-
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
151-
##
152-
brew_valgrind_pre_script:
153-
# Retry a few times because this tends to fail randomly.
154-
- for i in {1..5}; do brew update && break || sleep 15; done
155-
- brew config
156-
- brew tap LouisBrunner/valgrind
157-
# Fetch valgrind source but don't build it yet.
158-
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
159-
brew_valgrind_cache:
160-
# This is $(brew --cellar valgrind) but command substition does not work here.
161-
folder: /usr/local/Cellar/valgrind
162-
# Rebuild cache if ...
163-
fingerprint_script:
164-
# ... macOS version changes:
165-
- sw_vers
166-
# ... brew changes:
167-
- brew config
168-
# ... valgrind changes:
169-
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
170-
populate_script:
171-
# If there's no hit in the cache, build and install valgrind.
172-
- brew install --HEAD LouisBrunner/valgrind/valgrind
173-
brew_valgrind_post_script:
174-
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
175-
# If we haven't restored from cached (and just run brew install), this is a no-op.
176-
- brew link valgrind
177145
brew_script:
178-
- brew install automake libtool gcc@9
146+
- brew install automake libtool gcc
179147
<< : *MERGE_BASE
180148
test_script:
181149
- ./ci/cirrus.sh
@@ -199,6 +167,7 @@ task:
199167
GENERATOR: yes
200168
MUSIG: yes
201169
ECDSAADAPTOR: yes
170+
BPPP: yes
202171
CTIMETEST: no
203172
<< : *MERGE_BASE
204173
test_script:
@@ -293,6 +262,7 @@ task:
293262
GENERATOR: yes
294263
MUSIG: yes
295264
ECDSAADAPTOR: yes
265+
BPPP: yes
296266
CTIMETEST: no
297267
matrix:
298268
- name: "Valgrind (memcheck)"

secp256k1-zkp-sys/depend/secp256k1/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
bench
2+
bench_bppp
23
bench_ecmult
34
bench_generator
45
bench_rangeproof
56
bench_internal
7+
bench_whitelist
68
tests
9+
example_musig
710
exhaustive_tests
811
precompute_ecmult_gen
912
precompute_ecmult
@@ -66,4 +69,4 @@ src/stamp-h1
6669
libsecp256k1.pc
6770
contrib/gh-pr-create.sh
6871

69-
musig_example
72+
musig_example

secp256k1-zkp-sys/depend/secp256k1/Makefile.am

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AM_CFLAGS = $(SECP_CFLAGS)
88

99
lib_LTLIBRARIES = libsecp256k1.la
1010
include_HEADERS = include/secp256k1.h
11-
include_HEADERS += include/rustsecp256k1zkp_v0_7_0_preallocated.h
11+
include_HEADERS += include/rustsecp256k1zkp_v0_8_0_preallocated.h
1212
noinst_HEADERS =
1313
noinst_HEADERS += src/scalar.h
1414
noinst_HEADERS += src/scalar_4x64.h
@@ -67,13 +67,13 @@ noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
6767
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
6868
noinst_HEADERS += examples/random.h
6969

70-
PRECOMPUTED_LIB = librustsecp256k1zkp_v0_7_0_precomputed.la
70+
PRECOMPUTED_LIB = librustsecp256k1zkp_v0_8_0_precomputed.la
7171
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
72-
librustsecp256k1zkp_v0_7_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
73-
librustsecp256k1zkp_v0_7_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
72+
librustsecp256k1zkp_v0_8_0_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
73+
librustsecp256k1zkp_v0_8_0_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
7474

7575
if USE_EXTERNAL_ASM
76-
COMMON_LIB = librustsecp256k1zkp_v0_7_0_common.la
76+
COMMON_LIB = librustsecp256k1zkp_v0_8_0_common.la
7777
else
7878
COMMON_LIB =
7979
endif
@@ -84,17 +84,17 @@ pkgconfig_DATA = libsecp256k1.pc
8484

8585
if USE_EXTERNAL_ASM
8686
if USE_ASM_ARM
87-
librustsecp256k1zkp_v0_7_0_common_la_SOURCES = src/asm/field_10x26_arm.s
87+
librustsecp256k1zkp_v0_8_0_common_la_SOURCES = src/asm/field_10x26_arm.s
8888
endif
8989
endif
9090

91-
librustsecp256k1zkp_v0_7_0_la_SOURCES = src/secp256k1.c
92-
librustsecp256k1zkp_v0_7_0_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
93-
librustsecp256k1zkp_v0_7_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
94-
librustsecp256k1zkp_v0_7_0_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
91+
librustsecp256k1zkp_v0_8_0_la_SOURCES = src/secp256k1.c
92+
librustsecp256k1zkp_v0_8_0_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
93+
librustsecp256k1zkp_v0_8_0_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
94+
librustsecp256k1zkp_v0_8_0_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
9595

9696
if VALGRIND_ENABLED
97-
librustsecp256k1zkp_v0_7_0_la_CPPFLAGS += -DVALGRIND
97+
librustsecp256k1zkp_v0_8_0_la_CPPFLAGS += -DVALGRIND
9898
endif
9999

100100
noinst_PROGRAMS =
@@ -226,6 +226,10 @@ clean-precomp:
226226

227227
EXTRA_DIST = autogen.sh SECURITY.md
228228

229+
if ENABLE_MODULE_BPPP
230+
include src/modules/bppp/Makefile.am.include
231+
endif
232+
229233
if ENABLE_MODULE_ECDH
230234
include src/modules/ecdh/Makefile.am.include
231235
endif

secp256k1-zkp-sys/depend/secp256k1/ci/cirrus.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ valgrind --version || true
1919
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
2020
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
2121
--enable-module-ecdsa-s2c="$ECDSA_S2C" \
22+
--enable-module-bppp="$BPPP" \
2223
--enable-module-rangeproof="$RANGEPROOF" --enable-module-whitelist="$WHITELIST" --enable-module-generator="$GENERATOR" \
2324
--enable-module-schnorrsig="$SCHNORRSIG" --enable-module-musig="$MUSIG" --enable-module-ecdsa-adaptor="$ECDSAADAPTOR" \
2425
--enable-module-schnorrsig="$SCHNORRSIG" \
@@ -51,6 +52,10 @@ then
5152
$EXEC ./bench_ecmult
5253
$EXEC ./bench_internal
5354
$EXEC ./bench
55+
if [ "$BPPP" = "yes" ]
56+
then
57+
$EXEC ./bench_bppp
58+
fi
5459
} >> bench.log 2>&1
5560
fi
5661

secp256k1-zkp-sys/depend/secp256k1/configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ AC_ARG_ENABLE(examples,
140140
AS_HELP_STRING([--enable-examples],[compile the examples [default=no]]), [],
141141
[SECP_SET_DEFAULT([enable_examples], [no], [yes])])
142142

143+
AC_ARG_ENABLE(module_bppp,
144+
AS_HELP_STRING([--enable-module-bppp],[enable Bulletproofs++ module (experimental)]),
145+
[],
146+
[SECP_SET_DEFAULT([enable_module_bppp], [no], [yes])])
147+
143148
AC_ARG_ENABLE(module_ecdh,
144149
AS_HELP_STRING([--enable-module-ecdh],[enable ECDH module [default=no]]), [],
145150
[SECP_SET_DEFAULT([enable_module_ecdh], [no], [yes])])
@@ -417,6 +422,11 @@ if test x"$enable_module_rangeproof" = x"yes"; then
417422
AC_DEFINE(ENABLE_MODULE_RANGEPROOF, 1, [Define this symbol to enable the Pedersen / zero knowledge range proof module])
418423
fi
419424

425+
if test x"$enable_module_bppp" = x"yes"; then
426+
enable_module_generator=yes
427+
AC_DEFINE(ENABLE_MODULE_BPPP, 1, [Define this symbol to enable the Bulletproofs++ module])
428+
fi
429+
420430
if test x"$enable_module_generator" = x"yes"; then
421431
AC_DEFINE(ENABLE_MODULE_GENERATOR, 1, [Define this symbol to enable the NUMS generator module])
422432
fi
@@ -460,6 +470,9 @@ else
460470
# module (which automatically enables the module dependencies) we want to
461471
# print an error for the dependent module, not the module dependency. Hence,
462472
# we first test dependent modules.
473+
if test x"$enable_module_bppp" = x"yes"; then
474+
AC_MSG_ERROR([Bulletproofs++ module is experimental. Use --enable-experimental to allow.])
475+
fi
463476
if test x"$enable_module_whitelist" = x"yes"; then
464477
AC_MSG_ERROR([Key whitelisting module is experimental. Use --enable-experimental to allow.])
465478
fi
@@ -502,6 +515,7 @@ AM_CONDITIONAL([USE_TESTS], [test x"$enable_tests" != x"no"])
502515
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$enable_exhaustive_tests" != x"no"])
503516
AM_CONDITIONAL([USE_EXAMPLES], [test x"$enable_examples" != x"no"])
504517
AM_CONDITIONAL([USE_BENCHMARK], [test x"$enable_benchmark" = x"yes"])
518+
AM_CONDITIONAL([ENABLE_MODULE_BPPP], [test x"$enable_module_bppp" = x"yes"])
505519
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
506520
AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
507521
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
@@ -541,6 +555,7 @@ echo " module whitelist = $enable_module_whitelist"
541555
echo " module musig = $enable_module_musig"
542556
echo " module ecdsa-s2c = $enable_module_ecdsa_s2c"
543557
echo " module ecdsa-adaptor = $enable_module_ecdsa_adaptor"
558+
echo " module bppp = $enable_module_bppp"
544559
echo
545560
echo " asm = $set_asm"
546561
echo " ecmult window size = $set_ecmult_window"

0 commit comments

Comments
 (0)