Skip to content

chore: small-fix accoriding to the syncing up to the master branch #2

Closed
Sansh2356 wants to merge 444 commits intocpunet_0.32.4from
test
Closed

chore: small-fix accoriding to the syncing up to the master branch #2
Sansh2356 wants to merge 444 commits intocpunet_0.32.4from
test

Conversation

@Sansh2356
Copy link

No description provided.

leopardracer and others added 30 commits April 26, 2025 12:47
afd4ec8 test: push minimality check for zero(empty) (ChrisCho-H)

Pull request description:

  Following rust-bitcoin#4368.
  I omitted to test OP_0(empty bytes) and can be covered by this PR.

ACKs for top commit:
  apoelstra:
    ACK afd4ec8; successfully ran local tests

Tree-SHA512: a3643227f9dfde71d5c5707bf11804e0e26eff43346c0443abdd805f0ffad284c3090e22a0bda34e54e1185a980adc7511724db401c04b55a8be79d67a3fce6d
…end test for P2A

8eeceed test: extend `valid_v1_witness_programs` test to include P2A (Luis Schwab)
647526d chore: fix docs for `impl WitnessProgram` and P2A (Luis Schwab)

Pull request description:

  Closes rust-bitcoin#4124.

  This PR fixes documentation on `impl WitnessProgram` by replacing instances of `address` to `[WitnessProgram]`, adds punctuation and capitalization where it was lacking and extends the `valid_v1_witness_programs` test to include the P2A output.

ACKs for top commit:
  Kixunil:
    ACK 8eeceed
  apoelstra:
    ACK 8eeceed; successfully ran local tests

Tree-SHA512: 6e62a8de7135da04d6330d2b5596a2cd19da8a849f8c8c892f53578a8690152b23facf58149d4139ae088f1ab297d3526094617c3549e688819e9b1f3688de8b
…ons" -> "operations"

d5f8a02 Update result.rs (leopardracer)

Pull request description:

  **Description:**
  This PR fixes a small typo in the documentation comment in units/src/result.rs where "operatons" was misspelled as "operations". This improves code documentation clarity and consistency.

  Changes:
  - Corrected spelling of "operatons" to "operations" in the documentation comment
  - No functional changes, documentation-only update

ACKs for top commit:
  apoelstra:
    ACK d5f8a02; successfully ran local tests

Tree-SHA512: b9d6ea4c8d36e6a9f8d397b4db31d99f0b9d0101a0bef922f0c3832c501fbc773f8871c350ae8add47ab1f1c4d15806e1b1d9f0b9d7dd707b38adcc2afad8b34
…CONTRIBUTING.md

ab9f2fc removed API documentation section (Maximilian Hubert)

Pull request description:

  Removed API documentation section due to dead link - couldn't locate the referenced api folder or README file. Happy to restore this with correct link info if someone can provide the proper reference path. Just let me know!

ACKs for top commit:
  apoelstra:
    ACK ab9f2fc; successfully ran local tests

Tree-SHA512: eb4887048f9d2e4bcb1b21947aac55c250fe369e5b9a3f07cc6f9ec7abd5716a4a45c6ac9e767808c5b1fa5f16f387e64a2ea3ccd997bf95fd3b19f669e1f249
6737c3a 2025-04-27 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 6737c3a; successfully ran local tests

Tree-SHA512: d486efcc34aa7a3666ec421e8ae7d8f1d2f160a3ba8b086b70859f1da4fc03bb1399886370e09c26c57be98c20bdb865b86547f2f7dbcfcace2d34d486f842e0
…ks (to 0.41.0)

0edb0f5 Automated update to Github CI to cargo-semver-checks version-0.41.0 (Update cargo-semver-checks 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 0edb0f5

Tree-SHA512: 80ce15d4a0f568a2303d06f8c6c426cea75f90c5bff6270ff2b27b93f09260c3765666da51c1a0575a0ce8d526a0f1ac2cf7771a09f989cc147aa4d267799978
Our encoding/decoding support for scripts is currently a bit convoluted.
Add an example that shows how all the APIs go together.

Note this highlights a potential problem. `to_hex_string` is in
`bitcoin` and therefore has access to consensus encoding but does not
include the length prefix. This means that the output string from
`to_hex_string` cannot be parsed with
`consensus::encode::deserialize_hex` - which is surprising and has lead
to difficulty by at least one user trying to debug.
I'm not sure why we do not use consensus encoding currently for encoding
and decoding scripts to/from hex strings. Many tests include hard coded
hex which do not include the length prefix.

- Add a pair of encoding functions to encode/decode to/from hex without
the length prefix.
- Make `to_hex` and `from_hex` expect the length prefix i.e., use
consensus encoding.

This makes the API easier to use because the various encoding APIs can
be use together now eg `consensus::encode_hex` and `ScriptBuf::from_hex`.
Add the length prefix when formatting hex strings by way of `LowerHex`
and `UpperHex`.

This looses formatting options because I can't remember right now how
not to - again.
8b47068 feat(locktime): implement MtpAndHeight structure and validation logic (aagbotemi)

Pull request description:

  This PR fixes rust-bitcoin#4299

  - Computed MtpAndHeight structure
  - Checked if relative time and height is satisfied by MtpAndHeight
  - Compared the Ordering of MtpAndHeight with time and height
  - Checked MtpAndHeight satisfaction and comparison in Locktime
  - Added unit tests for all the implementation

  I've reviewed and adhered to the contribution guidelines

ACKs for top commit:
  apoelstra:
    ACK 8b47068; successfully ran local tests
  Kixunil:
    ACK 8b47068
  tcharding:
    ACK 8b47068

Tree-SHA512: b00d1384d5deaa038b486ca9d77ad33cfa6cd8c987e08407863f2be8d540014bdcc971cd9d46acb51a2d105341accc04ba151e5cccb276e8352a5d45b33097eb
a232783 docs: correction CHANGELOG.md (Fallengirl)

Pull request description:

  fix `funtions` - `functions`
  no impact on functionality, local tests passed
  thx

ACKs for top commit:
  tcharding:
    ACK a232783
  jamillambert:
    ACK a232783
  apoelstra:
    ACK a232783; successfully ran local tests

Tree-SHA512: e850ee8b642df49e1b8fb1cf50aac4f55c86cc4f955aa28bc0493449769d5239a491fab5df02c7ade21a40c1efb7f4194fded29a418ae070b3e20aceb9d6dae3
5d5a197 Run the formatter (Tobin C. Harding)
2b72f1f Make Lower/Upper hex print scripts with len prefix (Tobin C. Harding)
c27b95f Make script to/from hex use consensus encoding (Tobin C. Harding)
f4bc58d bitcoin: Add a script encoding example (Tobin C. Harding)

Pull request description:

  Done while investigating rust-bitcoin#3910 - this PR is quite invasive.

  - Patch 1 adds an example that shows the current behaviour of various API calls for converting scripts to/from hex.
  - Patch 2 adds a pair of functions that do not use the length prefix and makes script to/from_hex use the prefix.
  - Patch 3 makes `LowerHex` and `UpperHex` use the len prefix also
  - Patch 4 runs the formatter

  Explicitly keeps serde untouched - i.e., without the len prefix

ACKs for top commit:
  apoelstra:
    ACK 5d5a197; successfully ran local tests

Tree-SHA512: dbbec372ea7b01818fce68ffb807a4531f068e10147e8bedf37b77f66a068a628e380549c379c061b868973e97806ada59729248b03bbd1cf6809f6098170cb6
made a text look a little bit better
cargo-mutants 25.0.1  introduced a new mutation pattern that deletes an
arm of a match statement or replaces a match guard with true and false.
These are applied in sections that have been excluded from mutation
testing and cause false positives.
The match patterns are also now stricter causing previously excluded
`impl` to be included.

Exclude the new match arm and guard mutation patterns.

Add `impl fmt::` versions for Debug and Display.
f31b732 changed wording and punctuation (crStiv)

Pull request description:

  nothing fancy, just changed wording and improved punctuation

ACKs for top commit:
  apoelstra:
    ACK f31b732; successfully ran local tests
  tcharding:
    ACK f31b732

Tree-SHA512: 78daae62a7235dcf238687548f2b2778120aede3f5237e83a9015b87a112946b7ff4177cfbbab6206ea09f41cc9d08b3684f169beeba314f6afc1c917920f788
The bip32::Error enum is now exclusively used for errors related to
parsing and decoding. It is still a little messy (mainly: it contains a
base58 variant which is used when parsing a string but not when decoding
from bytes) but much cleaner than it was.
This restores the Result return from derive_xpriv which we had removed
in a previous PR, but such is life.

Fixes rust-bitcoin#4308
…um depth exceeded" error

b9a1204 bip32: return error when trying to derive a path too deep (Andrew Poelstra)
73781e0 bip32: rename Error to ParseError (Andrew Poelstra)
a66ad97 bip32: split InvalidChildNumber and InvalidChildNumberFormat out of error (Andrew Poelstra)
a891fb9 bip32: remove unused error variants (Andrew Poelstra)
f0a237c bip32: split out DerivationError from the main error enum (Andrew Poelstra)
32d96f6 bip32: make Xpriv::new_master be infallible (Andrew Poelstra)
0e5e021 bip32: change several cryptographically unreachable paths to expects (Andrew Poelstra)

Pull request description:

  This PR makes a first pass at splitting the `bip32::Error` type into multiple distinct types -- one for derivation (which can fail if you try to derive a hardened child of an xpub, or if you try to derive too many layers), one for parsing child numbers or derivation paths, and one for parsing xkeys. Along the way it cleans up a ton of weird things and typos, e.g. the psbt `GetKeyError` having an unused `Bip32` variant whose display text references "bip 23".

  Because all the error types get renamed, every part of this PR is an API break, but only the last commit is a "real" API break which uses the new `DerivationError::MaximumDepthExceeded` error variant to return an error when trying to derive a path of length 256 or longer. This means that `Xpriv::derive_xpriv` again returns an error result.

  I will make a simpler version of this last commit suitable for backporting to 0.32.x. (In 0.32.x `Xpriv::derive_priv` returns an error, so we can change it to error out on max-depth-exceeded without breaking the API. Sadly most users are likely to be unwrapping the error because in 0.32.x currently the error path is cryptographically unreachable...but at least this way the panic will be in their control rather than ours.)

  Fixes rust-bitcoin#4308

ACKs for top commit:
  tcharding:
    ACK b9a1204

Tree-SHA512: 688826126ff24066c6de9de3caa73db68c516ba8893d64d9226a498774a2fb9db7d7fd797375c6b3f820588c178632e1e6e8561022dfa7042a560582bf1509b4
…rm/guard mutants

3bcb5b0 Add exclusions for match arm/guard mutants (Jamil Lambert, PhD)

Pull request description:

  cargo-mutants 25.0.1 introduced a new mutation pattern that deletes an arm of a match statement or replaces a match guard with true and false. These are applied in sections that have been excluded from mutation testing and cause false positives.
  The match patterns are also now stricter causing previously excluded `impl` to be included.

  Exclude the new match arm and guard mutation patterns.

  Add `impl fmt::` versions for Debug and Display.

  Closes rust-bitcoin#4402

ACKs for top commit:
  apoelstra:
    ACK 3bcb5b0; successfully ran local tests
  tcharding:
    ACK 3bcb5b0

Tree-SHA512: d7a45bdd5bc844c273956922b5483c70f24ca8ea20da275fd6b1ff13e71ec86fcc487932365beb3084cc3894bbe1317ddb3df975f90584b639187ba278b0721e
The output of `Display` should not change in stable crates for types
that have well defined formatting and ones that implement `FromStr`.
Error types do not need to be tested.

Add missing tests for all implementations in `primitives` and round
trips for types that implement `FromStr`.
Existing display tests only test lock by block height.  New tests are
needed for lock by block time.

Change existing test names to make it clear which type of locktime is
being tested.
The existing display regression tests only tested height locktimes.
Denomination display regression and round trip were not tested.

Add tests for time locktimes and denomination.
The output of Display should not change in stable crates for types that
have well defined formatting and ones that implement FromStr.
Crates that are included in the mutation testing have been updated to
test all relevant Display implementations.

Remove the exclusion so that the Display implementations are included in
mutation testing.
The output of `Display` should not change in stable crates for types
that have well defined formatting and ones that implement `FromStr`.
Error types do not need to be tested.

Add missing tests for all implementations in `units`.
tcharding and others added 24 commits May 27, 2025 08:36
Recently we added a private `impl_u32_macro`. It included a bunch of
associated consts and a pair of u32 constructor/getter functions.

We overlooked the fact that the macro produces incorrect docs.

Move the offending code out of the macro and into the already existent
impl block for each type.

Docs only, no other logic change.
The `ServiceFlags` type is already tested within p2p/mod.rs with a
nearly identical test. This type also has nothing to do with `network`
In preparation to move `p2p` to its own crate, any `Vec<T>` that satisfies
`T: Encodable` will not trivially implement `Encodable` because of the
orphan rule. A type defined within p2p may implement `Encodable`,
however, and the simplest possible type is one that simply wraps the
vector. Three types that will implement `Encodable` within `p2p` are
added here.
All of the `Encodable` implementations are defined within `p2p` with the
exception of `p2p` types that are a `Vec`. To fully decouple `p2p` from
`encode` we can define these in `p2p` like the others. This is the final
step in removing anything `p2p` related from the rest of `bitcoin`.
9dac4d6 Implement CheckedSum for Weight iterator (yancy)
0dbcd09 Move CheckedSum trait to crate root (yancy)

Pull request description:

  * Move CheckedSum to the crate root so that other types can be added
  * Add Weight to CheckedSum

ACKs for top commit:
  tcharding:
    ACK 9dac4d6
  apoelstra:
    ACK 9dac4d6; successfully ran local tests

Tree-SHA512: 3e4b7f79074e23493ccd17a026542081f0d7a811f4f35edb7994ada95bf414a166531f142ad4986d27fcec448209b2ffa56813b495b5df6b6e8fcd589392e0c1
Peer to peer messages change on occasion, and we would like to add
messages as they are release from Bitcoin Core. Add an empty crate to
take the crate name.
9d956e8 test: remove redundant `ServiceFlags` test (rustaceanrob)

Pull request description:

  The `ServiceFlags` type is already tested within p2p/mod.rs with a nearly identical test. This type also has nothing to do with `network`

  ref: https://github.com/rust-bitcoin/rust-bitcoin/blob/master/bitcoin/src/p2p/mod.rs#L400

ACKs for top commit:
  tcharding:
    ACK 9d956e8
  apoelstra:
    ACK 9d956e8; successfully ran local tests

Tree-SHA512: d113609070e3df6d44b1ed57c40c1bce251d59fa22eb1abbf6c576fd84e21464553bee7fa97eba000ad9c1b8ef98e2ba04aec7077486273de9b7e54341ba894b
…nversions

6335c62 fix(p2p): remove `AddrV2` <> `SocketAddr` conversions (Luis Schwab)

Pull request description:

  This PR reverts rust-bitcoin#4521 due to loss/creation of port information during the conversion. Users should use the `AddrV2` <> `IpAddr` conversion instead.

  Closes rust-bitcoin#4566

ACKs for top commit:
  Kixunil:
    ACK 6335c62
  tcharding:
    ACK 6335c62

Tree-SHA512: f183756467ca17bb7e7078023a769ec33d3deb4146ab7ec63ef961107ab93ec975c9adffd9eeddc79250abfa1cee9eccbbcaef7466cf4c2c21205b69d8e9eb4f
2a3e606 units: Move some things out of impl_u32_macro (Tobin C. Harding)

Pull request description:

  Recently we added a private `impl_u32_macro`. It included a bunch of associated consts and a pair of u32 constructor/getter functions.

  We overlooked the fact that the macro produces incorrect docs.

  Move the offending code out of the macro and into the already existent impl block for each type.

  Docs only, no other logic change.

ACKs for top commit:
  apoelstra:
    ACK 2a3e606; successfully ran local tests

Tree-SHA512: ad4bdbb35bc674e9664e293841e14dc2374c8baddf3e795edb666c75860f02728e939ef5a93ede6f4c951e92c5dd5368d6a6b9662cf6d5b268f73ab5ac97e2cc
e47836f Do not derive Default on CompactTarget (Tobin C. Harding)

Pull request description:

  It is not immediately obvious what a zero value compact target is. Because of this and the fact that we are trying to release minimal code in `primitives 1.0` its best to remove the `Default` derive.

  This is an API breaking change.

ACKs for top commit:
  apoelstra:
    ACK e47836f; successfully ran local tests

Tree-SHA512: 7edb067a7ed66af8155b86b2391ee839b0a21b3d8d36b555123b14e93f1822b89c080328464b194e4ff47643440c56fa5afee929fe58b52d5f1cf84c9b96ca83
7b52b9c Fix typo (yancy)

Pull request description:

  Seems the comment has a stutter

ACKs for top commit:
  tcharding:
    ACK 7b52b9c
  apoelstra:
    ACK 7b52b9c; successfully ran local tests

Tree-SHA512: 1cb11c03bb3043c19936dbe4c2ccfa1e8fa43e90c118c969da536d010d95762966cc86e257e3365d18d96cc6dfe4a63d94c4d16b1b766dde3882286ce9bb4925
357ae40 fix typo Porallel to Parallel crypto.rs (Fallengirl)

Pull request description:

  Hi devs! Found and fixed one typo in `hashes/src/ripemd160/crypto.rs`

  `Porallel` - `Parallel`

ACKs for top commit:
  tcharding:
    ACK 357ae40

Tree-SHA512: 67b166f8f0262cc9f4fdd9d4cbe74977ca86e0256d0129f645559aa4e75fd30d978d8995d503932c90f000eee4d87b47cc4dd5eac8405d5cd02124346ad35b3a
4ccecf5 Fix stale Height type link (Tobin C. Harding)
caebb1b units: relative: Do minor rustdocs fixes (Tobin C. Harding)
40bb177 Put is_satisfied_by functions together (Tobin C. Harding)
480a2cd Favour new function `from_mtp` over deprecated (Tobin C. Harding)
f9d6453 Shorten locktime type term (Tobin C. Harding)
727047b Fix off-by-one-bug in absolute locktime (Tobin C. Harding)
3ffdc54 Fix off-by-one bug in relative locktime (Tobin C. Harding)
a2ff8dd Improve relative::LockTime is_satisfied_by_{height, time} (Tobin C. Harding)

Pull request description:

  Make the APIs uniform in relative and absolute locktimes in relation to the `is_satisfied_by` functions. In doing so improve the API and fix an off-by-one bug when checking satisfaction of locks by height.

  Done in three patches but maybe should be squashed? Probably easiest to review by looking at all the `is_satisfied_by*` functions and convincing yourself we got it right.

  EDIT: Now has 5 cleanup patches also (mostly docs cleanups).

ACKs for top commit:
  apoelstra:
    ACK 4ccecf5; successfully ran local tests

Tree-SHA512: 9206cb464a06647510a35a7d564062823117e75df60251969be458616f4f5d04acf0aada53dbf7d493a2a2a72d26b3a300417a6499e45413d5f2a011538b7826
…`p2p`

20779bd Move `p2p` encodings out of `encode` (rustaceanrob)
94bcff2 p2p: Add wrappers for messages that use `Vec` (rustaceanrob)

Pull request description:

  To move `p2p` into a crate:
  1. All `Encodable` implementations for `p2p` must be defined in `p2p`. To accomplish this, and anything else in the future related to encoding, I added a `deser` module with the necessary macro to implement `Encodable` for `Vec<T> where T: Encodable`.
  2. Because the orphan rule would apply for implementing `Encodable`for `Vec` within `p2p`, three types defined within `p2p` are used to wrap the `Vec` and snake around the orphan rule.

ACKs for top commit:
  tcharding:
    ACK 20779bd
  apoelstra:
    ACK 20779bd; successfully ran local tests

Tree-SHA512: 7abfe5b853e84bb465579309f80a0687c325217f6f342651278bedf540c4d17ae16683ab02dea5e3d98d90790deb12c6bc7d572a92cec8e19ff94e395bc0d29c
de32071 Introduce empty p2p messages crate (rustaceanrob)

Pull request description:

  Peer to peer messages change on occasion, and we would like to add messages as they are released from Bitcoin Core. Add an empty crate to take the crate name.

ACKs for top commit:
  tcharding:
    ACK de32071
  apoelstra:
    ACK de32071; successfully ran local tests

Tree-SHA512: 68c8080c524c30eb5ec0aca14e74c8196a7cfffabe32d47773d56b8a64850617094b3c2088dfce20b4abfca31c82b19369703722d0a98aee636c383318953da7
Signed-off-by: Calisto Abel Mathias <calisto.mathias.25@gmail.com>
@github-actions
Copy link

github-actions bot commented Jun 2, 2025

🚨 API BREAKING CHANGE DETECTED

To see the changes click details on "Check semver breaks / PR Semver - stable toolchain" job then expand "Run semver checker script" and scroll to the end of the section.

@Sansh2356 Sansh2356 closed this Jun 3, 2025
Sansh2356 pushed a commit that referenced this pull request Feb 27, 2026
…prefix

5d4f9cf Fix decoder bug when ending before decoding prefix (Shing Him Ng)

Pull request description:

  Before this fix, calling `ByteVecDecoder.end()` on a decoder that hadn't finished reading in the full prefix would result in a valid result of an empty vec. This should instead result in an error, since the decoder shouldn't be able to decode something with an incomplete prefix.
  
  Found from rust-bitcoin#5315 when i was testing some of the fuzzing:
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 4008033836
  INFO: Loaded 1 modules   (726 inline 8-bit counters): 726 [0x100aca050, 0x100aca326),
  INFO: Loaded 1 PC tables (726 PCs): 726 [0x100aca328,0x100acd088),
  INFO:       10 files found in /Users/shingng/git/rust-bitcoin/fuzz/corpus/consensus_encoding_decode_byte_vec
  INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
  
  thread '<unnamed>' (5327178) panicked at fuzz/fuzz_targets/consensus_encoding/decode_byte_vec.rs:21:17:
  decoder should error when insufficient data provided
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  ==12615== ERROR: libFuzzer: deadly signal
      #0 0x0001013453c4 in __sanitizer_print_stack_trace+0x28 (librustc-nightly_rt.asan.dylib:arm64+0x5d3c4)
      #1 0x000100a518d4 in fuzzer::PrintStackTrace()+0x30 (consensus_encoding_decode_byte_vec:arm64+0x1000158d4)
      #2 0x000100a45db8 in fuzzer::Fuzzer::CrashCallback()+0x54 (consensus_encoding_decode_byte_vec:arm64+0x100009db8)
      #3 0x00019914f740 in _sigtramp+0x34 (libsystem_platform.dylib:arm64+0x3740)
      #4 0x000199145884 in pthread_kill+0x124 (libsystem_pthread.dylib:arm64+0x6884)
      #5 0x00019904a84c in abort+0x78 (libsystem_c.dylib:arm64+0x7984c)
      rust-bitcoin#6 0x000100aa9e44 in _RNvNtNtNtCsk9AQ7OSayGk_3std3sys3pal4unix14abort_internal+0x8 (consensus_encoding_decode_byte_vec:arm64+0x10006de44)
      rust-bitcoin#7 0x000100aa9cd0 in _RNvNtCsk9AQ7OSayGk_3std7process5abort+0x8 (consensus_encoding_decode_byte_vec:arm64+0x10006dcd0)
      rust-bitcoin#8 0x000100aa5528 in _RNCNvCsaBYAWE6hvc2_13libfuzzer_sys10initialize0B3_+0xb8 (consensus_encoding_decode_byte_vec:arm64+0x100069528)
      rust-bitcoin#9 0x000100a9106c in _RNvNtCsk9AQ7OSayGk_3std9panicking15panic_with_hook+0x264 (consensus_encoding_decode_byte_vec:arm64+0x10005506c)
      rust-bitcoin#10 0x000100a85148 in _RNCNvNtCsk9AQ7OSayGk_3std9panicking13panic_handler0B5_+0x6c (consensus_encoding_decode_byte_vec:arm64+0x100049148)
      rust-bitcoin#11 0x000100a7cad4 in _RINvNtNtCsk9AQ7OSayGk_3std3sys9backtrace26___rust_end_short_backtraceNCNvNtB6_9panicking13panic_handler0zEB6_+0x8 (consensus_encoding_decode_byte_vec:arm64+0x100040ad4)
      rust-bitcoin#12 0x000100a8572c in _RNvCseYE12Li5r0M_7___rustc17rust_begin_unwind+0x1c (consensus_encoding_decode_byte_vec:arm64+0x10004972c)
      rust-bitcoin#13 0x000100aaa484 in _RNvNtCsh0x4TIixgmZ_4core9panicking9panic_fmt+0x24 (consensus_encoding_decode_byte_vec:arm64+0x10006e484)
      rust-bitcoin#14 0x000100a3d6ac in _RNvNvCsdWVpjOStM1p_34consensus_encoding_decode_byte_vec1__19___libfuzzer_sys_run decode_byte_vec.rs:45
      rust-bitcoin#15 0x000100a3f52c in rust_fuzzer_test_input lib.rs:276
      rust-bitcoin#16 0x000100a4436c in _RINvNvNtCsk9AQ7OSayGk_3std9panicking12catch_unwind7do_callNCNvCsaBYAWE6hvc2_13libfuzzer_sys15test_input_wrap0lEBY_+0xc4 (consensus_encoding_decode_byte_vec:arm64+0x10000836c)
      rust-bitcoin#17 0x000100a45034 in __rust_try+0x18 (consensus_encoding_decode_byte_vec:arm64+0x100009034)
      rust-bitcoin#18 0x000100a43c6c in LLVMFuzzerTestOneInput+0x16c (consensus_encoding_decode_byte_vec:arm64+0x100007c6c)
      rust-bitcoin#19 0x000100a47670 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)+0x158 (consensus_encoding_decode_byte_vec:arm64+0x10000b670)
      rust-bitcoin#20 0x000100a488e8 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, std::__1::allocator<fuzzer::SizedFile>>&)+0x240 (consensus_encoding_decode_byte_vec:arm64+0x10000c8e8)
      rust-bitcoin#21 0x000100a49058 in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, std::__1::allocator<fuzzer::SizedFile>>&)+0x88 (consensus_encoding_decode_byte_vec:arm64+0x10000d058)
      rust-bitcoin#22 0x000100a676b8 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long))+0x1aa4 (consensus_encoding_decode_byte_vec:arm64+0x10002b6b8)
      rust-bitcoin#23 0x000100a74158 in main+0x24 (consensus_encoding_decode_byte_vec:arm64+0x100038158)
      rust-bitcoin#24 0x000198d7dd50  (<unknown module>)
  
  NOTE: libFuzzer has rudimentary signal handlers.
        Combine libFuzzer with AddressSanitizer or similar for better crash reports.
  SUMMARY: libFuzzer: deadly signal
  MS: 0 ; base unit: 0000000000000000000000000000000000000000
  
  
  artifact_prefix='/Users/shingng/git/rust-bitcoin/fuzz/artifacts/consensus_encoding_decode_byte_vec/'; Test unit written to /Users/shingng/git/rust-bitcoin/fuzz/artifacts/consensus_encoding_decode_byte_vec/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  Base64:
  
  ────────────────────────────────────────────────────────────────────────────────
  
  Failing input:
  
  fuzz/artifacts/consensus_encoding_decode_byte_vec/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  
  Output of `std::fmt::Debug`:
  
  []
  
  Reproduce with:
  
  cargo fuzz run consensus_encoding_decode_byte_vec fuzz/artifacts/consensus_encoding_decode_byte_vec/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  
  Minimize test case with:
  
  cargo fuzz tmin consensus_encoding_decode_byte_vec fuzz/artifacts/consensus_encoding_decode_byte_vec/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709
  
  ────────────────────────────────────────────────────────────────────────────────
  
  Error: Fuzz target exited with exit status: 77
  ```


ACKs for top commit:
  apoelstra:
    ACK 5d4f9cf; successfully ran local tests
  tcharding:
    ACK 5d4f9cf


Tree-SHA512: 89298839cfc33b2cf3379ca5ddcbf3edb94b81d5dfae01ca23b034e390f01653a1a147642928313ae02a2136a9a9397f6f66d369abb12786016ac2186638f076
Sansh2356 pushed a commit that referenced this pull request Feb 27, 2026
…f funding utxos

a5bd502 Fix unreachable error bug during iteration of funding utxos (Shing Him Ng)

Pull request description:

  Found this while working on a psbt fuzz target:
  
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 3835569058
  INFO: Loaded 1 modules   (61329 inline 8-bit counters): 61329 [0x100a2acf0, 0x100a39c81),
  INFO: Loaded 1 PC tables (61329 PCs): 61329 [0x100a39c88,0x100b29598),
  target/aarch64-apple-darwin/release/bitcoin_arbitrary_psbt: Running 1 inputs 1 time(s) each.
  Running: fuzz/artifacts/bitcoin_arbitrary_psbt/crash-ba0bb9c6187caa78cd865a232ef56ea1a690e25b
  
  thread '<unnamed>' (7096951) panicked at bitcoin/src/psbt/mod.rs:204:18:
  internal error: entered unreachable code
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  ==48521== ERROR: libFuzzer: deadly signal
      #0 0x0001012893c4 in __sanitizer_print_stack_trace+0x28 (librustc-nightly_rt.asan.dylib:arm64+0x5d3c4)
      #1 0x0001007c8300 in fuzzer::PrintStackTrace()+0x30 (bitcoin_arbitrary_psbt:arm64+0x100354300)
      #2 0x0001007bc7e4 in fuzzer::Fuzzer::CrashCallback()+0x54 (bitcoin_arbitrary_psbt:arm64+0x1003487e4)
      #3 0x00019914f740 in _sigtramp+0x34 (libsystem_platform.dylib:arm64+0x3740)
      #4 0x000199145884 in pthread_kill+0x124 (libsystem_pthread.dylib:arm64+0x6884)
      #5 0x00019904a84c in abort+0x78 (libsystem_c.dylib:arm64+0x7984c)
      rust-bitcoin#6 0x0001008429c4 in _RNvNtNtNtCsk9AQ7OSayGk_3std3sys3pal4unix14abort_internal+0x8 (bitcoin_arbitrary_psbt:arm64+0x1003ce9c4)
      rust-bitcoin#7 0x000100842820 in _RNvNtCsk9AQ7OSayGk_3std7process5abort+0x8 (bitcoin_arbitrary_psbt:arm64+0x1003ce820)
      rust-bitcoin#8 0x00010083d9fc in _RNCNvCsaBYAWE6hvc2_13libfuzzer_sys10initialize0B3_+0xb8 (bitcoin_arbitrary_psbt:arm64+0x1003c99fc)
      rust-bitcoin#9 0x0001008174d4 in _RNvNtCsk9AQ7OSayGk_3std9panicking15panic_with_hook+0x264 (bitcoin_arbitrary_psbt:arm64+0x1003a34d4)
      rust-bitcoin#10 0x00010080b5b0 in _RNCNvNtCsk9AQ7OSayGk_3std9panicking13panic_handler0B5_+0x6c (bitcoin_arbitrary_psbt:arm64+0x1003975b0)
      rust-bitcoin#11 0x000100802f0c in _RINvNtNtCsk9AQ7OSayGk_3std3sys9backtrace26___rust_end_short_backtraceNCNvNtB6_9panicking13panic_handler0zEB6_+0x8 (bitcoin_arbitrary_psbt:arm64+0x10038ef0c)
      rust-bitcoin#12 0x00010080bb94 in _RNvCseYE12Li5r0M_7___rustc17rust_begin_unwind+0x1c (bitcoin_arbitrary_psbt:arm64+0x100397b94)
      rust-bitcoin#13 0x00010084311c in _RNvNtCsh0x4TIixgmZ_4core9panicking9panic_fmt+0x24 (bitcoin_arbitrary_psbt:arm64+0x1003cf11c)
      rust-bitcoin#14 0x0001008430f4 in _RNvNtCsh0x4TIixgmZ_4core9panicking5panic+0x10 (bitcoin_arbitrary_psbt:arm64+0x1003cf0f4)
      rust-bitcoin#15 0x00010056c670 in _RNvMNtCs9rLNVcx1A2L_7bitcoin4psbtNtB2_4Psbt39internal_extract_tx_with_fee_rate_limit+0x4e0 (bitcoin_arbitrary_psbt:arm64+0x1000f8670)
      rust-bitcoin#16 0x00010049ddd8 in _RNvNvCshHXwvrCOqYg_22bitcoin_arbitrary_psbt1__19___libfuzzer_sys_run arbitrary_psbt.rs:41
      rust-bitcoin#17 0x0001004a545c in rust_fuzzer_test_input lib.rs:276
      rust-bitcoin#18 0x0001007bad98 in _RINvNvNtCsk9AQ7OSayGk_3std9panicking12catch_unwind7do_callNCNvCsaBYAWE6hvc2_13libfuzzer_sys15test_input_wrap0lEBY_+0xc4 (bitcoin_arbitrary_psbt:arm64+0x100346d98)
      rust-bitcoin#19 0x0001007bba60 in __rust_try+0x18 (bitcoin_arbitrary_psbt:arm64+0x100347a60)
      rust-bitcoin#20 0x0001007ba698 in LLVMFuzzerTestOneInput+0x16c (bitcoin_arbitrary_psbt:arm64+0x100346698)
      rust-bitcoin#21 0x0001007be09c in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)+0x158 (bitcoin_arbitrary_psbt:arm64+0x10034a09c)
      rust-bitcoin#22 0x0001007d955c in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long)+0xd8 (bitcoin_arbitrary_psbt:arm64+0x10036555c)
      rust-bitcoin#23 0x0001007de1cc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long))+0x1b8c (bitcoin_arbitrary_psbt:arm64+0x10036a1cc)
      rust-bitcoin#24 0x0001007eab84 in main+0x24 (bitcoin_arbitrary_psbt:arm64+0x100376b84)
      rust-bitcoin#25 0x000198d7dd50  (<unknown module>)
  
  NOTE: libFuzzer has rudimentary signal handlers.
        Combine libFuzzer with AddressSanitizer or similar for better crash reports.
  SUMMARY: libFuzzer: deadly signal
  ────────────────────────────────────────────────────────────────────────────────
  ```
  
  I wasn't positive on if i should group it with `Error::MissingUtxo` and return `ExtractTxError::MissingInputAmount`


ACKs for top commit:
  tcharding:
    ACK a5bd502
  apoelstra:
    ACK a5bd502; successfully ran local tests


Tree-SHA512: 0fcc7663a5a3458f1eb5a968e200928c5476dfcce9a765437bab5987294373ba8e919d8e606de06ee69acda2100ffb348907173d8c9ce7a4cc62efb5ad108f8b
Sansh2356 pushed a commit that referenced this pull request Feb 27, 2026
…utput

164a9a5 Fix bug in `Psbt::spend_utxo` when missing output (Shing Him Ng)

Pull request description:

  Something else found from fuzzing:
  
  ```
  thread '<unnamed>' (8730670) panicked at bitcoin/src/psbt/mod.rs:625:38:
  index out of bounds: the len is 0 but the index is 16765184
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  ==1660== ERROR: libFuzzer: deadly signal
      #0 0x000104e693c4 in __sanitizer_print_stack_trace+0x28 (librustc-nightly_rt.asan.dylib:arm64+0x5d3c4)
      #1 0x000104439f6c in fuzzer::PrintStackTrace()+0x30 (bitcoin_arbitrary_psbt:arm64+0x100399f6c)
      #2 0x00010442e450 in fuzzer::Fuzzer::CrashCallback()+0x54 (bitcoin_arbitrary_psbt:arm64+0x10038e450)
      #3 0x00019914f740 in _sigtramp+0x34 (libsystem_platform.dylib:arm64+0x3740)
      #4 0x000199145884 in pthread_kill+0x124 (libsystem_pthread.dylib:arm64+0x6884)
      #5 0x00019904a84c in abort+0x78 (libsystem_c.dylib:arm64+0x7984c)
      rust-bitcoin#6 0x0001044b59f8 in _RNvNtNtNtCsk9AQ7OSayGk_3std3sys3pal4unix14abort_internal+0x8 (bitcoin_arbitrary_psbt:arm64+0x1004159f8)
      rust-bitcoin#7 0x0001044b5854 in _RNvNtCsk9AQ7OSayGk_3std7process5abort+0x8 (bitcoin_arbitrary_psbt:arm64+0x100415854)
      rust-bitcoin#8 0x0001044b0a30 in _RNCNvCsaBYAWE6hvc2_13libfuzzer_sys10initialize0B3_+0xb8 (bitcoin_arbitrary_psbt:arm64+0x100410a30)
      rust-bitcoin#9 0x0001044891bc in _RNvNtCsk9AQ7OSayGk_3std9panicking15panic_with_hook+0x264 (bitcoin_arbitrary_psbt:arm64+0x1003e91bc)
      rust-bitcoin#10 0x00010447d1f0 in _RNCNvNtCsk9AQ7OSayGk_3std9panicking13panic_handler0B5_+0x40 (bitcoin_arbitrary_psbt:arm64+0x1003dd1f0)
      rust-bitcoin#11 0x000104474b78 in _RINvNtNtCsk9AQ7OSayGk_3std3sys9backtrace26___rust_end_short_backtraceNCNvNtB6_9panicking13panic_handler0zEB6_+0x8 (bitcoin_arbitrary_psbt:arm64+0x1003d4b78)
      rust-bitcoin#12 0x00010447d800 in _RNvCseYE12Li5r0M_7___rustc17rust_begin_unwind+0x1c (bitcoin_arbitrary_psbt:arm64+0x1003dd800)
      rust-bitcoin#13 0x0001044b6150 in _RNvNtCsh0x4TIixgmZ_4core9panicking9panic_fmt+0x24 (bitcoin_arbitrary_psbt:arm64+0x100416150)
      rust-bitcoin#14 0x0001044b5f98 in _RNvNtCsh0x4TIixgmZ_4core9panicking18panic_bounds_check+0x34 (bitcoin_arbitrary_psbt:arm64+0x100415f98)
      rust-bitcoin#15 0x0001041bd2ac in _RNvMNtCs9rLNVcx1A2L_7bitcoin4psbtNtB2_4Psbt10spend_utxo+0x558 (bitcoin_arbitrary_psbt:arm64+0x10011d2ac)
      rust-bitcoin#16 0x0001040ebc3c in _RNvNvCshHXwvrCOqYg_22bitcoin_arbitrary_psbt1__19___libfuzzer_sys_run arbitrary_psbt.rs:41
      rust-bitcoin#17 0x0001040f73cc in rust_fuzzer_test_input lib.rs:276
      rust-bitcoin#18 0x00010442ca04 in _RINvNvNtCsk9AQ7OSayGk_3std9panicking12catch_unwind7do_callNCNvCsaBYAWE6hvc2_13libfuzzer_sys15test_input_wrap0lEBY_+0xc4 (bitcoin_arbitrary_psbt:arm64+0x10038ca04)
      rust-bitcoin#19 0x00010442d6cc in __rust_try+0x18 (bitcoin_arbitrary_psbt:arm64+0x10038d6cc)
      rust-bitcoin#20 0x00010442c304 in LLVMFuzzerTestOneInput+0x16c (bitcoin_arbitrary_psbt:arm64+0x10038c304)
      rust-bitcoin#21 0x00010442fd08 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)+0x158 (bitcoin_arbitrary_psbt:arm64+0x10038fd08)
      rust-bitcoin#22 0x00010444b1c8 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long)+0xd8 (bitcoin_arbitrary_psbt:arm64+0x1003ab1c8)
      rust-bitcoin#23 0x00010444fe38 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long))+0x1b8c (bitcoin_arbitrary_psbt:arm64+0x1003afe38)
      rust-bitcoin#24 0x00010445c7f0 in main+0x24 (bitcoin_arbitrary_psbt:arm64+0x1003bc7f0)
      rust-bitcoin#25 0x000198d7dd50  (<unknown module>)
  
  NOTE: libFuzzer has rudimentary signal handlers.
        Combine libFuzzer with AddressSanitizer or similar for better crash reports.
  SUMMARY: libFuzzer: deadly signal
  ────────────────────────────────────────────────────────────────────────────────
  ```


ACKs for top commit:
  tcharding:
    ACK 164a9a5
  apoelstra:
    ACK 164a9a5; successfully ran local tests


Tree-SHA512: 617843b541ecd19ade2a6dc9d449e7a5267f3f1e6c7749db16afd5d523d99dc978e43652711a3f02b2c04c94c7e6c464535e922bc0767b4a94180a0e12411ddc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.