File tree Expand file tree Collapse file tree 5 files changed +24
-0
lines changed
bittensor/core/extrinsics Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 44from bittensor .core .errors import MetadataError
55from bittensor .core .extrinsics .asyncex .mev_shield import submit_encrypted_extrinsic
66from bittensor .core .extrinsics .pallets import Commitments , SubtensorModule
7+ from bittensor .core .extrinsics .utils import MEV_HOTKEY_USAGE_WARNING
78from bittensor .core .settings import DEFAULT_MEV_PROTECTION , version_as_int
89from bittensor .core .types import AxonServeCallParams , ExtrinsicResponse
910from bittensor .utils import (
@@ -108,6 +109,7 @@ async def serve_extrinsic(
108109 call = await call_function (** params .as_dict ())
109110
110111 if mev_protection :
112+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
111113 response = await submit_encrypted_extrinsic (
112114 subtensor = subtensor ,
113115 wallet = wallet ,
@@ -291,6 +293,7 @@ async def publish_metadata_extrinsic(
291293 call = await Commitments (subtensor ).set_commitment (netuid = netuid , info = info )
292294
293295 if mev_protection :
296+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
294297 response = await submit_encrypted_extrinsic (
295298 subtensor = subtensor ,
296299 wallet = wallet ,
Original file line number Diff line number Diff line change 66
77from bittensor .core .extrinsics .asyncex .mev_shield import submit_encrypted_extrinsic
88from bittensor .core .extrinsics .pallets import SubtensorModule
9+ from bittensor .core .extrinsics .utils import MEV_HOTKEY_USAGE_WARNING
910from bittensor .core .settings import DEFAULT_MEV_PROTECTION , version_as_int
1011from bittensor .core .types import ExtrinsicResponse , Salt , UIDs , Weights
1112from bittensor .utils import get_mechid_storage_index
@@ -107,6 +108,7 @@ async def commit_timelocked_weights_extrinsic(
107108 )
108109
109110 if mev_protection :
111+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
110112 response = await submit_encrypted_extrinsic (
111113 subtensor = subtensor ,
112114 wallet = wallet ,
@@ -215,6 +217,7 @@ async def commit_weights_extrinsic(
215217 )
216218
217219 if mev_protection :
220+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
218221 response = await submit_encrypted_extrinsic (
219222 subtensor = subtensor ,
220223 wallet = wallet ,
@@ -315,6 +318,7 @@ async def reveal_weights_extrinsic(
315318 )
316319
317320 if mev_protection :
321+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
318322 response = await submit_encrypted_extrinsic (
319323 subtensor = subtensor ,
320324 wallet = wallet ,
@@ -412,6 +416,7 @@ async def set_weights_extrinsic(
412416 )
413417
414418 if mev_protection :
419+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
415420 response = await submit_encrypted_extrinsic (
416421 subtensor = subtensor ,
417422 wallet = wallet ,
Original file line number Diff line number Diff line change 33from bittensor .core .errors import MetadataError
44from bittensor .core .extrinsics .mev_shield import submit_encrypted_extrinsic
55from bittensor .core .extrinsics .pallets import Commitments , SubtensorModule
6+ from bittensor .core .extrinsics .utils import MEV_HOTKEY_USAGE_WARNING
67from bittensor .core .settings import DEFAULT_MEV_PROTECTION , version_as_int
78from bittensor .core .types import AxonServeCallParams , ExtrinsicResponse
89from bittensor .utils import (
@@ -106,6 +107,7 @@ def serve_extrinsic(
106107 call = call_function (** params .as_dict ())
107108
108109 if mev_protection :
110+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
109111 response = submit_encrypted_extrinsic (
110112 subtensor = subtensor ,
111113 wallet = wallet ,
@@ -286,6 +288,7 @@ def publish_metadata_extrinsic(
286288 call = Commitments (subtensor ).set_commitment (netuid = netuid , info = info )
287289
288290 if mev_protection :
291+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
289292 response = submit_encrypted_extrinsic (
290293 subtensor = subtensor ,
291294 wallet = wallet ,
Original file line number Diff line number Diff line change 1010from bittensor .core .types import ExtrinsicResponse
1111from bittensor .utils .balance import Balance
1212
13+
14+ # TODO: Michael/Roman add the link to the docs once it's ready.'
15+ MEV_HOTKEY_USAGE_WARNING = (
16+ "MeV Shield cannot be used with hotkey-signed extrinsics. The transaction will fail because the hotkey cannot pay "
17+ "the required extrinsic deposit fee. If you still want to use the hot key, please top up your balance before making"
18+ " the transaction."
19+ )
20+
1321if TYPE_CHECKING :
1422 from bittensor_wallet import Wallet
1523 from bittensor .core .chain_data import StakeInfo
Original file line number Diff line number Diff line change 66
77from bittensor .core .extrinsics .mev_shield import submit_encrypted_extrinsic
88from bittensor .core .extrinsics .pallets import SubtensorModule
9+ from bittensor .core .extrinsics .utils import MEV_HOTKEY_USAGE_WARNING
910from bittensor .core .settings import DEFAULT_MEV_PROTECTION , version_as_int
1011from bittensor .core .types import ExtrinsicResponse , Salt , UIDs , Weights
1112from bittensor .utils import get_mechid_storage_index
@@ -108,6 +109,7 @@ def commit_timelocked_weights_extrinsic(
108109 )
109110
110111 if mev_protection :
112+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
111113 response = submit_encrypted_extrinsic (
112114 subtensor = subtensor ,
113115 wallet = wallet ,
@@ -216,6 +218,7 @@ def commit_weights_extrinsic(
216218 )
217219
218220 if mev_protection :
221+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
219222 response = submit_encrypted_extrinsic (
220223 subtensor = subtensor ,
221224 wallet = wallet ,
@@ -316,6 +319,7 @@ def reveal_weights_extrinsic(
316319 )
317320
318321 if mev_protection :
322+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
319323 response = submit_encrypted_extrinsic (
320324 subtensor = subtensor ,
321325 wallet = wallet ,
@@ -413,6 +417,7 @@ def set_weights_extrinsic(
413417 )
414418
415419 if mev_protection :
420+ logging .warning (MEV_HOTKEY_USAGE_WARNING )
416421 response = submit_encrypted_extrinsic (
417422 subtensor = subtensor ,
418423 wallet = wallet ,
You can’t perform that action at this time.
0 commit comments