Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

DAWN-376 account history plugin migration #1048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ add_subdirectory(http_plugin)
add_subdirectory(chain_plugin)
add_subdirectory(chain_api_plugin)
add_subdirectory(producer_plugin)
#add_subdirectory(account_history_plugin)
#add_subdirectory(account_history_api_plugin)
add_subdirectory(account_history_plugin)
add_subdirectory(account_history_api_plugin)
add_subdirectory(wallet_plugin)
add_subdirectory(wallet_api_plugin)
add_subdirectory(txn_test_gen_plugin)
add_subdirectory(faucet_testnet_plugin)
add_subdirectory(faucet_testnet_plugin)
2 changes: 1 addition & 1 deletion plugins/account_history_api_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB HEADERS "include/eos/account_history_api_plugin/*.hpp")
file(GLOB HEADERS "include/eosio/account_history_api_plugin/*.hpp")
add_library( account_history_api_plugin
account_history_api_plugin.cpp
${HEADERS} )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <eos/account_history_api_plugin/account_history_api_plugin.hpp>
#include <eosio/account_history_api_plugin/account_history_api_plugin.hpp>
#include <eosio/chain/chain_controller.hpp>
#include <eosio/chain/exceptions.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

#pragma once
#include <eos/account_history_plugin/account_history_plugin.hpp>
#include <eos/chain_plugin/chain_plugin.hpp>
#include <eos/http_plugin/http_plugin.hpp>
#include <eosio/account_history_plugin/account_history_plugin.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp>
#include <eosio/http_plugin/http_plugin.hpp>

#include <appbase/application.hpp>

Expand Down
2 changes: 1 addition & 1 deletion plugins/account_history_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file(GLOB HEADERS "include/eos/account_history_plugin/*.hpp")
file(GLOB HEADERS "include/eosio/account_history_plugin/*.hpp")
add_library( account_history_plugin
account_history_plugin.cpp
${HEADERS} )
Expand Down
218 changes: 118 additions & 100 deletions plugins/account_history_plugin/account_history_plugin.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class account_control_history_object : public chainbase::object<chain::account_c

id_type id;
account_name controlled_account;
permission_name controlled_permission;
permission_name controlled_permission;
account_name controlling_account;
};

Expand All @@ -30,13 +30,17 @@ using account_control_history_multi_index = chainbase::shared_multi_index_contai
account_control_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(account_control_history_object, account_control_history_object::id_type, id)>,
hashed_non_unique<tag<by_controlling>, BOOST_MULTI_INDEX_MEMBER(account_control_history_object, account_name, controlling_account), std::hash<account_name>>,
hashed_non_unique<tag<by_controlled_authority>,
ordered_unique<tag<by_controlling>,
composite_key< account_control_history_object,
member<account_control_history_object, account_name, &account_control_history_object::controlling_account>,
member<account_control_history_object, account_control_history_object::id_type, &account_control_history_object::id>
>
>,
ordered_unique<tag<by_controlled_authority>,
composite_key< account_control_history_object,
member<account_control_history_object, account_name, &account_control_history_object::controlled_account>,
member<account_control_history_object, permission_name, &account_control_history_object::controlled_permission>
>,
composite_key_hash< std::hash<account_name>, std::hash<permission_name> >
>
>
>
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once
#include <appbase/application.hpp>

#include <eos/chain_plugin/chain_plugin.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp>

namespace fc { class variant; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class account_transaction_history_object : public chainbase::object<chain::accou
OBJECT_CTOR(account_transaction_history_object)

id_type id;
account_name account_name;
account_name name;
transaction_id_type transaction_id;
};

Expand All @@ -40,13 +40,11 @@ using account_transaction_history_multi_index = chainbase::shared_multi_index_co
account_transaction_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, account_transaction_history_object::id_type, id)>,
hashed_non_unique<tag<by_account_name>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, account_name, account_name), std::hash<account_name>>,
hashed_unique<tag<by_account_name_trx_id>,
ordered_unique<tag<by_account_name>,
composite_key< account_transaction_history_object,
member<account_transaction_history_object, account_name, &account_transaction_history_object::account_name>,
member<account_transaction_history_object, account_name, &account_transaction_history_object::name>,
member<account_transaction_history_object, transaction_id_type, &account_transaction_history_object::transaction_id>
>,
composite_key_hash< std::hash<account_name>, std::hash<transaction_id_type> >
>
>
>
>;
Expand All @@ -57,5 +55,5 @@ typedef chainbase::generic_index<account_transaction_history_multi_index> accoun

CHAINBASE_SET_INDEX_TYPE( eosio::account_transaction_history_object, eosio::account_transaction_history_multi_index )

FC_REFLECT( eosio::account_transaction_history_object, (account_name)(transaction_id) )
FC_REFLECT( eosio::account_transaction_history_object, (name)(transaction_id) )

Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@
#include <chainbase/chainbase.hpp>
#include <fc/array.hpp>

namespace std {

template<>
struct hash<eosio::chain::public_key_type>
{
size_t operator()( const eosio::chain::public_key_type& key ) const
{
std::hash<fc::ecc::public_key_data> hash;
return hash(key.key_data);
}
};
}

namespace eosio {
using chain::account_name;
using chain::public_key_type;
Expand All @@ -31,8 +18,8 @@ class public_key_history_object : public chainbase::object<chain::public_key_his

id_type id;
public_key_type public_key;
account_name account_name;
permission_name permission;
account_name name;
permission_name permission;
};

struct by_id;
Expand All @@ -42,15 +29,16 @@ using public_key_history_multi_index = chainbase::shared_multi_index_container<
public_key_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(public_key_history_object, public_key_history_object::id_type, id)>,
hashed_non_unique<tag<by_pub_key>, BOOST_MULTI_INDEX_MEMBER(public_key_history_object, public_key_type, public_key), std::hash<public_key_type> >,
hashed_non_unique<tag<by_account_permission>,
ordered_unique<tag<by_pub_key>,
composite_key< public_key_history_object,
member<public_key_history_object, public_key_type, &public_key_history_object::public_key>,
member<public_key_history_object, public_key_history_object::id_type, &public_key_history_object::id>
>
>,
ordered_unique<tag<by_account_permission>,
composite_key< public_key_history_object,
member<public_key_history_object, account_name, &public_key_history_object::account_name>,
member<public_key_history_object, account_name, &public_key_history_object::name>,
member<public_key_history_object, permission_name, &public_key_history_object::permission>
>,
composite_key_hash<
std::hash<account_name>,
std::hash<permission_name>
>
>
>
Expand All @@ -62,5 +50,5 @@ typedef chainbase::generic_index<public_key_history_multi_index> public_key_hist

CHAINBASE_SET_INDEX_TYPE( eosio::public_key_history_object, eosio::public_key_history_multi_index )

FC_REFLECT( eosio::public_key_history_object, (public_key)(account_name)(permission) )
FC_REFLECT( eosio::public_key_history_object, (public_key)(name)(permission) )

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using transaction_history_multi_index = chainbase::shared_multi_index_container<
transaction_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_history_object::id_type, id)>,
hashed_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id), std::hash<transaction_id_type>>
ordered_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id)>
>
>;

Expand Down
5 changes: 3 additions & 2 deletions programs/eosiod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ target_include_directories(eosiod PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries( eosiod
PRIVATE appbase
# PRIVATE account_history_api_plugin account_history_plugin db_plugin
PRIVATE account_history_api_plugin account_history_plugin
# PRIVATE db_plugin
PRIVATE chain_api_plugin producer_plugin chain_plugin
PRIVATE wallet_api_plugin
PRIVATE wallet_api_plugin
PRIVATE net_plugin net_api_plugin txn_test_gen_plugin
PRIVATE http_plugin faucet_testnet_plugin
PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
Expand Down
6 changes: 3 additions & 3 deletions programs/eosiod/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <eosio/chain_api_plugin/chain_api_plugin.hpp>
#include <eos/net_plugin/net_plugin.hpp>
#include <eos/net_api_plugin/net_api_plugin.hpp>
//#include <eosio/account_history_plugin/account_history_plugin.hpp>
//#include <eosio/account_history_api_plugin/account_history_api_plugin.hpp>
#include <eosio/account_history_plugin/account_history_plugin.hpp>
#include <eosio/account_history_api_plugin/account_history_api_plugin.hpp>
#include <eosio/wallet_api_plugin/wallet_api_plugin.hpp>
#include <eosio/txn_test_gen_plugin/txn_test_gen_plugin.hpp>
#include <eosio/faucet_testnet_plugin/faucet_testnet_plugin.hpp>
Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char** argv)
app().set_version(eosio::eosiod::config::version);
app().register_plugin<chain_api_plugin>();
app().register_plugin<producer_plugin>();
// app().register_plugin<account_history_api_plugin>();
app().register_plugin<account_history_api_plugin>();
app().register_plugin<net_plugin>();
app().register_plugin<net_api_plugin>();
app().register_plugin<txn_test_gen_plugin>();
Expand Down
5 changes: 2 additions & 3 deletions programs/launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,8 @@ launcher_def::write_config_file (tn_node_def &node) {
if( instance.has_db ) {
cfg << "plugin = eosio::db_plugin\n";
}
cfg << "plugin = eosio::chain_api_plugin\n";
//<< "plugin = eosio::account_history_plugin\n"
//<< "plugin = eosio::account_history_api_plugin\n";
cfg << "plugin = eosio::chain_api_plugin\n"
<< "plugin = eosio::account_history_api_plugin\n";
cfg.close();
}

Expand Down