diff --git a/pallets/subtensor/src/macros/genesis.rs b/pallets/subtensor/src/macros/genesis.rs index 4b67c7304..81b582398 100644 --- a/pallets/subtensor/src/macros/genesis.rs +++ b/pallets/subtensor/src/macros/genesis.rs @@ -70,66 +70,66 @@ mod genesis { // Set initial total issuance from balances TotalIssuance::::put(self.balances_issuance); - let tempo = 99; - if self.initialize_network_3 { - init_network::(3, tempo); - } - - let netuid: u16 = 3; - let max_uids = 4096; - - // Set max allowed uids - MaxAllowedUids::::insert(netuid, max_uids); - - let mut next_uid: u16 = 0; - - for (coldkey, hotkeys) in self.stakes.iter() { - for (hotkey, stake_uid) in hotkeys.iter() { - let (stake, uid) = stake_uid; - - // Expand Yuma Consensus with new position. - Rank::::mutate(netuid, |v| v.push(0)); - Trust::::mutate(netuid, |v| v.push(0)); - Active::::mutate(netuid, |v| v.push(true)); - Emission::::mutate(netuid, |v| v.push(0)); - Consensus::::mutate(netuid, |v| v.push(0)); - Incentive::::mutate(netuid, |v| v.push(0)); - Dividends::::mutate(netuid, |v| v.push(0)); - LastUpdate::::mutate(netuid, |v| v.push(0)); - PruningScores::::mutate(netuid, |v| v.push(0)); - ValidatorTrust::::mutate(netuid, |v| v.push(0)); - ValidatorPermit::::mutate(netuid, |v| v.push(false)); + let tempo = 99; - // Insert account information. - Keys::::insert(netuid, uid, hotkey.clone()); // Make hotkey - uid association. - Uids::::insert(netuid, hotkey.clone(), uid); // Make uid - hotkey association. - BlockAtRegistration::::insert(netuid, uid, 0); // Fill block at registration. - IsNetworkMember::::insert(hotkey.clone(), netuid, true); // Fill network is member. - - // Fill stake information. - Owner::::insert(hotkey.clone(), coldkey.clone()); - - TotalHotkeyStake::::insert(hotkey.clone(), stake); - TotalColdkeyStake::::insert( - coldkey.clone(), - TotalColdkeyStake::::get(coldkey).saturating_add(*stake), - ); - - // Update total issuance value - TotalIssuance::::put(TotalIssuance::::get().saturating_add(*stake)); - - Stake::::insert(hotkey.clone(), coldkey.clone(), stake); + init_network::(3, tempo); - next_uid = next_uid.saturating_add(1); + let netuid: u16 = 3; + let max_uids = 4096; + + // Set max allowed uids + MaxAllowedUids::::insert(netuid, max_uids); + + let mut next_uid: u16 = 0; + + for (coldkey, hotkeys) in self.stakes.iter() { + for (hotkey, stake_uid) in hotkeys.iter() { + let (stake, uid) = stake_uid; + + // Expand Yuma Consensus with new position. + Rank::::mutate(netuid, |v| v.push(0)); + Trust::::mutate(netuid, |v| v.push(0)); + Active::::mutate(netuid, |v| v.push(true)); + Emission::::mutate(netuid, |v| v.push(0)); + Consensus::::mutate(netuid, |v| v.push(0)); + Incentive::::mutate(netuid, |v| v.push(0)); + Dividends::::mutate(netuid, |v| v.push(0)); + LastUpdate::::mutate(netuid, |v| v.push(0)); + PruningScores::::mutate(netuid, |v| v.push(0)); + ValidatorTrust::::mutate(netuid, |v| v.push(0)); + ValidatorPermit::::mutate(netuid, |v| v.push(false)); + + // Insert account information. + Keys::::insert(netuid, uid, hotkey.clone()); // Make hotkey - uid association. + Uids::::insert(netuid, hotkey.clone(), uid); // Make uid - hotkey association. + BlockAtRegistration::::insert(netuid, uid, 0); // Fill block at registration. + IsNetworkMember::::insert(hotkey.clone(), netuid, true); // Fill network is member. + + // Fill stake information. + Owner::::insert(hotkey.clone(), coldkey.clone()); + + TotalHotkeyStake::::insert(hotkey.clone(), stake); + TotalColdkeyStake::::insert( + coldkey.clone(), + TotalColdkeyStake::::get(coldkey).saturating_add(*stake), + ); + + // Update total issuance value + TotalIssuance::::put(TotalIssuance::::get().saturating_add(*stake)); + + Stake::::insert(hotkey.clone(), coldkey.clone(), stake); + + next_uid = next_uid.saturating_add(1); + } } - } - // Set correct length for Subnet neurons - SubnetworkN::::insert(netuid, next_uid); + // Set correct length for Subnet neurons + SubnetworkN::::insert(netuid, next_uid); - // --- Increase total network count. - TotalNetworks::::mutate(|n| *n = n.saturating_add(1)); + // --- Increase total network count. + TotalNetworks::::mutate(|n| *n = n.saturating_add(1)); + } // Get the root network uid. let root_netuid: u16 = 0; @@ -140,7 +140,7 @@ mod genesis { // Increment the number of total networks. TotalNetworks::::mutate(|n| *n = n.saturating_add(1)); - // Set the number of validators to 1. + // Set the number of validators to 0. SubnetworkN::::insert(root_netuid, 0); // Set the maximum number to the number of senate members. diff --git a/scripts/localnet.sh b/scripts/localnet.sh index 51e3d05a8..e98575840 100755 --- a/scripts/localnet.sh +++ b/scripts/localnet.sh @@ -15,6 +15,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" # The base directory of the subtensor project BASE_DIR="$SCRIPT_DIR/.." +LOG_DIR="$BASE_DIR/logs" +ALICE_LOG="$LOG_DIR/alice.log" +BOB_LOG="$LOG_DIR/bob.log" + +# Create the log dir if it doesn't exist +mkdir -p "$LOG_DIR" + # get parameters # Get the value of fast_blocks from the first argument fast_blocks=${1:-"True"} @@ -96,8 +103,10 @@ bob_start=( trap 'pkill -P $$' EXIT SIGINT SIGTERM -( - ("${alice_start[@]}" 2>&1) & - ("${bob_start[@]}" 2>&1) - wait -) +# Redirect output to both alice.log and the terminal +("${alice_start[@]}" 2>&1 | tee -a "$ALICE_LOG") & + +# Redirect output to both bob.log and the terminal +("${bob_start[@]}" 2>&1 | tee -a "$BOB_LOG") & + +wait \ No newline at end of file