code-423n4 / org

Code4rena Governance and Discussion
71 stars 17 forks source link

To ensure accurate assessment of performance, a gas benchmark must be included in all gas reports. #139

Open pavankv241 opened 8 months ago

pavankv241 commented 8 months ago

Summary

I'm pointing out that gas submissions should include benchmarks to help sponsors and judges accurately assess the gas savings achieved by the findings in the report. I've seen numerous reports that contain findings such as move checks to the top of functions to save gas, but in practice, this often results in lower than minimal gas savings and merely returns unused gas in some cases. Additionally, findings such as Refactor code or functions to save gas and rearrange variables or structs often lack practical data(means exact gas benchmark which could saved by refactoring) to support their potential impact. Wardens proposing changes to code structures , storage structures or function calls for gas optimization should experimentally validate their findings using tools like (Foundry, Hardhat, or others) to provide concrete gas benchmarks.

I agree that for findings like Use bitmaps instead of booleans in mapping (saves 100000), providing gas benchmarks is impractical as it would necessitate a complete overhaul of the protocol's codebase. However, these types of findings can be effectively identified by automated bots, no need of manual work

Recommendation

We recommend mandating the inclusion of gas benchmarks in gas submissions. This would encourage wardens to experimentally validate their findings with code, leading to more unique and valuable insights for sponsors. (Correct this if wrong)

Thank you

pavankv241 commented 8 months ago

Any comments on this from C4 members