Skip to content

Conversation

@OttoAllmendinger
Copy link

No description provided.

storopoli and others added 30 commits October 31, 2025 20:00
The XOnlyPublicKey struct wraps a similar secp256k1 struct, and can
be constructed from the secp256k1 type. For code that requires the
secp key type, we have no way to convert our XOnlyPublicKey type back
to a secp type.

Add an into_inner() function on the XOnlyPublicKey struct
implementation to return the internal secp256k1 XOnlyPublicKey.
These tests sanity check the implementations of the from_byte_array
and into_inner functions in the XOnlyPublicKey struct implementation.
…all crates.

bc1f3c8 benches: add clippy::use_self lint (Jose Storopoli)
986382a fuzz: add clippy::use_self lint (Jose Storopoli)
7a970b1 consensus_encoding: add clippy::use_self lint (Jose Storopoli)
d45a964 chacha20_poly1305: add clippy::use_self lint (Jose Storopoli)
1dc3100 internals: add clippy::use_self lint (Jose Storopoli)
6826014 addresses: add clippy::use_self lint (Jose Storopoli)
bbf36a0 hashes: add clippy::use_self lint (Jose Storopoli)
dee68a8 base58: add clippy::use_self lint (Jose Storopoli)
29f9b11 units: add clippy::use_self lint (Jose Storopoli)
4c28783 p2p: add clippy::use_self lint (Jose Storopoli)
e4d51dc io: add clippy::use_self lint (Jose Storopoli)
f4d7e05 primitives: add clippy::use_self lint (Jose Storopoli)
8a8b12e bitcoin: add clippy::use_self lint (Jose Storopoli)

Pull request description:

  Adds [Clippy's `use_self` lint](https://rust-lang.github.io/rust-clippy/stable/index.html#use_self) to all crates in the repo.
  
  Suggested by Poelstra in #5197.
  Speaking of #5197, this needs to be rebased after that one is merged, keeping this a draft until.
  
  This lint disallows returning the same type by name and suggests to use `Self`, as in this example:
  
  ```rs
  // BAD!
  struct Foo;
  impl Foo {
      fn new() -> Foo {
          Foo {}
      }
  }
  
  // GOOD!
  struct Foo;
  impl Foo {
      fn new() -> Self {
          Self {}
      }
  }
  ```
  
  EDIT: All changes were made using `cargo clippy --workspace --all-features --bins --tests --examples --benches --fix`
  
  ~~EDIT 2: Oh fuck, the API files. Will fix these.~~ Done!


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


Tree-SHA512: 929ca4d6963953c22d81d4a105428d79be00a240af2bc91fb8f609593d9fadbd12fe06a668a606a21c8a27a94a5b1f1ba0a9687453cf36ec2b4228d900b10c24
…yPublicKey

bae0c57 Add tests for XOnlyPublicKey functions (Mitchell Bagot)
4c5ffff Add unwrapping function to XOnlyPublicKey (Mitchell Bagot)

Pull request description:

  The XOnlyPublicKey struct wraps a similar secp256k1 struct, and can be constructed from the secp256k1 type. For code that requires the secp key type, we have no way to convert our XOnlyPublicKey type back to a secp type.
  
  Add an into_inner() function on the XOnlyPublicKey struct implementation to return the internal secp256k1 XOnlyPublicKey
  Add tests for the new into_inner() function, and the from_byte_array() function in XOnlyPublicKey
  
  Closes #5201


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


Tree-SHA512: 3b6541363aebd934449ececab5e168f7fe061edbad6866b86cffe8b19c00e8beb5dc19efd3fb8ecc1e31967779dbdb0e14782e7ab5ca116503a70a1a0bc4db9a
Vibe code up a script that generates a test in `primitives` based on
stuff in the API file `api/units/all-features.txt`.

The idea is that we can run this script in CI then run the tests and
make sure it passes.
Currently, serde's serialize_str uses to_string, which requires an
expensive allocation on each call. as_str, by definition, produces
the same result, but does not require an allocation.

Introduce the as_str method in the Opcode implementation and change
the serialize_str call to use as_str in place of to_string.
…-11-02)

31658bb 2025-11-02 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 31658bb; successfully ran local tests
  tcharding:
    ACK 31658bb


Tree-SHA512: 8ce0d5e190ffbcc970c3d10be8fa597774763af10b57994371e371860b53d5ea5d6024c9d66438112614f8933ad4f3930a8837bb46f7192fb70953ef13c9252d
… in `primitives` vs `units`

65c8135 Add a script that generates a Rust test to check re-exports (Tobin C. Harding)
7164312 Update the API text files (Tobin C. Harding)
c5de1a6 primitives: Re-export block encoder/decoder (Tobin C. Harding)

Pull request description:

  Add a script that generates a Rust test to check re-exports
   
  Vibe code up a script that generates a test in `primitives` based on stuff in the API file `api/units/all-features.txt`.
   
  The idea is that we can run this script in CI then run the tests and make sure it passes.


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


Tree-SHA512: c1ba977797d8b54c96fb60a878a05296df27e600f3a8191616121948e848342bc62a077a357a28e7f22fd910fd7d4d02f4ac7e938b1f26d9533087ebdb7c4e63
Prefix with `self::` and group the pub re-export with the others.

Done because in #5233 the formatter bot munged the public and private
imports together.

No logic change.
Mutation testing found a mutant in
`<impl Encoder for Option<T>>::current_chunk`.

Add a test for both the Some and None cases.
Mutation testing found a mutant in calculating the remaining bytes to
decode in `<impl Decoder for ByteVecDecoder>::push_bytes`.

Add tests for both single and multi-chunk consumption.
Mutation testing found a mutant in decode_from_read.

Add a decode_from_read test the same as `decode_from_slice_extra_data`
and `decode_from_read_unbuffered_extra_data`.
One of the excludes for units was under the primitives heading.

Move it to the correct section.
The exclusions are organized by crate but have no crate specifier. They
are therefore applied to all crates.

Add the crate specifier to make them crate specific. And change Time to
LockTime to be more specific.
Mutation testing in consensus_encoding changes the logic that determines
when to stop decoding or encoding. These prevent the encoding or
decoding from ending.

Exclude the mutants that cause infinite loops.
nyonson and others added 29 commits December 11, 2025 13:53
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.
I never was really happy with the local variable `rinsed` but never
came up with a better one. In #5386 Mitch introduced `roundtrip`
instead, I like that better - use it everywhere.
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)
fix output heap size and remove stale line about secp buf size
…y by dropping pow validation

6710add p2p: remove HeaderExt dependency (Nick Johnson)

Pull request description:

  This breaks another link between p2p and bitcoin. p2p is focused on encoding and decoding the peer to peer messages, the POW validation should probably be on the caller or perhaps added to the primitives decoder.


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


Tree-SHA512: 371fbd7ffad1e5bfe0928527a2e0cf0dec7d38ba4c86675f604b7f267717e42456249b6d847a60ccab06d058be1e1b79781519171f6f0bcf4be674de4911e06d
…y() following a push_int()

c7aee58 Fix script::Builder::push_verify() following a push_int() (Nadav Ivgi)

Pull request description:

  For example, prior to this fix, attempting to `push_verify()` on `OP_EQUAL OP_5` would pop the `OP_5` and replace it with the verify opcode, resulting in `OP_EQUAL OP_EQUALVERIFY` (instead of `OP_EQUAL OP_5 OP_VERIFY`).


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


Tree-SHA512: 85bf5c9de528e9e8ccc69bb221e0b79b74c525613edfe0d21db3f5dbfb40c9656aa36ae6b0365a46afd0ddac40d60d4c9cd408d16c1129554568cc0b8debf785
…ribute

a7aa12b Put feature gate below test attribute (Tobin C. Harding)

Pull request description:

  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)


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


Tree-SHA512: 9914665b05e5bcd2cc3db60d474c4d78c615b15d2c0ef3d13fbc110a390486dc5e99e71108e227f77dd91ea244720e8cb2de896579242f98878d4db62db357ce
…c stable (to 1.92.0)

e1ffc92 Automated update to Github CI to rustc stable-1.92.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 e1ffc92


Tree-SHA512: e29c1cd30f7f7a40338fd2548520b76c6929fb347eb1fb238a716b9688b4bb3ba3242c1fa78b53541d71f0ad96283dd86e4068baa5b4e0d323ad6bd1dfa91e5c
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.
This was added solely so that we could call it in the consensus
decoding function in `bitcoin`. That call site no longer exists,
remove the function.
….33.0-beta.0`

2714cde bitcoin: Update changelog (Tobin C. Harding)
a702689 bitcoin: Use beta in release name (Tobin C. Harding)

Pull request description:

  Set the version to `1.0.0-beta.0`, add a changelog, and update the lock files.


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


Tree-SHA512: 97877dda69d646f900aeaa24e068cb68d59e69e40368b4cef024d88931392b41c1187b2c95f21d9b65b23f8225b187b7a31c47cde891cc9e095716ceb0f3b6c5
These structs only contain integers or references, so they should be
Copy.
50c5867 Use roundtrip instead of rinsed (Tobin C. Harding)

Pull request description:

  I never was really happy with the local variable `rinsed` but never came up with a better one. In #5386 Mitch introduced `roundtrip` instead, I like that better - use it everywhere.


ACKs for top commit:
  apoelstra:
    ACK 50c5867; successfully ran local tests; heh yes, "rinsed" does sound aggressively Commonwealth


Tree-SHA512: ffed1735aa72fcb0463159cf3fba924ffe56853fb18d62f40a040d01df171c39d17a474de808a98764275b7f714b64e4db44458b05d48bf85e229dd388a1ebce
f11e836 Add missing release note links (Nick Johnson)
db642c9 Move maintainer docs to CONTRIBUTING (Nick Johnson)
8a91a71 Remove redundant readme sections in packages (Nick Johnson)

Pull request description:

  All doc changes, but let me know if controversial.
  
  For the first patch, I noticed the `consensus_encoding` docs had drifted from reality. At this point, are "MSRV" and "License" sections needed in all the package READMEs if they are already required in the package manifests? Dropping them is one less thing to maintain, and I don't think it effects the end user much because the manifest info is already shown well on sites like crates.io.
  
  The second patch cleans up the root README a bit. I moved anything I considered "maintainer docs" into CONTRIBUTING, so that the README is more end user focused.
  
  Third patch just adds some missing CHANGELOG links.


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


Tree-SHA512: 445fcb94ded0a636d320a77c26970b1a087905c728540cfd3334ac221571672a23ef30ba068c3ff6e11d43432cbed166c423de7bd52fc2daea5ce3ba19cbae43
397aeb0 chore: Implement Copy (Christian Lewe)

Pull request description:

  Implement `Copy` for some sighash-related structs. The implementation will be disabled for `T: Borrow<TxOut>` that are not `Copy`.
  
  Also note that the entire `SighashCache` could be `Copy`, since it contains only hashes. This may or may not be desirable from an API perspective.


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


Tree-SHA512: 5542ab778ff1f45b8e8b057f66e2eb50558aac79ae18acb3d975302d128fda2419e27d663cdaf4fd1fb5a76fe8194748c99520eb9b712dd7924e31a521af0f48
…stable`

9b261de primitives: Remove Witness::from_parts__unstable (Tobin C. Harding)
f9a6b37 Implement Decodable for Witness using encoding crate (Tobin C. Harding)

Pull request description:

  This is nice enough now. Use the new `consensus_encoding` crate to decode a `Witness` (in `bitcoin`). Then remove the `from_parts__unstable` function.
  
  Close #4062


ACKs for top commit:
  apoelstra:
    ACK 9b261de; successfully ran local tests; I think we should do this before the beta release


Tree-SHA512: 2f30b9ed4e88245851c9e6fbc3ad7161a009ee7f4d61fdc8f5831d4c81e74b162907b7b3d2fb633dc0522ac3671e737df3ee7f5df2d7e80f68993170687d8881
…e lint rules

404646b primitives: migrate to workspace lint rules (Nick Johnson)

Pull request description:

  


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


Tree-SHA512: a8ea1b3f675020f7bb15c07583494fdd2a97de4a2fa272c18efd0e6edb9383eb521201b530886ec6a3acae2f592ef01b40f6264bb745d00f2336dbc7c7ed5a59
A push for `0x00` (a single byte) is different from a push for the
number 0 (an empty byte array), not a different non-minimally-encoded
representation of the same thing.

Prior to this fix, pushing `0x00` would actually push an empty byte
array instead.
And delegate Builder::push_slice() to use it.
…sign doc

cc459d9 docs: extend consensus encoding adr with tech design (Nick Johnson)

Pull request description:

  This might be jumping the gun a bit, but wanted to write it down while still fresh. And I think the interface is solidifying at this point.


ACKs for top commit:
  apoelstra:
    ACK cc459d9; successfully ran local tests; amazing!
  tcharding:
    ACK cc459d9


Tree-SHA512: c15cc0f851083d2b2b58aefeb6e19c3a2f2b723d99e851b26c9799d7d5b312eb913204caf88b600cb87076922e36ae9269693e212e3e0100d9339fdf202603f7
… and code

d9af54d docs: fix mismatch between docs and code (Bashmunta)

Pull request description:

  in bitcoin/embedded/src/main.rs
  
  ```rust
  const HEAP_SIZE: usize = 1024 * 256; // 256 KB
  ```
  
  but in Readme it was heap size 524288.


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


Tree-SHA512: 3d4a1cc5886c586415491eb8fd62a3b9ff0bc24be1e36aa0834421856444e64ad58f663a4eacf50758c93c27c27c5be16f226c4bd2bff3cc19733a7592dbb57b
…ng of 0x00

24d7a39 Add comment explaining push_slice()'s minimality (Nadav Ivgi)
cf8c1a5 Fix ScriptBuf::push_slice() handling of 0x00 (Nadav Ivgi)
0b9094c Fix push_slice() tests (Nadav Ivgi)
6a66254 Fix script::Builder::push_slice() handling of 0x00 (Nadav Ivgi)

Pull request description:

  A push for `0x00` (a single byte) is different from a push for the number 0 (an empty byte array), not a different non-minimally-encoded representation of the same thing.
  
  Prior to this fix, pushing `0x00` would actually push an empty byte array instead.


ACKs for top commit:
  tcharding:
    ACK 24d7a39
  jrakibi:
    ACK 24d7a39
  apoelstra:
    ACK 24d7a39; successfully ran local tests


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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.