Skip to content

fix: no Debug on Display implementations#2083

Open
Dmenec wants to merge 4 commits intobitcoindevkit:masterfrom
Dmenec:fix/no-debug-on-display-impls
Open

fix: no Debug on Display implementations#2083
Dmenec wants to merge 4 commits intobitcoindevkit:masterfrom
Dmenec:fix/no-debug-on-display-impls

Conversation

@Dmenec
Copy link

@Dmenec Dmenec commented Dec 11, 2025

Description

Fixes #1933, remove the usage of Debug on Display implemetations mentioned in #1881 (comment)

Changelog notice

  • Replaced Debug usage with Display messages for InsertDescriptorError, CalculateFeeError and StoreError.
  • InvalidMagicBytes now displays expected and actual bytes in hexadecimal instead of using Debug.
  • Added a new short_descriptor function to shorten descriptors for concise error output.
  • Added detailed SyncRequest Display for Esplora and Electrum examples.

Checklists

All Submissions:

  • I have signed all my commits
  • I followed the contribution guidelines
  • I ran just check, just fmt and just test before committing

@ValuedMammal ValuedMammal moved this to In Progress in BDK Chain Dec 12, 2025
@ValuedMammal ValuedMammal added this to the Chain 0.24.0 milestone Dec 12, 2025
@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch from 492114b to b73016e Compare December 14, 2025 14:57
@qatkk
Copy link

qatkk commented Dec 21, 2025

Concept ACK — this approach looks good, thanks for the changes. I ran the tests locally and they all passed.

While trying to recreate the initial issue’s scenario (#1933), I found that bdk_wallet master still references the older API names (list_canonical_txsfilter_chain_unspentsfilter_chain_txoutsfrom_genesis_hash), whereas this PR’s bdk_chain exposes the newer canonicalization API (canonical_iter) and LocalChain::from_genesis. As a result, building bdk_wallet against this PR failed. Is there any branch in bdk_wallet that already adopts the new APIs, so I can test against them?

I have a few small suggestions below. Most of these are nits, but since this PR is already addressing the area, I thought it’d be reasonable to mention them here:

  • It might be nice to add a CI to prevent using Debug for Display in future changes.

  • In the short_descriptor function, it could be useful to show the last 8 characters of the descriptor so the full checksum is visible.

  • A small note on InvalidMagicBytes: it might be helpful to also show any difference between the length of expected and received byte.

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality work.

Just a couple requested changes:

  • Commit messages should contain a scope (as mentioned in the conventional commits spec). The scope should be the name of the package affected: core, chain, example, etc.
  • Commits that break the API should be marked with !.

And a nit:

  • Error messages should be somewhat consistent. I personally don't think we should suggest actions in the message, just state what the error is.

@evanlinjin
Copy link
Member

@Dmenec are you able to make progress on this?

@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch from b73016e to 532e2ec Compare January 14, 2026 16:04
@Dmenec
Copy link
Author

Dmenec commented Jan 14, 2026

@evanlinjin Pushed the updates. Let me know if everything checks out :)

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 532e2ec

I'm happy with how this is looking. Unable to test until I have access to a computer again.

@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch 3 times, most recently from 789d8a3 to d65eed0 Compare January 21, 2026 11:06
@Dmenec
Copy link
Author

Dmenec commented Jan 21, 2026

Having some trouble with the no_std CI check for the esplora crate... Does it actually support no_std, or should be treated as std‑only?

@oleonardolima
Copy link
Collaborator

Having some trouble with the no_std CI check for the esplora crate... Does it actually support no_std, or should be treated as std‑only?

@Dmenec It's now fixed on master, a rebase should fix it.

@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch from f0698e1 to d65eed0 Compare January 22, 2026 13:06
@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch from d65eed0 to ae17df2 Compare January 27, 2026 13:50
@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch 2 times, most recently from 91abd25 to 75d1bd0 Compare January 27, 2026 16:43
Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the bike-shedding. We're very close.

Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good, it just need to address Evan's comments.

@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch 2 times, most recently from 2763989 to 744a3de Compare February 5, 2026 12:21
…eError

Limited to 3 max shown items and added a suffix when there are additional entries.
…rror.

Format magic bytes as 0x-prefixed hex.
@Dmenec Dmenec force-pushed the fix/no-debug-on-display-impls branch from 744a3de to 823e4e9 Compare February 5, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Display implementations should not expose Debug output

6 participants