Skip to content
Prev Previous commit
Next Next commit
Improve gas (?)
  • Loading branch information
ernestognw committed Jul 18, 2023
commit eabc9c00e7a35d46d04b1532134b3e32bb398d3f
9 changes: 3 additions & 6 deletions contracts/proxy/utils/Initializable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,11 @@ abstract contract Initializable {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();

// Cache values
bool initializing = $._initializing;
uint64 initialized = $._initialized;

bool reinitializing = version > 1;
bool increasing = version > initialized;

if (initializing ? reinitializing : !increasing) {
// When it's initializing check if it's a reinitializer, otherwise check if
// the intended version is not already set.
if (initializing ? version > 1 : version <= $._initialized) {
revert AlreadyInitialized();
}

Expand Down