Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit CLI warning log msg on non 64-bit hardware #3215

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Emit CLI warning log msg on non 64-bit node hardware.
([\#3215](https://github.com/anoma/namada/pull/3215))
20 changes: 20 additions & 0 deletions crates/apps/src/lib/node/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,28 @@ pub fn migrating_state() -> Option<BlockHeight> {
height.parse::<u64>().ok().map(BlockHeight)
}

/// Emit a header of warning log msgs if the host does not have
/// a 64-bit CPU.
fn emit_warning_on_non_64bit_cpu() {
if std::mem::size_of::<usize>() != 8 {
tracing::warn!("");
tracing::warn!(
"Your machine has a {}-bit CPU...",
8 * std::mem::size_of::<usize>()
);
tracing::warn!("");
tracing::warn!("A majority of nodes will run on 64-bit hardware!");
tracing::warn!("");
tracing::warn!("While not immediately being problematic, non 64-bit");
tracing::warn!("nodes may run into spurious consensus failures.");
tracing::warn!("");
}
}

/// Run the ledger with an async runtime
pub fn run(config: config::Ledger, wasm_dir: PathBuf) {
emit_warning_on_non_64bit_cpu();

let logical_cores = num_cpus::get();
tracing::info!("Available logical cores: {}", logical_cores);

Expand Down
Loading