Open
Conversation
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
l0r1s
reviewed
Mar 26, 2026
Collaborator
There was a problem hiding this comment.
Overall the design is good. My only concern is that the inner call is never charged for, the user gets free execution for whatever is inside. This could probably be fixed by implementing an additional check when trying to execute the call similar to what the ChargeTransactionPayment extension does and reject it if fee can't be paid, could even be done through a DispatchExtension.
JohnReedV
reviewed
Mar 26, 2026
Contributor
JohnReedV
left a comment
There was a problem hiding this comment.
Looks good to me. Didn't see anything in addition to Loris’s comments.
Collaborator
Author
Update summary
|
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.
This PR introduces infrastructure for the upcoming MEV Shield V2 feature. The idea is to accumulate encrypted extrinsics in a queue and decrypt them in the next block during the
on_initializephase. Encryption and decryption areoutside the scope of this PR and abstracted via the
ExtrinsicDecryptortrait. Protective limits include encrypted call size (const), queue size, weight for extrinsic execution, and lifetime in the queue.PR features
on_initializehook to process pending encrypted extrinsics with configurable weight limits, extrinsic lifetime, and queue sizestore_encryptedextrinsic for queuing encrypted calls for deferred executionset_max_pending_extrinsics_number,set_on_initialize_weight, andset_stored_extrinsic_lifetimeExtrinsicDecryptortrait for decrypting stored extrinsics before dispatch, with expiration, weight budgeting, and event loggingDetails
New Storage Items
PendingExtrinsics— map of queued encrypted extrinsics awaiting executionNextPendingExtrinsicIndex/PendingExtrinsicCount— auto-increment index and live count for the queueMaxPendingExtrinsicsLimit— configurable max queue depth (default: 100)OnInitializeWeight— configurable max weight budget for on_initialize processing (default: 500B ref_time, capped at 2T)ExtrinsicLifetime— configurable max age in blocks before expiration (default: 10)New Extrinsics
store_encrypted— signed extrinsic to queue an encrypted callset_max_pending_extrinsics_number— root-only, sets queue limitset_on_initialize_weight— root-only, sets weight budget with absolute max guardset_stored_extrinsic_lifetime— root-only, sets expiration windowProcessing Logic (
on_initialize)Iterates pending extrinsics in insertion order. For each entry:
ExtrinsicExpiredis emittedExtrinsicDecodeFailedis emittedExtrinsicPostponed)Other Changes
RuntimeCallandExtrinsicDecryptorassociated types to pallet_shield::ConfigT::RuntimeCallincheck_mortality.rsto resolve ambiguity betweenframe_system::Configandpallet_shield::ConfigUnit Test Plan
store_encrypted(success, queue full, event emission)set_max_pending_extrinsics_number(root-only, value persistence)set_on_initialize_weight(root-only, absolute max rejection)set_stored_extrinsic_lifetime(root-only, value persistence)on_initializeprocessing (dispatch, expiration, weight limits, decode failures)Benchmarks
To be added after the initial review. (UPDATE: the benchmarks were added)