hats-finance / SeeR-PM-0x899bc13919880db76edf4ccd72bdfa5dfa666fb7

1 stars 0 forks source link

Use `calldata` Instead of `memory` for Function Arguments That Do Not Get Mutated #118

Open hats-bug-reporter[bot] opened 3 days ago

hats-bug-reporter[bot] commented 3 days ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x054e4a4fc6326471ce25af2986acf2e88d9227aa96b9dd3f2f59e84287ac0510 Severity: low

Description: Description\ The Router, GnosisRouter, MainnetRouter, and MarketFactory contracts use memory for function arguments where calldata could be utilized instead. Using calldata allows the data to remain in the original transaction data without copying it into memory, resulting in a significant gas optimization for functions that do not mutate the passed arguments. The issue occurs when arguments passed to functions are marked as memory, even though they are not modified or passed to other functions that expect memory.

Example Locations:

Impact\ While this is classified as a low risk, addressing it can result in gas savings by reducing unnecessary memory allocation. Optimizing these areas can be especially beneficial when large arrays or strings are involved.

Recommendation\ Use calldata instead of memory if the data passed into the function does not need to be changed.

greenlucid commented 3 days ago

Out of scope

  • Gas optimizations.
clesaege commented 2 days ago

As per contest rules, are out of scope: