File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
pallets/subtensor/src/tests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1901,3 +1901,30 @@ fn test_mining_emission_distribution_validator_valiminer_miner() {
1901
1901
assert_eq ! ( miner_emission, total_emission / 4 ) ;
1902
1902
} ) ;
1903
1903
}
1904
+
1905
+ // Verify staking too low amount is impossible
1906
+ #[ test]
1907
+ fn test_staking_too_little_fails ( ) {
1908
+ new_test_ext ( 1 ) . execute_with ( || {
1909
+ let hotkey_account_id = U256 :: from ( 533453 ) ;
1910
+ let coldkey_account_id = U256 :: from ( 55453 ) ;
1911
+ let amount = 10_000 ;
1912
+
1913
+ //add network
1914
+ let netuid: u16 = add_dynamic_network ( & hotkey_account_id, & coldkey_account_id) ;
1915
+
1916
+ // Give it some $$$ in his coldkey balance
1917
+ SubtensorModule :: add_balance_to_coldkey_account ( & coldkey_account_id, amount) ;
1918
+
1919
+ // Coldkey / hotkey 0 decreases take to 5%. This should fail as the minimum take is 9%
1920
+ assert_err ! (
1921
+ SubtensorModule :: add_stake(
1922
+ RuntimeOrigin :: signed( coldkey_account_id) ,
1923
+ hotkey_account_id,
1924
+ netuid,
1925
+ 1
1926
+ ) ,
1927
+ Error :: <Test >:: AmountTooLow
1928
+ ) ;
1929
+ } ) ;
1930
+ }
You can’t perform that action at this time.
0 commit comments