forked from bitcoin-core/secp256k1
-
Notifications
You must be signed in to change notification settings - Fork 1
Debug ci #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- `schnorrsig_batch_context_create` - `schnorrsig_batch_context_destroy` - simple test that calls both create and destroy (failing)
destroying the scratch space when its alloc_size > 0 leads to an error
secp256k1_context obj is used for its error_callback function
In future, batch_context_create and batch_context_destroy will be moved to src/ directory. Only batch_context_add_*, batch_context_verify will be present in the schnorrsig module
batch_context_create and batch_context_destroy function are compiled by default. src/batch_impl: contains create and destroy function definition. This implementation is very similar to src/scratch_impl.h
added initial example where the batch context is created and destroyed.
added batch_context_verify to the schnorrsig module
batch_ctx->rounds keeps track of number of times the scratch space was erased by batch_add_* function. This occurs when user's inputs exceed batch object capacity (specified during creation).
This func will be update to include the following: [ ] randomizer generation (currently assume to be 1) [ ] run transparent verification if batch object is full
…orrsig batch_context_verify: - moved this API from module/schnorrsig/main_impl.h to secp256k1.c - hence this API will be available even if the user doesn't enable schnorrsig module batch_context_add_schnorrsig: - moved this API from module/schnorrsig/main_impl.h to module/schnorrsig/batch_add_impl.h - required since this api needs the `schnorrsig_challenge` func defined in schnorrsig/main_impl.h - hence batch_impl.h will be included after schnorrsig/main_impl.h in the secp256k1.c file
for each term added by the user, twice the number of points (and scalars) will be added to the scratch space. One term (schnorrsig or tweak) contains: - R, P for schnorrsig - Q, P for tweak check
…ignment currently the code uses `scalar_cmov` to set a scalar to the scratch space. This can be done using `batch_ctx->scalars[i] = ai` instead since we are not required to use constant function during verification
…on scratch let's use the following notation: - len(user_terms) = number of terms added by the user to the batch object - len(scratch_terms) = number of points (or scalars) present on batch objects's scratch space Previously `batch_ctx->len` was used to represent `len(user_terms)` since I assumed that `len(scratch_terms) = 2 * len(user_terms)` is always true. - if user adds schnorrsig, R and P will be added to scratch - if user adds tweak checks, Q and P will be added to scratch This approach will fail if the batch objects is required to verify `e*P ?= s*G`. In this case, `len(scratch_term) = len(user_term)` since only P will be added to batch objects scratch space
`rounds` was used to track the number of times the scratch space was cleared by batch_context_add_* for transparent verification. It will also tell the number of terms the user entered (rounds*capacity + len). Keeping track of this data was not worth it since the user could always have a counter to for total number of terms entered. It also made the `batch_verify` function look messy. Hence, decided to remove `rounds` memeber. The side effect of removing this data memeber is setting `batch_ctx->result = 1` during creation since we alwasy need to `&&` with `batch_ctx->result` during verification.
If the user calls `batch_add_schnorrsig` while the batch context's scratch space is full (i.e, batch_ctx->len = batch_ctx->capacity). The previously allocated points and scalars will be erased to allow adding new points and scalars (to scratch space).
this part of batch_create does performs the same operation as `secp256k1_batch_scratch_alloc`, so calling that func instead
Adds xonly pubkey tweak check data to the batch context. This function's algorithm is based on `secp256k1_xonly_pubkey_tweak_add_check`.
Batch context's secp256k1_sha256 object will be initialized with the tag "BIP0340/batch"
- removed `init` from the randomizer function name - removed `tweaked_buf[33]` from `secp256k1_batch_xonlypub_randomizer` - update documentation of `batch_context_add_*` functions
libsecp's CI tests required a newline to be present at the end of every file
- rename `n_terms` to `max_terms` - add `static` keyword for internal function definition - add `ARG_CHECK(batch_ctx != NULL)`
Previously: - `batch_add_schnorrsig` API was exposed through `include/secp256k1_schnorrsig.h`. - `batch_add_xonlypub_tweak_check` API was exposed through `include/secp256k1_extrakeys.h`. - These APIs also had an `#ifdef` guard to check if user enable the batch module. Placing an `#ifdef` guard in an include file forces the user to define `ENABLE_MODULE_BATCH` macro while compling their C program. Hence, the `batch_add_` APIs are exposed through a new header file without any `#ifdef`. Now, the user can simply the any libsecp's header file without worrying about defining any macro (during compilation).
(cherry picked from commit c171f0d)
(cherry picked from commit 9acd9c4)
Fixed CI test issues |
siv2r
pushed a commit
that referenced
this pull request
Jun 25, 2025
f87a358 cmake: Do not set `CTEST_TEST_TARGET_ALIAS` (Hennadii Stepanov) Pull request description: An alias for the "test" target can be confusing for the downstream project. For instance, when integrating using `add_subdirectory(secp256k1 EXCLUDE_FROM_ALL)` (see hebasto/bitcoin#192), test binaries are not being built by default. But the `check` alias target is exposed to the downstream project build system, which in turn fails: ``` $ make -C build check ... Unable to find executable: /home/hebasto/git/bitcoin/build/src/secp256k1/src/exhaustive_tests 3/3 Test #3: exhaustive_tests .................***Not Run 0.00 sec 0% tests passed, 3 tests failed out of 3 Total Test time (real) = 0.03 sec The following tests FAILED: 1 - noverify_tests (Not Run) 2 - tests (Not Run) 3 - exhaustive_tests (Not Run) Errors while running CTest ... ``` This PR fixes this issue by deleting the `CTEST_TEST_TARGET_ALIAS` usage. ACKs for top commit: real-or-random: utACK bitcoin-core@f87a358 Tree-SHA512: ccf3f30939cf1747471ea15260f7caa6dad3f510e5771245ecbfbef3cc0b0e7c8ac551519d0892bf2544c91467d8d67d2c6e6bc52f56c384b174b88bcf377d4a
siv2r
pushed a commit
that referenced
this pull request
Jun 25, 2025
… 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 bitcoin-core#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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For debugging CI tests