-
Notifications
You must be signed in to change notification settings - Fork 244
Global subsidies based on ema prices #2140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // Prices are low => we limit tao issued (buy alpha with it) | ||
| let tao_issued = TaoCurrency::from(((0.1 + 0.2) * emission as f64) as u64); | ||
| assert_abs_diff_eq!( | ||
| TotalIssuance::<Test>::get(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issuance should increase by the full emission, no? We should still be emitting the same amount of TAO. It's just where it goes that is different.
| ); | ||
| if price_i < tao_in_ratio { | ||
| if subsidy_mode { | ||
| tao_in_i = price_i.saturating_mul(U96F32::saturating_from_num(block_emission)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tao_in_i should only be changed for subnets where ALPHA price < TAO emissions (EMA / sum of EMAs), otherwise it would inject more TAO, and would result in more than 1 TAO/block being emitted. The only reason to change the tao_in_i according to the ALPHA price * Block Emission is so that one can calculate how much TAO should be used to swap for ALPHA (to bring the ALPHA price back up).
Here a scenario:
SoS is 0.8 and there is a subnet A that is overpriced, so ALPHA price is 0.5 while TAO emissions are 0.25, the chain would inject 0.5 TAO into the subnet because it looks at
ALPHA price * Block Emission, instead of the 0.25 TAO that he should get based on TAO emissions. Thedifference_tao_inwould clamp to 0 because it would be otherwise negative (tao_in > default_tao_in). Then subnet B has 0.75 TAO emissions but an ALPHA price of 0.3, so the chain would use 0.3 TAO to inject, and 0.45 TAO to swap for ALPHA to push ALPHA price towards TAO emissions (still using 0.75 TAO in total).
Thus subnet A gets 0.5 TAO and subnet B gets 0.75 TAO, so the chain emits 1.25 TAO/block
If one were to use ALPHA prices only as commented at line 38 I think this wouldn't happen, because then there is no discrepancy between ALPHA price and EMA price, as only ALPHA price is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to downscale TAO is if ALPHA needs to be downscaled, so that the injections can maintain the price, while the difference_tao_in is used to swap for ALPHA (increasing the ALPHA price towards TAO emissions), which it doesn't when ALPHA price > TAO emissions
| // Sell root emission through the pool (do not pay fees) | ||
| let subsidized: bool = *is_subsidized.get(netuid_i).unwrap_or(&false); | ||
| if !subsidized { | ||
| if !subsidy_mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could technically stay so that the root proportion on "overpriced" subnets (ALPHA price > TAO emissions) is not countering the SoS to increase at/above 1
| } | ||
| // Insert values into maps | ||
| tao_in.insert(*netuid_i, tao_in_i); | ||
| tao_issued.insert(*netuid_i, default_tao_in_i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented above that wouldn't be true, when ALPHA price > TAO emissions, with the global subsidy, because the tao_in_i (ALPHA price * Block Emission) would be larger than default_tao_in_i (which is based on EMA price).
|
Closing in favor of #2096 fix |
Description
No root sell when EMA prices sum up to lower than 1.0.
Type of Change
Checklist
cargo fmtandcargo clippyto ensure my code is formatted and linted correctly