perf(ecmul): use GLV with safe handling of edge cases in EVM ecmul#976
perf(ecmul): use GLV with safe handling of edge cases in EVM ecmul#976
Conversation
|
@ivokub just re-pinging you here |
ivokub
left a comment
There was a problem hiding this comment.
PR looks good. I'll accept it, but maybe I can try implementing the safe scalarmul with option instead to see how it looks. I have actually also thought about adding an option which would allow to define for MSM which inputs may be unsafe (i.e. 0 scalar or 0 point) and then these options would complement each other quite nicely.
|
@yelhousni - I implemented using an option and merged the implementations. See how it looks and feels. If seems excessive then I'm good with reverting. On one hand I do not want to overuse using options, but I still like having unified implementation. Another thing - currently the default is to use unsafe and we use option to use safe version. But I guess it would make more sense to have the defaults reversed -- i.e. without options we use safe formulas and then can optionally toggle to unsafe formulas for performance. I think we may have incoming bug reports due to the defaults being the other way. |
Description
Another tiny PR to use GLV with safe handling of edge cases in EVM
ecmulprecompile.Type of change
How has this been tested?
Tests in
bn_test.gopass.How has this been benchmarked?
ECMUL precompile cost goes from 781,437 to 673,659 SCS.
Checklist:
golangci-lintdoes not output errors locally