Skip to content

Commit

Permalink
Merge pull request #2168 from dusk-network/2154-fix-wrong-comments
Browse files Browse the repository at this point in the history
node-data: Fix some comments
  • Loading branch information
fed-franz authored Aug 21, 2024
2 parents 3e7209a + 1fe9742 commit b26d52e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
12 changes: 4 additions & 8 deletions node-data/src/bls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl PublicKey {
}

/// `bytes` returns a reference to the pk.to_bytes() initialized on
/// PublicKey::new call. NB Frequent use of `to_bytes()` creates a
/// noticeable perf overhead.
/// PublicKey::new call. NB: Frequent use of `to_bytes()` creates a
/// noticeable performance overhead.
pub fn bytes(&self) -> &PublicKeyBytes {
&self.as_bytes
}
Expand Down Expand Up @@ -104,7 +104,7 @@ impl std::fmt::Debug for PublicKey {
f.debug_struct("PublicKey").field("bs58", &bs).finish()
}
}
/// a wrapper of 96-sized array
/// A wrapper of 96-sized array
#[derive(Clone, Copy, Eq, Hash, PartialEq, Serialize)]
pub struct PublicKeyBytes(
#[serde(serialize_with = "crate::serialize_b58")] pub [u8; PUBLIC_BLS_SIZE],
Expand Down Expand Up @@ -141,8 +141,6 @@ impl Debug for PublicKeyBytes {
}

/// Loads consensus keys from an encrypted file.
///
/// Panics on any error.
pub fn load_keys(
path: String,
pwd: String,
Expand All @@ -154,8 +152,6 @@ pub fn load_keys(
}

/// Fetches BLS public and secret keys from an encrypted consensus keys file.
///
/// Panics on any error.
fn read_from_file(
path: PathBuf,
pwd: &str,
Expand Down Expand Up @@ -224,7 +220,7 @@ fn decrypt(data: &[u8], pwd: &[u8]) -> Result<Vec<u8>, BlockModeError> {
/// Loads wallet files from $DUSK_WALLET_DIR and returns a vector of all loaded
/// consensus keys.
///
/// It reads RUSK_WALLET_PWD var to unlock wallet files.
/// It reads $DUSK_CONSENSUS_KEYS_PASS var to unlock wallet files.
pub fn load_provisioners_keys(n: usize) -> Vec<(BlsSecretKey, PublicKey)> {
let mut keys = vec![];

Expand Down
4 changes: 2 additions & 2 deletions node-data/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ impl Serializable for Block {

impl Serializable for Transaction {
fn write<W: Write>(&self, w: &mut W) -> io::Result<()> {
//Write version
// Write version
w.write_all(&self.version.to_le_bytes())?;

//Write TxType
// Write TxType
w.write_all(&self.r#type.to_le_bytes())?;

let data = self.inner.to_var_bytes();
Expand Down
4 changes: 2 additions & 2 deletions node-data/src/ledger/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl StepVotes {
}
}

/// a wrapper of 48-sized array to facilitate Signature
/// A wrapper of 48-sized array to facilitate Signature
#[derive(Clone, Copy, Eq, Hash, PartialEq, Serialize)]
pub struct Signature(
#[serde(serialize_with = "crate::serialize_hex")] [u8; 48],
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Default for Signature {
/// generator
pub type IterationInfo = (Attestation, PublicKeyBytes);

/// Defines a set of attestations of any former iterations
/// Defines a set of attestations of former iterations
#[derive(Default, Eq, PartialEq, Clone, Serialize)]
#[serde(transparent)]
pub struct IterationsInfo {
Expand Down
2 changes: 1 addition & 1 deletion node-data/src/ledger/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub mod faker {
use transaction::faker::gen_dummy_tx;

impl<T> Dummy<T> for Block {
/// Creates a block with 3 transactions and random header.
/// Creates a block with 3 transactions and a random header.
fn dummy_with_rng<R: Rng + ?Sized>(_config: &T, rng: &mut R) -> Self {
let txs = vec![
gen_dummy_tx(rng.gen()),
Expand Down
10 changes: 3 additions & 7 deletions node-data/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Message {
Payload::Validation(v) => v.get_step(),
Payload::Ratification(r) => r.get_step(),
Payload::Quorum(_) => {
// This should be removed in future
// TODO: This should be removed in future
StepName::Ratification.to_step(self.header.iteration)
}
_ => StepName::Proposal.to_step(self.header.iteration),
Expand Down Expand Up @@ -353,7 +353,7 @@ pub enum Payload {
GetResource(payload::GetResource),

// Internal messages payload
/// Result message passed from Validation step to Ratification step
// Result message passed from Validation step to Ratification step
ValidationResult(Box<payload::ValidationResult>),

#[default]
Expand Down Expand Up @@ -1074,8 +1074,6 @@ pub enum Topics {
Candidate = 16,
Validation = 17,
Ratification = 18,

// Consensus Quorum loop topics
Quorum = 19,

#[default]
Expand Down Expand Up @@ -1132,9 +1130,7 @@ impl<M: Clone> AsyncQueue<M> {
///
/// `Label` sets a queue label for logging
///
/// Panics
/// Capacity must be a positive number. If cap is zero, this function will
/// panic.
/// Panics if `cap` is zero (Capacity must be a positive number).
pub fn bounded(cap: usize, label: &'static str) -> Self {
let (sender, receiver) = async_channel::bounded(cap);
Self {
Expand Down

0 comments on commit b26d52e

Please sign in to comment.