Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions bittensor/core/extrinsics/asyncex/move_stake.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ async def transfer_stake_extrinsic(
"""

amount.set_unit(netuid=origin_netuid)
# Verify ownership
hotkey_owner = await subtensor.get_hotkey_owner(hotkey_ss58)
if hotkey_owner != wallet.coldkeypub.ss58_address:
logging.error(
f":cross_mark: [red]Failed[/red]: Hotkey: {hotkey_ss58} does not belong to the origin coldkey owner: "
f"{wallet.coldkeypub.ss58_address}"
)
return False

# Check sufficient stake
stake_in_origin, stake_in_destination = await _get_stake_in_origin_and_dest(
Expand Down Expand Up @@ -194,14 +186,6 @@ async def swap_stake_extrinsic(
bool: True if the swap was successful, False otherwise.
"""
amount.set_unit(netuid=origin_netuid)
# Verify ownership
hotkey_owner = await subtensor.get_hotkey_owner(hotkey_ss58)
if hotkey_owner != wallet.coldkeypub.ss58_address:
logging.error(
f":cross_mark: [red]Failed[/red]: Hotkey: {hotkey_ss58} does not belong to the origin coldkey owner: "
f"{wallet.coldkeypub.ss58_address}"
)
return False

# Check sufficient stake
stake_in_origin, stake_in_destination = await _get_stake_in_origin_and_dest(
Expand Down
16 changes: 0 additions & 16 deletions bittensor/core/extrinsics/move_stake.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ def transfer_stake_extrinsic(
"""

amount.set_unit(netuid=origin_netuid)
# Verify ownership
hotkey_owner = subtensor.get_hotkey_owner(hotkey_ss58)
if hotkey_owner != wallet.coldkeypub.ss58_address:
logging.error(
f":cross_mark: [red]Failed[/red]: Hotkey: {hotkey_ss58} does not belong to the origin coldkey owner: "
f"{wallet.coldkeypub.ss58_address}"
)
return False

# Check sufficient stake
stake_in_origin, stake_in_destination = _get_stake_in_origin_and_dest(
Expand Down Expand Up @@ -192,14 +184,6 @@ def swap_stake_extrinsic(
"""

amount.set_unit(netuid=origin_netuid)
# Verify ownership
hotkey_owner = subtensor.get_hotkey_owner(hotkey_ss58)
if hotkey_owner != wallet.coldkeypub.ss58_address:
logging.error(
f":cross_mark: [red]Failed[/red]: Hotkey: {hotkey_ss58} does not belong to the origin coldkey owner: "
f"{wallet.coldkeypub.ss58_address}"
)
return False

# Check sufficient stake
stake_in_origin, stake_in_destination = _get_stake_in_origin_and_dest(
Expand Down
25 changes: 0 additions & 25 deletions tests/unit_tests/test_subtensor_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,31 +1484,6 @@ def test_transfer_stake_error(
)


def test_transfer_stake_non_owner(mock_substrate, subtensor, fake_wallet, mocker):
mocker.patch.object(
subtensor,
"get_hotkey_owner",
autospec=True,
return_value="owner2_ss58",
)

success = subtensor.transfer_stake(
fake_wallet,
"dest",
"hotkey_ss58",
origin_netuid=1,
destination_netuid=1,
amount=Balance(1),
)

assert success is False

subtensor.get_hotkey_owner.assert_called_once_with(
"hotkey_ss58",
)
mock_substrate.submit_extrinsic.assert_not_called()


def test_transfer_stake_insufficient_stake(
mock_substrate, subtensor, fake_wallet, mocker
):
Expand Down
Loading