aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorRobbie Ferguson <robbieferguson139@gmail.com>2018-02-27 18:48:16 +0800
committerchriseth <chris@ethereum.org>2018-04-06 22:38:59 +0800
commit49567b3f4c216b3345cd5e6c2f2a9a3b27b54fb6 (patch)
tree9fc119be16c25614e5ff8add295f282c7b9e07d7 /docs
parent866df15daa21ff55ebd7084976a32cd698fcdb9e (diff)
downloaddexon-solidity-49567b3f4c216b3345cd5e6c2f2a9a3b27b54fb6.tar.gz
dexon-solidity-49567b3f4c216b3345cd5e6c2f2a9a3b27b54fb6.tar.zst
dexon-solidity-49567b3f4c216b3345cd5e6c2f2a9a3b27b54fb6.zip
Update Delegatecall Description in Docs
The previous description did not include the fact that the storage locations of the two contracts must align up until the storage variable(s) affected in order for the called contract to successfully write to the caller's storage. If they are misaligned, delegatecall will silently fail. This is difficult to debug without underlying knowledge of how delegatecall works, and clarity in the docs would certainly be helpful.
Diffstat (limited to 'docs')
-rw-r--r--docs/units-and-global-variables.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 2571f20a..e7f41ed1 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -169,6 +169,13 @@ For more information, see the section on :ref:`address`.
Use a pattern where the recipient withdraws the money.
.. note::
+ If storage variables are accessed via a low-level delegatecall, the storage layout of the two contracts
+ must align in order for the called contract to correctly access the storage variables of the calling contract by name.
+ This is of course not the case if storage pointers are passed as function arguments as in the case for
+ the high-level libraries.
+
+
+.. note::
The use of ``callcode`` is discouraged and will be removed in the future.
.. index:: this, selfdestruct