Omniscia Euler Finance Audit
Governable Code Style Findings
Governable Code Style Findings
GEL-01C: Redundant Variable Caching
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | ![]() | Governable.sol:L40, L42 |
Description:
The referenced declaration will read the value of governor from storage, write to it, and then emit an event for its adjustment.
Example:
src/lib/Governable.sol
37/// @notice Set the governor address.38/// @param newGovernor The address of the new governor.39function _setGovernor(address newGovernor) internal {40 address oldGovernor = governor;41 governor = newGovernor;42 emit GovernorSet(oldGovernor, newGovernor);43}Recommendation:
We advise the code to instead emit the event before the adjustment takes place, permitting the governor token to be directly utilized in the event's emission and thus optimizing the code's memory expansion costs.
Alleviation:
The oldGovernor local variable has been omitted per our recommendation, emitting the GovernorSet event prior to mutating the governor entry optimally.
