feat: complete test script of mev shield #3196
Closed
+431
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
This PR adds comprehensive unit tests for the async MEV Shield extrinsics module (
bittensor/core/extrinsics/asyncex/mev_shield.py).New test file:
tests/unit_tests/extrinsics/asyncex/test_mev_shield.pyTests implemented:
test_submit_encrypted_extrinsic_success- Verifies successful encryption and submission with commitment and ciphertext generationtest_submit_encrypted_extrinsic_sign_with_hotkey- Verifies correct signer selection when using hotkeytest_wait_for_extrinsic_by_hash_success- Verifies successful extrinsic discovery in subsequent blockstest_wait_for_extrinsic_by_hash_decryption_failure- Verifies markDecryptionFailed event detectiontest_wait_for_extrinsic_by_hash_timeout- Verifies None return when extrinsic not found within timeouttest_submit_encrypted_extrinsic_invalid_signer- Verifies AttributeError raised for invalid sign_with parameterAlternate Designs
N/A - This is a test implementation following existing pytest patterns in the codebase.
Possible Drawbacks
None - This PR only adds tests without modifying production code.
Verification Process
python -m pytest tests/unit_tests/extrinsics/asyncex/test_mev_shield.py -v- All 6 tests pass@pytest.mark.asyncioandAsyncMockRelease Notes
N/A - Test-only changes, not user-facing.
Branch Acknowledgement
[x] I am acknowledging that I am opening this branch against
SDKv10Contribution by Gittensor, learn more at https://gittensor.io/