diff --git a/README.md b/README.md index e3d8d38a..a6ba1ea7 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ The default location of the config file is: `~/.bittensor/config.yml`. An exampl network: local use_cache: true dashboard_path: null -disk_cache: false +disk_cache: true rate_tolerance: null safe_staking: true wallet_hotkey: default diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index f431c261..a8344756 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -797,7 +797,7 @@ def __init__(self): "wallet_hotkey": None, "network": None, "use_cache": True, - "disk_cache": False, + "disk_cache": True, "rate_tolerance": None, "safe_staking": True, "allow_partial_stake": False, @@ -1431,7 +1431,7 @@ def initialize_chain( "Verify this is intended.", ) if not self.subtensor: - use_disk_cache = self.config.get("disk_cache", False) + use_disk_cache = self.config.get("disk_cache", True) if network: network_ = None for item in network: diff --git a/bittensor_cli/src/bittensor/subtensor_interface.py b/bittensor_cli/src/bittensor/subtensor_interface.py index bb249be2..57b4a627 100644 --- a/bittensor_cli/src/bittensor/subtensor_interface.py +++ b/bittensor_cli/src/bittensor/subtensor_interface.py @@ -82,7 +82,7 @@ class SubtensorInterface: Thin layer for interacting with Substrate Interface. Mostly a collection of frequently-used calls. """ - def __init__(self, network, use_disk_cache: bool = False): + def __init__(self, network, use_disk_cache: bool = True): if network in Constants.network_map: self.chain_endpoint = Constants.network_map[network] self.network = network @@ -114,7 +114,7 @@ def __init__(self, network, use_disk_cache: bool = False): self.network = defaults.subtensor.network substrate_class = ( DiskCachedAsyncSubstrateInterface - if (use_disk_cache or os.getenv("DISK_CACHE", "0") == "1") + if (use_disk_cache or os.getenv("DISK_CACHE", "1") == "1") else AsyncSubstrateInterface ) self.substrate = substrate_class( @@ -443,11 +443,11 @@ async def get_total_stake_for_coldkey( :return: {address: Balance objects} """ - sub_stakes = await self.get_stake_for_coldkeys( - list(ss58_addresses), block_hash=block_hash + sub_stakes, dynamic_info = await asyncio.gather( + self.get_stake_for_coldkeys(list(ss58_addresses), block_hash=block_hash), + # Token pricing info + self.all_subnets(block_hash=block_hash), ) - # Token pricing info - dynamic_info = await self.all_subnets() results = {} for ss58, stake_info_list in sub_stakes.items(): diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index 216d7bf1..1b15ff2c 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -702,7 +702,6 @@ async def wallet_balance( str(total_free_balance + total_staked_balance), ) console.print(Padding(table, (0, 0, 0, 4))) - await subtensor.substrate.close() if json_output: output_balances = { key: { @@ -2188,7 +2187,10 @@ async def find_coldkey_swap_extrinsic( ): console.print("Querying archive node for coldkey swap events...") await subtensor.substrate.close() - subtensor = SubtensorInterface("archive") + subtensor.substrate.chain_endpoint = Constants.archive_entrypoint + subtensor.substrate.url = Constants.archive_entrypoint + subtensor.substrate.initialized = False + await subtensor.substrate.initialize() block_hashes = await asyncio.gather( *[ diff --git a/pyproject.toml b/pyproject.toml index 3ec9af78..767c365c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] dependencies = [ "wheel", - "async-substrate-interface>=1.5.14", + "async-substrate-interface>=1.6.0", "aiohttp~=3.13", "backoff~=2.2.1", "bittensor-drand>=1.2.0",