Skip to content

Commit 443f9d0

Browse files
authored
refactor(l2): remove redb and libmdbx from rollup store (#4063)
**Motivation** We are not using `libmdbx` and `redb` for the rollup store and maintaining them is a waste of time. **Description** Removes `libmdbx` and `redb` from the rollup store. Closes #3743
1 parent 9f17fb7 commit 443f9d0

File tree

17 files changed

+14
-1222
lines changed

17 files changed

+14
-1222
lines changed

Cargo.lock

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build: ## 🔨 Build the client
1111
lint: ## 🧹 Linter check
1212
# Note that we are compiling without the "gpu" feature (see #4048 for why)
1313
# To compile with it you can replace '-F' with '--all-features', but you need to have nvcc installed
14-
cargo clippy --all-targets -F debug,redb,risc0,rollup_storage_libmdbx,rollup_storage_redb,sp1,sync-test \
14+
cargo clippy --all-targets -F debug,redb,risc0,sp1,sync-test \
1515
--workspace --exclude ethrex-replay --exclude ethrex-prover --exclude zkvm_interface --exclude ef_tests-blockchain \
1616
--release -- -D warnings
1717

cmd/ethrex/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ c-kzg = [
7070
"ethrex-p2p/c-kzg",
7171
]
7272
metrics = ["ethrex-blockchain/metrics", "ethrex-l2/metrics"]
73-
libmdbx = ["ethrex-storage/libmdbx", "ethrex-storage-rollup/libmdbx"]
73+
libmdbx = ["ethrex-storage/libmdbx"]
7474
redb = ["dep:redb", "ethrex-storage/redb"]
7575
blst = ["ethrex-vm/blst"]
76-
rollup_storage_libmdbx = ["ethrex-storage-rollup/libmdbx"]
77-
rollup_storage_redb = ["ethrex-storage-rollup/redb"]
7876
rollup_storage_sql = ["ethrex-storage-rollup/sql"]
7977
sync-test = ["ethrex-p2p/sync-test"]
8078
sp1 = ["ethrex-prover/sp1"]

cmd/ethrex/l2/command.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,10 @@ impl Command {
291291
}
292292
};
293293
cfg_if::cfg_if! {
294-
if #[cfg(feature = "rollup_storage_libmdbx")] {
295-
let rollup_store_type = ethrex_storage_rollup::EngineTypeRollup::Libmdbx;
296-
} else if #[cfg(feature = "rollup_storage_sql")] {
294+
if #[cfg(feature = "rollup_storage_sql")] {
297295
let rollup_store_type = ethrex_storage_rollup::EngineTypeRollup::SQL;
298296
} else {
299-
eyre::bail!("Expected one of libmdbx or sql rollup store engine");
297+
eyre::bail!("Expected sql rollup store engine");
300298
}
301299
};
302300

cmd/ethrex/l2/initializers.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,8 @@ pub async fn init_rollup_store(data_dir: &str) -> StoreRollup {
101101
cfg_if::cfg_if! {
102102
if #[cfg(feature = "rollup_storage_sql")] {
103103
let engine_type = EngineTypeRollup::SQL;
104-
} else if #[cfg(feature = "rollup_storage_redb")] {
105-
let engine_type = EngineTypeRollup::RedB;
106-
} else if #[cfg(feature = "rollup_storage_libmdbx")] {
107-
let engine_type = EngineTypeRollup::Libmdbx;
108-
} else {
104+
}
105+
else {
109106
let engine_type = EngineTypeRollup::InMemory;
110107
}
111108
}

crates/l2/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ CI_ETHREX_WORKDIR := /usr/local/bin
3535
L1_RPC_URL=http://localhost:8545
3636
L1_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924
3737

38-
ethrex_L2_DEV_LIBMDBX?=dev_ethrex_l2
39-
ethrex_L1_DEV_LIBMDBX=dev_ethrex_l1
38+
ethrex_L2_DEV_DB?=dev_ethrex_l2
39+
ethrex_L1_DEV_DB=dev_ethrex_l1
4040
L1_PORT=8545
4141
L2_PORT=1729
4242
L1_AUTH_PORT=8551
@@ -71,10 +71,10 @@ init-l1: ## 🚀 Initializes an L1 Lambda ethrex Client
7171
--http.addr ${L1_RPC_ADDRESS} \
7272
--authrpc.port ${L1_AUTH_PORT} \
7373
--dev \
74-
--datadir ${ethrex_L1_DEV_LIBMDBX}
74+
--datadir ${ethrex_L1_DEV_DB}
7575

7676
rm-db-l1: ## 🛑 Removes the DB used by the L1
77-
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- removedb --datadir ${ethrex_L1_DEV_LIBMDBX} --force
77+
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- removedb --datadir ${ethrex_L1_DEV_DB} --force
7878

7979
deploy-l1: ## 📜 Deploys the L1 contracts
8080
COMPILE_CONTRACTS=true \
@@ -124,7 +124,7 @@ init-l2: ## 🚀 Initializes an L2 Lambda ethrex Client
124124
--metrics \
125125
--metrics.port ${L2_PROMETHEUS_METRICS_PORT} \
126126
--evm levm \
127-
--datadir ${ethrex_L2_DEV_LIBMDBX} \
127+
--datadir ${ethrex_L2_DEV_DB} \
128128
--l1.bridge-address ${DEFAULT_BRIDGE_ADDRESS} \
129129
--l1.on-chain-proposer-address ${DEFAULT_ON_CHAIN_PROPOSER_ADDRESS} \
130130
--eth.rpc-url ${L1_RPC_URL} \
@@ -150,7 +150,7 @@ down-l2: ## 🛑 Shuts down the L2 Lambda ethrex Client
150150
pkill -x ethrex || exit 0
151151

152152
rm-db-l2: ## 🛑 Removes the DB used by the L2
153-
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- l2 removedb --datadir ${ethrex_L2_DEV_LIBMDBX} --force
153+
cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- l2 removedb --datadir ${ethrex_L2_DEV_DB} --force
154154

155155
restart-l2: down-l2 rm-db-l2 init-l2 ## 🔄 Restarts the L2 Lambda ethrex Client
156156

crates/l2/storage/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ futures.workspace = true
1717
anyhow = "1.0.86"
1818
thiserror.workspace = true
1919
tracing.workspace = true
20-
libmdbx = { workspace = true, optional = true }
21-
redb = { workspace = true, optional = true }
2220
libsql = { workspace = true, optional = true }
2321
# NOTE: intentionally avoiding the workspace dep as it brings "full" features, breaking the provers
2422
# We only need the runtime for the blocking databases to spawn blocking tasks
@@ -29,8 +27,6 @@ bincode = "1.3.3"
2927

3028
[features]
3129
default = []
32-
libmdbx = ["dep:libmdbx", "dep:tokio"]
33-
redb = ["dep:redb", "dep:tokio"]
3430
sql = ["dep:libsql", "dep:tokio"]
3531
l2 = []
3632

crates/l2/storage/src/error.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
#[cfg(feature = "redb")]
2-
use redb::{CommitError, DatabaseError, StorageError, TableError, TransactionError};
31
use thiserror::Error;
42

53
// TODO improve errors
64
#[derive(Debug, Error)]
75
pub enum RollupStoreError {
86
#[error("DecodeError")]
97
DecodeError,
10-
#[cfg(feature = "libmdbx")]
11-
#[error("Libmdbx error: {0}")]
12-
LibmdbxError(anyhow::Error),
13-
#[cfg(feature = "redb")]
14-
#[error("Redb Storage error: {0}")]
15-
RedbStorageError(#[from] StorageError),
16-
#[cfg(feature = "redb")]
17-
#[error("Redb Table error: {0}")]
18-
RedbTableError(#[from] TableError),
19-
#[cfg(feature = "redb")]
20-
#[error("Redb Commit error: {0}")]
21-
RedbCommitError(#[from] CommitError),
22-
#[cfg(feature = "redb")]
23-
#[error("Redb Transaction error: {0}")]
24-
RedbTransactionError(#[from] Box<TransactionError>),
25-
#[error("Redb Database error: {0}")]
26-
#[cfg(feature = "redb")]
27-
RedbDatabaseError(#[from] DatabaseError),
28-
#[error("Redb Cast error")]
29-
#[cfg(feature = "redb")]
30-
RedbCastError,
318
#[cfg(feature = "sql")]
329
#[error("Limbo Query error: {0}")]
3310
SQLQueryError(#[from] libsql::Error),

crates/l2/storage/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
mod api;
22
mod error;
3-
mod rlp;
43
mod store;
54
mod store_db;
65

crates/l2/storage/src/rlp.rs

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)