Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 1.29 KB

Storage Layout for Mappings & Dynamic Arrays.md

File metadata and controls

23 lines (21 loc) · 1.29 KB

Due to their unpredictable size, mappings and dynamically-sized array types cannot be stored “in between” the state variables preceding and following them.

Instead, they are considered to occupy only 32 bytes with regards to the rules above and the elements they contain are stored starting at a different storage slot that is computed using a Keccak256 hash.


Slide Screenshot

121.jpg


Slide Text

  • Storage Layout
  • Unpredictable Size
  • Cannot be Stored In-Between Others
  • Occupy -> 32 Bytes
  • Elements -> Elsewhere
  • Elements -> Starting Slot
  • Keccak256 Hash

References


Tags

Storage, Stack Memory, Storage, and Flow Operations, Storage Layout, Storage Packing, Storage Layout & Ordering, [Storage Layout & Inheritance]