Commit Graph

1216 Commits

Author SHA1 Message Date
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
Andrew Poelstra 9bc110b7d2
Merge rust-bitcoin/rust-secp256k1#676: Add byte accessors to `ElligatorSwiftSharedSecret`
7fe89c488b Add byte accessors to `ElligatorSwiftSharedSecret` (Martin Habovstiak)

Pull request description:

  The inner bytes of `ElligatorSwiftSharedSecret` were almost inaccessible making the type almost useless, so this commit adds methods to access inner bytes.

  Closes #675

ACKs for top commit:
  apoelstra:
    ACK 7fe89c488b

Tree-SHA512: 5ec457401c83423b180f7a6f28048f93040c39129050707b981d1c113e3daa85a37b3f848e61cd3230cc26db4a783e561b77e09b766fd8193d8f7bf187214091
2024-01-30 18:15:11 +00:00
Martin Habovstiak 7fe89c488b Add byte accessors to `ElligatorSwiftSharedSecret`
The inner bytes of `ElligatorSwiftSharedSecret` were almost inaccessible
making the type almost useless, so this commit adds methods to access
inner bytes.

Closes #675
2024-01-30 17:01:23 +01:00
Andrew Poelstra 4dede134de
Merge rust-bitcoin/rust-secp256k1#611: Impl Ord and PartialOrd for RecoverableSignature
dbc546596f Impl Ord and PartialOrd for RecoverableSignature (benthecarman)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK dbc546596f oops, sorry!

Tree-SHA512: decda6b6e7a4929147f5ca00cb2802037c6a297aa816c253e181f1a85ec9e46958469b9d481e2b4aba2c6d86def80bba33a62c507459d82c86cfed4271a23eea
2024-01-22 18:45:45 +00:00
benthecarman dbc546596f
Impl Ord and PartialOrd for RecoverableSignature 2024-01-22 14:50:29 +00:00
Andrew Poelstra f96fcd8fcf
Merge rust-bitcoin/rust-secp256k1#674: Derive Hash for Scalar
f87dc91151 Derive Hash for Scalar (Jiri Jakes)

Pull request description:

  Unless there is some safety concern I cannot see, having Scalar implementing Hash would be useful.

ACKs for top commit:
  Kixunil:
    ACK f87dc91151
  apoelstra:
    ACK f87dc91151

Tree-SHA512: 276670a3d938fade3828123547b01e38b1a3c56775fb3c545d2c392622de808cf2bf8125925c7896ee27bacd5897d88908384d8c157dc8ec7d605781475964fd
2024-01-18 16:23:05 +00:00
Jiri Jakes f87dc91151
Derive Hash for Scalar 2024-01-18 19:23:31 +08:00
Andrew Poelstra a771f6c722
Merge rust-bitcoin/rust-secp256k1#672: release 0.28.1
0ed5a55829 release 0.28.1 (Andrew Poelstra)

Pull request description:

  We need a new rust-secp release to deal with the new rust-secp-sys release.

ACKs for top commit:
  sanket1729:
    utACK 0ed5a55829
  Kixunil:
    ACK 0ed5a55829

Tree-SHA512: 6d54acce52acc03d09272a20242e9a086783e471153d77d10f21bf8924595d43717fd85e8aa4a9b7075c93a04ad88404377e06ca5200b1c9b45c08c01d6f77a8
2024-01-03 19:58:02 +00:00
Andrew Poelstra 0ed5a55829
release 0.28.1 2024-01-03 19:54:01 +00:00
Andrew Poelstra 60a5e36c14
Merge rust-bitcoin/rust-secp256k1#670: fix incorrect FFI binding for pubkey_combine
3373cc930e secp256k1-sys: update all symbols from 0.9.1 to 0.9.2 (Andrew Poelstra)
484e5d8d5b fix incorrect FFI binding for pubkey_combine (Andrew Poelstra)

Pull request description:

  Fixes #669.

  Needs backport.

ACKs for top commit:
  Kixunil:
    ACK 3373cc930e

Tree-SHA512: 602a5baa8095cc744a341d64e300185bce26c8c56e7a538d3b17c7ca4c98cb3244217cd34169e1e69dc904a9f9f28ed75fe096ffa95ea42d1ad3456d395f7ce5
2024-01-03 19:12:05 +00:00
Andrew Poelstra 3373cc930e
secp256k1-sys: update all symbols from 0.9.1 to 0.9.2 2024-01-02 16:22:20 +00:00
Andrew Poelstra 484e5d8d5b
fix incorrect FFI binding for pubkey_combine 2023-12-18 21:28:27 +00:00
Andrew Poelstra 97dade5581
Merge rust-bitcoin/rust-secp256k1#668: secp256k1-sys: Bump version to 0.9.1
c1ccda18b6 secp256k1-sys: Bump version to 0.9.1 (Tobin C. Harding)

Pull request description:

  In preparation for doing a point release add a changelog entry, bump the version, and update all the `0_9_0` identifiers in the vendored code.

  Done so we can release the wasm-build bug fix.

  Fix: #667

ACKs for top commit:
  apoelstra:
    ACK c1ccda18b6

Tree-SHA512: 4fda58bd2d97b73280c00f06109d4ecf913e87ecbd1e31465efe94b96589c819ffda0ae5c622428f0a7f2e09ec45033a0e683dfd954cf06369aac6b9369471c1
2023-12-06 23:40:22 +00:00
Tobin C. Harding c1ccda18b6
secp256k1-sys: Bump version to 0.9.1
In preparation for doing a point release add a changelog entry, bump the
version, and update all the `0_9_0` identifiers in the vendored code.

Done so we can release the wasm-build bug fix.
2023-12-07 10:21:38 +11:00
Andrew Poelstra 023d50b4db
Merge rust-bitcoin/rust-secp256k1#663: Patch out any instances of printf in upstream
7a0c60edcd secp256k1-sys: patch out checked_malloc (Andrew Poelstra)
942a0e5e2c build.rs: patch out any calls to `printf` (Andrew Poelstra)
51dab7ac04 vendor-libsecp: remove util.h patch (Andrew Poelstra)

Pull request description:

  Rather than using a new patchfile, just `#define` it away. Also includes a commit which removes one of the existing patchfiles, which I discovered was out of date while auditing the others to see if they could be replaced by `#define`s. (No, they cannot.)

  Fixes #660

ACKs for top commit:
  tcharding:
    AFAICT this is right to go, ACK 7a0c60edcd
  Kixunil:
    ACK 7a0c60edcd

Tree-SHA512: 83ba70b000919fb8a929804c9d5929a9929b80515f0594925d3789ef896889d3c909f9fa920bac45470611607b84f509723544fa442ff1a51eefba0de75bf68f
2023-11-15 18:28:10 +00:00
Andrew Poelstra 4244fec9ad
Merge rust-bitcoin/rust-secp256k1#666: Remove unnecessary code comment
458712212d Improve code comments (Tobin C. Harding)

Pull request description:

  These comments say what the code is doing, they add no value.

ACKs for top commit:
  Kixunil:
    ACK 458712212d
  apoelstra:
    ACK 458712212d

Tree-SHA512: 0f31d36d7dfbde5bf32d622c3ba1845d5c6989c3eff0e520b77eeee595453299551172331851176e50aef4f78eacb7033c0ff798077e44e1c63313013b073f0b
2023-11-15 18:09:23 +00:00
Tobin C. Harding 458712212d
Improve code comments
"what" comments add no value. Remove one and make the other describe
"why" the cast is ok.
2023-11-15 10:13:50 +11:00
Andrew Poelstra 7a0c60edcd
secp256k1-sys: patch out checked_malloc 2023-11-06 14:50:13 +00:00
Andrew Poelstra fb280a3179
Merge rust-bitcoin/rust-secp256k1#664: Fix unit test import statements
dd6bf7c10d Fix unit test import statements (Tobin C. Harding)

Pull request description:

  In `lib.rs` unit tests we are getting build warnings because of how we are importing things, just import with `super::*` unconditionally and be done with it.

  This patch is the only good one out of #661.

ACKs for top commit:
  apoelstra:
    ACK dd6bf7c10d
  Kixunil:
    ACK dd6bf7c10d

Tree-SHA512: 3970f4c1374ec6de4798bfb52b561e9ac4611ec3a3885edc79639566f777e1fbb502cb36fa7abd015f3fd4a9ca4b6a4931b4ecb2e629e967b4e49391db97a97f
2023-11-03 19:33:50 +00:00
Andrew Poelstra 09810e7fd8
Merge rust-bitcoin/rust-secp256k1#659: Implement `Ord` for `SerializedSignature`
e55c1f0960 Implement `Ord` for `SerializedSignature` (Martin Habovstiak)

Pull request description:

ACKs for top commit:
  tcharding:
    ACK e55c1f0960
  apoelstra:
    ACK e55c1f0960

Tree-SHA512: b9a7529f44e5d38ab449af7ee06007f3d0480b31cb21c371190f71bea4e3d9142c6c249fcc5564aa21139c0bdcd3951823cea70f29a63f3ef6d35b7e9c7a8e8c
2023-11-02 11:53:21 +00:00
Andrew Poelstra 942a0e5e2c
build.rs: patch out any calls to `printf` 2023-11-01 17:34:21 +00:00
Andrew Poelstra 51dab7ac04
vendor-libsecp: remove util.h patch
This patch adds a declaration of the `ecdsa_parse_compact` function to
util.h. This function isn't called from within libsecp proper; it is
called in lax_der_parse.c (which we patch separately with a declaration)
and in example code (which we don't compile at all).
2023-11-01 17:01:04 +00:00
Tobin C. Harding dd6bf7c10d
Fix unit test import statements
In `lib.rs` unit tests we are getting build warnings because of how we
are importing things, just import with `super::*` unconditionally and be
done with it.
2023-11-01 09:06:16 +11:00
Martin Habovstiak e55c1f0960 Implement `Ord` for `SerializedSignature` 2023-10-31 20:23:27 +01:00
Andrew Poelstra fe2905d8e3
Merge rust-bitcoin/rust-secp256k1#658: Serialized signture improvements
62c839c9e0 Implement conversion traits (Martin Habovstiak)
dc3eab7aaa Implement `Borrow<[u8]>`, `PartialEq<[u8]>`, `Hash` (Martin Habovstiak)
7dac91d973 Deprecate `capacity` and `is_empty` (Martin Habovstiak)

Pull request description:

  This deprecates methods returning constants and impls a few traits.

ACKs for top commit:
  apoelstra:
    ACK 62c839c9e0

Tree-SHA512: 724a08af7dc915e166e3efcdc4be681a53ae14a55d9cbd62dd4c5240fa8c0f13110498d03ebb0edc1d56f969901f978aa33bae9df19376957ff7f51698ed9535
2023-10-31 15:12:35 +00:00
Martin Habovstiak 62c839c9e0 Implement conversion traits
Converting signature to serialized signature and back is natural, so the
conversion traits should be implemented.
2023-10-31 15:07:01 +01:00