Commit Graph

11 Commits

Author SHA1 Message Date
Tobin C. Harding db5c8fe61c Move the taproot module to crate root
We are trying to flatten the `util` module. The `taproot` module can
live in the crate root. If/when we create a `crypto` module/crate we may
wish to pull some stuff out of this module but for now moving it gets us
closer to removing `util` without making the directory structure any
worse.

Includes adding rustfmt attributes to skip formatting of macros.
2022-11-30 12:03:39 +11:00
Andrew Poelstra 9266b1bbe0
Merge rust-bitcoin/rust-bitcoin#1260: Create `crypto` module
2df51dae15 Create crypto module (Tobin C. Harding)

Pull request description:

  Done as part of [util flattening](https://github.com/rust-bitcoin/rust-bitcoin/issues/639).

  Create a `crypto` module and move into it (out of `util`):
  - ecdsa
  - schnorr
  - key

  After review, this PR now includes some type re-names
  - EcdsaSig -> ecdsa::Signature
  - SchnorrSig -> schnorr::Signature
  - EcdsaSigError -> ecdsa::Error
  - SchnorrSigError -> schnorr::Error
  - InvalidSchnorrSigSize -> InvalidSignatureSize  (this is an error enum variant)

ACKs for top commit:
  apoelstra:
    ACK 2df51dae15
  sanket1729:
    ACK 2df51dae15

Tree-SHA512: 7cf63d51ed5fdc737cd59767d9bb96b1e3501634e3aee855493f6a51ad5c5397ce4b25c77f9929abd70d6ceb351fc6520e835da108f4c9a46df5b9c2b52ca6b3
2022-11-29 15:33:18 +00:00
yancy f7a6d17143 Add rand feature flag to the example documentation 2022-11-28 17:10:24 +01:00
Tobin C. Harding 2df51dae15 Create crypto module
Done as part of flattening util.

Currently in `util` module we have a bunch of modules that provide
cryptography related functionality.

Create a `crypto` module and move into it the following:

- ecdsa
- schnorr
- key

To improve uniformity and ergonomics, do the following re-names while we
are at it:

- EcdsaSig -> ecdsa::Signature
- SchnorrSig -> schnorr::Signature
- EcdsaSigError -> ecdsa::Error
- SchnorrSigError -> schnorr::Error
- InvalidSchnorrSigSize -> InvalidSignatureSize  (this is an error enum variant)
2022-11-22 14:09:33 +11:00
Tobin C. Harding 408d7737fb Run cargo fmt
Run the command `cargo +nightly fmt` to fix formatting issues. No other
changes other than those introduced by `rustfmt`.
2022-11-18 13:11:07 +11:00
Tobin C. Harding 6151d4c841 base58: Rename public functions
The `base58` module is for encoding and decoding, it makes sense for the
public functions to be called `encode` and `decode`. We also have some
functions that operate on data with a checksum, for these it makes sense
to tack `check` onto the _end_ of the function name.

With this applied the public API is:

- decode
- decode_check
- encode
- encode_check
- encode_check_to_fmt
2022-10-29 10:35:08 +11:00
Tobin C. Harding c3e4399519 Remove usage of opcodes::all
We have all of the opcodes defined in a submodule called `all`, this
allows wildcard imports without bringing in the other types in the
`opcodes` module.

Use wildcard import `use crate::blockdata::opcodes::all::*` instead of
fully qualifying the path to opcodes.
2022-10-24 13:08:47 +11:00
Tobin C. Harding 7d851b42ee Move serde_string_* macros to the serde_utils module
In preparation for emptying the `internal_macros` module move the
`serde_string_impl` and `serde_struct_human_string_imp` macros to the
`serde_utils` module.

Rationale: `internal_macros` stuff can go over in the `internals` crate
now that we have one. The serde macros could go over there but we have a
`serde_utils` module that holds code for implementing serde traits,
these two macros are exactly that.
2022-10-20 06:15:57 +11:00
Tobin C. Harding 7a1aa2098a Remove code deprecated last release
We give one release cycle for deprecating old code so as to make the
upgrade path easier for downstream users.

Remove code deprecated during the last release (v0.29.0).
2022-09-16 08:08:53 +10: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
Renamed from src/address.rs (Browse further)