aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-16 06:13:21 +0800
committerGitHub <noreply@github.com>2018-08-16 06:13:21 +0800
commitcc6fa6d61fb934617d088bb04766ef0dea614b4f (patch)
tree3256618e2b268924442ea55e45622313969bad80 /docs
parentc164f80ba6b1c6753450b59365d1e0f1633688db (diff)
parentdb48925907ef4b31025f83ca83298483c4860583 (diff)
downloaddexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar.gz
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar.bz2
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar.lz
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar.xz
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.tar.zst
dexon-solidity-cc6fa6d61fb934617d088bb04766ef0dea614b4f.zip
Merge pull request #4822 from ethereum/addressStaticCall
Add ``staticcall`` to ``address``.
Diffstat (limited to 'docs')
-rw-r--r--docs/control-structures.rst6
-rw-r--r--docs/security-considerations.rst3
-rw-r--r--docs/types.rst8
-rw-r--r--docs/units-and-global-variables.rst4
4 files changed, 13 insertions, 8 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index def75132..d0e58908 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -412,11 +412,11 @@ The deprecated keyword ``throw`` can also be used as an alternative to ``revert(
From version 0.4.13 the ``throw`` keyword is deprecated and will be phased out in the future.
When exceptions happen in a sub-call, they "bubble up" (i.e. exceptions are rethrown) automatically. Exceptions to this rule are ``send``
-and the low-level functions ``call``, ``delegatecall`` and ``callcode`` -- those return ``false`` in case
+and the low-level functions ``call``, ``delegatecall``, ``callcode`` and ``staticcall`` -- those return ``false`` in case
of an exception instead of "bubbling up".
.. warning::
- The low-level ``call``, ``delegatecall`` and ``callcode`` will return success if the called account is non-existent, as part of the design of EVM. Existence must be checked prior to calling if desired.
+ The low-level ``call``, ``delegatecall``, ``callcode`` and ``staticcall`` will return success if the called account is non-existent, as part of the design of EVM. Existence must be checked prior to calling if desired.
Catching exceptions is not yet possible.
@@ -455,7 +455,7 @@ A ``require``-style exception is generated in the following situations:
#. Calling ``throw``.
#. Calling ``require`` with an argument that evaluates to ``false``.
-#. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
+#. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall``, ``callcode`` or ``staticcall`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
#. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
#. If you perform an external function call targeting a contract that contains no code.
#. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst
index 5bb3d81d..066a31ea 100644
--- a/docs/security-considerations.rst
+++ b/docs/security-considerations.rst
@@ -171,7 +171,8 @@ before they interact with your contract.
Note that ``.send()`` does **not** throw an exception if the call stack is
depleted but rather returns ``false`` in that case. The low-level functions
-``.call()``, ``.callcode()`` and ``.delegatecall()`` behave in the same way.
+``.call()``, ``.callcode()``, ``.delegatecall()`` and ``.staticcall()`` behave
+in the same way.
tx.origin
=========
diff --git a/docs/types.rst b/docs/types.rst
index 6024cbb7..03fd36d9 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -91,7 +91,7 @@ Operators:
defined in the latter. Generally, in floating point almost the entire space is used to represent the number, while only a small number of bits define
where the decimal point is.
-.. index:: address, balance, send, call, callcode, delegatecall, transfer
+.. index:: address, balance, send, call, callcode, delegatecall, staticcall, transfer
.. _address:
@@ -146,7 +146,7 @@ Send is the low-level counterpart of ``transfer``. If the execution fails, the c
to make safe Ether transfers, always check the return value of ``send``, use ``transfer`` or even better:
use a pattern where the recipient withdraws the money.
-* ``call``, ``callcode`` and ``delegatecall``
+* ``call``, ``callcode``, ``delegatecall`` and ``staticcall``
Furthermore, to interface with contracts that do not adhere to the ABI,
or to get more direct control over the encoding,
@@ -189,7 +189,9 @@ Lastly, these modifiers can be combined. Their order does not matter::
In a similar way, the function ``delegatecall`` can be used: the difference is that only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract. The purpose of ``delegatecall`` is to use library code which is stored in another contract. The user has to ensure that the layout of storage in both contracts is suitable for delegatecall to be used. Prior to homestead, only a limited variant called ``callcode`` was available that did not provide access to the original ``msg.sender`` and ``msg.value`` values.
-All three functions ``call``, ``delegatecall`` and ``callcode`` are very low-level functions and should only be used as a *last resort* as they break the type-safety of Solidity.
+Since byzantium ``staticcall`` can be used as well. This is basically the same as ``call``, but will revert, if the called function modifies the state in any way.
+
+All four functions ``call``, ``delegatecall``, ``callcode`` and ``staticcall`` are very low-level functions and should only be used as a *last resort* as they break the type-safety of Solidity.
The ``.gas()`` option is available on all three methods, while the ``.value()`` option is not supported for ``delegatecall``.
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 2c571a45..28c9e6ab 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -153,7 +153,7 @@ Mathematical and Cryptographic Functions
It might be that you run into Out-of-Gas for ``sha256``, ``ripemd160`` or ``ecrecover`` on a *private blockchain*. The reason for this is that those are implemented as so-called precompiled contracts and these contracts only really exist after they received the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution runs into an Out-of-Gas error. A workaround for this problem is to first send e.g. 1 Wei to each of the contracts before you use them in your actual contracts. This is not an issue on the official or test net.
-.. index:: balance, send, transfer, call, callcode, delegatecall
+.. index:: balance, send, transfer, call, callcode, delegatecall, staticcall
.. _address_related:
Address Related
@@ -171,6 +171,8 @@ Address Related
issue low-level ``CALLCODE`` with the given payload, returns ``false`` on failure, forwards all available gas, adjustable
``<address>.delegatecall(bytes memory) returns (bool)``:
issue low-level ``DELEGATECALL`` with the given payload, returns ``false`` on failure, forwards all available gas, adjustable
+``<address>.staticcall(bytes memory) returns (bool)``:
+ issue low-level ``STATICCALL`` with the given payload, returns ``false`` on failure, forwards all available gas, adjustable
For more information, see the section on :ref:`address`.