Add testimonies and AC serialization
This commit is contained in:
parent
2488ff3978
commit
8346df41f2
@ -18,6 +18,7 @@
|
|||||||
| block_pof_hash
|
| block_pof_hash
|
||||||
| block_tx_hash
|
| block_tx_hash
|
||||||
| block_state_hash
|
| block_state_hash
|
||||||
|
| block_witness_hash
|
||||||
| channel
|
| channel
|
||||||
| contract_bytearray
|
| contract_bytearray
|
||||||
| contract_pubkey
|
| contract_pubkey
|
||||||
@ -31,6 +32,7 @@
|
|||||||
| oracle_response
|
| oracle_response
|
||||||
| account_pubkey
|
| account_pubkey
|
||||||
| account_seckey
|
| account_seckey
|
||||||
|
| associate_chain
|
||||||
| signature
|
| signature
|
||||||
| name
|
| name
|
||||||
| commitment
|
| commitment
|
||||||
@ -39,6 +41,7 @@
|
|||||||
| poi
|
| poi
|
||||||
| state_trees
|
| state_trees
|
||||||
| call_state_tree
|
| call_state_tree
|
||||||
|
| mp_tree_hash
|
||||||
| bytearray.
|
| bytearray.
|
||||||
|
|
||||||
-type extended_type() :: known_type() | block_hash | {id_hash, [known_type()]}.
|
-type extended_type() :: known_type() | block_hash | {id_hash, [known_type()]}.
|
||||||
@ -162,6 +165,7 @@ sha256_hash(Bin) ->
|
|||||||
|
|
||||||
|
|
||||||
id2type(account) -> account_pubkey;
|
id2type(account) -> account_pubkey;
|
||||||
|
id2type(associate_chain) -> associate_chain;
|
||||||
id2type(channel) -> channel;
|
id2type(channel) -> channel;
|
||||||
id2type(commitment) -> commitment;
|
id2type(commitment) -> commitment;
|
||||||
id2type(contract) -> contract_pubkey;
|
id2type(contract) -> contract_pubkey;
|
||||||
@ -169,6 +173,7 @@ id2type(name) -> name;
|
|||||||
id2type(oracle) -> oracle_pubkey.
|
id2type(oracle) -> oracle_pubkey.
|
||||||
|
|
||||||
type2id(account_pubkey) -> account;
|
type2id(account_pubkey) -> account;
|
||||||
|
type2id(associate_chain) -> associate_chain;
|
||||||
type2id(channel) -> channel;
|
type2id(channel) -> channel;
|
||||||
type2id(commitment) -> commitment;
|
type2id(commitment) -> commitment;
|
||||||
type2id(contract_pubkey) -> contract;
|
type2id(contract_pubkey) -> contract;
|
||||||
@ -180,6 +185,7 @@ type2enc(micro_block_hash) -> ?BASE58;
|
|||||||
type2enc(block_pof_hash) -> ?BASE58;
|
type2enc(block_pof_hash) -> ?BASE58;
|
||||||
type2enc(block_tx_hash) -> ?BASE58;
|
type2enc(block_tx_hash) -> ?BASE58;
|
||||||
type2enc(block_state_hash) -> ?BASE58;
|
type2enc(block_state_hash) -> ?BASE58;
|
||||||
|
type2enc(block_witness_hash) -> ?BASE58;
|
||||||
type2enc(channel) -> ?BASE58;
|
type2enc(channel) -> ?BASE58;
|
||||||
type2enc(contract_pubkey) -> ?BASE58;
|
type2enc(contract_pubkey) -> ?BASE58;
|
||||||
type2enc(contract_bytearray) -> ?BASE64;
|
type2enc(contract_bytearray) -> ?BASE64;
|
||||||
@ -193,6 +199,7 @@ type2enc(oracle_query_id) -> ?BASE58;
|
|||||||
type2enc(oracle_response) -> ?BASE64;
|
type2enc(oracle_response) -> ?BASE64;
|
||||||
type2enc(account_pubkey) -> ?BASE58;
|
type2enc(account_pubkey) -> ?BASE58;
|
||||||
type2enc(account_seckey) -> ?BASE58;
|
type2enc(account_seckey) -> ?BASE58;
|
||||||
|
type2enc(associate_chain) -> ?BASE58;
|
||||||
type2enc(signature) -> ?BASE58;
|
type2enc(signature) -> ?BASE58;
|
||||||
type2enc(commitment) -> ?BASE58;
|
type2enc(commitment) -> ?BASE58;
|
||||||
type2enc(peer_pubkey) -> ?BASE58;
|
type2enc(peer_pubkey) -> ?BASE58;
|
||||||
@ -201,6 +208,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(mp_tree_hash) -> ?BASE58;
|
||||||
|
type2enc(hash) -> ?BASE58;
|
||||||
type2enc(bytearray) -> ?BASE64.
|
type2enc(bytearray) -> ?BASE64.
|
||||||
|
|
||||||
|
|
||||||
@ -209,6 +218,7 @@ type2pfx(micro_block_hash) -> <<"mh">>;
|
|||||||
type2pfx(block_pof_hash) -> <<"bf">>;
|
type2pfx(block_pof_hash) -> <<"bf">>;
|
||||||
type2pfx(block_tx_hash) -> <<"bx">>;
|
type2pfx(block_tx_hash) -> <<"bx">>;
|
||||||
type2pfx(block_state_hash) -> <<"bs">>;
|
type2pfx(block_state_hash) -> <<"bs">>;
|
||||||
|
type2pfx(block_witness_hash) -> <<"ws">>;
|
||||||
type2pfx(channel) -> <<"ch">>;
|
type2pfx(channel) -> <<"ch">>;
|
||||||
type2pfx(contract_pubkey) -> <<"ct">>;
|
type2pfx(contract_pubkey) -> <<"ct">>;
|
||||||
type2pfx(contract_bytearray) -> <<"cb">>;
|
type2pfx(contract_bytearray) -> <<"cb">>;
|
||||||
@ -222,6 +232,7 @@ type2pfx(oracle_query_id) -> <<"oq">>;
|
|||||||
type2pfx(oracle_response) -> <<"or">>;
|
type2pfx(oracle_response) -> <<"or">>;
|
||||||
type2pfx(account_pubkey) -> <<"ak">>;
|
type2pfx(account_pubkey) -> <<"ak">>;
|
||||||
type2pfx(account_seckey) -> <<"sk">>;
|
type2pfx(account_seckey) -> <<"sk">>;
|
||||||
|
type2pfx(associate_chain) -> <<"ac">>;
|
||||||
type2pfx(signature) -> <<"sg">>;
|
type2pfx(signature) -> <<"sg">>;
|
||||||
type2pfx(commitment) -> <<"cm">>;
|
type2pfx(commitment) -> <<"cm">>;
|
||||||
type2pfx(peer_pubkey) -> <<"pp">>;
|
type2pfx(peer_pubkey) -> <<"pp">>;
|
||||||
@ -230,6 +241,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(mp_tree_hash) -> <<"mt">>;
|
||||||
|
type2pfx(hash) -> <<"hs">>;
|
||||||
type2pfx(bytearray) -> <<"ba">>.
|
type2pfx(bytearray) -> <<"ba">>.
|
||||||
|
|
||||||
pfx2type(<<"kh">>) -> key_block_hash;
|
pfx2type(<<"kh">>) -> key_block_hash;
|
||||||
@ -237,6 +250,7 @@ pfx2type(<<"mh">>) -> micro_block_hash;
|
|||||||
pfx2type(<<"bf">>) -> block_pof_hash;
|
pfx2type(<<"bf">>) -> block_pof_hash;
|
||||||
pfx2type(<<"bx">>) -> block_tx_hash;
|
pfx2type(<<"bx">>) -> block_tx_hash;
|
||||||
pfx2type(<<"bs">>) -> block_state_hash;
|
pfx2type(<<"bs">>) -> block_state_hash;
|
||||||
|
pfx2type(<<"ws">>) -> block_witness_hash;
|
||||||
pfx2type(<<"ch">>) -> channel;
|
pfx2type(<<"ch">>) -> channel;
|
||||||
pfx2type(<<"cb">>) -> contract_bytearray;
|
pfx2type(<<"cb">>) -> contract_bytearray;
|
||||||
pfx2type(<<"ck">>) -> contract_store_key;
|
pfx2type(<<"ck">>) -> contract_store_key;
|
||||||
@ -250,6 +264,7 @@ pfx2type(<<"oq">>) -> oracle_query_id;
|
|||||||
pfx2type(<<"or">>) -> oracle_response;
|
pfx2type(<<"or">>) -> oracle_response;
|
||||||
pfx2type(<<"ak">>) -> account_pubkey;
|
pfx2type(<<"ak">>) -> account_pubkey;
|
||||||
pfx2type(<<"sk">>) -> account_seckey;
|
pfx2type(<<"sk">>) -> account_seckey;
|
||||||
|
pfx2type(<<"ac">>) -> associate_chain;
|
||||||
pfx2type(<<"sg">>) -> signature;
|
pfx2type(<<"sg">>) -> signature;
|
||||||
pfx2type(<<"cm">>) -> commitment;
|
pfx2type(<<"cm">>) -> commitment;
|
||||||
pfx2type(<<"pp">>) -> peer_pubkey;
|
pfx2type(<<"pp">>) -> peer_pubkey;
|
||||||
@ -258,6 +273,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(<<"mt">>) -> mp_tree_hash;
|
||||||
|
pfx2type(<<"hs">>) -> hash;
|
||||||
pfx2type(<<"ba">>) -> bytearray.
|
pfx2type(<<"ba">>) -> bytearray.
|
||||||
|
|
||||||
-spec byte_size_for_type(known_type()) -> non_neg_integer() | not_applicable.
|
-spec byte_size_for_type(known_type()) -> non_neg_integer() | not_applicable.
|
||||||
@ -267,6 +284,7 @@ byte_size_for_type(micro_block_hash) -> 32;
|
|||||||
byte_size_for_type(block_pof_hash) -> 32;
|
byte_size_for_type(block_pof_hash) -> 32;
|
||||||
byte_size_for_type(block_tx_hash) -> 32;
|
byte_size_for_type(block_tx_hash) -> 32;
|
||||||
byte_size_for_type(block_state_hash) -> 32;
|
byte_size_for_type(block_state_hash) -> 32;
|
||||||
|
byte_size_for_type(block_witness_hash) -> 32;
|
||||||
byte_size_for_type(channel) -> 32;
|
byte_size_for_type(channel) -> 32;
|
||||||
byte_size_for_type(contract_pubkey) -> 32;
|
byte_size_for_type(contract_pubkey) -> 32;
|
||||||
byte_size_for_type(contract_bytearray) -> not_applicable;
|
byte_size_for_type(contract_bytearray) -> not_applicable;
|
||||||
@ -280,6 +298,7 @@ byte_size_for_type(oracle_query_id) -> 32;
|
|||||||
byte_size_for_type(oracle_response) -> not_applicable;
|
byte_size_for_type(oracle_response) -> not_applicable;
|
||||||
byte_size_for_type(account_pubkey) -> 32;
|
byte_size_for_type(account_pubkey) -> 32;
|
||||||
byte_size_for_type(account_seckey) -> 32;
|
byte_size_for_type(account_seckey) -> 32;
|
||||||
|
byte_size_for_type(associate_chain) -> 32;
|
||||||
byte_size_for_type(signature) -> 64;
|
byte_size_for_type(signature) -> 64;
|
||||||
byte_size_for_type(name) -> not_applicable;
|
byte_size_for_type(name) -> not_applicable;
|
||||||
byte_size_for_type(commitment) -> 32;
|
byte_size_for_type(commitment) -> 32;
|
||||||
@ -288,6 +307,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(mp_tree_hash) -> 32;
|
||||||
|
byte_size_for_type(hash) -> 32;
|
||||||
byte_size_for_type(bytearray) -> not_applicable.
|
byte_size_for_type(bytearray) -> not_applicable.
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,14 +87,24 @@ tag(channels_mtree) -> 623;
|
|||||||
tag(nameservice_mtree) -> 624;
|
tag(nameservice_mtree) -> 624;
|
||||||
tag(oracles_mtree) -> 625;
|
tag(oracles_mtree) -> 625;
|
||||||
tag(accounts_mtree) -> 626;
|
tag(accounts_mtree) -> 626;
|
||||||
|
tag(acs_mtree) -> 627;
|
||||||
tag(compiler_sophia) -> 70;
|
tag(compiler_sophia) -> 70;
|
||||||
tag(ga_attach_tx) -> 80;
|
tag(ga_attach_tx) -> 80;
|
||||||
tag(ga_meta_tx) -> 81;
|
tag(ga_meta_tx) -> 81;
|
||||||
tag(paying_for_tx) -> 82;
|
tag(paying_for_tx) -> 82;
|
||||||
tag(ga_meta_tx_auth_data) -> 810;
|
tag(ga_meta_tx_auth_data) -> 810;
|
||||||
|
tag(associate_chain) -> 90;
|
||||||
|
tag(ac_state) -> 91;
|
||||||
|
tag(ac_burn) -> 92;
|
||||||
|
tag(ac_create_tx) -> 93;
|
||||||
|
tag(ac_deposit_tx) -> 94;
|
||||||
|
tag(ac_update_cops_tx) -> 95;
|
||||||
|
tag(ac_rollup_tx) -> 96;
|
||||||
tag(key_block) -> 100;
|
tag(key_block) -> 100;
|
||||||
tag(micro_block) -> 101;
|
tag(micro_block) -> 101;
|
||||||
tag(light_micro_block) -> 102;
|
tag(light_micro_block) -> 102;
|
||||||
|
tag(testimony) -> 110;
|
||||||
|
tag(testimony_tx) -> 111;
|
||||||
tag(pof) -> 200.
|
tag(pof) -> 200.
|
||||||
|
|
||||||
rev_tag(10) -> account;
|
rev_tag(10) -> account;
|
||||||
@ -148,12 +158,22 @@ rev_tag(623) -> channels_mtree;
|
|||||||
rev_tag(624) -> nameservice_mtree;
|
rev_tag(624) -> nameservice_mtree;
|
||||||
rev_tag(625) -> oracles_mtree;
|
rev_tag(625) -> oracles_mtree;
|
||||||
rev_tag(626) -> accounts_mtree;
|
rev_tag(626) -> accounts_mtree;
|
||||||
|
rev_tag(627) -> acs_mtree;
|
||||||
rev_tag(70) -> compiler_sophia;
|
rev_tag(70) -> compiler_sophia;
|
||||||
rev_tag(80) -> ga_attach_tx;
|
rev_tag(80) -> ga_attach_tx;
|
||||||
rev_tag(81) -> ga_meta_tx;
|
rev_tag(81) -> ga_meta_tx;
|
||||||
rev_tag(82) -> paying_for_tx;
|
rev_tag(82) -> paying_for_tx;
|
||||||
rev_tag(810) -> ga_meta_tx_auth_data;
|
rev_tag(810) -> ga_meta_tx_auth_data;
|
||||||
|
rev_tag(90) -> associate_chain;
|
||||||
|
rev_tag(91) -> ac_state;
|
||||||
|
rev_tag(92) -> ac_burn;
|
||||||
|
rev_tag(93) -> ac_create_tx;
|
||||||
|
rev_tag(94) -> ac_deposit_tx;
|
||||||
|
rev_tag(95) -> ac_update_cops_tx;
|
||||||
|
rev_tag(96) -> ac_rollup_tx;
|
||||||
rev_tag(100) -> key_block;
|
rev_tag(100) -> key_block;
|
||||||
rev_tag(101) -> micro_block;
|
rev_tag(101) -> micro_block;
|
||||||
rev_tag(102) -> light_micro_block;
|
rev_tag(102) -> light_micro_block;
|
||||||
|
rev_tag(110) -> testimony;
|
||||||
|
rev_tag(111) -> testimony_tx;
|
||||||
rev_tag(200) -> pof.
|
rev_tag(200) -> pof.
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
}).
|
}).
|
||||||
|
|
||||||
-type tag() :: 'account' | 'oracle' | 'name'
|
-type tag() :: 'account' | 'oracle' | 'name'
|
||||||
| 'commitment' | 'contract' | 'channel'.
|
| 'commitment' | 'contract' | 'channel'
|
||||||
|
| 'associate_chain' .
|
||||||
-type val() :: <<_:256>>.
|
-type val() :: <<_:256>>.
|
||||||
-opaque(id() :: #id{}).
|
-opaque(id() :: #id{}).
|
||||||
|
|
||||||
@ -43,7 +44,8 @@
|
|||||||
___TAG___ =:= name;
|
___TAG___ =:= name;
|
||||||
___TAG___ =:= commitment;
|
___TAG___ =:= commitment;
|
||||||
___TAG___ =:= contract;
|
___TAG___ =:= contract;
|
||||||
___TAG___ =:= channel
|
___TAG___ =:= channel;
|
||||||
|
___TAG___ =:= associate_chain
|
||||||
).
|
).
|
||||||
-define(IS_VAL(___VAL___), byte_size(___VAL___) =:= 32).
|
-define(IS_VAL(___VAL___), byte_size(___VAL___) =:= 32).
|
||||||
|
|
||||||
@ -100,6 +102,7 @@ encode_tag(commitment) -> 3;
|
|||||||
encode_tag(oracle) -> 4;
|
encode_tag(oracle) -> 4;
|
||||||
encode_tag(contract) -> 5;
|
encode_tag(contract) -> 5;
|
||||||
encode_tag(channel) -> 6;
|
encode_tag(channel) -> 6;
|
||||||
|
encode_tag(associate_chain) -> 7;
|
||||||
encode_tag(Other) -> error({illegal_id_tag_name, Other}).
|
encode_tag(Other) -> error({illegal_id_tag_name, Other}).
|
||||||
|
|
||||||
decode_tag(1) -> account;
|
decode_tag(1) -> account;
|
||||||
@ -108,4 +111,5 @@ decode_tag(3) -> commitment;
|
|||||||
decode_tag(4) -> oracle;
|
decode_tag(4) -> oracle;
|
||||||
decode_tag(5) -> contract;
|
decode_tag(5) -> contract;
|
||||||
decode_tag(6) -> channel;
|
decode_tag(6) -> channel;
|
||||||
|
decode_tag(7) -> associate_chain;
|
||||||
decode_tag(X) -> error({illegal_id_tag, X}).
|
decode_tag(X) -> error({illegal_id_tag, X}).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user