If you have a dynamic array that stores
bytes32 (called arr) and do
arr.length--; (Assuming there is no underflow protection, i.e. pre solc 0.8.0) Then the length of
arr would become 2^256 - 1, taking up the entire storage space, thus allowing you to manipulate different state variables indirectly via this array.
Where in the storage would you access the last member of the array? My guess is the last item of the array would be keccak256(p) - 1 although i am uncertain.
If you change the storage slot that keeps the length of the array (position p) to 500 for example, what would happen to other slots previously designated to the array, e.g. lets say slot 2^256 -1 currently holds 0x10 (padded with 0's to reach 32 bytes) what happens to this slot once the length of
arr is changed to 500?
For some context: https://listed.to/@r1oga/13892/ethernaut-levels-19-to-21#AlienCodex
Read the section on level 20 (alien codex).