unlock icon indicating copy to clipboard operation
unlock copied to clipboard

Contracts are pretty Gas Costly

Open ShaheenRehman opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Not a bug but can be a big problem. As the contracts like unlock.sol include so many require statements with a error message, it will be too much gas costly. As it stores full-length of strings

Describe the solution you'd like A simple solution would be to use Custom Errors instead

Describe alternatives you've considered I think using Revert & Errors will be the best solution IA

Additional context Add any other context or screenshots about the feature request here.

ShaheenRehman avatar Aug 03 '22 18:08 ShaheenRehman

Thank you! The gas issue of using strings only upon deployment, correct?

julien51 avatar Aug 03 '22 20:08 julien51

No, Many functions included require statements with a string msgs. So it will be like deployment + every time calling any of those functions which have the require statement init.

I made Pull request #9418 with the solution and more gas-optimized contract :) Thanks

ShaheenRehman avatar Aug 04 '22 01:08 ShaheenRehman

Very good! Thanks for the clarification!

julien51 avatar Aug 04 '22 09:08 julien51

https://github.com/unlock-protocol/unlock/pull/9418 has been merged so lets close this

clemsos avatar Feb 27 '23 12:02 clemsos