I use upgradable smart contract .I have several Base contracts that use in my Main contract, Base contracts have __gap . when I add state variable to Base contract and reduce __gap array , I get this Error :
//For New Variable that added to Base contract
New variables should be placed after all existing inherited variables
//For reduce __gap array size in Base contract
- Bad array resize from 49 to 48
Size cannot decrease
Code to reproduce
abstract contract Base1 {
uint256 val1;
uint256[49] private ______gap;
}
abstract contract Base2 {
uint256 val2;
uint256[49] private ______gap;
}
contract Child is Base1, Base2 {
}
and new contracts:
abstract contract Base1V2 {
uint256 val1;
uint256 val3;
uint256[48] private ______gap;
}
abstract contract Base2 {
uint256 val2;
uint256[49] private ______gap;
}
contract Child is Base1V2, Base2 {}
Environment
I am using Truffle and uups upgradable proxy