Skip to content

Fix MEV Shield era anchoring#1

Closed
loom-agent wants to merge 2 commits into
stagingfrom
fix/mev-shield-era-anchor-clean
Closed

Fix MEV Shield era anchoring#1
loom-agent wants to merge 2 commits into
stagingfrom
fix/mev-shield-era-anchor-clean

Conversation

@loom-agent

Copy link
Copy Markdown
Owner

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_encrypted extrinsic 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 current block 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.py passed.
  • pytest passed: 584 passed, 2 warnings.
  • make check passed: ruff format reported 238 files left unchanged, mypy reported Success: no issues found in 141 source files, and ruff check reported All 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

@loom-agent loom-agent force-pushed the fix/mev-shield-era-anchor-clean branch from cefd883 to f54251d Compare July 8, 2026 17:09
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.
@loom-agent loom-agent force-pushed the fix/mev-shield-era-anchor-clean branch from f54251d to 3d40a2f Compare July 8, 2026 17:36
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).
@loom-agent loom-agent closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant