From cdf8f609cce934c474ec4383c202ad7555b3a583 Mon Sep 17 00:00:00 2001 From: perissology Date: Thu, 15 Feb 2018 15:42:19 -0800 Subject: [PATCH] fix multi-inheritance ordering w/ most base-like coming first, and reserve storage slots for future upgrades --- contracts/EscapableApp.sol | 1 + contracts/LiquidPledgingBase.sol | 2 +- contracts/LiquidPledgingPlugins.sol | 2 +- contracts/LiquidPledgingStorage.sol | 5 +++++ contracts/Pledges.sol | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/contracts/EscapableApp.sol b/contracts/EscapableApp.sol index fd2b2cd..87dce90 100644 --- a/contracts/EscapableApp.sol +++ b/contracts/EscapableApp.sol @@ -36,6 +36,7 @@ contract EscapableApp is AragonApp { address public escapeHatchDestination; mapping (address=>bool) private escapeBlacklist; // Token contract addresses + uint[20] private storageOffset; // reserve 20 slots for future upgrades /// @param _escapeHatchDestination The address of a safe location (usu a /// Multisig) to send the ether held in this contract; if a neutral address diff --git a/contracts/LiquidPledgingBase.sol b/contracts/LiquidPledgingBase.sol index 3bf313b..9634f30 100644 --- a/contracts/LiquidPledgingBase.sol +++ b/contracts/LiquidPledgingBase.sol @@ -27,7 +27,7 @@ import "./EscapableApp.sol"; /// @dev `LiquidPledgingBase` is the base level contract used to carry out /// liquidPledging's most basic functions, mostly handling and searching the /// data structures -contract LiquidPledgingBase is LiquidPledgingStorage, PledgeAdmins, Pledges, EscapableApp { +contract LiquidPledgingBase is EscapableApp, LiquidPledgingStorage, PledgeAdmins, Pledges { // Event Declarations event Transfer(uint indexed from, uint indexed to, uint amount); diff --git a/contracts/LiquidPledgingPlugins.sol b/contracts/LiquidPledgingPlugins.sol index b92489b..2bd8148 100644 --- a/contracts/LiquidPledgingPlugins.sol +++ b/contracts/LiquidPledgingPlugins.sol @@ -25,7 +25,7 @@ import "./LiquidPledgingStorage.sol"; /// NOTICE: This contract is not using EternalStorage. This is done to save gas. The pluginWhitelist /// should be fairly small, and would be trivial and relatively cheap to re-add all valid plugins /// when the LiquidPledging contract is upgraded -contract LiquidPledgingPlugins is LiquidPledgingStorage, AragonApp { +contract LiquidPledgingPlugins is AragonApp, LiquidPledgingStorage { bytes32 constant public PLUGIN_MANAGER_ROLE = keccak256("PLUGIN_MANAGER_ROLE"); diff --git a/contracts/LiquidPledgingStorage.sol b/contracts/LiquidPledgingStorage.sol index 8cf4740..15b11e7 100644 --- a/contracts/LiquidPledgingStorage.sol +++ b/contracts/LiquidPledgingStorage.sol @@ -54,4 +54,9 @@ contract LiquidPledgingStorage { bool public whitelistDisabled = false; ILPVault public vault; + + // reserve 50 slots for future upgrades. I'm not sure if this is necessary + // but b/c of multiple inheritance used in lp, better safe then sorry. + // especially since it is free + uint[50] private storageOffset; } \ No newline at end of file diff --git a/contracts/Pledges.sol b/contracts/Pledges.sol index 4901422..b83e29d 100644 --- a/contracts/Pledges.sol +++ b/contracts/Pledges.sol @@ -22,7 +22,7 @@ pragma solidity ^0.4.18; import "@aragon/os/contracts/apps/AragonApp.sol"; import "./LiquidPledgingStorage.sol"; -contract Pledges is LiquidPledgingStorage, AragonApp { +contract Pledges is AragonApp, LiquidPledgingStorage { // Limits inserted to prevent large loops that could prevent canceling uint constant MAX_DELEGATES = 10;