Skip to content

Commit c353eb0

Browse files
axiccameel
authored andcommitted
Document difficulty vs. prevrandao
1 parent eb8af2c commit c353eb0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/using-the-compiler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ at each version. Backward compatibility is not guaranteed between each version.
173173
- ``london`` (**default**)
174174
- The block's base fee (`EIP-3198 <https://eips.ethereum.org/EIPS/eip-3198>`_ and `EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`_) can be accessed via the global ``block.basefee`` or ``basefee()`` in inline assembly.
175175
- ``paris``
176-
- No changes.
176+
- No changes, however the semantics of the ``difficulty`` value have changed (see `EIP-4399 <https://eips.ethereum.org/EIPS/eip-4399>`_).
177177

178178
.. index:: ! standard JSON, ! --standard-json
179179
.. _compiler-api:

docs/yul.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ the ``dup`` and ``swap`` instructions as well as ``jump`` instructions, labels a
933933
+-------------------------+-----+---+-----------------------------------------------------------------+
934934
| number() | | F | current block number |
935935
+-------------------------+-----+---+-----------------------------------------------------------------+
936-
| difficulty() | | F | difficulty of the current block |
936+
| difficulty() | | F | difficulty of the current block (see note below) |
937937
+-------------------------+-----+---+-----------------------------------------------------------------+
938938
| gaslimit() | | F | block gas limit of the current block |
939939
+-------------------------+-----+---+-----------------------------------------------------------------+
@@ -948,6 +948,13 @@ the ``dup`` and ``swap`` instructions as well as ``jump`` instructions, labels a
948948
You need to use the ``returndatasize`` opcode to check which part of this memory area contains the return data.
949949
The remaining bytes will retain their values as of before the call.
950950

951+
.. note::
952+
With the Paris network upgrade the semantics of ``difficulty`` have been changed.
953+
It returns the value of ``prevrandao``, which is a 256-bit value, whereas the highest recorded
954+
difficulty value within Ethash was ~54 bits.
955+
This change is described in `EIP-4399 <https://eips.ethereum.org/EIPS/eip-4399>`_.
956+
Please note that irrelevant to which EVM version is selected in the compiler, the semantics of
957+
instructions depend on the final chain of deployment.
951958

952959
In some internal dialects, there are additional functions:
953960

0 commit comments

Comments
 (0)