Add EnsureBoth origin combinator, conviction-voting empty entry cleanup, and weight inheritance docs#12087
Open
BenWhiteJam wants to merge 3 commits into
Conversation
… cleanup, and weight inheritance docs - Add EnsureBoth<L, R> "AND gate" combinator for EnsureOrigin that requires both origin checks to pass (closes paritytech#369) - Add cleanup_empty_votes extrinsic to conviction-voting pallet and preventive cleanup in update_lock to remove zero-value VotingFor storage entries (closes paritytech#7458) - Document inherited weight resolution mechanism in #[pallet::weight] docs (closes paritytech#4766) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
bkchr
reviewed
May 18, 2026
Member
bkchr
left a comment
There was a problem hiding this comment.
Hey RoboBen, could you please split this pull request into two pull requests :)
Can you please also provide tests for both changes.
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.
Summary
EnsureBothorigin combinator: Adds an "AND gate" for origins — requires two independent origin checks to both pass. ImplementsEnsureOriginandEnsureOriginWithArgfor a tuple(LeftOrigin, RightOrigin).VotingForentries can linger in storage. This adds acleanup_empty_votesdispatchable (callable by any signed origin) plus automatic cleanup after vote removal to prevent storage bloat.#[pallet::weight]attribute docs to clarify how weight inheritance from$WeightInfoworks at compile time.Changes
frame/support/src/traits/dispatch.rs— newEnsureBoth<L, R>struct with full trait impls + doc testsframe/support/src/traits.rs— re-exportEnsureBothframe/support/src/lib.rs— expanded weight inheritance docsframe/conviction-voting/src/lib.rs—cleanup_empty_votesdispatchable + auto-cleanup after vote removal +remove_empty_entrieshelperframe/conviction-voting/src/vote.rs—Voting::is_empty()helperframe/conviction-voting/src/weights.rs— weight function forcleanup_empty_votesTest plan
cargo test -p pallet-conviction-votingcargo test -p frame-supportEnsureBothdoc test passes🤖 Generated with Claude Code