From 969a845203538dc7559e58ce0df1a08647a6de6a Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Sun, 5 Jan 2025 14:17:00 +0900 Subject: [PATCH] Remove oracle type references --- rebar.config | 4 ++-- rebar.lock | 6 +++--- src/aeser_api_encoder.erl | 26 ++------------------------ src/aeser_chain_objects.erl | 14 -------------- src/aeser_delegation.erl | 18 ------------------ src/aeser_id.erl | 5 +---- src/aeserialization.erl | 2 +- test/aeser_api_encoder_tests.erl | 2 -- test/aeser_delegation_tests.erl | 19 ------------------- 9 files changed, 9 insertions(+), 87 deletions(-) diff --git a/rebar.config b/rebar.config index 084d1f6..4f2836d 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ {erl_opts, [debug_info]}. -{deps, [ {base58, {git, "https://github.com/aeternity/erl-base58.git", {ref, "60a3356"}}} - , {enacl, {git, "https://gitlab.com/ioecs/enacl.git", {ref, "4eb7ec70"}}} +{deps, [ {base58, {git, "ssh://gitea@git.qpq.swiss:21203/QPQ-AG/erl-base58.git", {ref, "becd654c8bae9f2a78585fafb9f9bce2506df9ca"}}} + , {enacl, {git, "ssh://gitea@git.qpq.swiss:21203/QPQ-AG/enacl.git", {ref, "4eb7ec70084ba7c87b1af8797c4c4e90c84f95a2"}}} ]}. diff --git a/rebar.lock b/rebar.lock index 7a63cfc..14490aa 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,8 +1,8 @@ [{<<"base58">>, - {git,"https://github.com/aeternity/erl-base58.git", - {ref,"60a335668a60328a29f9731b67c4a0e9e3d50ab6"}}, + {git,"ssh://gitea@git.qpq.swiss:21203/QPQ-AG/erl-base58.git", + {ref,"becd654c8bae9f2a78585fafb9f9bce2506df9ca"}}, 0}, {<<"enacl">>, - {git,"https://gitlab.com/ioecs/enacl.git", + {git,"ssh://gitea@git.qpq.swiss:21203/QPQ-AG/enacl.git", {ref,"4eb7ec70084ba7c87b1af8797c4c4e90c84f95a2"}}, 0}]. diff --git a/src/aeser_api_encoder.erl b/src/aeser_api_encoder.erl index 9fc91f8..38518a1 100644 --- a/src/aeser_api_encoder.erl +++ b/src/aeser_api_encoder.erl @@ -27,10 +27,6 @@ | contract_source | transaction | tx_hash - | oracle_pubkey - | oracle_query - | oracle_query_id - | oracle_response | account_pubkey | account_seckey | associate_chain @@ -175,8 +171,7 @@ id2type(contract) -> contract_pubkey; id2type(contract_source) -> contract_source; id2type(name) -> name; id2type(native_token) -> native_token; -id2type(entry) -> entry; -id2type(oracle) -> oracle_pubkey. +id2type(entry) -> entry. type2id(account_pubkey) -> account; type2id(associate_chain) -> associate_chain; @@ -186,8 +181,7 @@ type2id(contract_pubkey) -> contract; type2id(contract_source) -> contract_source; type2id(name) -> name; type2id(native_token) -> native_token; -type2id(entry) -> entry; -type2id(oracle_pubkey) -> oracle. +type2id(entry) -> entry. type2enc(key_block_hash) -> ?BASE58; type2enc(micro_block_hash) -> ?BASE58; @@ -203,10 +197,6 @@ type2enc(contract_store_value) -> ?BASE64; type2enc(contract_source) -> ?BASE64; type2enc(transaction) -> ?BASE64; type2enc(tx_hash) -> ?BASE58; -type2enc(oracle_pubkey) -> ?BASE58; -type2enc(oracle_query) -> ?BASE64; -type2enc(oracle_query_id) -> ?BASE58; -type2enc(oracle_response) -> ?BASE64; type2enc(account_pubkey) -> ?BASE58; type2enc(account_seckey) -> ?BASE58; type2enc(associate_chain) -> ?BASE58; @@ -239,10 +229,6 @@ type2pfx(contract_store_value) -> <<"cv">>; type2pfx(contract_source) -> <<"cx">>; type2pfx(transaction) -> <<"tx">>; type2pfx(tx_hash) -> <<"th">>; -type2pfx(oracle_pubkey) -> <<"ok">>; -type2pfx(oracle_query) -> <<"ov">>; -type2pfx(oracle_query_id) -> <<"oq">>; -type2pfx(oracle_response) -> <<"or">>; type2pfx(account_pubkey) -> <<"ak">>; type2pfx(account_seckey) -> <<"sk">>; type2pfx(associate_chain) -> <<"ac">>; @@ -274,10 +260,6 @@ pfx2type(<<"ct">>) -> contract_pubkey; pfx2type(<<"cx">>) -> contract_source; pfx2type(<<"tx">>) -> transaction; pfx2type(<<"th">>) -> tx_hash; -pfx2type(<<"ok">>) -> oracle_pubkey; -pfx2type(<<"ov">>) -> oracle_query; -pfx2type(<<"oq">>) -> oracle_query_id; -pfx2type(<<"or">>) -> oracle_response; pfx2type(<<"ak">>) -> account_pubkey; pfx2type(<<"sk">>) -> account_seckey; pfx2type(<<"ac">>) -> associate_chain; @@ -311,10 +293,6 @@ 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(tx_hash) -> 32; -byte_size_for_type(oracle_pubkey) -> 32; -byte_size_for_type(oracle_query) -> not_applicable; -byte_size_for_type(oracle_query_id) -> 32; -byte_size_for_type(oracle_response) -> not_applicable; byte_size_for_type(account_pubkey) -> 32; byte_size_for_type(account_seckey) -> 32; byte_size_for_type(associate_chain) -> 32; diff --git a/src/aeser_chain_objects.erl b/src/aeser_chain_objects.erl index 48e416e..508bfb5 100644 --- a/src/aeser_chain_objects.erl +++ b/src/aeser_chain_objects.erl @@ -40,12 +40,6 @@ tag(account) -> 10; tag(signed_tx) -> 11; tag(spend_tx) -> 12; tag(data_extend_tx) -> 13; -tag(oracle) -> 20; -tag(oracle_query) -> 21; -tag(oracle_register_tx) -> 22; -tag(oracle_query_tx) -> 23; -tag(oracle_response_tx) -> 24; -tag(oracle_extend_tx) -> 25; tag(name) -> 30; tag(name_commitment) -> 31; tag(name_claim_tx) -> 32; @@ -88,7 +82,6 @@ tag(contracts_mtree) -> 621; tag(calls_mtree) -> 622; tag(channels_mtree) -> 623; tag(nameservice_mtree) -> 624; -tag(oracles_mtree) -> 625; tag(accounts_mtree) -> 626; tag(acs_mtree) -> 627; tag(entries_mtree) -> 628; @@ -125,12 +118,6 @@ rev_tag(10) -> account; rev_tag(11) -> signed_tx; rev_tag(12) -> spend_tx; rev_tag(13) -> data_extend_tx; -rev_tag(20) -> oracle; -rev_tag(21) -> oracle_query; -rev_tag(22) -> oracle_register_tx; -rev_tag(23) -> oracle_query_tx; -rev_tag(24) -> oracle_response_tx; -rev_tag(25) -> oracle_extend_tx; rev_tag(30) -> name; rev_tag(31) -> name_commitment; rev_tag(32) -> name_claim_tx; @@ -173,7 +160,6 @@ rev_tag(621) -> contracts_mtree; rev_tag(622) -> calls_mtree; rev_tag(623) -> channels_mtree; rev_tag(624) -> nameservice_mtree; -rev_tag(625) -> oracles_mtree; rev_tag(626) -> accounts_mtree; rev_tag(627) -> acs_mtree; rev_tag(628) -> entries_mtree; diff --git a/src/aeser_delegation.erl b/src/aeser_delegation.erl index f399e66..ba26521 100644 --- a/src/aeser_delegation.erl +++ b/src/aeser_delegation.erl @@ -9,9 +9,6 @@ -export([ aens_preclaim_sig/3 , aens_name_sig/4 , aens_sig/3 - - , oracle_sig/3 - , oracle_response_sig/3 ]). %% Delegation signatures are prefixed with a unique tag, ensuring not to @@ -53,21 +50,6 @@ aens_sig(NetworkId, Account, Contract) -> Fields = [{account, Account}, {contract, Contract}], serialize(?TYPE_AENS, NetworkId, Template, Fields). --spec oracle_sig(binary(), aeser_id:id(), aeser_id:id()) -> sig_data(). -oracle_sig(NetworkId, Account, Contract) -> - assert_id(account, Account), - assert_id(contract, Contract), - Template = [{account, id}, {contract, id}], - Fields = [{account, Account}, {contract, Contract}], - serialize(?TYPE_ORACLE, NetworkId, Template, Fields). - --spec oracle_response_sig(binary(), aeser_id:id(), aeser_id:id()) -> sig_data(). -oracle_response_sig(NetworkId, QueryId, Contract) -> - assert_id(oracle, QueryId), - assert_id(contract, Contract), - Template = [{query, id}, {contract, id}], - Fields = [{query, QueryId}, {contract, Contract}], - serialize(?TYPE_ORACLE_RESPONSE, NetworkId, Template, Fields). %% ------------------------------------------------------------------------ %% -- Internal functions diff --git a/src/aeser_id.erl b/src/aeser_id.erl index 3c354fd..ff0b807 100644 --- a/src/aeser_id.erl +++ b/src/aeser_id.erl @@ -24,7 +24,7 @@ , val }). --type tag() :: 'account' | 'oracle' | 'name' +-type tag() :: 'account' | 'name' | 'commitment' | 'contract' | 'channel' | 'associate_chain' | 'entry' . -type val() :: <<_:256>>. @@ -40,7 +40,6 @@ -define(SERIALIZED_SIZE, 33). %% ?TAG_SIZE + ?PUB_SIZE -define(IS_TAG(___TAG___), ___TAG___ =:= account; - ___TAG___ =:= oracle; ___TAG___ =:= name; ___TAG___ =:= commitment; ___TAG___ =:= contract; @@ -100,7 +99,6 @@ decode(<>) -> encode_tag(account) -> 1; encode_tag(name) -> 2; encode_tag(commitment) -> 3; -encode_tag(oracle) -> 4; encode_tag(contract) -> 5; encode_tag(channel) -> 6; encode_tag(associate_chain) -> 7; @@ -111,7 +109,6 @@ encode_tag(Other) -> error({illegal_id_tag_name, Other}). decode_tag(1) -> account; decode_tag(2) -> name; decode_tag(3) -> commitment; -decode_tag(4) -> oracle; decode_tag(5) -> contract; decode_tag(6) -> channel; decode_tag(7) -> associate_chain; diff --git a/src/aeserialization.erl b/src/aeserialization.erl index 11d70a8..9e79d53 100644 --- a/src/aeserialization.erl +++ b/src/aeserialization.erl @@ -35,7 +35,7 @@ | binary() | boolean() | [encodable_term()] %% Of any length - | #{atom() => encodable_term()} + | #{atom() => encodable_term()} | tuple() %% Any arity, containing encodable_term(). | aeser_id:id(). diff --git a/test/aeser_api_encoder_tests.erl b/test/aeser_api_encoder_tests.erl index b02bbf0..4d119fd 100644 --- a/test/aeser_api_encoder_tests.erl +++ b/test/aeser_api_encoder_tests.erl @@ -15,8 +15,6 @@ , {contract_pubkey , 32} , {transaction , not_applicable} , {tx_hash , 32} - , {oracle_pubkey , 32} - , {oracle_query_id , 32} , {account_pubkey , 32} , {signature , 64} , {name , not_applicable} diff --git a/test/aeser_delegation_tests.erl b/test/aeser_delegation_tests.erl index 6b88d79..8cf450d 100644 --- a/test/aeser_delegation_tests.erl +++ b/test/aeser_delegation_tests.erl @@ -11,7 +11,6 @@ -define(ACCOUNT, aeser_id:create(account, <<1:256>>)). -define(CONTRACT, aeser_id:create(contract, <<2:256>>)). -define(NAME, aeser_id:create(name, <<3:256>>)). --define(ORACLE, aeser_id:create(oracle, <<3:256>>)). -define(NETWORK_ID, <<"my_fancy_network"/utf8>>). @@ -27,14 +26,6 @@ encode_correct_test_() -> {"Encode aens wildcard sig", fun() -> aeser_delegation:aens_sig(?NETWORK_ID, ?ACCOUNT, ?CONTRACT) - end}, - {"Encode oracle sig", - fun() -> - aeser_delegation:oracle_sig(?NETWORK_ID, ?ACCOUNT, ?CONTRACT) - end}, - {"Encode oracle response sig", - fun() -> - aeser_delegation:oracle_response_sig(?NETWORK_ID, ?ORACLE, ?CONTRACT) end} ]. @@ -53,15 +44,5 @@ encode_fail_test_() -> fun() -> ?assertError(_, aeser_delegation:aens_sig(?NETWORK_ID, ?ACCOUNT, <<42:256>>)), ?assertError(_, aeser_delegation:aens_sig(?NETWORK_ID, ?CONTRACT, ?CONTRACT)) - end}, - {"Bad encoding oracle sig", - fun() -> - ?assertError(_, aeser_delegation:oracle_sig(?NETWORK_ID, <<42:256>>, ?CONTRACT)), - ?assertError(_, aeser_delegation:oracle_sig(?NETWORK_ID, ?ACCOUNT, ?ACCOUNT)) - end}, - {"Bad encoding oracle response sig", - fun() -> - ?assertError(_, aeser_delegation:oracle_response_sig(?NETWORK_ID, <<42:256>>, ?CONTRACT)), - ?assertError(_, aeser_delegation:oracle_response_sig(?NETWORK_ID, ?ORACLE, ?ORACLE)) end} ].