Skip to content

Upstream PRs 1533#316

Merged
jonasnick merged 7 commits intoBlockstreamResearch:masterfrom
mllwchrry:temp-merge-1533
Feb 9, 2026
Merged

Upstream PRs 1533#316
jonasnick merged 7 commits intoBlockstreamResearch:masterfrom
mllwchrry:temp-merge-1533

Conversation

@mllwchrry
Copy link
Contributor

Merge bitcoin-core/secp256k1#1533: tests: refactor: tidy up util functions (#1491)

This PR can be recreated with ./contrib/sync-upstream.sh -b master range 4392f0f7.

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.

theStack and others added 7 commits May 27, 2024 03:09
The rename was done with the following command:

$ sed -i 's/random_group_element_/random_ge_/g' $(git grep -l random_group_element_)
…e_magnitude`

Note that the already existing function `random_fe_magnitude` is removed
and the call-sites are adapted to pass the magnitude range of 8
(the maximum for secp256k1_fe_mul and secp256k1_fe_sqr) explicitly.
Can be reviewed via `--color-moved=dimmed-zebra`.
The rename was done with the following command:

$ sed -i 's/secp256k1_testrand/testrand/g' $(git grep -l secp256k1_testrand)
…tions (#1491)

e73f6f8 tests: refactor: drop `secp256k1_` prefix from testrand.h functions (Sebastian Falbesoner)
0ee7453 tests: refactor: add `testutil_` prefix to testutil.h functions (Sebastian Falbesoner)
0c6bc76 tests: refactor: move `random_` helpers from tests.c to testutil.h (Sebastian Falbesoner)
0fef847 tests: refactor: rename `random_field_element_magnitude` -> `random_fe_magnitude` (Sebastian Falbesoner)
59db007 tests: refactor: rename `random_group_element_...` -> `random_ge_...` (Sebastian Falbesoner)

Pull request description:

  This PR is an attempt at tidying up test util functions, as suggested in #1491. The following changes are done:
  * rename `_group_element...` functions to `_ge...`
  * rename `_field_element...` functions to `_fe...`
  * move `random_` helpers from tests.c to testutil.h (the alternative would be testrand.h, but to my understanding, this one is meant to contain the actual RNG implementation rather than helpers using it; happy to move the helpers there if that is preferred though)
  * prefix testutil.h functions with `testutil_`
  * prefix testrand.h functions with `testrand_` (this is currently done in a sloppy way by simply dropping the `secp256k1_` prefix, so some functions don't have the full prefix, like e.g. `testrand256`; naming suggestions welcome)

ACKs for top commit:
  sipa:
    utACK e73f6f8
  real-or-random:
    utACK e73f6f8

Tree-SHA512: c87a35a9f7f23d4bbb87a1ff0d40dd5fbd7d976719ca1027cad187ac44aa2db3ae887ac620639d2287c260e701a5963830b52048692d3e6b38b5eb6cdf17b854
Copy link
Contributor

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 513e550

@jonasnick jonasnick merged commit 84ca3b3 into BlockstreamResearch:master Feb 9, 2026
106 of 116 checks passed
@mllwchrry mllwchrry deleted the temp-merge-1533 branch February 13, 2026 14:01
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.

4 participants