From 00c89c51c81ffdb502906c33c2370e2dcdc010a7 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 14 Jul 2020 06:23:33 +0000 Subject: [PATCH] Return 32-bit architecture error earlier (#1356) ## Issue Addressed NA ## Proposed Changes Exits *earlier* when system is 32-bit. Previously we were trying (and failing) to parse the genesis SSZ first. This made for a bad user experience. ## Additional Info NA --- lighthouse/src/main.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index ccb13800f..08af75141 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -156,6 +156,13 @@ fn run( environment_builder: EnvironmentBuilder, matches: &ArgMatches, ) -> Result<(), String> { + if std::mem::size_of::() != 8 { + return Err(format!( + "{}bit architecture is not supported (64bit only).", + std::mem::size_of::() * 8 + )); + } + let debug_level = matches .value_of("debug-level") .ok_or_else(|| "Expected --debug-level flag".to_string())?; @@ -180,15 +187,6 @@ fn run( environment.log_to_json_file(path, debug_level, log_format)?; } - if std::mem::size_of::() != 8 { - crit!( - log, - "Lighthouse only supports 64bit CPUs"; - "detected" => format!("{}bit", std::mem::size_of::() * 8) - ); - return Err("Invalid CPU architecture".into()); - } - // Note: the current code technically allows for starting a beacon node _and_ a validator // client at the same time. //