40,000 USDC
View results
Submission Details
Severity: gas

Use `calldata` instead of `memory` for function arguments that do not get mutated

Summary

Mark data types as calldata instead of memory where possible. This makes it so that the data is not automatically loaded into memory. If the data passed into the function does not need to be changed (like updating values in an array), it can be passed in as calldata. The one exception to this is if the argument must later be passed into another function that takes an argument that specifies memory storage.

Vulnerability Details

There is 1 instance of this issue.

File: src/EscrowFactory.sol
/// @audit byteCode
56: function computeEscrowAddress(
57: bytes memory byteCode,
58: address deployer,
59: uint256 salt,
60: uint256 price,
61: IERC20 tokenContract,
62: address buyer,
63: address seller,
64: address arbiter,
65: uint256 arbiterFee
66: ) public pure returns (address) {
File Link Instance Count Instance Link
EscrowFactory.sol 1 56

Impact

211 gas

Tools Used

baudit: a custom static code analysis tool; manual review

Recommendations

Use calldata instead of memory for function arguments that do not get mutated.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.