my erl rlp implementation agrees with ethereum python implementation for 59,638 random cases

This commit is contained in:
2022-10-23 04:55:59 -06:00
parent 9701993e8b
commit 2254c82f77
4 changed files with 119291 additions and 6402 deletions
+1
View File
@@ -6,3 +6,4 @@ jex_include
*.swo
test/testgen/b58_cases_2.eterms
test/testgen/b58_cases_3.eterms
__pycache__
@@ -2,10 +2,11 @@
%-compile(export_all).
-mode(compile).
%-compile(nowarn_unused).
main([]) ->
% Decoded cases
DecodedCases = rand_decode_datas(5000),
DecodedCases = rand_decode_datas(100_000),
%io:format("~p~n", [DecodedCases]),
io:format("~s~n", [format_cases_py(DecodedCases)]),
ok.
@@ -15,7 +16,7 @@ format_cases_py(Cases) ->
% format a list of strings into a python list
format_stringlist_py(List) ->
[$[, slcommas(List, []), $]].
["cases = [\n", slcommas(List, []), $]].
% similar to commas/2 below but for a list of the dictstrings
% adding a comma, a newline, and a space
@@ -48,7 +49,6 @@ format_case_py(DecodedData_rlist) ->
EncodedData_bytes = rlp:encode(DecodedData_rlist),
EncodedBytes_py = format_bytes_py(EncodedData_bytes),
DecodedData_py = format_data_py(DecodedData_rlist),
% the extra space is intentional because of how we will do list formatting
[" {'decoded': ", DecodedData_py, ",\n",
" 'encoded': ", EncodedBytes_py, "}"].
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff