diff --git a/pallets/subtensor/src/benchmarks.rs b/pallets/subtensor/src/benchmarks.rs index a7cd03e652..ecadec3b4e 100644 --- a/pallets/subtensor/src/benchmarks.rs +++ b/pallets/subtensor/src/benchmarks.rs @@ -874,7 +874,7 @@ mod pallet_benchmarks { let amount = 900_000_000_000; let limit: u64 = 6_000_000_000; - let amount_to_be_staked = 440_000_000_000; + let amount_to_be_staked = 44_000_000_000; Subtensor::::add_balance_to_coldkey_account(&coldkey.clone(), amount); let tao_reserve = 150_000_000_000_u64; @@ -1478,11 +1478,43 @@ mod pallet_benchmarks { #[benchmark] fn unstake_all_alpha() { - let coldkey: T::AccountId = whitelisted_caller(); - let hotkey: T::AccountId = account("A", 0, 15); - Subtensor::::create_account_if_non_existent(&coldkey, &hotkey); + let netuid: u16 = 1; + let tempo: u16 = 1; + let seed: u32 = 1; + + Subtensor::::init_new_network(netuid, tempo); + Subtensor::::set_network_registration_allowed(netuid, true); + SubtokenEnabled::::insert(netuid, true); + + Subtensor::::set_max_allowed_uids(netuid, 4096); + assert_eq!(Subtensor::::get_max_allowed_uids(netuid), 4096); + + let coldkey: T::AccountId = account("Test", 0, seed); + let hotkey: T::AccountId = account("Alice", 0, seed); + Subtensor::::set_burn(netuid, 1); + + SubnetTAO::::insert(netuid, 150_000_000_000); + SubnetAlphaIn::::insert(netuid, 100_000_000_000); + + Subtensor::::add_balance_to_coldkey_account(&coldkey.clone(), 1000000u32.into()); + + assert_ok!(Subtensor::::do_burned_registration( + RawOrigin::Signed(coldkey.clone()).into(), + netuid, + hotkey.clone() + )); + + let staked_amt = 100_000_000_000; + Subtensor::::add_balance_to_coldkey_account(&coldkey.clone(), staked_amt); + + assert_ok!(Subtensor::::add_stake( + RawOrigin::Signed(coldkey.clone()).into(), + hotkey.clone(), + netuid, + staked_amt + )); #[extrinsic_call] - _(RawOrigin::Signed(coldkey.clone()), hotkey.clone()); + _(RawOrigin::Signed(coldkey), hotkey); } } diff --git a/scripts/benchmark_action.sh b/scripts/benchmark_action.sh index 34043957de..e3259c69d0 100755 --- a/scripts/benchmark_action.sh +++ b/scripts/benchmark_action.sh @@ -10,6 +10,7 @@ declare -A DISPATCH_PATHS=( [admin_utils]="../pallets/admin-utils/src/lib.rs" [commitments]="../pallets/commitments/src/lib.rs" [drand]="../pallets/drand/src/lib.rs" + [swap]="../pallets/swap/src/pallet/mod.rs" ) # Max allowed drift (%)