Skip to content

Internal merge 1628#5

Closed
mllwchrry wants to merge 29 commits into
internal-merge-1479from
internal-merge-1628
Closed

Internal merge 1628#5
mllwchrry wants to merge 29 commits into
internal-merge-1479from
internal-merge-1628

Conversation

@mllwchrry

Copy link
Copy Markdown
Owner

No description provided.

real-or-random and others added 29 commits September 17, 2024 16:21
This change:
1. Collects build artifacts in dedicated locations.
2. Allows to run individual examples with a shared library on Windows.
3. Is compatible with Wine when testing cross-compiled Windows binaries
   on Linux.
4. Is compatible with integration the project into a larger project
   hierarchy.
In fact, before reaching this particular VERIFY_CHECK, we had already successfully passed through

    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */

ensuring that f is not -m.
ef7ff03 f can never equal -m (Russell O'Connor)

Pull request description:

  In fact, before reaching this particular VERIFY_CHECK, we had already successfully passed through

      VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */

  ensuring that f is not -m.

ACKs for top commit:
  sipa:
    ACK ef7ff03
  real-or-random:
    utACK ef7ff03

Tree-SHA512: a8a8dcbad4dff36b9c49e40e07b212312cbf915132aea008eab6ea61b35bddb6d7782229c2cc528fb404d05132482c602cad768414d76153bb425a3d23714fff
Co-Authored by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
… generation loop

cd4f84f Improve examples/documentation: remove key generation loops (cheapshot003)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK cd4f84f
  jonasnick:
    ACK cd4f84f

Tree-SHA512: 242ab99c36302b539fc95421142c3eec5ccfa2cf918989457886338febde45a33b1794e0f08e7a632747bc21cbf5c47b7361fd9a28b9a1c6dff7caecf7b31a9f
…seckey randomness in musig

5bab8f6 examples: make key generation doc consistent (Jonas Nick)
e890822 examples: do not retry generating seckey randomness in musig (Jonas Nick)
70b6be1 extrakeys: improve doc of keypair_create (don't suggest retry) (Jonas Nick)

Pull request description:

  Follow-up to #1570.

ACKs for top commit:
  real-or-random:
    utACK 5bab8f6
  theStack:
    ACK 5bab8f6

Tree-SHA512: f29ceda87b0017aa2a2324f23527467c777223c9f7cbe43d814bb1cebfc6f4453b7e11f48a6bc718ae05d7eb9227ceb074adf576e8bb8c28639b47931136ce0a
… locations

c232486 Revert "cmake: Set `ENVIRONMENT` property for examples on Windows" (Hennadii Stepanov)
26e4a7c cmake: Set top-level target output locations (Hennadii Stepanov)

Pull request description:

  While testing bitcoin-core/secp256k1#1551, I noticed that when cross-compiling a shared library with examples for Windows, the `ctest` fails to run examples with Wine. Adjusting the `PATH` variable in https://github.com/bitcoin-core/secp256k1/blob/4af241b32099067464e015fa66daac5096206dea/examples/CMakeLists.txt#L16-L18 does not help because `WINEPATH` is expected.

  Another issue with the current implementation is that the examples cannot run individually on Windows.

  This PR resolves both issues by reverting the implementation from bitcoin-core/secp256k1#1290 in favour of the reworked and improved implementation from bitcoin-core/secp256k1#1233.

ACKs for top commit:
  theuni:
    Concept ACK and utACK c232486.
  real-or-random:
    utACK c232486

Tree-SHA512: 479b71d15d5d5670f6f69da3da599240c345711003383ca805c821b67065c9baaf269f987792cf1029211cdbfe799aecd401e6940a471539e3929b4a90e0781d
This change improves regex matching options when using `ctest` in
downstream projects.
The area marked as non-secret exceeds the nonce_pts array in the
second iteration of the for loop. Fix that by passing the correct
size to the _declassify call.
8be3839 Remove unused scratch space from API (Jonas Nick)

Pull request description:

  We had already merged this in #1305, but it was reverted before a release (#1311) because this change is not backwards compatible but at the time we only wanted to make a patch release in order to fix an actual issue.

  Due to the musig module, the next release will increment the version number from 0.5.x to 0.6.0, so it would be a good time to remove the scratch space from the API.

ACKs for top commit:
  sipa:
    utACK 8be3839
  real-or-random:
    utACK 8be3839

Tree-SHA512: ecd6bc1d925992f9df8e26820388fc436bbb6bc5f250950edf00406f006ca0df52ab8cd56a1b7541e57af0682ddadf6d34bd638b27557d301a5dff6c327a5ebc
…ol visibility on Windows

447334c include: Avoid visibility("default") on Windows (Tim Ruffing)

Pull request description:

  Fixes #1421. See code comments for rationale.

  Related meta-bug: #1181.  This reminds me that we should move forward with #1359.

ACKs for top commit:
  fanquake:
    ACK 447334c
  hebasto:
    ACK 447334c, tested on Ubuntu 24.04 using the following commands:
  theuni:
    ACK 447334c

Tree-SHA512: aaa47d88fd1b1f85c3e879a2b288c0eb3beebad0cc89e85f05d0b631f83e58d5a324fb441911970865eaa292f6820d03a1b516d6e8de37a87510e2082acc6e28
… range for generated nonce points

57eda3b musig: ctimetests: fix _declassify range for generated nonce points (Sebastian Falbesoner)

Pull request description:

  As noticed in bitcoin-core/secp256k1#1614 (comment), the area marked as non-secret exceeds the nonce_pts array in the second iteration of the for loop. Fix that by passing the correct size to the _declassify call.

ACKs for top commit:
  sipa:
    utACK 57eda3b
  real-or-random:
    utACK 57eda3b

Tree-SHA512: ff8074e3d1078d66a52d08c661997856ff586b3b4564a865a75212b32fafd7906d58885371bd63005007fde554ebcad121ab66125abe4331cf0aac63fc018ed0
The macOS 12 GHA image has been deprecated since 2024-10-07.
See: actions/runner-images#10721
096e3e2 ci: Update macOS image (Hennadii Stepanov)

Pull request description:

  The macOS 12 GHA image has been deprecated since 2024-10-07. See: actions/runner-images#10721.

  Draft for now as `./libtool --mode=execute valgrind --error-exitcode=42 ./ctime_tests` fails.

ACKs for top commit:
  real-or-random:
    ACK 096e3e2

Tree-SHA512: 715e7d2638bb7161c756d3856ee7eb6826f2300ab215deb888f040881c6b8cddc311c206f90dd942844ee2e56247e8ca99078a229e80ef086c2a4fdd8937af9d
We should anyway prefer to use the predefined macros from <inttypes.h>.

If I haven't missed anything, this removes the last OS-specific #if,
leaving us only with compiler-specific #if(def)s.
…matting macros

980c08d util: Remove unused (u)int64_t formatting macros (Tim Ruffing)

Pull request description:

  We should anyway prefer to use the predefined macros from <inttypes.h>.

  If I haven't missed anything, this removes the last OS-specific #if, leaving us only with compiler-specific #if(def)s.

ACKs for top commit:
  theStack:
    utACK 980c08d

Tree-SHA512: bcfc962618c6d0343c8231f9ea5ca23029b4e4946c4239cd9732933fe7065963d7c0ef2db60f72b76e0721865a61b8a9957b62398bb2d0b8f6bbc1d25461f1b3
…ix to test names

87384f5 cmake, test: Add `secp256k1_` prefix to test names (Hennadii Stepanov)

Pull request description:

  This PR improves regex matching options when using `ctest` in downstream projects, such as Bitcoin Core.

  For instance, a downstream project users can filter their tests like that:
  ```
  ctest --tests-regex "secp256k1"
  ```
  or
  ```
  ctest --exclude-regex "secp256k1"
  ```

  A `ctest` log with this PR:
  ```
  $ ctest --test-dir build -j 16
  Internal ctest changing into directory: /home/hebasto/git/secp256k1/secp256k1/build
  Test project /home/hebasto/git/secp256k1/secp256k1/build
      Start 1: secp256k1_noverify_tests
      Start 2: secp256k1_tests
      Start 3: secp256k1_exhaustive_tests
      Start 4: secp256k1_ecdsa_example
      Start 5: secp256k1_ecdh_example
      Start 6: secp256k1_schnorr_example
      Start 7: secp256k1_ellswift_example
      Start 8: secp256k1_musig_example
  1/8 Test #4: secp256k1_ecdsa_example ..........   Passed    0.00 sec
  2/8 Test #5: secp256k1_ecdh_example ...........   Passed    0.00 sec
  3/8 Test #6: secp256k1_schnorr_example ........   Passed    0.00 sec
  4/8 Test #7: secp256k1_ellswift_example .......   Passed    0.00 sec
  5/8 Test #8: secp256k1_musig_example ..........   Passed    0.00 sec
  6/8 Test #3: secp256k1_exhaustive_tests .......   Passed    6.19 sec
  7/8 Test #1: secp256k1_noverify_tests .........   Passed   38.83 sec
  8/8 Test #2: secp256k1_tests ..................   Passed   91.66 sec

  100% tests passed, 0 tests failed out of 8

  Total Test time (real) =  91.67 sec
  ```

ACKs for top commit:
  theuni:
    utACK 87384f5
  real-or-random:
    utACK 87384f5

Tree-SHA512: d8e46558cf58c9c660544b7bdfed24c991eb3e120b6511aa3968f509190130e498749a3c4dbabc87a7f22f0aa0056c6bcd3fc6c44f5eb131588945d593546840
The number of test iterations in the CI remains unchanged.

Additionally, the minimum iteration counts to enable the
`test_ecmult_constants_2bit` test is adjusted from 35 to 16, so it is
run by default.
…count to 16

0f73caf test, ci: Lower default iteration count to 16 (Hennadii Stepanov)

Pull request description:

  The number of test iterations in the CI remains the same.

  Resolves bitcoin-core/secp256k1#1561.

  ```
  $ ./build/src/tests
  test count = 16
  random seed = 59ea2b21267ec0ef0b4d13821292489f
  random run = 2936c044f82c7598a866869b9d954d42
  no problems found
  ```

ACKs for top commit:
  sipa:
    utACK 0f73caf
  jonasnick:
    ACK 0f73caf

Tree-SHA512: 84b265dc5d2780b3ea0a38f50ac8871d850ef2c97f33a0a5816baf20ac71c01db8b85696b343b089d7116d9cdb9450a6ca668229d95e54a39920d0e91a3127b3
694342f Name public API structs (Ava Chow)

Pull request description:

  Closes #1627

ACKs for top commit:
  real-or-random:
    utACK 694342f
  jonasnick:
    ACK 694342f

Tree-SHA512: 4e03d97e7c072fc7ddefe3f679878aa8a806f3f557a736c9a1b9137972798c953cb21b91491d65f7ba5d75d7119e3224ce60309a0ff93fcf9a64b57b4a426655
@mllwchrry mllwchrry deleted the branch internal-merge-1479 February 17, 2026 09:50
@mllwchrry mllwchrry closed this Feb 17, 2026
mllwchrry pushed a commit that referenced this pull request Mar 3, 2026
…to improve parallelism

8354618 cmake: Set `LABELS` property for tests (Hennadii Stepanov)
29f26ec cmake: Integrate DiscoverTests and normalize test names (Hennadii Stepanov)
f95b263 cmake: Add DiscoverTests module (Hennadii Stepanov)
4ac6511 cmake, refactor: Deduplicate test-related code (Hennadii Stepanov)

Pull request description:

  This PR implements the idea suggested in bitcoin-core/secp256k1#1734 (review) and is based on the work from bitcoin/bitcoin#33483.

  Here is an example of the `ctest` output:
  ```
  $ ctest --test-dir build -j $(nproc)
  Test project /home/hebasto/dev/secp256k1/secp256k1/build
          Start   1: secp256k1.noverify_tests.selftest_tests
          Start   2: secp256k1.noverify_tests.all_proper_context_tests
          Start   3: secp256k1.noverify_tests.all_static_context_tests
          Start   4: secp256k1.noverify_tests.deprecated_context_flags_test
  <snip>
  193/196 Test  #31: secp256k1.noverify_tests.ecmult_constants .........................   Passed    5.32 sec
  194/196 Test BlockstreamResearch#184: secp256k1.tests.ellswift_xdh_correctness_tests ....................   Passed    5.62 sec
  195/196 Test BlockstreamResearch#191: secp256k1.exhaustive_tests ........................................   Passed    6.97 sec
  196/196 Test BlockstreamResearch#126: secp256k1.tests.ecmult_constants ..................................   Passed    9.60 sec

  100% tests passed, 0 tests failed out of 196

  Label Time Summary:
  secp256k1_example           =   0.02 sec*proc (5 tests)
  secp256k1_exhaustive        =   6.97 sec*proc (1 test)
  secp256k1_noverify_tests    =  23.77 sec*proc (95 tests)
  secp256k1_tests             =  43.67 sec*proc (95 tests)

  Total Test time (real) =  10.21 sec
  ```

  For comparison, here is the output for the master branch on the same machine:
  ```
  $ ctest --test-dir build -j $(nproc)
  Test project /home/hebasto/dev/secp256k1/secp256k1/build
      Start 1: secp256k1_noverify_tests
      Start 2: secp256k1_tests
      Start 3: secp256k1_exhaustive_tests
      Start 4: secp256k1_ecdsa_example
      Start 5: secp256k1_ecdh_example
      Start 6: secp256k1_schnorr_example
      Start 7: secp256k1_ellswift_example
      Start 8: secp256k1_musig_example
  1/8 Test #4: secp256k1_ecdsa_example ..........   Passed    0.00 sec
  2/8 Test #5: secp256k1_ecdh_example ...........   Passed    0.00 sec
  3/8 Test #6: secp256k1_schnorr_example ........   Passed    0.00 sec
  4/8 Test #7: secp256k1_ellswift_example .......   Passed    0.00 sec
  5/8 Test #8: secp256k1_musig_example ..........   Passed    0.00 sec
  6/8 Test #3: secp256k1_exhaustive_tests .......   Passed    6.26 sec
  7/8 Test #1: secp256k1_noverify_tests .........   Passed   14.31 sec
  8/8 Test #2: secp256k1_tests ..................   Passed   31.65 sec

  100% tests passed, 0 tests failed out of 8

  Total Test time (real) =  31.65 sec
  ```

  ---

  **New Feature:** As the number of tests has grown, the _labels_ have been introduced to simplify test management. Now, one can run:
  ```
  $ ctest --test-dir build -j $(nproc) -L example
  Test project /home/hebasto/dev/secp256k1/secp256k1/build
      Start 192: secp256k1.example.ecdsa
      Start 193: secp256k1.example.ecdh
      Start 194: secp256k1.example.schnorr
      Start 195: secp256k1.example.ellswift
      Start 196: secp256k1.example.musig
  1/5 Test BlockstreamResearch#192: secp256k1.example.ecdsa ..........   Passed    0.00 sec
  2/5 Test BlockstreamResearch#193: secp256k1.example.ecdh ...........   Passed    0.00 sec
  3/5 Test BlockstreamResearch#194: secp256k1.example.schnorr ........   Passed    0.00 sec
  4/5 Test BlockstreamResearch#195: secp256k1.example.ellswift .......   Passed    0.00 sec
  5/5 Test BlockstreamResearch#196: secp256k1.example.musig ..........   Passed    0.00 sec

  100% tests passed, 0 tests failed out of 5

  Label Time Summary:
  secp256k1_example    =   0.01 sec*proc (5 tests)

  Total Test time (real) =   0.01 sec
  ```
  or
  ```
  $ ctest --test-dir build -j $(nproc) -LE tests
  Test project /home/hebasto/dev/secp256k1/secp256k1/build
      Start 192: secp256k1.example.ecdsa
      Start 193: secp256k1.example.ecdh
      Start 194: secp256k1.example.schnorr
      Start 195: secp256k1.example.ellswift
      Start 196: secp256k1.example.musig
      Start 191: secp256k1.exhaustive_tests
  1/6 Test BlockstreamResearch#192: secp256k1.example.ecdsa ..........   Passed    0.00 sec
  2/6 Test BlockstreamResearch#193: secp256k1.example.ecdh ...........   Passed    0.00 sec
  3/6 Test BlockstreamResearch#194: secp256k1.example.schnorr ........   Passed    0.00 sec
  4/6 Test BlockstreamResearch#195: secp256k1.example.ellswift .......   Passed    0.00 sec
  5/6 Test BlockstreamResearch#196: secp256k1.example.musig ..........   Passed    0.00 sec
  6/6 Test BlockstreamResearch#191: secp256k1.exhaustive_tests .......   Passed    6.19 sec

  100% tests passed, 0 tests failed out of 6

  Label Time Summary:
  secp256k1_example       =   0.01 sec*proc (5 tests)
  secp256k1_exhaustive    =   6.19 sec*proc (1 test)

  Total Test time (real) =   6.20 sec
  ```

ACKs for top commit:
  purpleKarrot:
    ACK 8354618
  furszy:
    Tested ACK 8354618

Tree-SHA512: 8c506ab08491aba4836b3058a8a09c929c6dd097c11e4e6f4deb20cf602285e73c3fd8a2c2040f7e92a058c7f8fc09752fa9de2ce80f7673adbdd505237ed262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants