Skip to content

Commit 05b5c6b

Browse files
committed
Disable TotalStake check in try-runtime
1 parent 92a476e commit 05b5c6b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

pallets/subtensor/src/utils/try_state.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,25 @@ impl<T: Config> Pallet<T> {
1717
pub fn check_accounting_invariants() -> Result<(), sp_runtime::TryRuntimeError> {
1818
use frame_support::traits::fungible::Inspect;
1919

20-
// Calculate the total staked amount
21-
let total_staked = SubnetTAO::<T>::iter().fold(0u64, |acc, (netuid, stake)| {
22-
let acc = acc.saturating_add(stake);
20+
// Disabled: https://github.com/opentensor/subtensor/pull/1166
21+
//
22+
// // Calculate the total staked amount
23+
// let total_staked = SubnetTAO::<T>::iter().fold(0u64, |acc, (netuid, stake)| {
24+
// let acc = acc.saturating_add(stake);
2325

24-
if netuid == Self::get_root_netuid() {
25-
// root network doesn't have initial pool TAO
26-
acc
27-
} else {
28-
acc.saturating_sub(POOL_INITIAL_TAO)
29-
}
30-
});
26+
// if netuid == Self::get_root_netuid() {
27+
// // root network doesn't have initial pool TAO
28+
// acc
29+
// } else {
30+
// acc.saturating_sub(POOL_INITIAL_TAO)
31+
// }
32+
// });
3133

32-
// Verify that the calculated total stake matches the stored TotalStake
33-
ensure!(
34-
total_staked == TotalStake::<T>::get(),
35-
"TotalStake does not match total staked",
36-
);
34+
// // Verify that the calculated total stake matches the stored TotalStake
35+
// ensure!(
36+
// total_staked == TotalStake::<T>::get(),
37+
// "TotalStake does not match total staked",
38+
// );
3739

3840
// Get the total subnet locked amount
3941
let total_subnet_locked = Self::get_total_subnet_locked();
@@ -43,7 +45,7 @@ impl<T: Config> Pallet<T> {
4345

4446
// Calculate the expected total issuance
4547
let expected_total_issuance = currency_issuance
46-
.saturating_add(total_staked)
48+
.saturating_add(TotalStake::<T>::get())
4749
.saturating_add(total_subnet_locked);
4850

4951
// Verify the diff between calculated TI and actual TI is less than delta

0 commit comments

Comments
 (0)