Skip to content

Commit 74b9f9f

Browse files
committed
merge with devnet ready
2 parents c5e3912 + bf6896f commit 74b9f9f

Some content is hidden

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

45 files changed

+3106
-2642
lines changed

.github/workflows/benchmark-weights.yml

Whitespace-only changes.

Cargo.lock

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

pallets/admin-utils/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,26 @@ pub mod pallet {
12871287
ensure_root(origin)?;
12881288
T::Grandpa::schedule_change(next_authorities, in_blocks, forced)
12891289
}
1290+
1291+
/// Enables or disables Liquid Alpha for a given subnet.
1292+
///
1293+
/// # Parameters
1294+
/// - `origin`: The origin of the call, which must be the root account or subnet owner.
1295+
/// - `netuid`: The unique identifier for the subnet.
1296+
/// - `enabled`: A boolean flag to enable or disable Liquid Alpha.
1297+
///
1298+
/// # Weight
1299+
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
1300+
#[pallet::call_index(61)]
1301+
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1302+
pub fn sudo_set_toggle_transfer(
1303+
origin: OriginFor<T>,
1304+
netuid: u16,
1305+
toggle: bool,
1306+
) -> DispatchResult {
1307+
pallet_subtensor::Pallet::<T>::ensure_subnet_owner_or_root(origin, netuid)?;
1308+
pallet_subtensor::Pallet::<T>::toggle_transfer(netuid, toggle)
1309+
}
12901310
}
12911311
}
12921312

pallets/admin-utils/src/tests/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ parameter_types! {
100100
pub const InitialTxDelegateTakeRateLimit: u64 = 0; // Disable rate limit for testing
101101
pub const InitialTxChildKeyTakeRateLimit: u64 = 0; // Disable rate limit for testing
102102
pub const InitialBurn: u64 = 0;
103-
pub const InitialMinBurn: u64 = 0;
103+
pub const InitialMinBurn: u64 = 500_000;
104104
pub const InitialMaxBurn: u64 = 1_000_000_000;
105105
pub const InitialValidatorPruneLen: u64 = 0;
106106
pub const InitialScalingLawPower: u16 = 50;

pallets/subtensor/src/coinbase/block_emission.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<T: Config> Pallet<T> {
5353
);
5454

5555
// Scale down tao_in
56-
tao_in_emission = alpha_price.saturating_mul(float_alpha_block_emission);
56+
// tao_in_emission = alpha_price.saturating_mul(float_alpha_block_emission);
5757

5858
// Set to max alpha_block_emission
5959
alpha_in_emission = float_alpha_block_emission;

pallets/subtensor/src/coinbase/block_step.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ impl<T: Config + pallet_drand::Config> Pallet<T> {
1616
log::debug!("Block emission: {:?}", block_emission);
1717
// --- 3. Run emission through network.
1818
Self::run_coinbase(block_emission);
19-
2019
// --- 4. Set pending children on the epoch; but only after the coinbase has been run.
2120
Self::try_set_pending_children(block_number);
22-
2321
// Return ok.
2422
Ok(())
2523
}

pallets/subtensor/src/coinbase/root.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl<T: Config> Pallet<T> {
479479
);
480480

481481
// --- 4. Remove the subnet identity if it exists.
482-
if SubnetIdentities::<T>::take(netuid).is_some() {
482+
if SubnetIdentitiesV2::<T>::take(netuid).is_some() {
483483
Self::deposit_event(Event::SubnetIdentityRemoved(netuid));
484484
}
485485

@@ -590,8 +590,8 @@ impl<T: Config> Pallet<T> {
590590
SubnetOwner::<T>::remove(netuid);
591591

592592
// --- 13. Remove subnet identity if it exists.
593-
if SubnetIdentities::<T>::contains_key(netuid) {
594-
SubnetIdentities::<T>::remove(netuid);
593+
if SubnetIdentitiesV2::<T>::contains_key(netuid) {
594+
SubnetIdentitiesV2::<T>::remove(netuid);
595595
Self::deposit_event(Event::SubnetIdentityRemoved(netuid));
596596
}
597597
}
@@ -722,6 +722,14 @@ impl<T: Config> Pallet<T> {
722722
Self::deposit_event(Event::NetworkLockCostReductionIntervalSet(interval));
723723
}
724724
pub fn get_lock_reduction_interval() -> u64 {
725-
NetworkLockReductionInterval::<T>::get()
725+
let interval: I64F64 =
726+
I64F64::saturating_from_num(NetworkLockReductionInterval::<T>::get());
727+
let block_emission: I64F64 =
728+
I64F64::saturating_from_num(Self::get_block_emission().unwrap_or(1_000_000_000));
729+
let halving: I64F64 = block_emission
730+
.checked_div(I64F64::saturating_from_num(1_000_000_000))
731+
.unwrap_or(I64F64::saturating_from_num(0.0));
732+
let halved_interval: I64F64 = interval.saturating_mul(halving);
733+
halved_interval.saturating_to_num::<u64>()
726734
}
727735
}

0 commit comments

Comments
 (0)