Skip to content

Commit aa3ec15

Browse files
Update dispatch class and “pays::yes” for extrinsics.
1 parent b2a995b commit aa3ec15

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

pallets/admin-utils/src/lib.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,11 @@ pub mod pallet {
376376
/// It is only callable by the root account or subnet owner.
377377
/// The extrinsic will call the Subtensor pallet to set the adjustment alpha.
378378
#[pallet::call_index(9)]
379-
#[pallet::weight((
379+
#[pallet::weight(
380380
Weight::from_parts(14_000_000, 0)
381381
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1))
382-
.saturating_add(<T as frame_system::Config>::DbWeight::get().reads(1)),
383-
DispatchClass::Operational,
384-
Pays::No
385-
))]
382+
.saturating_add(<T as frame_system::Config>::DbWeight::get().reads(1))
383+
)]
386384
pub fn sudo_set_adjustment_alpha(
387385
origin: OriginFor<T>,
388386
netuid: NetUid,
@@ -602,12 +600,10 @@ pub mod pallet {
602600
/// It is only callable by the root account or subnet owner.
603601
/// The extrinsic will call the Subtensor pallet to set the network PoW registration allowed.
604602
#[pallet::call_index(20)]
605-
#[pallet::weight((
603+
#[pallet::weight(
606604
Weight::from_parts(14_000_000, 0)
607-
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1)),
608-
DispatchClass::Operational,
609-
Pays::No
610-
))]
605+
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1))
606+
)]
611607
pub fn sudo_set_network_pow_registration_allowed(
612608
origin: OriginFor<T>,
613609
netuid: NetUid,
@@ -1130,7 +1126,7 @@ pub mod pallet {
11301126
/// # Weight
11311127
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
11321128
#[pallet::call_index(50)]
1133-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1129+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11341130
pub fn sudo_set_liquid_alpha_enabled(
11351131
origin: OriginFor<T>,
11361132
netuid: NetUid,
@@ -1144,7 +1140,7 @@ pub mod pallet {
11441140

11451141
/// Sets values for liquid alpha
11461142
#[pallet::call_index(51)]
1147-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1143+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11481144
pub fn sudo_set_alpha_values(
11491145
origin: OriginFor<T>,
11501146
netuid: NetUid,
@@ -1379,7 +1375,7 @@ pub mod pallet {
13791375
/// # Weight
13801376
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
13811377
#[pallet::call_index(61)]
1382-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1378+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
13831379
pub fn sudo_set_toggle_transfer(
13841380
origin: OriginFor<T>,
13851381
netuid: NetUid,
@@ -1509,7 +1505,7 @@ pub mod pallet {
15091505
/// # Weight
15101506
/// Weight is handled by the `#[pallet::weight]` attribute.
15111507
#[pallet::call_index(68)]
1512-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1508+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15131509
pub fn sudo_set_alpha_sigmoid_steepness(
15141510
origin: OriginFor<T>,
15151511
netuid: NetUid,
@@ -1544,7 +1540,7 @@ pub mod pallet {
15441540
/// # Weight
15451541
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
15461542
#[pallet::call_index(69)]
1547-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1543+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15481544
pub fn sudo_set_yuma3_enabled(
15491545
origin: OriginFor<T>,
15501546
netuid: NetUid,
@@ -1568,7 +1564,7 @@ pub mod pallet {
15681564
/// # Weight
15691565
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
15701566
#[pallet::call_index(70)]
1571-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1567+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15721568
pub fn sudo_set_bonds_reset_enabled(
15731569
origin: OriginFor<T>,
15741570
netuid: NetUid,
@@ -1613,7 +1609,7 @@ pub mod pallet {
16131609
/// # Rate Limiting
16141610
/// This function is rate-limited to one call per subnet per interval (e.g., one week).
16151611
#[pallet::call_index(67)]
1616-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1612+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
16171613
pub fn sudo_set_sn_owner_hotkey(
16181614
origin: OriginFor<T>,
16191615
netuid: NetUid,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ fn test_set_alpha_values_dispatch_info_ok() {
12271227

12281228
let dispatch_info = call.get_dispatch_info();
12291229

1230-
assert_eq!(dispatch_info.class, DispatchClass::Operational);
1231-
assert_eq!(dispatch_info.pays_fee, Pays::No);
1230+
assert_eq!(dispatch_info.class, DispatchClass::Normal);
1231+
assert_eq!(dispatch_info.pays_fee, Pays::Yes);
12321232
});
12331233
}
12341234

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ mod dispatches {
21572157
#[pallet::call_index(112)]
21582158
#[pallet::weight((
21592159
Weight::from_parts(26_200_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)),
2160-
DispatchClass::Operational,
2160+
DispatchClass::Normal,
21612161
Pays::Yes
21622162
))]
21632163
pub fn update_symbol(

0 commit comments

Comments
 (0)