code-423n4 / 2022-10-juicebox-findings

2 stars 0 forks source link

Gas Optimizations #133

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Optimize NFT delegate deployments by using proxy

Targets

c4-judge commented 1 year ago

Picodes marked the issue as grade-a

Picodes commented 1 year ago

Depending on the number of deployments this could be the biggest gas saving so far

c4-judge commented 1 year ago

Picodes marked the issue as selected for report

drgorillamd commented 1 year ago

@Picodes we didn't use proxies for 2 reasons (it would have obviously been easier;):

+ even if using a non-upgradeable proxy, some users have concern with such (I know, ux/docs/education is out of scope;)

In summary, not convinced this would be the biggest gas saving, on an overall basis

Picodes commented 1 year ago

Indeed it totally depend on the usage!

Giving this option to users could easily save a lot of gas for project that expect only a few transactions. I also selected this report as it's the only one suggesting this.

The deployment of the clone contract would be only <50k gas and then per call <2k (700 for the DELEGATECALL , 2600 for the cold address and then the memory expansion) so it'd be worth it for projects with less than a few hundred transactions