[pallet-conviction-voting] Prevent and remove empty storage entries#7631
[pallet-conviction-voting] Prevent and remove empty storage entries#7631Nathy-bajo wants to merge 17 commits into
Conversation
|
Please review @muharem |
224df7d to
8908678
Compare
muharem
left a comment
There was a problem hiding this comment.
do we still let zero balance vote? I do not see the restriction on this regard
I have updated it |
|
/cmd prdoc --audience runtime_dev --bump minor |
|
/cmd label T1-FRAME |
36c1909 to
033a2d2
Compare
|
@muharem All reviews addressed, please take a look! |
Co-authored-by: Dhiraj Sah <dhiraj@parity.io>
| } | ||
| }); | ||
|
|
||
| ensure!(voting_cleaned || locks_cleaned, Error::<T, I>::NotVoter); |
There was a problem hiding this comment.
On a no-op cleanup this returns NotVoter, but the caller isn't expected to be a voter and the target may simply have nothing stale. Overloading NotVoter makes error handling ambiguous. Consider a dedicated variant, e.g. add NothingToClean and use it here:
ensure!(voting_cleaned || locks_cleaned, Error::<T, I>::NothingToClean);There was a problem hiding this comment.
Done, added NothingToClean and used it for the no-op case.
|
/cmd bench --pallet pallet_conviction_voting |
|
Command "bench --pallet pallet_conviction_voting" has started 🚀 See logs here |
|
Command "bench --pallet pallet_conviction_voting" has finished ✅ See logs here DetailsSubweight results:
Command output:❌ Failed benchmarks of runtimes/pallets: |
resolves #7458
The conviction-voting pallet was creating and retaining 29,000+ empty storage entries (VotingFor and ClassLocksFor with zero votes, delegations, and locks) which this PR fixes by implementing automatic cleanup after vote/delegation operations, a one-time migration to remove existing empty entries, and a new permissionless extrinsic for manual cleanup—all without breaking changes.
Polkadot address: 121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1