Skip to content

Conversation

@nadir-akhtar
Copy link
Collaborator

Storage gaps should add up to 50. As demonstrated by inspecting storage via forge:

% forge inspect ProtocolRegistryStorage storage

╭--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------╮
| Name               | Type                                                               | Slot | Offset | Bytes | Contract                                                                       |
+==================================================================================================================================================================================================+
| _semanticVersion   | ShortString                                                        | 0    | 0      | 32    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| _deployments       | struct EnumerableMap.UintToAddressMap                              | 1    | 0      | 96    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| _deploymentConfigs | mapping(address => struct IProtocolRegistryTypes.DeploymentConfig) | 4    | 0      | 32    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| __gap              | uint256[47]                                                        | 5    | 0      | 1504  | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
╰--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------╯

The __gap begins at slot 5 -- however, the gap is of size 47, which adds up to 52. Though this is not an issue, it does defy convention, and can cause confusion later if a developer assumes the gap needs to be corrected to add up to 50.

@nadir-akhtar nadir-akhtar force-pushed the nadir/protocol-registry-storage-gap branch from 15d6d26 to b3021f0 Compare December 2, 2025 08:03
@ypatil12 ypatil12 merged commit 2eaee42 into release-dev/slashing-ux-improvements Dec 2, 2025
9 checks passed
@ypatil12 ypatil12 deleted the nadir/protocol-registry-storage-gap branch December 2, 2025 14:32
ypatil12 added a commit that referenced this pull request Dec 2, 2025
Storage gaps should add up to 50. As demonstrated by inspecting storage
via `forge`:

```txt
% forge inspect ProtocolRegistryStorage storage

╭--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------╮
| Name               | Type                                                               | Slot | Offset | Bytes | Contract                                                                       |
+==================================================================================================================================================================================================+
| _semanticVersion   | ShortString                                                        | 0    | 0      | 32    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| _deployments       | struct EnumerableMap.UintToAddressMap                              | 1    | 0      | 96    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| _deploymentConfigs | mapping(address => struct IProtocolRegistryTypes.DeploymentConfig) | 4    | 0      | 32    | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
|--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------|
| __gap              | uint256[47]                                                        | 5    | 0      | 1504  | src/contracts/core/storage/ProtocolRegistryStorage.sol:ProtocolRegistryStorage |
╰--------------------+--------------------------------------------------------------------+------+--------+-------+--------------------------------------------------------------------------------╯
```

The `__gap` begins at slot `5` -- however, the gap is of size `47`,
which adds up to `52`. Though this is not an issue, it does defy
convention, and can cause confusion later if a developer assumes the gap
needs to be corrected to add up to 50.

---------

Co-authored-by: Nadir Akhtar <[email protected]>
Co-authored-by: Yash Patil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants