Commit Graph

20 Commits

Author SHA1 Message Date
Tobin C. Harding a41e978855
Update to edition 2021
We just bumped the MSRV to Rust 1.56.1 which includes edition 2021.

Update all crates in this repo to use edition 2021 and build/lint
warnings.
2023-11-23 06:20:03 +11:00
Tobin C. Harding 52c4579057
Enable formatting for hashes
The `hashes` module contains a bunch of arrays, mostly formatted with 8
hex bytes on a line; add `rustfmt::skip` to keep the formatting of
arrays as is.

Remove the exclude for the `hashes` crate. Do not run the formatter,
that will be done as a separate patch to aid review.
2023-03-21 08:33:24 +11:00
Tobin C. Harding d210d2ac83
Enable formatting for util
Remove the exclude for the `util` module. Do not run the formatter,
that will be done as a separate patch to aid review.
2023-03-21 08:33:24 +11:00
Tobin C. Harding 0dcbed3c7b
Enable formatting for blockdata
Add `rustfmt::skip` attribute in a couple of places and then remove the
exclude for the `blockdata` module. Do not run the formatter, that will
be done as a separate patch to aid review.
2023-03-21 08:33:23 +11:00
Tobin C. Harding ef306db5e2
Enable formatting for psbt
Remove the exclude for the `psbt` module. Do not run the formatter, that
will be done as a separate patch to aid review.
2023-03-21 08:33:23 +11:00
Tobin C. Harding c8a3c58786
Enable formatting for crypto
Remove the exclude for the `crypto` module. Do not run the formatter,
that will be done as a separate patch to aid review.
2023-03-21 08:33:23 +11:00
Tobin C. Harding 89143205f9
Enable formatting for consensus
Remove the exclude for the `consensus` module. Do not run the formatter,
that will be done as a separate patch to aid review.
2023-03-21 08:33:22 +11:00
Tobin C. Harding 21d716b313
Use new fn_params_layout option
The `fn_args_layout` rustfmt option was recently changed to
`fn_params_layout`, use the new name.
2023-03-06 10:21:29 +11:00
Tobin C. Harding 2eb68caf81 Remove the rustfmt required_version config option
The `rustfmt` config option `required_version` causes grief in CI
because everytime `rustfmt` is update our `nightly` job fails. Since we
require nightly anyways to run `rustfmt` the config option is basically
redundant.
2023-01-31 08:20:38 +11: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
Andrew Poelstra 99a28db99d
Merge rust-bitcoin/rust-bitcoin#1353: Enable formating of the `network` module
e04a7a926d network: Run cargo fmt (Tobin C. Harding)
dc33c7999f Enable formatting of the network module (Tobin C. Harding)
81f69e846b Exclude from formatting stuff in the network module (Tobin C. Harding)
408d7737fb Run cargo fmt (Tobin C. Harding)
1ecf09359b Add local variable to reduce line length (Tobin C. Harding)
b2e74bc050 Exclude long function call (Tobin C. Harding)
ff5a80dbd3 Exclude formatting of function fmt_satoshi_in (Tobin C. Harding)
308a12b7cf Exclude array from formatting (Tobin C. Harding)
fb7ff46ccc Improve crate root re-exports (Tobin C. Harding)

Pull request description:

  The `network` module is not currently included in formatting. Also, at this point in time not much is happening in the `network` module so formatting it should not cause too many merge conflicts with other in-progress PRs.

  The first 3 patches are formatting preparation of the repo, the next 2 are formatting preparation of the `network` module. The last patch is the result of running `cargo +nightly fmt`. Can one reviewer please verify the last patch consists only of `rustfmt` changes by running the command on their branch. Thanks

  cc luckysori :)

ACKs for top commit:
  apoelstra:
    ACK e04a7a926d

Tree-SHA512: 49b2873f0bfdd448df97073b462fa860c85b7f3c3094fdb0e16fd86aa467156ea8b2ceec61e2ee99848802cd171fd8abbc17e45c66672889a37c413fa4bea636
2022-11-18 23:55:42 +00:00
Andrew Poelstra 349a8a5b4e
Merge rust-bitcoin/rust-bitcoin#1284: Import bitcoin hashes
9674bf29fe hashes: Fix clippy warnings (Tobin C. Harding)
b9643bf3e9 Import bitcoin_hashes crate into hashes (Tobin C. Harding)
580feab3f9 internals: Add CHANGELOG file (Tobin C. Harding)
bae64e156e Move CHANGELOG to bitcoin crate (Tobin C. Harding)
9a2c856be6 Update gitignore file (Tobin C. Harding)

Pull request description:

  #1337 was split out of this in an attempt to help review, I think we can merge this one though now it has some traction.

  We would like to bring the `bitcoin_hashes` crate into the `rust-bitcoin` repository. https://github.com/rust-bitcoin/rust-bitcoin/issues/550#issuecomment-1248071843

  Import `bitcoin_hashes` crate into `hashes`.

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

       commit 2a78c250f78d391599040223870a4d1d6f6f5482

  Please note the commit history of `bitcoin_hashes` is only preserved on the soon-to-be-archived `bitcoin_hashes` repository.

ACKs for top commit:
  sanket1729:
    ACK 9674bf29fe. Did my best to review the CI code, it looks good, and seems like we are testing everything when we add "hashes" to the root level `./contrib/tests.sh`. I would like other reviewers to confirm the same.
  apoelstra:
    ACK 9674bf29fe

Tree-SHA512: db3ce6adeb38430c5a9f372da16be9fb048c2e5cff646b701139fb4b5fa76e10261432284ede7fd139b75cd69bb124d55973ceb7eccaa996226a7be4cad9b68a
2022-11-18 18:32:41 +00:00
Tobin C. Harding dc33c7999f Enable formatting of the network module
Remove the exclude for the `bitcoin/src/network/` directory from the
`rustfmt` config file. Do not run formatter as part of this change, this
allows the actual formatting change to be verified more easily.
2022-11-18 13:11:09 +11:00
Tobin C. Harding 30888f74c5 Move psbt module to crate root module
Move the `psbt` module out of `util` and into the crate root module.
Done as part of an effort to clean up `util`.
2022-11-16 10:43:35 +11: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 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 ee9a3ec6a1 Enable formatter for "src"
Remove the ignore for the "src" directory, this enables the formatter
for all source files in the `src/` directory.
2022-07-19 13:43:12 +10:00
Tobin C. Harding 6461e2db8d Run formatter on examples/
Remove "examples" from the rustfmt ignore list.
2022-07-19 13:43:12 +10:00
Tobin C. Harding fd1c6589ba Add a rustfmt configuration file with explicit ignores
Add a configuration file but explicitly ignore all source files. The aim
of this is that we can then un-ignore files a few at a time and deal
with issues in a small isolated manner.
2022-07-19 13:43:12 +10:00
Tobin Harding 08428ba32b Add a disabled rustfmt.toml
We do not currently use `rustfmt`, this is a nuisance for devs who
routinely work on code bases that do use rustfmt who often have their
editors set to format on save. We can make the life of such devs much
better by explicitly disabling formatting using `rustfmt.toml`.

ref: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#disable_all_formatting
2022-01-21 10:00:46 +11:00