Skip to content

Commit 5f7514a

Browse files
authored
Merge pull request #2163 from opentensor/feat/flow-emissions
Fix DefaultFlowEmaSmoothingFactor (should be i64 normalized)
2 parents 2fdbe92 + b14c8d6 commit 5f7514a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
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.

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
220220
// `spec_version`, and `authoring_version` are the same between Wasm and native.
221221
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
222222
// the compatible custom types.
223-
spec_version: 332,
223+
spec_version: 333,
224224
impl_version: 1,
225225
apis: RUNTIME_API_VERSIONS,
226226
transaction_version: 1,

0 commit comments

Comments
 (0)