Category: Coding Mistakes
Reduction ineffective in Values function for Uint521
Informational Impact
Informational Severity
N/A Likelihood
Description
In sdk/api_uint521.go of the sdk repository, the Values function for the Uint521 type is implemented as follows:
func (v Uint521) Values() []frontend.Variable {
u521Field.Reduce(v.Element)
return v.Limbs
}The call to Reduce will not change v.Element but only return the reduced value.
Impact
The current implementation does not match the intention to return the reduced limbs.
Recommendations
To return the reduced limbs, the function should be implemented as follows:
func (v Uint521) Values() []frontend.Variable {
return u521Field.Reduce(v.Element).Limbs
}Remediation
This issue has been acknowledged by Brevis, and a fix was implemented in commit ea757d48↗.