a431edb86a Create configuration conditional bench (Tobin C. Harding)
2a1c9ab4b8 Remove rand-std feature from unstable (Tobin C. Harding)
ddc108c117 Increase heading size (Tobin C. Harding)
596adff8ba Remove unneeded whitespace (Tobin C. Harding)
Pull request description:
As we did in rust-bitcoin [0] create a configuration conditional `bench`
that we can use to guard bench mark code. This has the benefit of
making our features additive i.e., we can now test with `--all-features`
with a stable toolchain (currently this fails because of our use of the
`test` crate).
Please note, this patch maintains the current behaviour of turning on
the `recovery` and `rand-std` features when benching although I was
unable to ascertain why this is needed.
[0] - https://github.com/rust-bitcoin/rust-bitcoin/pull/1092
ACKs for top commit:
sanket1729:
ACK a431edb86a.
apoelstra:
ACK a431edb86a
Tree-SHA512: 913f5fbe0da08ec649081bf237c1d31cee58dacdac251d6030afabb99d455286c6d1dbdb6b2ac892b5d3c24584933254d1cfeec8e12f531cc420bd9d455a6531
This causes panics. We can't add catch the panic, we can't change its output, we
can't detect if it'll happen, etc. Rather than dealing with confused bug reports
let's just drop this.
If users want to rerandomize their contexts they can do so manually.
There is probably a better solution to this but it is still under debate, even
upstream in the C library, what this should look like. Meanwhile we have bug
reports now.
As we did in rust-bitcoin [0] create a configuration conditional `bench`
that we can use to guard bench mark code. This has the benefit of
making our features additive i.e., we can now test with `--all-features`
with a stable toolchain (currently this fails because of our use of the
`test` crate).
[0] - https://github.com/rust-bitcoin/rust-bitcoin/pull/1092
Currently the "unstable" feature (used to guard bench mark code) turns
on the "recovery" and "rand-std" features. The "rand-std" feature is not
needed since it is unused, as can be seen by the following bench runs:
Before applying this patch:
...
test benches::bench_sign_ecdsa ... bench: 35,454 ns/iter (+/- 1,376)
test benches::bench_verify_ecdsa ... bench: 44,578 ns/iter (+/- 1,619)
test benches::generate ... bench: 26,800 ns/iter (+/- 2,352)
test ecdh::benches::bench_ecdh ... bench: 51,195 ns/iter (+/- 1,400)
test ecdsa::recovery::benches::bench_recover ... bench: 50,174 ns/iter (+/- 1,572)
test key::benches::bench_pk_ordering ... bench: 5,748 ns/iter (+/- 492)
test result: ok. 0 passed; 0 failed; 76 ignored; 6 measured; 0 filtered out; finished in 14.52s
After removing "rand-std" feature:
...
test benches::bench_sign_ecdsa ... bench: 35,510 ns/iter (+/- 1,504)
test benches::bench_verify_ecdsa ... bench: 42,483 ns/iter (+/- 5,628)
test benches::generate ... bench: 26,573 ns/iter (+/- 1,333)
test ecdh::benches::bench_ecdh ... bench: 50,846 ns/iter (+/- 3,982)
test ecdsa::recovery::benches::bench_recover ... bench: 50,908 ns/iter (+/- 2,775)
test key::benches::bench_pk_ordering ... bench: 6,002 ns/iter (+/- 463)
test result: ok. 0 passed; 0 failed; 60 ignored; 6 measured; 0 filtered out; finished in 6.52s
d2c97d43d8 Remove unnecessary instances of must_use (Tobin C. Harding)
Pull request description:
`Result` is already `must_use`, adding the compiler directive to
functions that return `Result` is unnecessary.
ACKs for top commit:
apoelstra:
ACK d2c97d43d8
Tree-SHA512: 2c9cf38ea1b5b9f9502a99b8840cdc1e5969d07b0bfd284b2abc5f68dfe6dd501a9ce3371572256d2284b4ddcdd86770d760c8e482fbf88646c0e04a43493b65
580aba82d0 Bump version to v0.23.2 (Tobin C. Harding)
a5918c615a Posthumously add changelog entry for 0.23.2 (Tobin C. Harding)
Pull request description:
Bump the version to v0.23.3 and add changelog entry. Also, in preparation add a changeloge entry for the already released v0.23.2
ACKs for top commit:
apoelstra:
ACK 580aba82d0
Tree-SHA512: 5a49c8105bd5bcce28c607abd44d4386924251a8d48e7bd08aba2f3afd7e156ddea30e295f83c66a057e6c1f2a6ad75693c78136cb84bb5667f4438e78b66f34
5f611f6f7f Conditionally compile the hex macro (Tobin C. Harding)
69349a858f Add NIGHTLY variable to CI script (Tobin C. Harding)
Pull request description:
We are currently using the DO_BENCH variable as a proxy for whether or not we are using a nightly toolchain, while this is technically correct we use it from within an if guarded statement that is guarded by DO_FEATURE_MATRIX and we never run the CI script with _both_ of these variables set to true. This means that the all features test is never being run.
Add a NIGHTLY variable and set it based on the output of `cargo --version`.
This PR catches the bug fixed in: https://github.com/rust-bitcoin/rust-secp256k1/pull/466 as such it will not be able to be merged until #466 merges.
ACKs for top commit:
apoelstra:
ACK 5f611f6f7f
Tree-SHA512: 231bbff8e8944026183a87f681c2d7152c4dcfaaafb6cbd99404e8912d61dbc53c40bb24473c156e893c5b8de79462cb944ed94ffe5429f8b31eaef76dbc0694
We are currently using the DO_BENCH variable as a proxy for whether or
not we are using a nightly toolchain, while this is technically correct
we use it from within an if guarded statement that is guarded by
DO_FEATURE_MATRIX and we never run the CI script with _both_ of these
variables set to true. This means that the all features test is never
being run.
Add a NIGHTLY variable and set it based on the output of `cargo
--version`.
56f18430ff Add must_use for mut self key manipulation methods (Tobin C. Harding)
5b86e38aea Put compiler attributes below rustdocs (Tobin C. Harding)
Pull request description:
We recently added a bunch of key tweaking methods that take `mut self`
and return the tweaked/negated keys. These functions are pure and as
such the returned result is expected to be used. To help downstream
users use the API correctly add `must_use` attributes with a descriptive
error string for each of the methods that takes `mut self`.
Patch 1 is preparatory cleanup.
ACKs for top commit:
apoelstra:
ACK 56f18430ff
Tree-SHA512: 95ee63d5d0a34a9915551471d2f71de1963875eda04bf4217544076be0ed2836dcdee1875432dba5e02678556af86d7487e39daac6e928083807661430ddbcd6
0c15c01eb1 Use fuzzing not feature = "fuzzing" (Tobin C. Harding)
Pull request description:
Currently the following command fails
`RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all --all-features`
This is because `fuzzing` is not a feature, we should be using `fuzzing` directly not `feature = "fuzzing"`.
~I have no idea how this got past CI~, found while trying to [upgrade secp in bitcoin](https://github.com/rust-bitcoin/rust-bitcoin/pull/1066).
This got past CI because of the feature gate combination `#[cfg(all(test, feature = "unstable"))]`, we never run tests on CI with both DO_FEATURE_MATRIX and DO_BENCH.
```
if [ "$DO_FEATURE_MATRIX" = true ]; then
...
if [ "$DO_BENCH" = true ]; then # proxy for us having a nightly compiler
cargo test --all --all-features
RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all --all-features
fi
fi
```
ACKs for top commit:
apoelstra:
ACK 0c15c01eb1
Tree-SHA512: 08ada4eb20c3b7b128a225ed66cc621af097367f8ca19128b868d1b5de897f46d19f3a96a06ebd5dfaa288bc4477046f5d1214f0cdc33237b0ace079c539fc9e
Currently the following command fails
`RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all --all-features`
This is because `fuzzing` is not a feature, we should be using `fuzzing`
directly not `feature = "fuzzing"`.
I have no idea how this got past CI.
We recently added a bunch of key tweaking methods that take `mut self`
and return the tweaked/negated keys. These functions are pure and as
such the returned result is expected to be used. To help downstream
users use the API correctly add `must_use` attributes with a descriptive
error string for each of the methods that takes `mut self`.
141f2d1dbc Bump version to 0.23.2 (Artem Vorotnikov)
Pull request description:
ACKs for top commit:
apoelstra:
ACK 141f2d1dbc
Tree-SHA512: 931b4ad992f7f00640edae08fcb6ba7bacccf088f54adab7820207dd6d980788922b0596c45ef30e4b949a156f9e67b48cb20f79b033fda31dbde3c857d3bfd6
e275166652 derive Hash for RecoverableSignature (NicolaLS)
Pull request description:
It would be nice to also derive Hash for `RecoverableSignature` so data structures containing it don't have to implement it themself if they need to derive Hash
ACKs for top commit:
apoelstra:
ACK e275166652
Tree-SHA512: 418337e16e82a5e736c54d123450fdb164f4776db68952cf8095b36c501436446542821d554fa781dffa0f9067fc2464833a6c461897e655ff4449018da12ca2
4e44abc2e0 Bump version to v0.23.1 (Tobin C. Harding)
c36b4375c0 Enable rand/std_rng feature (Tobin C. Harding)
Pull request description:
Hot fix because currently attempting to use secp256 v0.23.0 as a dependency throws a secp build error.
We recently upgraded the rand dependency and we use it behind code feature gated on "rand-std". In that code we use `thread_rng` but this is only available if the "std_rng" feature is turned on, however in non-dev builds we do not enable this feature, we have a "rand-std" feature that enables "rand/std", it should also enable "std_rng".
Enable "rand/std_rng" in the "rand-std" feature.
I threw a version bump patch on this too in case we want to merge and release this fix (assuming I'm not mistaken about the 0.23.0 release), its Friday afternoon right now for me so if you want to forge ahead feel free to do what ever needs doing, don't wait for me and this PR :)
ACKs for top commit:
apoelstra:
ACK 4e44abc2e0
Tree-SHA512: a76b4a94cea219f6cac3fe33efd6913b713f781917c9cdf6c5265e4021d57a91cae53ca4bb396deea654b976495843fdbad660959356669299b1c7c0b2371f80
We just applied a hot fix to the 0.23.0 released code to fix the
features enabled in `rand` when our "rand-std" feature is enabled. This
requires a bump of the patch version for release.
Bump the version and add a changelog entry.
We recently upgraded the rand dependency and we use it behind code
feature gated on "rand-std". In that code we use `thread_rng` but this
is only available if the "std_rng" feature is turned on, however in
non-dev builds we do not enable this feature, we have a "rand-std"
feature that enables "rand/std", it should also enable "std_rng".
Enable "rand/std_rng" in the "rand-std" feature.
79a4ee333b secp256k1-sys: bump version to 0.6.0 (Andrew Poelstra)
Pull request description:
Needed for release of secp256k1 0.23.0
ACKs for top commit:
tcharding:
ACK 79a4ee333b
sanket1729:
utACK 79a4ee333b
Tree-SHA512: 25c35145a1b4bc4bc997e136b727345b5f43921efdc983fb5866a717ee2b2bab501c0801fa3e613672027f5b35117890a0384a396770cb59467405ae374079ee
b18f5d0454 Removed `Default` from `SerializedSignature` (Martin Habovstiak)
Pull request description:
`Default` was pointless, so it was replaced with internal
`from_raw_parts` method which also checks the length.
This commit also documents changes to `SerializedSignature`.
Closes#454
ACKs for top commit:
tcharding:
utACK b18f5d0454
apoelstra:
ACK b18f5d0454
Tree-SHA512: 5ee32160721d4d22cfe7c5dcc433bf013fc78a350e86b3d8d42c207fec7f2bf11c47fce77269ae816567be77602fdc86231d86e2c62aa2d327540056ab445842
`Default` was pointless, so it was replaced with internal
`from_raw_parts` method which also checks the length.
This commit also documents changes to `SerializedSignature`.
Closes#454
c1d735802c Bump crate version to 0.23.0 (Tobin C. Harding)
Pull request description:
~We just did an MSRV bump, this typically would require bumping our major
version number but since we are pre 1.0 we bump the minor version
number.~
In preparation for release, write CHANGELOG release notes and bump the crate version to 0.23.0
Thanks to Kixunil for sifting through the PRs to make the changelog list, I added links to the relevant PRs.
ACKs for top commit:
apoelstra:
ACK c1d735802c
Tree-SHA512: b320f061c78c9646a0c51a54b7fcdd676e7487b10a5a5323f20cf5ed11d3ea97a7a330764c934f3e4756679ac3daebbff2d725c9a15ec15216b60c7dfea9706b
e612458dc7 Remove mentions of 32-byte slice from tweak APIs (Martin Habovštiak)
Pull request description:
These methods accept `&Scalar`, not slice and `&Scalar` already guarantees 32-bytes, so this failure case is impossible.
ACKs for top commit:
sanket1729:
ACK e612458dc7.
apoelstra:
ACK e612458dc7
Tree-SHA512: f1c083756cb99b16b16764c4d603196a99b7bae864ca7f62908866667cf0218c459447b95298edc71de92c1abe1268a1c085495e1626bb0b9168e1af6aaf2af6
This de-clutters the code and prepares for the next step of adding
`IntoIterator`. The type is still re-exported so the change is neither
breaking nor inconvenient.
This also adds more datialed explanation of `SerializedSignature` and
why it's needed.
65186e732a Add githooks (Tobin C. Harding)
6d76bd4a89 Add clippy to CI (Tobin C. Harding)
9f1ebb93cb Allow nonminimal_bool in unit test (Tobin C. Harding)
685444c342 Use "a".repeats() instead of manual implementation (Tobin C. Harding)
42de876e01 Allow let_and_return for feature guarded code (Tobin C. Harding)
d64132cd4b Allow missing_safety_doc (Tobin C. Harding)
2cb687fc69 Use to_le_bytes instead of mem::transmute (Tobin C. Harding)
c15b9d2699 Remove unneeded explicit reference (Tobin C. Harding)
35d59e7cc6 Remove explicit 'static lifetime (Tobin C. Harding)
1a582db160 Remove redundant import (Tobin C. Harding)
Pull request description:
The first 8 patches clear clippy warnings. Next we add a CI job to run clippy. Finally we add a `githooks` directory that includes running clippy, also adds a section to the README on how to use the githooks. This is identical to the text in the [open PR](https://github.com/rust-bitcoin/rust-bitcoin/pull/1044) on `rust-bitcoin` that adds githooks _without_ yet adding clippy.
**Note**: The new clippy CI job runs and is green :)
ACKs for top commit:
Kixunil:
ACK 65186e732a
apoelstra:
ACK 65186e732a
Tree-SHA512: f70a157896ce2a83af8cfc10f2fbacc8f68256ac96ef7dec4d190aa72324b568d2267418eb4fe99099aeda5486957c31070943d7c209973859b7b9290676ccd7
Add `githooks` directory and:
- Copy the default pre-commit hook into new githooks directory
- Add a call to clippy to the pre-commit hook
- Add a section to the README instructing devs how to use the new
githooks