@0x/contracrts-zero-ex: Address more review comments.

This commit is contained in:
Lawrence Forman 2020-04-21 22:27:58 -04:00
parent 80787456fa
commit 7df6530f3a
6 changed files with 9 additions and 4 deletions

View File

@ -30,7 +30,7 @@ interface IMigrate {
/// @dev Execute a migration function in the context of the ZeroEx contract.
/// 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 original owner can be retrieved through `getMigrationOwner()`.`
/// @param target The migrator contract address.

View File

@ -55,7 +55,7 @@ contract Migrate is
/// @dev Execute a migration function in the context of the ZeroEx contract.
/// 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 original owner can be retrieved through `getMigrationOwner()`.`
/// @param target The migrator contract address.

View File

@ -26,6 +26,7 @@ import "../errors/LibProxyRichErrors.sol";
library LibBootstrap {
/// @dev Magic bytes returned by the bootstrapper to indicate success.
/// This is `keccack('BOOTSTRAP_SUCCESS')`.
bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b;
/// @dev Perform a delegatecall and ensure it returns the magic bytes.

View File

@ -26,6 +26,7 @@ import "../errors/LibMigrateRichErrors.sol";
library LibMigrate {
/// @dev Magic bytes returned by a migrator to indicate success.
/// This is `keccack('MIGRATE_SUCCESS')`.
bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef;
/// @dev Perform a delegatecall and ensure it returns the magic bytes.

View File

@ -44,6 +44,9 @@ 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;
}
}

View File

@ -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))
.filter(p => p.endsWith('.sol'))
.map(p => resolve(STORAGE_SOURCES_DIR, p));
@ -26,7 +26,7 @@ describe('Storage ID uniqueness test', () => {
for (let j = 0; j < storageIds.length; ++j) {
if (i !== j && storageId === storageIds[j]) {
throw new Error(
`Found duplicate STORAGE_ID ${storageId} ` +
`Found duplicate StorageId ${storageId} ` +
`in files ${basename(sourcePaths[i])}, ${basename(sourcePaths[j])}`,
);
}