Commit Graph

60 Commits

Author SHA1 Message Date
Tim Ruffing 0ecf318851 ci: Use remote pull/merge ref instead of local git merge
The merge strategy on the remote may be different than the local one.
This may cause local merges to be different or fail completely. Fix this
by using the result of the remote merge.

(copied from bitcoin/bitcoin@fad7281d78)
2023-01-27 22:38:45 +01:00
Pieter Wuille 0f088ec112 Rename CTIMETEST -> CTIMETESTS 2023-01-11 16:07:37 -05:00
Pieter Wuille 5e2e6fcfc0 Run ctime test in Linux MSan CI job 2023-01-11 16:07:37 -05:00
Pieter Wuille 5048be17e9 Rename valgrind_ctime_test -> ctime_tests 2023-01-11 16:07:37 -05:00
Tim Ruffing 203760023c tests: Add noverify_tests which is like tests but without VERIFY 2023-01-07 23:13:06 +01:00
Tim Ruffing 75d7b7f5ba
Merge bitcoin-core/secp256k1#1154: ci: set -u in cirrus.sh to treat unset variables as an error
7a74688201 ci: add missing CFLAGS & CPPFLAGS variable to print_environment (Jonas Nick)
c2e0fdadeb ci: set -u in cirrus.sh to treat unset variables as an error (Jonas Nick)

Pull request description:

  This PR is supposed to prevent accidental misuse of cirrus.sh. Maybe there is a way to check if `CC`, `AR` and `NM` are set within the loop that deals with the other variables, but so far I did not come up with one (that's POSIX shell compliant).

ACKs for top commit:
  real-or-random:
    ACK 7a74688201
  hebasto:
    re-ACK 7a74688201

Tree-SHA512: 91e42b3f1192fbf86e6fb43942713e78b2bee977ddd95256ea7448f84324369399d31ec4eedd47af595bf994bbc9396e26bb5c93bdb7f58c4310b5d3d5d66731
2022-12-19 14:57:55 +01:00
Jonas Nick c2e0fdadeb
ci: set -u in cirrus.sh to treat unset variables as an error 2022-12-19 13:22:18 +00:00
Pieter Wuille 7e5b22684f Don't use compute credits for now 2022-12-12 08:35:36 -05:00
Jonas Nick 751c4354d5
Merge bitcoin-core/secp256k1#1152: Update macOS image for CI
a8494b02bf Use compute credits for macOS jobs (Pieter Wuille)
c0ae48c995 Update macOS image for CI (Pieter Wuille)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK a8494b02bf
  jonasnick:
    ACK a8494b02bf

Tree-SHA512: af99585ef68fc8305785885efaf0a0ebe45e5765661d654523a36ba843fc83e0ac40a554638437fa53804e4aa42dbcd92d597702ee6225b66a044a6304bafd45
2022-11-24 21:53:02 +00:00
Pieter Wuille a8494b02bf Use compute credits for macOS jobs 2022-11-17 10:20:16 -05:00
Pieter Wuille c0ae48c995 Update macOS image for CI 2022-11-17 09:34:51 -05:00
Tim Ruffing 63ff064d2f int128: Add test override for testing __(u)mulh on MSVC X64
Also add a corresponding CI job
2022-11-17 09:28:30 -05:00
Jonas Nick 6138d73be4
Merge bitcoin-core/secp256k1#1155: Add MSan CI jobs
00a42b91b3 Add MSan CI job (Pieter Wuille)

Pull request description:

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

Tree-SHA512: 0b9ced572430e917041c916d8cda5c94996899a6e0a8c5a13f73f2c99b58b0098f7562cd758b48f18bec8c7095fab37980aa6dc2b139b2d1c293c965ea603686
2022-11-17 11:06:56 +00:00
Tim Ruffing ddf2b2910e
Merge bitcoin-core/secp256k1#1000: Synthetic int128 type.
a340d9500a ci: add int128_struct tests (Jonas Nick)
dceaa1f579 int128: Tidy #includes of int128.h and int128_impl.h (Tim Ruffing)
2914bccbc0 Simulated int128 type. (Russell O'Connor)

Pull request description:

  Abstracts the int128 type and provides an native version, if available, or a implements it using a pair of int64_t's.

  This is activated by setting the configuration flag `--with-test-override-wide-multiply=int128_struct`.

  The primary purpose of this PR is to take advantage of MSVC's [umulh](https://docs.microsoft.com/en-us/cpp/intrinsics/umulh?view=msvc-170) intrinsic that we can use to simulate an int128 type which MSVC does not have (AFAIU). This PR lays out the groundwork for this level of MSVC support, but doesn't include the configuration logic to enable it yet.

  For completeness, and implementation of `umulh` and `mulh` are also provided for compilers that support neither the intrinsic nor the int128 type (such as CompCert?).  This also opens up the possibility of removing the 32-bit field and scalar implementations should that ever be desired.

ACKs for top commit:
  sipa:
    ACK a340d9500a
  jonasnick:
    ACK a340d9500a

Tree-SHA512: b4f2853fa3ab60ce9d77b4eaee1fd20c4b612850e19fcb3179d7e36986f420c6c4589ff72f0cf844f989584ace49a1cd23cca3f4e405dabefc8da647a0df679d
2022-11-16 14:37:01 -05:00
Pieter Wuille 00a42b91b3 Add MSan CI job 2022-11-16 13:36:56 -05:00
Jonas Nick a340d9500a ci: add int128_struct tests 2022-11-07 16:55:43 -05:00
Jonas Nick 5c9f1a5c37
ci: always cat all logs_snippets 2022-11-07 20:12:33 +00:00
Jonas Nick cd47033335
Merge bitcoin-core/secp256k1#1084: ci: Add MSVC builds
49e2acd927 configure: Improve rationale for WERROR_CFLAGS (Tim Ruffing)
8dc4b03341 ci: Add a C++ job that compiles the public headers without -fpermissive (Tim Ruffing)
51f296a46c ci: Run persistent wineserver to speed up wine (Tim Ruffing)
3fb3269c22 ci: Add 32-bit MinGW64 build (Tim Ruffing)
9efc2e5221 ci: Add MSVC builds (Tim Ruffing)
2be6ba0fed configure: Convince autotools to work with MSVC's archiver lib.exe (Tim Ruffing)
bd81f4140a schnorrsig bench: Suppress a stupid warning in MSVC (Tim Ruffing)
09f3d71c51 configure: Add a few CFLAGS for MSVC (Tim Ruffing)
3b4f3d0d46 build: Reject C++ compilers in the preprocessor (Tim Ruffing)
1cc0941414 configure: Don't abort if the compiler does not define __STDC__ (Tim Ruffing)
cca8cbbac8 configure: Output message when checking for valgrind (Tim Ruffing)
1a6be5745f bench: Make benchmarks compile on MSVC (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 49e2acd927

Tree-SHA512: 986c498fb218231fff3519167d34a92e11dea6a4383788a9723be105c20578cd483c6b06ba5686c6669e3a02cfeebc29b8e5f1428552ebf4ec67fa7a86957548
2022-06-29 15:39:28 +00:00
Tim Ruffing 8dc4b03341 ci: Add a C++ job that compiles the public headers without -fpermissive 2022-06-29 11:05:40 +02:00
Tim Ruffing 3fb3269c22 ci: Add 32-bit MinGW64 build
This commit also raises the TEST_ITERS for wine tasks to the default.
The overhead of wine is negligible, so we can certainly afford the same
number of iterations as for native Linux tests.
2022-06-29 11:05:40 +02:00
Tim Ruffing 9efc2e5221 ci: Add MSVC builds
This adds MSVC builds built on Linux using wine. This requires some
settings of tools and flags because the autotools support for MSVC is
naturally somewhat limited.

The advantage of this approach is that it is compatible with our
existing CI scripts, so there's no need to write a Windows CI script
(in PowerShell or similar). If we want to test building and running on
Windows native (e.g., as supported by Cirrus CI) we could still do this
in the future.

Another advantage of this approach is that contributors can simply use
the docker image if they need a MSVC installation in a non-Windows
environment.

This commit also improves the Dockerfile by grouping RUN commands
according to Docker docs:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
2022-06-29 11:05:40 +02:00
Tim Ruffing 3b4f3d0d46 build: Reject C++ compilers in the preprocessor 2022-03-17 22:32:24 +01:00
Jonas Nick 80cf4eea5f build: stop treating schnorrsig, extrakeys modules as experimental 2022-03-17 14:14:08 +00:00
Jonas Nick 64b34979ed
Merge bitcoin-core/secp256k1#748: Add usage examples
7c9502cece Add a copy of the CC0 license to the examples (Elichai Turkel)
42e03432e6 Add usage examples to the readme (Elichai Turkel)
517644eab1 Optionally compile the examples in autotools, compile+run in travis (Elichai Turkel)
422a7cc86a Add a ecdh shared secret example (Elichai Turkel)
b0cfbcc143 Add a Schnorr signing and verifying example (Elichai Turkel)
fee7d4bf9e Add an ECDSA signing and verifying example (Elichai Turkel)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 7c9502cece
  jonasnick:
    ACK 7c9502cece

Tree-SHA512: c475cfd5b324b1e2d7126aa5bb1e7da25183b50adb7357d464c140de83d9097cb1bdc027d09aeadf167dbf9c8afd123235b0a1a742c5795089862418fafa1964
2022-02-23 17:37:58 +00:00
Elichai Turkel 517644eab1
Optionally compile the examples in autotools, compile+run in travis 2022-02-23 16:14:58 +02:00
Tim Ruffing e51ad3b737 ci: Retry `brew update` a few times to avoid random failures 2022-02-08 14:09:58 +01:00
Tim Ruffing b1cb969e8a ci: Revert "Attempt to make macOS builds more reliable"
This reverts commit d9396a56da, which
didn't have the desired effect.
2022-02-08 13:53:05 +01:00
Jonas Nick 59547943d6
Merge bitcoin-core/secp256k1#1072: ci: Attempt to make macOS builds more reliable
d9396a56da ci: Attempt to make macOS builds more reliable (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK d9396a56da

Tree-SHA512: 68df44107d74671de148e9c3e6dbc6b16bec937137d7d9771efce10f5d66459559b372346d05ecc23237b2e3af9479156f733219717cb93f5204f9ea5b2636a9
2022-02-06 19:30:14 +00:00
Tim Ruffing d8d54859ed ci: Run sage prover on CI 2022-02-04 15:37:32 +01:00
Tim Ruffing d9396a56da ci: Attempt to make macOS builds more reliable
The macOS CI tasks often error fail when doing `brew update` with
git fetch errors:
```
remote: fatal: packfile /data/repositories/b/nw/b6/07/5c/123272362/network.git/objects/pack/pack-2139bd07361b62a358e380a0e7d58ec35593d191.pack cannot be accessed
fatal: protocol error: bad pack header
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
```
Superficially this seems to be a problem on the GitHub server because
the message shows a "remote" error. But it seems we're the only one in
the world running into this specific issue when doing `brew update`, so
it's more likely that the something else is the culprit, and this error
message is just a symptom.

This commit replaces `brew update` with a complete reinstallation of
brew. This is essentially a shot in the dark but it's worth a try, and
I doubt it's significantly more expensive. If that won't work, we may
consider simply retrying `brew update` a few times.
2022-02-04 10:55:19 +01:00
Tim Ruffing b4ac1a1d5f ci: Run valgrind/memcheck tasks with 2 CPUs
... and increase the memory only for UBSan, ASan, LSan builds. Those are
the ones who need more memory.
2021-12-22 14:57:16 +01:00
Tim Ruffing e70acab601 ci: Use Cirrus "greedy" flag to use idle CPU time when available 2021-12-22 14:57:16 +01:00
Tim Ruffing d07e30176e ci: Update brew on macOS
The preinstalled brew is very old and tries to download prebuilt bottles
from a server which is no longer available. Because that will fail, brew
falls back to building our dependencies (e.g., autotools) from source,
which takes very long.

This commit makes sure that brew is updated before we start the build.

We also need to remove the `--shallow` argument from `brew tap`. It
doesn't exist in recent brew versions.
2021-12-22 14:56:49 +01:00
Tim Ruffing 22382f0ea0 ci: Test different ecmult window sizes 2021-12-22 14:56:27 +01:00
Tim Ruffing 26a022a3a0 ci: Remove STATICPRECOMPUTATION
This has been overlooked in #988.
2021-12-20 14:18:02 +01:00
Tim Ruffing 0559fc6e41
Merge bitcoin-core/secp256k1#988: Make signing table fully static
7dfceceea6 build: Remove #undef hack for ASM in the precomputation programs (Tim Ruffing)
bb36fe9be0 ci: Test `make precomp` (Tim Ruffing)
d94a37a20c build: Remove CC_FOR_BUILD stuff (Tim Ruffing)
ad63bb4c29 build: Prebuild and distribute ecmult_gen table (Tim Ruffing)
ac49361ed0 prealloc: Get rid of manual memory management for prealloc contexts (Tim Ruffing)
6573c08f65 ecmult_gen: Tidy precomputed file and save space (Tim Ruffing)
5eba83f17c ecmult_gen: Precompute tables for all values of ECMULT_GEN_PREC_BITS (Tim Ruffing)
fdb33dd122 refactor: Make PREC_BITS a parameter of ecmult_gen_build_prec_table (Tim Ruffing)
a4875e30a6 refactor: Move default callbacks to util.h (Tim Ruffing)
4c94c55bce doc: Remove obsolete hint for valgrind stack size (Tim Ruffing)
5106226991 exhaustive_tests: Fix with ecmult_gen table with custom generator (Tim Ruffing)
e1a76530db refactor: Make generator a parameter of ecmult_gen_create_prec_table (Tim Ruffing)
9ad09f6911 refactor: Rename program that generates static ecmult_gen table (Tim Ruffing)
8ae18f1ab3 refactor: Rename file that contains static ecmult_gen table (Tim Ruffing)
00d2fa116e ecmult_gen: Make code consistent with comment (Tim Ruffing)
3b0c2185ea ecmult_gen: Simplify ecmult_gen context after making table static (Tim Ruffing)
e43ba02cfc refactor: Decouple table generation and ecmult_gen context (Tim Ruffing)
22dc2c0a0d ecmult_gen: Move table creation to new file and force static prec (Tim Ruffing)

Pull request description:

  This resolves #893,  resolves #692 (and also resolves bitcoin/bitcoin#22854).

  - [x] Extract table generation to separate function in separate file (to be used by generation script and exhaustive tests)
  - [x] Tidy up
    - [x] Remove code that deals with non-static tables
    - [x] Make functions that need ecmult_gen not depend on signing context
    - [x] Rename stuff to make it fit the new structure and consistent with how we hande verification tables (#956)
  - [x] Fix exhaustive tests
    - [x] Make table generation function take generator as input
    - [x] Overwrite the static tables with a table with custom generator in exhaustive tests
  - [x] Overhaul script that generates table files
    - [x] Make table generation function take PREC_BITS as input (I have some code already, just not yet in this branch)
    - [x] Change generation script to generate three tables (for all three values of ECMULT_GEN_PREC_BITS)
  - [x] Ship pre-built tables
    - [x] Add pregenerated table file to repo
    - [x] Remove generation of table file from build process (like in #956)
    - [x] Remove left-over stuff (e.g., detecting a compiler running on the build machine) from build system
  - [x] Final cleanups (copyright headers, commit, messages, etc.)
  - [ ] (separate PR:) Make sure link-time optimization remove corresponding static tables (and code) when no signing/verifcation function is called
  - [ ] (separate PR:) Compile precomputation as a separate object file and link it (https://github.com/bitcoin-core/secp256k1/pull/988#issuecomment-977813538)
  - [ ] (separate PR:) Document the backwards-compatible API changes made in this PR and in #956.
    - [ ] Maybe deprecate the static context

ACKs for top commit:
  sipa:
    ACK 7dfceceea6
  robot-dreams:
    ACK 7dfceceea6 (based on range-diff between 56284c7d44c0ed46e636588bfbf6c403b7dfa6c1 and 7dfceceea6)

Tree-SHA512: 6efb3f36f05efe3b79bbd877881fe1409f71fd6488d24c811b2e77d9f053bed78670dd1dcbb42ad780458a51c4ffa36de9cd6567271b22041dc7a122ceb677c5
2021-12-15 11:06:47 +01:00
Tim Ruffing d94a37a20c build: Remove CC_FOR_BUILD stuff 2021-12-09 20:52:28 +01:00
Pieter Wuille 5eb519e1f6 ci: reduce TEST_ITERS in memcheck run 2021-12-05 11:54:05 -05:00
Tim Ruffing 6ad908aa00
Merge bitcoin-core/secp256k1#1008: bench.c: add `--help` option and ci: move env variables
592661c22f ci: move test environment variable declaration to .cirrus.yml (siv2r)
dcbe84b841 bench: add --help option to bench. (siv2r)

Pull request description:

  Fixes #1005

  **Changes:**
  - added `--help` option to `bench.c`
      - `help()` function prints the help to command-line
      - `have_invalid_args()` checks if the user has entered an invalid argument
  - moved `secp256k1_bench_iters` and `secp256k1_test_iters` environment variables declaration to `.cirrus.yml`

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

Tree-SHA512: ebc6a2e6e47b529212efa1c9b75cc79649fca7f42aa75ce46502db24ac94f46b6cef59c828d13265d1fa69187a81c140d1951e7daeb7c8e008a6c1ad75259741
2021-12-05 11:24:00 +01:00
siv2r 592661c22f ci: move test environment variable declaration to .cirrus.yml
environment var moved:
    1. SECP256K1_TEST_ITERS (replaces TEST_ITERS)
    2. SECP256K1_BENCH_ITERS (replaces BENCH_ITERS)
2021-12-04 22:47:40 +05:30
Tim Ruffing 72de1359e9 ci: Enable -g if we set CFLAGS manually
This enables sanitizers to output line numbers in stack traces.
2021-11-10 15:17:26 +01:00
Pieter Wuille bc08599e77 Remove OpenSSL testing support 2021-10-14 12:39:27 -04:00
Russell O'Connor 8de2d86a06 Bump memory limits in advance of making the ecmult context static. 2021-08-20 11:11:26 -04:00
Tim Ruffing 90e83449b2 ci: Add C++ test 2021-07-05 13:57:40 +02:00
Tim Ruffing 0302138f75 ci: Make compiler warning into errors on CI
This also tidies the list of environment variables in .cirrus.yml.
2021-07-01 20:37:40 +02:00
Tim Ruffing c58c4ea470 ci: Add ppc64le build 2021-06-08 17:03:53 +02:00
Tim Ruffing a35fdd3478 ci: Run PRs on merge result even for i686
This line should have been added in c7f754fe4d.

This mistake caused some i686 builds to fail when the PR was not
rebased, see https://cirrus-ci.com/build/5156197872435200.
2021-05-31 18:11:27 +02:00
Tim Ruffing 02dcea1ad9 ci: Make test iterations configurable and tweak for sanitizer builds 2021-05-21 20:48:07 +02:00
Tim Ruffing fcfcb97e74 ci: Simplify to use generic wrapper for QEMU, Valgrind, etc 2021-05-21 20:46:48 +02:00
Tim Ruffing de4157f13a ci: Run ASan/LSan and reorganize sanitizer and Valgrind jobs 2021-05-21 12:12:46 +02:00