Merge pull request #12256 from ethereum/clarifyPure

Clarify ``pure``.
This commit is contained in:
chriseth 2021-11-08 16:04:15 +01:00 committed by GitHub
commit b6d69eea47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,6 +222,9 @@ Pure Functions
--------------
Functions can be declared ``pure`` in which case they promise not to read from or modify the state.
In particular, it should be possible to evaluate a ``pure`` function at compile-time given
only its inputs and ``msg.data``, but without any knowledge of the current blockchain state.
This means that reading from ``immutable`` variables can be a non-pure operation.
.. note::
If the compiler's EVM target is Byzantium or newer (default) the opcode ``STATICCALL`` is used,