Skip to content

Commit

Permalink
Merge branch 'devnet-ready' into feat/sudo_toggle_evm_precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
open-junius committed Jan 10, 2025
2 parents 3d4edcf + 12a0f71 commit 2cc939e
Show file tree
Hide file tree
Showing 78 changed files with 9,372 additions and 10,110 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ members = [
"pallets/admin-utils",
"pallets/collective",
"pallets/registry",
"primitives/*",
"runtime",
"support/tools",
"support/macros",
Expand Down Expand Up @@ -82,6 +83,7 @@ quote = "1"
proc-macro2 = { version = "1", features = ["span-locations"] }
thiserror = "1.0"
walkdir = "2"
approx = "0.5"

subtensor-macros = { path = "support/macros" }

Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fp-rpc = { workspace = true }
fc-mapping-sync = { workspace = true }
fp-consensus = { workspace = true }
thiserror = { workspace = true }
num-traits = { version = "0.2", features = ["std"] }

# Local Dependencies
node-subtensor-runtime = { path = "../runtime" }
Expand Down
3 changes: 3 additions & 0 deletions node/src/chain_spec/localnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,8 @@ fn localnet_genesis(
"senateMembers": {
"members": senate_members,
},
"evmChainId": {
"chainId": 42,
},
})
}
11 changes: 0 additions & 11 deletions pallets/admin-utils/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,6 @@ mod benchmarks {
_(RawOrigin::Root, 1u16/*netuid*/, true/*enabled*/)/*set_commit_reveal_weights_enabled*/;
}

#[benchmark]
fn sudo_set_hotkey_emission_tempo() {
pallet_subtensor::Pallet::<T>::init_new_network(
1u16, /*netuid*/
1u16, /*sudo_tempo*/
);

#[extrinsic_call]
_(RawOrigin::Root, 1u64/*emission_tempo*/)/*set_hotkey_emission_tempo*/;
}

#[benchmark]
fn sudo_set_network_max_stake() {
pallet_subtensor::Pallet::<T>::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/);
Expand Down
82 changes: 34 additions & 48 deletions pallets/admin-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,25 +1000,25 @@ pub mod pallet {
Ok(())
}

/// The extrinsic sets the target stake per interval.
/// It is only callable by the root account.
/// The extrinsic will call the Subtensor pallet to set target stake per interval.
#[pallet::call_index(47)]
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
pub fn sudo_set_target_stakes_per_interval(
origin: OriginFor<T>,
target_stakes_per_interval: u64,
) -> DispatchResult {
ensure_root(origin)?;
pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
target_stakes_per_interval,
);
log::debug!(
"TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
target_stakes_per_interval
);
Ok(())
}
// The extrinsic sets the target stake per interval.
// It is only callable by the root account.
// The extrinsic will call the Subtensor pallet to set target stake per interval.
// #[pallet::call_index(47)]
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
// pub fn sudo_set_target_stakes_per_interval(
// origin: OriginFor<T>,
// target_stakes_per_interval: u64,
// ) -> DispatchResult {
// ensure_root(origin)?;
// pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
// target_stakes_per_interval,
// );
// log::debug!(
// "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
// target_stakes_per_interval
// ); (DEPRECATED)
// Ok(())
// } (DEPRECATED)

/// The extrinsic enabled/disables commit/reaveal for a given subnet.
/// It is only callable by the root account or subnet owner.
Expand Down Expand Up @@ -1083,35 +1083,21 @@ pub mod pallet {
)
}

/// Sets the hotkey emission tempo.
///
/// This extrinsic allows the root account to set the hotkey emission tempo, which determines
/// the number of blocks before a hotkey drains accumulated emissions through to nominator staking accounts.
///
/// # Arguments
/// * `origin` - The origin of the call, which must be the root account.
/// * `emission_tempo` - The new emission tempo value to set.
///
/// # Emits
/// * `Event::HotkeyEmissionTempoSet` - When the hotkey emission tempo is successfully set.
///
/// # Errors
/// * `DispatchError::BadOrigin` - If the origin is not the root account.
// #[pallet::weight(<T as Config>::WeightInfo::sudo_set_hotkey_emission_tempo())]
#[pallet::call_index(52)]
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
pub fn sudo_set_hotkey_emission_tempo(
origin: OriginFor<T>,
emission_tempo: u64,
) -> DispatchResult {
ensure_root(origin)?;
pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
log::debug!(
"HotkeyEmissionTempoSet( emission_tempo: {:?} )",
emission_tempo
);
Ok(())
}
// DEPRECATED
// #[pallet::call_index(52)]
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
// pub fn sudo_set_hotkey_emission_tempo(
// origin: OriginFor<T>,
// emission_tempo: u64,
// ) -> DispatchResult {
// ensure_root(origin)?;
// pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
// log::debug!(
// "HotkeyEmissionTempoSet( emission_tempo: {:?} )",
// emission_tempo
// );
// Ok(())
// }

/// Sets the maximum stake allowed for a specific network.
///
Expand Down
8 changes: 4 additions & 4 deletions pallets/admin-utils/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ parameter_types! {
pub const InitialNetworkLockReductionInterval: u64 = 2; // 2 blocks.
pub const InitialSubnetLimit: u16 = 10; // Max 10 subnets.
pub const InitialNetworkRateLimit: u64 = 0;
pub const InitialTargetStakesPerInterval: u16 = 1;
pub const InitialKeySwapCost: u64 = 1_000_000_000;
pub const InitialAlphaHigh: u16 = 58982; // Represents 0.9 as per the production default
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
pub const InitialHotkeyEmissionTempo: u64 = 1;
// pub const InitialHotkeyEmissionTempo: u64 = 1; // (DEPRECATED)
pub const InitialNetworkMaxStake: u64 = u64::MAX; // Maximum possible value for u64, this make the make stake infinity
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight.
}

impl pallet_subtensor::Config for Test {
Expand Down Expand Up @@ -188,16 +188,16 @@ impl pallet_subtensor::Config for Test {
type InitialNetworkLockReductionInterval = InitialNetworkLockReductionInterval;
type InitialSubnetLimit = InitialSubnetLimit;
type InitialNetworkRateLimit = InitialNetworkRateLimit;
type InitialTargetStakesPerInterval = InitialTargetStakesPerInterval;
type KeySwapCost = InitialKeySwapCost;
type AlphaHigh = InitialAlphaHigh;
type AlphaLow = InitialAlphaLow;
type LiquidAlphaOn = InitialLiquidAlphaOn;
type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo;
// type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo; // (DEPRECATED)
type InitialNetworkMaxStake = InitialNetworkMaxStake;
type Preimages = ();
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
type InitialTaoWeight = InitialTaoWeight;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
Expand Down
Loading

0 comments on commit 2cc939e

Please sign in to comment.