Skip to content

Commit

Permalink
Changed all sync extrinsics to use the submit_extrinsics util
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhaleking committed Nov 20, 2024
1 parent 08c4b19 commit 50dbea4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
15 changes: 7 additions & 8 deletions bittensor/core/extrinsics/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
from bittensor.utils import format_error_message, unlock_key
from bittensor.utils.btlogging import logging
from bittensor.utils.networking import ensure_connected
from bittensor.utils.registration import (
create_pow,
torch,
log_no_torch_error,
)
from bittensor.utils.registration import create_pow, torch, log_no_torch_error
from bittensor.core.extrinsics.utils import submit_extrinsic

# For annotation and lazy import purposes
if TYPE_CHECKING:
Expand Down Expand Up @@ -68,8 +65,9 @@ def _do_pow_register(
},
)
extrinsic = self.substrate.create_signed_extrinsic(call=call, keypair=wallet.hotkey)
response = self.substrate.submit_extrinsic(
extrinsic,
response = submit_extrinsic(
substrate=self.substrate,
extrinsic=extrinsic,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
)
Expand Down Expand Up @@ -298,7 +296,8 @@ def _do_burned_register(
extrinsic = self.substrate.create_signed_extrinsic(
call=call, keypair=wallet.coldkey
)
response = self.substrate.submit_extrinsic(
response = submit_extrinsic(
self.substrate,
extrinsic,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
Expand Down
7 changes: 5 additions & 2 deletions bittensor/core/extrinsics/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from numpy.typing import NDArray

from bittensor.core.settings import version_as_int
from bittensor.core.extrinsics.utils import submit_extrinsic
from bittensor.utils import format_error_message, weight_utils, unlock_key
from bittensor.utils.btlogging import logging
from bittensor.utils.networking import ensure_connected
Expand All @@ -31,7 +32,8 @@ def _do_root_register(
extrinsic = self.substrate.create_signed_extrinsic(
call=call, keypair=wallet.coldkey
)
response = self.substrate.submit_extrinsic(
response = submit_extrinsic(
self.substrate,
extrinsic,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
Expand Down Expand Up @@ -154,7 +156,8 @@ def _do_set_root_weights(
keypair=wallet.coldkey,
era={"period": 5},
)
response = self.substrate.submit_extrinsic(
response = submit_extrinsic(
self.substrate,
extrinsic,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
Expand Down
3 changes: 2 additions & 1 deletion bittensor/core/extrinsics/serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def publish_metadata(
)

extrinsic = substrate.create_signed_extrinsic(call=call, keypair=wallet.hotkey)
response = substrate.submit_extrinsic(
response = submit_extrinsic(
substrate,
extrinsic,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
Expand Down
1 change: 1 addition & 0 deletions bittensor/core/extrinsics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def _handler(signum, frame):
try:
# sets a timeout timer for the next call to 120 seconds
# will raise a _SignalTimeoutException if it reaches this point
logging.warning("OKAY BUDDY RETARD")
signal.signal(signal.SIGALRM, _handler)
signal.alarm(120) # two minute timeout

Expand Down

0 comments on commit 50dbea4

Please sign in to comment.