Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2ce3a0414 | |||
| 9d9026e760 | |||
| b3105c466f | |||
| 4d2beb0337 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{deps, [ {base58, {git, "https://github.com/aeternity/erl-base58.git", {ref, "60a3356"}}}
|
{deps, [ {base58, {git, "https://github.com/aeternity/erl-base58.git", {ref, "60a3356"}}}
|
||||||
, {enacl, {git, "https://gitlab.com/ioecs/enacl.git", {ref, "4eb7ec70"}}}
|
, {enacl, {git, "https://github.com/aeternity/enacl.git", {ref, "67fceef"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|||||||
+2
-2
@@ -3,6 +3,6 @@
|
|||||||
{ref,"60a335668a60328a29f9731b67c4a0e9e3d50ab6"}},
|
{ref,"60a335668a60328a29f9731b67c4a0e9e3d50ab6"}},
|
||||||
0},
|
0},
|
||||||
{<<"enacl">>,
|
{<<"enacl">>,
|
||||||
{git,"https://gitlab.com/ioecs/enacl.git",
|
{git,"https://github.com/aeternity/enacl.git",
|
||||||
{ref,"4eb7ec70084ba7c87b1af8797c4c4e90c84f95a2"}},
|
{ref,"67fceef42c0d055570f2e67b571f8d1f8de2f204"}},
|
||||||
0}].
|
0}].
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(aeser_api_encoder).
|
-module(aeser_api_encoder).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-export([encode/2,
|
-export([encode/2,
|
||||||
decode/1,
|
decode/1,
|
||||||
@@ -19,13 +18,11 @@
|
|||||||
| 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
|
||||||
| contract_store_key
|
| contract_store_key
|
||||||
| contract_store_value
|
| contract_store_value
|
||||||
| contract_source
|
|
||||||
| transaction
|
| transaction
|
||||||
| tx_hash
|
| tx_hash
|
||||||
| oracle_pubkey
|
| oracle_pubkey
|
||||||
@@ -35,10 +32,8 @@
|
|||||||
| account_pubkey
|
| account_pubkey
|
||||||
| account_seckey
|
| account_seckey
|
||||||
| associate_chain
|
| associate_chain
|
||||||
| entry
|
|
||||||
| signature
|
| signature
|
||||||
| name
|
| name
|
||||||
| native_token
|
|
||||||
| commitment
|
| commitment
|
||||||
| peer_pubkey
|
| peer_pubkey
|
||||||
| state
|
| state
|
||||||
@@ -173,10 +168,7 @@ 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;
|
||||||
id2type(contract_source) -> contract_source;
|
|
||||||
id2type(name) -> name;
|
id2type(name) -> name;
|
||||||
id2type(native_token) -> native_token;
|
|
||||||
id2type(entry) -> entry;
|
|
||||||
id2type(oracle) -> oracle_pubkey.
|
id2type(oracle) -> oracle_pubkey.
|
||||||
|
|
||||||
type2id(account_pubkey) -> account;
|
type2id(account_pubkey) -> account;
|
||||||
@@ -184,10 +176,7 @@ 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;
|
||||||
type2id(contract_source) -> contract_source;
|
|
||||||
type2id(name) -> name;
|
type2id(name) -> name;
|
||||||
type2id(native_token) -> native_token;
|
|
||||||
type2id(entry) -> entry;
|
|
||||||
type2id(oracle_pubkey) -> oracle.
|
type2id(oracle_pubkey) -> oracle.
|
||||||
|
|
||||||
type2enc(key_block_hash) -> ?BASE58;
|
type2enc(key_block_hash) -> ?BASE58;
|
||||||
@@ -195,13 +184,11 @@ 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;
|
||||||
type2enc(contract_store_key) -> ?BASE64;
|
type2enc(contract_store_key) -> ?BASE64;
|
||||||
type2enc(contract_store_value) -> ?BASE64;
|
type2enc(contract_store_value) -> ?BASE64;
|
||||||
type2enc(contract_source) -> ?BASE64;
|
|
||||||
type2enc(transaction) -> ?BASE64;
|
type2enc(transaction) -> ?BASE64;
|
||||||
type2enc(tx_hash) -> ?BASE58;
|
type2enc(tx_hash) -> ?BASE58;
|
||||||
type2enc(oracle_pubkey) -> ?BASE58;
|
type2enc(oracle_pubkey) -> ?BASE58;
|
||||||
@@ -215,14 +202,12 @@ type2enc(signature) -> ?BASE58;
|
|||||||
type2enc(commitment) -> ?BASE58;
|
type2enc(commitment) -> ?BASE58;
|
||||||
type2enc(peer_pubkey) -> ?BASE58;
|
type2enc(peer_pubkey) -> ?BASE58;
|
||||||
type2enc(name) -> ?BASE58;
|
type2enc(name) -> ?BASE58;
|
||||||
type2enc(native_token) -> ?BASE58;
|
|
||||||
type2enc(state) -> ?BASE64;
|
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(mp_tree_hash) -> ?BASE58;
|
||||||
type2enc(hash) -> ?BASE58;
|
type2enc(hash) -> ?BASE58;
|
||||||
type2enc(entry) -> ?BASE64;
|
|
||||||
type2enc(bytearray) -> ?BASE64.
|
type2enc(bytearray) -> ?BASE64.
|
||||||
|
|
||||||
|
|
||||||
@@ -231,13 +216,11 @@ 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">>;
|
||||||
type2pfx(contract_store_key) -> <<"ck">>;
|
type2pfx(contract_store_key) -> <<"ck">>;
|
||||||
type2pfx(contract_store_value) -> <<"cv">>;
|
type2pfx(contract_store_value) -> <<"cv">>;
|
||||||
type2pfx(contract_source) -> <<"cx">>;
|
|
||||||
type2pfx(transaction) -> <<"tx">>;
|
type2pfx(transaction) -> <<"tx">>;
|
||||||
type2pfx(tx_hash) -> <<"th">>;
|
type2pfx(tx_hash) -> <<"th">>;
|
||||||
type2pfx(oracle_pubkey) -> <<"ok">>;
|
type2pfx(oracle_pubkey) -> <<"ok">>;
|
||||||
@@ -251,14 +234,12 @@ type2pfx(signature) -> <<"sg">>;
|
|||||||
type2pfx(commitment) -> <<"cm">>;
|
type2pfx(commitment) -> <<"cm">>;
|
||||||
type2pfx(peer_pubkey) -> <<"pp">>;
|
type2pfx(peer_pubkey) -> <<"pp">>;
|
||||||
type2pfx(name) -> <<"nm">>;
|
type2pfx(name) -> <<"nm">>;
|
||||||
type2pfx(native_token) -> <<"nt">>;
|
|
||||||
type2pfx(state) -> <<"st">>;
|
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(mp_tree_hash) -> <<"mt">>;
|
||||||
type2pfx(hash) -> <<"hs">>;
|
type2pfx(hash) -> <<"hs">>;
|
||||||
type2pfx(entry) -> <<"en">>;
|
|
||||||
type2pfx(bytearray) -> <<"ba">>.
|
type2pfx(bytearray) -> <<"ba">>.
|
||||||
|
|
||||||
pfx2type(<<"kh">>) -> key_block_hash;
|
pfx2type(<<"kh">>) -> key_block_hash;
|
||||||
@@ -266,13 +247,11 @@ 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;
|
||||||
pfx2type(<<"cv">>) -> contract_store_value;
|
pfx2type(<<"cv">>) -> contract_store_value;
|
||||||
pfx2type(<<"ct">>) -> contract_pubkey;
|
pfx2type(<<"ct">>) -> contract_pubkey;
|
||||||
pfx2type(<<"cx">>) -> contract_source;
|
|
||||||
pfx2type(<<"tx">>) -> transaction;
|
pfx2type(<<"tx">>) -> transaction;
|
||||||
pfx2type(<<"th">>) -> tx_hash;
|
pfx2type(<<"th">>) -> tx_hash;
|
||||||
pfx2type(<<"ok">>) -> oracle_pubkey;
|
pfx2type(<<"ok">>) -> oracle_pubkey;
|
||||||
@@ -286,14 +265,12 @@ pfx2type(<<"sg">>) -> signature;
|
|||||||
pfx2type(<<"cm">>) -> commitment;
|
pfx2type(<<"cm">>) -> commitment;
|
||||||
pfx2type(<<"pp">>) -> peer_pubkey;
|
pfx2type(<<"pp">>) -> peer_pubkey;
|
||||||
pfx2type(<<"nm">>) -> name;
|
pfx2type(<<"nm">>) -> name;
|
||||||
pfx2type(<<"nt">>) -> native_token;
|
|
||||||
pfx2type(<<"st">>) -> state;
|
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(<<"mt">>) -> mp_tree_hash;
|
||||||
pfx2type(<<"hs">>) -> hash;
|
pfx2type(<<"hs">>) -> hash;
|
||||||
pfx2type(<<"en">>) -> entry;
|
|
||||||
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.
|
||||||
@@ -303,13 +280,11 @@ 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;
|
||||||
byte_size_for_type(contract_store_key) -> not_applicable;
|
byte_size_for_type(contract_store_key) -> not_applicable;
|
||||||
byte_size_for_type(contract_store_value) -> not_applicable;
|
byte_size_for_type(contract_store_value) -> not_applicable;
|
||||||
byte_size_for_type(contract_source) -> not_applicable;
|
|
||||||
byte_size_for_type(transaction) -> not_applicable;
|
byte_size_for_type(transaction) -> not_applicable;
|
||||||
byte_size_for_type(tx_hash) -> 32;
|
byte_size_for_type(tx_hash) -> 32;
|
||||||
byte_size_for_type(oracle_pubkey) -> 32;
|
byte_size_for_type(oracle_pubkey) -> 32;
|
||||||
@@ -321,7 +296,6 @@ byte_size_for_type(account_seckey) -> 32;
|
|||||||
byte_size_for_type(associate_chain) -> 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(native_token) -> 32;
|
|
||||||
byte_size_for_type(commitment) -> 32;
|
byte_size_for_type(commitment) -> 32;
|
||||||
byte_size_for_type(peer_pubkey) -> 32;
|
byte_size_for_type(peer_pubkey) -> 32;
|
||||||
byte_size_for_type(state) -> 32;
|
byte_size_for_type(state) -> 32;
|
||||||
@@ -330,7 +304,6 @@ 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(mp_tree_hash) -> 32;
|
||||||
byte_size_for_type(hash) -> 32;
|
byte_size_for_type(hash) -> 32;
|
||||||
byte_size_for_type(entry) -> not_applicable;
|
|
||||||
byte_size_for_type(bytearray) -> not_applicable.
|
byte_size_for_type(bytearray) -> not_applicable.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
-module(aeser_chain_objects).
|
-module(aeser_chain_objects).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-export([ serialize/4
|
-export([ serialize/4
|
||||||
, deserialize/4
|
, deserialize/4
|
||||||
@@ -40,7 +39,6 @@ deserialize(Type, Vsn, Template, Binary) ->
|
|||||||
tag(account) -> 10;
|
tag(account) -> 10;
|
||||||
tag(signed_tx) -> 11;
|
tag(signed_tx) -> 11;
|
||||||
tag(spend_tx) -> 12;
|
tag(spend_tx) -> 12;
|
||||||
tag(data_extend_tx) -> 13;
|
|
||||||
tag(oracle) -> 20;
|
tag(oracle) -> 20;
|
||||||
tag(oracle_query) -> 21;
|
tag(oracle_query) -> 21;
|
||||||
tag(oracle_register_tx) -> 22;
|
tag(oracle_register_tx) -> 22;
|
||||||
@@ -59,10 +57,8 @@ tag(contract) -> 40;
|
|||||||
tag(contract_call) -> 41;
|
tag(contract_call) -> 41;
|
||||||
tag(contract_create_tx) -> 42;
|
tag(contract_create_tx) -> 42;
|
||||||
tag(contract_call_tx) -> 43;
|
tag(contract_call_tx) -> 43;
|
||||||
tag(contract_source) -> 44;
|
|
||||||
tag(channel_create_tx) -> 50;
|
tag(channel_create_tx) -> 50;
|
||||||
tag(channel_set_delegates_tx) -> 501;
|
tag(channel_set_delegates_tx) -> 501;
|
||||||
tag(channel_delegates) -> 502;
|
|
||||||
tag(channel_deposit_tx) -> 51;
|
tag(channel_deposit_tx) -> 51;
|
||||||
tag(channel_withdraw_tx) -> 52;
|
tag(channel_withdraw_tx) -> 52;
|
||||||
tag(channel_force_progress_tx) -> 521;
|
tag(channel_force_progress_tx) -> 521;
|
||||||
@@ -92,7 +88,6 @@ 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(acs_mtree) -> 627;
|
||||||
tag(entries_mtree) -> 628;
|
|
||||||
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;
|
||||||
@@ -108,24 +103,11 @@ 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(nt_native_token) -> 120;
|
|
||||||
tag(nt_create_tx) -> 121;
|
|
||||||
tag(nt_mint_tx) -> 122;
|
|
||||||
tag(nt_finalize_tx) -> 123;
|
|
||||||
tag(nt_trade_tx) -> 124;
|
|
||||||
tag(nt_burn_tx) -> 125;
|
|
||||||
tag(entry) -> 140;
|
|
||||||
tag(entry_create_tx) -> 141;
|
|
||||||
tag(entry_transfer_tx) -> 142;
|
|
||||||
tag(entry_destroy_tx) -> 143;
|
|
||||||
tag(pof) -> 200.
|
tag(pof) -> 200.
|
||||||
|
|
||||||
rev_tag(10) -> account;
|
rev_tag(10) -> account;
|
||||||
rev_tag(11) -> signed_tx;
|
rev_tag(11) -> signed_tx;
|
||||||
rev_tag(12) -> spend_tx;
|
rev_tag(12) -> spend_tx;
|
||||||
rev_tag(13) -> data_extend_tx;
|
|
||||||
rev_tag(20) -> oracle;
|
rev_tag(20) -> oracle;
|
||||||
rev_tag(21) -> oracle_query;
|
rev_tag(21) -> oracle_query;
|
||||||
rev_tag(22) -> oracle_register_tx;
|
rev_tag(22) -> oracle_register_tx;
|
||||||
@@ -144,10 +126,8 @@ rev_tag(40) -> contract;
|
|||||||
rev_tag(41) -> contract_call;
|
rev_tag(41) -> contract_call;
|
||||||
rev_tag(42) -> contract_create_tx;
|
rev_tag(42) -> contract_create_tx;
|
||||||
rev_tag(43) -> contract_call_tx;
|
rev_tag(43) -> contract_call_tx;
|
||||||
rev_tag(44) -> contract_source;
|
|
||||||
rev_tag(50) -> channel_create_tx;
|
rev_tag(50) -> channel_create_tx;
|
||||||
rev_tag(501) -> channel_set_delegates_tx;
|
rev_tag(501) -> channel_set_delegates_tx;
|
||||||
rev_tag(502) -> channel_delegates;
|
|
||||||
rev_tag(51) -> channel_deposit_tx;
|
rev_tag(51) -> channel_deposit_tx;
|
||||||
rev_tag(52) -> channel_withdraw_tx;
|
rev_tag(52) -> channel_withdraw_tx;
|
||||||
rev_tag(521) -> channel_force_progress_tx;
|
rev_tag(521) -> channel_force_progress_tx;
|
||||||
@@ -177,7 +157,6 @@ 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(627) -> acs_mtree;
|
||||||
rev_tag(628) -> entries_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;
|
||||||
@@ -193,16 +172,4 @@ 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(120) -> nt_native_token;
|
|
||||||
rev_tag(121) -> nt_create_tx;
|
|
||||||
rev_tag(122) -> nt_mint_tx;
|
|
||||||
rev_tag(123) -> nt_finalize_tx;
|
|
||||||
rev_tag(124) -> nt_trade_tx;
|
|
||||||
rev_tag(125) -> nt_burn_tx;
|
|
||||||
rev_tag(140) -> entry;
|
|
||||||
rev_tag(141) -> entry_create_tx;
|
|
||||||
rev_tag(142) -> entry_transfer_tx;
|
|
||||||
rev_tag(143) -> entry_destroy_tx;
|
|
||||||
rev_tag(200) -> pof.
|
rev_tag(200) -> pof.
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(aeser_contract_code).
|
-module(aeser_contract_code).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-include("aeser_contract_code.hrl").
|
-include("aeser_contract_code.hrl").
|
||||||
|
|
||||||
@@ -17,16 +16,15 @@
|
|||||||
serialize(CodeMap) ->
|
serialize(CodeMap) ->
|
||||||
serialize(CodeMap, ?SOPHIA_CONTRACT_VSN_3).
|
serialize(CodeMap, ?SOPHIA_CONTRACT_VSN_3).
|
||||||
|
|
||||||
|
|
||||||
-spec serialize(map(), non_neg_integer()) -> binary().
|
-spec serialize(map(), non_neg_integer()) -> binary().
|
||||||
serialize(CodeMap = #{ byte_code := ByteCode
|
serialize(CodeMap = #{ byte_code := ByteCode
|
||||||
, type_info := TypeInfo }, SophiaContractVersion) ->
|
, type_info := TypeInfo }, SophiaContractVersion) ->
|
||||||
%% Source hash
|
%% Source hash
|
||||||
SourceHash =
|
SourceHash = case CodeMap of
|
||||||
case CodeMap of
|
#{ source_hash := SHash } -> SHash;
|
||||||
#{ source_hash := SHash } -> SHash;
|
#{ contract_source := SrcStr } ->
|
||||||
#{ contract_source := SrcStr } -> blake2(32, list_to_binary(SrcStr))
|
enacl:generichash(32, list_to_binary(SrcStr))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
%% Compiler version
|
%% Compiler version
|
||||||
Version = maps:get(compiler_version, CodeMap, <<"unknown">>),
|
Version = maps:get(compiler_version, CodeMap, <<"unknown">>),
|
||||||
@@ -49,21 +47,6 @@ serialize(CodeMap = #{ byte_code := ByteCode
|
|||||||
serialization_template(SophiaContractVersion),
|
serialization_template(SophiaContractVersion),
|
||||||
Fields).
|
Fields).
|
||||||
|
|
||||||
% NOTE:
|
|
||||||
% This form significantly favors the presence of enacl and slows fallback
|
|
||||||
% invokation of eblake2. `try' is really fast; the error throwing machinery
|
|
||||||
% is comparatively slow. The assumption here is that in cases where you want
|
|
||||||
% eblake2 performance isn't the problem you're solving (you're probably not
|
|
||||||
% syncing a new node, for example).
|
|
||||||
blake2(Size, Bin) ->
|
|
||||||
try
|
|
||||||
enacl:generichash(Size, Bin)
|
|
||||||
catch error:undef ->
|
|
||||||
{ok, Hash} = eblake2:blake2b(Size, Bin),
|
|
||||||
Hash
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
-spec deserialize(binary()) -> map().
|
-spec deserialize(binary()) -> map().
|
||||||
deserialize(Binary) ->
|
deserialize(Binary) ->
|
||||||
case aeser_chain_objects:deserialize_type_and_vsn(Binary) of
|
case aeser_chain_objects:deserialize_type_and_vsn(Binary) of
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(aeser_delegation).
|
-module(aeser_delegation).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-export([ aens_preclaim_sig/3
|
-export([ aens_preclaim_sig/3
|
||||||
, aens_name_sig/4
|
, aens_name_sig/4
|
||||||
|
|||||||
+2
-8
@@ -7,7 +7,6 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
-module(aeser_id).
|
-module(aeser_id).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-export([ create/2
|
-export([ create/2
|
||||||
, specialize/1
|
, specialize/1
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
|
|
||||||
-type tag() :: 'account' | 'oracle' | 'name'
|
-type tag() :: 'account' | 'oracle' | 'name'
|
||||||
| 'commitment' | 'contract' | 'channel'
|
| 'commitment' | 'contract' | 'channel'
|
||||||
| 'associate_chain' | 'entry' .
|
| 'associate_chain' .
|
||||||
-type val() :: <<_:256>>.
|
-type val() :: <<_:256>>.
|
||||||
-opaque(id() :: #id{}).
|
-opaque(id() :: #id{}).
|
||||||
|
|
||||||
@@ -46,8 +45,7 @@
|
|||||||
___TAG___ =:= commitment;
|
___TAG___ =:= commitment;
|
||||||
___TAG___ =:= contract;
|
___TAG___ =:= contract;
|
||||||
___TAG___ =:= channel;
|
___TAG___ =:= channel;
|
||||||
___TAG___ =:= associate_chain;
|
___TAG___ =:= associate_chain
|
||||||
___TAG___ =:= entry
|
|
||||||
).
|
).
|
||||||
-define(IS_VAL(___VAL___), byte_size(___VAL___) =:= 32).
|
-define(IS_VAL(___VAL___), byte_size(___VAL___) =:= 32).
|
||||||
|
|
||||||
@@ -105,8 +103,6 @@ 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(associate_chain) -> 7;
|
||||||
encode_tag(native_token) -> 8;
|
|
||||||
encode_tag(entry) -> 9;
|
|
||||||
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;
|
||||||
@@ -116,6 +112,4 @@ 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(7) -> associate_chain;
|
||||||
decode_tag(8) -> native_token;
|
|
||||||
decode_tag(9) -> entry;
|
|
||||||
decode_tag(X) -> error({illegal_id_tag, X}).
|
decode_tag(X) -> error({illegal_id_tag, X}).
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
-module(aeser_rlp).
|
-module(aeser_rlp).
|
||||||
-vsn("0.1.2").
|
|
||||||
-export([ decode/1
|
-export([ decode/1
|
||||||
, decode_one/1
|
, decode_one/1
|
||||||
, encode/1
|
, encode/1
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
|
|
||||||
-module(aeserialization).
|
-module(aeserialization).
|
||||||
-vsn("0.1.2").
|
|
||||||
|
|
||||||
-export([ decode_fields/2
|
-export([ decode_fields/2
|
||||||
, deserialize/5
|
, deserialize/5
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
, {account_pubkey , 32}
|
, {account_pubkey , 32}
|
||||||
, {signature , 64}
|
, {signature , 64}
|
||||||
, {name , not_applicable}
|
, {name , not_applicable}
|
||||||
, {native_token , 32}
|
|
||||||
, {commitment , 32}
|
, {commitment , 32}
|
||||||
, {peer_pubkey , 32}
|
, {peer_pubkey , 32}
|
||||||
, {state , 32}
|
, {state , 32}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
{name,"Gajumaru Serialization"}.
|
|
||||||
{type,lib}.
|
|
||||||
{modules,[]}.
|
|
||||||
{prefix,none}.
|
|
||||||
{author,"Hans Svensson"}.
|
|
||||||
{desc,"Serialization helpers for the Gajumaru."}.
|
|
||||||
{package_id,{"otpr","gmserialization",{0,1,2}}}.
|
|
||||||
{deps,[{"otpr","base58",{0,1,1}},{"otpr","eblake2",{1,0,0}}]}.
|
|
||||||
{key_name,none}.
|
|
||||||
{a_email,[]}.
|
|
||||||
{c_email,[]}.
|
|
||||||
{copyright,"Hans Svensson"}.
|
|
||||||
{file_exts,[]}.
|
|
||||||
{license,skip}.
|
|
||||||
{repo_url,"https://git.qpq.swiss/QPQ-AG/gmserialization"}.
|
|
||||||
{tags,["blockchain","crypto","gm", "gajumaru"]}.
|
|
||||||
{ws_url,[]}.
|
|
||||||
Reference in New Issue
Block a user