Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
06032d5
Merge pull request #2769 from opentensor/testnet
sam0x17 Jun 25, 2026
14cd19c
reduce balancer exp precision from 1024 to 512
gztensor Jun 26, 2026
bc5c024
reduce balancer exp precision from 512 to 128
gztensor Jun 26, 2026
503170f
Increase fuzzy test output frequency
gztensor Jun 26, 2026
98151ec
cap exp_scaled at 1, set balancer exp precision to 256
gztensor Jun 26, 2026
593de8a
Forbid swaps that are too large compared to available liauidity
gztensor Jun 26, 2026
536c893
spec bump
gztensor Jun 26, 2026
c4c77a2
chore: auditor auto-fix
Jun 26, 2026
8bc8ef6
Merge branch 'fix/balancer-performance' of github.com:opentensor/subt…
gztensor Jun 26, 2026
566fb8c
Update pallets/swap/src/pallet/balancer.rs
gztensor Jun 26, 2026
d005de3
fix tests
gztensor Jun 26, 2026
132b9cc
Fix tests, enforce atomic add-stake recycle/burn operations by rollin…
gztensor Jun 26, 2026
1ad1688
Apply the 1000x swap input cap to simulations and limit-path max-amou…
gztensor Jun 26, 2026
bb51677
Merge pull request #2803 from opentensor/fix/balancer-performance
sam0x17 Jun 26, 2026
156eeca
Allow locked alpha transfers in coldkey swaps
gztensor Jun 29, 2026
34e1def
Merge pull request #2810 from opentensor/fix/coldkey-swap-locked-alpha
sam0x17 Jun 29, 2026
b749a63
Apply dispatch extension conditionally
l0r1s Jun 29, 2026
ebe1ac6
Apply subtensor extension conditionally
l0r1s Jun 29, 2026
6d81084
Merge pull request #2812 from opentensor/conditional-ext
sam0x17 Jun 29, 2026
9759f67
Add eco-tests protecting Mentat indexer storage reads
yeuyeuh Jun 29, 2026
f77dcce
Add AlphaV2 presence test
gztensor Jun 30, 2026
9d49f17
Remove Alpha and AlphaV2 presence test from mentat eco
gztensor Jun 30, 2026
d340436
Enforce conviction, add test, bump spec
gztensor Jun 26, 2026
bb3591e
remove root prop from emission calculation
JohnReedV Jun 30, 2026
3b94406
test_get_shares_ignores_root_prop
JohnReedV Jun 30, 2026
6506ac6
bump spec
JohnReedV Jun 30, 2026
14bc6f9
Merge pull request #2800 from opentensor/feat/enforce-conviction
sam0x17 Jun 30, 2026
5c1c7ff
Update eco-tests/src/mock.rs
gztensor Jul 1, 2026
71044fd
Update eco-tests/src/mock.rs
gztensor Jul 1, 2026
026b8f3
Fix AI fix
gztensor Jul 1, 2026
06be4f7
clean merge
gztensor Jul 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions chain-extensions/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1297,15 +1297,26 @@ fn add_stake_recycle_rollback_on_recycle_failure() {

let netuid = mock::add_dynamic_network(&owner_hotkey, &owner_coldkey);

// Set up very low reserves so recycle will fail with InsufficientLiquidity
mock::register_ok_neuron(netuid, hotkey, coldkey, 0);
pallet_subtensor::Pallet::<mock::Test>::insert_lock_state(
&coldkey,
netuid,
&hotkey,
pallet_subtensor::staking::lock::LockState {
locked_mass: AlphaBalance::from(u64::MAX / 4),
conviction: U64F64::saturating_from_num(0),
last_update: pallet_subtensor::Pallet::<mock::Test>::get_current_block_as_u64(),
},
);

// Leave enough input-side liquidity for add_stake to pass the 1000x swap input cap.
// The lock above makes the recycle leg fail, exercising atomic rollback.
mock::setup_reserves(
netuid,
TaoBalance::from(1_000_u64),
TaoBalance::from(tao_amount_raw / 1000 + 1),
AlphaBalance::from(1_000_u64),
);

mock::register_ok_neuron(netuid, hotkey, coldkey, 0);

add_balance_to_coldkey_account(
&coldkey,
TaoBalance::from(tao_amount_raw.saturating_add(1_000_000_000)),
Expand Down Expand Up @@ -1368,15 +1379,26 @@ fn add_stake_burn_rollback_on_burn_failure() {

let netuid = mock::add_dynamic_network(&owner_hotkey, &owner_coldkey);

// Set up very low reserves so burn will fail with InsufficientLiquidity
mock::register_ok_neuron(netuid, hotkey, coldkey, 0);
pallet_subtensor::Pallet::<mock::Test>::insert_lock_state(
&coldkey,
netuid,
&hotkey,
pallet_subtensor::staking::lock::LockState {
locked_mass: AlphaBalance::from(u64::MAX / 4),
conviction: U64F64::saturating_from_num(0),
last_update: pallet_subtensor::Pallet::<mock::Test>::get_current_block_as_u64(),
},
);

// Leave enough input-side liquidity for add_stake to pass the 1000x swap input cap.
// The lock above makes the burn leg fail, exercising atomic rollback.
mock::setup_reserves(
netuid,
TaoBalance::from(1_000_u64),
TaoBalance::from(tao_amount_raw / 1000 + 1),
AlphaBalance::from(1_000_u64),
);

mock::register_ok_neuron(netuid, hotkey, coldkey, 0);

add_balance_to_coldkey_account(
&coldkey,
TaoBalance::from(tao_amount_raw.saturating_add(1_000_000_000)),
Expand Down
3 changes: 3 additions & 0 deletions eco-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ mod tests;

#[cfg(test)]
mod tests_taocom_indexer;

#[cfg(test)]
mod tests_mentat_indexer;
38 changes: 36 additions & 2 deletions eco-tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,19 @@ pub fn add_balance_to_coldkey_account(coldkey: &U256, tao: TaoBalance) {
mod api_mocks {
use codec::Compact;
use pallet_subtensor::rpc_info::delegate_info::DelegateInfo;
use pallet_subtensor::rpc_info::dynamic_info::DynamicInfo;
use pallet_subtensor::rpc_info::metagraph::{Metagraph, SelectiveMetagraph};
use pallet_subtensor::rpc_info::show_subnet::SubnetState;
use pallet_subtensor::rpc_info::stake_info::StakeInfo;
use pallet_subtensor::rpc_info::subnet_info::{
SubnetHyperparams, SubnetHyperparamsV2, SubnetHyperparamsV3, SubnetInfo, SubnetInfov2,
};
use pallet_subtensor_swap_runtime_api::{SimSwapResult, SubnetPrice, SwapRuntimeApi};
use sp_runtime::AccountId32;
use subtensor_custom_rpc_runtime_api::{DelegateInfoRuntimeApi, StakeInfoRuntimeApi};
use subtensor_runtime_common::{AlphaBalance, NetUid, TaoBalance};
use subtensor_custom_rpc_runtime_api::{
DelegateInfoRuntimeApi, StakeInfoRuntimeApi, SubnetInfoRuntimeApi,
};
use subtensor_runtime_common::{AlphaBalance, MechId, NetUid, TaoBalance};

use super::Block;

Expand Down Expand Up @@ -660,6 +668,32 @@ mod api_mocks {
}
}

impl SubnetInfoRuntimeApi<Block> for MockApi {
fn get_subnet_info(_netuid: NetUid) -> Option<SubnetInfo<AccountId32>> { None }
fn get_subnets_info() -> Vec<Option<SubnetInfo<AccountId32>>> { Vec::new() }
fn get_subnet_info_v2(_netuid: NetUid) -> Option<SubnetInfov2<AccountId32>> { None }
fn get_subnets_info_v2() -> Vec<Option<SubnetInfov2<AccountId32>>> { Vec::new() }
#[allow(deprecated)]
fn get_subnet_hyperparams(_netuid: NetUid) -> Option<SubnetHyperparams> { None }
#[allow(deprecated)]
fn get_subnet_hyperparams_v2(_netuid: NetUid) -> Option<SubnetHyperparamsV2> { None }
fn get_subnet_hyperparams_v3(_netuid: NetUid) -> Option<SubnetHyperparamsV3> { None }
fn get_all_dynamic_info() -> Vec<Option<DynamicInfo<AccountId32>>> { Vec::new() }
fn get_all_metagraphs() -> Vec<Option<Metagraph<AccountId32>>> { Vec::new() }
fn get_metagraph(_netuid: NetUid) -> Option<Metagraph<AccountId32>> { None }
fn get_all_mechagraphs() -> Vec<Option<Metagraph<AccountId32>>> { Vec::new() }
fn get_mechagraph(_netuid: NetUid, _mecid: MechId) -> Option<Metagraph<AccountId32>> { None }
fn get_dynamic_info(_netuid: NetUid) -> Option<DynamicInfo<AccountId32>> { None }
fn get_subnet_state(_netuid: NetUid) -> Option<SubnetState<AccountId32>> { None }
fn get_selective_metagraph(_netuid: NetUid, _metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>> { None }
fn get_coldkey_auto_stake_hotkey(_coldkey: AccountId32, _netuid: NetUid) -> Option<AccountId32> { None }
fn get_selective_mechagraph(_netuid: NetUid, _subid: MechId, _metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>> { None }
fn get_subnet_to_prune() -> Option<NetUid> { None }
fn get_subnet_account_id(_netuid: NetUid) -> Option<AccountId32> { None }
fn get_next_epoch_start_block(_netuid: NetUid) -> Option<u64> { None }
Comment thread
gztensor marked this conversation as resolved.
Comment thread
gztensor marked this conversation as resolved.
Comment thread
gztensor marked this conversation as resolved.
Comment thread
gztensor marked this conversation as resolved.
fn get_block_emission() -> TaoBalance { TaoBalance::from(0u64) }
}

impl SwapRuntimeApi<Block> for MockApi {
fn current_alpha_price(_netuid: NetUid) -> u64 { 0 }
fn current_alpha_price_all() -> Vec<SubnetPrice> { Vec::new() }
Expand Down
Loading
Loading