Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed May 17, 2024
1 parent 4e22ce9 commit c838618
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/block_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ use substrate_fixed::types::I110F18;
use substrate_fixed::types::I64F64;
use substrate_fixed::types::I96F32;

#[cfg(test)]
use crate::state::{TOTAL_COLDKEY_STAKE, TOTAL_STAKE};

/// Executes the necessary operations for each block.
pub fn block_step(deps: DepsMut, env: Env, caller: Option<Addr>) -> Result<Response, ContractError> {
if caller.is_some() {
Expand Down
2 changes: 2 additions & 0 deletions src/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use crate::utils::{

#[cfg(test)]
use crate::uids::get_stake_for_uid_and_subnetwork;
#[cfg(test)]
use crate::utils::get_rho;

// Calculates reward consensus values, then updates rank, trust, consensus, incentive, dividend, pruning_score, emission and bonds, and
// returns the emissions for uids/hotkeys in a given `netuid`.
Expand Down
3 changes: 3 additions & 0 deletions src/uids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use crate::state::{
use crate::utils::set_active_for_uid;
use crate::ContractError;

#[cfg(test)]
use crate::state::TOTAL_HOTKEY_STAKE;

pub fn get_subnetwork_n(store: &dyn Storage, netuid: u16) -> u16 {
SUBNETWORK_N.load(store, netuid.clone()).unwrap()
}
Expand Down
5 changes: 5 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ use crate::state::{
};
use crate::uids::get_subnetwork_n;

#[cfg(test)]
use crate::state::{LAST_ADJUSTMENT_BLOCK, POW_REGISTRATIONS_THIS_INTERVAL, BURN_REGISTRATIONS_THIS_INTERVAL,
LAST_MECHANISM_STEP_BLOCK, PENDING_EMISSION,
};

pub fn ensure_subnet_owner_or_root(
store: &dyn Storage,
coldkey: &Addr,
Expand Down

0 comments on commit c838618

Please sign in to comment.