Skip to content

Commit a227426

Browse files
committed
Fix root claim tests
1 parent dd58577 commit a227426

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

pallets/subtensor/src/tests/claim_root.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
use crate::tests::mock::{
44
RuntimeOrigin, SubtensorModule, Test, add_dynamic_network, new_test_ext, run_to_block,
55
};
6-
use crate::{
7-
DefaultMinRootClaimAmount, Error, MAX_NUM_ROOT_CLAIMS, MAX_ROOT_CLAIM_THRESHOLD, NetworksAdded,
8-
NumRootClaim, NumStakingColdkeys, PendingRootAlphaDivs, RootClaimable, RootClaimableThreshold,
9-
StakingColdkeys, StakingColdkeysByIndex, SubnetAlphaIn, SubnetMechanism, SubnetTAO,
10-
SubtokenEnabled, Tempo, pallet,
11-
};
6+
use crate::*;
127
use crate::{RootClaimType, RootClaimTypeEnum, RootClaimed};
138
use approx::assert_abs_diff_eq;
149
use frame_support::dispatch::RawOrigin;
@@ -763,6 +758,7 @@ fn test_claim_root_with_run_coinbase() {
763758

764759
let root_stake = 200_000_000u64;
765760
SubnetTAO::<Test>::insert(NetUid::ROOT, TaoCurrency::from(root_stake));
761+
SubnetMovingPrice::<Test>::insert(netuid, I96F32::from(2));
766762

767763
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
768764
&hotkey,
@@ -869,6 +865,7 @@ fn test_claim_root_with_block_emissions() {
869865

870866
let root_stake = 200_000_000u64;
871867
SubnetTAO::<Test>::insert(NetUid::ROOT, TaoCurrency::from(root_stake));
868+
SubnetMovingPrice::<Test>::insert(netuid, I96F32::from(2));
872869

873870
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
874871
&hotkey,
@@ -973,6 +970,9 @@ fn test_claim_root_coinbase_distribution() {
973970
let initial_tao = 200_000_000u64;
974971
SubnetTAO::<Test>::insert(NetUid::ROOT, TaoCurrency::from(initial_tao));
975972

973+
// Avoid subsidy mode
974+
SubnetMovingPrice::<Test>::insert(netuid, I96F32::from(2));
975+
976976
SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
977977
&hotkey,
978978
&coldkey,
@@ -996,7 +996,12 @@ fn test_claim_root_coinbase_distribution() {
996996
run_to_block(2);
997997

998998
let alpha_issuance = SubtensorModule::get_alpha_issuance(netuid);
999-
assert_eq!(initial_alpha_issuance + alpha_emissions, alpha_issuance);
999+
1000+
// Both alpha_in and alpha_out are increased, hence multiply emissions by 2 to get total issuance increase
1001+
assert_eq!(
1002+
initial_alpha_issuance + alpha_emissions * AlphaCurrency::from(2),
1003+
alpha_issuance
1004+
);
10001005

10011006
let root_prop = initial_tao as f64 / (u64::from(alpha_issuance) + initial_tao) as f64;
10021007
let root_validators_share = 0.5f64;

0 commit comments

Comments
 (0)