Skip to content

Commit

Permalink
Updated block emission
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed Jan 5, 2024
1 parent 544c6c2 commit fbc19ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn instantiate(

SUBNET_LIMIT.save(deps.storage, &16)?;
NETWORK_IMMUNITY_PERIOD.save(deps.storage, &7200)?;
BLOCK_EMISSION.save(deps.storage, &1_000_000_000)?;
BLOCK_EMISSION.save(deps.storage, &4_200_000)?;

SUBNET_OWNER_CUT.save(deps.storage, &0)?;
NETWORK_RATE_LIMIT.save(deps.storage, &0)?;
Expand Down
9 changes: 6 additions & 3 deletions src/tests/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use crate::test_helpers::{
};
use crate::uids::{get_subnetwork_n, get_uid_for_net_and_hotkey, is_hotkey_registered_on_network};
use crate::utils::{
get_pending_emission, get_total_issuance, set_burn, set_difficulty, set_max_allowed_uids,
set_max_registrations_per_block, set_target_registrations_per_interval, set_tempo,
set_weights_set_rate_limit,
do_sudo_set_block_emission, get_pending_emission, get_total_issuance, set_block_emission,
set_burn, set_difficulty, set_max_allowed_uids, set_max_registrations_per_block,
set_target_registrations_per_interval, set_tempo, set_weights_set_rate_limit,
};
use crate::ContractError;

Expand Down Expand Up @@ -212,6 +212,7 @@ fn test_root_register_stake_based_pruning_works() {
#[test]
fn test_root_set_weights() {
let (mut deps, mut env) = instantiate_contract();
set_block_emission(&mut deps.storage, 1_000_000_000);

let n: usize = 10;
let root_netuid: u16 = 0;
Expand Down Expand Up @@ -358,6 +359,7 @@ fn test_root_set_weights() {
#[test]
fn test_root_set_weights_out_of_order_netuids() {
let (mut deps, mut env) = instantiate_contract();
set_block_emission(&mut deps.storage, 1_000_000_000);

let n: usize = 10;
let root_netuid: u16 = 0;
Expand Down Expand Up @@ -655,6 +657,7 @@ fn test_root_subnet_creation_deletion() {
#[test]
fn test_network_pruning() {
let (mut deps, mut env) = instantiate_contract();
set_block_emission(&mut deps.storage, 1_000_000_000);

assert_eq!(get_total_issuance(&deps.storage), 0);

Expand Down
5 changes: 5 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,11 @@ pub fn do_sudo_set_validator_permit_for_uid(
.add_attribute("validator_permit", format!("{}", validator_permit)))
}

#[cfg(test)]
pub fn set_block_emission(store: &mut dyn Storage, emission: u64) {
BLOCK_EMISSION.save(store, &emission).unwrap();
}

pub fn do_sudo_set_block_emission(
deps: DepsMut,
_env: Env,
Expand Down

0 comments on commit fbc19ff

Please sign in to comment.