Skip to content

Commit b61303a

Browse files
committed
fix(dash): silence unused-variable warnings without quorum_validation
Gate the per-cycle rotation-sig bindings, the `RotationChainLockSignatureSlot` enum, its `Display` impl, and the `core::fmt` import behind `#[cfg(feature = "quorum_validation")]` so default-feature builds stay warning-free. Addresses CodeRabbit review comment on PR #736 #736 (comment)
1 parent 3dfd0a8 commit b61303a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • dash/src/sml/masternode_list_engine

dash/src/sml/masternode_list_engine/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ mod rotated_quorum_construction;
66
#[cfg(feature = "quorum_validation")]
77
mod validation;
88

9+
#[cfg(feature = "quorum_validation")]
910
use core::fmt;
1011
use std::collections::{BTreeMap, BTreeSet};
1112

@@ -41,6 +42,7 @@ pub const WORK_DIFF_DEPTH: u32 = 8;
4142
/// Identifies one of the rotation ChainLock signature slots carried by a QRInfo
4243
/// response. Each slot corresponds to one per-cycle diff in the rotation quorum
4344
/// formation proof: three historical cycles, the h diff, and the tip.
45+
#[cfg(feature = "quorum_validation")]
4446
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
4547
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4648
#[cfg_attr(feature = "bincode", derive(Encode, Decode))]
@@ -52,6 +54,7 @@ pub(crate) enum RotationChainLockSignatureSlot {
5254
Tip,
5355
}
5456

57+
#[cfg(feature = "quorum_validation")]
5558
impl fmt::Display for RotationChainLockSignatureSlot {
5659
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5760
let name = match self {
@@ -798,8 +801,11 @@ impl MasternodeListEngine {
798801

799802
self.known_snapshots
800803
.insert(mn_list_diff_at_h_minus_3c.block_hash, quorum_snapshot_at_h_minus_3c);
804+
#[cfg(feature = "quorum_validation")]
801805
let maybe_sig_h_minus_3c =
802806
self.apply_diff(mn_list_diff_at_h_minus_3c, None, false, None)?;
807+
#[cfg(not(feature = "quorum_validation"))]
808+
self.apply_diff(mn_list_diff_at_h_minus_3c, None, false, None)?;
803809
self.known_snapshots
804810
.insert(mn_list_diff_at_h_minus_2c.block_hash, quorum_snapshot_at_h_minus_2c);
805811
let maybe_sig_h_minus_2c =
@@ -811,6 +817,7 @@ impl MasternodeListEngine {
811817
// in the `(h-c, h]` diff range), not on `masternode_lists[h-c]` where
812818
// the cycle two back resides; using h here is load-bearing for the
813819
// sig alignment in `validate_and_store_previous_cycle_quorums`.
820+
#[cfg(feature = "quorum_validation")]
814821
let work_block_hash_h = mn_list_diff_h.block_hash;
815822
let maybe_sig_h = self.apply_diff(mn_list_diff_h, None, false, None)?;
816823

@@ -819,8 +826,11 @@ impl MasternodeListEngine {
819826
_ => None,
820827
};
821828

829+
#[cfg(feature = "quorum_validation")]
822830
let maybe_sig_tip =
823831
self.apply_diff(mn_list_diff_tip, None, verify_tip_non_rotated_quorums, sigs)?;
832+
#[cfg(not(feature = "quorum_validation"))]
833+
self.apply_diff(mn_list_diff_tip, None, verify_tip_non_rotated_quorums, sigs)?;
824834

825835
// The 4 historical sigs `[sig_h_minus_3c..sig_h]` align with the h-c
826836
// cycle's 4 quarters (work blocks h-4c-8, h-3c-8, h-2c-8, h-c-8).

0 commit comments

Comments
 (0)