test: Add debug output to common tested types #36091

Manually merged
rustaceanrob merged 2 commits from 26-8-25-display into master 2026-11-02 11:02:41 +00:00 AGit
rustaceanrob commented 2026-08-26 11:54:11 +00:00 (Migrated from github.com)

If the << operator exists, boost can use this as a debug output when a check fails (besides BOOST_CHECK). This adds << for types commonly used across the unit tests that do not yet have a display output. Each callsite that uses these types are then updated to use macros that will print the debug output on failure. All of these display strings would be used as part of #35713, but we can also use them with boost today.

What this PR does:

  • Adds debug output for types used across multiple files, or types that have a clear debug string, and migrates the BOOST_CHECK calls. This covers the majority of custom types that did not yet have a debug string.

What this PR does not do:

  • Migrate BOOST_CHECK callsites for types that already do have a debug output (all primitive type comparisons, CFeeRate, etc). This would be a much larger refactor and could perhaps be done after.
  • Add debug output for std::vector<T> where T is streamable. These can be migrated to BOOST_CHECK_EQUAL_COLLECTIONS, but is a similar refactor to the one above.
  • Add debug output for std::vector<unsigned char> and related. Also a large refactor, and could use discussion.
  • Add debug output for types that would require a friend method in the source code (ByRatio)
If the `<<` operator exists, boost can use this as a debug output when a check fails (besides `BOOST_CHECK`). This adds `<<` for types commonly used across the unit tests that do not yet have a display output. Each callsite that uses these types are then updated to use macros that will print the debug output on failure. All of these display strings would be used as part of #35713, but we can also use them with boost today. What this PR does: - Adds debug output for types used across multiple files, or types that have a clear debug string, and migrates the `BOOST_CHECK` calls. This covers the majority of custom types that did not yet have a debug string. What this PR does _not_ do: - Migrate `BOOST_CHECK` callsites for types that already _do_ have a debug output (all primitive type comparisons, `CFeeRate`, etc). This would be a much larger refactor and could perhaps be done after. - Add debug output for `std::vector<T>` where `T` is streamable. These can be migrated to `BOOST_CHECK_EQUAL_COLLECTIONS`, but is a similar refactor to the one above. - Add debug output for `std::vector<unsigned char>` and related. Also a large refactor, and could use discussion. - Add debug output for types that would require a `friend` method in the source code (`ByRatio`)
DrahtBot commented 2026-08-26 11:54:18 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK maflcko, ismaelsadeeq
Concept ACK sedited, brunoerg
Stale ACK jeanpablojp

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36395 (script: clarify implicit signature-cache input requirements by l0rinc)
  • #36074 (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
  • #35139 (test: Add thread-safe fast-failing test macros by maflcko)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36091 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36091.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36091#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [maflcko](https://github.com/bitcoin/bitcoin/pull/36091#issuecomment-6342758718), [ismaelsadeeq](https://github.com/bitcoin/bitcoin/pull/36091#pullrequestreview-5735273605) | | Concept ACK | [sedited](https://github.com/bitcoin/bitcoin/pull/36091#issuecomment-5425021157), [brunoerg](https://github.com/bitcoin/bitcoin/pull/36091#issuecomment-5425787470) | | Stale ACK | [jeanpablojp](https://github.com/bitcoin/bitcoin/pull/36091#issuecomment-5588206021) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36395](https://github.com/bitcoin/bitcoin/pull/36395) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36395.svg"></sub> (script: clarify implicit signature-cache input requirements by l0rinc) * [#36074](https://github.com/bitcoin/bitcoin/pull/36074) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36074.svg"></sub> (scripted-diff: [test] Add util/check.h includes for assertions by maflcko) * [#35139](https://github.com/bitcoin/bitcoin/pull/35139) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35139.svg"></sub> (test: Add thread-safe fast-failing test macros by maflcko) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
sedited commented 2026-08-26 12:07:02 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
brunoerg commented 2026-08-26 13:10:10 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
DrahtBot commented 2026-08-26 13:32:53 +00:00 (Migrated from github.com)

🚧 At least one of the CI tasks failed.
Task Windows native, fuzz, VS: https://github.com/bitcoin/bitcoin/actions/runs/32965723886/job/98167644980
LLM reason (✨ experimental): CI failed because the fuzz test target rpc crashed (exit code 3221225477, Windows access violation).

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

<!--85328a0da195eb286784d51f73fa0af9--> 🚧 At least one of the CI tasks failed. <sub>Task `Windows native, fuzz, VS`: https://github.com/bitcoin/bitcoin/actions/runs/32965723886/job/98167644980</sub> <sub>LLM reason (✨ experimental): CI failed because the fuzz test target `rpc` crashed (exit code `3221225477`, Windows access violation).</sub> <details><summary>Hints</summary> Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example: * Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch. * A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test. * An intermittent issue. Leave a comment here, if you need help tracking down a confusing failure. </details>
jeanpablojp (Migrated from github.com) reviewed 2026-08-29 15:07:18 +00:00
jeanpablojp (Migrated from github.com) left a comment

Concept ACK

Left three comments.

Concept ACK Left three comments.
jeanpablojp (Migrated from github.com) commented 2026-08-29 15:07:18 +00:00

feefrac_tests and txgraph_tests only need the FeeFrac printers, but this block drags addrman, key_io and protocol in with it. Touching addrman now rebuilds both, and it's about 12k extra preprocessed lines in the first one. Would it be worth splitting this by area?

`feefrac_tests` and `txgraph_tests` only need the `FeeFrac` printers, but this block drags addrman, key_io and protocol in with it. Touching addrman now rebuilds both, and it's about 12k extra preprocessed lines in the first one. Would it be worth splitting this by area?
jeanpablojp (Migrated from github.com) commented 2026-08-29 15:07:18 +00:00

This one leaves out nTime and nServices, which operator== does compare, so in the two addrv1/addrv2 unserialize checks a regression in time or in flags comes out as [::1]:0 != [::1]:0. The CTxDestination one prints CTxDestination() for CNoDestination and PubKeyDestination. Worth checking each printer against the type's operator==?

This one leaves out `nTime` and `nServices`, which `operator==` does compare, so in the two addrv1/addrv2 unserialize checks a regression in time or in flags comes out as `[::1]:0 != [::1]:0`. The `CTxDestination` one prints `CTxDestination()` for `CNoDestination` and `PubKeyDestination`. Worth checking each printer against the type's `operator==`?
jeanpablojp (Migrated from github.com) commented 2026-08-29 15:07:18 +00:00

Encode() asserts on an empty key, which is what DecodeExtKey leaves you with when it fails, and that's the value bip32_tests compares. I broke the decode to see. The case dies on SIGABRT and takes the following ones with it. On master the same break just prints 17 failures and the suite finishes. Worth a guard here and in the CExtPubKey one?

`Encode()` asserts on an empty key, which is what `DecodeExtKey` leaves you with when it fails, and that's the value `bip32_tests` compares. I broke the decode to see. The case dies on SIGABRT and takes the following ones with it. On master the same break just prints 17 failures and the suite finishes. Worth a guard here and in the `CExtPubKey` one?
rustaceanrob (Migrated from github.com) reviewed 2026-08-30 09:18:47 +00:00
rustaceanrob (Migrated from github.com) commented 2026-08-30 09:18:47 +00:00

If I understood this correctly I added a length guard for each of these. Lmk if that was what you were suggesting.

If I understood this correctly I added a length guard for each of these. Lmk if that was what you were suggesting.
rustaceanrob (Migrated from github.com) reviewed 2026-08-30 09:20:10 +00:00
rustaceanrob (Migrated from github.com) commented 2026-08-30 09:20:10 +00:00

Added additional info for CAddress and took a glance through the rest of the ==, I think all fields should be covered. As far as CTxDestination, I added specific displays for each variant and the CTxDestination printer now just passes through to those.

Added additional info for `CAddress` and took a glance through the rest of the `==`, I think all fields should be covered. As far as `CTxDestination`, I added specific displays for each variant and the `CTxDestination` printer now just passes through to those.
rustaceanrob (Migrated from github.com) reviewed 2026-08-30 09:28:23 +00:00
rustaceanrob (Migrated from github.com) commented 2026-08-30 09:28:23 +00:00

In the current state of #35713 I have it like this; however, I'm a little hesitant to make this change because having each test translation unit define the << would bloat the tests with additional code that doesn't pertain to the logic of the test. With everything defined in a single file, developers know where to make changes to the debug string, but otherwise it is out of the way. I can adjust if other reviewers agree with this suggestion.

In the current state of #35713 I have it like this; however, I'm a little hesitant to make this change because having each test translation unit define the `<<` would bloat the tests with additional code that doesn't pertain to the logic of the test. With everything defined in a single file, developers know where to make changes to the debug string, but otherwise it is out of the way. I can adjust if other reviewers agree with this suggestion.
jeanpablojp (Migrated from github.com) reviewed 2026-08-30 12:02:26 +00:00
jeanpablojp (Migrated from github.com) commented 2026-08-30 12:02:26 +00:00

While checking the changes I noticed a small nit. CService's == compares m_net, which the printer doesn't show, so IPv6 and CJDNS with the same bytes come out identical. MaybeFlipIPv6toCJDNS in advertise_local_address builds the pair. No check reaches that today.

While checking the changes I noticed a small nit. `CService`'s `==` compares `m_net`, which the printer doesn't show, so IPv6 and CJDNS with the same bytes come out identical. `MaybeFlipIPv6toCJDNS` in `advertise_local_address` builds the pair. No check reaches that today.
jeanpablojp (Migrated from github.com) reviewed 2026-08-30 12:03:13 +00:00
jeanpablojp (Migrated from github.com) commented 2026-08-30 12:03:13 +00:00

Yes, that's what I meant. I broke the decode again and now it prints CExtKey(<invalid>) and the suite finishes, no SIGABRT. Small thing, the CExtPubKey invalid branch says CPubExtKey.

Yes, that's what I meant. I broke the decode again and now it prints `CExtKey(<invalid>)` and the suite finishes, no SIGABRT. Small thing, the `CExtPubKey` invalid branch says `CPubExtKey`.
rustaceanrob (Migrated from github.com) reviewed 2026-08-31 11:02:59 +00:00
rustaceanrob (Migrated from github.com) commented 2026-08-31 11:02:59 +00:00

Fixed thanks

Fixed thanks
rustaceanrob (Migrated from github.com) reviewed 2026-08-31 11:04:11 +00:00
rustaceanrob (Migrated from github.com) commented 2026-08-31 11:04:11 +00:00

Added a net field to CService

Added a `net` field to `CService`
maflcko (Migrated from github.com) reviewed 2026-09-01 14:24:03 +00:00
maflcko (Migrated from github.com) commented 2026-09-01 14:24:03 +00:00

Most of the functions can be just the signature and a fwd decl for the type, and the actual stringify can move to a cpp file?

This saves re-compilation at least in the other cases (AddressPosition, etc)

Also, if this is the new display module, the other stuff should move here from ./src/test/util/common.h later?

Most of the functions can be just the signature and a fwd decl for the type, and the actual stringify can move to a cpp file? This saves re-compilation at least in the other cases (`AddressPosition`, etc) Also, if this is the new display module, the other stuff should move here from `./src/test/util/common.h` later?
rustaceanrob (Migrated from github.com) reviewed 2026-09-01 14:40:40 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-01 14:40:40 +00:00

Also, if this is the new display module, the other stuff should move here from ./src/test/util/common.h later?

This could just as well go into common, I was just trying to avoid bloat in that file bc I wasn't sure if debug outputs are "common", but I suppose they are.

Most of the functions can be just the signature and a fwd decl for the type, and the actual stringify can move to a cpp file?

This saves re-compilation at least in the other cases (AddressPosition, etc)

Sure, we can go this route. I don't have a strong preference.

> Also, if this is the new display module, the other stuff should move here from ./src/test/util/common.h later? This could just as well go into `common`, I was just trying to avoid bloat in that file bc I wasn't sure if debug outputs are "common", but I suppose they are. > Most of the functions can be just the signature and a fwd decl for the type, and the actual stringify can move to a cpp file? > This saves re-compilation at least in the other cases (AddressPosition, etc) Sure, we can go this route. I don't have a strong preference.
rustaceanrob (Migrated from github.com) reviewed 2026-09-01 15:25:25 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-01 15:25:25 +00:00

Moved the definitions to display.cpp. Can figure out the common.h situation later IMO.

Moved the definitions to `display.cpp`. Can figure out the `common.h` situation later IMO.
purpleKarrot (Migrated from github.com) reviewed 2026-09-01 16:11:01 +00:00
purpleKarrot (Migrated from github.com) commented 2026-09-01 16:11:01 +00:00

No need for separate template instantiations for each derived type:

inline std::ostream& operator<<(std::ostream& os, const FeeFrac& ff)
{
    return os << strprintf("FeeFrac(fee=%d, size=%d)", ff.fee, ff.size);
}

And then you can also move the implementation to the source file forward declare FeeFrac in the header.

No need for separate template instantiations for each derived type: ```cpp inline std::ostream& operator<<(std::ostream& os, const FeeFrac& ff) { return os << strprintf("FeeFrac(fee=%d, size=%d)", ff.fee, ff.size); } ``` And then you can also move the implementation to the source file forward declare `FeeFrac` in the header.
rustaceanrob (Migrated from github.com) reviewed 2026-09-01 16:48:00 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-01 16:48:00 +00:00

I de-templated ByRatioNegSize as well because the only intended and current use case is with FeeFrac. Updated in latest push.

I de-templated `ByRatioNegSize` as well because the only intended and current use case is with `FeeFrac`. Updated in latest push.
maflcko (Migrated from github.com) reviewed 2026-09-01 17:30:12 +00:00
maflcko (Migrated from github.com) commented 2026-09-01 17:30:12 +00:00

Why is this pair thing needed? Seems to be a single test-only thing? So either this should be moved to that test, or maybe pair should be handled generally, like the existing optional:

template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::optional<T>& v)
{
    return v ? os << *v
             : os << "std::nullopt";
}

Either would allow dropping the includes for this.

Why is this pair thing needed? Seems to be a single test-only thing? So either this should be moved to that test, or maybe pair should be handled generally, like the existing optional: ```cpp template <typename T> inline std::ostream& operator<<(std::ostream& os, const std::optional<T>& v) { return v ? os << *v : os << "std::nullopt"; } ``` Either would allow dropping the includes for this.
rustaceanrob (Migrated from github.com) reviewed 2026-09-02 09:23:10 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-02 09:23:10 +00:00

There is a callsite that uses both BOOST_CHECK and std::pair on types that do not implement <<. #35713 works around this because both types make sense as hex representations, but I couldn't compile after rebasing on this branch because operator<< resolved first. I added a requires requires(std::ostream& os, const T& t, const U& u) { os << t; os << u; }, which I think it correct. Otherwise yeah this should be general, updated in latest push.

There is a callsite that uses both `BOOST_CHECK` and `std::pair` on types that do not implement `<<`. #35713 works around this because both types make sense as hex representations, but I couldn't compile after rebasing on this branch because `operator<<` resolved first. I added a `requires requires(std::ostream& os, const T& t, const U& u) { os << t; os << u; }`, which I think it correct. Otherwise yeah this should be general, updated in latest push.
maflcko (Migrated from github.com) reviewed 2026-09-02 09:49:07 +00:00
maflcko (Migrated from github.com) commented 2026-09-02 09:49:07 +00:00

Ah interesting. I wonder if the hex fallback should be added here (even if unused). The benefit would be that the stringify logic and fallback logic would only need to be reviewed once.

Ah interesting. I wonder if the hex fallback should be added here (even if unused). The benefit would be that the stringify logic and fallback logic would only need to be reviewed once.
maflcko (Migrated from github.com) reviewed 2026-09-02 09:52:13 +00:00
maflcko (Migrated from github.com) commented 2026-09-02 09:52:13 +00:00

Can figure out the common.h situation later IMO.

It probably makes sense for HasReason to sit in the same header/module? If all display stuff is grouped with one include, it would seem odd to require another include for HasReason. But no strong opinion. Also, not sure how if this will change with https://github.com/bitcoin/bitcoin/pull/35713 and the display+HasReason stuff is provided by the framework include?

> Can figure out the `common.h` situation later IMO. It probably makes sense for `HasReason` to sit in the same header/module? If all display stuff is grouped with one include, it would seem odd to require another include for `HasReason`. But no strong opinion. Also, not sure how if this will change with https://github.com/bitcoin/bitcoin/pull/35713 and the display+`HasReason` stuff is provided by the framework include?
rustaceanrob (Migrated from github.com) reviewed 2026-09-02 10:02:10 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-02 10:02:10 +00:00

I am currently using typeid as additional information in that debug output, but that doesn't seem great since it'll be a mangled type name. Another option is to just add HexType(0x00..00). Either way, seems like that can occur in a different pull since this one is to improve specific callsites?

I am currently using `typeid` as additional information in that debug output, but that doesn't seem great since it'll be a mangled type name. Another option is to just add `HexType(0x00..00)`. Either way, seems like that can occur in a different pull since this one is to improve specific callsites?
rustaceanrob (Migrated from github.com) reviewed 2026-09-02 10:09:47 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-02 10:09:47 +00:00

I intend to invert where the display comes from so framework imports common. Since common and the header here are serving the same purpose, I think I will add these forward decl to common.h and make a common.cpp here.

I intend to invert where the display comes from so `framework` imports `common`. Since `common` and the header here are serving the same purpose, I think I will add these forward decl to `common.h` and make a `common.cpp` here.
maflcko (Migrated from github.com) approved these changes 2026-09-02 10:14:39 +00:00
maflcko (Migrated from github.com) left a comment

approach lgtm.

Haven't looked closely, but all of this seems fine.

approach lgtm. Haven't looked closely, but all of this seems fine.
rustaceanrob (Migrated from github.com) reviewed 2026-09-02 14:41:13 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-02 14:41:13 +00:00

Added common.cpp with the implementations and all forward delc to common.h in latest push

Added `common.cpp` with the implementations and all forward delc to `common.h` in latest push
ismaelsadeeq (Migrated from github.com) reviewed 2026-09-07 19:34:15 +00:00
ismaelsadeeq (Migrated from github.com) left a comment

Code review ACK 056bd2582bc96f1fc2b47933badcd4fe85832c3c

Left a few comments. I checked the new test modification and did not see any change in the test invariants.

Code review ACK 056bd2582bc96f1fc2b47933badcd4fe85832c3c Left a few comments. I checked the new test modification and did not see any change in the test invariants.
ismaelsadeeq (Migrated from github.com) commented 2026-09-07 19:05:06 +00:00

In "test: Convert BOOST_CHECK macros with known debug string" 056bd2582bc96f1fc2b47933badcd4fe85832c3c

nit: It will be nice if callers don't have to include this in order to use the displayable macros. Reviewers now have to point to pr authors so they can use it instead of boost check. Because when u use boost check equal without the include, it won't compile.

Should we make common.h self-advertising so authors discover it without a reviewer? A short header comment listing the types it makes BOOST_CHECK_*-printable, e.g.:

// Provides operator<< for these types so they can be used with BOOST_CHECK_EQUAL/_NE:
//   AddressPosition, CService, CAddress, CExtKey/CExtPubKey, FeeFrac, CTxDestination
//   (+ all its alternatives), CPubKey, KeyOriginInfo, BlockTxPosition, std::pair, ...
// Include this header in your *_tests.cpp to print values on failure.
In "test: Convert `BOOST_CHECK` macros with known debug string" 056bd2582bc96f1fc2b47933badcd4fe85832c3c nit: It will be nice if callers don't have to include this in order to use the displayable macros. Reviewers now have to point to pr authors so they can use it instead of boost check. Because when u use boost check equal without the include, it won't compile. Should we make common.h self-advertising so authors discover it without a reviewer? A short header comment listing the types it makes BOOST_CHECK_*-printable, e.g.: ```cpp // Provides operator<< for these types so they can be used with BOOST_CHECK_EQUAL/_NE: // AddressPosition, CService, CAddress, CExtKey/CExtPubKey, FeeFrac, CTxDestination // (+ all its alternatives), CPubKey, KeyOriginInfo, BlockTxPosition, std::pair, ... // Include this header in your *_tests.cpp to print values on failure. ```
ismaelsadeeq (Migrated from github.com) commented 2026-09-07 19:07:28 +00:00

In "test: Convert BOOST_CHECK macros with known debug string" 056bd2582bc96f1fc2b47933badcd4fe85832c3c

It seems you missed some.

diff
diff --git a/src/test/script_standard_tests.cpp b/src/test/script_standard_tests.cpp
index 5022e1f7b4..9c87ba7c91 100644
--- a/src/test/script_standard_tests.cpp
+++ b/src/test/script_standard_tests.cpp
@@ -242,14 +242,14 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
     s.clear();
     s << OP_DUP << OP_HASH160 << ToByteVector(pubkey.GetID()) << OP_EQUALVERIFY << OP_CHECKSIG;
     BOOST_CHECK(ExtractDestination(s, address));
-    BOOST_CHECK(std::get<PKHash>(address) == PKHash(pubkey));
+    BOOST_CHECK_EQUAL(std::get<PKHash>(address), PKHash(pubkey));

     // TxoutType::SCRIPTHASH
     CScript redeemScript(s); // initialize with leftover P2PKH script
     s.clear();
     s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL;
     BOOST_CHECK(ExtractDestination(s, address));
-    BOOST_CHECK(std::get<ScriptHash>(address) == ScriptHash(redeemScript));
+    BOOST_CHECK_EQUAL(std::get<ScriptHash>(address), ScriptHash(redeemScript));

     // TxoutType::MULTISIG
     s.clear();
@@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
     BOOST_CHECK(ExtractDestination(s, address));
     WitnessV0KeyHash keyhash;
     CHash160().Write(pubkey).Finalize(keyhash);
-    BOOST_CHECK(std::get<WitnessV0KeyHash>(address) == keyhash);
+    BOOST_CHECK_EQUAL(std::get<WitnessV0KeyHash>(address), keyhash);

     // TxoutType::WITNESS_V0_SCRIPTHASH
     s.clear();
@@ -275,14 +275,14 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
     CSHA256().Write(redeemScript.data(), redeemScript.size()).Finalize(scripthash.begin());
     s << OP_0 << ToByteVector(scripthash);
     BOOST_CHECK(ExtractDestination(s, address));
-    BOOST_CHECK(std::get<WitnessV0ScriptHash>(address) == scripthash);
+    BOOST_CHECK_EQUAL(std::get<WitnessV0ScriptHash>(address), scripthash);

     // TxoutType::WITNESS_V1_TAPROOT
     s.clear();
     auto xpk = XOnlyPubKey(pubkey);
     s << OP_1 << ToByteVector(xpk);
     BOOST_CHECK(ExtractDestination(s, address));
-    BOOST_CHECK(std::get<WitnessV1Taproot>(address) == WitnessV1Taproot(xpk));
+    BOOST_CHECK_EQUAL(std::get<WitnessV1Taproot>(address), WitnessV1Taproot(xpk));

     // TxoutType::ANCHOR
     s.clear();
In "test: Convert `BOOST_CHECK` macros with known debug string" 056bd2582bc96f1fc2b47933badcd4fe85832c3c It seems you missed some. <details> <summary>diff</summary> ```diff diff --git a/src/test/script_standard_tests.cpp b/src/test/script_standard_tests.cpp index 5022e1f7b4..9c87ba7c91 100644 --- a/src/test/script_standard_tests.cpp +++ b/src/test/script_standard_tests.cpp @@ -242,14 +242,14 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination) s.clear(); s << OP_DUP << OP_HASH160 << ToByteVector(pubkey.GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; BOOST_CHECK(ExtractDestination(s, address)); - BOOST_CHECK(std::get<PKHash>(address) == PKHash(pubkey)); + BOOST_CHECK_EQUAL(std::get<PKHash>(address), PKHash(pubkey)); // TxoutType::SCRIPTHASH CScript redeemScript(s); // initialize with leftover P2PKH script s.clear(); s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL; BOOST_CHECK(ExtractDestination(s, address)); - BOOST_CHECK(std::get<ScriptHash>(address) == ScriptHash(redeemScript)); + BOOST_CHECK_EQUAL(std::get<ScriptHash>(address), ScriptHash(redeemScript)); // TxoutType::MULTISIG s.clear(); @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination) BOOST_CHECK(ExtractDestination(s, address)); WitnessV0KeyHash keyhash; CHash160().Write(pubkey).Finalize(keyhash); - BOOST_CHECK(std::get<WitnessV0KeyHash>(address) == keyhash); + BOOST_CHECK_EQUAL(std::get<WitnessV0KeyHash>(address), keyhash); // TxoutType::WITNESS_V0_SCRIPTHASH s.clear(); @@ -275,14 +275,14 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination) CSHA256().Write(redeemScript.data(), redeemScript.size()).Finalize(scripthash.begin()); s << OP_0 << ToByteVector(scripthash); BOOST_CHECK(ExtractDestination(s, address)); - BOOST_CHECK(std::get<WitnessV0ScriptHash>(address) == scripthash); + BOOST_CHECK_EQUAL(std::get<WitnessV0ScriptHash>(address), scripthash); // TxoutType::WITNESS_V1_TAPROOT s.clear(); auto xpk = XOnlyPubKey(pubkey); s << OP_1 << ToByteVector(xpk); BOOST_CHECK(ExtractDestination(s, address)); - BOOST_CHECK(std::get<WitnessV1Taproot>(address) == WitnessV1Taproot(xpk)); + BOOST_CHECK_EQUAL(std::get<WitnessV1Taproot>(address), WitnessV1Taproot(xpk)); // TxoutType::ANCHOR s.clear(); ``` </details>
ismaelsadeeq (Migrated from github.com) commented 2026-09-07 18:53:29 +00:00

In "test: Add display operator<< overloads to common.{h,cpp}" 05bd1513be2d9aaeb0a94671024f585f0d3cca15

nit: add context to what we are displaying here and other places.

diff
diff --git a/src/test/util/common.cpp b/src/test/util/common.cpp
index ea9b42525a..6f0229c21e 100644
--- a/src/test/util/common.cpp
+++ b/src/test/util/common.cpp
@@ -44,7 +44,7 @@ std::ostream& operator<<(std::ostream& os, const CExtKey& k)
     if (!k.key.IsValid()) return os << "CExtKey(<invalid>)";
     unsigned char code[BIP32_EXTKEY_SIZE];
     k.Encode(code);
-    return os << strprintf("CExtKey(%s)", HexStr(code));
+    return os << strprintf("CExtKey(encoded=%s)", HexStr(code));
 }

 std::ostream& operator<<(std::ostream& os, const CExtPubKey& k)
@@ -52,7 +52,7 @@ std::ostream& operator<<(std::ostream& os, const CExtPubKey& k)
     if (k.pubkey.size() != CPubKey::COMPRESSED_SIZE) return os << "CExtPubKey(<invalid>)";
     unsigned char code[BIP32_EXTKEY_SIZE];
     k.Encode(code);
-    return os << strprintf("CExtPubKey(%s)", HexStr(code));
+    return os << strprintf("CExtPubKey(encoded=%s)", HexStr(code));
 }

 std::ostream& operator<<(std::ostream& os, const FeeFrac& ff)
@@ -67,32 +67,32 @@ std::ostream& operator<<(std::ostream& os, const ByRatioNegSize<FeeFrac>& b)

 std::ostream& operator<<(std::ostream& os, const CNoDestination& dest)
 {
-    return os << strprintf("CNoDestination(%s)", HexStr(dest.GetScript()));
+    return os << strprintf("CNoDestination(script=%s)", HexStr(dest.GetScript()));
 }

 std::ostream& operator<<(std::ostream& os, const PubKeyDestination& dest)
 {
-    return os << strprintf("PubKeyDestination(%s)", HexStr(dest.GetPubKey()));
+    return os << strprintf("PubKeyDestination(pubkey=%s)", HexStr(dest.GetPubKey()));
 }

 std::ostream& operator<<(std::ostream& os, const PKHash& h)
 {
-    return os << strprintf("PKHash(%s)", h.ToString());
+    return os << strprintf("PKHash(hash=%s)", h.ToString());
 }

 std::ostream& operator<<(std::ostream& os, const ScriptHash& h)
 {
-    return os << strprintf("ScriptHash(%s)", h.ToString());
+    return os << strprintf("ScriptHash(hash=%s)", h.ToString());
 }

 std::ostream& operator<<(std::ostream& os, const WitnessV0KeyHash& h)
 {
-    return os << strprintf("WitnessV0KeyHash(%s)", h.ToString());
+    return os << strprintf("WitnessV0KeyHash(hash=%s)", h.ToString());
 }

 std::ostream& operator<<(std::ostream& os, const WitnessV0ScriptHash& h)
 {
-    return os << strprintf("WitnessV0ScriptHash(%s)", h.ToString());
+    return os << strprintf("WitnessV0ScriptHash(hash=%s)", h.ToString());
 }

 std::ostream& operator<<(std::ostream& os, const WitnessUnknown& w)
@@ -107,7 +107,7 @@ std::ostream& operator<<(std::ostream& os, const PayToAnchor& p)

 std::ostream& operator<<(std::ostream& os, const WitnessV1Taproot& t)
 {
-    return os << strprintf("WitnessV1Taproot(%s)", HexStr(t));
+    return os << strprintf("WitnessV1Taproot(program=%s)", HexStr(t));
 }

 std::ostream& operator<<(std::ostream& os, const CTxDestination& dest)
@@ -118,7 +118,7 @@ std::ostream& operator<<(std::ostream& os, const CTxDestination& dest)

 std::ostream& operator<<(std::ostream& os, const CPubKey& pk)
 {
-    return os << strprintf("CPubKey(%s)", HexStr(pk));
+    return os << strprintf("CPubKey(pubkey=%s)", HexStr(pk));
 }

 std::ostream& operator<<(std::ostream& os, const KeyOriginInfo& info)
In "test: Add display `operator<<` overloads to `common.{h,cpp}`" 05bd1513be2d9aaeb0a94671024f585f0d3cca15 nit: add context to what we are displaying here and other places. <details> <summary>diff</summary> ```diff diff --git a/src/test/util/common.cpp b/src/test/util/common.cpp index ea9b42525a..6f0229c21e 100644 --- a/src/test/util/common.cpp +++ b/src/test/util/common.cpp @@ -44,7 +44,7 @@ std::ostream& operator<<(std::ostream& os, const CExtKey& k) if (!k.key.IsValid()) return os << "CExtKey(<invalid>)"; unsigned char code[BIP32_EXTKEY_SIZE]; k.Encode(code); - return os << strprintf("CExtKey(%s)", HexStr(code)); + return os << strprintf("CExtKey(encoded=%s)", HexStr(code)); } std::ostream& operator<<(std::ostream& os, const CExtPubKey& k) @@ -52,7 +52,7 @@ std::ostream& operator<<(std::ostream& os, const CExtPubKey& k) if (k.pubkey.size() != CPubKey::COMPRESSED_SIZE) return os << "CExtPubKey(<invalid>)"; unsigned char code[BIP32_EXTKEY_SIZE]; k.Encode(code); - return os << strprintf("CExtPubKey(%s)", HexStr(code)); + return os << strprintf("CExtPubKey(encoded=%s)", HexStr(code)); } std::ostream& operator<<(std::ostream& os, const FeeFrac& ff) @@ -67,32 +67,32 @@ std::ostream& operator<<(std::ostream& os, const ByRatioNegSize<FeeFrac>& b) std::ostream& operator<<(std::ostream& os, const CNoDestination& dest) { - return os << strprintf("CNoDestination(%s)", HexStr(dest.GetScript())); + return os << strprintf("CNoDestination(script=%s)", HexStr(dest.GetScript())); } std::ostream& operator<<(std::ostream& os, const PubKeyDestination& dest) { - return os << strprintf("PubKeyDestination(%s)", HexStr(dest.GetPubKey())); + return os << strprintf("PubKeyDestination(pubkey=%s)", HexStr(dest.GetPubKey())); } std::ostream& operator<<(std::ostream& os, const PKHash& h) { - return os << strprintf("PKHash(%s)", h.ToString()); + return os << strprintf("PKHash(hash=%s)", h.ToString()); } std::ostream& operator<<(std::ostream& os, const ScriptHash& h) { - return os << strprintf("ScriptHash(%s)", h.ToString()); + return os << strprintf("ScriptHash(hash=%s)", h.ToString()); } std::ostream& operator<<(std::ostream& os, const WitnessV0KeyHash& h) { - return os << strprintf("WitnessV0KeyHash(%s)", h.ToString()); + return os << strprintf("WitnessV0KeyHash(hash=%s)", h.ToString()); } std::ostream& operator<<(std::ostream& os, const WitnessV0ScriptHash& h) { - return os << strprintf("WitnessV0ScriptHash(%s)", h.ToString()); + return os << strprintf("WitnessV0ScriptHash(hash=%s)", h.ToString()); } std::ostream& operator<<(std::ostream& os, const WitnessUnknown& w) @@ -107,7 +107,7 @@ std::ostream& operator<<(std::ostream& os, const PayToAnchor& p) std::ostream& operator<<(std::ostream& os, const WitnessV1Taproot& t) { - return os << strprintf("WitnessV1Taproot(%s)", HexStr(t)); + return os << strprintf("WitnessV1Taproot(program=%s)", HexStr(t)); } std::ostream& operator<<(std::ostream& os, const CTxDestination& dest) @@ -118,7 +118,7 @@ std::ostream& operator<<(std::ostream& os, const CTxDestination& dest) std::ostream& operator<<(std::ostream& os, const CPubKey& pk) { - return os << strprintf("CPubKey(%s)", HexStr(pk)); + return os << strprintf("CPubKey(pubkey=%s)", HexStr(pk)); } std::ostream& operator<<(std::ostream& os, const KeyOriginInfo& info) ``` </details>
ismaelsadeeq (Migrated from github.com) commented 2026-09-07 19:31:57 +00:00

In "test: Add display operator<< overloads to common.{h,cpp}" 05bd1513be2d9aaeb0a94671024f585f0d3cca15

Should we add for script too?

std::ostream& operator<<(std::ostream& os, const CScript& script);

In "test: Add display `operator<<` overloads to `common.{h,cpp}`" 05bd1513be2d9aaeb0a94671024f585f0d3cca15 Should we add for script too? ```suggestion std::ostream& operator<<(std::ostream& os, const CScript& script); ```
rustaceanrob (Migrated from github.com) reviewed 2026-09-08 09:25:12 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-08 09:25:12 +00:00

Makes sense. Applied those changes as well as adding a addr field to CService and CAddress.

Makes sense. Applied those changes as well as adding a `addr` field to `CService` and `CAddress`.
rustaceanrob (Migrated from github.com) reviewed 2026-09-08 09:25:50 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-08 09:25:50 +00:00

Applied those changes, thanks

Applied those changes, thanks
rustaceanrob (Migrated from github.com) reviewed 2026-09-08 09:27:07 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-08 09:27:07 +00:00

Yeah, definitely, I added a debug output and modified psbt_tests and script_tests to include it.

Yeah, definitely, I added a debug output and modified `psbt_tests` and `script_tests` to include it.
rustaceanrob (Migrated from github.com) reviewed 2026-09-08 10:50:26 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-08 10:50:26 +00:00

Added a comment to common.h describing the purpose of the file. I think it would be a bit cumbersome to update the list on each addition to this file, and the developer would already be either in the file or one click away, so I noted that debug-available types are listed in the header.

Added a comment to `common.h` describing the purpose of the file. I think it would be a bit cumbersome to update the list on each addition to this file, and the developer would already be either in the file or one click away, so I noted that debug-available types are listed in the header.
jeanpablojp (Migrated from github.com) reviewed 2026-09-08 13:13:38 +00:00
jeanpablojp (Migrated from github.com) left a comment

tACK 0560c013476708771cf9141fda54410cbee07645

Rebuilt and ran the unit tests on this head. Left one non-blocking nit.

tACK 0560c013476708771cf9141fda54410cbee07645 Rebuilt and ran the unit tests on this head. Left one non-blocking nit.
jeanpablojp (Migrated from github.com) commented 2026-09-08 13:13:38 +00:00

nit: ScriptToAsmStr decodes any push of up to four bytes as a number, so scripts that differ in bytes can come out as the same string.

A P2WPKH scriptPubKey and the same script with OP_0 replaced by a one-byte zero push, which is no longer a witness program, both print the same, and psbt_tests compares exactly GetScriptForDestination(WitnessV0KeyHash{...}). Would it be worth adding hex=%s alongside?

nit: `ScriptToAsmStr` decodes any push of up to four bytes as a number, so scripts that differ in bytes can come out as the same string. A P2WPKH scriptPubKey and the same script with `OP_0` replaced by a one-byte zero push, which is no longer a witness program, both print the same, and `psbt_tests` compares exactly `GetScriptForDestination(WitnessV0KeyHash{...})`. Would it be worth adding `hex=%s` alongside?
rustaceanrob (Migrated from github.com) reviewed 2026-09-08 13:31:55 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-08 13:31:55 +00:00

Nice find. Somewhat unfortunate to make the debug output longer here, but given the ASM will be the most useful a majority of the time, with the possibility of needing to use hex, I added the hex string alongside the ASM in the latest push.

Nice find. Somewhat unfortunate to make the debug output longer here, but given the ASM will be the most useful a majority of the time, with the possibility of needing to use hex, I added the hex string alongside the ASM in the latest push.
ismaelsadeeq (Migrated from github.com) reviewed 2026-09-08 15:30:17 +00:00
ismaelsadeeq (Migrated from github.com) left a comment

reACK 387e443275, all my suggestions were addressed.

reACK 387e443275587a46c25f21ed5e05e02439140a5a, all my suggestions were addressed.
jeanpablojp commented 2026-09-08 16:08:54 +00:00 (Migrated from github.com)

re-ACK 387e443275

re-ACK 387e443275587a46c25f21ed5e05e02439140a5a
sedited (Migrated from github.com) reviewed 2026-09-14 15:47:31 +00:00
sedited (Migrated from github.com) commented 2026-09-14 15:47:31 +00:00

How exhaustive is the conversion supposed to be? In this file alone there seem to be more cases where we compare scriptsigs.

How exhaustive is the conversion supposed to be? In this file alone there seem to be more cases where we compare scriptsigs.
rustaceanrob (Migrated from github.com) reviewed 2026-09-15 09:24:21 +00:00
rustaceanrob (Migrated from github.com) commented 2026-09-15 09:24:21 +00:00

It is intended to be completely exhaustive for the types with << added here. I ran the following: rg -nP '\bBOOST_CHECK(?!_)\s*\(\s*(?=[^()\n]*(?:==|!=|<=|>=|<|>))[^()\n]*\)' which showed quite a few additional sites I missed that have been updated now (descriptor_tests, key_tests, script_standard_tests, script_tests). Should be cleaned up now, updated in latest push.

That grep also showed a number of sites that could be converted from BOOST_CHECK to BOOST_CHECK_* bc the types have operator<<, but those could be done as follow up or deferred.

It is intended to be completely exhaustive for the types with << added here. I ran the following: `rg -nP '\bBOOST_CHECK(?!_)\s*\(\s*(?=[^()\n]*(?:==|!=|<=|>=|<|>))[^()\n]*\)'` which showed quite a few additional sites I missed that have been updated now (`descriptor_tests`, `key_tests`, `script_standard_tests`, `script_tests`). Should be cleaned up now, updated in latest push. That grep also showed a number of sites that could be converted from `BOOST_CHECK` to `BOOST_CHECK_*` bc the types have `operator<<`, but those could be done as follow up or deferred.
ismaelsadeeq commented 2026-09-15 15:27:46 +00:00 (Migrated from github.com)

reACK fc42f878cb

The recent push converted a few call sites that were supposed to be converted from bare boost check but are left out.

I also used the same rg -nP '\bBOOST_CHECK(?!_)\s*\(\s*(?=[^()\n]*(?:==|!=|<=|>=|<|>))[^()\n]*\)' command and inspected the remaining ones; there are some that can also have a display string like TxGraph::Ref. Intentional I guess?
Integer comparisons are left untouched as well. Also intentional?

The PR description should be more explicit about this and the rationale.

This is a nice cleanup consequence of the main goal, which is replacing the framework, and I support it, but AFAICT only the first commit is needed ed9dd30570 for the main PR https://github.com/bitcoin/bitcoin/pull/35713,

reACK fc42f878cb578f9d91d6b11e8dd6fe2057a54fbc The recent push converted a few call sites that were supposed to be converted from bare boost check but are left out. I also used the same `rg -nP '\bBOOST_CHECK(?!_)\s*\(\s*(?=[^()\n]*(?:==|!=|<=|>=|<|>))[^()\n]*\)'` command and inspected the remaining ones; there are some that can also have a display string like `TxGraph::Ref`. Intentional I guess? Integer comparisons are left untouched as well. Also intentional? The PR description should be more explicit about this and the rationale. This is a nice cleanup consequence of the main goal, which is replacing the framework, and I support it, but AFAICT only the first commit is needed ed9dd305702f58bfb1872434d135cd3858cb4010 for the main PR https://github.com/bitcoin/bitcoin/pull/35713,
rustaceanrob commented 2026-09-16 09:58:40 +00:00 (Migrated from github.com)

Thanks, I updated the description to be more thorough as far as what this seeks to accomplish.

Integer comparisons are left untouched as well. Also intentional?

Yes, added to description

there are some that can also have a display string like TxGraph::Ref

What is being compared in those tests is std::vector<std::vector<TxGraph::Ref*>>, which is more nuanced. Also updated the description.

Thanks, I updated the description to be more thorough as far as what this seeks to accomplish. > Integer comparisons are left untouched as well. Also intentional? Yes, added to description > there are some that can also have a display string like TxGraph::Ref What is being compared in those tests is `std::vector<std::vector<TxGraph::Ref*>>`, which is more nuanced. Also updated the description.
ismaelsadeeq (Migrated from github.com) reviewed 2026-09-21 12:40:32 +00:00
ismaelsadeeq (Migrated from github.com) left a comment

reACK e239d936cf

reACK e239d936cf0f294760e26c4824c022c0b66d8036
ismaelsadeeq (Migrated from github.com) commented 2026-09-21 12:40:08 +00:00

In b6ec94b700 "test: Add display operator<< overloads to common.{h,cpp}"

minor grammar nit:

// Bitcoin Core types are printable by BOOST_CHECK_*. Include this from
In b6ec94b70016d132438ac4c0c6b740b5626a6f08 "test: Add display `operator<<` overloads to `common.{h,cpp}`" minor grammar nit: ```suggestion // Bitcoin Core types are printable by BOOST_CHECK_*. Include this from ```
rustaceanrob commented 2026-09-24 10:52:32 +00:00 (Migrated from github.com)

Fixed a silent build error where Encode was removed and added another callsite migration of an XOnlyPubkey 1f6262c559

Fixed a silent build error where `Encode` was removed and added another callsite migration of an `XOnlyPubkey` 1f6262c5599124a093589725d7f9311645ea92be
ismaelsadeeq commented 2026-09-28 12:19:25 +00:00 (Migrated from github.com)

reACK 1f6262c559

reACK 1f6262c5599124a093589725d7f9311645ea92be
First-time contributor

Base: f655a8df755330911c6c109c8b1d04ef5dd4ea09
Head: 722d08e03980c359bae4e3b65551d6b8ba615a7a

No verified findings are available from this review.

Review coverage was incomplete.

Review limitations
  • adversarial_deepseek: Stage did not complete (ValueError).
  • verifier: Finding withheld: Source evidence does not match the snapshot

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:b41bdf4ebdd51f70cc4e325a472af5d26b399a00336f341a1856879961e0f932:f359184720b19d8f4199eb38e750c73a24dbe6263b5428fbe549b1858030cb9b --> Base: `f655a8df755330911c6c109c8b1d04ef5dd4ea09` Head: `722d08e03980c359bae4e3b65551d6b8ba615a7a` No verified findings are available from this review. Review coverage was incomplete. <details> <summary>Review limitations</summary> - adversarial_deepseek: Stage did not complete (ValueError). - verifier: Finding withheld: Source evidence does not match the snapshot </details> [Full review report](<https://review.fish.foo/traces/36091-722d08e03980c359bae4e3b65551d6b8ba615a7a-1113-5.html>)
maflcko commented 2026-10-16 09:27:43 +00:00 (Migrated from github.com)

I haven't reviewed that the printing of fields is exhaustive, nor that the replacement is exhaustive, but this is just adding more test debug logs, which seems harmless. lgtm.

I haven't reviewed that the printing of fields is exhaustive, nor that the replacement is exhaustive, but this is just adding more test debug logs, which seems harmless. lgtm.
maflcko (Migrated from github.com) approved these changes 2026-10-16 09:27:47 +00:00
maflcko (Migrated from github.com) left a comment

happy to re-ack for the nits, but up to you.

review ACK cf4412a592 🌧

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK cf4412a5929433e58ee18239fb3537f4002fd76b 🌧
K4snwm53hTQ4QCiUNy/utaWGcYvfKvlCoMkHzlE5RuZyzfuk4MGL5WV9ES2iGzqTqcp/ey3kz/1E87k8uCwpDA==
happy to re-ack for the nits, but up to you. review ACK cf4412a5929433e58ee18239fb3537f4002fd76b 🌧 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK cf4412a5929433e58ee18239fb3537f4002fd76b 🌧 K4snwm53hTQ4QCiUNy/utaWGcYvfKvlCoMkHzlE5RuZyzfuk4MGL5WV9ES2iGzqTqcp/ey3kz/1E87k8uCwpDA== ``` </details>
maflcko (Migrated from github.com) commented 2026-10-16 09:09:34 +00:00

nit: I find SpanWriter{code} << k; more readable.

nit: I find `SpanWriter{code} << k;` more readable.
maflcko (Migrated from github.com) commented 2026-10-16 08:52:36 +00:00

nit in 05053fc29c: Could forward to op<<(const Cscript&) ?

nit in 05053fc29c78a1c30c8bf497de0df1f01139092a: Could forward to op<<(const Cscript&) ?
maflcko (Migrated from github.com) commented 2026-10-16 08:53:49 +00:00

same: fwd?

same: fwd?
maflcko (Migrated from github.com) commented 2026-10-16 09:03:25 +00:00

nit: should this say std::pair(_, _) ?

nit: should this say `std::pair(_, _)` ?
rustaceanrob commented 2026-10-17 02:20:51 +00:00 (Migrated from github.com)

Addressed review aa94fda3ad

Addressed review aa94fda3adf5600dc593f7520789f4b6c18de865
maflcko commented 2026-10-19 12:45:43 +00:00 (Migrated from github.com)

review ACK aa94fda3ad 🗝

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK aa94fda3adf5600dc593f7520789f4b6c18de865 🗝
X6/2GLbSOHiPSS91RYXOABcb9wTtwofUN3080iszsKEY1j2WqedUHsh+h6n3FNjnPES0BZKOeQMMARrkzO1LBQ==
review ACK aa94fda3adf5600dc593f7520789f4b6c18de865 🗝 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK aa94fda3adf5600dc593f7520789f4b6c18de865 🗝 X6/2GLbSOHiPSS91RYXOABcb9wTtwofUN3080iszsKEY1j2WqedUHsh+h6n3FNjnPES0BZKOeQMMARrkzO1LBQ== ``` </details>
sedited commented 2026-10-21 14:24:24 +00:00 (Migrated from github.com)

Looks like a few more arrived in the meantime:

diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp
index 4cc9822d932..c18a2fc9837 100644
--- a/src/test/bip32_tests.cpp
+++ b/src/test/bip32_tests.cpp
@@ -142,2 +142,2 @@ void RunTest(const TestVector& test)
-        BOOST_CHECK(key_deser == key);
-        BOOST_CHECK(pubkey_deser == pubkey);
+        BOOST_CHECK_EQUAL(key_deser, key);
+        BOOST_CHECK_EQUAL(pubkey_deser, pubkey);
@@ -236 +236 @@ BOOST_AUTO_TEST_CASE(bip32_deserialize_invalid)
-        BOOST_CHECK(key == master);
+        BOOST_CHECK_EQUAL(key, master);
@@ -245 +245 @@ BOOST_AUTO_TEST_CASE(bip32_deserialize_invalid)
-        BOOST_CHECK(pubkey == master_pub);
+        BOOST_CHECK_EQUAL(pubkey, master_pub);
diff --git a/src/test/bip352_tests.cpp b/src/test/bip352_tests.cpp
index 09660e5644c..36c8c79db59 100644
--- a/src/test/bip352_tests.cpp
+++ b/src/test/bip352_tests.cpp
@@ -313 +313 @@ BOOST_AUTO_TEST_CASE(bip352_p2pkh_pubkey_extraction_with_checksig_in_scriptsig)
-    BOOST_CHECK(std::get<CPubKey>(*extracted_pubkey) == pubkey);
+    BOOST_CHECK_EQUAL(std::get<CPubKey>(*extracted_pubkey), pubkey);
diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp
index ddcb8285ac8..ba37ce0f687 100644
--- a/src/test/key_tests.cpp
+++ b/src/test/key_tests.cpp
@@ -358 +358 @@ BOOST_AUTO_TEST_CASE(key_ellswift)
-        BOOST_CHECK(key.GetPubKey() == decoded_pubkey);
+        BOOST_CHECK_EQUAL(key.GetPubKey(), decoded_pubkey);

Can you add these? The PR seems good to go otherwise.

Looks like a few more arrived in the meantime: ```diff diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp index 4cc9822d932..c18a2fc9837 100644 --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -142,2 +142,2 @@ void RunTest(const TestVector& test) - BOOST_CHECK(key_deser == key); - BOOST_CHECK(pubkey_deser == pubkey); + BOOST_CHECK_EQUAL(key_deser, key); + BOOST_CHECK_EQUAL(pubkey_deser, pubkey); @@ -236 +236 @@ BOOST_AUTO_TEST_CASE(bip32_deserialize_invalid) - BOOST_CHECK(key == master); + BOOST_CHECK_EQUAL(key, master); @@ -245 +245 @@ BOOST_AUTO_TEST_CASE(bip32_deserialize_invalid) - BOOST_CHECK(pubkey == master_pub); + BOOST_CHECK_EQUAL(pubkey, master_pub); diff --git a/src/test/bip352_tests.cpp b/src/test/bip352_tests.cpp index 09660e5644c..36c8c79db59 100644 --- a/src/test/bip352_tests.cpp +++ b/src/test/bip352_tests.cpp @@ -313 +313 @@ BOOST_AUTO_TEST_CASE(bip352_p2pkh_pubkey_extraction_with_checksig_in_scriptsig) - BOOST_CHECK(std::get<CPubKey>(*extracted_pubkey) == pubkey); + BOOST_CHECK_EQUAL(std::get<CPubKey>(*extracted_pubkey), pubkey); diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index ddcb8285ac8..ba37ce0f687 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -358 +358 @@ BOOST_AUTO_TEST_CASE(key_ellswift) - BOOST_CHECK(key.GetPubKey() == decoded_pubkey); + BOOST_CHECK_EQUAL(key.GetPubKey(), decoded_pubkey); ``` Can you add these? The PR seems good to go otherwise.
maflcko commented 2026-10-22 14:06:25 +00:00 (Migrated from github.com)

review ACK 722d08e039 🍟

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 722d08e03980c359bae4e3b65551d6b8ba615a7a  🍟
v/TIMYV8+I/ICEvbKY7NIPxggcj0d2ExqVd4OBC94tqoDMnWI22wUDBNiCDq0ecv3BNhL5Re6wKTvzVRF9HSAg==
review ACK 722d08e03980c359bae4e3b65551d6b8ba615a7a 🍟 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK 722d08e03980c359bae4e3b65551d6b8ba615a7a 🍟 v/TIMYV8+I/ICEvbKY7NIPxggcj0d2ExqVd4OBC94tqoDMnWI22wUDBNiCDq0ecv3BNhL5Re6wKTvzVRF9HSAg== ``` </details>
ismaelsadeeq (Migrated from github.com) reviewed 2026-11-02 10:37:36 +00:00
ismaelsadeeq (Migrated from github.com) left a comment

reACK 722d08e039

Some nits were addressed, and more conversions of boost check to boost check equal.

reACK 722d08e03980c359bae4e3b65551d6b8ba615a7a Some nits were addressed, and more conversions of boost check to boost check equal.
maflcko commented 2026-11-02 10:49:24 +00:00 (Migrated from github.com)

rfm? This is in a rebase,re-ack,nit loop for several months now?

rfm? This is in a rebase,re-ack,nit loop for several months now?
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36091
No description provided.