Skip to content

Commit baaddf9

Browse files
authored
Merge pull request #3204 from opentensor/feat/roman/add-warning-for-mev-hk-usage
[v10] Add warning about MeV HK usage
2 parents 60871cd + 22b591a commit baaddf9

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

bittensor/core/extrinsics/asyncex/serving.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from bittensor.core.errors import MetadataError
55
from bittensor.core.extrinsics.asyncex.mev_shield import submit_encrypted_extrinsic
66
from bittensor.core.extrinsics.pallets import Commitments, SubtensorModule
7+
from bittensor.core.extrinsics.utils import MEV_HOTKEY_USAGE_WARNING
78
from bittensor.core.settings import DEFAULT_MEV_PROTECTION, version_as_int
89
from bittensor.core.types import AxonServeCallParams, ExtrinsicResponse
910
from 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,

bittensor/core/extrinsics/asyncex/weights.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from bittensor.core.extrinsics.asyncex.mev_shield import submit_encrypted_extrinsic
88
from bittensor.core.extrinsics.pallets import SubtensorModule
9+
from bittensor.core.extrinsics.utils import MEV_HOTKEY_USAGE_WARNING
910
from bittensor.core.settings import DEFAULT_MEV_PROTECTION, version_as_int
1011
from bittensor.core.types import ExtrinsicResponse, Salt, UIDs, Weights
1112
from 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,

bittensor/core/extrinsics/serving.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from bittensor.core.errors import MetadataError
44
from bittensor.core.extrinsics.mev_shield import submit_encrypted_extrinsic
55
from bittensor.core.extrinsics.pallets import Commitments, SubtensorModule
6+
from bittensor.core.extrinsics.utils import MEV_HOTKEY_USAGE_WARNING
67
from bittensor.core.settings import DEFAULT_MEV_PROTECTION, version_as_int
78
from bittensor.core.types import AxonServeCallParams, ExtrinsicResponse
89
from 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,

bittensor/core/extrinsics/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
from bittensor.core.types import ExtrinsicResponse
1111
from 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+
1321
if TYPE_CHECKING:
1422
from bittensor_wallet import Wallet
1523
from bittensor.core.chain_data import StakeInfo

bittensor/core/extrinsics/weights.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from bittensor.core.extrinsics.mev_shield import submit_encrypted_extrinsic
88
from bittensor.core.extrinsics.pallets import SubtensorModule
9+
from bittensor.core.extrinsics.utils import MEV_HOTKEY_USAGE_WARNING
910
from bittensor.core.settings import DEFAULT_MEV_PROTECTION, version_as_int
1011
from bittensor.core.types import ExtrinsicResponse, Salt, UIDs, Weights
1112
from 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,

0 commit comments

Comments
 (0)