Skip to content

Commit 32b0658

Browse files
authored
Merge pull request #1740 from opentensor/fix/build-netuid
fix build due to set bond reset ext missing NetUid
2 parents 1100804 + de7c10d commit 32b0658

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

pallets/admin-utils/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub mod pallet {
8888
/// Event emitted when Bonds Reset is toggled.
8989
BondsResetToggled {
9090
/// The network identifier.
91-
netuid: u16,
91+
netuid: NetUid,
9292
/// Indicates if the Bonds Reset was enabled or disabled.
9393
enabled: bool,
9494
},
@@ -1625,7 +1625,7 @@ pub mod pallet {
16251625
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
16261626
pub fn sudo_set_bonds_reset_enabled(
16271627
origin: OriginFor<T>,
1628-
netuid: u16,
1628+
netuid: NetUid,
16291629
enabled: bool,
16301630
) -> DispatchResult {
16311631
pallet_subtensor::Pallet::<T>::ensure_subnet_owner_or_root(origin, netuid)?;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ fn test_set_sn_owner_hotkey_root() {
17851785
#[test]
17861786
fn test_sudo_set_bonds_reset_enabled() {
17871787
new_test_ext().execute_with(|| {
1788-
let netuid: u16 = 1;
1788+
let netuid = NetUid::from(1);
17891789
let to_be_set: bool = true;
17901790
let sn_owner = U256::from(1);
17911791
add_network(netuid, 10);
@@ -1822,7 +1822,7 @@ fn test_sudo_set_bonds_reset_enabled() {
18221822
#[test]
18231823
fn test_sudo_set_yuma3_enabled() {
18241824
new_test_ext().execute_with(|| {
1825-
let netuid: u16 = 1;
1825+
let netuid = NetUid::from(1);
18261826
let to_be_set: bool = true;
18271827
let sn_owner = U256::from(1);
18281828
add_network(netuid, 10);

precompiles/src/subnet.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,9 @@ where
621621
#[precompile::public("getBondsResetEnabled(uint16)")]
622622
#[precompile::view]
623623
fn get_bonds_reset_enabled(_: &mut impl PrecompileHandle, netuid: u16) -> EvmResult<bool> {
624-
Ok(pallet_subtensor::BondsResetOn::<R>::get(netuid))
624+
Ok(pallet_subtensor::BondsResetOn::<R>::get(NetUid::from(
625+
netuid,
626+
)))
625627
}
626628

627629
#[precompile::public("setYuma3Enabled(uint16,bool)")]
@@ -649,7 +651,10 @@ where
649651
netuid: u16,
650652
enabled: bool,
651653
) -> EvmResult<()> {
652-
let call = pallet_admin_utils::Call::<R>::sudo_set_bonds_reset_enabled { netuid, enabled };
654+
let call = pallet_admin_utils::Call::<R>::sudo_set_bonds_reset_enabled {
655+
netuid: netuid.into(),
656+
enabled,
657+
};
653658

654659
handle.try_dispatch_runtime_call::<R, _>(
655660
call,

0 commit comments

Comments
 (0)