From 76b35ee3cc659943f5407db8f143f71c6a783ff4 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 11 Jul 2024 16:45:57 +1000 Subject: [PATCH 1/4] Fix builds with slasher-redb feature --- slasher/src/database/redb_impl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slasher/src/database/redb_impl.rs b/slasher/src/database/redb_impl.rs index da7b4e38eda..6c5b62a44fd 100644 --- a/slasher/src/database/redb_impl.rs +++ b/slasher/src/database/redb_impl.rs @@ -91,7 +91,7 @@ impl Environment { } pub fn filenames(&self, config: &Config) -> Vec { - vec![config.database_path.join(BASE_DB)] + vec![config.database_path.join(REDB_DATA_FILENAME)] } pub fn begin_rw_txn(&self) -> Result { From 4ca1ed3bc4f9722da7dd2f2d29d2858662109ef7 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 11 Jul 2024 16:47:08 +1000 Subject: [PATCH 2/4] Test redb on CI --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7d144e55fb8..d18a6738803 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,9 @@ test-network-%: # Run the tests in the `slasher` crate for all supported database backends. test-slasher: cargo nextest run --release -p slasher --features "lmdb,$(TEST_FEATURES)" + cargo nextest run --release -p slasher --no-default-features --features "redb,$(TEST_FEATURES)" cargo nextest run --release -p slasher --no-default-features --features "mdbx,$(TEST_FEATURES)" - cargo nextest run --release -p slasher --features "lmdb,mdbx,$(TEST_FEATURES)" # both backends enabled + cargo nextest run --release -p slasher --features "lmdb,mdbx,redb,$(TEST_FEATURES)" # all backends enabled # Runs only the tests/state_transition_vectors tests. run-state-transition-tests: From 8a4fdfb088147354c8ea49e11d2c74ba068ba06c Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 11 Jul 2024 17:47:39 +1000 Subject: [PATCH 3/4] Delete unnecessary test --- slasher/tests/backend.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/slasher/tests/backend.rs b/slasher/tests/backend.rs index c24b861b18b..9bd36292829 100644 --- a/slasher/tests/backend.rs +++ b/slasher/tests/backend.rs @@ -55,19 +55,3 @@ fn failed_override_with_existing_mdbx_db() { ); assert_eq!(config.backend, DatabaseBackend::Lmdb); } - -#[test] -#[cfg(feature = "redb")] -fn failed_override_with_existing_mdbx_db() { - let tempdir = tempdir().unwrap(); - let mut config = Config::new(tempdir.path().into()); - - let filename = config.database_path.join(MDBX_DATA_FILENAME); - File::create(&filename).unwrap(); - - assert_eq!( - config.override_backend(), - DatabaseBackendOverride::Failure(filename) - ); - assert_eq!(config.backend, DatabaseBackend::Redb); -} From 8dd590773a605db1acda1bca1586a18a17ae6836 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 11 Jul 2024 18:37:55 +1000 Subject: [PATCH 4/4] Disable redb in slasher override tests --- slasher/tests/backend.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slasher/tests/backend.rs b/slasher/tests/backend.rs index 9bd36292829..fd1a6ae14f6 100644 --- a/slasher/tests/backend.rs +++ b/slasher/tests/backend.rs @@ -1,4 +1,4 @@ -#![cfg(any(feature = "lmdb", feature = "redb"))] +#![cfg(feature = "lmdb")] use slasher::{config::MDBX_DATA_FILENAME, Config, DatabaseBackend, DatabaseBackendOverride}; use std::fs::File; @@ -41,7 +41,7 @@ fn no_override_with_existing_mdbx_db() { } #[test] -#[cfg(all(not(feature = "mdbx"), feature = "lmdb", not(feature = "redb")))] +#[cfg(all(not(feature = "mdbx"), feature = "lmdb"))] fn failed_override_with_existing_mdbx_db() { let tempdir = tempdir().unwrap(); let mut config = Config::new(tempdir.path().into());