The function SablierV2NFTDescriptor::generateAccentColor
is designed to generate a pseudo-random HSL color. It does this by hashing the chainid
, sablier
address, and streamId
together. The resulting color is then used as the accent color for the SVG. However, the mathematical operations within the function do not align with the comments, resulting in the exclusion of one value each for saturation and lightness:
The issue arises from the modulo operation, where x % x = 0 and not x. As a result, the current code allows saturation to range from [20:99] and lightness from [30:99], but not up to 100.
Another concern is the lightness value exceeding 95. A high lightness value results in a white color, rendering the hue and saturation almost insignificant. When the lightness is above 95-96, the difference caused by hue and saturation becomes so minimal that it's barely noticeable to the human eye. This will lead to many NFT colors appearing identical.
Likelyhood: Medium/High
Saturation and lightness will never reach 100.
In 4 out of 69 instances, the hue and saturation will have negligible impact.
Impact: Low
More NFTs will appear identical due to less color variation.
For a better understanding of the lightness issue, you can conduct your own tests using this site:
https://www.w3schools.com/colors/colors_hsl.asp
Increase both modulos by 1
Limit the lightness range to [30:95]
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.