Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
331 lines (291 loc) · 15.1 KB
/
Copy pathCargo.toml
File metadata and controls
331 lines (291 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
[workspace]
resolver = "3"
members = [
"crates/consensus",
"crates/storage",
"crates/chain",
"crates/index",
"crates/mempool",
"crates/p2p",
"crates/wire",
"crates/node",
"bin/bitcoin-rs",
"e2e",
"tools/storage-footprint",
"tools/snapshot",
"tools/contract-index",
"tools/p2pk-scan",
"tools/storage-convert",
]
[workspace.package]
edition = "2024"
rust-version = "1.99.0"
license = "Apache-2.0"
repository = "https://github.com/gosuda/bitcoin-rs"
version = "0.15.0"
authors = ["metaphorics"]
# ============================================================================
# Workspace dependencies.
#
# `cargo info` on 2026-05-19. The original tech-stack dependency rationale is
# recorded in git history; this section is the authoritative reflection.
# ============================================================================
[workspace.dependencies]
# Internal crates — `version` must match `[workspace.package].version` (gate g15).
# Cargo cannot inherit `version` into `[workspace.dependencies]`; bump both together.
bitcoin-rs-consensus = { path = "crates/consensus", version = "0.15.0", default-features = false }
bitcoin-rs-storage = { path = "crates/storage", version = "0.15.0", default-features = false }
bitcoin-rs-chain = { path = "crates/chain", version = "0.15.0", default-features = false }
bitcoin-rs-index = { path = "crates/index", version = "0.15.0" }
bitcoin-rs-mempool = { path = "crates/mempool", version = "0.15.0" }
bitcoin-rs-p2p = { path = "crates/p2p", version = "0.15.0" }
bitcoin-rs-wire = { path = "crates/wire", version = "0.15.0" }
bitcoin-rs-node = { path = "crates/node", version = "0.15.0", default-features = false }
bitcoin-rs-e2e = { path = "e2e", version = "0.15.0" }
# Allocator. Defaults pull `secure` and `extended` overhead — disable for perf.
mimalloc = { version = ">=0.1.50, <0.2", default-features = false }
# --- Stratum V2 transport ------------------------------------------------------
# Pinned SRI release family (v1.13.0): these crates are semver-major-coupled
# and their wire layouts MUST move together. codec_sv2 8.1.0 is the v1.13.0
# tag plus the in-place-encoder patch release. noise_sv2 2.1.0 is admitted
# with the narrow duplicate-crypto exception documented in deny.toml.
binary_sv2 = "=8.0.0"
framing_sv2 = "=9.0.0"
codec_sv2 = { version = "=8.1.0" }
noise_sv2 = "=2.1.0"
mining_sv2 = "=13.0.0"
common_messages_sv2 = "=10.0.0"
# Authority-key zeroization used by the SV2 Noise boundary.
zeroize = { version = ">=1.8.2, <2", default-features = false, features = ["alloc"] }
# --- Bitcoin ecosystem --------------------------------------------------------
# bitcoin 0.32 line; 0.33 is still beta. `default = [std, secp-recovery]`.
# Keep `bitcoinconsensus-std` out of the workspace-wide dependency: the
# `bitcoinconsensus` opt-in was removed and bitcoinkernel is the optional
# consensus oracle, gated by the consensus crate's `kernel` feature. `kernel`
# is a capability ("bitcoinkernel support is compiled in") and is off by
# default in every crate; the engine a run uses is selected at runtime by
# `validation.engine` (see docs/contracts/validation-default.md).
bitcoin = { version = ">=0.32.9, <0.33", default-features = false, features = [
"std", "secp-recovery", "serde", "rand-std",
] }
# bitcoinkernel 0.3 line (libbitcoinkernel-sys 0.4). No features exposed.
bitcoinkernel = { version = ">=0.3, <0.4", default-features = false }
secp256k1 = { version = ">=0.33.1, <0.34", default-features = false, features = [
"std", "alloc", "recovery", "rand", "global-context",
] }
# sha2 0.11: default features are alloc+oid; no std/asm feature is exposed.
base64 = { version = ">=0.23.1, <0.24", default-features = false, features = ["std"] }
sha3 = { version = ">=0.12, <0.13", default-features = false }
sha2 = { version = ">=0.11, <0.12", default-features = false }
bitcoin_hashes = { version = ">=1.2.0, <1.3", default-features = false, features = [
"alloc", "std",
] }
# BIP324 v2 transport ciphers (crates/p2p). RustCrypto primitives on the same
# digest 0.11 line as sha2; the `bip324` crate is not used because every
# release since 0.6 pulls a second bitcoin_hashes (DEP-02). `chacha20` keeps
# only its default `cipher` feature; `chacha20poly1305` drops `getrandom`.
chacha20 = { version = ">=0.10.2, <0.11", default-features = false, features = ["cipher"] }
chacha20poly1305 = { version = ">=0.11, <0.12", default-features = false }
hkdf = { version = ">=0.13, <0.14", default-features = false }
cap-std = "=4.0.3"
cap-fs-ext = "=4.0.3"
rustix = { version = "=1.1.6", features = ["fs"] }
# windows-sys: the console-control and process APIs the e2e harness uses to
# signal (CTRL_BREAK_EVENT) and reap spawned nodes on Windows.
windows-sys = { version = "=0.61.2", features = [
"Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_Console",
"Win32_System_Threading",
] }
# Miniscript supplies the key-free PSBT finalizer retained by the RPC crate.
miniscript = { version = ">=13, <14", default-features = false, features = ["std"] }
corepc-types = { version = "0.16.0", default-features = false, features = [
"std", "serde-deny-unknown-fields",
] }
# --- Core data structures -----------------------------------------------------
# hashbrown 0.17: HashTable raw API. Default also adds `equivalent` + `raw-entry`
# which we do not use; disable defaults for minimal surface.
hashbrown = { version = ">=0.17.1, <0.18", default-features = false, features = [
"inline-more", "default-hasher", "allocator-api2",
] }
# ruint: 256-bit chainwork. `default = [std]`.
ruint = { version = ">=1.17, <2", default-features = false, features = [
"alloc",
] }
# slab: block-tree node arena. `default = [std]`.
slab = { version = ">=0.4.12, <0.5", default-features = false, features = [
"std", "serde",
] }
# arc-swap (registry name uses hyphen, NOT underscore).
arc-swap = { version = ">=1.9.1, <2", default-features = false }
# parking_lot: workspace uses 0.13; transitive crates still pin the 0.12 line
# (rust-rocksdb, signet-libmdbx, surrealkv, quick_cache, affinitypool), an
# exact-version duplicate split approved in deny.toml.
parking_lot = { version = ">=0.13.0, <0.14", default-features = false, features = [
"arc_lock", "send_guard",
] }
# Crossbeam (event-loop + utilities).
crossbeam-channel = { version = ">=0.5.15, <0.6", default-features = false, features = ["std"] }
crossbeam-utils = { version = ">=0.8.21, <0.9", default-features = false, features = ["std"] }
# RPC listener readiness without an async runtime.
mio = { version = ">=1.2.4, <2", default-features = false, features = ["os-poll", "net"] }
# Rayon — no default features at all on 1.12; nothing to disable/add.
rayon = { version = ">=1.12, <2" }
# --- Small vectors / strings --------------------------------------------------
# tinyvec: no default features; explicitly enable alloc.
tinyvec = { version = ">=1.11, <2", default-features = false, features = ["alloc"] }
# smallvec 1.x stable (2.0 is alpha). No default features; enable union + const_*.
smallvec = { version = ">=1.15.2, <2", default-features = false, features = [
"union", "const_generics", "const_new",
] }
compact_str = { version = ">=0.9, <1", default-features = false, features = ["std"] }
# --- Zero-copy / compression --------------------------------------------------
bytemuck = { version = ">=1.25, <2", default-features = false, features = ["derive"] }
bytes = { version = ">=1.11.1, <2", default-features = false }
zerocopy = { version = "0.8.57", default-features = false, features = ["derive", "std"] }
# --- Storage backends ---------------------------------------------------------
# rust-rocksdb 0.54 line.
# `default = [snappy, lz4, zstd, zlib, bzip2, bindgen-runtime]` — disable to
# pick only what storage uses.
rust-rocksdb = { version = ">=0.54, <0.55", default-features = false, features = [
"mt_static", "snappy", "lz4", "zstd",
] }
# Retired storage engines: retained in workspace dependencies ONLY for the
# offline converter (tools/storage-convert, ARCH-02). The node itself keeps
# RocksDB as the sole engine in epoch 3.
# fjall: converter-only. bitcoin-rs-storage-convert reads retired Fjall
# datadirs through this pin; the node never links it.
fjall = { version = ">=3.1.4, <4", default-features = false, features = ["lz4"] }
# redb: converter-only, same rule as fjall above.
redb = { version = ">=4.1, <5", default-features = false }
# Optional storage backends (R4): SurrealKV and libmdbx
surrealkv = { version = ">=1.2.0, <2", default-features = false }
signet-libmdbx = { version = ">=0.8.3, <0.9", default-features = false }
tokio = { version = ">=1.36, <2", default-features = false, features = ["rt", "time", "sync"] }
# --- Serialization / config ---------------------------------------------------
serde = { version = ">=1.0.225, <2", default-features = false, features = ["derive", "std", "alloc"] }
# `sort_keys` makes constructed and mutated `Value` objects BTreeMap-backed, so
# they serialize in sorted key order, as serde_json's BTreeMap-backed `Map` did.
# Parsed trees keep document order. Without it, mutated objects serialize in
# ahash order, which varies per process and breaks deterministic output.
sonic-rs = { version = ">=0.5, <0.6", default-features = false, features = ["sort_keys"] }
# toml: the `serde` feature only exists in 1.x (0.8 uses serde unconditionally, so the
# feature name is absent there). Floor must stay >=1 or publish picks 0.8 and fails.
toml = { version = ">=1, <2", default-features = false, features = ["parse", "display", "serde"] }
clap = { version = ">=4.6, <5", default-features = false, features = [
"std", "color", "error-context", "help", "suggestions", "usage",
"derive", "env", "wrap_help",
] }
# --- Observability ------------------------------------------------------------
log = { version = ">=0.4.35, <0.5", default-features = false }
tracing = { version = ">=0.1.44, <0.2", default-features = false, features = ["std", "attributes"] }
# USDT probe emission for the consensus crate's `trace` module (optional;
# pulled in only by the `usdt` feature). Apache-2.0, no AWS-LC/ring providers.
# `default-features = false` drops the `asm` feature, an empty marker in 0.6.0 —
# `.note.stapsdt` emission is unconditional and asserted by sdt_notes in CI.
# Build-time chain caveat: dtrace-parser → pest 2.9.3 now compiles `psm`/`stacker`
# target assembly via `cc`, so builds enabling this feature need a C toolchain
# even though the usdt crates themselves are pure Rust.
usdt = { version = "=0.6.0", default-features = false }
tracing-subscriber = { version = ">=0.3.23, <0.4", default-features = false, features = [
"std", "fmt", "registry", "ansi", "env-filter", "json", "smallvec",
"tracing-log", "sharded-slab", "thread_local",
] }
# metrics 0.24 has NO features at all.
metrics = { version = ">=0.24.6, <0.25" }
# metrics-exporter-prometheus default pulls tokio+hyper+rustls; disable
# defaults; crates/node serves Prometheus text over its own listener.
metrics-exporter-prometheus = { version = ">=0.18, <0.19", default-features = false }
# quanta: monotonic TSC clock for hot-path timing. No special features needed.
quanta = { version = ">=0.13.0, <0.14", default-features = false }
# --- Signals ------------------------------------------------------------------
signal-hook = { version = ">=0.4.4, <0.5", default-features = false }
# --- Errors -------------------------------------------------------------------
thiserror = { version = ">=2.0.18, <3", default-features = false, features = ["std"] }
zmq = { version = ">=0.10, <0.11", default-features = false }
# --- Test / bench -------------------------------------------------------------
proptest = { version = ">=1.12, <1.13", default-features = false, features = ["std"] }
proptest-state-machine = "=0.9.0"
tempfile = { version = ">=3.20.0, <4" }
# ============================================================================
# Lints
# ============================================================================
[workspace.lints.rust]
unsafe_op_in_unsafe_fn = "deny"
missing_docs = "allow"
unused_lifetimes = "warn"
unreachable_pub = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(kani)", "cfg(verification)"] }
[workspace.lints.clippy]
correctness = { level = "deny", priority = -1 }
suspicious = { level = "warn", priority = -1 }
complexity = { level = "warn", priority = -1 }
perf = { level = "warn", priority = -1 }
# Optional groups are selected below instead of becoming blanket CI gates.
pedantic = { level = "allow", priority = -1 }
nursery = { level = "allow", priority = -1 }
# Select safety, numerical-loss and guard-lifetime checks from the optional groups.
unchecked_time_subtraction = "warn"
cast_ptr_alignment = "warn"
ptr_as_ptr = "warn"
checked_conversions = "warn"
non_send_fields_in_send_ty = "warn"
debug_assert_with_mut_call = "warn"
read_zero_byte_vec = "warn"
transmute_undefined_repr = "warn"
fallible_impl_from = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_sign_loss = "warn"
cast_precision_loss = "warn"
float_cmp = "warn"
invalid_upcast_comparisons = "warn"
large_stack_arrays = "warn"
significant_drop_in_scrutinee = "warn"
undocumented_unsafe_blocks = "deny"
as_conversions = "deny"
cast_lossless = "deny"
unwrap_used = "deny"
expect_used = "warn"
dbg_macro = "deny"
todo = "deny"
unimplemented = "deny"
mod_module_files = "deny"
too_many_lines = "allow"
too_many_arguments = "allow"
# Preserve the existing default-style preference.
collapsible_if = "allow"
# ============================================================================
# Profiles
# ============================================================================
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
panic = "abort"
debug = "none"
strip = "symbols"
# Fastest path from clone to a running node. Inherits `release` but drops
# fat LTO and raises codegen-units so crates compile in parallel — ~3x
# faster to build than `--release` at the cost of lower runtime throughput
# (~2.5–4.5x fewer blocks/s in the sync-apply bench). Good enough to boot
# and explore; switch to `--release` for sustained IBD or benchmarking.
[profile.quickstart]
inherits = "release"
opt-level = 3
lto = false
codegen-units = 16
debug = "none"
[profile.bench]
opt-level = 3
lto = "fat"
codegen-units = 1
debug = "line-tables-only"
split-debuginfo = "unpacked"
[profile.dev]
opt-level = 1
debug = "limited"
split-debuginfo = "unpacked"
[profile.test]
opt-level = 3
debug = "limited"
split-debuginfo = "unpacked"