Allow compilation with no slasher backend (#3888)
## Proposed Changes Allowing compiling without MDBX by running: ```bash CARGO_INSTALL_EXTRA_FLAGS="--no-default-features" make ``` The reasons to do this are several: - Save compilation time if the slasher won't be used - Work around compilation errors in slasher backend dependencies (our pinned version of MDBX is currently not compiling on FreeBSD with certain compiler versions). ## Additional Info When I opened this PR we were using resolver v1 which [doesn't disable default features in dependencies](https://doc.rust-lang.org/cargo/reference/features.html#resolver-version-2-command-line-flags), and `mdbx` is default for the `slasher` crate. Even after the resolver got changed to v2 in #3697 compiling with `--no-default-features` _still_ wasn't turning off the slasher crate's default features, so I added `default-features = false` in all the places we depend on it. Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
parent
be29394a9d
commit
47b22d5256
15
Makefile
15
Makefile
@ -38,15 +38,24 @@ PROFILE ?= release
|
|||||||
# they run for different forks.
|
# they run for different forks.
|
||||||
FORKS=phase0 altair merge capella
|
FORKS=phase0 altair merge capella
|
||||||
|
|
||||||
|
# Extra flags for Cargo
|
||||||
|
CARGO_INSTALL_EXTRA_FLAGS?=
|
||||||
|
|
||||||
# Builds the Lighthouse binary in release (optimized).
|
# Builds the Lighthouse binary in release (optimized).
|
||||||
#
|
#
|
||||||
# Binaries will most likely be found in `./target/release`
|
# Binaries will most likely be found in `./target/release`
|
||||||
install:
|
install:
|
||||||
cargo install --path lighthouse --force --locked --features "$(FEATURES)" --profile "$(PROFILE)"
|
cargo install --path lighthouse --force --locked \
|
||||||
|
--features "$(FEATURES)" \
|
||||||
|
--profile "$(PROFILE)" \
|
||||||
|
$(CARGO_INSTALL_EXTRA_FLAGS)
|
||||||
|
|
||||||
# Builds the lcli binary in release (optimized).
|
# Builds the lcli binary in release (optimized).
|
||||||
install-lcli:
|
install-lcli:
|
||||||
cargo install --path lcli --force --locked --features "$(FEATURES)" --profile "$(PROFILE)"
|
cargo install --path lcli --force --locked \
|
||||||
|
--features "$(FEATURES)" \
|
||||||
|
--profile "$(PROFILE)" \
|
||||||
|
$(CARGO_INSTALL_EXTRA_FLAGS)
|
||||||
|
|
||||||
# The following commands use `cross` to build a cross-compile.
|
# The following commands use `cross` to build a cross-compile.
|
||||||
#
|
#
|
||||||
@ -124,7 +133,7 @@ run-ef-tests:
|
|||||||
test-beacon-chain: $(patsubst %,test-beacon-chain-%,$(FORKS))
|
test-beacon-chain: $(patsubst %,test-beacon-chain-%,$(FORKS))
|
||||||
|
|
||||||
test-beacon-chain-%:
|
test-beacon-chain-%:
|
||||||
env FORK_NAME=$* cargo test --release --features fork_from_env -p beacon_chain
|
env FORK_NAME=$* cargo test --release --features fork_from_env,slasher/lmdb -p beacon_chain
|
||||||
|
|
||||||
# Run the tests in the `operation_pool` crate for all known forks.
|
# Run the tests in the `operation_pool` crate for all known forks.
|
||||||
test-op-pool: $(patsubst %,test-op-pool-%,$(FORKS))
|
test-op-pool: $(patsubst %,test-op-pool-%,$(FORKS))
|
||||||
|
@ -36,7 +36,7 @@ clap_utils = { path = "../common/clap_utils" }
|
|||||||
hyper = "0.14.4"
|
hyper = "0.14.4"
|
||||||
lighthouse_version = { path = "../common/lighthouse_version" }
|
lighthouse_version = { path = "../common/lighthouse_version" }
|
||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
slasher = { path = "../slasher" }
|
slasher = { path = "../slasher", default-features = false }
|
||||||
monitoring_api = { path = "../common/monitoring_api" }
|
monitoring_api = { path = "../common/monitoring_api" }
|
||||||
sensitive_url = { path = "../common/sensitive_url" }
|
sensitive_url = { path = "../common/sensitive_url" }
|
||||||
http_api = { path = "http_api" }
|
http_api = { path = "http_api" }
|
||||||
|
@ -53,7 +53,7 @@ fork_choice = { path = "../../consensus/fork_choice" }
|
|||||||
task_executor = { path = "../../common/task_executor" }
|
task_executor = { path = "../../common/task_executor" }
|
||||||
derivative = "2.1.1"
|
derivative = "2.1.1"
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
slasher = { path = "../../slasher" }
|
slasher = { path = "../../slasher", default-features = false }
|
||||||
eth2 = { path = "../../common/eth2" }
|
eth2 = { path = "../../common/eth2" }
|
||||||
strum = { version = "0.24.0", features = ["derive"] }
|
strum = { version = "0.24.0", features = ["derive"] }
|
||||||
logging = { path = "../../common/logging" }
|
logging = { path = "../../common/logging" }
|
||||||
|
@ -39,7 +39,7 @@ time = "0.3.5"
|
|||||||
directory = {path = "../../common/directory"}
|
directory = {path = "../../common/directory"}
|
||||||
http_api = { path = "../http_api" }
|
http_api = { path = "../http_api" }
|
||||||
http_metrics = { path = "../http_metrics" }
|
http_metrics = { path = "../http_metrics" }
|
||||||
slasher = { path = "../../slasher" }
|
slasher = { path = "../../slasher", default-features = false }
|
||||||
slasher_service = { path = "../../slasher/service" }
|
slasher_service = { path = "../../slasher/service" }
|
||||||
monitoring_api = {path = "../../common/monitoring_api"}
|
monitoring_api = {path = "../../common/monitoring_api"}
|
||||||
execution_layer = { path = "../execution_layer" }
|
execution_layer = { path = "../execution_layer" }
|
||||||
|
@ -133,6 +133,15 @@ Commonly used features include:
|
|||||||
* `slasher-lmdb`: support for the LMDB slasher backend.
|
* `slasher-lmdb`: support for the LMDB slasher backend.
|
||||||
* `jemalloc`: use [`jemalloc`][jemalloc] to allocate memory. Enabled by default on Linux and macOS.
|
* `jemalloc`: use [`jemalloc`][jemalloc] to allocate memory. Enabled by default on Linux and macOS.
|
||||||
Not supported on Windows.
|
Not supported on Windows.
|
||||||
|
* `spec-minimal`: support for the minimal preset (useful for testing).
|
||||||
|
|
||||||
|
Default features (e.g. `slasher-mdbx`) may be opted out of using the `--no-default-features`
|
||||||
|
argument for `cargo`, which can plumbed in via the `CARGO_INSTALL_EXTRA_FLAGS` environment variable.
|
||||||
|
E.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
CARGO_INSTALL_EXTRA_FLAGS="--no-default-features" make
|
||||||
|
```
|
||||||
|
|
||||||
[jemalloc]: https://jemalloc.net/
|
[jemalloc]: https://jemalloc.net/
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ malloc_utils = { path = "../common/malloc_utils" }
|
|||||||
directory = { path = "../common/directory" }
|
directory = { path = "../common/directory" }
|
||||||
unused_port = { path = "../common/unused_port" }
|
unused_port = { path = "../common/unused_port" }
|
||||||
database_manager = { path = "../database_manager" }
|
database_manager = { path = "../database_manager" }
|
||||||
slasher = { path = "../slasher" }
|
slasher = { path = "../slasher", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
@ -9,7 +9,7 @@ beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
|||||||
directory = { path = "../../common/directory" }
|
directory = { path = "../../common/directory" }
|
||||||
lighthouse_network = { path = "../../beacon_node/lighthouse_network" }
|
lighthouse_network = { path = "../../beacon_node/lighthouse_network" }
|
||||||
network = { path = "../../beacon_node/network" }
|
network = { path = "../../beacon_node/network" }
|
||||||
slasher = { path = ".." }
|
slasher = { path = "..", default-features = false }
|
||||||
slog = "2.5.2"
|
slog = "2.5.2"
|
||||||
slot_clock = { path = "../../common/slot_clock" }
|
slot_clock = { path = "../../common/slot_clock" }
|
||||||
state_processing = { path = "../../consensus/state_processing" }
|
state_processing = { path = "../../consensus/state_processing" }
|
||||||
|
Loading…
Reference in New Issue
Block a user