Skip to content

Commit d2c794c

Browse files
committed
Bump MSRV to 1.63.0 and update dependencies
1 parent 46881ed commit d2c794c

File tree

8 files changed

+380
-271
lines changed

8 files changed

+380
-271
lines changed

Cargo.lock

Lines changed: 351 additions & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/romanz/electrs"
99
keywords = ["bitcoin", "electrum", "server", "index", "database"]
1010
documentation = "https://docs.rs/electrs/"
1111
readme = "README.md"
12-
edition = "2018"
12+
edition = "2021"
1313
build = "build.rs"
1414

1515
[features]
@@ -27,29 +27,27 @@ bitcoincore-rpc = "0.17.0"
2727
configure_me = "0.4"
2828
crossbeam-channel = "0.5"
2929
dirs-next = "2.0"
30-
env_logger = "0.9"
30+
env_logger = "0.10"
3131
log = "0.4"
32-
parking_lot = "0.11"
32+
parking_lot = "0.12"
3333
prometheus = { version = "0.13", optional = true }
34-
rayon = "1.5"
34+
rayon = "1.7"
3535
serde = "1.0"
3636
serde_derive = "1.0"
3737
serde_json = "1.0"
3838
signal-hook = "0.3"
3939
tiny_http = { version = "0.12", optional = true }
4040

4141
[dependencies.electrs-rocksdb]
42-
# Workaround the following issues:
43-
# - https://github.com/romanz/electrs/issues/403 (support building on ARM 32-bit)
44-
# - https://github.com/romanz/electrs/issues/469 (dynamic linking on Debian 11)
45-
version = "0.15.0-e3"
42+
version = "0.19.0-e2"
43+
4644
default-features = false
4745
# ZSTD is used for data compression
4846
# Snappy is only for checking old DB
4947
features = ["zstd", "snappy"]
5048

5149
[build-dependencies]
52-
configure_me_codegen = { version = "0.4.3", default-features = false }
50+
configure_me_codegen = { version = "0.4.4", default-features = false }
5351

5452
[dev-dependencies]
5553
hex_lit = "0.1.1"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# The maintainers of electrs are not deeply familiar with Docker, so you should DYOR.
33
# If you are not familiar with Docker either it's probably be safer to NOT use it.
44

5-
FROM debian:bullseye-slim as base
5+
FROM debian:bookworm-slim as base
66
RUN apt-get update -qqy
77
RUN apt-get install -qqy librocksdb-dev curl
88

Dockerfile.ci

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# The maintainers of electrs are not deeply familiar with Docker, so you should DYOR.
33
# If you are not familiar with Docker either it's probably be safer to NOT use it.
44

5-
FROM debian:bullseye-slim as base
5+
FROM debian:bookworm-slim as base
66
RUN apt-get update -qqy
77
RUN apt-get install -qqy librocksdb-dev wget
88

@@ -36,9 +36,11 @@ RUN bitcoind -version && bitcoin-cli -version
3636
### Electrum ###
3737
# Clone latest Electrum wallet and a few test tools
3838
WORKDIR /build/
39-
RUN apt-get install -qqy git libsecp256k1-0 python3-cryptography python3-setuptools python3-pip jq curl
39+
RUN apt-get install -qqy git libsecp256k1-1 python3-cryptography python3-setuptools python3-venv python3-pip jq curl
4040
RUN git clone --recurse-submodules https://github.com/spesmilo/electrum/ && cd electrum/ && git log -1
41-
RUN python3 -m pip install -e electrum/
41+
RUN python3 -m venv --system-site-packages venv && \
42+
venv/bin/pip install -e electrum/ && \
43+
ln /build/venv/bin/electrum /usr/bin/electrum
4244

4345
RUN electrum version --offline
4446
WORKDIR /

doc/install.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $ ./target/release/electrs --version # should print the latest version
2525
Note for Raspberry Pi 4 owners: the old versions of OS/toolchains produce broken binaries.
2626
Make sure to use latest OS! (see #226)
2727

28-
Install [recent Rust](https://rustup.rs/) (1.48.0+, `apt install cargo` is preferred for Debian 11),
28+
Install [recent Rust](https://rustup.rs/) (1.63.0+, `apt install cargo` is preferred for Debian 12),
2929
[latest Bitcoin Core](https://bitcoincore.org/en/download/) (0.21+)
3030
and [latest Electrum wallet](https://electrum.org/#download) (4.0+).
3131

@@ -52,18 +52,18 @@ The advantages of dynamic linking:
5252
* Cross compilation is more reliable
5353
* If another application is also using `rocksdb`, you don't store it on disk and in RAM twice
5454

55-
If you decided to use dynamic linking, you will also need to install the library ([6.11.4 release](https://github.com/facebook/rocksdb/releases/tag/v6.11.4) is required).
56-
On [Debian 11 (bullseye)](https://packages.debian.org/bullseye/librocksdb-dev) and [Ubuntu 21.04 (hirsute)](https://packages.ubuntu.com/hirsute/librocksdb-dev):
55+
If you decided to use dynamic linking, you will also need to install the library ([7.8.3 release](https://github.com/facebook/rocksdb/releases/tag/v7.8.3) is required).
56+
On [Debian 12 (bookworm)](https://packages.debian.org/bookworm/librocksdb-dev) and [Ubuntu 23.04 (lunar)](https://packages.ubuntu.com/lunar/librocksdb-dev):
5757

5858
```bash
59-
$ sudo apt install librocksdb-dev=6.11.4-3
59+
$ sudo apt install librocksdb-dev=7.8.3-2
6060
```
6161

6262
For other versions of Debian or Ubuntu, you can build librocksdb and install inside `/usr/local` directory using following command.
6363

6464
```bash
6565
$ sudo apt install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
66-
$ git clone -b v6.11.4 --depth 1 https://github.com/facebook/rocksdb && cd rocksdb
66+
$ git clone -b v7.8.3 --depth 1 https://github.com/facebook/rocksdb && cd rocksdb
6767
$ make shared_lib -j $(nproc) && sudo make install-shared
6868
$ cd .. && rm -r rocksdb
6969
```

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.48.0
1+
1.63.0

src/db.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ impl Default for Config {
9696
}
9797

9898
fn default_opts() -> rocksdb::Options {
99+
let mut block_opts = rocksdb::BlockBasedOptions::default();
100+
block_opts.set_checksum_type(rocksdb::ChecksumType::CRC32c);
101+
99102
let mut opts = rocksdb::Options::default();
100103
opts.set_keep_log_file_num(10);
101104
opts.set_max_open_files(16);
@@ -106,6 +109,7 @@ fn default_opts() -> rocksdb::Options {
106109
opts.set_disable_auto_compactions(true); // for initial bulk load
107110
opts.set_advise_random_on_open(false); // bulk load uses sequential I/O
108111
opts.set_prefix_extractor(rocksdb::SliceTransform::create_fixed_prefix(8));
112+
opts.set_block_based_table_factory(&block_opts);
109113
opts
110114
}
111115

@@ -233,15 +237,15 @@ impl DBStore {
233237
opts.set_prefix_same_as_start(true); // requires .set_prefix_extractor() above.
234238
self.db
235239
.iterator_cf_opt(cf, opts, mode)
236-
.map(|(key, _value)| key) // values are empty in prefix-scanned CFs
240+
.map(|row| row.expect("prefix iterator failed").0) // values are empty in prefix-scanned CFs
237241
}
238242

239243
pub(crate) fn read_headers(&self) -> Vec<Row> {
240244
let mut opts = rocksdb::ReadOptions::default();
241245
opts.fill_cache(false);
242246
self.db
243247
.iterator_cf_opt(self.headers_cf(), opts, rocksdb::IteratorMode::Start)
244-
.map(|(key, _)| key)
248+
.map(|row| row.expect("header iterator failed").0) // extract key from row
245249
.filter(|key| &key[..] != TIP_KEY) // headers' rows are longer than TIP_KEY
246250
.collect()
247251
}
@@ -310,7 +314,7 @@ impl DBStore {
310314
DB_PROPERIES.iter().filter_map(move |property_name| {
311315
let value = self
312316
.db
313-
.property_int_value_cf(cf, property_name)
317+
.property_int_value_cf(cf, *property_name)
314318
.expect("failed to get property");
315319
Some((*cf_name, *property_name, value?))
316320
})

src/status.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,8 @@ impl ScriptHashStatus {
376376
let sorted_entries = entries_map
377377
.into_iter()
378378
.collect::<BTreeMap<usize, TxEntry>>()
379-
.into_iter()
380-
.map(|(_pos, entry)| entry)
381-
.collect::<Vec<TxEntry>>();
379+
.into_values()
380+
.collect();
382381
(blockhash, sorted_entries)
383382
})
384383
.collect())
@@ -415,7 +414,7 @@ impl ScriptHashStatus {
415414
.spent = spent_outpoints;
416415
cache.add_tx(entry.txid, || entry.tx.clone());
417416
}
418-
result.into_iter().map(|(_txid, entry)| entry).collect()
417+
result.into_values().collect()
419418
}
420419

421420
/// Sync with currently confirmed txs and mempool, downloading non-cached transactions via p2p protocol.

0 commit comments

Comments
 (0)