Solidity noob here; reading about data locations i've learned that whenever you don't need to store or modify a function's input value it's actually more gas efficient to set its location to calldata (oversimplifying the concept). That said, i've came across a function into "OwnableUpgradeable.sol" by OpenZeppelin (but i've seen this in other instances) that doesn't set an argument's location to calldata even though its value will not be altered. Why is that? I know i'm missing something but i cannot understand what.

OpenZeppelin case

Another case from github

--- Can anyone explain or link to an explanation of why it's not correct to set these two arguments' locations to calldata?

1 Answer 1


Because calldata is for arrays not primitive types like strings or addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.