parity-common icon indicating copy to clipboard operation
parity-common copied to clipboard

Implement BoundedVec with bound on both end

Open sudipghimire533 opened this issue 10 months ago • 2 comments

Is there an existing issue?

  • [X] I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • [X] This is not a support question.

Motivation

BoundedVec will not only bound its size in maximum limit but there shall also be minimum limit. This is useful in many case where pallet is expecting a vector within certain bounds eg: Some Name shall be greater than 3 element long but less than 500 and so on

Request

Extend BoundedVec implementation in frame_support to include another type Paramater LowerBound and all the operation in BoundedVec gurantee this bound ( and also the current upperbound ).

If required, default LowerBound can be 0 so it does not change the behavior in places where lower bound is not required

Solution

** Explain Above **

( I can also take the responsibility to implement and raise the PR, but first i need confirmation if everyone else thinks this is worth having )

Are you willing to help with this request?

Yes!

sudipghimire533 avatar Aug 23 '23 12:08 sudipghimire533