@@ -30,6 +30,7 @@ pub fn migrate_dissolve_sn73<T: Config>() -> Weight {
30
30
// Get the subnet TAO
31
31
let subnet_tao = I96F32 :: from_num ( SubnetTAO :: < T > :: get ( this_netuid) ) ;
32
32
weight = weight. saturating_add ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
33
+ log:: debug!( "Subnet TAO: {}" , subnet_tao) ;
33
34
34
35
let mut total_alpha: I96F32 = I96F32 :: from_num ( 0 ) ;
35
36
// Iterate over every hotkey and sum up the total alpha
@@ -43,26 +44,29 @@ pub fn migrate_dissolve_sn73<T: Config>() -> Weight {
43
44
hotkeys_to_remove. push ( hotkey) ;
44
45
total_alpha = total_alpha. saturating_add ( I96F32 :: from_num ( total_hotkey_alpha) ) ;
45
46
}
47
+ log:: debug!( "Total alpha: {}" , total_alpha) ;
46
48
47
49
// Iterate over every hotkey and distribute the TAO from the pool
48
50
// using previous total alpha as the denominator
49
- for ( hotkey, netuid_i, total_hotkey_alpha_i) in TotalHotkeyAlpha :: < T > :: iter ( ) {
50
- if netuid_i != this_netuid {
51
- continue ;
52
- }
51
+ for hotkey in hotkeys_to_remove. iter ( ) {
52
+ log:: debug!( "Hotkey: {}" , hotkey) ;
53
53
54
+ let total_hotkey_alpha_i = TotalHotkeyAlpha :: < T > :: get ( hotkey. clone ( ) , this_netuid) ;
54
55
let total_hotkey_alpha = I96F32 :: from_num ( total_hotkey_alpha_i) ;
55
56
weight = weight. saturating_add ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
56
57
57
58
// Get the total hotkey shares
58
59
let total_hotkey_shares =
59
60
I96F32 :: from_num ( TotalHotkeyShares :: < T > :: get ( hotkey. clone ( ) , this_netuid) ) ;
60
61
weight = weight. saturating_add ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ;
62
+ log:: debug!( "Total hotkey shares: {}" , total_hotkey_shares) ;
61
63
62
64
// Get the equivalent amount of TAO
63
65
let hotkey_tao: I96F32 = total_hotkey_alpha
64
66
. saturating_div ( total_alpha)
65
67
. saturating_mul ( subnet_tao) ;
68
+ log:: debug!( "Total hotkey alpha: {}" , total_hotkey_alpha) ;
69
+ log:: debug!( "Hotkey TAO: {}" , hotkey_tao) ;
66
70
67
71
let mut coldkeys_to_remove: Vec < T :: AccountId > = Vec :: new ( ) ;
68
72
// Distribute the TAO to each of the stakers to the hotkey
@@ -74,10 +78,13 @@ pub fn migrate_dissolve_sn73<T: Config>() -> Weight {
74
78
75
79
coldkeys_to_remove. push ( coldkey. clone ( ) ) ;
76
80
77
- let alpha = I96F32 :: from_num ( alpha_i) ;
78
- let coldkey_share: I96F32 = alpha . saturating_div ( total_hotkey_shares) ;
81
+ let alpha_shares = I96F32 :: from_num ( alpha_i) ;
82
+ let coldkey_share: I96F32 = alpha_shares . saturating_div ( total_hotkey_shares) ;
79
83
let coldkey_tao = coldkey_share. saturating_mul ( hotkey_tao) ;
80
84
let coldkey_alpha = coldkey_share. saturating_mul ( total_hotkey_alpha) ;
85
+ log:: debug!( "Alpha shares: {}" , alpha_shares) ;
86
+ log:: debug!( "Coldkey share: {}" , coldkey_share) ;
87
+ log:: debug!( "Coldkey TAO: {}" , coldkey_tao) ;
81
88
82
89
// Distribute the TAO to the coldkey
83
90
let as_tao: u64 = coldkey_tao. saturating_to_num :: < u64 > ( ) ;
0 commit comments