Open code423n4 opened 1 year ago
Contains some false findings: G2, G4, G5, G8, G10 borderline low quality imo
hansfriese marked the issue as grade-a
@hansfriese please review this report again. I think it should be graded as C because it has too many wrong optimizations.
This won't save any gas.
The instances refer to functions that cannot be marked external
because they're used internally. They must be public
.
The single instance of this finding is wrong because calldata
cannot be used on local variables.
>=
and >
are not equivalent. This kind of optimization can only be applied to something like this:
if (x > y) {
doSomething1();
} else {
doSomething2();
}
And the optimized code would look like this:
if (y >= x) {
doSomething2();
} else {
doSomething1();
}
Most of the instances are wrong. The only valid instance is:
File: /contracts/Position.sol
160 if (newPrice > price) {
None of the instances describe a bool
that is used for storage. They are all local variables and functions' return values.
This is not an optimization unless that state variables is cached in a local variable, which isn't the case here. In addition, some of the instances refer to immutables.
This is not an optimization because it changes functionality.
Changes functionality and doesn't save any gas in this case.
Most of the instances are wrong because the don't refer to accesses done in the same function. Some of them aren't even read operations (they are write operations) so caching won't help.
Most of the instances are wrong because they refer to immutables.
G9 has invalid finding. G13, G14 has many invalid instances.
See the markdown file with the details of this report here.