Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawchord committed Nov 27, 2024
1 parent 32ba6a7 commit 7d8edd4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rs/consensus/src/dkg/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@ fn get_dkg_interval_length(
})
}

// Reads the SubnetCallContext and attempts to create DKG configs for new
// subnets for the next round. An Ok return value contains:
// * configs grouped by subnet (low and high threshold configs per subnet)
// * errors produced while generating the configs.
/// Reads the SubnetCallContext and attempts to create DKG configs for new
/// subnets for the next round. An Ok return value contains:
/// * configs grouped by subnet (low and high threshold configs per subnet)
/// * errors produced while generating the configs.
#[allow(clippy::type_complexity)]
fn process_subnet_call_context(
this_subnet_id: SubnetId,
Expand Down Expand Up @@ -618,9 +618,9 @@ fn get_node_list(
.collect())
}

// Compares two DKG ids without considering the start block heights. This
// function is only used for DKGs for other subnets, as the start block height
// is not used to differentiate two DKGs for the same subnet.
/// Compares two DKG ids without considering the start block heights. This
/// function is only used for DKGs for other subnets, as the start block height
/// is not used to differentiate two DKGs for the same subnet.
fn eq_sans_height(dkg_id1: &NiDkgId, dkg_id2: &NiDkgId) -> bool {
dkg_id1.dealer_subnet == dkg_id2.dealer_subnet
&& dkg_id1.dkg_tag == dkg_id2.dkg_tag
Expand Down Expand Up @@ -664,9 +664,9 @@ fn add_callback_ids_to_transcript_results(
.collect()
}

// This function is called for each entry on the SubnetCallContext. It returns
// either the created high and low configs for the entry or returns two errors
// identified by the NiDkgId.
/// This function is called for each entry on the SubnetCallContext. It returns
/// either the created high and low configs for the entry or returns two errors
/// identified by the NiDkgId.
fn create_remote_dkg_configs(
start_block_height: Height,
dealer_subnet: SubnetId,
Expand Down
6 changes: 6 additions & 0 deletions rs/consensus/src/dkg/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ pub(super) fn get_dkg_dealings(
}

// TODO: Remove dead_code

/// Starts with the given block and creates a nested mapping from the DKG Id to
/// the node Id to the dealing. This function panics if multiple dealings
/// from one dealer are discovered, hence, we assume a valid block chain.
/// It also excludes dealings for ni_dkg ids, which already have a transcript in the
/// blockchain.
#[allow(dead_code)]
pub(super) fn get_unused_dkg_dealings(
pool_reader: &PoolReader<'_>,
Expand Down

0 comments on commit 7d8edd4

Please sign in to comment.