@0x/contracrts-zero-ex: Address more review comments.
				
					
				
			This commit is contained in:
		| @@ -30,7 +30,7 @@ interface IMigrate { | |||||||
|  |  | ||||||
|     /// @dev Execute a migration function in the context of the ZeroEx contract. |     /// @dev Execute a migration function in the context of the ZeroEx contract. | ||||||
|     ///      The result of the function being called should be the magic bytes |     ///      The result of the function being called should be the magic bytes | ||||||
|     ///      0x2c64c5ef. Only callable by the owner. |     ///      0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner. | ||||||
|     ///      The owner will be temporarily set to `address(this)` inside the call. |     ///      The owner will be temporarily set to `address(this)` inside the call. | ||||||
|     ///      The original owner can be retrieved through `getMigrationOwner()`.` |     ///      The original owner can be retrieved through `getMigrationOwner()`.` | ||||||
|     /// @param target The migrator contract address. |     /// @param target The migrator contract address. | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ contract Migrate is | |||||||
|  |  | ||||||
|     /// @dev Execute a migration function in the context of the ZeroEx contract. |     /// @dev Execute a migration function in the context of the ZeroEx contract. | ||||||
|     ///      The result of the function being called should be the magic bytes |     ///      The result of the function being called should be the magic bytes | ||||||
|     ///      0x2c64c5ef. Only callable by the owner. |     ///      0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner. | ||||||
|     ///      The owner will be temporarily set to `address(this)` inside the call. |     ///      The owner will be temporarily set to `address(this)` inside the call. | ||||||
|     ///      The original owner can be retrieved through `getMigrationOwner()`.` |     ///      The original owner can be retrieved through `getMigrationOwner()`.` | ||||||
|     /// @param target The migrator contract address. |     /// @param target The migrator contract address. | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ import "../errors/LibProxyRichErrors.sol"; | |||||||
| library LibBootstrap { | library LibBootstrap { | ||||||
|  |  | ||||||
|     /// @dev Magic bytes returned by the bootstrapper to indicate success. |     /// @dev Magic bytes returned by the bootstrapper to indicate success. | ||||||
|  |     ///      This is `keccack('BOOTSTRAP_SUCCESS')`. | ||||||
|     bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b; |     bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b; | ||||||
|  |  | ||||||
|     /// @dev Perform a delegatecall and ensure it returns the magic bytes. |     /// @dev Perform a delegatecall and ensure it returns the magic bytes. | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ import "../errors/LibMigrateRichErrors.sol"; | |||||||
| library LibMigrate { | library LibMigrate { | ||||||
|  |  | ||||||
|     /// @dev Magic bytes returned by a migrator to indicate success. |     /// @dev Magic bytes returned by a migrator to indicate success. | ||||||
|  |     ///      This is `keccack('MIGRATE_SUCCESS')`. | ||||||
|     bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef; |     bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef; | ||||||
|  |  | ||||||
|     /// @dev Perform a delegatecall and ensure it returns the magic bytes. |     /// @dev Perform a delegatecall and ensure it returns the magic bytes. | ||||||
|   | |||||||
| @@ -44,6 +44,9 @@ library LibStorage { | |||||||
|         pure |         pure | ||||||
|         returns (uint256 offset) |         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; |         return uint256(storageId) * STORAGE_OFFSET_MULTIPLIER; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ describe('Storage ID uniqueness test', () => { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     it('all STORAGE_IDs are unique in storage libraries', async () => { |     it('all StorageId references are unique in storage libraries', async () => { | ||||||
|         const sourcePaths = (await promisify(readdir)(STORAGE_SOURCES_DIR)) |         const sourcePaths = (await promisify(readdir)(STORAGE_SOURCES_DIR)) | ||||||
|             .filter(p => p.endsWith('.sol')) |             .filter(p => p.endsWith('.sol')) | ||||||
|             .map(p => resolve(STORAGE_SOURCES_DIR, p)); |             .map(p => resolve(STORAGE_SOURCES_DIR, p)); | ||||||
| @@ -26,7 +26,7 @@ describe('Storage ID uniqueness test', () => { | |||||||
|             for (let j = 0; j < storageIds.length; ++j) { |             for (let j = 0; j < storageIds.length; ++j) { | ||||||
|                 if (i !== j && storageId === storageIds[j]) { |                 if (i !== j && storageId === storageIds[j]) { | ||||||
|                     throw new Error( |                     throw new Error( | ||||||
|                         `Found duplicate STORAGE_ID ${storageId} ` + |                         `Found duplicate StorageId ${storageId} ` + | ||||||
|                             `in files ${basename(sourcePaths[i])}, ${basename(sourcePaths[j])}`, |                             `in files ${basename(sourcePaths[i])}, ${basename(sourcePaths[j])}`, | ||||||
|                     ); |                     ); | ||||||
|                 } |                 } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user