Commit Graph

195 Commits

Author SHA1 Message Date
Tobin C. Harding b6d0c3bfcd
Use doc_auto_cfg
We can build docs using feature markers by using `doc_auto_cfg` now, no
need to manually call the `doc` attribute.
2023-05-03 12:06:25 +10:00
Andrew Poelstra 0494f50b1a
fix correct minimal versions for serde crates 2023-03-18 20:50:10 +00:00
Andrew Poelstra b03602bfaa
tests: replace cbor with more-recently-deprecated serde_cbor
The `cbor` crate has been unmaintained for several years, and depends on
the ancient `rustc_serialize` crate which (a) doesn't build on WASM, and
(b) doesn't build when we use a minimal-dep Cargo.lock. (The latter is
because cbor specifies rustc_serialize 0.3.0 when it should specify 0.3.1,
but there is nothing we can do to fix that when cbor is unmaintained.)

This changes a hardcoded value in a regression test, but it's because
we're replacing the serialization engine rather than changing our code,
so this is not actually a change.
2023-03-18 20:50:02 +00:00
Tobin C. Harding 5ae136d7bd
Bump secp256k1-sys version to 0.8.1
We are ready to release a new minor version of `secp256k1-sys`, in order
to do so we must make change the symbol names to reflect the new version
as well as the usual changelog and version bump.

In preparation for releasing `secp256k1-sys` v0.8.1 do:

- Rename symbols to from `0_8_0` -> `0_8_1`, done mechanically (search
  and replace)
- Add changes log notes (includes changelog entry for 0.8.0)
- Bump `secp256k1-sys` crate version 0.8.0 -> 0.8.1, justified because
  we have added a new public function.
2023-03-17 16:22:01 +11:00
Tobin C. Harding 45395190c2
Bump version to 0.27.0
Add changelog notes and bump the minor version number.
2023-03-15 15:13:05 +11:00
Tobin C. Harding 8e772493dc
Depend on bitcoin_hashes v0.12
Upgrade to use the newly released `bitcoin_hashes`.
2023-03-15 14:56:28 +11:00
Andrew Poelstra fe828d040d
add redundant features for cargo 1.41 bug 2023-01-13 14:04:23 +00:00
Tobin C. Harding 2dad589394 Upgrade the vendored libsecp256k1 code
`libsecp256k1` v0.2.0 was just released.

Update the vendored code using

 `./vendor-libsecp.sh depend 0_8_0 21ffe4b`

```
git show 21ffe4b
commit 21ffe4b22a9683cf24ae0763359e401d1284cc7a (tag: v0.2.0)
Merge: 8c949f5 e025ccd
Author: Pieter Wuille <pieter@wuille.net>
Date:   Mon Dec 12 17:00:52 2022 -0500

    Merge bitcoin-core/secp256k1#1055: Prepare initial release

    e025ccdf7473702a76bb13d763dc096548ffefba release: prepare for initial release 0.2.0 (Jonas Nick)
    6d1784a2e2c1c5a8d89ffb08a7f76fa15e84fff5 build: add missing files to EXTRA_DIST (Jonas Nick)
    13bf1b6b324f2ed1c1fb4c8d17a4febd3556839e changelog: make order of change types match keepachangelog.com (Jonas Nick)
    b1f992a552785395d2e60b10862626fd11f66f84 doc: improve release process (Jonas Nick)
    ad39e2dc417f85c1577a6a6a9c519f5c60453def build: change package version to 0.1.0-dev (Jonas Nick)
    90618e9263ebc2a0d73d487d6d94fd3af96b973c doc: move CHANGELOG from doc/ to root directory (Jonas Nick)

    Pull request description:

      Based on #964

    ACKs for top commit:
      sipa:
        ACK e025ccdf7473702a76bb13d763dc096548ffefba

    Tree-SHA512: b9ab71d7362537d383a32b5e321ef44069f00e3e92340375bcd662267bc5a60c2bad60222998e6602cfac24ad65efb23d772eac37c86065036b90ef090b54c49
    ```

Requires a new version of `secp256k1-sys`, use v0.8.0

- Update the `secp256k1-sys` manifest (including links field)
- Update symbols to use 0_8_0
- Add a changelog entry
- depend on the new version in `secp256k1`

Which in turn requires a new version of `secp256k1`, use v0.26.0
2022-12-21 08:11:14 +11:00
Tobin C. Harding 3fa2436272 Bump secp256k1-sys version to 0.7.0
We are ready to release a new minor version of `secp256k1-sys`, in order
to do so we must make change the symbol names to reflect the new version
as well as the usual changelog and version bump.

In preparation for releasing `secp256k1-sys` v0.7.0 do:

- Rename symbols to from `0_6_1` -> `0_7_0`, done mechanically (search
  and replace)
- Add changes log notes
- Bump `secp256k1-sys` crate version 0.6.1 -> 0.7.0, justified because
  we have added new public methods to various types (e.g.,
  `PublicKey::cmp_fast_unstable`)
2022-12-12 09:13:00 +11:00
Tobin C. Harding 1dbd7691da secp256k1: Bump crate version to 0.25.0
Add changelog notes and bump the crate version to v0.25.0!
2022-11-30 12:22:16 +11:00
Tobin C. Harding 9c748550b4 Fix feature gating
Currently we have a few problems with our feature gating, attempt to
audit all feature gating and fix it by doing:

1. Do not enable features on optional dependencies (`rand` and
   `bitcoin-hashes`) in dev-dependencies, doing so hides broken feature
   gating in unit tests.
2. Do not use unnecessary feature combinations when one feature enables
   another e.g. `any(feature = "std", feature = "alloc")`.
3. Enable "std" from "rand-std" and "bitcoin-std" (and fix features
   gating as for point 2).
4. Clean up code around `rand::thread_rng`, this is part of this patch
   because `thread_rng` requires the "rand-std" feature.
5. Clean up CI test script to test each feature individually now that
   "rand-std" and "bitcoin-hashes-std" enable "std".
2022-11-18 10:14:41 +11:00
Tobin C. Harding b0d0b2afcb Improve feature usage bitcoin-hashes[-std]
Currently we have a feature `bitcoin-hashes-std` and a dependency
`bitcoin_hashes`, this means one has to think about and change the `_`
and `-` when coding. The underscore in `bitcoin_hashes` is an artifact
of days gone by and we cannot fix it but we can cover it up and make our
lives easier, especially now we have `bitcoin-hashes-std`.

Improve feature usage of the `bitcoin_hashes` library by:

- Add a feature `bitcoin-hashes` that enables `bitcoin_hashes`.
- Use the new feature in all feature gated code
- Use `bitcoin-hashes-std` in feature gated code that includes other
  `std` features (e.g. `rand-std`)
2022-11-10 10:56:14 +11:00
elsirion 1f327b478a
Bump version number to v0.24.1
We have fixed a bug in `KeyPair` decoding and otherwise didn't change the API.
2022-10-25 20:32:58 +02:00
Tobin C. Harding d31bbc1723 Bump version number to v0.24.0
We have updated the `bitcoin_hashes` version, this requires a minor
version bump and release.
2022-07-20 07:56:20 +10:00
Tobin C. Harding 6062ea7d54 Upgrade to bitcoin_hashes v0.11.0
New version of `bitcoin_hashes` is out, lets use it.
2022-07-20 07:55:55 +10:00
Tobin C. Harding 510e58a949 Remove leading whitespace character
The manifest has two cases of leading whitespace, doesn't obviously mean
anything, remove them.

Whitespace was introduced in commit: `7d3a149ca5064147229db147359638cbcb54acdd`
2022-07-20 07:55:55 +10:00
Andrew Poelstra 71b47d1273
Merge rust-bitcoin/rust-secp256k1#473: Create configuration conditional "bench"
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
2022-07-19 21:11:13 +00:00
Andrew Poelstra d206891eaa bump version to 0.23.4 2022-07-14 14:10:59 +00:00
Tobin C. Harding a431edb86a Create configuration conditional bench
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
2022-07-14 09:35:23 +10:00
Tobin C. Harding 2a1c9ab4b8 Remove rand-std feature from unstable
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
2022-07-14 09:33:47 +10:00
Tobin C. Harding 580aba82d0 Bump version to v0.23.2
A couple of quick fixes where merged over the last two days, bump the
version ready to do a point release. Add changelog entry also.
2022-06-29 10:58:25 +10:00
Artem Vorotnikov 141f2d1dbc
Bump version to 0.23.2 2022-06-27 20:11:03 +03:00
Artem Vorotnikov 74ec3eff70
Move cbor to dev-dependencies 2022-06-24 17:30:25 +03:00
Tobin C. Harding 4e44abc2e0 Bump version to v0.23.1
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.
2022-06-24 14:00:50 +10:00
Tobin C. Harding c36b4375c0 Enable rand/std_rng feature
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.
2022-06-24 13:41:51 +10:00
Andrew Poelstra 79a4ee333b secp256k1-sys: bump version to 0.6.0
Needed for release of secp256k1 0.23.0
2022-06-21 20:37:45 +00:00
Tobin C. Harding c1d735802c Bump crate version to 0.23.0
In preparation for release, write CHANGELOG release notes and bump the
crate version  to 0.23.0
2022-06-21 08:57:14 +10:00
Tobin Harding 3ca7f499e0 Add fixed-width-serde integration tests
Add a `tests` directory. Add `serde` tests for the recently added fixed
width binary serialization code.

Please note, serialization is only fixed width when serialized with
the `bincode` crate.
2022-06-09 16:17:11 +10:00
Elichai Turkel 5d2f1ceb64
Fix WASM build 2022-06-07 23:59:44 +03:00
Elichai Turkel 7d3a149ca5
Move more things from the std feature to the alloc feature 2022-06-07 23:59:42 +03:00
Elichai Turkel ebe46a4d4e
Update rand to 0.8 and replace CounterRng with mock::StepRng 2022-06-07 23:59:40 +03:00
Elichai Turkel 626835f540
Update secp256k1 to edition 2018 and fix imports 2022-06-07 23:59:25 +03:00
Elichai Turkel c1bb316675
Make global-context-less-secure actually enable the global context 2022-03-28 16:39:06 +03:00
Dominik Spicher 463148f9a0 bump version to 0.22.1 2022-03-10 22:38:25 +01:00
Andrew Poelstra 8294ea3f50 secp256k1-sys: update upstream library
Two API changes needed to be reflected: schnorrsig_sign and schnorrsig_verify.

Also bump both Cargo.toml files
2022-03-08 19:45:41 +00:00
Tobin Harding 6bcf3ea0d0 Add bitcoin-hashes-std features
Currently we use 'no default features' for the `bitcoin_hashes`
dependency. Doing so means that if users want the `std` feature they
need to explicitly add a `bitcoin_hashes` dependency even though we
re-export `bitcoin_hashes` as `hashes`. This means that in the common
case the re-export is pointless. As an example, `rust-bitcoin`
unnecessarily requires an explicit dependency on `bitcoin_hashes`.

Add `bitcoin-hashes-std` feature so that users do not need an explicit
dependency in the common use case.

Change the test matrix to only test '*-std' features when 'std' is
enabled since enabling one without the other is illogical. Please note,
this replaces the test run of feature 'std'+'rand'+'rand-std' with just
'std'+'rand-std' because enabling 'rand-std' enables 'rand' so the
explicit additional feature is redundant.
2022-03-08 10:44:21 +11:00
Tobin Harding 555833b70f
Disable bitcoin_hashes default features
Currently we use default features for the `bitcoin_hashes` dependency,
doing so breaks the `no-std` feature in `rust-bitcoin` because `std` is
part of `bitcoin_hashes` default feature set.

Disable `bitcoin_hashes` default features, no changes to `rust-bitcoin`
are require after this change since we manually turn on `std` and
`alloc` as part of the `std`/`no-std` features of `rust-bitcoin`.

For other users of `rust-secp256k1` this is a breaking change but is
unlikely to cause too much bother because `std` is so commonly used.
2022-03-01 16:24:05 +00:00
Tobin Harding b6f169f083
Improve manifest whitespace
Mirror the whitespacing in `rust-bitcoin` by doing:

- Only use single line of whitespace between sections
- Separate optional dependencies from non-optional ones
2022-03-01 16:22:37 +00:00
Andrew Poelstra ce255fdfe1
Merge rust-bitcoin/rust-secp256k1#390: bump version to 0.21.3
65d32af6fd bump version to 0.21.3 (Andrew Poelstra)

Pull request description:

  We've got a ton of minor changes in, plus fixing the Parity type and adding some extra serde impls. Let's push a minor version out so that we can move on to updating the upstream libsecp.

Top commit has no ACKs.

Tree-SHA512: 584c03106124b4152b8971ac6d0587a26d2aca9187f88d8228a356c2327bf066d2c9b8134149f9ee3bc5f3712f64559b32843aa8e92d3395c5a1bd53de5442ce
2022-02-23 18:45:12 +00:00
Andrew Poelstra 65d32af6fd bump version to 0.21.3 2022-02-17 17:20:41 +00:00
Andrew Poelstra 2a25e5eae8 restore `global-context-less-secure` feature 2022-02-16 23:46:52 +00:00
Tobin Harding a0465ea279 Remove feature global-context-less-secure
Instead of providing a mechanism for users to opt out of randomization
we can just feature gate the call site i.e., opportunistically randomize
the global context on creation if `rand-std` feature is enabled.
2022-02-04 08:34:39 +11:00
Tobin Harding a79840eca2 Be explicit about example feature requirements
The examples depend on having the "std" feature [1]. In preparation for
being able to run tests with `--no-default-features` add the "std"
feature as a requirement for all three examples. While we are at it use
the correct rand feature requirement: `rand-std`.

[1] Technically we only need "alloc" but "alloc" is not working with
Rust 1.29 currently so just use "std".
2022-02-01 15:20:06 +11:00
Martin Habovstiak d52ab85dd5 Added missing features to docs.rs config
These features were previously forgotten and without them the docs.rs
doc is not that great. :(
2022-01-07 01:12:41 +01:00
sanket1729 1671dfc2ed Release 0.21.2 2022-01-06 23:57:28 +05:30
Andrew Poelstra 74e8fc7699
Merge rust-bitcoin/rust-secp256k1#360: Re-export Parity struct
e595b39510 Re-export Parity struct (sanket1729)

Pull request description:

  pub struct Parity is under a private module key and not re-exported in lib.rs . It is therefore not
  possible to use it downstream.

ACKs for top commit:
  elichai:
    ACK e595b39510
  apoelstra:
    ACK e595b39510

Tree-SHA512: 2573689f9a08505c8dfe8f79cd921d5a2742a2a2f4f92cf4066fe6557c765c756531d13560fa4fe6461f094b0c11a52aca30b44542eb77eda7dd1ebd24d3b155
2022-01-06 15:46:18 +00:00
Andrew Poelstra 88f6baee73
Merge rust-bitcoin/rust-secp256k1#353: Documented features
18f74d5242 Clarify what does "less security" mean (Martin Habovstiak)
94c55b4d09 Fixed typos/grammar mistakes (Martin Habovštiak)
1bf05523f0 Documented features (Martin Habovstiak)

Pull request description:

  This documents the Cargo features making sure docs.rs shows warning for
  feature-gated items. They are also explicitly spelled out in the crate
  documentation.

  The PR is similar in spirit to https://github.com/rust-bitcoin/rust-bitcoin/pull/633

ACKs for top commit:
  apoelstra:
    ACK 18f74d5242

Tree-SHA512: 8aac3fc5fd8ee887d6b13606d66b3d11ce44662afb92228c4f8da6169e3f70ac6a005b328f427a91d307f8d36d091dcf24bfe4d17dfc034d02b578258719a90a
2022-01-06 15:42:32 +00:00
sanket1729 e595b39510 Re-export Parity struct
pub struct Parity is under a private module key. It is therefore not
possible to use it downstream.
2022-01-06 09:08:59 +05:30
Andrew Poelstra c50411f798 release secp256k1-sys 0.4.2; make new `ZERO` type publically accessible 2022-01-05 15:56:49 +00:00
Martin Habovstiak 1bf05523f0 Documented features
This documents the Cargo features making sure docs.rs shows warning for
feature-gated items. They are also explicitly spelled out in the crate
documentation.
2022-01-04 16:55:01 +01:00