Skip to content

Commit 4a85e80

Browse files
committed
Merge #145: Condense RBMT metadata and add rust-bitcoin lints
fc98f7f chore: add and apply `rust-bitcoin` lints (Luis Schwab) 284da41 chore: condense `cargo-rbmt` metadata fields (Luis Schwab) Pull request description: Top commit has no ACKs. Tree-SHA512: 1c6faffaaf3670f0e70b1b2451b5f9b96df55687008dd9658d7a521fdae6b8d3de81dc63e880ed6b79b59855fe0f53046e14c4bf4d18686746a315f955a87d75
2 parents 9bc89df + fc98f7f commit 4a85e80

15 files changed

Lines changed: 465 additions & 199 deletions

Cargo-minimal.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
139139

140140
[[package]]
141141
name = "bdk-floresta"
142-
version = "0.1.0"
142+
version = "0.0.0"
143143
dependencies = [
144144
"anyhow",
145145
"bdk_wallet",

Cargo-recent.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
130130

131131
[[package]]
132132
name = "bdk-floresta"
133-
version = "0.1.0"
133+
version = "0.0.0"
134134
dependencies = [
135135
"anyhow",
136136
"bdk_wallet",

Cargo.toml

Lines changed: 148 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[package]
2-
version = "0.1.0"
32
name = "bdk-floresta"
3+
version = "0.0.0"
44
description = "A Floresta-powered chain-source crate for BDK"
55
authors = ["Luis Schwab <dev@luisschwab.net"]
6-
repository = "https://github.com/luisschwab/bdk-floresta"
76
documentation = "https://docs.rs/bdk-floresta"
7+
repository = "https://github.com/luisschwab/bdk-floresta"
88
keywords = ["bdk", "bitcoin", "floresta", "utreexo"]
9-
readme = "README.md"
109
license = "MIT OR Apache-2.0"
11-
edition = "2021"
10+
readme = "README.md"
1211
rust-version = "1.85.0" # MSRV
12+
edition = "2024"
1313

1414
[features]
1515
default = ["logger"]
@@ -23,9 +23,6 @@ required-features = ["logger"]
2323
name = "client_signet"
2424
required-features = ["logger"]
2525

26-
[build-dependencies]
27-
toml = { version = "=1.1.2" }
28-
2926
[dependencies]
3027
bitcoin = { version = "=0.32.8" }
3128
bdk_wallet = { version = "=3.0.0" }
@@ -41,39 +38,27 @@ tracing-appender = { version = "=0.2.5", optional = true }
4138
tracing-subscriber = { version = "=0.3.23", features = ["ansi", "env-filter", "time"], optional = true }
4239
time = { version = "=0.3.45", features = ["macros", "local-offset"], optional = true } # time >0.3.45 requires Rust 1.88.0
4340
tokio-util = { version = "=0.7.18" }
44-
45-
# These pins are needed for `Cargo-minimal.lock`:
41+
# Pinned transitive deps:
4642
lazy_static = { version = "=1.5.0" } # blame: sharded-slab@v0.1.7 -> tracing-subscriber@v0.3.23
4743
bitcoin-consensus-encoding = { version = "=1.0.0-rc.3" } # blame: bitcoin-io v0.3.0 (Encodable->Encode/Decodable->Decode)
4844

45+
[build-dependencies]
46+
toml = { version = "=1.1.2" }
47+
4948
[dev-dependencies]
5049
halfin = { version = "=0.4.0" }
5150
anyhow = { version = "=1.0.102" }
5251
tokio = { version = "=1.52.3", features = ["macros", "rt-multi-thread"] }
5352

54-
[lints.clippy]
55-
uninlined_format_args = "deny"
56-
result_large_err = "allow"
57-
use_self = "deny"
58-
5953
[package.metadata.docs.rs]
6054
all-features = true
6155
rustdoc-args = ["--cfg", "docsrs"]
6256

63-
[package.metadata.rbmt.test]
64-
sample_strategy = "all"
65-
66-
[package.metadata.rbmt.tools]
67-
cargo-audit = "=0.22.2"
68-
zizmor = "=1.26.1"
69-
70-
[package.metadata.rbmt.toolchains]
71-
stable = "1.96.0"
72-
nightly = "nightly-2026-06-23"
73-
74-
# Allow packages of different versions in the dependency tree
75-
[package.metadata.rbmt.lint]
76-
allowed_duplicates = [
57+
[package.metadata.rbmt]
58+
toolchains = { stable = "1.96.0", nightly = "nightly-2026-06-23" }
59+
tools = { cargo-audit = "=0.22.2", zizmor = "=1.26.1" }
60+
test = { sample_strategy = "all" }
61+
lint = { allowed_duplicates = [
7762
"base64", # blame: bitcoin@v0.32.8 (v0.21) vs floresta-wire@v0.5.0 -> tonic@v0.14.5 (v0.22)
7863
"bitcoin_hashes", # blame: bitcoin@v0.32.8 (v0.14), floresta-wire@v0.5.0 -> bip324@v0.10.0 (v0.15), floresta-chain@v0.5.0 -> rustreexo@v0.5.0 (v0.20)
7964
"bitcoin-consensus-encoding", # blame: floresta-chain@v0.5.0 -> rustreexo@v0.5.0 -> bitcoin_hashes@v0.20.0 (v0.1.0) vs bitcoin-io@v0.3.0 / bitcoin_hashes@v1.0.0 (v1.0.0)
@@ -95,4 +80,138 @@ allowed_duplicates = [
9580
"windows_x86_64_gnu", # blame: cascades from windows-targets versions above
9681
"windows_x86_64_gnullvm", # blame: cascades from windows-targets versions above
9782
"windows_x86_64_msvc", # blame: cascades from windows-targets versions above
98-
]
83+
] }
84+
85+
[lints.rust]
86+
missing_docs = "warn"
87+
88+
# Copied over from `rust-bitcoin`
89+
[lints.clippy]
90+
# Exclude lints we don't think are valuable.
91+
needless_question_mark = "allow" # https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
92+
manual_range_contains = "allow" # More readable than clippy's format.
93+
# Exhaustive list of pedantic clippy lints
94+
assigning_clones = "warn"
95+
bool_to_int_with_if = "warn"
96+
borrow_as_ptr = "warn"
97+
case_sensitive_file_extension_comparisons = "warn"
98+
cast_lossless = "warn"
99+
cast_possible_truncation = "allow" # All casts should include a code comment (except test code).
100+
cast_possible_wrap = "allow" # Same as above re code comment.
101+
cast_precision_loss = "warn"
102+
cast_ptr_alignment = "warn"
103+
cast_sign_loss = "allow" # All casts should include a code comment (except in test code).
104+
checked_conversions = "warn"
105+
cloned_instead_of_copied = "warn"
106+
copy_iterator = "warn"
107+
default_trait_access = "warn"
108+
doc_link_with_quotes = "warn"
109+
doc_markdown = "warn"
110+
empty_enums = "warn"
111+
enum_glob_use = "warn"
112+
expl_impl_clone_on_copy = "warn"
113+
explicit_deref_methods = "warn"
114+
explicit_into_iter_loop = "warn"
115+
explicit_iter_loop = "warn"
116+
filter_map_next = "warn"
117+
flat_map_option = "warn"
118+
float_cmp = "allow" # Bitcoin floats are typically limited to 8 decimal places and we want them exact.
119+
fn_params_excessive_bools = "warn"
120+
if_not_else = "warn"
121+
ignored_unit_patterns = "warn"
122+
implicit_clone = "warn"
123+
implicit_hasher = "warn"
124+
inconsistent_struct_constructor = "warn"
125+
index_refutable_slice = "warn"
126+
inefficient_to_string = "warn"
127+
inline_always = "warn"
128+
into_iter_without_iter = "warn"
129+
invalid_upcast_comparisons = "warn"
130+
items_after_statements = "warn"
131+
iter_filter_is_ok = "warn"
132+
iter_filter_is_some = "warn"
133+
iter_not_returning_iterator = "warn"
134+
iter_without_into_iter = "warn"
135+
large_digit_groups = "warn"
136+
large_futures = "warn"
137+
large_stack_arrays = "warn"
138+
large_types_passed_by_value = "warn"
139+
linkedlist = "warn"
140+
macro_use_imports = "warn"
141+
manual_assert = "warn"
142+
manual_instant_elapsed = "warn"
143+
manual_is_power_of_two = "warn"
144+
manual_is_variant_and = "warn"
145+
manual_let_else = "warn"
146+
manual_ok_or = "warn"
147+
manual_string_new = "warn"
148+
many_single_char_names = "warn"
149+
map_unwrap_or = "warn"
150+
match_bool = "allow" # Adds extra indentation and LOC.
151+
match_same_arms = "allow" # Collapses things that are conceptually unrelated to each other.
152+
match_wild_err_arm = "warn"
153+
match_wildcard_for_single_variants = "warn"
154+
maybe_infinite_iter = "warn"
155+
mismatching_type_param_order = "warn"
156+
missing_errors_doc = "warn"
157+
missing_fields_in_debug = "warn"
158+
missing_panics_doc = "warn"
159+
missing_safety_doc = "warn"
160+
missing_docs_in_private_items = "warn"
161+
must_use_candidate = "allow" # Useful for audit but many false positives.
162+
mut_mut = "warn"
163+
naive_bytecount = "warn"
164+
needless_bitwise_bool = "warn"
165+
needless_continue = "warn"
166+
needless_for_each = "warn"
167+
needless_pass_by_value = "warn"
168+
needless_raw_string_hashes = "warn"
169+
no_effect_underscore_binding = "warn"
170+
no_mangle_with_rust_abi = "warn"
171+
option_as_ref_cloned = "warn"
172+
option_option = "warn"
173+
ptr_as_ptr = "warn"
174+
ptr_cast_constness = "warn"
175+
pub_underscore_fields = "warn"
176+
range_minus_one = "warn"
177+
range_plus_one = "warn"
178+
redundant_clone = "warn"
179+
redundant_closure_for_method_calls = "warn"
180+
redundant_else = "warn"
181+
ref_as_ptr = "warn"
182+
ref_binding_to_reference = "warn"
183+
ref_option = "warn"
184+
ref_option_ref = "warn"
185+
return_self_not_must_use = "warn"
186+
same_functions_in_if_condition = "warn"
187+
semicolon_if_nothing_returned = "warn"
188+
should_panic_without_expect = "warn"
189+
similar_names = "allow" # Too many (subjectively) false positives.
190+
single_char_pattern = "warn"
191+
single_match_else = "warn"
192+
stable_sort_primitive = "warn"
193+
str_split_at_newline = "warn"
194+
string_add_assign = "warn"
195+
struct_excessive_bools = "warn"
196+
struct_field_names = "allow" # dumb
197+
too_many_lines = "warn"
198+
transmute_ptr_to_ptr = "warn"
199+
trivially_copy_pass_by_ref = "warn"
200+
unchecked_time_subtraction = "warn"
201+
unicode_not_nfc = "warn"
202+
uninlined_format_args = "allow" # This is a subjective style choice.
203+
unnecessary_box_returns = "warn"
204+
unnecessary_join = "warn"
205+
unnecessary_literal_bound = "warn"
206+
unnecessary_wraps = "warn"
207+
unnested_or_patterns = "warn"
208+
unreadable_literal = "warn"
209+
unsafe_derive_deserialize = "warn"
210+
unused_async = "warn"
211+
unused_self = "warn"
212+
use_self = "warn"
213+
used_underscore_binding = "warn"
214+
used_underscore_items = "warn"
215+
verbose_bit_mask = "warn"
216+
wildcard_imports = "warn"
217+
zero_sized_map_values = "warn"

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# bdk-floresta
22

33
<p>
4-
<!-- <a href="https://crates.io/crates/bdk_floresta"><img src="https://img.shields.io/crates/v/bdk_floresta.svg"/></a> -->
5-
<!-- <a href="https://docs.rs/bdk_floresta"><img src="https://img.shields.io/badge/docs.rs-bdk--floresta-brightgreen"/></a> -->
4+
<!-- <a href="https://crates.io/crates/bdk-floresta"><img src="https://img.shields.io/crates/v/bdk-floresta.svg"/></a> -->
5+
<!-- <a href="https://docs.rs/bdk-floresta"><img src="https://img.shields.io/badge/docs.rs-bdk-floresta-brightgreen"/></a> -->
66
<a href="https://blog.rust-lang.org/2025/02/20/Rust-1.85.0/"><img src="https://img.shields.io/badge/MSRV-1.85.0%2B-orange.svg"/></a>
77
<a href="https://github.com/luisschwab/bdk-floresta/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT%2FApache--2.0-red.svg"/></a>
88
<a href="https://github.com/luisschwab/bdk-floresta/actions/workflows/rust.yml"><img src="https://github.com/luisschwab/bdk-floresta/actions/workflows/rust.yml/badge.svg"></a>
@@ -36,8 +36,6 @@ To install them with `cargo`, run:
3636
~$ cargo install just
3737

3838
~$ cargo install cargo-rbmt
39-
40-
~$ cargo install uv
4139
```
4240

4341
Alternatively, use your preferred package manager to install `just` and `uv`.

build.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ fn main() {
1010
let bdk_floresta_version = get_bdk_floresta_version();
1111

1212
// Get floresta-wire's version from Cargo.toml or fallback to Cargo.lock
13-
let floresta_wire_version = get_dependency_version("floresta-wire").unwrap();
13+
let floresta_wire_version = source_dependency_version("floresta-wire").unwrap();
1414

1515
// Build bdk_floresta's user agent in Bitcoin Core style:
1616
// `/floresta-wire:A.B.C/bdk-floresta:X.Y.Z`
1717
let user_agent = format!(
1818
"/floresta-wire:{}/bdk-floresta:{}/",
1919
floresta_wire_version,
20-
bdk_floresta_version.replace("v", ""),
20+
bdk_floresta_version.replace('v', ""),
2121
);
2222

2323
println!("cargo:rustc-env=USER_AGENT={user_agent}");
2424
println!("cargo:rustc-env=GIT_DESCRIBE={bdk_floresta_version}");
2525
println!("cargo:rustc-env=FLORESTA_WIRE_VERSION={floresta_wire_version}");
2626

27-
// Re-run if HEAD, build.rs, Cargo.toml or Cargo.lock change
27+
// Re-run if HEAD, build.rs, `Cargo.toml` or `Cargo.lock` change
2828
println!("cargo:rerun-if-changed=.git/HEAD");
2929
println!("cargo:rerun-if-changed=build.rs");
3030
println!("cargo:rerun-if-changed=Cargo.toml");
3131
println!("cargo:rerun-if-changed=Cargo.lock");
3232
}
3333

34-
/// Get bdk_floresta's version from Cargo.toml
34+
/// Source `bdk_floresta`'s version from `Cargo.toml`.
3535
fn get_bdk_floresta_version() -> String {
3636
let manifest = fs::read_to_string("Cargo.toml").unwrap();
3737
let toml: Value = toml::from_str(&manifest).unwrap();
@@ -45,16 +45,16 @@ fn get_bdk_floresta_version() -> String {
4545

4646
/// Try to get the version of a particular dependency.
4747
///
48-
/// Gets it from `Cargo.toml`, or falls back to `Cargo.lock`.
49-
fn get_dependency_version(dep: &str) -> Option<String> {
50-
if let Some(version) = get_version_from_cargo_toml(dep) {
48+
/// Sources it from `Cargo.toml`, or falls back to `Cargo.lock`.
49+
fn source_dependency_version(dep: &str) -> Option<String> {
50+
if let Some(version) = source_version_from_cargo_toml(dep) {
5151
return Some(version);
5252
}
53-
get_version_from_cargo_lock(dep)
53+
source_version_from_cargo_lock(dep)
5454
}
5555

56-
/// Get the version of a dependency from `Cargo.toml`.
57-
fn get_version_from_cargo_toml(dep_name: &str) -> Option<String> {
56+
/// Source the version of a dependency from `Cargo.toml`.
57+
fn source_version_from_cargo_toml(dep_name: &str) -> Option<String> {
5858
let manifest = fs::read_to_string("Cargo.toml").ok()?;
5959
let toml: Value = toml::from_str(&manifest).ok()?;
6060

@@ -87,8 +87,8 @@ fn get_version_from_cargo_toml(dep_name: &str) -> Option<String> {
8787
None
8888
}
8989

90-
/// Get the version of a dependency from `Cargo.lock`.
91-
fn get_version_from_cargo_lock(dep_name: &str) -> Option<String> {
90+
/// Source the version of a dependency from `Cargo.lock`.
91+
fn source_version_from_cargo_lock(dep_name: &str) -> Option<String> {
9292
let lock_content = std::fs::read_to_string("Cargo.lock").ok()?;
9393
let lock: toml::Value = toml::from_str(&lock_content).ok()?;
9494

examples/client_regtest.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,29 @@ use halfin::utreexod::UtreexoDConf;
4949
use halfin::wait_for_filter_height;
5050
use halfin::wait_for_height;
5151
use tokio::sync::RwLock;
52+
use tracing::Level;
5253
use tracing::error;
5354
use tracing::info;
5455
use tracing::warn;
55-
use tracing::Level;
5656

57+
/// Network used by this example.
5758
const NETWORK: Network = Network::Regtest;
59+
60+
/// Directory used for node data and logs.
5861
const DATA_DIR: &str = "./examples/data/client_regtest/";
5962

63+
/// External descriptor used by the [`Client`]'s wallet.
6064
const DESC_EXT: &str = "tr([697412fb/86h/1h/0h]tpubDD5LyUwjWvkndncfQqMcNko6coES1ZehnsqykLLe8E3w7RX5dveHMJrXxhpvYLnSqQBuPVw9Lk7gSYnS9xyoLRQ21xpebdpCFt5ZNyorhHb/0/*)";
65+
66+
/// Internal descriptor used by the [`Client`]'s wallet.
6167
const DESC_INT: &str = "tr([697412fb/86h/1h/0h]tpubDD5LyUwjWvkndncfQqMcNko6coES1ZehnsqykLLe8E3w7RX5dveHMJrXxhpvYLnSqQBuPVw9Lk7gSYnS9xyoLRQ21xpebdpCFt5ZNyorhHb/1/*)";
6268

6369
#[tokio::main]
70+
#[allow(clippy::too_many_lines)]
6471
async fn main() -> anyhow::Result<()> {
65-
env::set_var("RUST_LOG", "client_regtest=info");
72+
unsafe {
73+
env::set_var("RUST_LOG", "client_regtest=info");
74+
}
6675

6776
let _logger = Logger {
6877
log_level: Level::INFO,

examples/client_signet.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,29 @@ use bdk_wallet::Wallet;
4040
use bdk_wallet::WalletEvent;
4141
use bitcoin::Network;
4242
use tokio::sync::RwLock;
43+
use tracing::Level;
4344
use tracing::error;
4445
use tracing::info;
4546
use tracing::warn;
46-
use tracing::Level;
4747

48+
/// Network used by this example.
4849
const NETWORK: Network = Network::Signet;
50+
51+
/// Directory used for node data and logs.
4952
const DATA_DIR: &str = "./examples/data/client_signet/";
5053

54+
/// External descriptor used by the [`Client`]'s wallet.
5155
const DESC_EXT: &str = "wpkh([9cee26c8/84h/1h/0h]tpubDDuCfGKBYo4pQjNcpVkdLktdYm9wZiowEXMKM4Nn9QBcbnu5ikxmqZyXuhDgcdfr8zcuR66iLCmManN9XguSpP2m2SZyUsJsdCKQkcru6VG/0/*)";
56+
57+
/// Internal descriptor used by the [`Client`]'s wallet.
5258
const DESC_INT: &str = "wpkh([9cee26c8/84h/1h/0h]tpubDDuCfGKBYo4pQjNcpVkdLktdYm9wZiowEXMKM4Nn9QBcbnu5ikxmqZyXuhDgcdfr8zcuR66iLCmManN9XguSpP2m2SZyUsJsdCKQkcru6VG/1/*)";
5359

5460
#[tokio::main]
61+
#[allow(clippy::too_many_lines)]
5562
async fn main() -> anyhow::Result<()> {
56-
env::set_var("RUST_LOG", "client_signet=info");
63+
unsafe {
64+
env::set_var("RUST_LOG", "client_signet=info");
65+
}
5766

5867
let _logger = Logger {
5968
log_level: Level::INFO,

0 commit comments

Comments
 (0)