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
5 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{erl_opts, [debug_info]}.
{deps, [ {base58, {git, "https://github.com/aeternity/erl-base58.git", {ref, "60a3356"}}}
, {enacl, {git, "https://github.com/aeternity/enacl.git", {ref, "793ddb5"}}}
, {enacl, {git, "https://github.com/aeternity/enacl.git", {ref, "26180f4"}}}
]}.
+10 -5
View File
@@ -38,7 +38,8 @@
| poi
| state_trees
| call_state_tree
| bytearray.
| bytearray
| fate_code.
-type extended_type() :: known_type() | block_hash | {id_hash, [known_type()]}.
@@ -199,7 +200,8 @@ type2enc(state) -> ?BASE64;
type2enc(poi) -> ?BASE64;
type2enc(state_trees) -> ?BASE64;
type2enc(call_state_tree) -> ?BASE64;
type2enc(bytearray) -> ?BASE64.
type2enc(bytearray) -> ?BASE64;
type2enc(fate_code) -> ?BASE64.
type2pfx(key_block_hash) -> <<"kh">>;
@@ -227,7 +229,8 @@ type2pfx(state) -> <<"st">>;
type2pfx(poi) -> <<"pi">>;
type2pfx(state_trees) -> <<"ss">>;
type2pfx(call_state_tree) -> <<"cs">>;
type2pfx(bytearray) -> <<"ba">>.
type2pfx(bytearray) -> <<"ba">>;
type2pfx(fate_code) -> <<"fc">>.
pfx2type(<<"kh">>) -> key_block_hash;
pfx2type(<<"mh">>) -> micro_block_hash;
@@ -254,7 +257,8 @@ pfx2type(<<"st">>) -> state;
pfx2type(<<"pi">>) -> poi;
pfx2type(<<"ss">>) -> state_trees;
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.
@@ -283,7 +287,8 @@ byte_size_for_type(state) -> 32;
byte_size_for_type(poi) -> not_applicable;
byte_size_for_type(state_trees) -> 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
-4
View File
@@ -58,7 +58,6 @@ tag(contract_call) -> 41;
tag(contract_create_tx) -> 42;
tag(contract_call_tx) -> 43;
tag(channel_create_tx) -> 50;
tag(channel_set_delegates_tx) -> 501;
tag(channel_deposit_tx) -> 51;
tag(channel_withdraw_tx) -> 52;
tag(channel_force_progress_tx) -> 521;
@@ -90,7 +89,6 @@ tag(accounts_mtree) -> 626;
tag(compiler_sophia) -> 70;
tag(ga_attach_tx) -> 80;
tag(ga_meta_tx) -> 81;
tag(paying_for_tx) -> 82;
tag(key_block) -> 100;
tag(micro_block) -> 101;
tag(light_micro_block) -> 102;
@@ -118,7 +116,6 @@ rev_tag(41) -> contract_call;
rev_tag(42) -> contract_create_tx;
rev_tag(43) -> contract_call_tx;
rev_tag(50) -> channel_create_tx;
rev_tag(501) -> channel_set_delegates_tx;
rev_tag(51) -> channel_deposit_tx;
rev_tag(52) -> channel_withdraw_tx;
rev_tag(521) -> channel_force_progress_tx;
@@ -150,7 +147,6 @@ rev_tag(626) -> accounts_mtree;
rev_tag(70) -> compiler_sophia;
rev_tag(80) -> ga_attach_tx;
rev_tag(81) -> ga_meta_tx;
rev_tag(82) -> paying_for_tx;
rev_tag(100) -> key_block;
rev_tag(101) -> micro_block;
rev_tag(102) -> light_micro_block;
+2 -1
View File
@@ -23,7 +23,8 @@ serialize(CodeMap = #{ byte_code := ByteCode
SourceHash = case CodeMap of
#{ source_hash := SHash } -> SHash;
#{ contract_source := SrcStr } ->
enacl:generichash(32, list_to_binary(SrcStr))
{ok, SHash} = enacl:generichash(32, list_to_binary(SrcStr)),
SHash
end,
%% Compiler version
+1
View File
@@ -23,6 +23,7 @@
, {commitment , 32}
, {peer_pubkey , 32}
, {state , 32}
, {fate_code , not_applicable}
, {poi , not_applicable}]).
encode_decode_test_() ->