Skip to content

Commit

Permalink
Updated default networks size
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed May 28, 2024
1 parent f95ffc3 commit d0cc915
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
26 changes: 3 additions & 23 deletions src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub fn instantiate(
NETWORK_LAST_LOCK_COST.save(deps.storage, &10_000_000_000)?;
NETWORK_MIN_LOCK_COST.save(deps.storage, &10_000_000_000)?;
NETWORK_LOCK_REDUCTION_INTERVAL.save(deps.storage, &(7 * 14400))?;
TOTAL_REWARDS.save(deps.storage, &0)?;

// -- Root network initialization --
let root_netuid: u16 = 0;
Expand Down Expand Up @@ -155,8 +156,8 @@ pub fn instantiate(
REGISTRATIONS_THIS_INTERVAL.save(deps.storage, netuid, &0)?;
POW_REGISTRATIONS_THIS_INTERVAL.save(deps.storage, netuid, &0)?;
BURN_REGISTRATIONS_THIS_INTERVAL.save(deps.storage, netuid, &0)?;
MAX_ALLOWED_VALIDATORS.save(deps.storage, netuid, &64)?;
MAX_ALLOWED_UIDS.save(deps.storage, netuid, &256)?;
MAX_ALLOWED_VALIDATORS.save(deps.storage, netuid, &32)?;
MAX_ALLOWED_UIDS.save(deps.storage, netuid, &128)?;
WEIGHTS_VERSION_KEY.save(deps.storage, netuid, &0)?;
WEIGHTS_SET_RATE_LIMIT.save(deps.storage, netuid, &100)?;

Expand Down Expand Up @@ -1012,26 +1013,5 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, C
return Err(ContractError::MigrationError {})
}

let metadata_old = METADATA
.range(deps.storage, None, None, Order::Ascending)
.map(|item| {
let i = item.unwrap();
(i.0, i.1)
})
.collect::<Vec<(u16, String)>>();

for item in metadata_old {
// let (uid, particle) = item.unwrap();
let metadata = Metadata {
name: "empty".to_string(),
particle: item.1.to_string(),
description: "".to_string(),
logo: "".to_string(),
types: "".to_string(),
extra: "".to_string(),
};
NETWORKS_METADATA.save(deps.storage, item.0, &metadata)?;
}

Ok(Response::new().add_attribute("action", "migrate"))
}
6 changes: 3 additions & 3 deletions src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ pub fn do_root_register(

// --- 13. Force all members on root to become a delegate.
if !hotkey_is_delegate(deps.storage, &hotkey) {
delegate_hotkey(deps.storage, &hotkey, 11796);
delegate_hotkey(deps.storage, &hotkey, 13107);
}

// --- 14. Update the registration counters for both the block and interval.
Expand Down Expand Up @@ -782,8 +782,8 @@ pub fn init_new_network(

// --- 6. Set all default values **explicitly**.
NETWORK_REGISTRATION_ALLOWED.save(store, netuid, &true)?;
MAX_ALLOWED_UIDS.save(store, netuid, &256)?;
MAX_ALLOWED_VALIDATORS.save(store, netuid, &64)?;
MAX_ALLOWED_UIDS.save(store, netuid, &128)?;
MAX_ALLOWED_VALIDATORS.save(store, netuid, &32)?;
MIN_ALLOWED_WEIGHTS.save(store, netuid, &1)?;
MAX_WEIGHTS_LIMIT.save(store, netuid, &u16::MAX)?;
ADJUSTMENT_INTERVAL.save(store, netuid, &360)?;
Expand Down

0 comments on commit d0cc915

Please sign in to comment.