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
2 changes: 1 addition & 1 deletion bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7002,7 +7002,7 @@ async def mev_submit_encrypted(
have successfully decrypted and executed the inner call. If True, the function will poll subsequent
blocks for the event matching this submission's commitment.
blocks_for_revealed_execution: Maximum number of blocks to poll for the executed event after
inclusion. The function checks blocks from start_block+1 to start_block + blocks_for_revealed_execution.
inclusion. The function checks blocks from start_block to start_block + blocks_for_revealed_execution.
Returns immediately if the event is found before the block limit is reached.

Returns:
Expand Down
6 changes: 3 additions & 3 deletions bittensor/core/extrinsics/asyncex/mev_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ async def wait_for_extrinsic_by_hash(
extrinsic_hash: The hash of the inner extrinsic to find.
shield_id: The wrapper ID from EncryptedSubmitted event (for detecting decryption failures).
submit_block_hash: Block hash where submit_encrypted was included.
timeout_blocks: Max blocks to wait (default 3).
timeout_blocks: Max blocks to wait.

Returns:
Optional ExtrinsicReceipt.
"""

starting_block = await subtensor.substrate.get_block_number(submit_block_hash)
current_block = starting_block + 1
current_block = starting_block

while current_block - starting_block <= timeout_blocks:
logging.debug(
Expand Down Expand Up @@ -127,7 +127,7 @@ async def submit_encrypted_extrinsic(
successfully decrypted and executed the inner call. If True, the function will poll subsequent blocks for
the event matching this submission's commitment.
blocks_for_revealed_execution: Maximum number of blocks to poll for the executed event after inclusion.
The function checks blocks from start_block + 1 to start_block + blocks_for_revealed_execution. Returns
The function checks blocks from start_block to start_block + blocks_for_revealed_execution. Returns
immediately if the event is found before the block limit is reached.

Returns:
Expand Down
6 changes: 3 additions & 3 deletions bittensor/core/extrinsics/mev_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def wait_for_extrinsic_by_hash(
extrinsic_hash: The hash of the inner extrinsic to find.
shield_id: The wrapper ID from EncryptedSubmitted event (for detecting decryption failures).
submit_block_hash: Block hash where submit_encrypted was included.
timeout_blocks: Max blocks to wait (default 3).
timeout_blocks: Max blocks to wait.

Returns:
Optional ExtrinsicReceipt.
"""

starting_block = subtensor.substrate.get_block_number(submit_block_hash)
current_block = starting_block + 1
current_block = starting_block

while current_block - starting_block <= timeout_blocks:
logging.debug(
Expand Down Expand Up @@ -126,7 +126,7 @@ def submit_encrypted_extrinsic(
successfully decrypted and executed the inner call. If True, the function will poll subsequent blocks for
the event matching this submission's commitment.
blocks_for_revealed_execution: Maximum number of blocks to poll for the executed event after inclusion.
The function checks blocks from start_block + 1 to start_block + blocks_for_revealed_execution. Returns
The function checks blocks from start_block to start_block + blocks_for_revealed_execution. Returns
immediately if the event is found before the block limit is reached.

Returns:
Expand Down
2 changes: 1 addition & 1 deletion bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5847,7 +5847,7 @@ def mev_submit_encrypted(
have successfully decrypted and executed the inner call. If True, the function will poll subsequent
blocks for the event matching this submission's commitment.
blocks_for_revealed_execution: Maximum number of blocks to poll for the executed event after inclusion. The
function checks blocks from start_block+1 to start_block + blocks_for_revealed_execution. Returns
function checks blocks from start_block to start_block + blocks_for_revealed_execution. Returns
immediately if the event is found before the block limit is reached.

Returns:
Expand Down
10 changes: 5 additions & 5 deletions tests/unit_tests/extrinsics/asyncex/test_mev_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async def test_wait_for_extrinsic_by_hash_success(subtensor, mocker):
shield_id = "shield_id_123"
submit_block_hash = "0xblockhash"
starting_block = 100
current_block = 101
current_block = 100

mocked_get_block_number = mocker.patch.object(
subtensor.substrate,
Expand Down Expand Up @@ -76,7 +76,7 @@ async def test_wait_for_extrinsic_by_hash_decryption_failed(subtensor, mocker):
shield_id = "shield_id_123"
submit_block_hash = "0xblockhash"
starting_block = 100
current_block = 101
current_block = 100

mocked_get_block_number = mocker.patch.object(
subtensor.substrate,
Expand Down Expand Up @@ -174,9 +174,9 @@ async def test_wait_for_extrinsic_by_hash_timeout(subtensor, mocker):

# Asserts
mocked_get_block_number.assert_awaited_once_with(submit_block_hash)
assert mocked_wait_for_block.await_count == 3
assert mocked_get_block_hash.await_count == 3
assert mocked_get_extrinsics.await_count == 3
assert mocked_wait_for_block.await_count == 4
assert mocked_get_block_hash.await_count == 4
assert mocked_get_extrinsics.await_count == 4
assert result is None


Expand Down
10 changes: 5 additions & 5 deletions tests/unit_tests/extrinsics/test_mev_shield.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_wait_for_extrinsic_by_hash_success(subtensor, mocker):
shield_id = "shield_id_123"
submit_block_hash = "0xblockhash"
starting_block = 100
current_block = 101
current_block = 100

mocked_get_block_number = mocker.patch.object(
subtensor.substrate, "get_block_number", return_value=starting_block
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_wait_for_extrinsic_by_hash_decryption_failed(subtensor, mocker):
shield_id = "shield_id_123"
submit_block_hash = "0xblockhash"
starting_block = 100
current_block = 101
current_block = 100

mocked_get_block_number = mocker.patch.object(
subtensor.substrate, "get_block_number", return_value=starting_block
Expand Down Expand Up @@ -152,9 +152,9 @@ def test_wait_for_extrinsic_by_hash_timeout(subtensor, mocker):

# Asserts
mocked_get_block_number.assert_called_once_with(submit_block_hash)
assert mocked_wait_for_block.call_count == 3
assert mocked_get_block_hash.call_count == 3
assert mocked_get_extrinsics.call_count == 3
assert mocked_wait_for_block.call_count == 4
assert mocked_get_block_hash.call_count == 4
assert mocked_get_extrinsics.call_count == 4
assert result is None


Expand Down