All optimizations were benchmarked using the protocol's tests using the following config: solc version 0.8.18, optimizer on, 200 runs, viaIR = true. In most cases forge test --gas-report was used
Each optimization was submitted individually.
Issue | Instances | Total Gas Saved | |
---|---|---|---|
[G‑01] | Consider using clones | * | -70% cheaper deployment gas |
[G‑02] | ReentrancyGuard can be safely removed | 1 | 42725 |
[G‑03] | computeEscrowAddress() can be internal instead of public | 1 | 55863 + 193 |
[G‑04] | Redundant zero address checks | 2 | 237 |
[G‑05] | Input validation should be done in the beginning | 2 | 110649(in the revert case) |
[G‑06] | Emit after the transfer has been made in case it fails | 2 | 1381(in the revert case) |
[G‑07] | The bytecode can be removed from the function params | 1 | 27 |
[G‑08] | Nested ifs are cheaper than && | 1 | 19 |
The computeEscrowAddress() here is set to public however because it is only used in the newEscrow() function and users arent going to call this function then it can be marked as internal and this will save us both deployment gas of the EscrowFactory and runtime gas when calling newEscrow()
Deployment Gas Savings for EscrowFactory.sol obtained via protocol's tests: 55863 gas
Before | 1720616 |
After | 1664753 |
Runtime Gas Savings for newEscrow() obtained via protocol's tests(median was used because the avg isnt accurate here): 193 gas
MED | |
---|---|
Before | 627057 |
After | 626864 |
There is 1 instance of this issue:
Use internal instead of public
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.