Incorrect storage slots for arrays declared with a constant or expression
naddison36 opened this issue · comments
Nick Addison commented
The TestStorage
contract has two examples
uint256 public constant N_COINS = 3;
address[N_COINS] coins;
IERC20[2 * N_COINS] doubleTokens;
IERC20[N_COINS ** 2] powerTokens;
The coins
variable is currently showing as only taking one slot but it actually takes three.
The doubleTokens
variable is currently showing as only taking one slot but it actually takes six.
Joey139 commented
uint256 public constant N_COINS = 3;
address[N_COINS] coins;
IERC20[2 * N_COINS] doubleTokens;
IERC20[N_COINS ** 2] powerTokens;