LevelK auditors pointed out an unnecessary contract variables that were inherited from zeppelinos
https://github.com/zeppelinos/labs/pull/49/files
This commit is contained in:
parent
40a07ebd12
commit
de8ac84efc
|
@ -1,13 +0,0 @@
|
|||
pragma solidity ^0.4.19;
|
||||
|
||||
import "./EternalStorage.sol";
|
||||
import "./UpgradeabilityStorage.sol";
|
||||
import "./UpgradeabilityOwnerStorage.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title OwnedUpgradeabilityStorage
|
||||
* @dev This is the storage necessary to perform upgradeable contracts.
|
||||
* This means, required state variables for upgradeability purpose and eternal storage per se.
|
||||
*/
|
||||
contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
|
|
@ -3,10 +3,10 @@ pragma solidity ^0.4.19;
|
|||
import "./Ownable.sol";
|
||||
import "../IBridgeValidators.sol";
|
||||
import "../libraries/SafeMath.sol";
|
||||
import "../upgradeability/OwnedUpgradeabilityStorage.sol";
|
||||
import "../upgradeability/EternalStorage.sol";
|
||||
|
||||
|
||||
contract BridgeValidators is IBridgeValidators, Ownable, OwnedUpgradeabilityStorage {
|
||||
contract BridgeValidators is IBridgeValidators, EternalStorage, Ownable {
|
||||
using SafeMath for uint256;
|
||||
event ValidatorAdded (address validator);
|
||||
event ValidatorRemoved (address validator);
|
||||
|
|
|
@ -2,9 +2,7 @@ pragma solidity ^0.4.19;
|
|||
import "../libraries/SafeMath.sol";
|
||||
import "../libraries/Helpers.sol";
|
||||
import "../libraries/Message.sol";
|
||||
// import "./IBridgeValidators.sol";
|
||||
import "./U_Validatable.sol";
|
||||
// import "./BridgeDeploymentAddressStorage.sol";
|
||||
import "../IBurnableMintableERC677Token.sol";
|
||||
import "../ERC677Receiver.sol";
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ import "../libraries/SafeMath.sol";
|
|||
import "../libraries/Helpers.sol";
|
||||
import "../libraries/Message.sol";
|
||||
import "./U_Validatable.sol";
|
||||
import "../upgradeability/OwnedUpgradeabilityStorage.sol";
|
||||
import "../upgradeability/EternalStorage.sol";
|
||||
|
||||
|
||||
contract HomeBridge is OwnedUpgradeabilityStorage, Validatable {
|
||||
contract HomeBridge is EternalStorage, Validatable {
|
||||
using SafeMath for uint256;
|
||||
event GasConsumptionLimitsUpdated(uint256 gas);
|
||||
event Deposit (address recipient, uint256 value);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
pragma solidity ^0.4.19;
|
||||
import "../IBridgeValidators.sol";
|
||||
import "../upgradeability/OwnedUpgradeabilityStorage.sol";
|
||||
import "../upgradeability/EternalStorage.sol";
|
||||
|
||||
|
||||
contract Validatable is OwnedUpgradeabilityStorage {
|
||||
contract Validatable is EternalStorage {
|
||||
|
||||
function validatorContract() public view returns(IBridgeValidators) {
|
||||
return IBridgeValidators(addressStorage[keccak256("validatorContract")]);
|
||||
|
|
|
@ -73,71 +73,6 @@ contract EternalStorage {
|
|||
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityOwnerStorage
|
||||
* @dev This contract keeps track of the upgradeability owner
|
||||
*/
|
||||
contract UpgradeabilityOwnerStorage {
|
||||
// Owner of the contract
|
||||
address private _upgradeabilityOwner;
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the owner
|
||||
* @return the address of the owner
|
||||
*/
|
||||
function upgradeabilityOwner() public view returns (address) {
|
||||
return _upgradeabilityOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Sets the address of the owner
|
||||
*/
|
||||
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
|
||||
_upgradeabilityOwner = newUpgradeabilityOwner;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityStorage
|
||||
* @dev This contract holds all the necessary state variables to support the upgrade functionality
|
||||
*/
|
||||
contract UpgradeabilityStorage {
|
||||
// Version name of the current implementation
|
||||
string internal _version;
|
||||
|
||||
// Address of the current implementation
|
||||
address internal _implementation;
|
||||
|
||||
/**
|
||||
* @dev Tells the version name of the current implementation
|
||||
* @return string representing the name of the current version
|
||||
*/
|
||||
function version() public view returns (string) {
|
||||
return _version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the current implementation
|
||||
* @return address of the current implementation
|
||||
*/
|
||||
function implementation() public view returns (address) {
|
||||
return _implementation;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/OwnedUpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title OwnedUpgradeabilityStorage
|
||||
* @dev This is the storage necessary to perform upgradeable contracts.
|
||||
* This means, required state variables for upgradeability purpose and eternal storage per se.
|
||||
*/
|
||||
contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
|
||||
|
||||
// File: contracts/upgradeable_contracts/Ownable.sol
|
||||
|
||||
// Roman Storm Multi Sender
|
||||
|
@ -194,7 +129,7 @@ contract Ownable is EternalStorage {
|
|||
|
||||
// File: contracts/upgradeable_contracts/U_BridgeValidators.sol
|
||||
|
||||
contract BridgeValidators is IBridgeValidators, Ownable, OwnedUpgradeabilityStorage {
|
||||
contract BridgeValidators is IBridgeValidators, EternalStorage, Ownable {
|
||||
using SafeMath for uint256;
|
||||
event ValidatorAdded (address validator);
|
||||
event ValidatorRemoved (address validator);
|
||||
|
|
|
@ -248,74 +248,9 @@ contract EternalStorage {
|
|||
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityOwnerStorage
|
||||
* @dev This contract keeps track of the upgradeability owner
|
||||
*/
|
||||
contract UpgradeabilityOwnerStorage {
|
||||
// Owner of the contract
|
||||
address private _upgradeabilityOwner;
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the owner
|
||||
* @return the address of the owner
|
||||
*/
|
||||
function upgradeabilityOwner() public view returns (address) {
|
||||
return _upgradeabilityOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Sets the address of the owner
|
||||
*/
|
||||
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
|
||||
_upgradeabilityOwner = newUpgradeabilityOwner;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityStorage
|
||||
* @dev This contract holds all the necessary state variables to support the upgrade functionality
|
||||
*/
|
||||
contract UpgradeabilityStorage {
|
||||
// Version name of the current implementation
|
||||
string internal _version;
|
||||
|
||||
// Address of the current implementation
|
||||
address internal _implementation;
|
||||
|
||||
/**
|
||||
* @dev Tells the version name of the current implementation
|
||||
* @return string representing the name of the current version
|
||||
*/
|
||||
function version() public view returns (string) {
|
||||
return _version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the current implementation
|
||||
* @return address of the current implementation
|
||||
*/
|
||||
function implementation() public view returns (address) {
|
||||
return _implementation;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/OwnedUpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title OwnedUpgradeabilityStorage
|
||||
* @dev This is the storage necessary to perform upgradeable contracts.
|
||||
* This means, required state variables for upgradeability purpose and eternal storage per se.
|
||||
*/
|
||||
contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
|
||||
|
||||
// File: contracts/upgradeable_contracts/U_Validatable.sol
|
||||
|
||||
contract Validatable is OwnedUpgradeabilityStorage {
|
||||
contract Validatable is EternalStorage {
|
||||
|
||||
function validatorContract() public view returns(IBridgeValidators) {
|
||||
return IBridgeValidators(addressStorage[keccak256("validatorContract")]);
|
||||
|
@ -335,13 +270,6 @@ contract Validatable is OwnedUpgradeabilityStorage {
|
|||
|
||||
// File: contracts/upgradeable_contracts/U_ForeignBridge.sol
|
||||
|
||||
// import "./IBridgeValidators.sol";
|
||||
|
||||
// import "./BridgeDeploymentAddressStorage.sol";
|
||||
|
||||
|
||||
|
||||
|
||||
contract ForeignBridge is ERC677Receiver, Validatable {
|
||||
using SafeMath for uint256;
|
||||
/// triggered when relay of deposit from HomeBridge is complete
|
||||
|
|
|
@ -199,74 +199,9 @@ contract EternalStorage {
|
|||
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityOwnerStorage
|
||||
* @dev This contract keeps track of the upgradeability owner
|
||||
*/
|
||||
contract UpgradeabilityOwnerStorage {
|
||||
// Owner of the contract
|
||||
address private _upgradeabilityOwner;
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the owner
|
||||
* @return the address of the owner
|
||||
*/
|
||||
function upgradeabilityOwner() public view returns (address) {
|
||||
return _upgradeabilityOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Sets the address of the owner
|
||||
*/
|
||||
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
|
||||
_upgradeabilityOwner = newUpgradeabilityOwner;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/UpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title UpgradeabilityStorage
|
||||
* @dev This contract holds all the necessary state variables to support the upgrade functionality
|
||||
*/
|
||||
contract UpgradeabilityStorage {
|
||||
// Version name of the current implementation
|
||||
string internal _version;
|
||||
|
||||
// Address of the current implementation
|
||||
address internal _implementation;
|
||||
|
||||
/**
|
||||
* @dev Tells the version name of the current implementation
|
||||
* @return string representing the name of the current version
|
||||
*/
|
||||
function version() public view returns (string) {
|
||||
return _version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Tells the address of the current implementation
|
||||
* @return address of the current implementation
|
||||
*/
|
||||
function implementation() public view returns (address) {
|
||||
return _implementation;
|
||||
}
|
||||
}
|
||||
|
||||
// File: contracts/upgradeability/OwnedUpgradeabilityStorage.sol
|
||||
|
||||
/**
|
||||
* @title OwnedUpgradeabilityStorage
|
||||
* @dev This is the storage necessary to perform upgradeable contracts.
|
||||
* This means, required state variables for upgradeability purpose and eternal storage per se.
|
||||
*/
|
||||
contract OwnedUpgradeabilityStorage is UpgradeabilityOwnerStorage, UpgradeabilityStorage, EternalStorage {}
|
||||
|
||||
// File: contracts/upgradeable_contracts/U_Validatable.sol
|
||||
|
||||
contract Validatable is OwnedUpgradeabilityStorage {
|
||||
contract Validatable is EternalStorage {
|
||||
|
||||
function validatorContract() public view returns(IBridgeValidators) {
|
||||
return IBridgeValidators(addressStorage[keccak256("validatorContract")]);
|
||||
|
@ -286,7 +221,7 @@ contract Validatable is OwnedUpgradeabilityStorage {
|
|||
|
||||
// File: contracts/upgradeable_contracts/U_HomeBridge.sol
|
||||
|
||||
contract HomeBridge is OwnedUpgradeabilityStorage, Validatable {
|
||||
contract HomeBridge is EternalStorage, Validatable {
|
||||
using SafeMath for uint256;
|
||||
event GasConsumptionLimitsUpdated(uint256 gas);
|
||||
event Deposit (address recipient, uint256 value);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var Migrations = artifacts.require("./Migrations.sol");
|
||||
|
||||
module.exports = async function(deployer) {
|
||||
await deployer.deploy(Migrations);
|
||||
const PROXY_OWNER = process.env.PROXY_OWNER || accounts[0];
|
||||
await deployer.deploy(Migrations, {from: PROXY_OWNER});
|
||||
};
|
||||
|
|
|
@ -97,7 +97,7 @@ contract('BridgeValidators', async (accounts) => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.only('#setRequiredSignatures', async () => {
|
||||
describe('#setRequiredSignatures', async () => {
|
||||
let owner = accounts[2];
|
||||
let validators = [accounts[0], accounts[1], accounts[3]];
|
||||
let requiredSignatures = 2;
|
||||
|
|
Loading…
Reference in New Issue