From f7f015257352135d4a5c61a7806bae0e9f05323c Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Wed, 22 Apr 2020 15:07:44 -0400 Subject: [PATCH] `@0x/contracts-zero-ex`: Add `Unused` to `StorageId` enum --- contracts/zero-ex/contracts/src/features/Migrate.sol | 2 +- contracts/zero-ex/contracts/src/features/Ownable.sol | 2 +- contracts/zero-ex/contracts/src/storage/LibStorage.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/zero-ex/contracts/src/features/Migrate.sol b/contracts/zero-ex/contracts/src/features/Migrate.sol index 8bbc20cd6c..cc78fa1263 100644 --- a/contracts/zero-ex/contracts/src/features/Migrate.sol +++ b/contracts/zero-ex/contracts/src/features/Migrate.sol @@ -72,7 +72,7 @@ contract Migrate is // If the owner is already set to ourselves then we've reentered. _rrevert(LibMigrateRichErrors.AlreadyMigratingError()); } - // Temporarily set the owner to ourselves. + // Temporarily set the owner to ourselves to enable admin functions. ownableStor.owner = address(this); stor.migrationOwner = prevOwner; diff --git a/contracts/zero-ex/contracts/src/features/Ownable.sol b/contracts/zero-ex/contracts/src/features/Ownable.sol index 609aecbfc6..1b8429434c 100644 --- a/contracts/zero-ex/contracts/src/features/Ownable.sol +++ b/contracts/zero-ex/contracts/src/features/Ownable.sol @@ -48,7 +48,7 @@ contract Ownable is /// @param impl the actual address of this feature contract. /// @return success Magic bytes if successful. function bootstrap(address impl) external returns (bytes4 success) { - // Set the owner. + // Set the owner to ourselves to allow bootstrappers to call `extend()`. LibOwnableStorage.getStorage().owner = address(this); // Register feature functions. diff --git a/contracts/zero-ex/contracts/src/storage/LibStorage.sol b/contracts/zero-ex/contracts/src/storage/LibStorage.sol index 403a1440c6..083f933a4f 100644 --- a/contracts/zero-ex/contracts/src/storage/LibStorage.sol +++ b/contracts/zero-ex/contracts/src/storage/LibStorage.sol @@ -30,6 +30,7 @@ library LibStorage { /// @dev Storage IDs for feature storage buckets. enum StorageId { + Unused, // Unused buffer for state accidents. Proxy, SimpleFunctionRegistry, Ownable, @@ -44,7 +45,6 @@ library LibStorage { pure returns (uint256 offset) { - // We don't use safeMul here to save gas. // This should never overflow with a reasonable `STORAGE_OFFSET_MULTIPLIER` // because Solidity will do a range check on `storageId` during the cast. return uint256(storageId) * STORAGE_OFFSET_MULTIPLIER;