Skip to content

Doc fix and clarification for n_slots in custom layout file #4641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/scoping-and-declarations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ This issue can be avoided by allocating ``balanceOf`` to ``slot1`` using the sto
.. code-block:: json

{
"owner": {"type": "address", "slot": 0},
"minter": {"type": "address", "slot": 2},
"balanceOf": {"type": "HashMap[address, uint256]", "slot": 1}
"owner": {"type": "address", "n_slots": 1, "slot": 0},
"minter": {"type": "address", "n_slots": 1, "slot": 2},
"balanceOf": {"type": "HashMap[address, uint256]", "n_slots": 1, "slot": 1}
}

When creating a custom storage layout, you must also include ``n_slots`` for each storage variable. This tells the compiler how many 32 byte slots to allocate from the ``slot`` storage offset.

For further information on generating the storage layout, see :ref:`Storage Layout <compiler-storage-layout>`.

Scoping Rules
Expand Down