Compare commits

...

3 Commits

Author SHA1 Message Date
radrow
751bb35cd7 Add test 2021-03-22 14:41:04 +01:00
radrow
47d5d493a3 Add missing stuff 2021-03-22 14:30:44 +01:00
radrow
929ab6d5da Fate code prefix 2021-03-22 14:26:15 +01:00
2 changed files with 11 additions and 5 deletions

View File

@ -38,7 +38,8 @@
| poi | poi
| state_trees | state_trees
| call_state_tree | call_state_tree
| bytearray. | bytearray
| fate_code.
-type extended_type() :: known_type() | block_hash | {id_hash, [known_type()]}. -type extended_type() :: known_type() | block_hash | {id_hash, [known_type()]}.
@ -199,7 +200,8 @@ type2enc(state) -> ?BASE64;
type2enc(poi) -> ?BASE64; type2enc(poi) -> ?BASE64;
type2enc(state_trees) -> ?BASE64; type2enc(state_trees) -> ?BASE64;
type2enc(call_state_tree) -> ?BASE64; type2enc(call_state_tree) -> ?BASE64;
type2enc(bytearray) -> ?BASE64. type2enc(bytearray) -> ?BASE64;
type2enc(fate_code) -> ?BASE64.
type2pfx(key_block_hash) -> <<"kh">>; type2pfx(key_block_hash) -> <<"kh">>;
@ -227,7 +229,8 @@ type2pfx(state) -> <<"st">>;
type2pfx(poi) -> <<"pi">>; type2pfx(poi) -> <<"pi">>;
type2pfx(state_trees) -> <<"ss">>; type2pfx(state_trees) -> <<"ss">>;
type2pfx(call_state_tree) -> <<"cs">>; type2pfx(call_state_tree) -> <<"cs">>;
type2pfx(bytearray) -> <<"ba">>. type2pfx(bytearray) -> <<"ba">>;
type2pfx(fate_code) -> <<"fc">>.
pfx2type(<<"kh">>) -> key_block_hash; pfx2type(<<"kh">>) -> key_block_hash;
pfx2type(<<"mh">>) -> micro_block_hash; pfx2type(<<"mh">>) -> micro_block_hash;
@ -254,7 +257,8 @@ pfx2type(<<"st">>) -> state;
pfx2type(<<"pi">>) -> poi; pfx2type(<<"pi">>) -> poi;
pfx2type(<<"ss">>) -> state_trees; pfx2type(<<"ss">>) -> state_trees;
pfx2type(<<"cs">>) -> call_state_tree; pfx2type(<<"cs">>) -> call_state_tree;
pfx2type(<<"ba">>) -> bytearray. pfx2type(<<"ba">>) -> bytearray;
pfx2type(<<"fc">>) -> fate_code.
-spec byte_size_for_type(known_type()) -> non_neg_integer() | not_applicable. -spec byte_size_for_type(known_type()) -> non_neg_integer() | not_applicable.
@ -283,7 +287,8 @@ byte_size_for_type(state) -> 32;
byte_size_for_type(poi) -> not_applicable; byte_size_for_type(poi) -> not_applicable;
byte_size_for_type(state_trees) -> not_applicable; byte_size_for_type(state_trees) -> not_applicable;
byte_size_for_type(call_state_tree) -> not_applicable; byte_size_for_type(call_state_tree) -> not_applicable;
byte_size_for_type(bytearray) -> not_applicable. byte_size_for_type(bytearray) -> not_applicable;
byte_size_for_type(fate_code) -> not_applicable.
%% TODO: Fix the base58 module so that it consistently uses binaries instead %% TODO: Fix the base58 module so that it consistently uses binaries instead

View File

@ -23,6 +23,7 @@
, {commitment , 32} , {commitment , 32}
, {peer_pubkey , 32} , {peer_pubkey , 32}
, {state , 32} , {state , 32}
, {fate_code , not_applicable}
, {poi , not_applicable}]). , {poi , not_applicable}]).
encode_decode_test_() -> encode_decode_test_() ->