Skip to content

Commit eef3ce6

Browse files
committed
move val prop to outside func
1 parent 8aa5717 commit eef3ce6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ pub struct WeightsTlockPayload {
1818
}
1919

2020
impl<T: Config> Pallet<T> {
21-
pub fn get_root_divs_in_alpha(netuid: u16, alpha_out_emission: I96F32) -> I96F32 {
21+
pub fn get_root_divs_in_alpha(
22+
netuid: u16,
23+
alpha_out_emission: I96F32,
24+
validator_proportion: I96F32,
25+
) -> I96F32 {
2226
// Get total TAO on root.
2327
let total_root_tao: I96F32 = I96F32::from_num(SubnetTAO::<T>::get(0));
2428
// Get total ALPHA on subnet.
@@ -32,7 +36,8 @@ impl<T: Config> Pallet<T> {
3236
// Get root proportion of alpha_out dividends.
3337
let root_divs_in_alpha: I96F32 = root_proportion
3438
.saturating_mul(alpha_out_emission)
35-
.saturating_mul(I96F32::from_num(0.41));
39+
.saturating_mul(validator_proportion); // % of emission that goes to *all* validators.
40+
3641
// Return
3742
root_divs_in_alpha
3843
}
@@ -207,9 +212,14 @@ impl<T: Config> Pallet<T> {
207212
remaining_emission
208213
);
209214

215+
// Validators get 50% of remaining emission.
216+
let validator_proportion: I96F32 = I96F32::from_num(0.5);
210217
// Get proportion of alpha out emission as root divs.
211-
let root_emission_in_alpha: I96F32 =
212-
Self::get_root_divs_in_alpha(*netuid, I96F32::from_num(remaining_emission));
218+
let root_emission_in_alpha: I96F32 = Self::get_root_divs_in_alpha(
219+
*netuid,
220+
I96F32::from_num(remaining_emission),
221+
validator_proportion,
222+
);
213223
// Subtract root divs from alpha divs.
214224
let pending_alpha_emission: I96F32 =
215225
I96F32::from_num(remaining_emission).saturating_sub(root_emission_in_alpha);

0 commit comments

Comments
 (0)