Skip to content

Commit 5d27fc6

Browse files
Update dispatch class and “pays::yes” for extrinsics.
1 parent 032cd5e commit 5d27fc6

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,
@@ -1095,7 +1091,7 @@ pub mod pallet {
10951091
/// # Weight
10961092
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
10971093
#[pallet::call_index(50)]
1098-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1094+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
10991095
pub fn sudo_set_liquid_alpha_enabled(
11001096
origin: OriginFor<T>,
11011097
netuid: NetUid,
@@ -1109,7 +1105,7 @@ pub mod pallet {
11091105

11101106
/// Sets values for liquid alpha
11111107
#[pallet::call_index(51)]
1112-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1108+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11131109
pub fn sudo_set_alpha_values(
11141110
origin: OriginFor<T>,
11151111
netuid: NetUid,
@@ -1288,7 +1284,7 @@ pub mod pallet {
12881284
/// # Weight
12891285
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
12901286
#[pallet::call_index(61)]
1291-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1287+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
12921288
pub fn sudo_set_toggle_transfer(
12931289
origin: OriginFor<T>,
12941290
netuid: NetUid,
@@ -1418,7 +1414,7 @@ pub mod pallet {
14181414
/// # Weight
14191415
/// Weight is handled by the `#[pallet::weight]` attribute.
14201416
#[pallet::call_index(68)]
1421-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1417+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14221418
pub fn sudo_set_alpha_sigmoid_steepness(
14231419
origin: OriginFor<T>,
14241420
netuid: NetUid,
@@ -1453,7 +1449,7 @@ pub mod pallet {
14531449
/// # Weight
14541450
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
14551451
#[pallet::call_index(69)]
1456-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1452+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14571453
pub fn sudo_set_yuma3_enabled(
14581454
origin: OriginFor<T>,
14591455
netuid: NetUid,
@@ -1477,7 +1473,7 @@ pub mod pallet {
14771473
/// # Weight
14781474
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
14791475
#[pallet::call_index(70)]
1480-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1476+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14811477
pub fn sudo_set_bonds_reset_enabled(
14821478
origin: OriginFor<T>,
14831479
netuid: NetUid,
@@ -1522,7 +1518,7 @@ pub mod pallet {
15221518
/// # Rate Limiting
15231519
/// This function is rate-limited to one call per subnet per interval (e.g., one week).
15241520
#[pallet::call_index(67)]
1525-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1521+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15261522
pub fn sudo_set_sn_owner_hotkey(
15271523
origin: OriginFor<T>,
15281524
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
@@ -1987,7 +1987,7 @@ mod dispatches {
19871987
#[pallet::call_index(112)]
19881988
#[pallet::weight((
19891989
Weight::from_parts(26_200_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)),
1990-
DispatchClass::Operational,
1990+
DispatchClass::Normal,
19911991
Pays::Yes
19921992
))]
19931993
pub fn update_symbol(

0 commit comments

Comments
 (0)