aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-09 06:29:06 +0800
committerGitHub <noreply@github.com>2018-08-09 06:29:06 +0800
commitcbd64e0e1183869671b394ea98b774f7b7445665 (patch)
treec95bdfd8dfb9b6b4274e32e71678cfd0685a087a
parent478012a00058767ab82b17a8cb21bfa5f6e7ee44 (diff)
parentf01689ac77bc8f87fe9b6b8de3338bfa2cd87706 (diff)
downloaddexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar.gz
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar.bz2
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar.lz
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar.xz
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.tar.zst
dexon-solidity-cbd64e0e1183869671b394ea98b774f7b7445665.zip
Merge pull request #4773 from ethereum/chriseth-patch-1
Clarify packed encoding.
-rw-r--r--docs/abi-spec.rst12
1 files changed, 5 insertions, 7 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index ec84d123..be645b5c 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -565,14 +565,13 @@ Non-standard Packed Mode
Through ``abi.encodePacked()``, Solidity supports a non-standard packed mode where:
-- no :ref:`function selector <abi_function_selector>` is encoded,
- types shorter than 32 bytes are neither zero padded nor sign extended and
- dynamic types are encoded in-place and without the length.
-As an example encoding ``int1, bytes1, uint16, string`` with values ``-1, 0x42, 0x2424, "Hello, world!"`` results in ::
+As an example encoding ``int8, bytes1, uint16, string`` with values ``-1, 0x42, 0x2424, "Hello, world!"`` results in ::
0xff42242448656c6c6f2c20776f726c6421
- ^^ int1(-1)
+ ^^ int8(-1)
^^ bytes1(0x42)
^^^^ uint16(0x2424)
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
@@ -582,8 +581,7 @@ and dynamically-sized types like ``string``, ``bytes`` or ``uint[]`` are encoded
their length field. This means that the encoding is ambiguous as soon as there are two
dynamically-sized elements.
-Note that constants will be packed using the minimum number of bytes required to store them.
-This means that, for example, ``abi.encodePacked(0) == abi.encodePacked(uint8(0)) == hex"00"`` and
-``abi.encodePacked(0x12345678) == abi.encodePacked(uint32(0x12345678)) == hex"12345678"``.
-
If padding is needed, explicit type conversions can be used: ``abi.encodePacked(uint16(0x12)) == hex"0012"``.
+
+Since packed encoding is not used when calling functions, there is no special support
+for prepending a function selector.