code-423n4 / 2021-10-tally-findings

0 stars 0 forks source link

Unnecessary `SLOAD` in `Swap.setFeeRecipient()` #65

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pants

Vulnerability details

This line in Swap.setFeeRecipient() perfoms an SLOAD operation for a value that is already stored in a local variable:

emit NewFeeRecipient(feeRecipient);

Impact

Storage reads are much more expensive than reading local variables.

Tool Used

Manual code review.

Recommended Mitigation Steps

Use the already existing local variable instead of loading this value from storage:

emit NewFeeRecipient(feeRecipient_);
Shadowfiend commented 2 years ago

Duplicate of #19.