InputWeightPrediction can be used to determine the weight needed
to calculate the effective_value. This simplifies the process for api
consumers by allowing an easier interface with which to use to predict
the weight. Prior to this change, it was required to manually calculate
the predicted weight for whichever input type was to be used.
Update serde from 1.0 to 1.0.103 to align with versions used in other
workspace crates. This makes the dependency constraint match reality
since it was almost always implicitly raised by the other crates.
c55da5c342 Update bip_174.rs (fuder.eth)
Pull request description:
This pull request renames the variable 'indecies' to 'indices' throughout the bip_174.rs file to use the correct plural form of 'index'. The change affects both variable names and comments, ensuring consistent and proper terminology throughout the codebase.
Changes include:
- Renamed 'indecies' to 'indices' in comments
- Renamed the variable declaration and all references
- Updated the for loop iteration
This is a simple terminology correction with no functional changes to the code.
ACKs for top commit:
tcharding:
ACK c55da5c342
apoelstra:
ACK c55da5c3427ff2d850feb2e5891ce5d52cc304ba; successfully ran local tests; lol
Tree-SHA512: 04249c13599824dc56ea8b86ca1b989bc727cad16f771100e1af00017e3c11559a8dd9fc906569bebed94e36119ff4086cc806dda3b7606c011c5bc95f1398b6
b01152ef5d Automated update to Github CI to rustc nightly-2025-04-04 (Update Nightly Rustc Bot)
Pull request description:
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
ACKs for top commit:
tcharding:
ACK b01152ef5d
Tree-SHA512: 720894224ed8f4b49457f13e0fd93eb21fda5ebcdfee59ede998ff1f92ec04554bf923f322aa92e43c9d6d7d79827abd1954d741f467dbd13127038c985394e6
Currently we use a std numeric type for the output of various `Div`
implementations while other ops use `NumOpResult`. This makes it
difficult to chain operations.
Throughout the crate use `Output = NumOpResult<Foo>` when implementing
`Div`.
Later we want to enable users differentiating between an overflow and a
div-by-zero. Explicitly do not implement that yet, done separately to
assist review.
We are going to add implementations of `OptionExt` for various other
types and all impls are almost identical. To make doing so easier
macroize the implementation for `Amount` and `SignedAmount`.
Internal change only, no logic changes.
We currently use the `NumOpResult` for operations involving more than
just amount types (e.g. `FeeRate`) however when the `result` module was
written we only used amount types.
To make the intention of the custom result types more clear introduce a
top level `result` module and move the general code there. Leave the
amount implementations in the `amount` module. Note that both `result`
modules are private.
Move the `OptionExt` impls because later we will add a bunch more of them.
Internal change only, no logic changes.
We currently use the `NumOpResult` for operations involving more than
just amount types (e.g. `FeeRate`) however when the `result` module was
written we only used amount types.
To make the docs and code clearer use 'numeric type' instead of
'amount' in docs. And for local variables use `x` instead of `amount`.
This is docs and internal changes only.
f3cc445c87 Automated update to Github CI to rustc stable-1.86.0 (Update Stable Rustc Bot)
Pull request description:
Automated update to Github CI workflow `semver-checks.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
ACKs for top commit:
tcharding:
ACK f3cc445c87
Tree-SHA512: 1111f912ed137de0b5a328ba5909bcbeb0b8d66e82bf8729e3e3a825c1ba73147fd19200e0c7018a97604535d199ee82b54f515feb83ccee2224cdd4a0a56756
b387b923c8 Update contributing guide re merging and CI (Tobin C. Harding)
Pull request description:
Lately we have had a bunch of new devs bumping PRs trying to get things merged. Everyone gets excited, no need to be too harsh on them. At least we can try to explain why we might be taking so long.
We (*cough* Andrew) runs a custom CI box that leads to slightly unusual merge behaviour in this repo if one is unaware of it.
Document our CI better and ask folk not to bump too much.
ACKs for top commit:
apoelstra:
ACK b387b923c810e72e4da1f538cecf3ac4c3369ddb; successfully ran local tests
Tree-SHA512: 96505714a444b3a3aa86a7e41de6fda954f40a444917a8066fc0c395ac4207a7f4ea310d8e2d7f76c2bfacc1db18047a26536d738c1f1b8bd17a9d09f87d3998
ebaf162a96 Add push_relative_lock_time() and deprecate push_sequence() (Erick Cestari)
Pull request description:
This pr improves the script builder API to better align with Bitcoin semantics when working with relative timelocks:
- Add `push_relative_lock_time()` method that takes a `relative::LockTime` parameter, which correctly represents the semantic meaning when working with CHECKSEQUENCEVERIFY
- Deprecate `push_sequence()` in favor of `push_relative_lock_time()` to avoid confusion between sequence numbers and relative timelocks
This addresses a potential confusion point in the API where developers might incorrectly push raw sequence numbers in scripts when what they actually need is to push a relative locktime value that will be checked against the transaction's sequence numbers by CHECKSEQUENCEVERIFY.
Closes#4301
ACKs for top commit:
apoelstra:
ACK ebaf162a962494329c6cb5f6d375a6a4a97fe83b; successfully ran local tests
tcharding:
ACK ebaf162a96
Tree-SHA512: 52c37b6e8bbcaa3f9346c5fd5db26eba69169bce13f915906df95fdc65204067fd75f803f8b5adad76978c9baad553c99281628736db4d1d317b149ab257d81f
Lately we have had a bunch of new devs bumping PRs trying to get things
merged. Everyone gets excited, no need to be too harsh on them. At least
we can try to explain why we might be taking so long.
We (*cough* Andrew) runs a custom CI box that leads to slightly unusual
merge behaviour in this repo if one is unaware of it.
Document our CI better and ask folk not to bump too much.
While we are at it remove the `API changes` section because we removed
the API files already.
From my reading of the new sanity rules (#4090) we should only have a
single constructor that accesses the inner field of the amount types.
Furthermore we have one const constructor inside the privacy boundry and
a couple outside.
Move the const constructors outside of the privacy boundry.
Internal change only.
Please note
The function being inside privacy boundary allows it to not have the
"runtime" check (most likely optimized-away after inlining). But if we
wanted to get rid of that check we should have _unchecked method
instead. But we don't want that (yet), since the check here will have
zero performance impact in optimized builds and it's not worth the
cost of dealing with unchecked constructors to optimize debug builds.
Recently I wrote a panic message that included the maximum value of an
integer however I used the max of a 16 bit value for both signed and
unsigned - this is incorrect.
Use the correct values for `u16::MAX` and `i16::MAX`.
157fe48dfd minor docstring fixups (planetBoy)
Pull request description:
ACKs for top commit:
apoelstra:
ACK 157fe48dfdc4029a0db63b393d8d9fd32a197e30; successfully ran local tests
Tree-SHA512: 29fe6168ff729f0f65f32a2c6ad28d45e36e0761cac4455b57b891f9c0bd2622db51a21b4961d33fa5a8934302eefca4a77c20732bf047e2721a5bc5d655c340
ab63ec9768 fix correction typos (Bilog WEB3)
Pull request description:
tesnet - testnet `fixed`
How may blocks - How many blocks `fixed`
ACKs for top commit:
apoelstra:
ACK ab63ec976845586d3616ebad6e211e93efba1e8d; successfully ran local tests
Tree-SHA512: 6e84cdc45973c7a9831a7cad4f408cb90dc5a9b01c3f929b4df7449b5719e7f9148ce308797d29e72caa3e1fd73e7ca645e27ae4598f18e133b49dc8f979b480
This commit improves the script builder API to better align with Bitcoin
semantics when working with relative timelocks:
- Add push_relative_lock_time() method that takes a relative::LockTime
parameter, which correctly represents the semantic meaning when working
with CHECKSEQUENCEVERIFY
- Deprecate push_sequence() in favor of push_relative_lock_time() to avoid
confusion between sequence numbers and relative timelocks
This addresses a potential confusion point in the API where developers
might incorrectly push raw sequence numbers in scripts when what they
actually need is to push a relative locktime value that will be checked
against the transaction's sequence numbers by CHECKSEQUENCEVERIFY.
6ba0e46b53 chore: remove unused serde_json dep (lfg2)
Pull request description:
checked by [shear](https://github.com/boshen/cargo-shear)
```
bitcoin_hashes -- hashes/Cargo.toml:
serde_json
Fixed 1 dependencies!
```
cargo +nightly build in local env is ok, local cargo.lock is ok(not include serde_json) so no need update cargo.lock
```
[[package]]
name = "bitcoin_hashes"
version = "0.16.0"
dependencies = [
"bitcoin-internals",
"hex-conservative 0.3.0",
"serde",
"serde_test",
]
```
but check CI seems need update
`error: the lock file /home/runner/work/rust-bitcoin/rust-bitcoin/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.`
ACKs for top commit:
Kixunil:
ACK 6ba0e46b53
apoelstra:
ACK 6ba0e46b53fbc9d6ea0c3e23a553920581930e75; successfully ran local tests
Tree-SHA512: 68a444e05876733af9606d4489ca30a18c9d3439dedf932e40db67dcfdb5ae40ab0f8cf937146f6b1ef92edc626dcb27a441b63c283e6945aa8071500bcc43a4
51d3a83891 updated and corrected links CHANGELOG.md (Bilog WEB3)
Pull request description:
Hey , I read through the whole `CHANGELOG.md` and fixed all the links + adjusted some
ACKs for top commit:
apoelstra:
ACK 51d3a83891395195fb89ae8590addded7efb4871; successfully ran local tests
Kixunil:
ACK 51d3a83891
Tree-SHA512: d36f38dd4b4fb83e615a3cdfe5efdbec5418283b53b09a0e7f288d88711626123c3e1dd5d3dac151186a4592dfbbaa26c90e4d409ed9f1cbf2116292979c3e20
89d61304af chore: remove needless question mark (lfgtwo)
Pull request description:
There’s no reason to use ? to short-circuit when execution of the body will end there anyway.
ACKs for top commit:
apoelstra:
ACK 89d61304af8e05757e5ce3d57497ddbef716674e; successfully ran local tests; sure
Kixunil:
ACK 89d61304af
Tree-SHA512: ac266c9e1d5104c1cb05488a6f3d8d5710e53a17a678ceff7a8a53f839683c3c55e5d229c2df132b0338580f53340686c0c8c554852787c0ead1225b0ef790fa
2d9e240fb6 [hashes] Use `fixed_time_eq` for `Hmac::eq` (Matt Corallo)
7ac7273013 [hashes] Disable fixed-time equality cmp when building for fuzzers (Matt Corallo)
Pull request description:
Fuzzers want to break memcmp calls into separate comparisons for coverage monitoring, allowing them to not-quite-brute-force find inputs that fully match. Thus, we disable our fancy fixed-time comparison when built with the `hashes_fuzz` cfg.
ACKs for top commit:
Kixunil:
ACK 2d9e240fb6
apoelstra:
ACK 2d9e240fb6ae13e6139713f9bb8ccb51e5dc0bff; successfully ran local tests
Tree-SHA512: 372e344ae5497a10ca03a50baadb9d2e8a6dac914bbc4ca91fd5c9b839fb036f42c8b47c252ca3466c15286e889a6f5b51390cc0d938ba24dc50b13e8b863463
7b193b5125 fix err P2WPKH to P2WSH (planetBoy)
Pull request description:
The correction is important because “P2WPK” is not a valid name. In the BIP141 specifications, the correct terms are “P2WPKH” and “P2WSH”.
ACKs for top commit:
Kixunil:
ACK 7b193b5125
apoelstra:
ACK 7b193b5125336263f672f2e2c69447cc3ae58926; successfully ran local tests
Tree-SHA512: 951bcde2c28e2086a69043c1ed27bde0935df0918f418c5f6f89ed476ba9e182e99eec545a438f79ca4e1704ce496d443b5bc9e368a53dd583a884f1da405865
492073f288 Strengthen the type of `taproot_control_block()` (Martin Habovstiak)
e8a42d5851 Unify/reduce usage of `unsafe` (Martin Habovstiak)
d42364bd9d Swap around the fields in `Address` (Martin Habovstiak)
7a115e3cf1 Make `Address` obey sanity rules (Martin Habovstiak)
bc6da1fe07 Swap around the fields in `sha256t::Hash` (Martin Habovstiak)
8ee088df74 Make `sha256t` obey sanity rules (Martin Habovstiak)
Pull request description:
Well, I thought this PR will be just the last commit... 😅
Anyway, this implements a bunch of changes to allow returning `ControlBlock` from `Witness` method(s). One cool side effect is that this PR also reduces the number of `unsafe` blocks.
ACKs for top commit:
apoelstra:
ACK 492073f28876406f8fe5a07a8a2495c8e0ba1fb3; successfully ran local tests
Tree-SHA512: 11979517cc310abf25644fc93a75deccacae66af8ba2d9b4011fdc3f414b15fac7e748399c7eef492ca850c11b7aacc3f24ec46fccf95e6d57a400212979637e
When someone is checking if an `Hmac` is equal to some other
`Hmac`, its fairly common for them to be doing a
constant-time-ness-sensitive operation. Thus, here we default to
our existing `fixed_time_eq` method for `PartialEq` on `Hamc`,
rather than the naive Rust slice comparison.
While we should consider doing the same for all hash types, we do
not yet do so here.
2867a7074f chore: fix some typos in comment (todaymoon)
Pull request description:
I fix some typos in the comments to improve readability.
ACKs for top commit:
apoelstra:
ACK 2867a7074ffef9c77d0a660d788b30d9afaf7494; successfully ran local tests
Tree-SHA512: 64a418b36443b0c1fd653cfc66fb35c13fafd0f3dff388df365ded35a83b759c5a6a3565add626f7d9813f3985019df92635fb18acd1893e453e02687717de18
f15e461baf Add an exclusion for a mutant in a deprecated fn (Jamil Lambert, PhD)
9a2b56f381 Modify test in Amount to kill mutants (Jamil Lambert, PhD)
1d1cf00b1e Add test to BlockTime to kill mutants (Jamil Lambert, PhD)
Pull request description:
Weekly mutation testing found mutants in `Amount` and `BlockTime`.
Add a test to `BlockTime`.
Add two asserts to `Amount` tests.
Exclude deprecated function from mutation testing.
Closes#4225, #4243, #4278
ACKs for top commit:
apoelstra:
ACK f15e461baf463da0bf9d89018180c1d5032106c1; successfully ran local tests
Tree-SHA512: 18a405362db1b2eabac7c7ac01a56d306a1bf5f705626b5c217ec329e6420daa2f2e62b37c72537f29b7ee76b9fd795adde2da71b226fec3a74d0f25dca6cd96
Fuzzers want to break memcmp calls into separate comparisons for
coverage monitoring, allowing them to not-quite-brute-force find
inputs that fully match. Thus, we disable our fancy fixed-time
comparison when built with the `hashes_fuzz` cfg.