Commit Graph

1044 Commits

Author SHA1 Message Date
Andrew Poelstra b00b1943e5
Merge rust-bitcoin/rust-secp256k1#483: move some unsafe code inside an unsafe{} boundary
0f29348b6c move some unsafe code inside an unsafe{} boundary (Andrew Poelstra)

Pull request description:

  An internal function had a non-unsafe signature but could be called
  with data that would cause it to exhibit UB. Move the unsafety inside
  of the function so that the function signature now enforces soundness.

  Fixes #481

Top commit has no ACKs.

Tree-SHA512: b1ffc643aa11e9c8d0b7a32965a1504da14f6ac3f9e0aa175d2c09d7d7b6bf84e228f64e1f57800d75500e2c65066a4991f0070a3a1d0a19c1bd84ca0dd44363
2022-08-13 14:28:13 +00:00
Andrew Poelstra 0f29348b6c move some unsafe code inside an unsafe{} boundary
An internal function had a non-unsafe signature but could be called
with data that would cause it to exhibit UB. Move the unsafety inside
of the function so that the function signature now enforces soundness.

Fixes #481
2022-08-12 16:02:55 +00:00
Andrew Poelstra 89670c7a31
Merge rust-bitcoin/rust-secp256k1#484: Fix clippy warnings
6e98ec0475 Fix clippy warnings (Tobin C. Harding)

Pull request description:

  Clippy default settings seemed to have changed introducing a few new warnings.

  warning: variable does not need to be mutable
  warning: deref on an immutable reference
  warning: returning the result of a `let` binding from a block

  Fix them all in a single patch because CI has to pass for each patch.

  cc apoelstra, turns out you were right I was wrong, clippy did change, cannot remember which PR we were discussing it on.

ACKs for top commit:
  apoelstra:
    ACK 6e98ec0475

Tree-SHA512: 0d0a4d21861f4e0bf27beb4c8f0b46708ca769252582f8133d35013070510dfc997a1e414dd97e8dfcab2afc39fcee61d6fa3c28012b109a81036d6c7d4bfda1
2022-08-12 16:00:31 +00:00
Tobin C. Harding 6e98ec0475 Fix clippy warnings
Clippy default settings seemed to have changed introducing a few new
warnings.

warning: variable does not need to be mutable
warning: deref on an immutable reference
warning: returning the result of a `let` binding from a block

Fix them all in a single patch because CI has to pass for each patch.
2022-08-12 12:58:00 +10:00
Andrew Poelstra 7fde332507
Merge rust-bitcoin/rust-secp256k1#480: Run `shellcheck` on the ci script
1bbc1e7628 Explicitly set RUSTDOCFLAGS (Tobin C. Harding)
bf95a02263 Use the STD_FEATURES list (Tobin C. Harding)
c8dc4b6410 Remove TOOLCHAIN (Tobin C. Harding)
d14cccbad5 Add alloc to features (Tobin C. Harding)
1194591fa1 Use set -ex instead of /bin/sh -ex (Tobin C. Harding)

Pull request description:

  The first 3 patches are preparatory cleanup in line with what has been done lately in `rust-bitcoin`. The last two are real bugs found by `shellcheck`.

  Props to dpc for putting me on to `shellcheck`.

ACKs for top commit:
  apoelstra:
    ACK 1bbc1e7628

Tree-SHA512: 9eac1e8a19f2fb7d7413c8b76d8b8c14c1ec88e523565b4b907ef595496e0e59f9ae33896024211990cc59bf82bb36cba09dabeb28605e50d5db075bbe39457a
2022-07-22 20:19:50 +00:00
Tobin C. Harding 1bbc1e7628 Explicitly set RUSTDOCFLAGS
shellcheck emits these two warnings:

  SC2097: This assignment is only seen by the forked process.
  SC2098: This expansion will not see the mentioned assignment.

Set `RUSTDOCFLAGS` explicitly to `--cfg=fuzzing` instead of trying to
use the `RUSTFLAGS` variable.
2022-07-22 11:37:43 +10:00
Tobin C. Harding bf95a02263 Use the STD_FEATURES list
We define a list of features that should be tested along with "std" but
we don't actually use it. Add a call to `cargo test` that enables "std"
and all the features from `STD_FEATURES`.

Found by `shellcheck`.
2022-07-22 11:35:15 +10:00
Tobin C. Harding c8dc4b6410 Remove TOOLCHAIN
We can use the already provided `RUSTUP_TOOLCHAIN` to control the Rust
toolchain, no need for our own custom env variable.
2022-07-22 11:32:51 +10:00
Tobin C. Harding d14cccbad5 Add alloc to features
Remove the comment and add "alloc" to the features list now that we have
bumped the MSRV.
2022-07-22 11:31:54 +10:00
Tobin C. Harding 1194591fa1 Use set -ex instead of /bin/sh -ex
Simply because it is subjectively more typical and easier to see; use
`set -ex` instead of `-ex` on the shebang line.
2022-07-22 11:30:53 +10:00
Andrew Poelstra 576e10b23e
Merge rust-bitcoin/rust-secp256k1#475: Upgrade bitcoin hashes
d31bbc1723 Bump version number to v0.24.0 (Tobin C. Harding)
6062ea7d54 Upgrade to bitcoin_hashes v0.11.0 (Tobin C. Harding)
510e58a949 Remove leading whitespace character (Tobin C. Harding)

Pull request description:

  We have updated the `bitcoin_hashes` version, this requires a minor version bump and release.

  - Patch 1: trivial clean up in the manifest
  - Patch 2: upgrade `bitcoin_hashes` dependency

ACKs for top commit:
  sanket1729:
    utACK d31bbc1723.
  apoelstra:
    ACK d31bbc1723

Tree-SHA512: 940f30218955a9f47d253764143b80868ea2f9d53503c00a71938ec19082f3081e7cfe9dd9bef2bc6ef304344645bdd4ed3d6bbfba332f4a94e5c70e381b6f88
2022-07-19 22:24:30 +00: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
sanket1729 125211db5b
Merge rust-bitcoin/rust-secp256k1#474: Disable re-randomization under more conditions
d206891eaa bump version to 0.23.4 (Andrew Poelstra)
b01337cfb5 context: unconditionally disable auto-rerandomization on wasm (Andrew Poelstra)
748284633b apply `global-context-not-secure` logic to Secp256k1::new (Andrew Poelstra)

Pull request description:

  Fixes #470

ACKs for top commit:
  Kixunil:
    ACK d206891eaa
  tcharding:
    ACK d206891eaa
  sanket1729:
    ACK d206891eaa

Tree-SHA512: 2a7db5b75f55a007aa780b6317804c819c0366e207623220f72a06c2af09087accf1bc834f05899897afcc2035f5e9a5480d8a7ffff83536327c695602ba138d
2022-07-19 00:23:50 -07:00
Andrew Poelstra d206891eaa bump version to 0.23.4 2022-07-14 14:10:59 +00:00
Andrew Poelstra b01337cfb5 context: unconditionally disable auto-rerandomization on wasm
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.
2022-07-14 14:08:04 +00:00
Andrew Poelstra 748284633b apply `global-context-not-secure` logic to Secp256k1::new
Disable auto-rerandomization for both global and local contexts.
2022-07-14 14:06:41 +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 ddc108c117 Increase heading size
Currently the main heading of the readme uses a level three markdown
heading, this is quite small. Use level two instead.
2022-07-13 14:34:16 +10:00
Tobin C. Harding 596adff8ba Remove unneeded whitespace
We do not customarily put two lines of whitespace before modules.

Remove unneeded whitespace from before the `benches` module.
2022-07-13 14:30:17 +10:00
Andrew Poelstra 6741aa0284
Merge rust-bitcoin/rust-secp256k1#472: Remove unnecessary instances of must_use
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
2022-07-11 15:18:57 +00:00
Tobin C. Harding d2c97d43d8 Remove unnecessary instances of must_use
`Result` is already `must_use`, adding the compiler directive to
functions that return `Result` is unnecessary.
2022-07-11 07:56:47 +10:00
Andrew Poelstra 3f99ae8f1f
Merge rust-bitcoin/rust-secp256k1#468: Release tracking issue - v0.23.3
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
2022-06-29 12:43:50 +00:00
Andrew Poelstra ce8883ceea
Merge rust-bitcoin/rust-secp256k1#467: Add NIGHTLY variable to CI script
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
2022-06-29 12:41:16 +00:00
Tobin C. Harding 5f611f6f7f Conditionally compile the hex macro
We only use this macro when not fuzzing, add a cfg attribute to build it
in only when needed.
2022-06-29 11:11:39 +10:00
Tobin C. Harding 69349a858f Add NIGHTLY variable to CI script
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`.
2022-06-29 11:11:34 +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
Tobin C. Harding a5918c615a Posthumously add changelog entry for 0.23.2
We did a quick point release but omitted the changelog entry, lets add
it posthumously for completeness.
2022-06-29 10:56:47 +10:00
Andrew Poelstra 5f59820a8a
Merge rust-bitcoin/rust-secp256k1#465: Add must_use for mut self key manipulation methods
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
2022-06-28 14:56:58 +00:00
Andrew Poelstra 16b740265d
Merge rust-bitcoin/rust-secp256k1#466: Hot Fix: Use fuzzing not feature = "fuzzing"
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
2022-06-28 14:48:23 +00:00
Tobin C. Harding 0c15c01eb1 Use fuzzing not feature = "fuzzing"
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.
2022-06-28 13:30:33 +10:00
Tobin C. Harding 56f18430ff Add must_use for mut self key manipulation methods
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`.
2022-06-28 13:18:57 +10:00
Tobin C. Harding 5b86e38aea Put compiler attributes below rustdocs
It is conventional, at least within the `rust-bitcoin` organisation to
put compiler attributes _below_ the associated rustdocs.
2022-06-28 13:07:08 +10:00
Andrew Poelstra e8454cdc50
Merge rust-bitcoin/rust-secp256k1#464: Bump version to 0.23.2
141f2d1dbc Bump version to 0.23.2 (Artem Vorotnikov)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK 141f2d1dbc

Tree-SHA512: 931b4ad992f7f00640edae08fcb6ba7bacccf088f54adab7820207dd6d980788922b0596c45ef30e4b949a156f9e67b48cb20f79b033fda31dbde3c857d3bfd6
2022-06-27 18:15:22 +00:00
Artem Vorotnikov 141f2d1dbc
Bump version to 0.23.2 2022-06-27 20:11:03 +03:00
Andrew Poelstra 2b8297a468
Merge rust-bitcoin/rust-secp256k1#462: derive Hash for RecoverableSignature
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
2022-06-27 14:02:41 +00:00
NicolaLS e275166652 derive Hash for RecoverableSignature 2022-06-27 14:16:49 +02:00
Andrew Poelstra 234ba5c6f5
Merge rust-bitcoin/rust-secp256k1#461: Move cbor to dev-dependencies
74ec3eff70 Move cbor to dev-dependencies (Artem Vorotnikov)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK 74ec3eff70

Tree-SHA512: 19228e31f994b4befa5b533ed1ddcac024e87d421b2d6bebc690886a8af87d3c0909e023a7a36f43cf50b8914ee79828f186b048fd5b38c151917abdcbf1f53b
2022-06-24 16:30:32 +00:00
Artem Vorotnikov 74ec3eff70
Move cbor to dev-dependencies 2022-06-24 17:30:25 +03:00
Andrew Poelstra 8d84857bff
Merge rust-bitcoin/rust-secp256k1#460: HOT FIX: Enable "rand/std_rng" feature
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
2022-06-24 12:20:31 +00: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 ff7c34792a
Merge rust-bitcoin/rust-secp256k1#457: secp256k1-sys: bump version to 0.6.0
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
2022-06-22 17:02:29 +00:00
Andrew Poelstra 568f16a519
Merge rust-bitcoin/rust-secp256k1#458: Removed `Default` from `SerializedSignature`
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
2022-06-22 16:59:58 +00:00
Martin Habovstiak b18f5d0454 Removed `Default` from `SerializedSignature`
`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
2022-06-22 00:29:57 +02:00
Andrew Poelstra 7975be53cf
Merge rust-bitcoin/rust-secp256k1#456: `SerializedSignature` improvements
0e0fa06e41 Simplify `Display` impl of `SerializedSignature` (Martin Habovstiak)
5d51b9d94b Added `MAX_LEN` constant to `serialized_signature` (Martin Habovstiak)
e642a52e7d Add `#[inline]` to methods of `SerializedSignatre` (Martin Habovstiak)
e92540beb8 `impl IntoIterator for SerializedSignature` (Martin Habovstiak)
7f2d3d2452 Move `SerializedSignature` into its own module (Martin Habovstiak)
901d5ffeb9 `impl<'a> IntoIterator for &'a SerializedSignature` (Martin Habovstiak)
1d2a1c3fee Deduplicate `self.data[..self.len]` expressions (Martin Habovstiak)

Pull request description:

  This

  * Deduplicates slicing operations
  * Implements `IntoIterator` (owned and borrowed)
  * Reorganizes the code for better clarity
  * Adds `#[inline]`s
  * Checks length set by libsep256k1

  Closes #367
  Closes #368

  Individual commits are hopefully easier to review.

ACKs for top commit:
  apoelstra:
    ACK 0e0fa06e41

Tree-SHA512: bbc759af767c8b84bfd6720456efc1e86da501aa193641dae3c99847a3c882f7d4aa7e5cbec074fdd9c2595f1f65e5fbb4c80620539a6357927149e5c2fbc734
2022-06-21 20:46:42 +00: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