Skip to content

Commit 2c11a68

Browse files
Update dispatch class and “pays::yes” for extrinsics.
1 parent bf552a3 commit 2c11a68

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
@@ -378,13 +378,11 @@ pub mod pallet {
378378
/// It is only callable by the root account or subnet owner.
379379
/// The extrinsic will call the Subtensor pallet to set the adjustment alpha.
380380
#[pallet::call_index(9)]
381-
#[pallet::weight((
381+
#[pallet::weight(
382382
Weight::from_parts(14_000_000, 0)
383383
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1))
384-
.saturating_add(<T as frame_system::Config>::DbWeight::get().reads(1)),
385-
DispatchClass::Operational,
386-
Pays::No
387-
))]
384+
.saturating_add(<T as frame_system::Config>::DbWeight::get().reads(1))
385+
)]
388386
pub fn sudo_set_adjustment_alpha(
389387
origin: OriginFor<T>,
390388
netuid: NetUid,
@@ -604,12 +602,10 @@ pub mod pallet {
604602
/// It is only callable by the root account or subnet owner.
605603
/// The extrinsic will call the Subtensor pallet to set the network PoW registration allowed.
606604
#[pallet::call_index(20)]
607-
#[pallet::weight((
605+
#[pallet::weight(
608606
Weight::from_parts(14_000_000, 0)
609-
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1)),
610-
DispatchClass::Operational,
611-
Pays::No
612-
))]
607+
.saturating_add(<T as frame_system::Config>::DbWeight::get().writes(1))
608+
)]
613609
pub fn sudo_set_network_pow_registration_allowed(
614610
origin: OriginFor<T>,
615611
netuid: NetUid,
@@ -1132,7 +1128,7 @@ pub mod pallet {
11321128
/// # Weight
11331129
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
11341130
#[pallet::call_index(50)]
1135-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1131+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11361132
pub fn sudo_set_liquid_alpha_enabled(
11371133
origin: OriginFor<T>,
11381134
netuid: NetUid,
@@ -1146,7 +1142,7 @@ pub mod pallet {
11461142

11471143
/// Sets values for liquid alpha
11481144
#[pallet::call_index(51)]
1149-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1145+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11501146
pub fn sudo_set_alpha_values(
11511147
origin: OriginFor<T>,
11521148
netuid: NetUid,
@@ -1385,7 +1381,7 @@ pub mod pallet {
13851381
/// # Weight
13861382
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
13871383
#[pallet::call_index(61)]
1388-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1384+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
13891385
pub fn sudo_set_toggle_transfer(
13901386
origin: OriginFor<T>,
13911387
netuid: NetUid,
@@ -1515,7 +1511,7 @@ pub mod pallet {
15151511
/// # Weight
15161512
/// Weight is handled by the `#[pallet::weight]` attribute.
15171513
#[pallet::call_index(68)]
1518-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1514+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15191515
pub fn sudo_set_alpha_sigmoid_steepness(
15201516
origin: OriginFor<T>,
15211517
netuid: NetUid,
@@ -1550,7 +1546,7 @@ pub mod pallet {
15501546
/// # Weight
15511547
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
15521548
#[pallet::call_index(69)]
1553-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1549+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15541550
pub fn sudo_set_yuma3_enabled(
15551551
origin: OriginFor<T>,
15561552
netuid: NetUid,
@@ -1574,7 +1570,7 @@ pub mod pallet {
15741570
/// # Weight
15751571
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
15761572
#[pallet::call_index(70)]
1577-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1573+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15781574
pub fn sudo_set_bonds_reset_enabled(
15791575
origin: OriginFor<T>,
15801576
netuid: NetUid,
@@ -1619,7 +1615,7 @@ pub mod pallet {
16191615
/// # Rate Limiting
16201616
/// This function is rate-limited to one call per subnet per interval (e.g., one week).
16211617
#[pallet::call_index(67)]
1622-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1618+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
16231619
pub fn sudo_set_sn_owner_hotkey(
16241620
origin: OriginFor<T>,
16251621
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)