aboutsummaryrefslogtreecommitdiffstats
path: root/docs/rlp_tests/index.rst
blob: 2d812aae663c12352dab9663e7b307925c668843 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.. _rlp_tests:

RLP Tests
=========

Describes an **RLP** (https://github.com/ethereum/wiki/wiki/RLP) encoding using 
the .json file.

=================== ==============================================================
Location            `/RLPTests <https://github.com/ethereum/tests/tree/develop/RLPTests>`_
Supported Hardforks Hardfork-independent
Status              Actively supported
=================== ==============================================================


Test Implementation
-------------------

The client should read the rlp byte stream, **decode** and check 
whether the contents match its json representation. Then it should try do it 
reverse - **encode** json rlp representation into rlp byte stream and check whether 
it matches the given rlp byte stream.

If it is an invalid RLP byte stream in the test, then 'in' field would contain string ``INVALID``.

Some RLP byte streams are expected to be generated by fuzz test suite. For those 
examples 'in' field would contain string ``VALID`` as it means that rlp should be easily decoded.

**Note** that RLP tests are testing a single RLP object encoding and not a stream of 
RLP objects in one array.

Test Structure
--------------

::

    {
       "rlpTest": {
        "in": "dog",
        "out": "83646f67"
       },

       "multilist": {
        "in": [ "zw", [ 4 ], 1 ],
        "out": "c6827a77c10401"
       },

       "validRLP": {
        "in": "VALID",
        "out": "c7c0c1c0c3c0c1c0"
       },

       "invalidRLP": {
        "in": "INVALID",
        "out": "bf0f000000000000021111"
       },
       ...
    }

Sections
^^^^^^^^

* ``in`` - json object (array, int, string) representation of the rlp byte stream (\*except values ``VALID`` and ``INVALID``)
* ``out`` - string of rlp bytes stream