Skip to content

Commit 0c6868f

Browse files
authored
Merge pull request #2442 from opentensor/testnet
mainnet deploy 2/20/2026
2 parents 860aab9 + a987de9 commit 0c6868f

File tree

120 files changed

+16256
-10896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+16256
-10896
lines changed

Cargo.lock

Lines changed: 243 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pallet-subtensor-swap-runtime-api = { path = "pallets/swap/runtime-api", default
6161
pallet-subtensor-swap-rpc = { path = "pallets/swap/rpc", default-features = false }
6262
procedural-fork = { path = "support/procedural-fork", default-features = false }
6363
safe-math = { path = "primitives/safe-math", default-features = false }
64+
safe-bigmath = { package = "safe-bigmath", default-features = false, git = "https://github.com/sam0x17/safe-bigmath" }
6465
share-pool = { path = "primitives/share-pool", default-features = false }
6566
subtensor-macros = { path = "support/macros", default-features = false }
6667
subtensor-custom-rpc = { default-features = false, path = "pallets/subtensor/rpc" }

chain-extensions/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use pallet_subtensor_proxy as pallet_proxy;
1818
use pallet_subtensor_proxy::WeightInfo;
1919
use sp_runtime::{DispatchError, Weight, traits::StaticLookup};
2020
use sp_std::marker::PhantomData;
21-
use substrate_fixed::types::U96F32;
21+
use substrate_fixed::types::U64F64;
2222
use subtensor_runtime_common::{AlphaCurrency, NetUid, ProxyType, TaoCurrency};
2323
use subtensor_swap_interface::SwapHandler;
2424

@@ -520,7 +520,7 @@ where
520520
netuid.into(),
521521
);
522522

523-
let price = current_alpha_price.saturating_mul(U96F32::from_num(1_000_000_000));
523+
let price = current_alpha_price.saturating_mul(U64F64::from_num(1_000_000_000));
524524
let price: u64 = price.saturating_to_num();
525525

526526
let encoded_result = price.encode();

chain-extensions/src/mock.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use sp_runtime::{
2525
traits::{BlakeTwo256, Convert, IdentityLookup},
2626
};
2727
use sp_std::{cell::RefCell, cmp::Ordering, sync::OnceLock};
28-
use subtensor_runtime_common::{AlphaCurrency, NetUid, TaoCurrency};
28+
use subtensor_runtime_common::{AlphaCurrency, AuthorshipInfo, NetUid, TaoCurrency};
2929

3030
type Block = frame_system::mocking::MockBlock<Test>;
3131

@@ -262,6 +262,14 @@ parameter_types! {
262262
pub const AnnouncementDepositFactor: Balance = 1;
263263
}
264264

265+
pub struct MockAuthorshipProvider;
266+
267+
impl AuthorshipInfo<U256> for MockAuthorshipProvider {
268+
fn author() -> Option<U256> {
269+
Some(U256::from(12345u64))
270+
}
271+
}
272+
265273
parameter_types! {
266274
pub const InitialMinAllowedWeights: u16 = 0;
267275
pub const InitialEmissionValue: u16 = 0;
@@ -325,9 +333,8 @@ parameter_types! {
325333
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
326334
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
327335
pub const InitialYuma3On: bool = false; // Default value for Yuma3On
328-
// pub const InitialNetworkMaxStake: u64 = u64::MAX; // (DEPRECATED)
329-
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
330-
pub const InitialColdkeySwapRescheduleDuration: u64 = 24 * 60 * 60 / 12; // Default as 1 day
336+
pub const InitialColdkeySwapAnnouncementDelay: u64 = 50;
337+
pub const InitialColdkeySwapReannouncementDelay: u64 = 10;
331338
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
332339
pub const InitialTaoWeight: u64 = 0; // 100% global weight.
333340
pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks
@@ -397,8 +404,8 @@ impl pallet_subtensor::Config for Test {
397404
type LiquidAlphaOn = InitialLiquidAlphaOn;
398405
type Yuma3On = InitialYuma3On;
399406
type Preimages = Preimage;
400-
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
401-
type InitialColdkeySwapRescheduleDuration = InitialColdkeySwapRescheduleDuration;
407+
type InitialColdkeySwapAnnouncementDelay = InitialColdkeySwapAnnouncementDelay;
408+
type InitialColdkeySwapReannouncementDelay = InitialColdkeySwapReannouncementDelay;
402409
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
403410
type InitialTaoWeight = InitialTaoWeight;
404411
type InitialEmaPriceHalvingPeriod = InitialEmaPriceHalvingPeriod;
@@ -412,13 +419,13 @@ impl pallet_subtensor::Config for Test {
412419
type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage;
413420
type CommitmentsInterface = CommitmentsI;
414421
type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit;
422+
type AuthorshipProvider = MockAuthorshipProvider;
415423
}
416424

417425
// Swap-related parameter types
418426
parameter_types! {
419427
pub const SwapProtocolId: PalletId = PalletId(*b"ten/swap");
420428
pub const SwapMaxFeeRate: u16 = 10000; // 15.26%
421-
pub const SwapMaxPositions: u32 = 100;
422429
pub const SwapMinimumLiquidity: u64 = 1_000;
423430
pub const SwapMinimumReserve: NonZeroU64 = NonZeroU64::new(100).unwrap();
424431
}
@@ -430,7 +437,6 @@ impl pallet_subtensor_swap::Config for Test {
430437
type TaoReserve = TaoCurrencyReserve<Self>;
431438
type AlphaReserve = AlphaCurrencyReserve<Self>;
432439
type MaxFeeRate = SwapMaxFeeRate;
433-
type MaxPositions = SwapMaxPositions;
434440
type MinimumLiquidity = SwapMinimumLiquidity;
435441
type MinimumReserve = SwapMinimumReserve;
436442
type WeightInfo = ();

chain-extensions/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use pallet_subtensor::DefaultMinStake;
1010
use sp_core::Get;
1111
use sp_core::U256;
1212
use sp_runtime::DispatchError;
13-
use substrate_fixed::types::U96F32;
13+
use substrate_fixed::types::U64F64;
1414
use subtensor_runtime_common::{AlphaCurrency, Currency as CurrencyTrait, NetUid, TaoCurrency};
1515
use subtensor_swap_interface::SwapHandler;
1616

@@ -985,7 +985,7 @@ fn get_alpha_price_returns_encoded_price() {
985985
<pallet_subtensor_swap::Pallet<mock::Test> as SwapHandler>::current_alpha_price(
986986
netuid.into(),
987987
);
988-
let expected_price_scaled = expected_price.saturating_mul(U96F32::from_num(1_000_000_000));
988+
let expected_price_scaled = expected_price.saturating_mul(U64F64::from_num(1_000_000_000));
989989
let expected_price_u64: u64 = expected_price_scaled.saturating_to_num();
990990

991991
let mut env = MockEnv::new(FunctionId::GetAlphaPriceV1, caller, netuid.encode());

common/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ pub trait BalanceOps<AccountId> {
260260
) -> Result<AlphaCurrency, DispatchError>;
261261
}
262262

263+
/// Allows to query the current block author
264+
pub trait AuthorshipInfo<AccountId> {
265+
/// Return the current block author
266+
fn author() -> Option<AccountId>;
267+
}
268+
263269
pub mod time {
264270
use super::*;
265271

0 commit comments

Comments
 (0)