Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Sword-Smith committed Oct 24, 2024
1 parent b0f6c61 commit 21339e6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
6 changes: 4 additions & 2 deletions src/main_loop/proof_upgrader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl UpgradeJob {
}
};

let _new_update_job: UpdateMutatorSetDataJob = {
let new_update_job: UpdateMutatorSetDataJob = {
let mut global_state = global_state_lock.lock_guard_mut().await;
// Did we receive a new block while proving? If so, perform an
// update also, if this was requested (and we have a single proof)
Expand Down Expand Up @@ -245,8 +245,10 @@ impl UpgradeJob {
}
};

let _new_update_job = UpgradeJob::UpdateMutatorSetData(new_update_job);

warn!("We should perform an upgrade now. But that isn't implemented yet");
// TODO: Make recursive call here.
// TODO: Make recursive call here. Or use a proof queue.
}

/// Execute the proof upgrade.
Expand Down
38 changes: 23 additions & 15 deletions src/models/blockchain/block/mutator_set_update.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::bail;
use anyhow::Result;
use num_traits::Zero;
use serde::Deserialize;
use serde::Serialize;

Expand All @@ -24,20 +23,6 @@ impl MutatorSetUpdate {
}
}

/// Return the number of removal records
pub(crate) fn num_removals(&self) -> usize {
self.removals.len()
}

/// Return the number of removal records
pub(crate) fn num_additions(&self) -> usize {
self.additions.len()
}

pub(crate) fn is_empty(&self) -> bool {
self.num_removals().is_zero() && self.num_additions().is_zero()
}

/// Apply a mutator-set-update to a mutator-set-accumulator. Changes the mutator
/// set accumulator according to the provided addition and removal records.
pub fn apply_to_accumulator(&self, ms_accumulator: &mut MutatorSetAccumulator) -> Result<()> {
Expand Down Expand Up @@ -81,3 +66,26 @@ impl MutatorSetUpdate {
Ok(())
}
}

#[cfg(test)]
mod tests {
use num_traits::Zero;

use super::*;

impl MutatorSetUpdate {
/// Return the number of removal records
pub(crate) fn num_removals(&self) -> usize {
self.removals.len()
}

/// Return the number of removal records
pub(crate) fn num_additions(&self) -> usize {
self.additions.len()
}

pub(crate) fn is_empty(&self) -> bool {
self.num_removals().is_zero() && self.num_additions().is_zero()
}
}
}
3 changes: 0 additions & 3 deletions src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ use tokio::sync::mpsc::error::SendError;
use tracing::error;
use tracing::info;
use twenty_first::math::digest::Digest;
use twenty_first::util_types::algebraic_hasher::AlgebraicHasher;

use crate::config_models::network::Network;
use crate::models::blockchain::block::block_header::BlockHeader;
use crate::models::blockchain::block::block_height::BlockHeight;
use crate::models::blockchain::block::block_info::BlockInfo;
use crate::models::blockchain::block::block_selector::BlockSelector;
use crate::models::blockchain::shared::Hash;
use crate::models::blockchain::transaction::transaction_output::UtxoNotificationMedium;
use crate::models::blockchain::type_scripts::neptune_coins::NeptuneCoins;
use crate::models::channel::RPCServerToMain;
Expand All @@ -37,7 +35,6 @@ use crate::models::peer::PeerInfo;
use crate::models::peer::PeerStanding;
use crate::models::proof_abstractions::timestamp::Timestamp;
use crate::models::state::transaction_kernel_id::TransactionKernelId;
use crate::models::state::tx_proving_capability;
use crate::models::state::tx_proving_capability::TxProvingCapability;
use crate::models::state::wallet::address::KeyType;
use crate::models::state::wallet::address::ReceivingAddress;
Expand Down

0 comments on commit 21339e6

Please sign in to comment.