EthereumAdvanced

Storage packing

Placing multiple small contract variables into one EVM storage slot according to layout rules.

PLAIN-ENGLISH DEFINITION

In more detail

Packing can reduce the number of storage slots used, but the gas effect also depends on how values are accessed and updated. Reordering variables in an upgradeable contract can change their locations and corrupt existing state.

IN THE WILD

How you might use it

Two small integer fields share a storage slot because the compiler can fit both into its 32 bytes.

Got a way to make Storage packing click?

Add your take

By Crypto Dictionary · Published

Go to the source

Use the original reference to explore the details behind this entry.

Read the reference

An original explanation with a reference to follow. Protocol details and community usage can evolve. Sources & standards

PASS IT TO THE GROUP CHAT

Share a definition