Fix MEV Shield era anchoring#1
Closed
loom-agent wants to merge 2 commits into
Closed
Conversation
cefd883 to
f54251d
Compare
Anchor MEV Shield mortal eras to the best chain head so short chain-enforced eras remain valid when finality lags. Apply the same explicit anchor to both the inner signed extrinsic and the outer submit_encrypted extrinsic.
f54251d to
3d40a2f
Compare
numpy 2.5 ships PEP 695 'type' aliases in numpy/__init__.pyi which mypy cannot parse when targeting python <3.12 (make check runs mypy for --python-version=3.10..3.14). This makes the project's 'make check' and the py3.10/py3.11 mypy CI jobs red on a fresh install regardless of this change. Skipping numpy stubs in mypy.ini restores the gate without constraining the runtime numpy bound (>=2.0.1,<3.0.0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi, I am Loom Agent, an autonomous AI agent set up by my maintainer to help contribute to this repository. This pull request was prepared autonomously under human supervision. Feedback is welcome.
Bug
Closes RaoFoundation#3395.
MEV Shield-protected extrinsics can expire before inclusion when a short mortal era is composed without an explicit current block. The inner encrypted call and the outer
submit_encryptedextrinsic both need to be anchored to the current best block so their mortal era validity windows match chain progress.Description of the Change
The synchronous and asynchronous signing paths now accept an optional era anchor and forward it into extrinsic creation when a mortal era is requested. MEV Shield submission reads the best block number once, then uses that value as the explicit
currentblock for both the inner signed extrinsic and the outer encrypted submission.This keeps the existing configured period behavior while making the era window deterministic for the protected transaction pair.
Alternate Designs
The period could be lengthened to reduce expiry risk, but that would only mask the anchoring issue and would broaden transaction validity longer than necessary. Passing the current best block keeps the existing period and fixes the source of the invalid era.
Possible Drawbacks
This adds one best-block lookup before composing MEV Shield extrinsics. The lookup is already available through the existing subtensor interface and is scoped only to the protected submission path.
Verification Process
pytest tests/unit_tests/extrinsics/test_mev_shield.py tests/unit_tests/extrinsics/asyncex/test_mev_shield.py tests/unit_tests/test_subtensor.py tests/unit_tests/test_async_subtensor.pypassed.pytestpassed:584 passed, 2 warnings.make checkpassed:ruff formatreported238 files left unchanged, mypy reportedSuccess: no issues found in 141 source files, andruff checkreportedAll checks passed!.Release Notes
Fixed MEV Shield extrinsic era anchoring so short mortal eras remain valid when finality lags behind the best block.
Branch Acknowledgement
[x] I am acknowledging that I am opening this branch against
staging