Commit Graph

19 Commits

Author SHA1 Message Date
Tobin C. Harding 0ff8d82193
Make FeeRate from sat constructors infallible
We now have constructors that take an arbitrary size fee
rate (`Amount`). The `from_sat_per_foo` constructors can be made
infallible by taking a `u32` instead of `u64`. This makes the API more
ergonomic but limits the fee rate to just under 42 BTC which is plenty.

Note we just delete the `from_sat_per_vb_u32` function because it is
unreleased, in the past we had `from_sat_per_vb_unchecked` so we could
put that back in if we wanted to be a bit more kind to downstream. Can
be done later, we likely want to go over the public API before release
and add a few things back in that we forgot to deprecate or could not
for some reason during dev.

Fuzz with a new function that consumes a `u32`.
2025-06-16 09:56:42 +10:00
Tobin C. Harding b27d8e5819
Change the internal representation of FeeRate
To get more precision use sats per million virtual bytes.

To make review easier keep most calls in tests using
`FeeRate::from_sats_per_kwu` and just unwrap. These can likely be
cleaned up later on if we want to.

For `serde` just change the module to `_floor` and leave it at that. The
serde stuff likely needs re-visiting before release anyways.
2025-05-31 07:52:31 +01:00
Fmt Bot a74e08a53d 2025-03-16 automated rustfmt nightly 2025-03-16 01:25:25 +00:00
Jamil Lambert, PhD ddb6dd520e
Move module out of fuzz_target directory
The new module `fuzz_utils` in the `fuzz_targets/` directory causes
`verify-execution` to fail.

Move the module to the `src/` directory. Create a `lib.rs` file.
2025-03-07 15:47:39 +00:00
Bruno Garcia 08e0d4f0e5 fuzz: cover minimal_non_dust_custom for Script 2025-03-04 11:13:55 -03:00
Bruno Garcia eb8ecd5e3c fuzz: cover minimal_non_dust for Script 2025-03-03 12:24:15 -03:00
Bruno Garcia cab8a6134f fuzz: cover count_sigops{_legacy} for Script 2025-03-03 12:06:55 -03:00
Bruno Garcia 2688abad19 fuzz: add coverage for Display for Script 2025-02-26 09:04:59 -03:00
Chris Hyunhum Cho 33edaf935d fix: check overflow for push_int with push_int_unchecked 2024-09-25 03:15:03 +00:00
Martin Habovstiak 0857697665 Replace impl blocks with extension traits
In preparation to move script types to `primitives` we replace impl
block with extension traits by replacing the temporary modules with
`define_extension_trait`.
2024-08-13 13:14:00 +02:00
Tobin C. Harding a42bcdc22e
Remove usage of blockdata from paths
the `blockdata` directory is code organisation thing, all the
types/modules are re-exported from other places. In preparation for, and
to make easier, the `primitives` crate smashing work - remove all
explicit usage of `blockdata`.

Note that the few instances remain as they seem required e.g.,

  `pub(in crate::blockdata::script)`

Refactor only, no logic changes.
2024-06-20 12:00:22 +10:00
Shing Him Ng e7f33a2a12 Update PushBytes::read_scriptint(x) to x.read_scriptint() 2024-06-16 17:11:33 -05:00
Divyansh Gupta a336ec0dda refactor(script): move `read_scriptint` to `PushBytes` & create `read_int` function
* Moved read_scriptint method to Push_Bytes struct
 * Created Instruction::read_int method
fix #1547
2024-05-28 15:36:17 +05:30
Tobin C. Harding d4e8f49fc3
Move p2p::constants::Network to crate root
The `Network` type is not a p2p construct, it is more general, used
throughout the codebase to define _which_ Bitcoin network we are
operating on.
2023-08-01 16:46:59 +10:00
Tobin C. Harding 1bac1fd518
Rename the network module to p2p
The `network` module deals with data types and logic related to
internetworking bitcoind nodes, this is commonly referred to as the p2p
layer.

Rename the `network` module to `p2p` and fix all the paths.
2023-08-01 16:36:12 +10:00
Andrew Poelstra 6467728202
fuzz: disable tests unless 'cfg(fuzzing)' is passed; update README for reproducing failures 2023-04-27 00:24:53 +00:00
Andrew Poelstra 6e2ee5be66
fuzz: run 'cargo fmt' on all the fuzz targets 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 5a891dec2d
move bitcoin fuzz targets into bitcoin/ subdirectory 2023-04-27 00:24:52 +00:00
Renamed from fuzz/fuzz_targets/deserialize_script.rs (Browse further)