From 4b9205cb2fcdf02460fdf5aa09599558072bc927 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Thu, 14 Feb 2019 14:38:12 -0500 Subject: [PATCH 1/3] consistently use `0x` prefixes in RLP tests This finishes what https://github.com/ethereum/tests/pull/557 started, to use 0x prefixes consistently in rlptest.json, invalidRLPTest.json, and RandomRLPTests/example.json. This also updates the documentation in rlp_tests.rst describe the `0x` and `#` prefixes. --- RLPTests/RandomRLPTests/example.json | 2 +- RLPTests/invalidRLPTest.json | 18 +++++++++--------- docs/test_types/rlp_tests.rst | 15 +++++++++++---- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/RLPTests/RandomRLPTests/example.json b/RLPTests/RandomRLPTests/example.json index e395204d03c..d18fd3e8c39 100644 --- a/RLPTests/RandomRLPTests/example.json +++ b/RLPTests/RandomRLPTests/example.json @@ -1,6 +1,6 @@ { "listsoflists2": { "in": "VALID", - "out": "c7c0c1c0c3c0c1c0" + "out": "0xc7c0c1c0c3c0c1c0" } } diff --git a/RLPTests/invalidRLPTest.json b/RLPTests/invalidRLPTest.json index 1f9b806c8da..515caa46ca2 100644 --- a/RLPTests/invalidRLPTest.json +++ b/RLPTests/invalidRLPTest.json @@ -1,46 +1,46 @@ { "int32Overflow": { "in": "INVALID", - "out": "bf0f000000000000021111" + "out": "0xbf0f000000000000021111" }, "int32Overflow2": { "in": "INVALID", - "out": "ff0f000000000000021111" + "out": "0xff0f000000000000021111" }, "wrongSizeList": { "in": "INVALID", - "out": "f80180" + "out": "0xf80180" }, "wrongSizeList2": { "in": "INVALID", - "out": "f80100" + "out": "0xf80100" }, "incorrectLengthInArray": { "in": "INVALID", - "out": "b9002100dc2b275d0f74e8a53e6f4ec61b27f24278820be3f82ea2110e582081b0565df0" + "out": "0xb9002100dc2b275d0f74e8a53e6f4ec61b27f24278820be3f82ea2110e582081b0565df0" }, "randomRLP": { "in": "INVALID", - "out": "f861f83eb9002100dc2b275d0f74e8a53e6f4ec61b27f24278820be3f82ea2110e582081b0565df027b90015002d5ef8325ae4d034df55d4b58d0dfba64d61ddd17be00000b9001a00dae30907045a2f66fa36f2bb8aa9029cbb0b8a7b3b5c435ab331" + "out": "0xf861f83eb9002100dc2b275d0f74e8a53e6f4ec61b27f24278820be3f82ea2110e582081b0565df027b90015002d5ef8325ae4d034df55d4b58d0dfba64d61ddd17be00000b9001a00dae30907045a2f66fa36f2bb8aa9029cbb0b8a7b3b5c435ab331" }, "bytesShouldBeSingleByte00": { "in": "INVALID", - "out": "8100" + "out": "0x8100" }, "bytesShouldBeSingleByte01": { "in": "INVALID", - "out": "8101" + "out": "0x8101" }, "bytesShouldBeSingleByte7F": { "in": "INVALID", - "out": "817F" + "out": "0x817F" } } diff --git a/docs/test_types/rlp_tests.rst b/docs/test_types/rlp_tests.rst index 2d812aae663..381b54ca025 100644 --- a/docs/test_types/rlp_tests.rst +++ b/docs/test_types/rlp_tests.rst @@ -37,22 +37,22 @@ Test Structure { "rlpTest": { "in": "dog", - "out": "83646f67" + "out": "0x83646f67" }, "multilist": { "in": [ "zw", [ 4 ], 1 ], - "out": "c6827a77c10401" + "out": "0xc6827a77c10401" }, "validRLP": { "in": "VALID", - "out": "c7c0c1c0c3c0c1c0" + "out": "0xc7c0c1c0c3c0c1c0" }, "invalidRLP": { "in": "INVALID", - "out": "bf0f000000000000021111" + "out": "0xbf0f000000000000021111" }, ... } @@ -62,3 +62,10 @@ Sections * ``in`` - json object (array, int, string) representation of the rlp byte stream (\*except values ``VALID`` and ``INVALID``) * ``out`` - string of rlp bytes stream + +When a json string starts with ``0x``, the rest of the string is interpreted as +hex bytes, and when one starts with ``#``, the rest is interpreted as a decimal +number. + +The ``out`` strings normally start with ``0x`` to be interpreted as hex bytes +bytes. From 8a968ca939321eecc2aaceb91f79e68c32fa4966 Mon Sep 17 00:00:00 2001 From: Alex Knauth Date: Thu, 14 Feb 2019 15:21:51 -0500 Subject: [PATCH 2/3] fix repeated word --- docs/test_types/rlp_tests.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/test_types/rlp_tests.rst b/docs/test_types/rlp_tests.rst index 381b54ca025..be1256e80a5 100644 --- a/docs/test_types/rlp_tests.rst +++ b/docs/test_types/rlp_tests.rst @@ -67,5 +67,4 @@ When a json string starts with ``0x``, the rest of the string is interpreted as hex bytes, and when one starts with ``#``, the rest is interpreted as a decimal number. -The ``out`` strings normally start with ``0x`` to be interpreted as hex bytes -bytes. +The ``out`` strings normally start with ``0x`` to be interpreted as hex bytes. From 28b77e588000446f15a77251c9c2c717826c7201 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Tue, 19 Feb 2019 09:24:59 -0500 Subject: [PATCH 3/3] clarify strings with `#` prefixes, add an example --- docs/test_types/rlp_tests.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/test_types/rlp_tests.rst b/docs/test_types/rlp_tests.rst index be1256e80a5..e0062668722 100644 --- a/docs/test_types/rlp_tests.rst +++ b/docs/test_types/rlp_tests.rst @@ -65,6 +65,9 @@ Sections When a json string starts with ``0x``, the rest of the string is interpreted as hex bytes, and when one starts with ``#``, the rest is interpreted as a decimal -number. +number. For example ``5050`` and ``"#5050"`` both represent the decimal number +``5050``. Strings with ``#`` prefixes should be used for numbers that would be +too big to represented as ``int`` values, and would require a "bigint" +representation. The ``out`` strings normally start with ``0x`` to be interpreted as hex bytes.