Redb slasher backend impl (#4529)

* initial redb impl

* redb impl

* remove phantom data

* fixed table definition

* fighting the borrow checker

* a rough draft that doesnt cause lifetime issues

* refactoring

* refactor

* refactor

* passing unit tests

* refactor

* refactor

* refactor

* commit

* move everything to one database

* remove panics, ready for a review

* merge

* a working redb impl

* passing a ref of txn to cursor

* this tries to create a second write transaction when initializing cursor. breaks everything

* Use 2 lifetimes and subtyping

Also fixes a bug in last_key caused by rev and next_back cancelling out

* Move table into cursor

* Merge remote-tracking branch 'origin/unstable' into redb-slasher-backend-impl

* changes based on feedback

* update lmdb

* fix lifetime issues

* moving everything from Cursor to Transaction

* update

* upgrade to redb 2.0

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into redb-slasher-backend-impl

* bring back cursor

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into redb-slasher-backend-impl

* fix delete while

* linting

* linting

* switch to lmdb

* update redb to v2.1

* build fixes, remove unwrap or default

* another build error

* hopefully this is the last build error

* fmt

* cargo.toml

* fix mdbx

* Merge branch 'unstable' of https://github.com/sigp/lighthouse into redb-slasher-backend-impl

* Remove a collect

* Merge remote-tracking branch 'origin/unstable' into redb-slasher-backend-impl

* Merge branch 'redb-slasher-backend-impl' of https://github.com/eserilev/lighthouse into redb-slasher-backend-impl

* re-enable test

* fix failing slasher test

* Merge remote-tracking branch 'origin/unstable' into redb-slasher-backend-impl

* Rename DB file to `slasher.redb`
This commit is contained in:
Eitan Seri-Levi
2024-07-01 03:36:40 +02:00
committed by GitHub
parent 16b81132ca
commit 70bcba1e6b
18 changed files with 499 additions and 72 deletions

11
Cargo.lock generated
View File

@@ -6678,6 +6678,15 @@ dependencies = [
"yasna",
]
[[package]]
name = "redb"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed7508e692a49b6b2290b56540384ccae9b1fb4d77065640b165835b56ffe3bb"
dependencies = [
"libc",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
@@ -7635,6 +7644,7 @@ version = "0.1.0"
dependencies = [
"bincode",
"byteorder",
"derivative",
"ethereum_ssz",
"ethereum_ssz_derive",
"filesystem",
@@ -7650,6 +7660,7 @@ dependencies = [
"parking_lot 0.12.3",
"rand",
"rayon",
"redb",
"safe_arith",
"serde",
"slog",