Preserve old state meaning while reviewing new authority.
LET’S PICTURE IT
A new manual must still match the cabinet and its key holders.
SEE IT FOR YOURSELF
Pack small values into Solidity storage slotsStep 1 / 4
In this simple default-layout example, two uint128 values come before one uint256. Each slot holds thirty-two bytes.
In this simple default-layout example, two uint128 values come before one uint256. Each slot holds thirty-two bytes.The first sixteen-byte value occupies the low-order half of slot zero. Low-order bytes are shown on the right.The second uint128 fits in the remaining sixteen bytes. Both values now share slot zero.C needs a complete thirty-two-byte slot, so it begins at slot one. Two packed small values plus C use two slots.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Collect complete old and new layouts
Use exact sources, inherited declarations and compiler settings. Compare slot, byte offset and type for existing fields.
Inspect the proposed change
Reordering fields, changing widths or altering nested structures can reinterpret existing bytes. Appending fields also requires the relevant pattern’s compatibility analysis.
Review the execution and authority paths
Determine who can install the implementation and how initialization runs. Correct layout does not compensate for an unprotected upgrade function.
Test with populated old state
Set representative records, upgrade locally and assert preserved values and permissions. Include packed fields, dynamic structures and failed unauthorized attempts where present.