improve packed encoding test vector

packed byte length of ints now unambiguously shown to be type-dependent, not value dependent e.g. uint16(0x03) is 0x0003 not 0x03
This commit is contained in:
Evan Saulpaugh 2019-01-18 02:30:15 -06:00 committed by GitHub
parent 2ec997e697
commit bda0bc8f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -611,15 +611,15 @@ Through ``abi.encodePacked()``, Solidity supports a non-standard packed mode whe
This packed mode is mainly used for indexed event parameters.
As an example, the encoding of ``int8(-1), bytes1(0x42), uint16(0x2424), string("Hello, world!")`` results in:
As an example, the encoding of ``int16(-1), bytes1(0x42), uint16(0x03), string("Hello, world!")`` results in:
.. code-block:: none
0xff42242448656c6c6f2c20776f726c6421
^^ int8(-1)
^^ bytes1(0x42)
^^^^ uint16(0x2424)
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
0xffff42000348656c6c6f2c20776f726c6421
^^^^ int16(-1)
^^ bytes1(0x42)
^^^^ uint16(0x03)
^^^^^^^^^^^^^^^^^^^^^^^^^^ string("Hello, world!") without a length field
More specifically:
- Each value type takes as many bytes as its range has.