subtensor
subtensor copied to clipboard
Running STAO and DTAO concurrently
- change the emission calculation to the following:
sum_tao = sum([p.tao_in for p in pools])
sum_prices = sum([p.price for p in pools])
emission = [p.tao_in/sum_tao for p in pools]
for i, p in enumerate(pools):
if sum_prices > 1.0:
p.inject( tao_in = 0, alpha_in = 1, alpha_out = 1 )
else:
p.inject( tao_in = emission[i], alpha_in = 0, alpha_out = 1 )
Note that the emission is now p.tao_in/sum_tao which is the ratio of TAO in the pool to the total TAO in the pools. This is the exact same calculation for STAO, where the emission for the subnet is tao_in_network/sum_tao_in_networks
TotalSubnetStake and DynamicTAOReserve are the same values in an STAO/DTAO environment
- When we migrate from STAO --> DTAO we will need to unstake everyone
// --- 5. Iterate over all stakes and unstake them if they are in
// this subnet. The subnet is not dynamic so this is all clean unstakes.
SubStake::<T>::iter().for_each(|((cold_i, hot_i, subnet_i), stake_amount_i)| {
if subnet_i == netuid {
// Unstake everyone from this subnet.
Self::decrease_stake_on_coldkey_hotkey_account( cold_i, hot_i, subnet_i, stake_amount_i );
}
});
TotalSubnetStake::<T>::insert( netuid, 0 ); // We have cleared all the stake on this subnet.
- Prices no longer are required except here:
if sum_prices > 1.0:
p.inject( tao_in = 0, alpha_in = 1, alpha_out = 1 )
else:
p.inject( tao_in = emission[i], alpha_in = 0, alpha_out = 1 )
For STAO subnets we just always emit TAO (as if prices were > 1)