Skip to content

Commit 2cc939e

Browse files
committed
Merge branch 'devnet-ready' into feat/sudo_toggle_evm_precompile
2 parents 3d4edcf + 12a0f71 commit 2cc939e

Some content is hidden

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

78 files changed

+9372
-10110
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ members = [
2929
"pallets/admin-utils",
3030
"pallets/collective",
3131
"pallets/registry",
32+
"primitives/*",
3233
"runtime",
3334
"support/tools",
3435
"support/macros",
@@ -82,6 +83,7 @@ quote = "1"
8283
proc-macro2 = { version = "1", features = ["span-locations"] }
8384
thiserror = "1.0"
8485
walkdir = "2"
86+
approx = "0.5"
8587

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

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ fp-rpc = { workspace = true }
103103
fc-mapping-sync = { workspace = true }
104104
fp-consensus = { workspace = true }
105105
thiserror = { workspace = true }
106+
num-traits = { version = "0.2", features = ["std"] }
106107

107108
# Local Dependencies
108109
node-subtensor-runtime = { path = "../runtime" }

node/src/chain_spec/localnet.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,8 @@ fn localnet_genesis(
120120
"senateMembers": {
121121
"members": senate_members,
122122
},
123+
"evmChainId": {
124+
"chainId": 42,
125+
},
123126
})
124127
}

pallets/admin-utils/src/benchmarking.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,6 @@ mod benchmarks {
264264
_(RawOrigin::Root, 1u16/*netuid*/, true/*enabled*/)/*set_commit_reveal_weights_enabled*/;
265265
}
266266

267-
#[benchmark]
268-
fn sudo_set_hotkey_emission_tempo() {
269-
pallet_subtensor::Pallet::<T>::init_new_network(
270-
1u16, /*netuid*/
271-
1u16, /*sudo_tempo*/
272-
);
273-
274-
#[extrinsic_call]
275-
_(RawOrigin::Root, 1u64/*emission_tempo*/)/*set_hotkey_emission_tempo*/;
276-
}
277-
278267
#[benchmark]
279268
fn sudo_set_network_max_stake() {
280269
pallet_subtensor::Pallet::<T>::init_new_network(1u16 /*netuid*/, 1u16 /*tempo*/);

pallets/admin-utils/src/lib.rs

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,25 +1000,25 @@ pub mod pallet {
10001000
Ok(())
10011001
}
10021002

1003-
/// The extrinsic sets the target stake per interval.
1004-
/// It is only callable by the root account.
1005-
/// The extrinsic will call the Subtensor pallet to set target stake per interval.
1006-
#[pallet::call_index(47)]
1007-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1008-
pub fn sudo_set_target_stakes_per_interval(
1009-
origin: OriginFor<T>,
1010-
target_stakes_per_interval: u64,
1011-
) -> DispatchResult {
1012-
ensure_root(origin)?;
1013-
pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
1014-
target_stakes_per_interval,
1015-
);
1016-
log::debug!(
1017-
"TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
1018-
target_stakes_per_interval
1019-
);
1020-
Ok(())
1021-
}
1003+
// The extrinsic sets the target stake per interval.
1004+
// It is only callable by the root account.
1005+
// The extrinsic will call the Subtensor pallet to set target stake per interval.
1006+
// #[pallet::call_index(47)]
1007+
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1008+
// pub fn sudo_set_target_stakes_per_interval(
1009+
// origin: OriginFor<T>,
1010+
// target_stakes_per_interval: u64,
1011+
// ) -> DispatchResult {
1012+
// ensure_root(origin)?;
1013+
// pallet_subtensor::Pallet::<T>::set_target_stakes_per_interval(
1014+
// target_stakes_per_interval,
1015+
// );
1016+
// log::debug!(
1017+
// "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ",
1018+
// target_stakes_per_interval
1019+
// ); (DEPRECATED)
1020+
// Ok(())
1021+
// } (DEPRECATED)
10221022

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

1086-
/// Sets the hotkey emission tempo.
1087-
///
1088-
/// This extrinsic allows the root account to set the hotkey emission tempo, which determines
1089-
/// the number of blocks before a hotkey drains accumulated emissions through to nominator staking accounts.
1090-
///
1091-
/// # Arguments
1092-
/// * `origin` - The origin of the call, which must be the root account.
1093-
/// * `emission_tempo` - The new emission tempo value to set.
1094-
///
1095-
/// # Emits
1096-
/// * `Event::HotkeyEmissionTempoSet` - When the hotkey emission tempo is successfully set.
1097-
///
1098-
/// # Errors
1099-
/// * `DispatchError::BadOrigin` - If the origin is not the root account.
1100-
// #[pallet::weight(<T as Config>::WeightInfo::sudo_set_hotkey_emission_tempo())]
1101-
#[pallet::call_index(52)]
1102-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1103-
pub fn sudo_set_hotkey_emission_tempo(
1104-
origin: OriginFor<T>,
1105-
emission_tempo: u64,
1106-
) -> DispatchResult {
1107-
ensure_root(origin)?;
1108-
pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
1109-
log::debug!(
1110-
"HotkeyEmissionTempoSet( emission_tempo: {:?} )",
1111-
emission_tempo
1112-
);
1113-
Ok(())
1114-
}
1086+
// DEPRECATED
1087+
// #[pallet::call_index(52)]
1088+
// #[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1089+
// pub fn sudo_set_hotkey_emission_tempo(
1090+
// origin: OriginFor<T>,
1091+
// emission_tempo: u64,
1092+
// ) -> DispatchResult {
1093+
// ensure_root(origin)?;
1094+
// pallet_subtensor::Pallet::<T>::set_hotkey_emission_tempo(emission_tempo);
1095+
// log::debug!(
1096+
// "HotkeyEmissionTempoSet( emission_tempo: {:?} )",
1097+
// emission_tempo
1098+
// );
1099+
// Ok(())
1100+
// }
11151101

11161102
/// Sets the maximum stake allowed for a specific network.
11171103
///

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ parameter_types! {
124124
pub const InitialNetworkLockReductionInterval: u64 = 2; // 2 blocks.
125125
pub const InitialSubnetLimit: u16 = 10; // Max 10 subnets.
126126
pub const InitialNetworkRateLimit: u64 = 0;
127-
pub const InitialTargetStakesPerInterval: u16 = 1;
128127
pub const InitialKeySwapCost: u64 = 1_000_000_000;
129128
pub const InitialAlphaHigh: u16 = 58982; // Represents 0.9 as per the production default
130129
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
131130
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
132-
pub const InitialHotkeyEmissionTempo: u64 = 1;
131+
// pub const InitialHotkeyEmissionTempo: u64 = 1; // (DEPRECATED)
133132
pub const InitialNetworkMaxStake: u64 = u64::MAX; // Maximum possible value for u64, this make the make stake infinity
134133
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
135134
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days
135+
pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight.
136136
}
137137

138138
impl pallet_subtensor::Config for Test {
@@ -188,16 +188,16 @@ impl pallet_subtensor::Config for Test {
188188
type InitialNetworkLockReductionInterval = InitialNetworkLockReductionInterval;
189189
type InitialSubnetLimit = InitialSubnetLimit;
190190
type InitialNetworkRateLimit = InitialNetworkRateLimit;
191-
type InitialTargetStakesPerInterval = InitialTargetStakesPerInterval;
192191
type KeySwapCost = InitialKeySwapCost;
193192
type AlphaHigh = InitialAlphaHigh;
194193
type AlphaLow = InitialAlphaLow;
195194
type LiquidAlphaOn = InitialLiquidAlphaOn;
196-
type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo;
195+
// type InitialHotkeyEmissionTempo = InitialHotkeyEmissionTempo; // (DEPRECATED)
197196
type InitialNetworkMaxStake = InitialNetworkMaxStake;
198197
type Preimages = ();
199198
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
200199
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
200+
type InitialTaoWeight = InitialTaoWeight;
201201
}
202202

203203
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]

0 commit comments

Comments
 (0)