Skip to content

Commit 828a824

Browse files
committed
Merge branch 'fix/safe-math' of github.com:opentensor/subtensor into fix/safe-math
2 parents 7c62b8f + ef564ed commit 828a824

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ mod dispatches {
233233
///
234234
#[pallet::call_index(96)]
235235
#[pallet::weight((Weight::from_parts(67_770_000, 0)
236-
.saturating_add(T::DbWeight::get().reads(9_u64))
236+
.saturating_add(T::DbWeight::get().reads(10_u64))
237237
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
238238
pub fn commit_weights(
239239
origin: T::RuntimeOrigin,
@@ -302,7 +302,7 @@ mod dispatches {
302302
///
303303
#[pallet::call_index(100)]
304304
#[pallet::weight((Weight::from_parts(100_500_000, 0)
305-
.saturating_add(T::DbWeight::get().reads(10_u64))
305+
.saturating_add(T::DbWeight::get().reads(11_u64))
306306
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
307307
pub fn batch_commit_weights(
308308
origin: OriginFor<T>,
@@ -457,18 +457,18 @@ mod dispatches {
457457
/// * `TooManyUnrevealedCommits`:
458458
/// - Attempting to commit when the user has more than the allowed limit of unrevealed commits.
459459
///
460-
#[pallet::call_index(99)]
461-
#[pallet::weight((Weight::from_parts(77_750_000, 0)
462-
.saturating_add(T::DbWeight::get().reads(9_u64))
463-
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
464-
pub fn commit_crv3_weights(
465-
origin: T::RuntimeOrigin,
466-
netuid: NetUid,
467-
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
468-
reveal_round: u64,
469-
) -> DispatchResult {
470-
Self::do_commit_timelocked_weights(origin, netuid, commit, reveal_round, 4)
471-
}
460+
// #[pallet::call_index(99)]
461+
// #[pallet::weight((Weight::from_parts(77_750_000, 0)
462+
// .saturating_add(T::DbWeight::get().reads(9_u64))
463+
// .saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
464+
// pub fn commit_crv3_weights(
465+
// origin: T::RuntimeOrigin,
466+
// netuid: NetUid,
467+
// commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
468+
// reveal_round: u64,
469+
// ) -> DispatchResult {
470+
// Self::do_commit_timelocked_weights(origin, netuid, commit, reveal_round, 4)
471+
// }
472472

473473
/// ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed for mechanisms.
474474
///
@@ -1314,8 +1314,8 @@ mod dispatches {
13141314
/// User register a new subnetwork
13151315
#[pallet::call_index(59)]
13161316
#[pallet::weight((Weight::from_parts(235_400_000, 0)
1317-
.saturating_add(T::DbWeight::get().reads(37_u64))
1318-
.saturating_add(T::DbWeight::get().writes(51_u64)), DispatchClass::Normal, Pays::Yes))]
1317+
.saturating_add(T::DbWeight::get().reads(39_u64))
1318+
.saturating_add(T::DbWeight::get().writes(57_u64)), DispatchClass::Normal, Pays::Yes))]
13191319
pub fn register_network(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {
13201320
Self::do_register_network(origin, &hotkey, 1, None)
13211321
}
@@ -1601,8 +1601,8 @@ mod dispatches {
16011601
/// User register a new subnetwork
16021602
#[pallet::call_index(79)]
16031603
#[pallet::weight((Weight::from_parts(234_200_000, 0)
1604-
.saturating_add(T::DbWeight::get().reads(36_u64))
1605-
.saturating_add(T::DbWeight::get().writes(50_u64)), DispatchClass::Normal, Pays::Yes))]
1604+
.saturating_add(T::DbWeight::get().reads(38_u64))
1605+
.saturating_add(T::DbWeight::get().writes(56_u64)), DispatchClass::Normal, Pays::Yes))]
16061606
pub fn register_network_with_identity(
16071607
origin: OriginFor<T>,
16081608
hotkey: T::AccountId,
@@ -2265,7 +2265,7 @@ mod dispatches {
22652265
/// - The client (bittensor-drand) version
22662266
#[pallet::call_index(113)]
22672267
#[pallet::weight((Weight::from_parts(80_690_000, 0)
2268-
.saturating_add(T::DbWeight::get().reads(9_u64))
2268+
.saturating_add(T::DbWeight::get().reads(10_u64))
22692269
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
22702270
pub fn commit_timelocked_weights(
22712271
origin: T::RuntimeOrigin,
@@ -2358,5 +2358,16 @@ mod dispatches {
23582358
commit_reveal_version,
23592359
)
23602360
}
2361+
2362+
/// Remove a subnetwork
2363+
/// The caller must be root
2364+
#[pallet::call_index(120)]
2365+
#[pallet::weight((Weight::from_parts(119_000_000, 0)
2366+
.saturating_add(T::DbWeight::get().reads(6))
2367+
.saturating_add(T::DbWeight::get().writes(31)), DispatchClass::Operational, Pays::No))]
2368+
pub fn root_dissolve_network(origin: OriginFor<T>, netuid: NetUid) -> DispatchResult {
2369+
ensure_root(origin)?;
2370+
Self::do_dissolve_network(netuid)
2371+
}
23612372
}
23622373
}

0 commit comments

Comments
 (0)