Skip to content

Commit

Permalink
[fix]: missing cfg(debug_assertions)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Petrosyan <[email protected]>
  • Loading branch information
appetrosyan committed Aug 14, 2023
1 parent 68c5ad4 commit 4addb64
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
clippy::std_instead_of_core,
clippy::std_instead_of_alloc
)]
#[cfg(debug_assertions)]
use core::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

Expand Down Expand Up @@ -286,6 +287,7 @@ impl Iroha {
)
.start();

#[cfg(debug_assertions)]
let freeze_status = Arc::new(AtomicBool::new(false));

NetworkRelay {
Expand Down
2 changes: 1 addition & 1 deletion core/src/sumeragi/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ fn process_message_independent(
current_view_change_index: u64,
view_change_proof_chain: &mut ProofChain,
round_start_time: &Instant,
is_genesis_peer: bool,
#[cfg_attr(not(debug_assertions), allow(unused_variables))] is_genesis_peer: bool,
) {
let current_topology = &sumeragi.current_topology;
let role = current_topology.role(&sumeragi.peer_id);
Expand Down
2 changes: 1 addition & 1 deletion core/src/sumeragi/network_topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Topology {
}
}

/// True, if the topology contains at least one peer and thus requires consensus
/// True, if the topology contains at least one peer and thus requires consensus
pub fn is_non_empty(&self) -> Option<NonEmptyTopology> {
(!self.sorted_peers.is_empty()).then_some(NonEmptyTopology { topology: self })
}
Expand Down
5 changes: 4 additions & 1 deletion core/src/wsv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,10 @@ impl WorldStateView {
/// you likely have data corruption.
/// - If trigger execution fails
/// - If timestamp conversion to `u64` fails
#[cfg(debug_assertions)]
#[cfg_attr(
not(debug_assertions),
deprecated(note = "This function is to be used in testing only. ")
)]
#[iroha_logger::log(skip_all, fields(block_height))]
pub fn apply(&mut self, block: &VersionedCommittedBlock) -> Result<()> {
self.execute_transactions(block.as_v1())?;
Expand Down
4 changes: 3 additions & 1 deletion core/test_network/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! Module for starting peers and networks. Used only for tests
#![allow(clippy::restriction, clippy::future_not_send)]

use core::{fmt::Debug, str::FromStr as _, sync::atomic::AtomicBool, time::Duration};
use core::{fmt::Debug, str::FromStr as _, time::Duration};
#[cfg(debug_assertions)]
use std::sync::atomic::AtomicBool;
use std::{
collections::{HashMap, HashSet},
path::Path,
Expand Down

0 comments on commit 4addb64

Please sign in to comment.