Skip to content

Configure log level and DNS resolver#701

Merged
thunderbiscuit merged 1 commit intobitcoindevkit:masterfrom
rustaceanrob:kyoto-builder-features-3-12
Mar 27, 2025
Merged

Configure log level and DNS resolver#701
thunderbiscuit merged 1 commit intobitcoindevkit:masterfrom
rustaceanrob:kyoto-builder-features-3-12

Conversation

@rustaceanrob
Copy link
Copy Markdown
Collaborator

Description

Partial steps towards #700 that are uncontroversial feature additions. The LogLevel enum allows for filtering the Log::Debug messages, which are mostly used for debugging and require a string allocation. Without these messages the node should sync even faster in a production application that communicates with a UI. Other developers may have a preferred DNS resolver they would like to point their users at. That is easily configurable as well.

Notes to the reviewers

It appears the lockfile was not updated when the Cargo.toml changed versions.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@rustaceanrob rustaceanrob force-pushed the kyoto-builder-features-3-12 branch from 3c3ff8f to 2376478 Compare March 17, 2025 22:45
@rustaceanrob rustaceanrob force-pushed the kyoto-builder-features-3-12 branch from 2376478 to 0287453 Compare March 27, 2025 08:57
@rustaceanrob
Copy link
Copy Markdown
Collaborator Author

Rebased

@thunderbiscuit
Copy link
Copy Markdown
Member

thunderbiscuit commented Mar 27, 2025

Looks good to me, I'd merge this one next.

One thing I just tried locally (it's my first time using a straight remote type that doesn't need wrapping with the proc macros) is the procedure defined on this page: https://mozilla.github.io/uniffi-rs/latest/types/remote_ext_types.html. All live Kyoto tests pass on my end.

// Remove this line
// use bdk_kyoto::kyoto::LogLevel as BDKLogLevel;

// Replace with
type LogLevel = bdk_kyoto::kyoto::LogLevel;

/// Select the category of messages for the node to emit.
#[uniffi::remote(Enum)]
pub enum LogLevel {
    /// Send `Log::Debug` messages. These messages are intended for debugging or troubleshooting
    /// node operation.
    Debug,
    /// Omit `Log::Debug` messages, including their memory allocations. Ideal for a production
    /// application that uses minimal logging.
    Warning,
}

// The From<LogLevel> for BDKLogLevel trait implementation can be deleted

How do you feel about this approach? It basically removes the requirement to write a wrapper on the type. There are other places where we should use this, for example on the Network enum (and potentially on a bunch of errors? Will need to look into that).

@rustaceanrob rustaceanrob force-pushed the kyoto-builder-features-3-12 branch from 0287453 to 58e31c7 Compare March 27, 2025 13:56
@rustaceanrob
Copy link
Copy Markdown
Collaborator Author

I took a shallow attempt at this and overlooked uniffi::Remote. This is much better, thanks for the detailed instructions. Updated now

@rustaceanrob rustaceanrob force-pushed the kyoto-builder-features-3-12 branch from 58e31c7 to bb89233 Compare March 27, 2025 14:01
Copy link
Copy Markdown
Member

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

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

ACK bb89233.

@thunderbiscuit
Copy link
Copy Markdown
Member

thunderbiscuit commented Mar 27, 2025

@reez if you don't mind I'll merge this one once the tests finish and then you can rebase #711?

@reez
Copy link
Copy Markdown
Collaborator

reez commented Mar 27, 2025

@reez if you don't mind I'll merge this one once the tests finish and then you can rebase #711?

absolutely, no problem, thanks for the heads up

@thunderbiscuit thunderbiscuit merged commit bb89233 into bitcoindevkit:master Mar 27, 2025
26 checks passed
@rustaceanrob rustaceanrob deleted the kyoto-builder-features-3-12 branch March 27, 2025 15:06
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.

3 participants