mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 08:52:54 +00:00
Update BLST, add force-adx support (#1595)
## Issue Addressed Closes #1504 Closes https://github.com/sigp/lighthouse/issues/1505 ## Proposed Changes * Update `blst` to the latest version, which is more portable and includes finer-grained compilation controls (see below). * Detect the case where a binary has been explicitly compiled with ADX support but it's missing at runtime, and report a nicer error than `SIGILL`. ## Known Issues * None. The previous issue with `make build-aarch64` (https://github.com/supranational/blst/issues/27), has been resolved. ## Additional Info I think we should tweak our release process and our Docker builds so that we provide two options: Binaries: * `lighthouse`: compiled with `modern`/`force-adx`, for CPUs 2013 and newer * `lighthouse-portable`: compiled with `portable` for older CPUs Docker images: * `sigp/lighthouse:latest`: multi-arch image with `modern` x86_64 and vanilla aarch64 binary * `sigp/lighthouse:latest-portable`: multi-arch image with `portable` builds for x86_64 and aarch64 And relevant Docker images for the releases (as per https://github.com/sigp/lighthouse/pull/1574#issuecomment-687766141), tagged `v0.x.y` and `v0.x.y-portable`
This commit is contained in:
@@ -9,6 +9,9 @@ edition = "2018"
|
||||
write_ssz_files = ["beacon_node/write_ssz_files"]
|
||||
# Compiles the BLS crypto code so that the binary is portable across machines.
|
||||
portable = ["bls/supranational-portable"]
|
||||
# Compiles BLST so that it always uses ADX instructions.
|
||||
# Compatible with processors from 2013 onwards.
|
||||
modern = ["bls/supranational-force-adx"]
|
||||
# Uses the slower Milagro BLS library, which is written in native Rust.
|
||||
milagro = ["bls/milagro"]
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ pub const ETH2_CONFIG_FILENAME: &str = "eth2-spec.toml";
|
||||
fn bls_library_name() -> &'static str {
|
||||
if cfg!(feature = "portable") {
|
||||
"blst-portable"
|
||||
} else if cfg!(feature = "modern") {
|
||||
"blst-modern"
|
||||
} else if cfg!(feature = "milagro") {
|
||||
"milagro"
|
||||
} else {
|
||||
@@ -181,6 +183,13 @@ fn run<E: EthSpec>(
|
||||
));
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "modern", target_arch = "x86_64"))]
|
||||
if !std::is_x86_feature_detected!("adx") {
|
||||
return Err(format!(
|
||||
"CPU incompatible with optimized binary, please try Lighthouse portable build"
|
||||
));
|
||||
}
|
||||
|
||||
let debug_level = matches
|
||||
.value_of("debug-level")
|
||||
.ok_or_else(|| "Expected --debug-level flag".to_string())?;
|
||||
|
||||
Reference in New Issue
Block a user