Commit Graph

1291 Commits

Author SHA1 Message Date
Tobin C. Harding 1b0c79ce90
Remove check-for-api infrastructure
This was a short lived, and unfortunately unsuccessful experiment on how
to catch API breaking changes. As we did elsewhere in the org, remove
the check-for-api infrastructure.
2024-08-05 14:29:49 +10:00
merge-script 2753b9e767
Merge rust-bitcoin/rust-secp256k1#711: Improve from digest comment
72e09c1a7c Improve the comment on `Message::from_digest` (Martin Habovstiak)

Pull request description:

  Minor improvement on top of #712

ACKs for top commit:
  apoelstra:
    ACK 72e09c1a7c

Tree-SHA512: 06e8e706bb9732ea46ef3488ed33f7c7c84ea5afa5b1b2bca03cd2641524ff61156133436c1dd62df62769c8544644e1a4453fbacf4413fece73282ae154a387
2024-07-29 10:45:05 +00:00
Martin Habovstiak 72e09c1a7c Improve the comment on `Message::from_digest`
The example claimed it'd be unsafe, which is a specific Rust term and
thus confusing. It'd just be cryptographically broken. Also the example
passes in a constant which looks ridiculously unrealistic.

Fix these by
* changing the comment to say cryptographically broken
* making the example pass the input through invisible fake hash function
2024-07-28 20:35:38 +02:00
merge-script 3f067d5b1a
Merge rust-bitcoin/rust-secp256k1#712: Deprecate `Message::from_digest_slice`
939bf9ed5e Deprecate `Message::from_digest_slice` (Martin Habovstiak)
13c5366238 Use `hex_lit::hex` in tests (Martin Habovstiak)

Pull request description:

  Closes #710

  On top of #709

ACKs for top commit:
  apoelstra:
    ACK 939bf9ed5e

Tree-SHA512: 34afc2c040e84745881d8d6d250e6fbe5a42b0fcd4dc3ea01579c52948b6ab89d31eb0ffd449d322ec1fe2c7076c05e5b6343a3e1821eae62fd0c13db926f228
2024-07-28 17:42:56 +00:00
Martin Habovstiak 939bf9ed5e Deprecate `Message::from_digest_slice`
All sensible hash engines return arrays, not slices or other things,
therefore `Message::from_digest_slice` is most likely entirely unneeded
since the array version does a better job and in those rare cases where
it is, the users can just call `.try_into()` themselves.

This commit deprecates `from_digest_slice` and changes all tests to use
`from_digest` except the test that tests `from_digest_slice`. It also
simplifies its code to use `try_into` rather than convert manually and
inefficiently.
2024-07-28 09:13:30 +02:00
Martin Habovstiak 13c5366238 Use `hex_lit::hex` in tests
The tests defined custom `hex!` macros (yes, two actually) that
evaluated to `Vec<u8>`. While the performance didn't matter it made it
harder to use with interfaces that require arrays and all current uses
were passing it as slices anyway.

So, in preparation for upcoming changes, this commit introduces
`hex_lit` dev-dependency which evaluates to array allowing better
interaction with type checker.
2024-07-28 09:13:20 +02:00
merge-script c4c029fca2
Merge rust-bitcoin/rust-secp256k1#709: Bump MSRV to 1.63
55c2efc320 Bump MSRV to 1.63 (Martin Habovstiak)

Pull request description:

  The version 1.63 satisfies our requirements for MSRV and provides significant benefits so this commit bumps it. This commit also starts using weak dependencies.

ACKs for top commit:
  tcharding:
    ACK 55c2efc320

Tree-SHA512: 565fd46768384e7c026c3aa8873e321a20425a6526bcd379ba442cf2504517a435c6c14e21186b36c99185d0a8439f4de2d3ba097b91119483d1a83ab05010ba
2024-07-26 19:18:30 +00:00
Martin Habovstiak 55c2efc320 Bump MSRV to 1.63
The version 1.63 satisfies our requirements for MSRV and provides
significant benefits so this commit bumps it. This commit also starts
using weak dependencies.
2024-07-24 18:12:08 +02:00
merge-script 135c938830
Merge rust-bitcoin/rust-secp256k1#708: scalar: fix PrivateKey->SecretKey in docstring
37d040cb16 scalar: fix PrivateKey->SecretKey in docstring (Marko Bencun)

Pull request description:

ACKs for top commit:
  Kixunil:
    ACK 37d040cb16
  tcharding:
    ACK 37d040cb16

Tree-SHA512: 26ea05cf555463387ea545ef9e81f1ad4e0689fe70d5b4256be45e3ae765b7b23f1c10ad6d14ee80a561fd2481ad8d30fe0c2ac440bbd6f33bfee91e5441d93d
2024-07-23 16:32:22 +00:00
Marko Bencun 37d040cb16
scalar: fix PrivateKey->SecretKey in docstring 2024-07-20 09:21:38 +02:00
merge-script ad9d9d0726
Merge rust-bitcoin/rust-secp256k1#706: Make schnorr sign/verify accept a message slice instead of 32 bytes `Message`
df98b160d8 Make schnorr sign/verify accept a message slice (Elichai Turkel)

Pull request description:

  As discussed on https://github.com/rust-bitcoin/rust-secp256k1/issues/702 and on IRC,
  BIP340 has evolved from supporting only "pre-hashed" 32 byte messages, to supporting messages of "any length" and as such we should allow the users to pass a message of any length.
  Note that passing exactly 32 bytes will make the API behave exactly as before (ie it will produce the same signatures).

  I added all the test vectors from: https://github.com/bitcoin/bips/blob/master/bip-0340/test-vectors.csv To make sure the API is correct even for empty messages and shorter/longer ones :)

ACKs for top commit:
  Kixunil:
    ACK df98b160d8
  apoelstra:
    ACK df98b160d8 thanks for all the new test vectors\!

Tree-SHA512: bd99ea8e17fcc6fd71ad39a87c7c21761f325006998a61b33b6f2abc9f892f90a4236bd25615cb34dc83214a70dcdd34ce3e7cece7d6f971c3843505356c97c5
2024-07-05 22:42:36 +00:00
Elichai Turkel df98b160d8
Make schnorr sign/verify accept a message slice 2024-07-05 22:28:54 +03:00
merge-script 30dda2c12c
Merge rust-bitcoin/rust-secp256k1#705: Fix ci
33a1893c14 Upgrade cross image for windows (Martin Habovstiak)
24e81eeadb Run cross with --verbose flag (Martin Habovstiak)
742c69f975 Compile `no_std` test using xargo (Martin Habovstiak)
2572fb6ab0 Migrate `no_std_test` to edition 2021 (Martin Habovstiak)
df0523a0a7 Use `libc::abort` instead of `intrinsics::abort` (Martin Habovstiak)
924ba381c8 Update panic message handling (Martin Habovstiak)
614fe81708 Whitelist known cfgs (Martin Habovstiak)
05a4e3963c Don't use `core::i32::MAX` (Martin Habovstiak)

Pull request description:

  Updated deprecated item and fixed cfg lints.

ACKs for top commit:
  apoelstra:
    ACK 33a1893c14

Tree-SHA512: 8b66f1f404d44916b2a18dbbe829b31ec1915d3fd084164127aa6e5f98ee5de3ea988f5b1ed05e9532c026890a769b4c54e175508fe472beaea5898a477d5c76
2024-07-05 13:38:37 +00:00
Martin Habovstiak 33a1893c14 Upgrade cross image for windows
Cross uses an old image by default and there's a problem that is
resolved in the newest wine version, so this commit upgrades the
image.
2024-07-04 11:06:44 +02:00
Martin Habovstiak 24e81eeadb Run cross with --verbose flag
This can help debug CI issues.
2024-07-04 09:41:56 +02:00
Martin Habovstiak 742c69f975 Compile `no_std` test using xargo
The `no_std` test disables `std`, so unwinding is unsupported, so we use
`panic = "abort"` but the `core` library is compiled with unwind by
default which breaks the build. Xargo can handle this by recompiling
`core` with `panic = "abort"` so we use it.
2024-07-04 09:21:30 +02:00
Martin Habovstiak 2572fb6ab0 Migrate `no_std_test` to edition 2021
Previously we had dependency problems that were resolved by resolver v2.
We want to activate it just in case it happens again but even better,
bump the edition.  This was probably forgotten when other crates were
migrated.
2024-07-04 07:30:45 +02:00
Martin Habovstiak df0523a0a7 Use `libc::abort` instead of `intrinsics::abort`
Despite using the `#![feature()]` attribute rustc still warns about it
being unstable. Changing it to `libc::abort` gets rid of the annoying
message.
2024-07-03 06:47:16 +02:00
Martin Habovstiak 924ba381c8 Update panic message handling
The newest nightly stabilized `PanicMessage` with a slightly different
API. This updates the API and removes the `#![feature()]` attribute.
2024-07-03 06:43:40 +02:00
Martin Habovstiak 614fe81708 Whitelist known cfgs
Rust is now checking cfg attributes for typos but this interferes with
our cfgs that rustc/cargo don't recognize. This whitelists them so they
no longer produce warnings.
2024-07-03 06:02:12 +02:00
Martin Habovstiak 05a4e3963c Don't use `core::i32::MAX`
This is a legacy constant and it's better to just use `i32::MAX`. Note
that one cannot `use` an associated constant so this just removed the
import. This is better anyway since it's only used once and it didn't
provide meaningful line length reduction.
2024-07-03 05:46:18 +02:00
Andrew Poelstra 6648126c69
Merge rust-bitcoin/rust-secp256k1#685: Release tracking PR: `v0.29.0`
5f9baaa7d5 Bump version to 0.29.0 (Tobin C. Harding)

Pull request description:

  In preparation for release add a dummy changelog entry and bump the version.

ACKs for top commit:
  apoelstra:
    ACK 5f9baaa7d5

Tree-SHA512: 1c58dfbc5c55402aae25e50ff096b7af0cc3d85fef05297f597edea264f9a7534983a2a9e79c15e6514142321c71ea8b48a8b80da960e933d2a155162e6e41b4
2024-04-02 21:51:37 +00:00
Tobin C. Harding 5f9baaa7d5
Bump version to 0.29.0
In preparation for release add a changelog entry and bump the version.
2024-04-03 07:55:21 +11:00
Andrew Poelstra 1e814e7639
Merge rust-bitcoin/rust-secp256k1#688: Release tracking PR: `secp256k1-sys 0.10.0`
2bba8f9f5a secp256k1-sys: Vendor latest secp256k1 (Tobin C. Harding)

Pull request description:

  Vendor latest tagged version of `secp256k1` and prepare for release:

  - Bump the version number to `0.10.0`
  - Run the vendor script (vendoring `secp256k1 0.4.1`)
  - Update lock files
  - Add changelog entry
  - Depend on new version in `secp256k1/Cargo.toml`

ACKs for top commit:
  apoelstra:
    ACK 2bba8f9f5a

Tree-SHA512: 86ab44574d31657f0c99d32a7cf950a54deda4eac6f67ab08cb08a04aa60e65e268893fc1d158fb9895745963c687416c0158e693250d41cefdaf2b71583ff96
2024-04-02 20:33:53 +00:00
Tobin C. Harding 2bba8f9f5a
secp256k1-sys: Vendor latest secp256k1
Vendor the latest secp256k1 `v0.4.1`. Bump the version number of
`secp256k1-sys` to `v0.10.0` and run the vendor script.

Also depend on the new version in `rust-secp256k1`, and add a changelog
entry.
2024-04-03 06:58:25 +11:00
Andrew Poelstra a05078f6e5
Merge rust-bitcoin/rust-secp256k1#686: Deprecate `ThirtyTwoByteHash`
9f28cf6ad0 Deprecate ThirtyTwoByteHash (Tobin C. Harding)
88c8c58d8d Fix import warnings (Tobin C. Harding)

Pull request description:

  The implementations of `ThirtyTwoByteHash` for types from the `hashes` crate are problematic during upgrades because both `bitcoin` and `secp256k1` depend on `hashes` and when the versions of `hashes` get out of sync usage of the trait breaks.

  Deprecate the `ThirtyTwoByteHash` trait and remove the impls for types from `bitcoin_hashes`.

  Add an explanation in the changelog because its too long to go in the deprecation message.

  Close: #673

ACKs for top commit:
  apoelstra:
    ACK 9f28cf6ad0

Tree-SHA512: a7598b09c6a2f49913a9effad3e1ed9b0663970ac20fbfe5fc2f1329daaa2b4cab78b00128a03d0f3f6559ed7964b09e0bd939e60cf130b2cc6e609c90df6868
2024-04-02 00:52:13 +00:00
Tobin C. Harding 9f28cf6ad0
Deprecate ThirtyTwoByteHash
The implementations of `ThirtyTwoByteHash` for types from the `hashes`
crate are problematic during upgrades because both `bitcoin` and
`secp256k1` depend on `hashes` and when the versions of `hashes` get
out of sync usage of the trait breaks.

Deprecate the `ThirtyTwoByteHash` trait and remove the impls for types
from `bitcoin_hashes`.

Add an explanation in the changelog because its too long to go in the
deprecation message.
2024-04-02 11:11:29 +11:00
Tobin C. Harding 88c8c58d8d
Fix import warnings
Recent rustc upgrade introduced some new warnings for incorrect imports,
fix them.
2024-04-02 11:11:20 +11:00
Andrew Poelstra d279c13beb
Merge rust-bitcoin/rust-secp256k1#690: Upgrade hashes dependency
645271dd74 Upgrade hashes dependency (Tobin C. Harding)

Pull request description:

  Keep the range versioning but increase the threshold to include the latest `v0.14.0` release.

ACKs for top commit:
  apoelstra:
    ACK 645271dd74

Tree-SHA512: 46c93e4ad4077cc164e546fd9621f18ec34c2e110f9c763e8252d3ee92174e9efb5a20eea6169f62d5397fcbab5799dd8d9c88577bbf246e9aa4c2b2282c2266
2024-03-28 21:08:19 +00:00
Tobin C. Harding 645271dd74
Upgrade hashes dependency
Keep the range versioning but increase the threshould to include the
upcoming `v0.14.0` release.
2024-03-29 06:23:35 +11:00
Andrew Poelstra ac706178bf
Merge rust-bitcoin/rust-secp256k1#693: Bump MSRV to 1.56.1
2d0c7835f1 Tighten the version grep in vendor script (Tobin C. Harding)
a2b78f4022 Bump MSRV to 1.56.1 (Tobin C. Harding)

Pull request description:

  As we have done in other parts of the ecosystem bump the MSRV to Rust `v1.56.1`.

  Done for `secp256k1` and `secp256k1-sys`.

  This was originally in #688 but there are too many things going on so here it is separately.

ACKs for top commit:
  apoelstra:
    ACK 2d0c7835f1

Tree-SHA512: 35ac5632428211b02f5b25780c3a680d8c9a68b238de7299242510091f9243fe2f6718817c865c3420e3afb64b32d52daf2cf372706067204e7de42e188c31c6
2024-03-28 13:40:40 +00:00
Tobin C. Harding 2d0c7835f1
Tighten the version grep in vendor script
We just added `rust-version = ` to the `secp256k1-sys` manifest, doing
so causes a grep statement from the vendor script to match this line -
we don't want that.

Tighten up the grep statement by only matching on `version` at the start
of the line.
2024-03-28 10:13:27 +11:00
Tobin C. Harding a2b78f4022
Bump MSRV to 1.56.1
As we have done in other parts of the ecosystem bump the MSRV to Rust
`v1.56.1`.

Done for `secp256k1` and `secp256k1-sys`.
2024-03-28 08:40:48 +11:00
Andrew Poelstra b370f6704d
Merge rust-bitcoin/rust-secp256k1#682: Remove wildcard re-exports
0da394e648 Remove wildcard re-exports of key types (Tobin C. Harding)
d63e95b99b Remove wildcard re-exports of context types (Tobin C. Harding)

Pull request description:

  Wildcards make it hard to grep for where stuff comes from, explicit imports and re-exports are ... more explicit.

  - Patch 1: Re-export the `context` types explicitly.
  - Patch 2: Re-export the `key` types explicitly.

  Fix: #681

ACKs for top commit:
  apoelstra:
    ACK 0da394e648

Tree-SHA512: ac92baa9b9abaaff436223bf1d18d286825dbfc8eef401c714314902ff471db4830dce360138845efd781bcb883676d0cbc3db8d691476403eb487a0585edeaa
2024-03-27 19:07:53 +00:00
Andrew Poelstra 1674406b1b
Merge rust-bitcoin/rust-secp256k1#692: CI: Revert cc pin in ASAN job
7b6a13b004 CI: Revert cc pin in ASAN job (Tobin C. Harding)

Pull request description:

  Revert commit: 92778efe92

  We can't use git to revert it because the code has now moved from `test.sh` to `_test.sh`.

  I don't remember the problem but lets just use CI to see if its fixed.

ACKs for top commit:
  sanket1729:
    utACK 7b6a13b004
  apoelstra:
    ACK 7b6a13b004

Tree-SHA512: d804c73152b3d8b14e8f13e64066c33e2dfbdef8b184d55672638df6b468a6f636e632c5e1a0b09e617534aaf466b1c719c6df16952aaf8a51cb2659bed1d0ef
2024-03-27 18:44:33 +00:00
Andrew Poelstra d5f8b2abff
Merge rust-bitcoin/rust-secp256k1#691: Check for API changes in CI
65d54e7bbe Add script to update-lock-files (Tobin C. Harding)
c61db1b44f CI: Check for API changes (Tobin C. Harding)
53d34d5ee0 Update the API files (Tobin C. Harding)
c3f2c59db1 just: Add a command to check for API changes (Tobin C. Harding)
1e22d74270 Add a justfile (Tobin C. Harding)

Pull request description:

  This PR is not just CI, it does a few clean up chores:
  - Add a `justfile` (including command to check the API)
  - Update the API files
  - Add a script to update the lock files

ACKs for top commit:
  apoelstra:
    ACK 65d54e7bbe

Tree-SHA512: c799200dc761cb4367904346024834caf52e9a549aed5741263429d0bd297858c5293bfdb4bdf83fffb063060f7f251c9c1956659bd50867b09fafddb3c54880
2024-03-27 18:34:14 +00:00
Tobin C. Harding 0da394e648
Remove wildcard re-exports of key types
Wildcards make it hard to grep for where stuff comes from, explicit
imports and re-exports are ... more explicit.

Re-export the `key` types explicitly.
2024-03-27 11:49:59 +11:00
Tobin C. Harding d63e95b99b
Remove wildcard re-exports of context types
Wildcards make it hard to grep for where stuff comes from, explicit
imports and re-exports are ... more explicit.

Import and re-export explicitly instead of by using wildcards.
2024-03-27 11:49:57 +11:00
Tobin C. Harding 7b6a13b004
CI: Revert cc pin in ASAN job
Revert commit: 92778efe92

We can't use git to revert it because the code has now moved from
`test.sh` to `_test.sh`.

I don't remember the problem but lets just use CI to see if its fixed.
2024-03-27 11:45:42 +11:00
Tobin C. Harding 65d54e7bbe
Add script to update-lock-files
Copy the script from `rust-bitcoin`, also add a `just` command to call
it.
2024-03-27 11:17:12 +11:00
Tobin C. Harding c61db1b44f
CI: Check for API changes
Add a job to run the `contrib/check-for-api-changes.sh` script in CI.
2024-03-27 11:16:36 +11:00
Tobin C. Harding 53d34d5ee0
Update the API files
Run `just check-api` and commit the changes. We should have never gotten
to this state, upcoming patch will check for changes in CI.
2024-03-27 11:16:36 +11:00
Tobin C. Harding c3f2c59db1
just: Add a command to check for API changes
Add a command to run the `contrib/check-for-api-changes.sh` script.
2024-03-27 11:16:36 +11:00
Tobin C. Harding 1e22d74270
Add a justfile
The `just` command makes scripts and commands discoverable for new devs
and old devs alike when switching between repos.

Add a justfile copied from bitcoin with changes as required.
2024-03-27 11:09:57 +11:00
Andrew Poelstra 5fa3623acf
Merge rust-bitcoin/rust-secp256k1#689: Allow dead_code on AlignedType
873ad47343 Allow dead_code on AlignedType (Tobin C. Harding)

Pull request description:

  We use the `AlignedType` and take a pointer to its inner data, never access the data directly - this confuses clippy causing a "field is never used" warning.

  Shoosh the lint and add a code comment explaining why.

ACKs for top commit:
  apoelstra:
    ACK 873ad47343

Tree-SHA512: 2a383aed169edf247def5c291bc2d8177cc09412b82bb47bb514e0929ae89d689102e646dcbbffc6fd4caa1ce1430420a63c7ceb3428ad9b05230a93b7f14d16
2024-03-26 22:38:01 +00:00
Tobin C. Harding 873ad47343
Allow dead_code on AlignedType
We use the `AlignedType` and take a pointer to its inner data, never
access the data directly - this confuses clippy causing a "field is
never used" warning.

Shoosh the lint and add a code comment explaining why.
2024-03-26 09:33:38 +11:00
Andrew Poelstra fb676dcb1f
Merge rust-bitcoin/rust-secp256k1#678: schnorr: Change verify_schnorr error return type
adee34fe18 schnorr: Change verify_schnorr error return type (Steven Roose)

Pull request description:

  Bumped into this.

ACKs for top commit:
  Kixunil:
    ACK adee34fe18
  tcharding:
    ACK adee34fe18
  apoelstra:
    ACK adee34fe18

Tree-SHA512: 7ddad93fc69e36d7d33b54526b7c108df9fc69e6153eb583a69eca840c3bd095bcabe03c32ad21577e0fe1a12f1d191d7f5b7edd722fd20ecc200a30c8ee4d25
2024-01-31 21:32:38 +00:00
Steven Roose adee34fe18
schnorr: Change verify_schnorr error return type
From InvalidSignature to IncorrectSignature; the former prints the
message "malformed signature", which doesn't represent the correct
error.
2024-01-31 15:19:42 +00:00
Andrew Poelstra a1d8c90a46
Merge rust-bitcoin/rust-secp256k1#677: bump version to 0.28.2
1a162faf40 bump version to 0.28.2 (Andrew Poelstra)

Pull request description:

  Minor version which just adds some methods to various types.

ACKs for top commit:
  Kixunil:
    ACK 1a162faf40

Tree-SHA512: d93b1abc04d6165bf121f9385683178ada0103501a3de198772b992e2c01e8d9e742f7cd111fdaef825be4fd989d01b6928f2dece4fd78e286798ee905ce9e42
2024-01-31 14:26:06 +00:00
Andrew Poelstra 1a162faf40
bump version to 0.28.2 2024-01-31 13:33:21 +00:00