From 8383fce7ce1f9fddd7010dd2b5e0c66b009a1c16 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Mon, 16 Dec 2024 18:34:02 +0200 Subject: [PATCH] Remove process_events() calls if they precede `is_success` (which processes the events anyway) --- bittensor/core/async_subtensor.py | 1 - bittensor/core/extrinsics/async_registration.py | 1 - bittensor/core/extrinsics/async_root.py | 1 - bittensor/core/extrinsics/async_transfer.py | 1 - bittensor/core/extrinsics/async_weights.py | 2 -- bittensor/core/extrinsics/commit_reveal.py | 1 - bittensor/core/extrinsics/staking.py | 1 - bittensor/core/extrinsics/unstaking.py | 1 - 8 files changed, 9 deletions(-) diff --git a/bittensor/core/async_subtensor.py b/bittensor/core/async_subtensor.py index 002c724eac..0e2e80bbad 100644 --- a/bittensor/core/async_subtensor.py +++ b/bittensor/core/async_subtensor.py @@ -1416,7 +1416,6 @@ async def sign_and_send_extrinsic( # We only wait here if we expect finalization. if not wait_for_finalization and not wait_for_inclusion: return True, "" - await response.process_events() if await response.is_success: return True, "" else: diff --git a/bittensor/core/extrinsics/async_registration.py b/bittensor/core/extrinsics/async_registration.py index d5fe719bb4..05ba181a5e 100644 --- a/bittensor/core/extrinsics/async_registration.py +++ b/bittensor/core/extrinsics/async_registration.py @@ -83,7 +83,6 @@ async def _do_pow_register( return True, None # process if registration successful, try again if pow is still valid - await response.process_events() if not await response.is_success: return False, format_error_message(error_message=await response.error_message) # Successful registration diff --git a/bittensor/core/extrinsics/async_root.py b/bittensor/core/extrinsics/async_root.py index 0d23de2e5e..2c514ea077 100644 --- a/bittensor/core/extrinsics/async_root.py +++ b/bittensor/core/extrinsics/async_root.py @@ -167,7 +167,6 @@ async def _do_set_root_weights( if not wait_for_finalization and not wait_for_inclusion: return True, "Not waiting for finalization or inclusion." - await response.process_events() if await response.is_success: return True, "Successfully set weights." else: diff --git a/bittensor/core/extrinsics/async_transfer.py b/bittensor/core/extrinsics/async_transfer.py index db9dd30d7f..b6b546c5a6 100644 --- a/bittensor/core/extrinsics/async_transfer.py +++ b/bittensor/core/extrinsics/async_transfer.py @@ -56,7 +56,6 @@ async def _do_transfer( return True, "", "Success, extrinsic submitted without waiting." # Otherwise continue with finalization. - await response.process_events() if await response.is_success: block_hash_ = response.block_hash return True, block_hash_, "Success with response." diff --git a/bittensor/core/extrinsics/async_weights.py b/bittensor/core/extrinsics/async_weights.py index 572266c3f6..9356761a6a 100644 --- a/bittensor/core/extrinsics/async_weights.py +++ b/bittensor/core/extrinsics/async_weights.py @@ -73,7 +73,6 @@ async def _do_set_weights( if not wait_for_finalization and not wait_for_inclusion: return True, "Not waiting for finalization or inclusion." - await response.process_events() if await response.is_success: return True, "Successfully set weights." else: @@ -194,7 +193,6 @@ async def _do_commit_weights( if not wait_for_finalization and not wait_for_inclusion: return True, None - await response.process_events() if await response.is_success: return True, None else: diff --git a/bittensor/core/extrinsics/commit_reveal.py b/bittensor/core/extrinsics/commit_reveal.py index c72c7dd531..82d2d981f7 100644 --- a/bittensor/core/extrinsics/commit_reveal.py +++ b/bittensor/core/extrinsics/commit_reveal.py @@ -68,7 +68,6 @@ def _do_commit_reveal_v3( if not wait_for_finalization and not wait_for_inclusion: return True, "Not waiting for finalization or inclusion." - response.process_events() if response.is_success: return True, None else: diff --git a/bittensor/core/extrinsics/staking.py b/bittensor/core/extrinsics/staking.py index b12076497b..6162693c81 100644 --- a/bittensor/core/extrinsics/staking.py +++ b/bittensor/core/extrinsics/staking.py @@ -53,7 +53,6 @@ def _do_stake( if not wait_for_finalization and not wait_for_inclusion: return True - response.process_events() if response.is_success: return True else: diff --git a/bittensor/core/extrinsics/unstaking.py b/bittensor/core/extrinsics/unstaking.py index de0377493c..1dea45cae3 100644 --- a/bittensor/core/extrinsics/unstaking.py +++ b/bittensor/core/extrinsics/unstaking.py @@ -52,7 +52,6 @@ def _do_unstake( if not wait_for_finalization and not wait_for_inclusion: return True - response.process_events() if response.is_success: return True else: