Foundation for questions: scenario where multiple parent (base) contracts are inherited:
contract Base1 {
// do something
uint256[1000] private __gap;
}
contract Base2 {
// do something
uint256[1000] private __gap;
}
contract Child is Base1, Base2 {
uint256 testVariable = 123;
}
Questions:
-
If a large storage gap is left, you could theoretically replace
Base2
with two new contracts (ex:Base2A
andBase2B
), so long as the storage used, including gaps, for both sums to the total gap left by the original Base2, right? -
On implementation upgrades, since storage variables from previous implementations can't be removed, but byte code can nevertheless be reduced (ex: nuking
Base2
's code), each proxy upgrade is still ultimately constrained by the max contract size. To be clear, the available bytecode space would be24576 bytes - contract_to_replace_size
. Given that the legacy storage variables fromBase2
are still taking up storage slots, they would eat into the available bytecode space for implementation upgrades, correct? In other words, even if, like in #1, large gaps were left, you cant continue replacing parent contracts forever, because each replacement leaves behind non-removable storage variables that eats into contract size?