Skip to content

Commit ab5d88b

Browse files
committed
Fix DefaultFlowEmaSmoothingFactor (should be i64 normalized)
1 parent 733f8b3 commit ab5d88b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pallets/subtensor/src/coinbase/subnet_emissions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<T: Config> Pallet<T> {
5959
// EMA flow already initialized
6060
if last_block != current_block {
6161
let flow_alpha = I64F64::saturating_from_num(FlowEmaSmoothingFactor::<T>::get())
62-
.safe_div(I64F64::saturating_from_num(u64::MAX));
62+
.safe_div(I64F64::saturating_from_num(i64::MAX));
6363
let one = I64F64::saturating_from_num(1);
6464
let ema_flow = (one.saturating_sub(flow_alpha))
6565
.saturating_mul(last_block_ema)

pallets/subtensor/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,10 @@ pub mod pallet {
13021302
/// Default value for flow EMA smoothing.
13031303
pub fn DefaultFlowEmaSmoothingFactor<T: Config>() -> u64 {
13041304
// Example values:
1305-
// half-life factor value u64 normalized
1306-
// 216000 (1 month) --> 0.000003209009576 ( 59_195_778_378_555)
1307-
// 50400 (1 week) --> 0.000013752825678 (253_694_855_576_670)
1308-
59_195_778_378_555
1305+
// half-life factor value i64 normalized
1306+
// 216000 (1 month) --> 0.000003209009576 ( 29_597_889_189_277)
1307+
// 50400 (1 week) --> 0.000013752825678 (126_847_427_788_335)
1308+
29_597_889_189_277
13091309
}
13101310
#[pallet::type_value]
13111311
/// Flow EMA smoothing half-life.

0 commit comments

Comments
 (0)