is there a posible storage clash in smallProxy.sol that uses "delegateCall" between _IMPLEMENTATION_SLOT and value variables? #2310
-
why in the smallProxy.sol that uses "delegateCall" from import "@openzeppelin/contracts/proxy/Proxy.sol"; the vasriable "bytes32 private constant _IMPLEMENTATION_SLOT" doesn't clash with the implementation contract variable "uint256 public value;" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Code snippet for each please. |
Beta Was this translation helpful? Give feedback.
-
@krakxn there is no "storage" collision because for the constant and immutable state variables "The compiler does not reserve a storage slot for these variables, and every occurrence is replaced by the respective value." so those values are saved in the contract's deployed code itself. Patrick talk about this in the minute 12:10:15 of the 32 hours video and this detail is in the solidity docs in "contracts" section. Just a note: a non constant bytes state variable would have a storage slot in the EVM layout and then it could be participant in a storage collision. |
Beta Was this translation helpful? Give feedback.
@krakxn there is no "storage" collision because for the constant and immutable state variables "The compiler does not reserve a storage slot for these variables, and every occurrence is replaced by the respective value." so those values are saved in the contract's deployed code itself.
Patrick talk about this in the minute 12:10:15 of the 32 hours video and this detail is in the solidity docs in "contracts" section. Just a note: a non constant bytes state variable would have a storage slot in the EVM layout and then it could be participant in a storage collision.