Commit Graph

208 Commits

Author SHA1 Message Date
Tobin C. Harding 512d982275
Remove path field from internals dependency
We use two different methods for specifying local dependencies, `patch`
and also `path`. There does not seem to be a reason why we use both,
lets be uniform. Elect to use `patch` for all local crates.
2023-07-18 10:27:46 +10:00
Andrew Poelstra e3111c748b
move bitcoin/fuzz into repo root; add to workspace
This allows testing the fuzztests and making sure that they compile and
tests pass, etc., just using `cargo test --all` in the root.
2023-04-27 00:24:48 +00:00
Martin Habovstiak 6acf9ac8b8 Patch hashes and update the code
This patches `bitcoin_hashes` to use the version in the repository and
fixes the code after removal of `Deref`.

This also turns off `AS_DEPENDENCY` check with the intention to refactor
it later.
2022-12-18 14:33:55 +01:00
Tobin C. Harding b9643bf3e9 Import bitcoin_hashes crate into hashes
We would like to bring the `bitcoin_hashes` crate into the
`rust-bitcoin` repository.

Import `bitcoin_hashes` into `rust-bitocin/hashes`, doing so looses all
the commit history from the original crate but if we archive the
original repository then the history will be preserved. We maintain the
same version number obviously and in the changelog we note the change of
repository.

Commit hash that was tip of `bitcoin_hashes` at time of import:

 commit 54c16249e06cc6b7870c7fc07d90f489d82647c7

Includes making `embedded` and `fuzzing` per-crate i.e., move them into
`bitcoin` as hashes includes these also.

NOTE: Does _not_ enable fuzzing for `hashes` in CI.

Notes on CI:

Attempts to merge in the github actions from the hashes crate however reduces
coverage by not running hashes tests for beta toolchain. Some additional
work could be done to improve the CI to increase efficiency without
reducing coverage. Leaving for another day.
2022-11-08 08:58:09 +11:00
Tobin C. Harding 834bbf461f Introduce bitcoin-internals crate
Add a new crate `bitcoin-internals` to be used for internal code needed
by multiple soon-to-be-created crates.

Add the `write_err` macro to `bitcoin-internals`, nothing else.

This patch uses a `path` dependency which means `rust-bitcoin` cannot be
released in its current state, will need to be changed once we release
the `bitcoin-internals` crate on `crates.io`.
2022-09-13 08:59:57 +10:00
Tobin C. Harding 022730bd8d Add a workspace to the top level directory.
Create a directory `bitcoin` and move into it the following as is with
no code changes:

- src
- Cargo.toml
- contrib
- test_data
- examples

Then do:

- Add a workspace to the repository root directory.
- Add the newly created `bitcoin` crate to the workspace.
- Exclude `fuzz` and `embedded` crates from the workspace.
- Add a contrib/test.sh script that runs contrib/test.sh in each
  sub-crate
- Fix the bitcoin/contrib/test.sh script
2022-09-13 08:44:57 +10:00
Tobin C. Harding 110b5d8963 Bump version to v0.29.0
Add changelog notes and bump the version number to v0.29.0.
2022-08-05 11:14:41 +10:00
Tobin C. Harding 7f554774a3 Update bitcoinconsensus dependency
We recently released a couple of new versions of
`rust-bitcoinconsensus`, the first was mainly to move to git subtree,
included in this release was a bump of the patch version of bitcoin
core. The next release updated bitcoin core major version to 0.20.2

Update our bitcoinconsensus dependency to `0.20.2-0.5.0`.
2022-08-04 08:21:41 +10:00
Tobin C. Harding c67f74bb81 Upgrade bech32 to version 0.9.0
Recently `rust-bech32` v0.9.0 was released, this release included
updating the MSRV to 1.41.1.
2022-07-27 12:03:48 +10:00
Arturo Marquez aeede12604
Infallible conversions: `Hash` -> `Message`
Replace all instances of
`secp256k1::Message::from_slice(_).expect(_)` with
`secp256k1::Message::from(_)`.

Also adds an implementation of ThirtyTwoByteHash for
TapSighashHash.

Solves https://github.com/rust-bitcoin/rust-bitcoin/issues/824
2022-07-21 11:26:53 -05:00
Tobin C. Harding df73576515 Upgrade to secp v0.24.0
We just released a new version of `rust-secp256k1`, lets use it.

This also fixes a bug where we upgraded our `bitcoin_hashes` dependency
before secp had done theirs.
2022-07-20 15:44:19 +10:00
Tobin Harding 6967c0ed6f Add psbt example
Add an example PSBT workflow. The workflow we simulate is that of a
setup using a watch-only online wallet (contains only public keys) and a
cold-storage wallet (contains the private keys).

We create and update a PSBT using the watch-only wallet then pass the
PSBT to the cold-storage wallet to sign.

Co-authored-by: Dan Gould <d@ngould.dev>
2022-07-19 10:59:48 +10:00
Andrew Poelstra bd8d9af18a
Merge rust-bitcoin/rust-bitcoin#1092: Create configuration conditional "bench"
f3b2120ec9 Create configuration conditional bench (Tobin C. Harding)
f60c92ca58 Add informative error message to DO_BENCH (Tobin C. Harding)
c6d5a12b60 Add cargo/rustc sanity calls (Tobin C. Harding)
34d5a3141d Put triple ticks on their own line (Tobin C. Harding)

Pull request description:

  Currently we are unable to build with all features enabled with a non-nightly toolchain, this is because of the use of

      `#![cfg_attr(all(test, feature = "unstable"), feature(test))]`

  which causes the following error when building:

   error[E0554]: `#![feature]` may not be used on the stable release channel

  The "unstable" feature is used to guard bench mark modules, this is widely suggested online but there is a better way.

  When running the bench marks use the following incantation:

      `RUSTFLAGS='--cfg=bench' cargo bench`

  This creates a configuration conditional "bench" that can be used to guard the bench mark modules.

  ```
  #[cfg(bench)]
  mod benches {
      ...
  }
  ```

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

Tree-SHA512: 7ec2a501a30bfe2ce72601077cd675cf5e5ac2f0f93f97fc7e83cb7401606b69ae909b35bfc0ace8bd1ea771ca4fba70e2ad9ac9ba26f2b6e371494cf694c0a8
2022-07-17 23:03:37 +00:00
Tobin C. Harding f3b2120ec9 Create configuration conditional bench
Currently we are unable to build with all features enabled with a
non-nightly toolchain, this is because of the use of

    `#![cfg_attr(all(test, feature = "unstable"), feature(test))]`

which causes the following error when building:

 error[E0554]: `#![feature]` may not be used on the stable release
 channel

The "unstable" feature is used to guard bench mark modules, this is
widely suggested online but there is a better way.

When running the bench marks use the following incantation:

    `RUSTFLAGS='--cfg=bench' cargo bench`

This creates a configuration conditional "bench" that can be used to
guard the bench mark modules.

    #[cfg(bench)]
    mod benches {
        ...
    }
2022-07-14 10:21:01 +10:00
Tobin C. Harding 1e46eeaa88 Upgrade to bitcoin_hashes v0.11.0 2022-07-13 09:38:05 +10:00
Tobin C. Harding 36f29d4357 Upgrade to secp256k1 v0.23.0
We recently released a new version of `rust-secp256k1`, upgrade to use
it.
2022-07-12 09:22:55 +10:00
sanket1729 471f90923d
Merge rust-bitcoin/rust-bitcoin#1006: Feature `use-serde` renamed to `serde`
2e7effc604 Feature `use-serde` renamed to `serde` (Martin Habovstiak)

Pull request description:

  Features activating external crates are supposed to have same name as
  those crates. However we depend on same feature in other crates so we
  need a separate feature. After MSRV bump it is possible to rename the
  crates and features so we can now fix this inconsistency.

  Sadly, derive can't see that the crate was renamed so all derives must
  be told to use the other one.

  Replaces #373

ACKs for top commit:
  apoelstra:
    ACK 2e7effc604

Tree-SHA512: b20364b9e8f30c2269bef915e821b2b2ec929e71dd0e88af2bc3a021821f87011d35e095cb8efe99add77a23dde940a17537eb387fb4582b05c57c8679969eb0
2022-06-01 14:29:02 -07:00
sanket1729 68dd23d5ca
Merge rust-bitcoin/rust-bitcoin#993: Replace base64-compat dependency
38c41e4612 Replace base64-compat dependency (Tobin C. Harding)

Pull request description:

  Now that we have MSRV 1.41.1 we can use the more modern `base64` instead of the compat crate. Requires no changes other than changing the dependency.

ACKs for top commit:
  elichai:
    ACK 38c41e4612
  apoelstra:
    ACK 38c41e4612
  sanket1729:
    ACK 38c41e4612

Tree-SHA512: 3b53f7c52c9f8346fe4a958b8a8ffa5312891cbb4ce9f5e413bcad596f416ad2f5d6bbbde8857795544de06eaaa2450e88dde273e3177da918baed264a38d1ec
2022-06-01 11:55:07 -07:00
Martin Habovstiak 2e7effc604 Feature `use-serde` renamed to `serde`
Features activating external crates are supposed to have same name as
those crates. However we depend on same feature in other crates so we
need a separate feature. After MSRV bump it is possible to rename the
crates and features so we can now fix this inconsistency.

Sadly, derive can't see that the crate was renamed so all derives must
be told to use the other one.
2022-05-26 10:10:47 +02:00
Tobin C. Harding 553a6813c5 Do not pin transitive ryu dependency
We do not need to pin the `ryu` transitive dependency now that MSRV is
not 1.29.
2022-05-26 14:50:11 +10:00
Tobin C. Harding 38c41e4612 Replace base64-compat dependency
Now that we have MSRV 1.41.1 we can use the more modern `base64` instead
of the compat crate. Requires no changes other than changing the
dependency.
2022-05-11 10:33:03 +10:00
Tobin C. Harding 9f0c687d89 Enable edition 2018
Add 'edition = "2018"' to the manifest and do a bunch of manual path
fixups (use statements and fully qualified paths).
2022-05-11 10:16:48 +10:00
ass3rt 7db03f27e4 Disable Serde's default-features
We do not need serde/std, only serde/alloc. Serde/std breaks no-std
builds, but serde/alloc does not. Depending on serde/alloc is the more
compatible approach, as the entire library already depends on alloc.
2022-04-25 09:51:02 -05:00
Andrew Poelstra 785be0e27a release 0.28.0 2022-04-05 20:39:13 +00:00
sanket1729 0d29c8388d rust-bitcoin 0.28.0-rc.2 2022-03-28 10:42:22 -07:00
Tobin Harding d68531d815
Update secp256k1 dependency
Update our `rust-secp256k1` dependency to the latest version.

Requires doing:

- Add a new variant to `Error` for the case where parity of the internal
  key is an invalid value (not 0 or 1).
- Use non-deprecated const
2022-03-12 08:12:42 +11:00
Dr Maxim Orlovsky 1b2dbd7c08
0.28.0-rc.1 release 2022-01-17 20:57:27 +01:00
Andrew Poelstra f332a1967e
Merge rust-bitcoin/rust-bitcoin#750: Use `test_data` for big objects, add big block for benchmarking
247a14f4c3 Use test big block for bench_stream_reader instead of making one (Riccardo Casatta)
b92dfbb63f exclude test_data when publishing the crate (Riccardo Casatta)
f5a9681a2a include a big block in test_data, use it for ser/de benchmark (Riccardo Casatta)
09dada55d6 Move bip158 test vectors to test_data (Riccardo Casatta)
06d1a820c3 Remove testnet block hex from tests, use test_data with include_bytes! (Riccardo Casatta)

Pull request description:

  In the first two commits I moved some data from source files to the newly introduced `test_data` dir, including it with `include_[str|bytes]!` macro.

  The second-to-last commit introduces a big block in test_data which is very handy in ser/de benchmark (I used it for #672) because with smaller blocks you may not notice performance improvements.

  Since I don't want to pollute the package the last commit excludes the `test_data` dir from the published package. I think it's fine to do it because dependent packages don't run dependencies tests.

ACKs for top commit:
  apoelstra:
    ACK 247a14f4c3
  Kixunil:
    tACK 247a14f4c3

Tree-SHA512: a2beb635b0a358737d0b57d3e7205b1ddf87652b9a8c889ce63e2867659a8eaf7e43a5b87a453345d56d953745913f40b58596f449e5fbc87340e0dd2aef0727
2022-01-07 20:22:02 +00:00
sanket1729 2178c7367c Update to secp256k1 0.21.2 2022-01-07 04:45:40 +05:30
Riccardo Casatta b92dfbb63f
exclude test_data when publishing the crate 2022-01-06 13:48:05 +01:00
Martin Habovstiak 9ef1c1e64a Fixed docs.rs metadata
This changes `rustc-args`, which doesn't do what we want, to `rustdoc-args`,
which does.
2021-12-17 13:49:54 +01:00
Dr Maxim Orlovsky 4eedd46d58
Hotfix for secp256k1 alloc feature 2021-11-12 21:36:32 +01:00
Dr. Maxim Orlovsky ff1ed818b1
Merge pull request #637 from devrandom/2021-08-no-std-cleanup
no-std cleanup
2021-11-12 20:39:16 +01:00
Martin Habovstiak 95fb4e01f9 Document cargo features
This documents cargo features in two ways: explictly in text and in code
using `#[doc(cfg(...))]` attribute where possible. Notably, this is
impossible for `serde` derives. The attribute is contitional and only
activated for docs.rs or explicit local builds.

This change also adds `package.metadata.docs.rs` field to `Cargo.toml`
which instructs docs.rs to build with relevant features and with
`docsrs` config activated enabling `#[doc(cfg(...))] attributes.

I also took the opportunity to fix a few missing spaces in nearby code.
2021-09-14 12:24:57 +02:00
Devrandom 849ec3f2c8 Enable secp256k1/alloc for no-std 2021-08-02 22:09:14 +02:00
Martin Habovstiak a291fee23c Removed fuzztarget feature
It seems to be unused and when there's a need for it it's better to use
`--cfg fuzzing` as in `rust-secp256k1 ` and `bitcoin_hashes`.
2021-07-29 08:13:25 +02:00
Riccardo Casatta ef69f24fed
Bump version to 0.27.0 2021-07-21 08:53:51 +02:00
Devrandom 4826d0c6cc no_std support
Based on the original work by Justin Moon.

*MSRV unchanged from 1.29.0.*

When `std` is off, `no-std` must be on, and we use the [`alloc`](https://doc.rust-lang.org/alloc/) and core2 crates. The `alloc` crate requires the user define a global allocator.

* Import from `core` and `alloc` instead of `std`
* `alloc` only used if `no-std` is on
* Create `std` feature
* Create `no-std` feature which adds a core2 dependency to polyfill `std::io` features. This is an experimental feature and should be
used with caution.
* CI runs tests `no-std`
* MSRV for `no-std` is 1.51 or so
2021-07-15 09:04:49 +02:00
Andrew Poelstra abff973e83
Merge pull request #601 from LNP-BP/feat/bech32m-1
Bech32m adoption
2021-06-18 21:14:12 +00:00
Sebastian Geisler 055d0fb087 Prepare release 0.26.2 2021-06-08 15:34:27 +02:00
Dr Maxim Orlovsky c1fae03686
Non-API breaking Bech32m adoption 2021-06-08 08:43:39 +02:00
Dr Maxim Orlovsky d2ee8e81f3
Bump version to 0.26.1 2021-06-06 20:04:18 +02:00
Dr Maxim Orlovsky 5b962dc9a9
Updating dependency versions 2021-05-04 03:58:56 +02:00
Dr Maxim Orlovsky 122450b102
Fixing hashes core dependency and fuzz feature 2021-05-04 03:47:34 +02:00
Nadav Ivgi 4a7cf34eeb
Use efficient serialization for non-human-readable formats 2021-01-14 19:36:36 +02:00
Andrew Poelstra 010068ba32 bump version to 0.26 2021-01-12 23:26:10 +00:00
Thomas Eizinger e52e48eebb
Don't enable `recovery` of `secp256k1` in the dependency declaration
Enabling this feature in the dependency declaration defeats the point
of exposing a feature in rust-bitcoin that enables this because
cargo currently does not provide a way to disable a once activated feature.
2021-01-06 12:23:51 +11:00
Thomas Eizinger 68840b65f5
Bump to secp256k1 0.20
This version removes the fuzztarget and endomorphism features.
2021-01-04 15:25:45 +11:00
Steven Roose 94b7371424 Replace serde_struct_impl with derive-based impls 2020-12-30 16:32:52 +01:00
Steven Roose a56712befc
Create tagged taproot hashes 2020-11-30 20:13:11 +00:00