You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some numbers should be appropriately limited in the app but aren't. Right now there is no simple way in contract validation functions to limit a number's range.
Also, I noticed separate missing stringMax validators for:
Similar to stringMax(), implement numberRange() that looks like this:
numberRange(<low>, <high>)
No need to add the name of the parameter there. Just make sure that any error messages thrown include the range itself, and that should be sufficient to identity which parameter failed.
Then add this to:
mincomeAmount: make it go from 1 to 1000000000
distributionPeriodLength: from 1 to 365
amount (in group/payment)): from 0 to 1000000000
exchangeRate: from 0 to 1000000000
expires_date_ms: from 0 to Number.MAX_SAFE_INTEGER
For the stringMax validators:
vote should be a unionOf the 4 literalOfs from rules.js
proposalIds should be arrayOfMAX_HASH_LEN strings
memberID should be MAX_HASH_LEN
reason should be some value that's also enforced in the UI (double check that it is), and probably same as GROUP_DESCRIPTION_MAX_CHAR
paymentMethod name should be GROUP_NAME_MAX_CHAR
memberID is another MAX_HASH_LEN
The text was updated successfully, but these errors were encountered:
@taoeffect
I implemented numberRange() in this previous PR.
So things left to do here is to add this to various places you mentioned.
Q. I remember you telling us a few weeks ago to refrain from making updates to contracts files and this one does involve changes in contract files. Is this safe to work on now?
Problem
Some numbers should be appropriately limited in the app but aren't. Right now there is no simple way in contract validation functions to limit a number's range.
Also, I noticed separate missing
stringMax
validators for:Solution
Similar to
stringMax()
, implementnumberRange()
that looks like this:No need to add the name of the parameter there. Just make sure that any error messages thrown include the range itself, and that should be sufficient to identity which parameter failed.
Then add this to:
mincomeAmount
: make it go from1
to1000000000
distributionPeriodLength
: from1
to365
amount
(ingroup/payment)
): from0
to1000000000
exchangeRate
: from0
to1000000000
expires_date_ms
: from0
toNumber.MAX_SAFE_INTEGER
For the
stringMax
validators:vote
should be aunionOf
the 4literalOf
s fromrules.js
proposalIds
should bearrayOf
MAX_HASH_LEN
stringsmemberID
should beMAX_HASH_LEN
reason
should be some value that's also enforced in the UI (double check that it is), and probably same asGROUP_DESCRIPTION_MAX_CHAR
name
should beGROUP_NAME_MAX_CHAR
memberID
is anotherMAX_HASH_LEN
The text was updated successfully, but these errors were encountered: