40,000 USDC
View results
Submission Details
Severity: gas

Optimize names to save gas

Summary

public and external function names and public member variable names can be optimized to save gas. The contracts listed below can be optimized so that the most frequently called functions use the least amount of gas possible during the Method ID lookup. Method IDs that have two leading zero bytes can save 128 gas each during deployment. Renaming functions to have lower Method IDs will save 22 gas per call, per sorted position shifted.

Vulnerability Details

There are 2 instances of this issue.

File: src/Escrow.sol
/// @audit confirmReceipt(), initiateDispute(), resolveDispute(), getPrice(), getTokenContract(), getBuyer(), getSeller(), getArbiter(), getArbiterFee(), getState()
14: contract Escrow is IEscrow, ReentrancyGuard {
File Link Instance Count Instance Link
Escrow.sol 1 14

File: src/EscrowFactory.sol
/// @audit newEscrow(), computeEscrowAddress()
13: contract EscrowFactory is IEscrowFactory {
File Link Instance Count Instance Link
EscrowFactory.sol 1 13

Impact

44 gas

Tools Used

baudit: a custom static code analysis tool; manual review

Recommendations

Rename the functions to have lower Method IDs.

Support

FAQs

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