Skip to content

Commit 6fa30ee

Browse files
committed
Squashed 'src/secp256k1/' changes from 4af241b320..ac59105026
ac59105026 ci: enable silentpayments module fc6c7f0abb tests: add BIP-352 test vectors 0a3e59b5d2 silentpayments: add benchmark for `scan_outputs` 6812e3f292 silentpayments: add examples/silentpayments.c c1eef5a0db silentpayments: add recipient light client support 2e8791ae2f silentpayments: add recipient scanning routine d7dff22516 silentpayments: add opaque data type `public_data` e29a4f3b74 silentpayments: add recipient label support b90c219944 silentpayments: add sender routine 81e6b8dcf6 silentpayments: implement output pubkey creation 7f7fb99f33 silentpayments: implement shared secret creation b0866a2912 silentpayments: add sortable recipient struct 01d6e461a5 doc: add module description for silentpayments b52dcb0bc5 build: add skeleton for new silentpayments (BIP352) module REVERT: 4af241b320 Merge bitcoin-core/secp256k1#1535: build: Replace hardcoded "auto" value with default one REVERT: f473c959f0 Merge bitcoin-core/secp256k1#1543: cmake: Do not modify build types when integrating by downstream project REVERT: d403eea484 Merge bitcoin-core/secp256k1#1546: cmake: Rename `SECP256K1_LATE_CFLAGS` and switch to Bitcoin Core's approach REVERT: d7ae25ce6f Merge bitcoin-core/secp256k1#1550: fix: typos in secp256k1.c REVERT: 0e2fadb20c fix: typos in secp256k1.c REVERT: 69b2192ad4 Merge bitcoin-core/secp256k1#1545: cmake: Do not set `CTEST_TEST_TARGET_ALIAS` REVERT: 5dd637f3cf Merge bitcoin-core/secp256k1#1548: README: mention ellswift module REVERT: 7454a53736 README: mention ellswift module REVERT: 4706be2cd0 cmake: Reimplement `SECP256K1_APPEND_CFLAGS` using Bitcoin Core approach REVERT: c2764dbb99 cmake: Rename `SECP256K1_LATE_CFLAGS` to `SECP256K1_APPEND_CFLAGS` REVERT: f87a3589f4 cmake: Do not set `CTEST_TEST_TARGET_ALIAS` REVERT: 158f9e5eae cmake: Do not modify build types when integrating by downstream project REVERT: 35c0fdc86b Merge bitcoin-core/secp256k1#1529: cmake: Fix cache issue when integrating by downstream project REVERT: 4392f0f717 Merge bitcoin-core/secp256k1#1533: tests: refactor: tidy up util functions (bitcoin#1491) REVERT: bedffd53d8 Merge bitcoin-core/secp256k1#1488: ci: Add native macOS arm64 job REVERT: 4b8d5eeacf Merge bitcoin-core/secp256k1#1532: cmake: Disable eager MSan in ctime_tests REVERT: f55703ba49 autotools: Delete unneeded compiler test REVERT: 396e885886 autotools: Align MSan checking code with CMake's implementation REVERT: abde59f52d cmake: Report more compiler details in summary REVERT: 7abf979a43 cmake: Disable `ctime_tests` if build with `-fsanitize=memory` REVERT: 4d9645bee0 cmake: Remove "AUTO" value of `SECP256K1_ECMULT_GEN_KB` option REVERT: a06805ee74 cmake: Remove "AUTO" value of `SECP256K1_ECMULT_WINDOW_SIZE` option REVERT: 26b94ee92a autotools: Remove "auto" value of `--with-ecmult-gen-kb` option REVERT: 122dbaeb37 autotools: Remove "auto" value of `--with-ecmult-window` option REVERT: e73f6f8fd9 tests: refactor: drop `secp256k1_` prefix from testrand.h functions REVERT: 0ee7453a99 tests: refactor: add `testutil_` prefix to testutil.h functions REVERT: 0c6bc76dcd tests: refactor: move `random_` helpers from tests.c to testutil.h REVERT: 0fef8479be tests: refactor: rename `random_field_element_magnitude` -> `random_fe_magnitude` REVERT: 59db007f0f tests: refactor: rename `random_group_element_...` -> `random_ge_...` REVERT: ec4c002faa cmake: Simplify `PROJECT_IS_TOP_LEVEL` emulation REVERT: cae9a7ad14 cmake: Do not set emulated PROJECT_IS_TOP_LEVEL as cache variable REVERT: 218f0cc93b ci: Add native macOS arm64 job git-subtree-dir: src/secp256k1 git-subtree-split: ac591050262d9d00b629943d598f62b47e1ca7ae
1 parent 1408944 commit 6fa30ee

34 files changed

+6771
-563
lines changed

.cirrus.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ env:
1010
MAKEFLAGS: -j4
1111
BUILD: check
1212
### secp256k1 config
13-
ECMULTWINDOW: 15
14-
ECMULTGENKB: 22
13+
ECMULTWINDOW: auto
14+
ECMULTGENKB: auto
1515
ASM: no
1616
WIDEMUL: auto
1717
WITH_VALGRIND: yes
@@ -22,6 +22,7 @@ env:
2222
RECOVERY: no
2323
SCHNORRSIG: no
2424
ELLSWIFT: no
25+
SILENTPAYMENTS: no
2526
### test options
2627
SECP256K1_TEST_ITERS:
2728
BENCH: yes
@@ -68,6 +69,7 @@ task:
6869
RECOVERY: yes
6970
SCHNORRSIG: yes
7071
ELLSWIFT: yes
72+
SILENTPAYMENTS: yes
7173
matrix:
7274
# Currently only gcc-snapshot, the other compilers are tested on GHA with QEMU
7375
- env: { CC: 'gcc-snapshot' }
@@ -84,6 +86,7 @@ task:
8486
RECOVERY: yes
8587
SCHNORRSIG: yes
8688
ELLSWIFT: yes
89+
SILENTPAYMENTS: yes
8790
WRAPPER_CMD: 'valgrind --error-exitcode=42'
8891
SECP256K1_TEST_ITERS: 2
8992
matrix:

.github/workflows/ci.yml

+26-71
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ env:
2121
MAKEFLAGS: '-j4'
2222
BUILD: 'check'
2323
### secp256k1 config
24-
ECMULTWINDOW: 15
25-
ECMULTGENKB: 22
24+
ECMULTWINDOW: 'auto'
25+
ECMULTGENKB: 'auto'
2626
ASM: 'no'
2727
WIDEMUL: 'auto'
2828
WITH_VALGRIND: 'yes'
@@ -33,6 +33,7 @@ env:
3333
RECOVERY: 'no'
3434
SCHNORRSIG: 'no'
3535
ELLSWIFT: 'no'
36+
SILENTPAYMENTS: 'no'
3637
### test options
3738
SECP256K1_TEST_ITERS:
3839
BENCH: 'yes'
@@ -71,18 +72,18 @@ jobs:
7172
matrix:
7273
configuration:
7374
- env_vars: { WIDEMUL: 'int64', RECOVERY: 'yes' }
74-
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
75+
- env_vars: { WIDEMUL: 'int64', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
7576
- env_vars: { WIDEMUL: 'int128' }
7677
- env_vars: { WIDEMUL: 'int128_struct', ELLSWIFT: 'yes' }
7778
- env_vars: { WIDEMUL: 'int128', RECOVERY: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
78-
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes' }
79+
- env_vars: { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', SILENTPAYMENTS: 'yes' }
7980
- env_vars: { WIDEMUL: 'int128', ASM: 'x86_64', ELLSWIFT: 'yes' }
8081
- env_vars: { RECOVERY: 'yes', SCHNORRSIG: 'yes' }
81-
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', CPPFLAGS: '-DVERIFY' }
82+
- env_vars: { CTIMETESTS: 'no', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', SILENTPAYMENTS: 'yes', CPPFLAGS: '-DVERIFY' }
8283
- env_vars: { BUILD: 'distcheck', WITH_VALGRIND: 'no', CTIMETESTS: 'no', BENCH: 'no' }
8384
- env_vars: { CPPFLAGS: '-DDETERMINISTIC' }
8485
- env_vars: { CFLAGS: '-O0', CTIMETESTS: 'no' }
85-
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
86+
- env_vars: { CFLAGS: '-O1', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
8687
- env_vars: { ECMULTGENKB: 2, ECMULTWINDOW: 2 }
8788
- env_vars: { ECMULTGENKB: 86, ECMULTWINDOW: 4 }
8889
cc:
@@ -141,6 +142,7 @@ jobs:
141142
RECOVERY: 'yes'
142143
SCHNORRSIG: 'yes'
143144
ELLSWIFT: 'yes'
145+
SILENTPAYMENTS: 'yes'
144146
CC: ${{ matrix.cc }}
145147

146148
steps:
@@ -185,6 +187,7 @@ jobs:
185187
RECOVERY: 'yes'
186188
SCHNORRSIG: 'yes'
187189
ELLSWIFT: 'yes'
190+
SILENTPAYMENTS: 'yes'
188191
CTIMETESTS: 'no'
189192

190193
steps:
@@ -236,6 +239,7 @@ jobs:
236239
RECOVERY: 'yes'
237240
SCHNORRSIG: 'yes'
238241
ELLSWIFT: 'yes'
242+
SILENTPAYMENTS: 'yes'
239243
CTIMETESTS: 'no'
240244

241245
steps:
@@ -281,6 +285,7 @@ jobs:
281285
RECOVERY: 'yes'
282286
SCHNORRSIG: 'yes'
283287
ELLSWIFT: 'yes'
288+
SILENTPAYMENTS: 'yes'
284289
CTIMETESTS: 'no'
285290

286291
strategy:
@@ -336,6 +341,7 @@ jobs:
336341
RECOVERY: 'yes'
337342
SCHNORRSIG: 'yes'
338343
ELLSWIFT: 'yes'
344+
SILENTPAYMENTS: 'yes'
339345
CTIMETESTS: 'no'
340346

341347
steps:
@@ -388,6 +394,7 @@ jobs:
388394
RECOVERY: 'yes'
389395
SCHNORRSIG: 'yes'
390396
ELLSWIFT: 'yes'
397+
SILENTPAYMENTS: 'yes'
391398
CTIMETESTS: 'no'
392399
SECP256K1_TEST_ITERS: 2
393400

@@ -439,6 +446,7 @@ jobs:
439446
RECOVERY: 'yes'
440447
SCHNORRSIG: 'yes'
441448
ELLSWIFT: 'yes'
449+
SILENTPAYMENTS: 'yes'
442450
CTIMETESTS: 'no'
443451
CFLAGS: '-fsanitize=undefined,address -g'
444452
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
@@ -503,6 +511,7 @@ jobs:
503511
RECOVERY: 'yes'
504512
SCHNORRSIG: 'yes'
505513
ELLSWIFT: 'yes'
514+
SILENTPAYMENTS: 'yes'
506515
CC: 'clang'
507516
SECP256K1_TEST_ITERS: 32
508517
ASM: 'no'
@@ -549,6 +558,7 @@ jobs:
549558
RECOVERY: 'yes'
550559
SCHNORRSIG: 'yes'
551560
ELLSWIFT: 'yes'
561+
SILENTPAYMENTS: 'yes'
552562
CTIMETESTS: 'no'
553563

554564
strategy:
@@ -591,10 +601,10 @@ jobs:
591601
run: env
592602
if: ${{ always() }}
593603

594-
x86_64-macos-native:
595-
name: "x86_64: macOS Monterey, Valgrind"
604+
macos-native:
605+
name: "x86_64: macOS Monterey"
596606
# See: https://github.com/actions/runner-images#available-images.
597-
runs-on: macos-12
607+
runs-on: macos-12 # Use M1 once available https://github.com/github/roadmap/issues/528
598608

599609
env:
600610
CC: 'clang'
@@ -605,14 +615,14 @@ jobs:
605615
fail-fast: false
606616
matrix:
607617
env_vars:
608-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
618+
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
609619
- { WIDEMUL: 'int128_struct', ECMULTGENKB: 2, ECMULTWINDOW: 4 }
610-
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
620+
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
611621
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
612-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
613-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
614-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
615-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
622+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes' }
623+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc' }
624+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
625+
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', SILENTPAYMENTS: 'yes', CC: 'gcc', WRAPPER_CMD: 'valgrind --error-exitcode=42', SECP256K1_TEST_ITERS: 2 }
616626
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY', CTIMETESTS: 'no' }
617627
- BUILD: 'distcheck'
618628

@@ -650,62 +660,6 @@ jobs:
650660
run: env
651661
if: ${{ always() }}
652662

653-
arm64-macos-native:
654-
name: "ARM64: macOS Sonoma"
655-
# See: https://github.com/actions/runner-images#available-images.
656-
runs-on: macos-14
657-
658-
env:
659-
CC: 'clang'
660-
HOMEBREW_NO_AUTO_UPDATE: 1
661-
HOMEBREW_NO_INSTALL_CLEANUP: 1
662-
WITH_VALGRIND: 'no'
663-
CTIMETESTS: 'no'
664-
665-
strategy:
666-
fail-fast: false
667-
matrix:
668-
env_vars:
669-
- { WIDEMUL: 'int64', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
670-
- { WIDEMUL: 'int128_struct', ECMULTGENPRECISION: 2, ECMULTWINDOW: 4 }
671-
- { WIDEMUL: 'int128', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
672-
- { WIDEMUL: 'int128', RECOVERY: 'yes' }
673-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes' }
674-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CC: 'gcc' }
675-
- { WIDEMUL: 'int128', RECOVERY: 'yes', ECDH: 'yes', SCHNORRSIG: 'yes', ELLSWIFT: 'yes', CPPFLAGS: '-DVERIFY' }
676-
- BUILD: 'distcheck'
677-
678-
steps:
679-
- name: Checkout
680-
uses: actions/checkout@v4
681-
682-
- name: Install Homebrew packages
683-
run: |
684-
brew install automake libtool gcc
685-
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
686-
687-
- name: CI script
688-
env: ${{ matrix.env_vars }}
689-
run: ./ci/ci.sh
690-
691-
- run: cat tests.log || true
692-
if: ${{ always() }}
693-
- run: cat noverify_tests.log || true
694-
if: ${{ always() }}
695-
- run: cat exhaustive_tests.log || true
696-
if: ${{ always() }}
697-
- run: cat ctime_tests.log || true
698-
if: ${{ always() }}
699-
- run: cat bench.log || true
700-
if: ${{ always() }}
701-
- run: cat config.log || true
702-
if: ${{ always() }}
703-
- run: cat test_env.log || true
704-
if: ${{ always() }}
705-
- name: CI env
706-
run: env
707-
if: ${{ always() }}
708-
709663
win64-native:
710664
name: ${{ matrix.configuration.job_name }}
711665
# See: https://github.com/actions/runner-images#available-images.
@@ -780,6 +734,7 @@ jobs:
780734
RECOVERY: 'yes'
781735
SCHNORRSIG: 'yes'
782736
ELLSWIFT: 'yes'
737+
SILENTPAYMENTS: 'yes'
783738

784739
steps:
785740
- name: Checkout

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ctime_tests
1010
ecdh_example
1111
ecdsa_example
1212
schnorr_example
13+
silentpayments_example
1314
*.exe
1415
*.so
1516
*.a

0 commit comments

Comments
 (0)