Clarify block.* and tx.* values in off-chain calls

Looks like this may vary between different EVM implementations and confuses users.
This commit is contained in:
Mikko Ohtamaa 2021-09-09 20:00:26 +02:00 committed by Kamil Śliwak
parent 1e630fc584
commit 025bbbad82
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).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::
Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness,
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.
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::
Do not rely on ``block.timestamp`` or ``blockhash`` as a source of randomness,
unless you know what you are doing.