Skip to content

Commit 7a5f153

Browse files
Merge #333: Upstream PRs 1794, 1775, 1814, 1816, 1813, 1804, 1818, 1817, 1815, 1819, 1823, 1821, 1760, 1828, 1829, 1825, 1832, 1811
48cbd78 modules: Port bitcoin-core/secp256k1#1825 to zkp-specific code (mllwchrry) 126501f modules: Port bitcoin-core/secp256k1#1815 to zkp-specific code (mllwchrry) c49c9be bench: Update help functions in bench and bench_internal (kevkevinpal) 8d0eda0 testrand: Remove testrand_finish (Tim Ruffing) f48b1bf hash: add midstate initializer and use it for tagged hashes (w0xlt) 79e9f25 ci: Fix leftover use of old ECMULTGENPRECISION (Tim Ruffing) 76e92cf Revert "ci, docker: Fix LLVM repository signature failure" (Hennadii Stepanov) 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) b99a94c Add tests for bad scalar inputs in ellswift XDH (gzJx0DuTRHytnHe7P5RmMbPf3wKy2BztweVGXTf) 307b49f ellswift: fix overflow flag handling in secp256k1_ellswift_xdh (gzJx0DuTRHytnHe7P5RmMbPf3wKy2BztweVGXTf) ed02466 ci: Load Docker image by ID from builder step (Hennadii Stepanov) f47bbc0 test: add unit tests for secp256k1_scalar_check_overflow (Rohit Yadav) 97b3c47 refactor: remove unnecessary `malloc` result casts (Sebastian Falbesoner) 3ae72e7 ci: Disable Docker build summary generation (Hennadii Stepanov) 4fb7ccf ci: Enforce base-10 evaluation (Hennadii Stepanov) 1bc74a2 test: show both Autotools and CMake usage for ctime_tests (8144225309) 86cae58 build: Add `-Wleading-whitespace=spaces` compiler flag (Hennadii Stepanov) fb229e7 build: Add `-Wtrailing-whitespace=any` compiler flag (Hennadii Stepanov) 13e3bee refactor: Remove trailing whitespace (Hennadii Stepanov) 2ccff6e ci: Add weekly schedule (Hennadii Stepanov) 2f18567 ci: Rotate Docker cache keys every 4 weeks (Hennadii Stepanov) 0ffb174 ci, docker: Fix LLVM repository signature failure (Hennadii Stepanov) 0267b65 release process: mention the `[Unreleased]` link clearly (Jonas Nick) 748c0fd Add CMake build directory patterns to `.gitignore` (Hennadii Stepanov) 7eb86bd autotools: Rename `build-aux` to `autotools-aux` (Hennadii Stepanov) 47eb709 ecmult: Use size_t for array indices in _odd_multiplies_table (Tim Ruffing) bb1d199 ecmult: Use size_t for array indices into tables (Tim Ruffing) Pull request description: Merge bitcoin-core/secp256k1#1794: ecmult: Use size_t for array indices Merge bitcoin-core/secp256k1#1775: Add CMake build directory patterns to `.gitignore` Merge bitcoin-core/secp256k1#1814: release process: mention the `[Unreleased]` link clearly Merge bitcoin-core/secp256k1#1816: ci: Rotate Docker cache keys Merge bitcoin-core/secp256k1#1813: Remove trailing spaces and introduce `-Wtrailing-whitespace=any` compiler flag Merge bitcoin-core/secp256k1#1804: test: show both CMake and Autotools usage for ctime_tests Merge bitcoin-core/secp256k1#1818: ci: Enforce base-10 evaluation Merge bitcoin-core/secp256k1#1817: ci: Disable Docker build summary generation Merge bitcoin-core/secp256k1#1815: refactor: remove unnecessary `malloc` result casts Merge bitcoin-core/secp256k1#1819: tests: Improve secp256k1_scalar_check_overflow tests (Issue #1812) Merge bitcoin-core/secp256k1#1823: ci: Load Docker image by ID from builder step Merge bitcoin-core/secp256k1#1821: ellswift: fix overflow flag handling in secp256k1_ellswift_xdh Merge bitcoin-core/secp256k1#1760: cmake: Add dynamic test discovery to improve parallelism Merge bitcoin-core/secp256k1#1828: Revert "ci, docker: Fix LLVM repository signature failure" Merge bitcoin-core/secp256k1#1829: ci: Fix leftover use of old ECMULTGENPRECISION Merge bitcoin-core/secp256k1#1825: hash: remove redundant `secp256k1_sha256_initialize` in tagged hash midstate functions Merge bitcoin-core/secp256k1#1832: testrand: Remove testrand_finish Merge bitcoin-core/secp256k1#1811: bench: Update help functions in bench and bench_internal This PR can be recreated with `./contrib/sync-upstream.sh -b master range c0a2aba`. Tips: * Use `git show --remerge-diff <pr-branch>` to show the conflict resolution in the merge commit. * Use `git read-tree --reset -u <pr-branch>` to replay these resolutions during the conflict resolution stage when recreating the PR branch locally. Be aware that this may discard your index as well as the uncommitted changes and untracked files in your worktree. ACKs for top commit: real-or-random: ACK 48cbd78 Tree-SHA512: 1ea96bf3b7458c02bb472ca7423eb21defe6640ea58a993ac24603d6a8d44ac9bbeab7e2ca5f993918fa1388b9e69b308dcc67277afffd55cb833ecf07051c75
2 parents 459eab2 + 48cbd78 commit 7a5f153

46 files changed

Lines changed: 397 additions & 321 deletions

Some content is hidden

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

.github/actions/run-in-docker-action/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ inputs:
66
required: true
77
scope:
88
description: 'A cached image scope'
9-
required: false
10-
default: ${{ runner.arch }}
9+
required: true
1110
command:
1211
description: 'A command to run in a container'
1312
required: true
@@ -45,7 +44,7 @@ runs:
4544
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \
4645
--volume ${{ github.workspace }}:${{ github.workspace }} \
4746
--workdir ${{ github.workspace }} \
48-
$(docker images -q | head -n1) \
47+
${{ case(steps.main_builder.outcome == 'success', steps.main_builder.outputs.imageid, steps.retry_builder.outputs.imageid) }} \
4948
bash -c "
5049
git config --global --add safe.directory ${{ github.workspace }}
5150
${{ inputs.command }}

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- '**'
77
tags-ignore:
88
- '**'
9+
schedule:
10+
# Run on the default branch every Monday morning.
11+
# This also warms the Docker caches after key rotation.
12+
- cron: '22 2 * * 1'
913

1014
concurrency:
1115
group: ${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
@@ -50,11 +54,16 @@ env:
5054
SYMBOL_CHECK: 'yes'
5155
# Compile and run the examples.
5256
EXAMPLES: 'yes'
57+
# Disable Docker build summary generation.
58+
# See https://github.com/docker/build-push-action/blob/master/README.md#environment-variables.
59+
DOCKER_BUILD_SUMMARY: false
5360

5461
jobs:
5562
docker_cache:
5663
name: "Build ${{ matrix.arch }} Docker image"
5764
runs-on: ${{ matrix.runner }}
65+
outputs:
66+
cache_scope: ${{ steps.cache_timestamp.outputs.period }}
5867

5968
strategy:
6069
fail-fast: false
@@ -66,6 +75,10 @@ jobs:
6675
runner: ubuntu-24.04-arm
6776

6877
steps:
78+
- name: Get cache validity period
79+
id: cache_timestamp
80+
run: echo "period=$((10#$(date +%V) / 4))" >> "$GITHUB_OUTPUT"
81+
6982
- name: Set up Docker Buildx
7083
uses: docker/setup-buildx-action@v3
7184
with:
@@ -77,8 +90,8 @@ jobs:
7790
uses: docker/build-push-action@v6
7891
with:
7992
file: ./ci/linux-debian.Dockerfile
80-
cache-from: type=gha,scope=${{ runner.arch }}
81-
cache-to: type=gha,scope=${{ runner.arch }},mode=min
93+
cache-from: type=gha,scope=${{ runner.arch }}-${{ steps.cache_timestamp.outputs.period }}
94+
cache-to: type=gha,scope=${{ runner.arch }}-${{ steps.cache_timestamp.outputs.period }},mode=min
8295

8396
x86_64-debian:
8497
name: "x86_64: Linux (Debian stable)"
@@ -124,6 +137,7 @@ jobs:
124137
uses: ./.github/actions/run-in-docker-action
125138
with:
126139
dockerfile: ./ci/linux-debian.Dockerfile
140+
scope: ${{ runner.arch }}-${{ needs.docker_cache.outputs.cache_scope }}
127141
command: ./ci/ci.sh
128142

129143
- &PRINT_LOGS
@@ -723,6 +737,7 @@ jobs:
723737
uses: ./.github/actions/run-in-docker-action
724738
with:
725739
dockerfile: ./ci/linux-debian.Dockerfile
740+
scope: ${{ runner.arch }}-${{ needs.docker_cache.outputs.cache_scope }}
726741
command: |
727742
g++ -Werror include/*.h
728743
clang -Werror -x c++-header include/*.h

.gitignore

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,16 @@ coverage.*.html
4949
*.gcno
5050
*.gcov
5151

52-
build-aux/ar-lib
53-
build-aux/config.guess
54-
build-aux/config.sub
55-
build-aux/depcomp
56-
build-aux/install-sh
57-
build-aux/ltmain.sh
58-
build-aux/m4/libtool.m4
59-
build-aux/m4/lt~obsolete.m4
60-
build-aux/m4/ltoptions.m4
61-
build-aux/m4/ltsugar.m4
62-
build-aux/m4/ltversion.m4
63-
build-aux/missing
64-
build-aux/compile
65-
build-aux/test-driver
52+
/autotools-aux/
53+
!/autotools-aux/m4/bitcoin_secp.m4
54+
6655
libsecp256k1.pc
6756
contrib/gh-pr-create.sh
6857

6958
### CMake
7059
/CMakeUserPresets.json
71-
# Default CMake build directory.
72-
/build
60+
# CMake build directories.
61+
/*build*
7362

7463
### Python
7564
__pycache__/

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,15 @@ else()
225225
try_append_c_flags(-Wcast-align=strict) # GCC >= 8.0.
226226
try_append_c_flags(-Wconditional-uninitialized) # Clang >= 3.0 only.
227227
try_append_c_flags(-Wextra) # GCC >= 3.4, this is the newer name of -W, which we don't use because older GCCs will warn about unused functions.
228+
try_append_c_flags(-Wleading-whitespace=spaces) # GCC >= 15.0
228229
try_append_c_flags(-Wnested-externs)
229230
try_append_c_flags(-Wno-long-long) # GCC >= 3.0, -Wlong-long is implied by -pedantic.
230231
try_append_c_flags(-Wno-overlength-strings) # GCC >= 4.2, -Woverlength-strings is implied by -pedantic.
231232
try_append_c_flags(-Wno-unused-function) # GCC >= 3.0, -Wunused-function is implied by -Wall.
232233
try_append_c_flags(-Wreserved-identifier) # Clang >= 13.0 only.
233234
try_append_c_flags(-Wshadow)
234235
try_append_c_flags(-Wstrict-prototypes)
236+
try_append_c_flags(-Wtrailing-whitespace=any) # GCC >= 15.0
235237
try_append_c_flags(-Wundef)
236238
endif()
237239

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ACLOCAL_AMFLAGS = -I build-aux/m4
1+
ACLOCAL_AMFLAGS = -I autotools-aux/m4
22

33
# AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
44
# which does not have an explicit foo_CFLAGS variable set.

cmake/DiscoverTests.cmake

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# TODO: rework/remove once test discovery is implemented upstream:
2+
# https://gitlab.kitware.com/cmake/cmake/-/issues/26920
3+
function(discover_tests target)
4+
set(options "")
5+
set(oneValueArgs DISCOVERY_MATCH TEST_NAME_REPLACEMENT TEST_ARGS_REPLACEMENT)
6+
set(multiValueArgs DISCOVERY_ARGS PROPERTIES)
7+
cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${oneValueArgs}" "${multiValueArgs}")
8+
9+
set(file_base ${CMAKE_CURRENT_BINARY_DIR}/${target})
10+
set(include_file ${file_base}_include.cmake)
11+
12+
set(properties_content)
13+
list(LENGTH arg_PROPERTIES properties_len)
14+
if(properties_len GREATER "0")
15+
set(properties_content " set_tests_properties(\"\${test_name}\" PROPERTIES\n")
16+
math(EXPR num_properties "${properties_len} / 2")
17+
foreach(i RANGE 0 ${num_properties} 2)
18+
math(EXPR value_index "${i} + 1")
19+
list(GET arg_PROPERTIES ${i} name)
20+
list(GET arg_PROPERTIES ${value_index} value)
21+
string(APPEND properties_content " \"${name}\" \"${value}\"\n")
22+
endforeach()
23+
string(APPEND properties_content " )\n")
24+
endif()
25+
26+
string(CONCAT include_content
27+
"set(runner [[$<TARGET_FILE:${target}>]])\n"
28+
"set(launcher [[$<TARGET_PROPERTY:${target},TEST_LAUNCHER>]])\n"
29+
"set(emulator [[$<$<BOOL:${CMAKE_CROSSCOMPILING}>:$<TARGET_PROPERTY:${target},CROSSCOMPILING_EMULATOR>>]])\n"
30+
"\n"
31+
"execute_process(\n"
32+
" COMMAND \${launcher} \${emulator} \${runner} ${arg_DISCOVERY_ARGS}\n"
33+
" OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE\n"
34+
" ERROR_VARIABLE output ERROR_STRIP_TRAILING_WHITESPACE\n"
35+
" RESULT_VARIABLE result\n"
36+
")\n"
37+
"\n"
38+
"if(NOT result EQUAL 0)\n"
39+
" add_test([[${target}_DISCOVERY_FAILURE]] \${launcher} \${emulator} \${runner} ${arg_DISCOVERY_ARGS})\n"
40+
"else()\n"
41+
" string(REPLACE \"\\n\" \";\" lines \"\${output}\")\n"
42+
" foreach(line IN LISTS lines)\n"
43+
" if(line MATCHES \"${arg_DISCOVERY_MATCH}\")\n"
44+
" string(REGEX REPLACE \"${arg_DISCOVERY_MATCH}\" \"${arg_TEST_NAME_REPLACEMENT}\" test_name \"\${line}\")\n"
45+
" string(REGEX REPLACE \"${arg_DISCOVERY_MATCH}\" \"${arg_TEST_ARGS_REPLACEMENT}\" test_args \"\${line}\")\n"
46+
" separate_arguments(test_args)\n"
47+
" add_test(\"\${test_name}\" \${launcher} \${emulator} \${runner} \${test_args})\n"
48+
${properties_content}
49+
" endif()\n"
50+
" endforeach()\n"
51+
"endif()\n"
52+
)
53+
54+
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
55+
if(is_multi_config)
56+
file(GENERATE
57+
OUTPUT ${file_base}_include-$<CONFIG>.cmake
58+
CONTENT "${include_content}"
59+
)
60+
file(WRITE ${include_file}
61+
"include(\"${file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")"
62+
)
63+
else()
64+
file(GENERATE
65+
OUTPUT ${include_file}
66+
CONTENT "${include_content}"
67+
)
68+
endif()
69+
70+
set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES ${include_file})
71+
endfunction()

configure.ac

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ define(_LIB_VERSION_AGE, 0)
1919

2020
AC_INIT([libsecp256k1],m4_join([.], _PKG_VERSION_MAJOR, _PKG_VERSION_MINOR, _PKG_VERSION_PATCH)m4_if(_PKG_VERSION_IS_RELEASE, [true], [], [-dev]),[https://github.com/bitcoin-core/secp256k1/issues],[libsecp256k1],[https://github.com/bitcoin-core/secp256k1])
2121

22-
AC_CONFIG_AUX_DIR([build-aux])
23-
AC_CONFIG_MACRO_DIR([build-aux/m4])
22+
AC_CONFIG_AUX_DIR([autotools-aux])
23+
AC_CONFIG_MACRO_DIR([autotools-aux/m4])
2424
AC_CANONICAL_HOST
2525

2626
# Require Automake 1.11.2 for AM_PROG_AR
@@ -111,6 +111,8 @@ AC_DEFUN([SECP_TRY_APPEND_DEFAULT_CFLAGS], [
111111
SECP_TRY_APPEND_CFLAGS([-Wcast-align=strict], $1) # GCC >= 8.0
112112
SECP_TRY_APPEND_CFLAGS([-Wconditional-uninitialized], $1) # Clang >= 3.0 only
113113
SECP_TRY_APPEND_CFLAGS([-Wreserved-identifier], $1) # Clang >= 13.0 only
114+
SECP_TRY_APPEND_CFLAGS([-Wtrailing-whitespace=any], $1) # GCC >= 15.0
115+
SECP_TRY_APPEND_CFLAGS([-Wleading-whitespace=spaces], $1) # GCC >= 15.0
114116
115117
CFLAGS="$SECP_TRY_APPEND_DEFAULT_CFLAGS_saved_CFLAGS"
116118
fi

doc/release-process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Perform these checks when reviewing the release PR (see below):
6161
4. Open a PR to the master branch with a commit (using message `"release cleanup: bump version after $MAJOR.$MINOR.$PATCH"`, for example) that
6262
* sets `_PKG_VERSION_IS_RELEASE` to `false` and increments `_PKG_VERSION_PATCH` and `_LIB_VERSION_REVISION` in `configure.ac`,
6363
* increments the `$PATCH` component of `project(libsecp256k1 VERSION ...)` and `${PROJECT_NAME}_LIB_VERSION_REVISION` in `CMakeLists.txt`, and
64-
* adds an `[Unreleased]` section header to the [CHANGELOG.md](../CHANGELOG.md).
64+
* adds an `[Unreleased]` section header and a corresponding `[Unreleased]` link at the bottom of [CHANGELOG.md](../CHANGELOG.md).
6565

6666
If other maintainers are not present to approve the PR, it can be merged without ACKs.
6767
5. Create a new GitHub release with a link to the corresponding entry in [CHANGELOG.md](../CHANGELOG.md).

examples/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ function(add_example name)
88
secp256k1
99
$<$<PLATFORM_ID:Windows>:bcrypt>
1010
)
11-
set(test_name ${name}_example)
12-
add_test(NAME secp256k1_${test_name} COMMAND ${target_name})
11+
add_test(NAME secp256k1.example.${name} COMMAND ${target_name})
12+
set_tests_properties(secp256k1.example.${name} PROPERTIES
13+
LABELS secp256k1_example
14+
)
1315
endfunction()
1416

1517
add_example(ecdsa)

0 commit comments

Comments
 (0)