Use libfuzzer instead of honggfuzz#60
Merged
shinghim merged 43 commits intocargo-fuzzfrom Dec 21, 2025
Merged
Conversation
ad87f25 to
fa956fd
Compare
As part of discussion rust-bitcoin#5331, `bitcoin` and `p2p` should not depend on each other and should instead mutually depend on `primitives`, `hashes`, etc. BIP-158 is the last remaining dependency from `bitcoin` in `p2p`. It is not a peer-to-peer specification, but it is not an essential module of `bitcoin` either. IMO the best option for this module is to release it as a crate. Blaming the module shows it hasn't changed architecturally in many years. A new crate would allow us to revisit some of the design choices. Particularly the heavy use of generics, dependency on `io` that could be replaced by `consensus_encoding`, and perhaps an opportunity to benchmark and improve performance.
Me had trouble because of automatic resolution of RC depencies by `cargo`. So now we want to pin to a specific version using the "=X.Y.Z.rc.x" syntax. Do so for all dependencies that are currently in an RC cycle.
Use the new type name and stop using the deprecated one.
We are calling a deprecated function provided `primitives`, as part of the `primitives` release first remove the call and use the new non-deprecated function.
Do another RC round. Remembering to remove all the TBDs. (Note I did not check if anything needs to go in the changelog.)
…value in satoshis
Cargo does not support inheriting workspace lint configs and then overwriting them at the package manifest level. But you can overwrite them in the code itself, like enabling in lib.rs for a package. This isn't great having settings in two spots, but maybe ok for specific settings.
These types are defined in [BIP-157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki#specification). Defining these types within `p2p` is appropriate, as these are used for wire messages. By doing this move 1. no other crates would depend on `bip158` 2. we are adhering to the policy that a crate with a release that matches the BIP must implement only that BIP. As part of this move, a single test `assert` is removed, but this was testing a method that didn't make much sense in the first place. If a user wants to get a filter header, they should use the filter hash and filter header directly.
This breaks another link between p2p and bitcoin. p2p is focused on encoding and decoding the peer to peer messages, the POW verification should probably be on the caller or perhaps added to the primitives decoder.
And add a test case that was previously failing.
For the stabilising crates we would like test code to be treated as a first class citizen. In my book that means clean AF. Audit all three crates and put the feature gate attributes below the `#[test]` attribute, based on two things: - Uniformity (we could arbitrarily pick either) - Puts the more important thing closer to the code (subjective)
`rc` is definitely different to alhpa/beta but the difference between alpha and beta is not so clear. Also we have numbers as well (eg `-beta.0`, `-beta.1`). In `secp256k1` we chose to use `-beta.0`, shall we just do the same here?
I never was really happy with the local variable `rinsed` but never came up with a better one. In rust-bitcoin#5386 Mitch introduced `roundtrip` instead, I like that better - use it everywhere.
The MSRV and License sections in each package are redundant with the required information in the package manifest. The manifest info is already shown on sites like crates.io, so not much benefit of listing it twice. This removes another spot to update on changes.
Cleaning up some duplicate docs between the workspace README and CONTRIBUTING. This patch treats the README as docs for an end user, while CONTRIBUTING is more targeted at maintainers.
These structs only contain integers or references, so they should be Copy.
Use the new `consensus_encoding` crate (by way of the `io` crate decoding function) to implement `consensus_decode` for `Witness`. This is ugly a bit ugly because we remove equality derives from `ParseError` so that we can jam the witness decoding error into it. Cleanly it should not go there but in order to keep `encode::deserialize_partial` working we have to be able to return a `ParseError` and we have to be able to include the witness decoding error if there was one. Each subsequent time we try to do this in other decoding impls we will add a new error variant each time also. This encoding code is on its way out and will hopefully be deprecated soon so I believe this is ok.
Run `just fmt` then add `;` to two lines where the formatter changes
`{ some statement }` into
```
{
some statement
}
```
The the linter warns because no trailing `;`.
We don't need this atm, found by clippy while updating nightly toolchain.
The encoding/decoding and serde functionality of BlockTime is not covered in existing tests. Add tests to cover BlockTimeEncoder, BlockTimeDecoder and the Serialize + Deserialize traits on BlockTime.
Quick before someone has a seizure.
There are new mutants in the Witness::size() function. Add a test to improve coverage and kill the mutants.
There are new mutants from two deprecated functions in the units module. Exclude them from mutation testing.
Currently only stable crates have API files. Since some features may cross crate boundaries, and involve breaking changes to the API of crates under the stable crates, it's important to track the API of these crates also. Add internals to check-api just function and add initial API files.
Following the change to CompactSizeEncoder::new to take a usize, the return types and ranges of the CompactSizeEncoder and CompactSizeDecoder now differ. Since a device's memory addressing is limited to usize, returning values beyond that size is largely useless. Converting the CompactSizeDecoder to return a usize also allows the cast_to_usize_if_valid function to be merged into the decoder itself. Convert the CompactSizeDecoder to return a usize. Remove cast_to_usize_if_valid and introduce its functionality into CompactSizeDecoder.
The primitives crate only uses the arrayvec crate to provide Display trait for Header. In order to minimise the use of external dependencies, it should be removed. Convert Header Display impl to use fmt_hex_exact! and remove the arrayvec dependency from primitives.
Consolidate dependency tree for downstream crates that depend on `bitcoin-p2p-messages` and `bitcoin-primitives` by reducing overlapping dependencies. For example, consider crate A which depends on `bitcoin-primitives` and `bitcoin-p2p-messages`. For types defined by both `bitcoin-primitives` and `bitcoin`, Crate A may still need to depend on `bitcoin` if a type of `bitcoin-p2p-messages` depends on `bitcoin` instead of `bitcoin-primitives`.
Enable use of `primitives` from bitcoin, eg: `use bitcoin::primitives`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.