Skip to content

Conversation

@matheusaaguiar
Copy link
Collaborator

@matheusaaguiar matheusaaguiar commented Feb 26, 2025

Part of #597/#15727.

@matheusaaguiar matheusaaguiar added this to the 0.8.29 milestone Feb 26, 2025
@matheusaaguiar matheusaaguiar marked this pull request as draft February 26, 2025 15:52
@matheusaaguiar matheusaaguiar force-pushed the storageLayoutSpecifierDocs branch from 50ba958 to 88792ee Compare February 26, 2025 17:14
@matheusaaguiar matheusaaguiar self-assigned this Feb 26, 2025
@cameel
Copy link
Collaborator

cameel commented Feb 27, 2025

Please link to the issue in PR description.

a contract definition, either after or before the inheritance specifier.
It can be given at most once.
The ``base-slot-expression`` must be an expression consisting of number literals
that can be evaluated at compile time and yield in a rational value in the range of ``uint256``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps another section describing that the max number of available storage slots will be (uint256::max - user defined base slot address + 1), and that a revert will be triggered in case an attempt is made to exceed the maximum number of available slots.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a revert. A compilation error.

@matheusaaguiar matheusaaguiar force-pushed the storageLayoutSpecifierDocs branch from 803a4b2 to 74f84d3 Compare March 4, 2025 21:49
Copy link
Collaborator

@cameel cameel Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this page still says that the storage always starts at zero:

Except for dynamically-sized arrays and mappings (see below), data is stored
contiguously item after item starting with the first state variable,
which is stored in slot ``0``. For each variable,

Please also check if there's anything in the rest of the text that needs updating too.

@nikola-matic nikola-matic force-pushed the storageLayoutSpecifierDocs branch from 8c93ccf to 4034c14 Compare March 10, 2025 08:34
@nikola-matic nikola-matic marked this pull request as ready for review March 10, 2025 08:34
@matheusaaguiar matheusaaguiar force-pushed the storageLayoutSpecifierDocs branch from 5ccc7d7 to cbd4ad8 Compare March 10, 2025 21:25
@matheusaaguiar matheusaaguiar force-pushed the storageLayoutSpecifierDocs branch from 5e46227 to 05b0efb Compare March 11, 2025 03:16
cameel
cameel previously approved these changes Mar 11, 2025
Copy link
Collaborator

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a final pass over the PR, doing proofreading, fixing some grammar and generally rewording things to sound nicer. I also added some diagrams to your example (this is what I meant by showing the layout) and also extended the example to show more things (dynamic variables, more complex packing, etc.)

I pushed that as fixups just now. Please take a look and if you're fine with it, please squash, rebase and we can merge.

@ekpyron ekpyron merged commit 0598c01 into develop Mar 11, 2025
74 checks passed
@ekpyron ekpyron deleted the storageLayoutSpecifierDocs branch March 11, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants