Skip to content

Commit b53f2f0

Browse files
committed
Merge rust-bitcoin#5382: Create empty bip158 crate
47fe9ce Create empty `bip158` crate (rustaceanrob) Pull request description: As part of discussion rust-bitcoin#5331, `bitcoin` and `p2p` should not depend on each other and should instead mutually depend on `primitives`, `hashes`, etc. BIP-158 is the last remaining dependency from `bitcoin` in `p2p`. It is not a peer-to-peer specification, but it is not an essential module of `bitcoin` either. IMO the best option for this module is to release it as a crate. Blaming the module shows it hasn't changed architecturally in many years. A new crate would allow us to revisit some of the design choices. Particularly the heavy use of generics, dependency on `io` that could be replaced by `consensus_encoding`, and perhaps an opportunity to benchmark and improve performance. ACKs for top commit: apoelstra: ACK 47fe9ce; successfully ran local tests Tree-SHA512: 7f9b5d89cb8cdce5c663d583f52f6425e706c281a3e6dd6fc943d6e5e948caa7e4fcab28a56fa020852ef61705ef4090b8ef2440db4f7db68a6a25bba11d7e92
2 parents a89b52d + 47fe9ce commit b53f2f0

File tree

9 files changed

+83
-1
lines changed

9 files changed

+83
-1
lines changed

Cargo-minimal.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ dependencies = [
7272
name = "bitcoin-addresses"
7373
version = "0.0.0"
7474

75+
[[package]]
76+
name = "bitcoin-bip158"
77+
version = "0.0.0"
78+
7579
[[package]]
7680
name = "bitcoin-consensus-encoding"
7781
version = "1.0.0-rc.2"

Cargo-recent.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ dependencies = [
7171
name = "bitcoin-addresses"
7272
version = "0.0.0"
7373

74+
[[package]]
75+
name = "bitcoin-bip158"
76+
version = "0.0.0"
77+
7478
[[package]]
7579
name = "bitcoin-consensus-encoding"
7680
version = "1.0.0-rc.2"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[workspace]
2-
members = ["addresses", "base58", "bitcoin", "chacha20_poly1305", "consensus_encoding", "crypto", "fuzz", "hashes", "internals", "io", "p2p", "primitives", "units"]
2+
members = ["addresses", "base58", "bip158", "bitcoin", "chacha20_poly1305", "consensus_encoding", "crypto", "fuzz", "hashes", "internals", "io", "p2p", "primitives", "units"]
33
exclude = ["benches"]
44
resolver = "2"

bip158/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.1.0 - 2025-12-09
2+
3+
* Initial release of the `github.com/rust-bitcoin/rust-bitcoin/bip158` crate as `bip158`.

bip158/Cargo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "bitcoin-bip158"
3+
version = "0.0.0"
4+
authors = ["Andrew Poelstra <[email protected]>"]
5+
license = "CC0-1.0"
6+
repository = "https://github.com/rust-bitcoin/rust-bitcoin"
7+
description = "Golomb-rice coded filters for set membership query."
8+
categories = ["cryptography::cryptocurrencies"]
9+
keywords = ["bitcoin", "peer-to-peer", "cryptography"]
10+
readme = "README.md"
11+
edition = "2021"
12+
rust-version = "1.74.0"
13+
exclude = ["tests", "contrib"]
14+
15+
[dependencies]
16+
17+
[dev-dependencies]
18+
19+
[package.metadata.docs.rs]
20+
all-features = true
21+
rustdoc-args = ["--cfg", "docsrs"]
22+
23+
[lints.clippy]
24+
redundant_clone = "warn"
25+
use_self = "warn"

bip158/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BIP-158
2+
3+
Implementation of [BIP-158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki) golomb coded block filters for private light client set membership query.
4+
5+
## Minimum Supported Rust Version (MSRV)
6+
7+
This library should always compile with any combination of features on **Rust 1.74.0**.
8+
9+
## Licensing
10+
11+
The code in this project is licensed under the [Creative Commons CC0 1.0 Universal license](LICENSE).
12+
We use the [SPDX license list](https://spdx.org/licenses/) and [SPDX IDs](https://spdx.dev/ids/).

bip158/contrib/extra_lints.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# No shebang, this file should not be executed.
2+
# shellcheck disable=SC2148
3+
4+
cargo clippy --all-targets --no-default-features --keep-going -- -D warnings

bip158/contrib/test_vars.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# No shebang, this file should not be executed.
2+
# shellcheck disable=SC2148
3+
#
4+
# disable verify unused vars, despite the fact that they are used when sourced
5+
# shellcheck disable=SC2034
6+
7+
# Test all these features with "std" enabled.
8+
FEATURES_WITH_STD=""
9+
10+
# Test all these features without "std" enabled.
11+
FEATURES_WITHOUT_STD=""
12+
13+
# Run these examples.
14+
EXAMPLES=""

bip158/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
3+
//! # Rust Bitcoin BIP-158 implementation.
4+
5+
// Experimental features we need.
6+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7+
// Coding conventions.
8+
#![warn(missing_docs)]
9+
#![warn(deprecated_in_future)]
10+
#![doc(test(attr(warn(unused))))]
11+
// Pedantic lints that we enforce.
12+
#![warn(clippy::return_self_not_must_use)]
13+
// Exclude lints we don't think are valuable.
14+
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
15+
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
16+
#![allow(clippy::uninlined_format_args)] // Allow `format!("{}", x)`instead of enforcing `format!("{x}")`

0 commit comments

Comments
 (0)