Merge pull request #11923 from miohtama/patch-4

Clarify `block.*` and `tx.*` values in off-chain calls
This commit is contained in:
chriseth 2021-10-19 13:36:22 +02:00 committed by GitHub
commit 7fba9ab245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -130,6 +130,12 @@ Global Variables
- ``type(T).min`` (``T``): the minimum value representable by the integer type ``T``, see :ref:`Type Information<meta-type>`. - ``type(T).min`` (``T``): the minimum value representable by the integer type ``T``, see :ref:`Type Information<meta-type>`.
- ``type(T).max`` (``T``): the maximum value representable by the integer type ``T``, see :ref:`Type Information<meta-type>`. - ``type(T).max`` (``T``): the maximum value representable by the integer type ``T``, see :ref:`Type Information<meta-type>`.
.. note::
When contracts are evaluated off-chain rather than in context of a transaction included in a
block, you should not assume that ``block.*`` and ``tx.*`` refer to values from any specific
block or transaction. These values are provided by the EVM implementation that executes the
contract and can be arbitrary.
.. note:: .. note::
Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness, Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness,
unless you know what you are doing. unless you know what you are doing.

View File

@ -92,6 +92,12 @@ Block and Transaction Properties
``msg.value`` can change for every **external** function call. ``msg.value`` can change for every **external** function call.
This includes calls to library functions. This includes calls to library functions.
.. note::
When contracts are evaluated off-chain rather than in context of a transaction included in a
block, you should not assume that ``block.*`` and ``tx.*`` refer to values from any specific
block or transaction. These values are provided by the EVM implementation that executes the
contract and can be arbitrary.
.. note:: .. note::
Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness, Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness,
unless you know what you are doing. unless you know what you are doing.