mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Compare commits
5 Commits
v1.4.0-rc.
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b600acdc5 | ||
|
|
b383836418 | ||
|
|
4a6f2fac81 | ||
|
|
93100f221f | ||
|
|
502402c6b9 |
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -630,7 +630,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "beacon_node"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"beacon_chain",
|
||||
"clap",
|
||||
@@ -844,7 +844,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "boot_node"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"beacon_node",
|
||||
"clap",
|
||||
@@ -3352,7 +3352,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lcli"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"account_utils",
|
||||
"bls",
|
||||
@@ -3729,7 +3729,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lighthouse"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"account_manager",
|
||||
"account_utils",
|
||||
@@ -3884,7 +3884,6 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"lighthouse_metrics",
|
||||
"num_cpus",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "beacon_node"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
authors = ["Paul Hauner <paul@paulhauner.com>", "Age Manning <Age@AgeManning.com"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -797,7 +797,7 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
|
||||
// TODO: Maintain this attestation and re-process once sync completes
|
||||
// TODO: We then score based on whether we can download the block and re-process.
|
||||
debug!(
|
||||
trace!(
|
||||
self.log,
|
||||
"Attestation for unknown block";
|
||||
"peer_id" => %peer_id,
|
||||
|
||||
@@ -554,6 +554,13 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
return;
|
||||
}
|
||||
|
||||
debug!(
|
||||
self.log,
|
||||
"Searching for block";
|
||||
"peer_id" => %peer_id,
|
||||
"block" => %block_hash
|
||||
);
|
||||
|
||||
let request = BlocksByRootRequest {
|
||||
block_roots: VariableList::from(vec![block_hash]),
|
||||
};
|
||||
|
||||
@@ -190,6 +190,7 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.eth1.endpoints = vec![SensitiveUrl::parse(endpoint)
|
||||
.map_err(|e| format!("eth1-endpoint was an invalid URL: {:?}", e))?];
|
||||
} else if let Some(endpoints) = cli_args.value_of("eth1-endpoints") {
|
||||
client_config.sync_eth1_chain = true;
|
||||
client_config.eth1.endpoints = endpoints
|
||||
.split(',')
|
||||
.map(|s| SensitiveUrl::parse(s))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "boot_node"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
authors = ["Sigma Prime <contact@sigmaprime.io>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ pub const VERSION: &str = git_version!(
|
||||
// NOTE: using --match instead of --exclude for compatibility with old Git
|
||||
"--match=thiswillnevermatchlol"
|
||||
],
|
||||
prefix = "Lighthouse/v1.4.0-rc.0-",
|
||||
prefix = "Lighthouse/v1.4.0-",
|
||||
fallback = "unknown"
|
||||
);
|
||||
|
||||
|
||||
@@ -11,4 +11,3 @@ lighthouse_metrics = { path = "../lighthouse_metrics" }
|
||||
lazy_static = "1.4.0"
|
||||
libc = "0.2.79"
|
||||
parking_lot = "0.11.0"
|
||||
num_cpus = "1.13.0"
|
||||
|
||||
@@ -21,37 +21,20 @@ use std::result::Result;
|
||||
/// NODES_PER_VALIDATOR * VALIDATORS_PER_ARENA * 32 = 15 * 4096 * 32 = 1.875 MiB
|
||||
const OPTIMAL_MMAP_THRESHOLD: c_int = 2 * 1_024 * 1_024;
|
||||
|
||||
/// The maximum number of arenas allowed to be created by malloc.
|
||||
///
|
||||
/// See `ArenaMaxSetting` docs for details.
|
||||
const OPTIMAL_ARENA_MAX: ArenaMaxSetting = ArenaMaxSetting::NumCpus;
|
||||
|
||||
/// Constants used to configure malloc internals.
|
||||
///
|
||||
/// Source:
|
||||
///
|
||||
/// https://github.com/lattera/glibc/blob/895ef79e04a953cac1493863bcae29ad85657ee1/malloc/malloc.h#L115-L123
|
||||
const M_MMAP_THRESHOLD: c_int = -4;
|
||||
const M_ARENA_MAX: c_int = -8;
|
||||
|
||||
/// Environment variables used to configure malloc.
|
||||
///
|
||||
/// Source:
|
||||
///
|
||||
/// https://man7.org/linux/man-pages/man3/mallopt.3.html
|
||||
const ENV_VAR_ARENA_MAX: &str = "MALLOC_ARENA_MAX";
|
||||
const ENV_VAR_MMAP_THRESHOLD: &str = "MALLOC_MMAP_THRESHOLD_";
|
||||
|
||||
#[allow(dead_code)]
|
||||
enum ArenaMaxSetting {
|
||||
/// Do not set any value for MALLOC_ARENA_MAX, leave it as default.
|
||||
DoNotSet,
|
||||
/// Set a fixed value.
|
||||
Fixed(c_int),
|
||||
/// Read the number of CPUs at runtime and use that value.
|
||||
NumCpus,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref GLOBAL_LOCK: Mutex<()> = <_>::default();
|
||||
}
|
||||
@@ -123,20 +106,6 @@ pub fn scrape_mallinfo_metrics() {
|
||||
|
||||
/// Perform all configuration routines.
|
||||
pub fn configure_glibc_malloc() -> Result<(), String> {
|
||||
if !env_var_present(ENV_VAR_ARENA_MAX) {
|
||||
let arena_max = match OPTIMAL_ARENA_MAX {
|
||||
ArenaMaxSetting::DoNotSet => None,
|
||||
ArenaMaxSetting::Fixed(n) => Some(n),
|
||||
ArenaMaxSetting::NumCpus => Some(num_cpus::get() as c_int),
|
||||
};
|
||||
|
||||
if let Some(max) = arena_max {
|
||||
if let Err(e) = malloc_arena_max(max) {
|
||||
return Err(format!("failed (code {}) to set malloc max arena count", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !env_var_present(ENV_VAR_MMAP_THRESHOLD) {
|
||||
if let Err(e) = malloc_mmap_threshold(OPTIMAL_MMAP_THRESHOLD) {
|
||||
return Err(format!("failed (code {}) to set malloc mmap threshold", e));
|
||||
@@ -151,19 +120,6 @@ fn env_var_present(name: &str) -> bool {
|
||||
env::var(name) != Err(env::VarError::NotPresent)
|
||||
}
|
||||
|
||||
/// Uses `mallopt` to set the `M_ARENA_MAX` value, specifying the number of memory arenas to be
|
||||
/// created by malloc.
|
||||
///
|
||||
/// Generally speaking, a smaller arena count reduces memory fragmentation at the cost of memory contention
|
||||
/// between threads.
|
||||
///
|
||||
/// ## Resources
|
||||
///
|
||||
/// - https://man7.org/linux/man-pages/man3/mallopt.3.html
|
||||
fn malloc_arena_max(num_arenas: c_int) -> Result<(), c_int> {
|
||||
into_result(mallopt(M_ARENA_MAX, num_arenas))
|
||||
}
|
||||
|
||||
/// Uses `mallopt` to set the `M_MMAP_THRESHOLD` value, specifying the threshold where objects of this
|
||||
/// size or larger are allocated via an `mmap`.
|
||||
///
|
||||
@@ -198,11 +154,6 @@ fn into_result(result: c_int) -> Result<(), c_int> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn malloc_arena_max_does_not_panic() {
|
||||
malloc_arena_max(2).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malloc_mmap_threshold_does_not_panic() {
|
||||
malloc_mmap_threshold(OPTIMAL_MMAP_THRESHOLD).unwrap();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "lcli"
|
||||
description = "Lighthouse CLI (modeled after zcli)"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "lighthouse"
|
||||
version = "1.4.0-rc.0"
|
||||
version = "1.4.0"
|
||||
authors = ["Sigma Prime <contact@sigmaprime.io>"]
|
||||
edition = "2018"
|
||||
autotests = false
|
||||
|
||||
@@ -165,7 +165,11 @@ fn main() {
|
||||
|
||||
// Configure the allocator early in the process, before it has the chance to use the default values for
|
||||
// anything important.
|
||||
if !matches.is_present(DISABLE_MALLOC_TUNING_FLAG) {
|
||||
//
|
||||
// Only apply this optimization for the beacon node. It's the only process with a substantial
|
||||
// memory footprint.
|
||||
let is_beacon_node = matches.subcommand_name() == Some("beacon_node");
|
||||
if is_beacon_node && !matches.is_present(DISABLE_MALLOC_TUNING_FLAG) {
|
||||
if let Err(e) = configure_memory_allocator() {
|
||||
eprintln!(
|
||||
"Unable to configure the memory allocator: {} \n\
|
||||
|
||||
@@ -257,6 +257,7 @@ fn eth1_endpoints_flag() {
|
||||
"https://infura.io/secret"
|
||||
);
|
||||
assert_eq!(config.eth1.endpoints[1].to_string(), "https://infura.io/");
|
||||
assert!(config.sync_eth1_chain);
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user