Skip to content

Commit ddccd73

Browse files
committed
Fix outdated references to byte[] type (it's now bytes1[])
1 parent 691083c commit ddccd73

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

docs/assembly.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ This means that the allocatable memory starts at ``0x80``, which is the initial
234234
of the free memory pointer.
235235

236236
Elements in memory arrays in Solidity always occupy multiples of 32 bytes (this is
237-
even true for ``byte[]``, but not for ``bytes`` and ``string``). Multi-dimensional memory
237+
even true for ``bytes1[]``, but not for ``bytes`` and ``string``). Multi-dimensional memory
238238
arrays are pointers to memory arrays. The length of a dynamic array is stored at the
239239
first slot of the array and followed by the array elements.
240240

docs/internals/layout_in_memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Solidity always places new objects at the free memory pointer and
1919
memory is never freed (this might change in the future).
2020

2121
Elements in memory arrays in Solidity always occupy multiples of 32 bytes (this
22-
is even true for ``byte[]``, but not for ``bytes`` and ``string``).
22+
is even true for ``bytes1[]``, but not for ``bytes`` and ``string``).
2323
Multi-dimensional memory arrays are pointers to memory arrays. The length of a
2424
dynamic array is stored at the first slot of the array and followed by the array
2525
elements.

docs/types/reference-types.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ a reference to it.
139139
``bytes`` and ``string`` as Arrays
140140
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141141

142-
Variables of type ``bytes`` and ``string`` are special arrays. A ``bytes`` is similar to ``byte[]``,
142+
Variables of type ``bytes`` and ``string`` are special arrays. The ``bytes`` type is similar to ``bytes1[]``,
143143
but it is packed tightly in calldata and memory. ``string`` is equal to ``bytes`` but does not allow
144144
length or index access.
145145

@@ -148,8 +148,8 @@ third-party string libraries. You can also compare two strings by their keccak25
148148
``keccak256(abi.encodePacked(s1)) == keccak256(abi.encodePacked(s2))`` and
149149
concatenate two strings using ``bytes.concat(bytes(s1), bytes(s2))``.
150150

151-
You should use ``bytes`` over ``byte[]`` because it is cheaper,
152-
since ``byte[]`` adds 31 padding bytes between the elements. As a general rule,
151+
You should use ``bytes`` over ``bytes1[]`` because it is cheaper,
152+
since ``bytes1[]`` adds 31 padding bytes between the elements. As a general rule,
153153
use ``bytes`` for arbitrary-length raw byte data and ``string`` for arbitrary-length
154154
string (UTF-8) data. If you can limit the length to a certain number of bytes,
155155
always use one of the value types ``bytes1`` to ``bytes32`` because they are much cheaper.

docs/types/value-types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ Members:
398398
* ``.length`` yields the fixed length of the byte array (read-only).
399399

400400
.. note::
401-
The type ``byte[]`` is an array of bytes, but due to padding rules, it wastes
401+
The type ``bytes1[]`` is an array of bytes, but due to padding rules, it wastes
402402
31 bytes of space for each element (except in storage). It is better to use the ``bytes``
403403
type instead.
404404

0 commit comments

Comments
 (0)