aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-08-30 03:12:35 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-08-30 03:12:35 +0800
commit6a6976dc1922903e847b59ee57c09a86aeaa38f5 (patch)
treef47037e966f265f10fc16180616e8f5f36f55a50 /docs
parent0b89e1e98ce75ba4ed9ecd7b2e5de2f51a810622 (diff)
downloaddexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar.gz
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar.bz2
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar.lz
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar.xz
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.tar.zst
dexon-solidity-6a6976dc1922903e847b59ee57c09a86aeaa38f5.zip
Document constant behaviour for hashes
Diffstat (limited to 'docs')
-rw-r--r--docs/units-and-global-variables.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index d1d578ed..3b5d5802 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -109,6 +109,10 @@ This means that the following are all identical::
If padding is needed, explicit type conversions can be used: ``sha3("\x00\x12")`` is the
same as ``sha3(uint16(0x12))``.
+Note that constants will packed using the minimum number of bytes required to store them.
+This means that, for example, ``sha3(0) == sha3(uint8(0))`` and
+``sha3(0x12345678) == sha3(uint32(0x12345678))``.
+
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.
.. _address_related: