Skip to content

Commit d6e40f3

Browse files
authored
Merge pull request #1976 from opentensor/change-subnet-owner-extrinsics
Update dispatch class and “pays::yes” for extrinsics.
2 parents dd28ad4 + a2d161d commit d6e40f3

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,
@@ -1113,7 +1109,7 @@ pub mod pallet {
11131109
/// # Weight
11141110
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
11151111
#[pallet::call_index(50)]
1116-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1112+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11171113
pub fn sudo_set_liquid_alpha_enabled(
11181114
origin: OriginFor<T>,
11191115
netuid: NetUid,
@@ -1127,7 +1123,7 @@ pub mod pallet {
11271123

11281124
/// Sets values for liquid alpha
11291125
#[pallet::call_index(51)]
1130-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1126+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
11311127
pub fn sudo_set_alpha_values(
11321128
origin: OriginFor<T>,
11331129
netuid: NetUid,
@@ -1306,7 +1302,7 @@ pub mod pallet {
13061302
/// # Weight
13071303
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
13081304
#[pallet::call_index(61)]
1309-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1305+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
13101306
pub fn sudo_set_toggle_transfer(
13111307
origin: OriginFor<T>,
13121308
netuid: NetUid,
@@ -1436,7 +1432,7 @@ pub mod pallet {
14361432
/// # Weight
14371433
/// Weight is handled by the `#[pallet::weight]` attribute.
14381434
#[pallet::call_index(68)]
1439-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1435+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14401436
pub fn sudo_set_alpha_sigmoid_steepness(
14411437
origin: OriginFor<T>,
14421438
netuid: NetUid,
@@ -1471,7 +1467,7 @@ pub mod pallet {
14711467
/// # Weight
14721468
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
14731469
#[pallet::call_index(69)]
1474-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1470+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14751471
pub fn sudo_set_yuma3_enabled(
14761472
origin: OriginFor<T>,
14771473
netuid: NetUid,
@@ -1495,7 +1491,7 @@ pub mod pallet {
14951491
/// # Weight
14961492
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
14971493
#[pallet::call_index(70)]
1498-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1494+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
14991495
pub fn sudo_set_bonds_reset_enabled(
15001496
origin: OriginFor<T>,
15011497
netuid: NetUid,
@@ -1540,7 +1536,7 @@ pub mod pallet {
15401536
/// # Rate Limiting
15411537
/// This function is rate-limited to one call per subnet per interval (e.g., one week).
15421538
#[pallet::call_index(67)]
1543-
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1539+
#[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights
15441540
pub fn sudo_set_sn_owner_hotkey(
15451541
origin: OriginFor<T>,
15461542
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)