Skip to content

Commit

Permalink
Fix formatting nits
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Oct 23, 2023
1 parent a9f3557 commit b3c8e87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion node/Cranky.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ warn = [
allow = [
# Produces too many false positives.
"clippy::redundant_locals",
]
]
27 changes: 11 additions & 16 deletions node/actors/executor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use consensus::Consensus;
use executor::{configurator::Configs, io::Dispatcher};
use std::{fs, io::IsTerminal as _, path::Path, sync::Arc};
use storage::{BlockStore, RocksdbStorage};
use tracing::{debug, info, metadata::LevelFilter};
use tracing::metadata::LevelFilter;
use tracing_subscriber::{prelude::*, Registry};
use utils::{no_copy::NoCopy, pipe};
use vise_exporter::MetricsExporter;
Expand Down Expand Up @@ -55,20 +55,20 @@ async fn main() -> anyhow::Result<()> {
tracing::subscriber::set_global_default(subscriber).unwrap();

// Start the node.
info!("Starting node.");
tracing::info!("Starting node.");
}

// Load the config files.
debug!("Loading config files.");
tracing::debug!("Loading config files.");
let configs = Configs::read(&args).context("configs.read()")?;

if config_mode {
info!("Configuration verified.");
tracing::info!("Configuration verified.");
return Ok(());
}

// Initialize the storage.
debug!("Initializing storage.");
tracing::debug!("Initializing storage.");

let storage = RocksdbStorage::new(ctx, &configs.config.genesis_block, Path::new("./database"));
let storage = Arc::new(storage.await.context("RocksdbStorage::new()")?);
Expand Down Expand Up @@ -98,7 +98,7 @@ async fn main() -> anyhow::Result<()> {
.context("consensus")?;
// FIXME(slowli): Run `sync_blocks` actor once it's fully functional

debug!("Starting actors in separate threads.");
tracing::debug!("Starting actors in separate threads.");
scope::run!(ctx, |ctx, s| async {
if let Some(addr) = configs.config.metrics_server_addr {
let addr = NoCopy::from(addr);
Expand Down Expand Up @@ -128,15 +128,10 @@ async fn main() -> anyhow::Result<()> {
if ci_mode {
let storage = storage.clone();
loop {
let block_finalized = storage
.head_block(ctx)
.await
.context("head_block")?
.block
.number
.0;

info!("current finalized block {}", block_finalized);
let block_finalized = storage.head_block(ctx).await.context("head_block")?;
let block_finalized = block_finalized.block.number.0;

tracing::info!("current finalized block {}", block_finalized);
if block_finalized > 100 {
// we wait for 10 seconds to make sure that we send enough messages to other nodes
// and other nodes have enough messages to finalize 100+ blocks
Expand All @@ -146,7 +141,7 @@ async fn main() -> anyhow::Result<()> {
ctx.sleep(time::Duration::seconds(1)).await?;
}

info!("Cancel all tasks");
tracing::info!("Cancel all tasks");
s.cancel();
}

Expand Down

0 comments on commit b3c8e87

Please sign in to comment.