Skip to content

Commit

Permalink
Update docs/types/value-types.rst
Browse files Browse the repository at this point in the history
Co-authored-by: r0qs <rodrigo.saramago@protonmail.com>
  • Loading branch information
ustas-eth and r0qs committed Apr 26, 2024
1 parent 21a9d16 commit b4f2622
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/types/value-types.rst
Expand Up @@ -339,11 +339,11 @@ You can query the deployed code for any smart contract. Use ``.code`` to get the
(as a ``bytes32``). Note that ``addr.codehash`` is cheaper than using ``keccak256(addr.code)``.

.. warning::
The output of ``addr.codehash`` also depends on the ``addr`` balance and nonce. If ``addr``
is empty or non-existent (it has no code, zero balance, and zero nonce), ``addr.codehash``
will output ``0``. If balance or nonce is greater than 0, then ``addr.codehash`` will output
``keccak256("")``. See `EIP-1052 <https://eips.ethereum.org/EIPS/eip-1052>`_ for test cases
and `EIP-161 <https://eips.ethereum.org/EIPS/eip-161>`_ for the definition of an empty account.
The output of ``addr.codehash`` may be ``0`` if the account associated with ``addr`` is empty or non-existent
(i.e., it has no code, zero balance, and zero nonce as defined by `EIP-161 <https://eips.ethereum.org/EIPS/eip-161>`_).
If the account has no code but a non-zero balance or nonce, then ``addr.codehash`` will output the Keccak-256 hash of empty data
(i.e., ``keccak256("")`` which is equal to ``c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470``), as defined by
`EIP-1052 <https://eips.ethereum.org/EIPS/eip-1052>`_.

.. note::
All contracts can be converted to ``address`` type, so it is possible to query the balance of the
Expand Down

0 comments on commit b4f2622

Please sign in to comment.