diff --git a/src/CustomSlotInitializable.sol b/src/CustomSlotInitializable.sol index 6de945a..8a2ab8f 100644 --- a/src/CustomSlotInitializable.sol +++ b/src/CustomSlotInitializable.sol @@ -66,7 +66,7 @@ abstract contract CustomSlotInitializable { * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ - uint8 initialized; + uint64 initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ @@ -76,7 +76,7 @@ abstract contract CustomSlotInitializable { /** * @dev Triggered when the contract has been initialized or reinitialized. */ - event Initialized(uint8 version); + event Initialized(uint64 version); constructor(bytes32 storagePosition) { _storagePosition = storagePosition; @@ -128,7 +128,7 @@ abstract contract CustomSlotInitializable { * * Emits an {Initialized} event. */ - modifier reinitializer(uint8 version) { + modifier reinitializer(uint64 version) { CustomSlotInitializableStorage storage _storage = _getInitialiazableStorage(); require( !_storage.initializing && _storage.initialized < version, "Initializable: contract is already initialized" @@ -160,16 +160,16 @@ abstract contract CustomSlotInitializable { function _disableInitializers() internal virtual { CustomSlotInitializableStorage storage _storage = _getInitialiazableStorage(); require(!_storage.initializing, "Initializable: contract is initializing"); - if (_storage.initialized != type(uint8).max) { - _storage.initialized = type(uint8).max; - emit Initialized(type(uint8).max); + if (_storage.initialized != type(uint64).max) { + _storage.initialized = type(uint64).max; + emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ - function _getInitializedVersion() internal view returns (uint8) { + function _getInitializedVersion() internal view returns (uint64) { return _getInitialiazableStorage().initialized; } diff --git a/test/CustomSlotInitializable.t.sol b/test/CustomSlotInitializable.t.sol index d67f516..eb405ec 100644 --- a/test/CustomSlotInitializable.t.sol +++ b/test/CustomSlotInitializable.t.sol @@ -11,7 +11,7 @@ import {CustomSlotInitializable} from "../src/CustomSlotInitializable.sol"; contract CustomSlotInitializableTest is Test { using stdStorage for StdStorage; - event Initialized(uint8 version); + event Initialized(uint64 version); address v1Impl; address v2Impl; @@ -74,7 +74,7 @@ contract CustomSlotInitializableTest is Test { contract V1 is CustomSlotInitializable(keccak256("storage")), UUPSUpgradeable { function initialize() public initializer {} - function getInitializedVersion() public view returns (uint8) { + function getInitializedVersion() public view returns (uint64) { return _getInitializedVersion(); } @@ -90,7 +90,7 @@ contract V1 is CustomSlotInitializable(keccak256("storage")), UUPSUpgradeable { contract V2 is CustomSlotInitializable(keccak256("storage")), UUPSUpgradeable { function initialize() public reinitializer(2) {} - function getInitializedVersion() public view returns (uint8) { + function getInitializedVersion() public view returns (uint64) { return _getInitializedVersion(); } diff --git a/test/LightAccount.t.sol b/test/LightAccount.t.sol index b671991..4662ae5 100644 --- a/test/LightAccount.t.sol +++ b/test/LightAccount.t.sol @@ -29,7 +29,7 @@ contract LightAccountTest is Test { event SimpleAccountInitialized(IEntryPoint indexed entryPoint, address indexed owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - event Initialized(uint8 version); + event Initialized(uint64 version); function setUp() public { eoaAddress = vm.addr(EOA_PRIVATE_KEY);