Commit Graph

37 Commits

Author SHA1 Message Date
Tobin C. Harding 69e56a64ed
Add bitcoin-units crate
Add a new crate `bitcoin-units`, move the `amount` module over to it and
re-export all types from `bitcoin::amount` so this as not a breaking
change.
2023-12-11 08:52:31 +11:00
Tobin C. Harding 4d5415f835
Add rust-version to the workspace manifests
Add `rust-version = 1.56.1` to all crates in the workspace i.e.,
including `fuzz` but excluding the various test crates.
2023-11-23 06:20:04 +11:00
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 efedf862b0
bitcoin: Bump version number to v0.31.0
In preparation for release of v0.31.0 bump the version number.

The changelog is already up to date because we have done two RC
releases.
2023-10-28 08:32:30 +11:00
Tobin C. Harding 38960ab5a5
Bump version to 0.31.0-rc2
In preparation for doing the next RC release bump the version.
2023-10-18 13:52:49 +11:00
Tobin C. Harding 6731e85dc1
bitcoin: Bump version to 0.31.0-rc1
In preparation for the first rc release; bump the version number.
2023-10-13 08:34:46 +11:00
Andrew Poelstra 539f4ba64c
apoelstra run of generate-files.sh 2023-10-10 14:39:15 -03:00
Einherjar 20f3a05d2a
ci: replace fuzz toolchain
old: `actions-rs/toolchain`
new: `dtolnay/rust-toolchain`

fix

ci(fuzz): change runner to ubuntu-latest

ci: update run syntax in fuzz job

ci: update and run fuzz/generate-files.sh
2023-10-10 14:39:15 -03:00
Andrew Poelstra ab4a48c8ba
ci: use new fuzzing cfg flags when fuzzing bitcoin (but not hashes) 2023-05-01 21:33:11 +00:00
Andrew Poelstra 2860aae1a5
fuzz: don't fuzz hashes against RustCrypto
We should probably restore this in the future, but we need to rethink
how we fuzz hashes -- right now when cfg(fuzzing) is set, we break all
the hash functions in a way that won't match any other library.

We should probably make this breakage opt-in but this will require
buy-in from rust-lightning and maybe others.
2023-04-27 00:24:53 +00:00
Andrew Poelstra fd88e48696
fuzz: remove AFL support
AFAICT we literally never used this; it was available only on the
bitcoin targets and not the honggfuzz ones; AFL has a broken dep
tree (or at least, requires some more MSRV pins that I did not care
to investigate).

Just remove it entirely.
2023-04-27 00:24:52 +00:00
Andrew Poelstra ab467cb091
fuzz: make hongfuzz fuzzing the default feature
This way you can run `cargo clippy --all` in the root, and `cargo hfuzz
run` without modification.
2023-04-27 00:24:52 +00:00
Andrew Poelstra 6534f22362
fuzz: auto-generate CI and Cargo.toml files 2023-04-27 00:24:52 +00:00
Andrew Poelstra 0be75f7edc
move hashes/fuzz into main fuzz/ directory 2023-04-27 00:24:52 +00:00
Andrew Poelstra 5a891dec2d
move bitcoin fuzz targets into bitcoin/ subdirectory 2023-04-27 00:24:52 +00: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
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 cb9893c4a9 Add Target and Difficulty types
Currently we use the `Uint256` type to represent two proof of work
integers, namely target and difficulty (work).

It would be nice to not have a public integer type that is not fully
implemented (i.e., does not implement arithmetic etc as do integer types
in stdlib). Instead of implementing all the stdlib functions we can
instead add two new wrapper types, since these are not general purpose
integers they do not need to implement anything we do not need to use.

- Add a `pow` module.
- Put a modified version of `Uint256` to `pow`.
- Add two new wrapper types `Target` and `Difficulty`.
- Only implement methods that we use on each type.

Note this patch does not remove the original `Uint256`, that will be
done as a separate patch.
2022-09-28 04:16:59 +10:00
Tobin Harding b79c178ea8 Add fuzz test for PrefilledTransaction
Add a simple deserialization fuzz test for `PrefilledTransaction`.
2022-09-16 13:02:24 +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
Andrew Poelstra 0a32525862
fuzz: disable features in honggfuzz 2022-08-30 20:42:28 +00:00
Riccardo Casatta 106acdc3ac
Add fuzzing for Witness struct 2021-12-28 09:56:41 +01:00
Martin Habovstiak 0e1b99359c Added fuzz test for `Script::bytes_to_asm_fmt`
This adds fuzz target for `Script::bytes_to_asm_fmt` which could
panic due to overflow in the past. Fuzzing should decrease the risk of
other panics.
2021-09-30 15:06:18 +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
Matt Corallo 604f1aa56e Add fuzz target comparing native u128 to our Uint type 2020-04-30 19:22:49 -04:00
Steven Roose 30201f3924
Remove Decimal and replace strason with serde_json 2019-06-13 18:29:16 +01:00
Andrew Poelstra 5d7e6bb7a4
Merge pull request #272 from TheBlueMatt/2019-05-net-cleanups
Fix DoS in RawNetworkMessage Deserialization
2019-06-07 11:53:31 +00:00
Matt Corallo 1b2dc9d6b0 Rename deserialize_raw_network_message to make my afl scripts happy 2019-06-05 07:49:19 -04:00
Carl Dong 836fdce475 fuzz: Add fuzzer for RawNetworkMessage. 2019-06-05 07:49:19 -04:00
Steven Roose 7af134ce79
Add fuzz target for Amount parsing 2019-06-04 12:54:12 +01:00
Carl Dong f74ec3e187 Add fuzz testing for PartiallySignedTransaction 2019-02-28 11:11:55 -05:00
Andrew Poelstra 8b6a40f96a add fuzzer for transaction::OutPoint 2018-10-18 23:14:23 +00:00
Matt Corallo ac11191f71 Upgrade AFL to 0.4 with persistent mode fuzzing 2018-09-06 16:58:38 -04:00
Jean Pierre Dudey be0d54738b Add fuzz tests for `Decimal`/`UDecimal` parsing.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 16:21:29 -04:00
Matt Corallo 298ba23876 Add address serialization round-trip fuzzer 2018-03-21 18:44:10 -04:00
Matt Corallo d445eaa8c3 Update fuzzers to match rust-lightning boilerplate 2018-03-21 17:14:41 -04:00
Daniel Lockyer 3cf1ccf8f8 Add fuzzing code 2017-06-07 09:19:25 +01:00