mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 03:14:25 +00:00
Modularise slasher backend (#3443)
## Proposed Changes
Enable multiple database backends for the slasher, either MDBX (default) or LMDB. The backend can be selected using `--slasher-backend={lmdb,mdbx}`.
## Additional Info
In order to abstract over the two library's different handling of database lifetimes I've used `Box::leak` to give the `Environment` type a `'static` lifetime. This was the only way I could think of using 100% safe code to construct a self-referential struct `SlasherDB`, where the `OpenDatabases` refers to the `Environment`. I think this is OK, as the `Environment` is expected to live for the life of the program, and both database engines leave the database in a consistent state after each write. The memory claimed for memory-mapping will be freed by the OS and appropriately flushed regardless of whether the `Environment` is actually dropped.
We are depending on two `sigp` forks of `libmdbx-rs` and `lmdb-rs`, to give us greater control over MDBX OS support and LMDB's version.
This commit is contained in:
@@ -107,6 +107,23 @@ git checkout ${VERSION}
|
||||
make
|
||||
```
|
||||
|
||||
## Feature Flags
|
||||
|
||||
You can customise the features that Lighthouse is built with using the `FEATURES` environment
|
||||
variable. E.g.
|
||||
|
||||
```
|
||||
env FEATURES="gnosis,slasher-lmdb" make
|
||||
```
|
||||
|
||||
Commonly used features include:
|
||||
|
||||
* `gnosis`: support for the Gnosis Beacon Chain.
|
||||
* `portable`: support for legacy hardware.
|
||||
* `modern`: support for exclusively modern hardware.
|
||||
* `slasher-mdbx`: support for the MDBX slasher backend (enabled by default).
|
||||
* `slasher-lmdb`: support for the LMDB slasher backend.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Command is not found
|
||||
|
||||
Reference in New Issue
Block a user