diff --git a/README.md b/README.md index 941afa68..7173bcb1 100644 --- a/README.md +++ b/README.md @@ -88,14 +88,14 @@ then proceed with: cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release . make ./programs/witness_node/witness_node - + Launching the witness creates required directories. Next, **stop the witness** and continue. $ vi witness_node_data_dir/config.ini p2p-endpoint = 0.0.0.0:9777 rpc-endpoint = 127.0.0.1:8090 seed-node = 213.184.225.234:59500 - + Start the witness back up ./programs/witness_node/witness_node @@ -155,7 +155,7 @@ Create your witness (substitute the url for your witness information) ``` create_witness your_witness_username "url" true ``` -**Be sure to take note of the block_signing_key** +**Be sure to take note of the block_signing_key** IMPORTANT (issue below command using block_signing_key just obtained) ``` diff --git a/docs b/docs index 8d8b69d8..8df8f663 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8d8b69d82482101279460fa02f814d0e4030966f +Subproject commit 8df8f66389853df73ab8f6dd73981be2a6957df8 diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index 18ca3130..cf2355f1 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -1,12 +1,10 @@ -add_subdirectory( fc ) -add_subdirectory( db ) -#add_subdirectory( deterministic_openssl_rand ) +add_subdirectory( app ) add_subdirectory( chain ) +add_subdirectory( db ) add_subdirectory( egenesis ) +add_subdirectory( fc ) add_subdirectory( net ) -#add_subdirectory( p2p ) +add_subdirectory( plugins ) add_subdirectory( time ) add_subdirectory( utilities ) -add_subdirectory( app ) -add_subdirectory( plugins ) add_subdirectory( wallet ) diff --git a/libraries/app/CMakeLists.txt b/libraries/app/CMakeLists.txt index e0e5e6c2..52460c77 100644 --- a/libraries/app/CMakeLists.txt +++ b/libraries/app/CMakeLists.txt @@ -4,16 +4,19 @@ file(GLOB EGENESIS_HEADERS "../egenesis/include/graphene/app/*.hpp") add_library( graphene_app api.cpp application.cpp + config_util.cpp database_api.cpp plugin.cpp - config_util.cpp ${HEADERS} ${EGENESIS_HEADERS} ) # need to link graphene_debug_witness because plugins aren't sufficiently isolated #246 #target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness ) -target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities graphene_debug_witness graphene_bookie graphene_elasticsearch peerplays_sidechain ) +target_link_libraries( graphene_app + PUBLIC graphene_net graphene_utilities + graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch graphene_es_objects graphene_generate_genesis graphene_market_history ) + target_include_directories( graphene_app PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" ) @@ -30,3 +33,26 @@ INSTALL( TARGETS ARCHIVE DESTINATION lib ) INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/app" ) + + + +add_library( graphene_plugin + plugin.cpp + + include/graphene/app/plugin.hpp + ) + +target_link_libraries( graphene_plugin + PUBLIC graphene_net graphene_utilities ) + +target_include_directories( graphene_plugin + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) + +INSTALL( TARGETS + graphene_app + + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 1e876634..f36fd8d3 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -181,7 +181,7 @@ namespace graphene { namespace app { void network_broadcast_api::broadcast_transaction(const signed_transaction& trx) { trx.validate(); - _app.chain_database()->check_tansaction_for_duplicated_operations(trx); + _app.chain_database()->check_transaction_for_duplicated_operations(trx); _app.chain_database()->push_transaction(trx); if( _app.p2p_node() != nullptr ) _app.p2p_node()->broadcast_transaction(trx); @@ -189,8 +189,8 @@ namespace graphene { namespace app { fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx) { - _app.chain_database()->check_tansaction_for_duplicated_operations(trx); - + _app.chain_database()->check_transaction_for_duplicated_operations(trx); + fc::promise::ptr prom( new fc::promise() ); broadcast_transaction_with_callback( [=]( const fc::variant& v ){ prom->set_value(v); diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 17a254d4..cda9207a 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -160,10 +160,12 @@ namespace detail { { // t.me/peerplays #seednodes vector seeds = { - "ppy-beatrice-seed.blckchnd.com:6666", - "159.69.223.206:7777", - "51.38.237.243:9666", - "pbsa-beatrice.blockchainprojectsbv.com:9195" + "pts.blockveritas.co:6666", + "seed-beatrice01.eifos.org:7777", + "seed-testnet.ppy.alex-pu.info:7777", + "seed.ppy-beatrice.blckchnd.com:6666", + "seed.testnet.peerblock.trade:6666", + "testnet-ppyapi.spacemx.tech:9777" }; for( const string& endpoint_string : seeds ) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 95303223..3044959c 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -83,7 +83,7 @@ class database_api_impl : public std::enable_shared_from_this // Keys vector> get_key_references( vector key )const; - bool is_public_key_registered(string public_key) const; + bool is_public_key_registered(string public_key) const; // Accounts account_id_type get_account_id_from_string(const std::string& name_or_id)const; diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 0a0e9c56..4054878c 100755 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -8,143 +8,29 @@ add_dependencies( build_hardfork_hpp cat-parts ) file(GLOB HEADERS "include/graphene/chain/*.hpp") file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/*.hpp") -if( GRAPHENE_DISABLE_UNITY_BUILD ) - set( GRAPHENE_DB_FILES - db_balance.cpp - db_bet.cpp - db_block.cpp - db_debug.cpp - db_getter.cpp - db_init.cpp - db_maint.cpp - db_management.cpp - db_market.cpp - db_update.cpp - db_witness_schedule.cpp - ) +file(GLOB CPP_FILES "*.cpp") +file(GLOB PROTOCOL_CPP_FILES "protocol/*.cpp") + +#if( GRAPHENE_DISABLE_UNITY_BUILD ) + list(FILTER CPP_FILES EXCLUDE REGEX "[/]database[.]cpp$") + #message ("--- ${CPP_FILES}") message( STATUS "Graphene database unity build disabled" ) -else( GRAPHENE_DISABLE_UNITY_BUILD ) - set( GRAPHENE_DB_FILES - database.cpp ) - message( STATUS "Graphene database unity build enabled" ) -endif( GRAPHENE_DISABLE_UNITY_BUILD ) +#else( GRAPHENE_DISABLE_UNITY_BUILD ) +# list(FILTER CPP_FILES EXCLUDE REGEX ".*db_.*[.]cpp$") +# #message ("--- ${CPP_FILES}") +# message( STATUS "Graphene database unity build enabled" ) +#endif( GRAPHENE_DISABLE_UNITY_BUILD ) -## SORT .cpp by most likely to change / break compile add_library( graphene_chain - - # As database takes the longest to compile, start it first - ${GRAPHENE_DB_FILES} - fork_database.cpp - - protocol/types.cpp - protocol/address.cpp - protocol/authority.cpp - protocol/asset.cpp - protocol/assert.cpp - protocol/account.cpp - protocol/transfer.cpp - protocol/chain_parameters.cpp - protocol/committee_member.cpp - protocol/witness.cpp - protocol/market.cpp - protocol/proposal.cpp - protocol/withdraw_permission.cpp - protocol/asset_ops.cpp - protocol/lottery_ops.cpp - protocol/memo.cpp - protocol/worker.cpp - protocol/custom.cpp - protocol/operations.cpp - protocol/transaction.cpp - protocol/block.cpp - protocol/fee_schedule.cpp - protocol/confidential.cpp - protocol/vote.cpp - protocol/tournament.cpp - protocol/small_ops.cpp - protocol/custom_permission.cpp - protocol/custom_account_authority.cpp - protocol/offer.cpp - - genesis_state.cpp - get_config.cpp - - pts_address.cpp - - evaluator.cpp - balance_evaluator.cpp - account_evaluator.cpp - assert_evaluator.cpp - witness_evaluator.cpp - committee_member_evaluator.cpp - asset_evaluator.cpp - lottery_evaluator.cpp - transfer_evaluator.cpp - proposal_evaluator.cpp - market_evaluator.cpp - vesting_balance_evaluator.cpp - tournament_evaluator.cpp - tournament_object.cpp - match_object.cpp - game_object.cpp - withdraw_permission_evaluator.cpp - worker_evaluator.cpp - confidential_evaluator.cpp - special_authority.cpp - buyback.cpp - - account_object.cpp - asset_object.cpp - fba_object.cpp - proposal_object.cpp - vesting_balance_object.cpp - small_objects.cpp - - block_database.cpp - - is_authorized_asset.cpp - - protocol/sport.cpp - sport_evaluator.cpp - protocol/event_group.cpp - event_group_evaluator.cpp - event_group_object.cpp - protocol/event.cpp - event_evaluator.cpp - event_object.cpp - protocol/betting_market.cpp - betting_market_evaluator.cpp - betting_market_object.cpp - betting_market_group_object.cpp - custom_permission_evaluator.cpp - custom_account_authority_evaluator.cpp - - affiliate_payout.cpp - - offer_object.cpp - offer_evaluator.cpp - nft_evaluator.cpp - protocol/nft.cpp - protocol/account_role.cpp - account_role_evaluator.cpp - - son_evaluator.cpp - son_object.cpp - - son_wallet_evaluator.cpp - son_wallet_deposit_evaluator.cpp - son_wallet_withdraw_evaluator.cpp - - sidechain_address_evaluator.cpp - sidechain_transaction_evaluator.cpp - + ${CPP_FILES} + ${PROTOCOL_CPP_FILES} ${HEADERS} ${PROTOCOL_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp" ) add_dependencies( graphene_chain build_hardfork_hpp ) -target_link_libraries( graphene_chain fc graphene_db ) +target_link_libraries( graphene_chain graphene_db ) target_include_directories( graphene_chain PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" ) diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index e6168438..985fb8df 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -79,7 +79,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o { auto dotpos = op.symbol.rfind( '.' ); if( dotpos != std::string::npos ) - + { auto prefix = op.symbol.substr( 0, dotpos ); auto asset_symbol_itr = asset_indx.find( prefix ); @@ -122,7 +122,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o FC_ASSERT( op.bitasset_opts ); FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision ); } - + return void_result(); } FC_CAPTURE_AND_RETHROW( (op) ) } @@ -177,7 +177,7 @@ object_id_type asset_create_evaluator::do_apply( const asset_create_operation& o a.options.core_exchange_rate.base.asset_id = next_asset_id; a.dynamic_asset_data_id = dyn_asset.id; - + if( op.bitasset_opts.valid() ) a.bitasset_data_id = bit_asset_id; }); @@ -225,7 +225,7 @@ void_result lottery_asset_create_evaluator::do_evaluate( const lottery_asset_cre { auto dotpos = op.symbol.rfind( '.' ); if( dotpos != std::string::npos ) - + { auto prefix = op.symbol.substr( 0, dotpos ); auto asset_symbol_itr = asset_indx.find( prefix ); @@ -578,7 +578,7 @@ void_result asset_update_dividend_evaluator::do_evaluate(const asset_update_divi auto& params = db().get_global_properties().parameters; if (o.new_options.payout_interval && *o.new_options.payout_interval < params.maintenance_interval) - FC_THROW("New payout interval may not be less than the maintenance interval", + FC_THROW("New payout interval may not be less than the maintenance interval", ("new_payout_interval", o.new_options.payout_interval)("maintenance_interval", params.maintenance_interval)); return void_result(); } FC_CAPTURE_AND_RETHROW( (o) ) } diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 1e124902..8c1287c3 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -30,6 +30,6 @@ #include "db_maint.cpp" #include "db_management.cpp" #include "db_market.cpp" +#include "db_notify.cpp" #include "db_update.cpp" #include "db_witness_schedule.cpp" -#include "db_notify.cpp" \ No newline at end of file diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index c7881906..21701a25 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -44,11 +44,11 @@ namespace { - + struct proposed_operations_digest_accumulator { typedef void result_type; - + void operator()(const graphene::chain::proposal_create_operation& proposal) { for (auto& operation: proposal.proposed_ops) @@ -56,20 +56,20 @@ namespace { proposed_operations_digests.push_back(fc::digest(operation.op)); } } - + //empty template method is needed for all other operation types //we can ignore them, we are interested in only proposal_create_operation template - void operator()(const T&) + void operator()(const T&) {} - + std::vector proposed_operations_digests; }; - + std::vector gather_proposed_operations_digests(const graphene::chain::transaction& trx) { proposed_operations_digest_accumulator digest_accumulator; - + for (auto& operation: trx.operations) { if( operation.which() != graphene::chain::operation::tag::value @@ -78,7 +78,7 @@ namespace { else edump( ("Found dup")); } - + return digest_accumulator.proposed_operations_digests; } } @@ -148,24 +148,24 @@ std::vector database::get_block_ids_on_fork(block_id_type head_of result.emplace_back(branches.first.back()->previous_id()); return result; } - -void database::check_tansaction_for_duplicated_operations(const signed_transaction& trx) + +void database::check_transaction_for_duplicated_operations(const signed_transaction& trx) { const auto& proposal_index = get_index(); std::set existed_operations_digests; - + proposal_index.inspect_all_objects( [&](const object& obj){ const proposal_object& proposal = static_cast(obj); auto proposed_operations_digests = gather_proposed_operations_digests( proposal.proposed_transaction ); existed_operations_digests.insert( proposed_operations_digests.begin(), proposed_operations_digests.end() ); }); - + for (auto& pending_transaction: _pending_tx) { auto proposed_operations_digests = gather_proposed_operations_digests(pending_transaction); existed_operations_digests.insert(proposed_operations_digests.begin(), proposed_operations_digests.end()); } - + auto proposed_operations_digests = gather_proposed_operations_digests(trx); for (auto& digest: proposed_operations_digests) { @@ -337,7 +337,7 @@ void database::verify_signing_witness( const signed_block& new_block, const fork FC_ASSERT( new_block.witness == wid, "Witness produced block at wrong time", ("block witness",new_block.witness)("scheduled",wid)("slot_num",slot_num) ); FC_ASSERT( new_block.validate_signee( wid(*this).signing_key ) ); - } + } } void database::update_witnesses( fork_item& fork_entry )const @@ -351,7 +351,7 @@ void database::update_witnesses( fork_item& fork_entry )const const witness_schedule_object& wso = get_witness_schedule_object(); fork_entry.scheduled_witnesses = std::make_shared< vector< pair< witness_id_type, public_key_type > > >(); fork_entry.scheduled_witnesses->reserve( wso.current_shuffled_witnesses.size() ); - + for( size_t i = 0; i < wso.current_shuffled_witnesses.size(); ++i ) { const auto& witness = wso.current_shuffled_witnesses[i](*this); @@ -551,7 +551,7 @@ signed_block database::_generate_block( pending_block.timestamp = when; pending_block.transaction_merkle_root = pending_block.calculate_merkle_root(); pending_block.witness = witness_id; - + // Genesis witnesses start with a default initial secret if( witness_obj.next_secret_hash == secret_hash_type::hash( secret_hash_type() ) ) { pending_block.previous_secret = secret_hash_type(); @@ -561,7 +561,7 @@ signed_block database::_generate_block( fc::raw::pack( last_enc, witness_obj.previous_secret ); pending_block.previous_secret = last_enc.result(); } - + secret_hash_type::encoder next_enc; fc::raw::pack( next_enc, block_signing_private_key ); fc::raw::pack( next_enc, pending_block.previous_secret ); @@ -692,10 +692,10 @@ void database::_apply_block( const signed_block& next_block ) // For VOPs derived directly from a real op, // use the real op's (block_num,trx_in_block,op_in_trx), virtual_op starts from 1. // For VOPs created after processed all transactions, - // trx_in_block = the_block.trsanctions.size(), virtual_op starts from 0. + // trx_in_block = the_block.trsanctions.size(), virtual_op starts from 0. ++_current_trx_in_block; _current_op_in_trx = 0; - _current_virtual_op = 0; + _current_virtual_op = 0; } if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM) { @@ -713,9 +713,9 @@ void database::_apply_block( const signed_block& next_block ) // Are we at the maintenance interval? if( maint_needed ) perform_chain_maintenance(next_block, global_props); - + check_ending_lotteries(); - + create_block_summary(next_block); place_delayed_bets(); // must happen after update_global_dynamic_data() updates the time clear_expired_transactions(); @@ -786,7 +786,7 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx auto& trx_idx = get_mutable_index_type(); const chain_id_type& chain_id = get_chain_id(); transaction_id_type trx_id; - + if( !(skip & skip_transaction_dupe_check) ) { trx_id = trx.id(); @@ -884,7 +884,7 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign FC_ASSERT( secret_hash_type::hash( next_block.previous_secret ) == witness.next_secret_hash, "", ( "previous_secret", next_block.previous_secret )( "next_secret_hash", witness.next_secret_hash ) ); - if( !(skip&skip_witness_signature) ) + if( !(skip&skip_witness_signature) ) FC_ASSERT( next_block.validate_signee( witness.signing_key ) ); if( !(skip&skip_witness_schedule_check) ) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index a64b6d65..d7e7eb23 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -32,22 +32,24 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include #include #include +#include #include #include #include #include #include -#include #define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed diff --git a/libraries/chain/db_notify.cpp b/libraries/chain/db_notify.cpp index 06ffdee5..455b17a3 100644 --- a/libraries/chain/db_notify.cpp +++ b/libraries/chain/db_notify.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include #include +#include +#include +#include +#include using namespace fc; diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index 2e896070..a2989e2b 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -26,16 +26,18 @@ #include #include +#include +#include #include #include #include +#include #include +#include +#include #include #include #include -#include -#include -#include #include diff --git a/libraries/chain/hardfork.d/SON.hf b/libraries/chain/hardfork.d/SON.hf index 5cc86af6..1f1a9c5a 100644 --- a/libraries/chain/hardfork.d/SON.hf +++ b/libraries/chain/hardfork.d/SON.hf @@ -1,5 +1,4 @@ // SON HARDFORK Wednesday, October 28, 2020 0:00:00 GMT #ifndef HARDFORK_SON_TIME -#include #define HARDFORK_SON_TIME (fc::time_point_sec( 1603843200 )) #endif diff --git a/libraries/chain/include/graphene/chain/account_role_object.hpp b/libraries/chain/include/graphene/chain/account_role_object.hpp index 9455f475..ccdfc9bc 100644 --- a/libraries/chain/include/graphene/chain/account_role_object.hpp +++ b/libraries/chain/include/graphene/chain/account_role_object.hpp @@ -28,10 +28,10 @@ namespace graphene using account_role_multi_index_type = multi_index_container< account_role_object, indexed_by< - ordered_unique< tag, + ordered_unique< tag, member >, - ordered_non_unique< tag, + ordered_non_unique< tag, member >, ordered_unique< tag, @@ -46,4 +46,4 @@ namespace graphene } // namespace graphene FC_REFLECT_DERIVED(graphene::chain::account_role_object, (graphene::db::object), - (owner)(name)(metadata)(allowed_operations)(whitelisted_accounts)(valid_to)) \ No newline at end of file + (owner)(name)(metadata)(allowed_operations)(whitelisted_accounts)(valid_to)) diff --git a/libraries/chain/include/graphene/chain/betting_market_object.hpp b/libraries/chain/include/graphene/chain/betting_market_object.hpp index 36e8e664..2abe6b20 100644 --- a/libraries/chain/include/graphene/chain/betting_market_object.hpp +++ b/libraries/chain/include/graphene/chain/betting_market_object.hpp @@ -718,8 +718,8 @@ inline Stream& operator>>( Stream& s, betting_market_group_object& betting_marke } } // graphene::chain FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) ) -FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description) ) -FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id) ) +FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description)(event_id)(rules_id)(asset_id)(total_matched_bets_amount)(never_in_play)(delay_before_settling)(settling_time) ) +FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id)(description)(payout_condition)(resolution) ) FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) ) FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) ) diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index 89d3cce3..776b0f1b 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -153,7 +153,7 @@ #define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4 #define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3 -#define GRAPHENE_CURRENT_DB_VERSION "PPY2.3" +#define GRAPHENE_CURRENT_DB_VERSION "PPY2.4" #define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT) diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 05927399..41c1aa2b 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -140,8 +140,8 @@ namespace graphene { namespace chain { void add_checkpoints( const flat_map& checkpts ); const flat_map get_checkpoints()const { return _checkpoints; } bool before_last_checkpoint()const; - - void check_tansaction_for_duplicated_operations(const signed_transaction& trx); + + void check_transaction_for_duplicated_operations(const signed_transaction& trx); bool push_block( const signed_block& b, uint32_t skip = skip_nothing ); processed_transaction push_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing ); diff --git a/libraries/chain/include/graphene/chain/event_object.hpp b/libraries/chain/include/graphene/chain/event_object.hpp index 4258cbb1..56330029 100644 --- a/libraries/chain/include/graphene/chain/event_object.hpp +++ b/libraries/chain/include/graphene/chain/event_object.hpp @@ -158,5 +158,6 @@ typedef generic_index event_object_ return s; } } } // graphene::chain -FC_REFLECT(graphene::chain::event_object, (name)) +FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores)) + diff --git a/libraries/chain/include/graphene/chain/protocol/betting_market.hpp b/libraries/chain/include/graphene/chain/protocol/betting_market.hpp index 26b6f263..8ed9e2ac 100644 --- a/libraries/chain/include/graphene/chain/protocol/betting_market.hpp +++ b/libraries/chain/include/graphene/chain/protocol/betting_market.hpp @@ -481,13 +481,13 @@ FC_REFLECT( graphene::chain::bet_place_operation, (fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) ) FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) ) +FC_REFLECT( graphene::chain::bet_matched_operation, (fee)(bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) ) FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) ) FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) ) FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) ) +FC_REFLECT( graphene::chain::bet_canceled_operation, (fee)(bettor_id)(bet_id)(stake_returned) ) FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_adjusted_operation, (bettor_id)(bet_id)(stake_returned) ) +FC_REFLECT( graphene::chain::bet_adjusted_operation, (fee) (bettor_id)(bet_id)(stake_returned) ) diff --git a/libraries/chain/index.cpp b/libraries/chain/index.cpp deleted file mode 100644 index 41a469b2..00000000 --- a/libraries/chain/index.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015 Cryptonomex, Inc., and contributors. - * - * The MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include -#include -#include - -namespace graphene { namespace chain { - void base_primary_index::save_undo( const object& obj ) - { _db.save_undo( obj ); } - - void base_primary_index::on_add( const object& obj ) - { - _db.save_undo_add( obj ); - for( auto ob : _observers ) ob->on_add( obj ); - } - - void base_primary_index::on_remove( const object& obj ) - { _db.save_undo_remove( obj ); for( auto ob : _observers ) ob->on_remove( obj ); } - - void base_primary_index::on_modify( const object& obj ) - {for( auto ob : _observers ) ob->on_modify( obj ); } -} } // graphene::chain diff --git a/libraries/chain/proposal_evaluator.cpp b/libraries/chain/proposal_evaluator.cpp index 3ea4a836..38521284 100644 --- a/libraries/chain/proposal_evaluator.cpp +++ b/libraries/chain/proposal_evaluator.cpp @@ -62,10 +62,18 @@ struct proposal_operation_hardfork_visitor FC_ASSERT( !aco.extensions.value.affiliate_distributions.valid(), "Affiliate reward distributions not allowed yet" ); } + void operator()(const sport_create_operation &v) const { + FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_create_operation not allowed yet!" ); + } + void operator()(const sport_update_operation &v) const { FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_update_operation not allowed yet!" ); } + void operator()(const sport_delete_operation &v) const { + FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_delete_operation not allowed yet!" ); + } + void operator()(const event_group_create_operation &v) const { FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_create_operation not allowed yet!" ); } @@ -74,6 +82,10 @@ struct proposal_operation_hardfork_visitor FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_update_operation not allowed yet!" ); } + void operator()(const event_group_delete_operation &v) const { + FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_delete_operation not allowed yet!" ); + } + void operator()(const event_create_operation &v) const { FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_create_operation not allowed yet!" ); } @@ -111,7 +123,7 @@ struct proposal_operation_hardfork_visitor } void operator()(const bet_cancel_operation &v) const { - FC_ASSERT( block_time >= HARDFORK_1000_TIME, "betting_market_group_resolve_operation not allowed yet!" ); + FC_ASSERT( block_time >= HARDFORK_1000_TIME, "bet_cancel_operation not allowed yet!" ); } void operator()(const betting_market_group_update_operation &v) const { diff --git a/libraries/chain/protocol/competitor.cpp b/libraries/chain/protocol/competitor.cpp deleted file mode 100644 index 1f35cf37..00000000 --- a/libraries/chain/protocol/competitor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors. - * - * The MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include - -namespace graphene { namespace chain { - -void competitor_create_operation::validate() const -{ - FC_ASSERT( fee.amount >= 0 ); -} - - -} } // graphene::chain - diff --git a/libraries/chain/transaction_object.cpp b/libraries/chain/transaction_object.cpp deleted file mode 100644 index fb4f75df..00000000 --- a/libraries/chain/transaction_object.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2015 Cryptonomex, Inc., and contributors. - * - * The MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include - -namespace graphene { namespace chain { - -const object* transaction_index::create(const std::function& constructor, object_id_type) -{ - transaction_object obj; - - obj.id = get_next_available_id(); - constructor(&obj); - - auto result = _index.insert(std::move(obj)); - FC_ASSERT(result.second, "Could not create transaction_object! Most likely a uniqueness constraint is violated."); - return &*result.first; -} - -void transaction_index::modify(const object* obj, - const std::function& m) -{ - assert(obj != nullptr); - FC_ASSERT(obj->id < _index.size()); - - const transaction_object* t = dynamic_cast(obj); - assert(t != nullptr); - - auto itr = _index.find(obj->id.instance()); - assert(itr != _index.end()); - _index.modify(itr, [&m](transaction_object& o) { m(&o); }); -} - -void transaction_index::add(unique_ptr o) -{ - assert(o); - object_id_type id = o->id; - assert(id.space() == transaction_object::space_id); - assert(id.type() == transaction_object::type_id); - assert(id.instance() == size()); - - auto trx = dynamic_cast(o.get()); - assert(trx != nullptr); - o.release(); - - auto result = _index.insert(std::move(*trx)); - FC_ASSERT(result.second, "Could not insert transaction_object! Most likely a uniqueness constraint is violated."); -} - -void transaction_index::remove(object_id_type id) -{ - auto& index = _index.get(); - auto itr = index.find(id.instance()); - if( itr == index.end() ) - return; - - assert(id.space() == transaction_object::space_id); - assert(id.type() == transaction_object::type_id); - - index.erase(itr); -} - -const object*transaction_index::get(object_id_type id) const -{ - if( id.type() != transaction_object::type_id || - id.space() != transaction_object::space_id ) - return nullptr; - - auto itr = _index.find(id.instance()); - if( itr == _index.end() ) - return nullptr; - return &*itr; -} - -} } // graphene::chain diff --git a/libraries/egenesis/CMakeLists.txt b/libraries/egenesis/CMakeLists.txt index 68de4b00..75589999 100644 --- a/libraries/egenesis/CMakeLists.txt +++ b/libraries/egenesis/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_egenesis_none include/graphene/egenesis/egenesis.hpp ) -target_link_libraries( graphene_egenesis_none graphene_chain fc ) +target_link_libraries( graphene_egenesis_none graphene_chain ) target_include_directories( graphene_egenesis_none PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) @@ -12,7 +12,7 @@ add_executable( embed_genesis embed_genesis.cpp ) -target_link_libraries( embed_genesis graphene_chain graphene_app graphene_egenesis_none fc ) +target_link_libraries( embed_genesis PRIVATE graphene_app graphene_egenesis_none ) set( embed_genesis_args -t "${CMAKE_CURRENT_SOURCE_DIR}/egenesis_brief.cpp.tmpl---${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp" @@ -42,8 +42,8 @@ add_custom_command( add_library( graphene_egenesis_brief "${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp" include/graphene/egenesis/egenesis.hpp ) add_library( graphene_egenesis_full "${CMAKE_CURRENT_BINARY_DIR}/egenesis_full.cpp" include/graphene/egenesis/egenesis.hpp ) -target_link_libraries( graphene_egenesis_brief graphene_chain fc ) -target_link_libraries( graphene_egenesis_full graphene_chain fc ) +target_link_libraries( graphene_egenesis_brief graphene_chain ) +target_link_libraries( graphene_egenesis_full graphene_chain ) target_include_directories( graphene_egenesis_brief PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/net/CMakeLists.txt b/libraries/net/CMakeLists.txt index 955012e4..1cc71728 100644 --- a/libraries/net/CMakeLists.txt +++ b/libraries/net/CMakeLists.txt @@ -10,12 +10,8 @@ set(SOURCES node.cpp add_library( graphene_net ${SOURCES} ${HEADERS} ) -target_link_libraries( graphene_net - PUBLIC fc graphene_db ) -target_include_directories( graphene_net - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../chain/include" "${CMAKE_CURRENT_BINARY_DIR}/../chain/include" -) +target_link_libraries( graphene_net graphene_chain ) +target_include_directories( graphene_net PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) if(MSVC) set_source_files_properties( node.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) diff --git a/libraries/plugins/CMakeLists.txt b/libraries/plugins/CMakeLists.txt index d2a5be16..20497629 100644 --- a/libraries/plugins/CMakeLists.txt +++ b/libraries/plugins/CMakeLists.txt @@ -1,14 +1,14 @@ -add_subdirectory( witness ) add_subdirectory( account_history ) add_subdirectory( accounts_list ) add_subdirectory( affiliate_stats ) -add_subdirectory( elasticsearch ) -add_subdirectory( market_history ) -add_subdirectory( delayed_node ) add_subdirectory( bookie ) +add_subdirectory( debug_witness ) +add_subdirectory( delayed_node ) +add_subdirectory( elasticsearch ) +add_subdirectory( es_objects ) add_subdirectory( generate_genesis ) add_subdirectory( generate_uia_sharedrop_genesis ) -add_subdirectory( debug_witness ) -add_subdirectory( snapshot ) +add_subdirectory( market_history ) add_subdirectory( peerplays_sidechain ) -add_subdirectory( es_objects ) +add_subdirectory( snapshot ) +add_subdirectory( witness ) diff --git a/libraries/plugins/account_history/CMakeLists.txt b/libraries/plugins/account_history/CMakeLists.txt index 4af81abb..4a40fba8 100644 --- a/libraries/plugins/account_history/CMakeLists.txt +++ b/libraries/plugins/account_history/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_account_history account_history_plugin.cpp ) -target_link_libraries( graphene_account_history graphene_chain graphene_app ) +target_link_libraries( graphene_account_history PRIVATE graphene_plugin ) target_include_directories( graphene_account_history PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/accounts_list/CMakeLists.txt b/libraries/plugins/accounts_list/CMakeLists.txt index 3c2747c2..b337409e 100644 --- a/libraries/plugins/accounts_list/CMakeLists.txt +++ b/libraries/plugins/accounts_list/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_accounts_list accounts_list_plugin.cpp ) -target_link_libraries( graphene_accounts_list graphene_chain graphene_app ) +target_link_libraries( graphene_accounts_list PRIVATE graphene_plugin ) target_include_directories( graphene_accounts_list PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/affiliate_stats/CMakeLists.txt b/libraries/plugins/affiliate_stats/CMakeLists.txt index fec2544c..60b2d6e2 100644 --- a/libraries/plugins/affiliate_stats/CMakeLists.txt +++ b/libraries/plugins/affiliate_stats/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( graphene_affiliate_stats affiliate_stats_plugin.cpp ) -target_link_libraries( graphene_affiliate_stats graphene_chain graphene_app ) +target_link_libraries( graphene_affiliate_stats PRIVATE graphene_plugin graphene_account_history ) target_include_directories( graphene_affiliate_stats PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/bookie/CMakeLists.txt b/libraries/plugins/bookie/CMakeLists.txt index 12d84e3c..d7c6d4c0 100644 --- a/libraries/plugins/bookie/CMakeLists.txt +++ b/libraries/plugins/bookie/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( graphene_bookie bookie_api.cpp ) -target_link_libraries( graphene_bookie graphene_chain graphene_app ) +target_link_libraries( graphene_bookie PRIVATE graphene_plugin ) target_include_directories( graphene_bookie PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/debug_witness/CMakeLists.txt b/libraries/plugins/debug_witness/CMakeLists.txt index f0fcb7fb..ac7d7fc9 100644 --- a/libraries/plugins/debug_witness/CMakeLists.txt +++ b/libraries/plugins/debug_witness/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( graphene_debug_witness debug_witness.cpp ) -target_link_libraries( graphene_debug_witness graphene_chain graphene_app ) +target_link_libraries( graphene_debug_witness PRIVATE graphene_plugin ) target_include_directories( graphene_debug_witness PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/delayed_node/CMakeLists.txt b/libraries/plugins/delayed_node/CMakeLists.txt index 63dd73e5..d481eb84 100644 --- a/libraries/plugins/delayed_node/CMakeLists.txt +++ b/libraries/plugins/delayed_node/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_delayed_node delayed_node_plugin.cpp ) -target_link_libraries( graphene_delayed_node graphene_chain graphene_app ) +target_link_libraries( graphene_delayed_node PRIVATE graphene_plugin graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch graphene_market_history ) target_include_directories( graphene_delayed_node PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/elasticsearch/CMakeLists.txt b/libraries/plugins/elasticsearch/CMakeLists.txt index f4815576..88e584b7 100644 --- a/libraries/plugins/elasticsearch/CMakeLists.txt +++ b/libraries/plugins/elasticsearch/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_elasticsearch elasticsearch_plugin.cpp ) -target_link_libraries( graphene_elasticsearch graphene_chain graphene_app curl ) +target_link_libraries( graphene_elasticsearch PRIVATE graphene_plugin curl ) target_include_directories( graphene_elasticsearch PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/es_objects/CMakeLists.txt b/libraries/plugins/es_objects/CMakeLists.txt index 92e3d150..bcaabe52 100644 --- a/libraries/plugins/es_objects/CMakeLists.txt +++ b/libraries/plugins/es_objects/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_es_objects es_objects.cpp ) -target_link_libraries( graphene_es_objects graphene_chain graphene_app curl ) +target_link_libraries( graphene_es_objects PRIVATE graphene_plugin curl ) target_include_directories( graphene_es_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/generate_genesis/CMakeLists.txt b/libraries/plugins/generate_genesis/CMakeLists.txt index 45ad5719..acc24202 100644 --- a/libraries/plugins/generate_genesis/CMakeLists.txt +++ b/libraries/plugins/generate_genesis/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_generate_genesis generate_genesis.cpp ) -target_link_libraries( graphene_generate_genesis graphene_chain graphene_app graphene_time ) +target_link_libraries( graphene_generate_genesis PRIVATE graphene_plugin ) target_include_directories( graphene_generate_genesis PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/generate_uia_sharedrop_genesis/CMakeLists.txt b/libraries/plugins/generate_uia_sharedrop_genesis/CMakeLists.txt index d2a50ab6..737e7614 100644 --- a/libraries/plugins/generate_uia_sharedrop_genesis/CMakeLists.txt +++ b/libraries/plugins/generate_uia_sharedrop_genesis/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_generate_uia_sharedrop_genesis generate_uia_sharedrop_genesis.cpp ) -target_link_libraries( graphene_generate_uia_sharedrop_genesis graphene_chain graphene_app graphene_time ) +target_link_libraries( graphene_generate_uia_sharedrop_genesis PRIVATE graphene_plugin ) target_include_directories( graphene_generate_uia_sharedrop_genesis PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp b/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp deleted file mode 100644 index ef1ae04c..00000000 --- a/libraries/plugins/grouped_orders/grouped_orders_plugin.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2018 Abit More, and contributors. - * - * The MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include - -#include - -namespace graphene { namespace grouped_orders { - -namespace detail -{ - -class grouped_orders_plugin_impl -{ - public: - grouped_orders_plugin_impl(grouped_orders_plugin& _plugin) - :_self( _plugin ) {} - virtual ~grouped_orders_plugin_impl(); - - graphene::chain::database& database() - { - return _self.database(); - } - - grouped_orders_plugin& _self; - flat_set _tracked_groups; -}; - -/** - * @brief This secondary index is used to track changes on limit order objects. - */ -class limit_order_group_index : public secondary_index -{ - public: - limit_order_group_index( const flat_set& groups ) : _tracked_groups( groups ) {}; - - virtual void object_inserted( const object& obj ) override; - virtual void object_removed( const object& obj ) override; - virtual void about_to_modify( const object& before ) override; - virtual void object_modified( const object& after ) override; - - const flat_set& get_tracked_groups() const - { return _tracked_groups; } - - const map< limit_order_group_key, limit_order_group_data >& get_order_groups() const - { return _og_data; } - - private: - void remove_order( const limit_order_object& obj, bool remove_empty = true ); - - /** tracked groups */ - flat_set _tracked_groups; - - /** maps the group key to group data */ - map< limit_order_group_key, limit_order_group_data > _og_data; -}; - -void limit_order_group_index::object_inserted( const object& objct ) -{ try { - const limit_order_object& o = static_cast( objct ); - - auto& idx = _og_data; - - for( uint16_t group : get_tracked_groups() ) - { - auto create_ogo = [&]() { - idx[ limit_order_group_key( group, o.sell_price ) ] = limit_order_group_data( o.sell_price, o.for_sale ); - }; - // if idx is empty, insert this order - // Note: not capped - if( idx.empty() ) - { - create_ogo(); - continue; - } - - // cap the price - price capped_price = o.sell_price; - price max = o.sell_price.max(); - price min = o.sell_price.min(); - bool capped_max = false; - bool capped_min = false; - if( o.sell_price > max ) - { - capped_price = max; - capped_max = true; - } - else if( o.sell_price < min ) - { - capped_price = min; - capped_min = true; - } - // if idx is not empty, find the group that is next to this order - auto itr = idx.lower_bound( limit_order_group_key( group, capped_price ) ); - bool check_previous = false; - if( itr == idx.end() || itr->first.group != group - || itr->first.min_price.base.asset_id != o.sell_price.base.asset_id - || itr->first.min_price.quote.asset_id != o.sell_price.quote.asset_id ) - // not same market or group type - check_previous = true; - else // same market and group type - { - bool update_max = false; - if( capped_price > itr->second.max_price ) // implies itr->min_price <= itr->max_price < max - { - update_max = true; - price max_price = itr->first.min_price * ratio_type( GRAPHENE_100_PERCENT + group, GRAPHENE_100_PERCENT ); - // max_price should have been capped here - if( capped_price > max_price ) // new order is out of range - check_previous = true; - } - if( !check_previous ) // new order is within the range - { - if( capped_min && o.sell_price < itr->first.min_price ) - { // need to update itr->min_price here, if itr is below min, and new order is even lower - // TODO improve performance - limit_order_group_data data( itr->second.max_price, o.for_sale + itr->second.total_for_sale ); - idx.erase( itr ); - idx[ limit_order_group_key( group, o.sell_price ) ] = data; - } - else - { - if( update_max || ( capped_max && o.sell_price > itr->second.max_price ) ) - itr->second.max_price = o.sell_price; // store real price here, not capped - itr->second.total_for_sale += o.for_sale; - } - } - } - - if( check_previous ) - { - if( itr == idx.begin() ) // no previous - create_ogo(); - else - { - --itr; // should be valid - if( itr->first.group != group || itr->first.min_price.base.asset_id != o.sell_price.base.asset_id - || itr->first.min_price.quote.asset_id != o.sell_price.quote.asset_id ) - // not same market or group type - create_ogo(); - else // same market and group type - { - // due to lower_bound, always true: capped_price < itr->first.min_price, so no need to check again, - // if new order is in range of itr group, always need to update itr->first.min_price, unless - // o.sell_price is higher than max - price min_price = itr->second.max_price / ratio_type( GRAPHENE_100_PERCENT + group, GRAPHENE_100_PERCENT ); - // min_price should have been capped here - if( capped_price < min_price ) // new order is out of range - create_ogo(); - else if( capped_max && o.sell_price >= itr->first.min_price ) - { // itr is above max, and price of new order is even higher - if( o.sell_price > itr->second.max_price ) - itr->second.max_price = o.sell_price; - itr->second.total_for_sale += o.for_sale; - } - else - { // new order is within the range - // TODO improve performance - limit_order_group_data data( itr->second.max_price, o.for_sale + itr->second.total_for_sale ); - idx.erase( itr ); - idx[ limit_order_group_key( group, o.sell_price ) ] = data; - } - } - } - } - } -} FC_CAPTURE_AND_RETHROW( (objct) ); } - -void limit_order_group_index::object_removed( const object& objct ) -{ try { - const limit_order_object& o = static_cast( objct ); - remove_order( o ); -} FC_CAPTURE_AND_RETHROW( (objct) ); } - -void limit_order_group_index::about_to_modify( const object& objct ) -{ try { - const limit_order_object& o = static_cast( objct ); - remove_order( o, false ); -} FC_CAPTURE_AND_RETHROW( (objct) ); } - -void limit_order_group_index::object_modified( const object& objct ) -{ try { - object_inserted( objct ); -} FC_CAPTURE_AND_RETHROW( (objct) ); } - -void limit_order_group_index::remove_order( const limit_order_object& o, bool remove_empty ) -{ - auto& idx = _og_data; - - for( uint16_t group : get_tracked_groups() ) - { - // find the group that should contain this order - auto itr = idx.lower_bound( limit_order_group_key( group, o.sell_price ) ); - if( itr == idx.end() || itr->first.group != group - || itr->first.min_price.base.asset_id != o.sell_price.base.asset_id - || itr->first.min_price.quote.asset_id != o.sell_price.quote.asset_id - || itr->second.max_price < o.sell_price ) - { - // can not find corresponding group, should not happen - wlog( "can not find the order group containing order for removing (price dismatch): ${o}", ("o",o) ); - continue; - } - else // found - { - if( itr->second.total_for_sale < o.for_sale ) - // should not happen - wlog( "can not find the order group containing order for removing (amount dismatch): ${o}", ("o",o) ); - else if( !remove_empty || itr->second.total_for_sale > o.for_sale ) - itr->second.total_for_sale -= o.for_sale; - else - // it's the only order in the group and need to be removed - idx.erase( itr ); - } - } -} - -grouped_orders_plugin_impl::~grouped_orders_plugin_impl() -{} - -} // end namespace detail - - -grouped_orders_plugin::grouped_orders_plugin() : - my( new detail::grouped_orders_plugin_impl(*this) ) -{ -} - -grouped_orders_plugin::~grouped_orders_plugin() -{ -} - -std::string grouped_orders_plugin::plugin_name()const -{ - return "grouped_orders"; -} - -void grouped_orders_plugin::plugin_set_program_options( - boost::program_options::options_description& cli, - boost::program_options::options_description& cfg - ) -{ - cli.add_options() - ("tracked-groups", boost::program_options::value()->default_value("[10,100]"), // 0.1% and 1% - "Group orders by percentage increase on price. Specify a JSON array of numbers here, each number is a group, number 1 means 0.01%. ") - ; - cfg.add(cli); -} - -void grouped_orders_plugin::plugin_initialize(const boost::program_options::variables_map& options) -{ try { - - if( options.count( "tracked-groups" ) ) - { - const std::string& groups = options["tracked-groups"].as(); - my->_tracked_groups = fc::json::from_string(groups).as>( 2 ); - my->_tracked_groups.erase( 0 ); - } - else - my->_tracked_groups = fc::json::from_string("[10,100]").as>(2); - - database().add_secondary_index< primary_index, detail::limit_order_group_index >( my->_tracked_groups ); - -} FC_CAPTURE_AND_RETHROW() } - -void grouped_orders_plugin::plugin_startup() -{ -} - -const flat_set& grouped_orders_plugin::tracked_groups() const -{ - return my->_tracked_groups; -} - -const map< limit_order_group_key, limit_order_group_data >& grouped_orders_plugin::limit_order_groups() -{ - const auto& idx = database().get_index_type< limit_order_index >(); - const auto& pidx = dynamic_cast&>(idx); - const auto& logidx = pidx.get_secondary_index< detail::limit_order_group_index >(); - return logidx.get_order_groups(); -} - -} } diff --git a/libraries/plugins/market_history/CMakeLists.txt b/libraries/plugins/market_history/CMakeLists.txt index 47410d74..8100de28 100644 --- a/libraries/plugins/market_history/CMakeLists.txt +++ b/libraries/plugins/market_history/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_market_history market_history_plugin.cpp ) -target_link_libraries( graphene_market_history graphene_chain graphene_app ) +target_link_libraries( graphene_market_history PRIVATE graphene_plugin ) target_include_directories( graphene_market_history PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/peerplays_sidechain/CMakeLists.txt b/libraries/plugins/peerplays_sidechain/CMakeLists.txt index 3e37b6fe..3737ae61 100755 --- a/libraries/plugins/peerplays_sidechain/CMakeLists.txt +++ b/libraries/plugins/peerplays_sidechain/CMakeLists.txt @@ -36,7 +36,7 @@ endif() unset(ENABLE_PEERPLAYS_ASSET_DEPOSITS) unset(ENABLE_PEERPLAYS_ASSET_DEPOSITS CACHE) -target_link_libraries( peerplays_sidechain graphene_chain graphene_app fc zmq ) +target_link_libraries( peerplays_sidechain PRIVATE graphene_plugin zmq ) target_include_directories( peerplays_sidechain PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/snapshot/CMakeLists.txt b/libraries/plugins/snapshot/CMakeLists.txt index 728740de..57fb1689 100644 --- a/libraries/plugins/snapshot/CMakeLists.txt +++ b/libraries/plugins/snapshot/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_snapshot snapshot.cpp ) -target_link_libraries( graphene_snapshot graphene_chain graphene_app ) +target_link_libraries( graphene_snapshot PRIVATE graphene_plugin ) target_include_directories( graphene_snapshot PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/witness/CMakeLists.txt b/libraries/plugins/witness/CMakeLists.txt index 95759bbf..a4272b2d 100644 --- a/libraries/plugins/witness/CMakeLists.txt +++ b/libraries/plugins/witness/CMakeLists.txt @@ -4,7 +4,7 @@ add_library( graphene_witness witness.cpp ) -target_link_libraries( graphene_witness graphene_chain graphene_app ) +target_link_libraries( graphene_witness PRIVATE graphene_plugin ) target_include_directories( graphene_witness PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/wallet/CMakeLists.txt b/libraries/wallet/CMakeLists.txt index 8c9f8790..d3825810 100644 --- a/libraries/wallet/CMakeLists.txt +++ b/libraries/wallet/CMakeLists.txt @@ -23,7 +23,7 @@ else() endif() add_library( graphene_wallet wallet.cpp ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp ${HEADERS} ) -target_link_libraries( graphene_wallet PRIVATE graphene_app graphene_net graphene_chain graphene_utilities fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( graphene_wallet PRIVATE graphene_app ) target_include_directories( graphene_db PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) if(MSVC) diff --git a/programs/build_helpers/CMakeLists.txt b/programs/build_helpers/CMakeLists.txt index 7a625b25..e6e92455 100644 --- a/programs/build_helpers/CMakeLists.txt +++ b/programs/build_helpers/CMakeLists.txt @@ -5,7 +5,7 @@ if( UNIX AND NOT APPLE ) endif() # we only actually need Boost, but link against FC for now so we don't duplicate it. -target_link_libraries( cat-parts PRIVATE fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( cat-parts PRIVATE fc ${PLATFORM_SPECIFIC_LIBS} ) add_executable( member_enumerator member_enumerator.cpp ) if( UNIX AND NOT APPLE ) @@ -13,5 +13,5 @@ if( UNIX AND NOT APPLE ) endif() # we only actually need Boost, but link against FC for now so we don't duplicate it. -target_link_libraries( member_enumerator PRIVATE fc graphene_app graphene_net graphene_chain graphene_egenesis_brief graphene_utilities graphene_wallet ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( member_enumerator PRIVATE graphene_chain ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/programs/cli_wallet/CMakeLists.txt b/programs/cli_wallet/CMakeLists.txt index 140bdce3..31f697eb 100644 --- a/programs/cli_wallet/CMakeLists.txt +++ b/programs/cli_wallet/CMakeLists.txt @@ -10,7 +10,7 @@ if( GPERFTOOLS_FOUND ) endif() target_link_libraries( cli_wallet - PRIVATE graphene_app graphene_net graphene_chain graphene_egenesis_brief graphene_utilities graphene_wallet fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_brief graphene_wallet ${PLATFORM_SPECIFIC_LIBS} ) if(MSVC) set_source_files_properties( main.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) diff --git a/programs/debug_node/CMakeLists.txt b/programs/debug_node/CMakeLists.txt index 232d265e..e39ea929 100644 --- a/programs/debug_node/CMakeLists.txt +++ b/programs/debug_node/CMakeLists.txt @@ -10,7 +10,7 @@ if( GPERFTOOLS_FOUND ) endif() target_link_libraries( debug_node - PRIVATE graphene_app graphene_account_history graphene_market_history graphene_witness graphene_debug_witness graphene_bookie graphene_chain graphene_egenesis_full fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_full ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS debug_node diff --git a/programs/delayed_node/CMakeLists.txt b/programs/delayed_node/CMakeLists.txt index 4dbe2bbf..7e610ace 100644 --- a/programs/delayed_node/CMakeLists.txt +++ b/programs/delayed_node/CMakeLists.txt @@ -10,7 +10,7 @@ if( GPERFTOOLS_FOUND ) endif() target_link_libraries( delayed_node - PRIVATE graphene_app graphene_account_history graphene_market_history graphene_delayed_node graphene_chain graphene_egenesis_full fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_full graphene_delayed_node ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS delayed_node diff --git a/programs/genesis_util/CMakeLists.txt b/programs/genesis_util/CMakeLists.txt index 9c3b278d..80a3c7b8 100644 --- a/programs/genesis_util/CMakeLists.txt +++ b/programs/genesis_util/CMakeLists.txt @@ -5,7 +5,7 @@ if( UNIX AND NOT APPLE ) endif() target_link_libraries( genesis_update - PRIVATE graphene_app graphene_chain graphene_egenesis_none fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_none ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS genesis_update @@ -18,7 +18,7 @@ install( TARGETS add_executable( get_dev_key get_dev_key.cpp ) target_link_libraries( get_dev_key - PRIVATE graphene_app graphene_chain graphene_egenesis_none graphene_utilities fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS get_dev_key @@ -31,4 +31,4 @@ install( TARGETS add_executable( convert_address convert_address.cpp ) target_link_libraries( convert_address - PRIVATE graphene_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_chain ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/programs/js_operation_serializer/CMakeLists.txt b/programs/js_operation_serializer/CMakeLists.txt index dad8ded2..a49d164e 100644 --- a/programs/js_operation_serializer/CMakeLists.txt +++ b/programs/js_operation_serializer/CMakeLists.txt @@ -4,7 +4,7 @@ if( UNIX AND NOT APPLE ) endif() target_link_libraries( js_operation_serializer - PRIVATE graphene_app graphene_net graphene_chain graphene_egenesis_none graphene_utilities graphene_wallet fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS js_operation_serializer diff --git a/programs/size_checker/CMakeLists.txt b/programs/size_checker/CMakeLists.txt index 5e0a167c..a1a504a3 100644 --- a/programs/size_checker/CMakeLists.txt +++ b/programs/size_checker/CMakeLists.txt @@ -4,7 +4,7 @@ if( UNIX AND NOT APPLE ) endif() target_link_libraries( size_checker - PRIVATE graphene_chain graphene_egenesis_none fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_chain ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS size_checker diff --git a/programs/witness_node/CMakeLists.txt b/programs/witness_node/CMakeLists.txt index d5578379..806330d6 100644 --- a/programs/witness_node/CMakeLists.txt +++ b/programs/witness_node/CMakeLists.txt @@ -11,7 +11,7 @@ endif() # We have to link against graphene_debug_witness because deficiency in our API infrastructure doesn't allow plugins to be fully abstracted #246 target_link_libraries( witness_node - PRIVATE graphene_app graphene_account_history graphene_affiliate_stats graphene_elasticsearch graphene_market_history graphene_witness graphene_chain graphene_debug_witness graphene_bookie graphene_egenesis_full graphene_snapshot graphene_es_objects fc peerplays_sidechain ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_full graphene_snapshot graphene_witness peerplays_sidechain ${PLATFORM_SPECIFIC_LIBS} ) # also add dependencies to graphene_generate_genesis graphene_generate_uia_sharedrop_genesis if you want those plugins install( TARGETS diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01474582..6ff915a9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,62 +1,65 @@ -file(GLOB COMMON_SOURCES "common/*.cpp") - find_package( Gperftools QUIET ) if( GPERFTOOLS_FOUND ) message( STATUS "Found gperftools; compiling tests with TCMalloc") list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) endif() +file(GLOB COMMON_SOURCES "common/*.cpp") +add_library(graphene_tests_common "${COMMON_SOURCES}" ) +target_link_libraries( graphene_tests_common + PUBLIC graphene_app graphene_egenesis_none ) + file(GLOB UNIT_TESTS "tests/*.cpp") -add_executable( chain_test ${UNIT_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( chain_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_bookie graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( chain_test ${UNIT_TESTS} ) +target_link_libraries( chain_test PRIVATE graphene_wallet graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) if(MSVC) set_source_files_properties( tests/serialization_tests.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) endif(MSVC) file(GLOB PERFORMANCE_TESTS "performance/*.cpp") -add_executable( performance_test ${PERFORMANCE_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_bookie graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( performance_test ${PERFORMANCE_TESTS} ) +target_link_libraries( performance_test PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB BENCH_MARKS "benchmarks/*.cpp") -add_executable( chain_bench ${BENCH_MARKS} ${COMMON_SOURCES} ) -target_link_libraries( chain_bench graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_bookie graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( chain_bench ${BENCH_MARKS} ) +target_link_libraries( chain_bench PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB APP_SOURCES "app/*.cpp") add_executable( app_test ${APP_SOURCES} ) -target_link_libraries( app_test graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_witness graphene_bookie graphene_net graphene_chain graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( app_test PRIVATE graphene_tests_common graphene_witness ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB INTENSE_SOURCES "intense/*.cpp") -add_executable( intense_test ${INTENSE_SOURCES} ${COMMON_SOURCES} ) -target_link_libraries( intense_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_bookie graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( intense_test ${INTENSE_SOURCES} ) +target_link_libraries( intense_test PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB BETTING_TESTS "betting/*.cpp") -add_executable( betting_test ${BETTING_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( betting_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_bookie graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( betting_test ${BETTING_TESTS} ) +target_link_libraries( betting_test PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB PEERPLAYS_SIDECHAIN_TESTS "peerplays_sidechain/*.cpp") -add_executable( peerplays_sidechain_test ${PEERPLAYS_SIDECHAIN_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( peerplays_sidechain_test graphene_chain graphene_app graphene_account_history graphene_bookie graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( peerplays_sidechain_test ${PEERPLAYS_SIDECHAIN_TESTS} ) +target_link_libraries( peerplays_sidechain_test PRIVATE graphene_tests_common peerplays_sidechain ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB TOURNAMENT_TESTS "tournament/*.cpp") -add_executable( tournament_test ${TOURNAMENT_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( tournament_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( tournament_test ${TOURNAMENT_TESTS} ) +target_link_libraries( tournament_test PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB RANDOM_SOURCES "random/*.cpp") -add_executable( random_test ${RANDOM_SOURCES} ${COMMON_SOURCES} ) -target_link_libraries( random_test graphene_chain graphene_app graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( random_test ${RANDOM_SOURCES} ) +target_link_libraries( random_test PRIVATE graphene_tests_common ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB CLI_SOURCES "cli/*.cpp") add_executable( cli_test ${CLI_SOURCES} ) if(WIN32) list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32) endif() -target_link_libraries( cli_test graphene_chain graphene_app graphene_witness graphene_wallet graphene_egenesis_none fc graphene_elasticsearch graphene_es_objects ${PLATFORM_SPECIFIC_LIBS} ) +target_link_libraries( cli_test PRIVATE graphene_wallet graphene_tests_common graphene_witness ${PLATFORM_SPECIFIC_LIBS} ) if(MSVC) set_source_files_properties( cli/main.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) endif(MSVC) file(GLOB ES_SOURCES "elasticsearch/*.cpp") -add_executable( es_test ${ES_SOURCES} ${COMMON_SOURCES} ) -target_link_libraries( es_test graphene_chain graphene_app graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc ${PLATFORM_SPECIFIC_LIBS} ) +add_executable( es_test ${ES_SOURCES} ) +target_link_libraries( es_test PRIVATE graphene_tests_common ) add_subdirectory( generate_empty_blocks ) diff --git a/tests/betting/betting_tests.cpp b/tests/betting/betting_tests.cpp index 7dff8b82..cb6118a6 100644 --- a/tests/betting/betting_tests.cpp +++ b/tests/betting/betting_tests.cpp @@ -1838,14 +1838,17 @@ BOOST_AUTO_TEST_CASE(event_group_delete_test_with_matched_bets) transfer(account_id_type(), bob_id, asset(initialAccountAsset)); generate_blocks(1); - const auto& event = create_event({{"en", "event"}}, {{"en", "2016-17"}}, nhl.id); + create_event({{"en", "event"}}, {{"en", "2016-17"}}, nhl.id); generate_blocks(1); + const event_object& event = *db.get_index_type().indices().get().rbegin(); - const auto& market_group = create_betting_market_group({{"en", "market group"}}, event.id, betting_market_rules.id, asset_id_type(), false, 0); + create_betting_market_group({{"en", "market group"}}, event.id, betting_market_rules.id, asset_id_type(), false, 0); generate_blocks(1); + const betting_market_group_object& market_group = *db.get_index_type().indices().get().rbegin(); - const auto& market = create_betting_market(market_group.id, {{"en", "market"}}); + create_betting_market(market_group.id, {{"en", "market"}}); generate_blocks(1); + const betting_market_object& market = *db.get_index_type().indices().get().rbegin(); place_bet(alice_id, market.id, bet_type::back, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION); place_bet(bob_id, market.id, bet_type::lay, asset(betAsset, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION); @@ -1877,9 +1880,8 @@ BOOST_AUTO_TEST_CASE(event_group_delete_test_not_existed_event_group) try { CREATE_ICE_HOCKEY_BETTING_MARKET(false, 0); - event_group_id_type nhl_id = nhl.id; - delete_event_group(nhl_id); - + event_group_id_type nhl_id = nhl.id; + delete_event_group(nhl_id); BOOST_CHECK_THROW(delete_event_group(nhl_id), fc::exception); } FC_LOG_AND_RETHROW() @@ -3013,7 +3015,8 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { std::cout << "Random number generator seeded to " << time(NULL) << std::endl; // betting operations don't take effect until HARDFORK 1000 - GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2; + GRAPHENE_TESTING_GENESIS_TIMESTAMP = + (HARDFORK_1000_TIME.sec_since_epoch() + 15) / GRAPHENE_DEFAULT_BLOCK_INTERVAL * GRAPHENE_DEFAULT_BLOCK_INTERVAL; return nullptr; } diff --git a/tests/cli/cli_fixture.cpp b/tests/cli/cli_fixture.cpp index 6148ccaa..70bdfb7c 100644 --- a/tests/cli/cli_fixture.cpp +++ b/tests/cli/cli_fixture.cpp @@ -201,9 +201,39 @@ cli_fixture::~cli_fixture() #endif } +void cli_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks, uint32_t skip) +{ + auto db = app1->chain_database(); + + if( miss_intermediate_blocks ) + { + generate_block(skip); + auto slots_to_miss = db->get_slot_at_time(timestamp); + if( slots_to_miss <= 1 ) + return; + --slots_to_miss; + generate_block(skip, fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key"))), slots_to_miss); + return; + } + while( db->head_block_time() < timestamp ) + generate_block(skip); +} + +signed_block cli_fixture::generate_block(uint32_t skip, const fc::ecc::private_key& key, int miss_blocks) +{ + skip |= database::skip_undo_history_check; + // skip == ~0 will skip checks specified in database::validation_steps + auto db = app1->chain_database(); + auto block = db->generate_block(db->get_slot_time(miss_blocks + 1), + db->get_scheduled_witness(miss_blocks + 1), + key, skip); + db->clear_pending(); + return block; +} + bool cli_fixture::generate_maintenance_block() { try { - fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); + fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key"))); uint32_t skip = ~database::skip_fork_db; auto db = app1->chain_database(); auto maint_time = db->get_dynamic_global_properties().next_maintenance_time; @@ -219,27 +249,6 @@ bool cli_fixture::generate_maintenance_block() { } } -bool cli_fixture::generate_block() -{ - graphene::chain::signed_block returned_block; - return generate_block(returned_block); -} - -bool cli_fixture::generate_block(graphene::chain::signed_block& returned_block) -{ - try { - fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); - auto db = app1->chain_database(); - returned_block = db->generate_block( db->get_slot_time(1), - db->get_scheduled_witness(1), - committee_key, - database::skip_nothing ); - return true; - } catch (exception &e) { - return false; - } -} - void cli_fixture::init_nathan() { try @@ -254,7 +263,7 @@ void cli_fixture::init_nathan() import_txs = con.wallet_api_ptr->import_balance("nathan", nathan_keys, true); nathan_acct_before_upgrade = con.wallet_api_ptr->get_account("nathan"); - BOOST_CHECK(generate_block()); + generate_block(); // upgrade nathan BOOST_TEST_MESSAGE("Upgrading Nathan to LTM"); diff --git a/tests/cli/cli_fixture.hpp b/tests/cli/cli_fixture.hpp index ad3e9e33..79004f3a 100644 --- a/tests/cli/cli_fixture.hpp +++ b/tests/cli/cli_fixture.hpp @@ -60,13 +60,12 @@ struct cli_fixture cli_fixture(); ~cli_fixture(); - /////////// - /// Send a block to the db - /// @param returned_block the signed block - /// @returns true on success - /////////// - bool generate_block(graphene::chain::signed_block& returned_block); - bool generate_block(); + signed_block generate_block(uint32_t skip = ~0, + const fc::ecc::private_key& key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key"))), + int miss_blocks = 0); + + void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true, uint32_t skip = ~0); + /////////// /// @brief Skip intermediate blocks, and generate a maintenance block /// @returns true on success diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index c6b587e8..49bfa387 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( create_new_account ) BOOST_CHECK(con.wallet_api_ptr->import_key("jmjatlanta", bki.wif_priv_key)); con.wallet_api_ptr->save_wallet_file(con.wallet_filename); - BOOST_CHECK(generate_block()); + generate_block(); fc::usleep( fc::seconds(1) ); // attempt to give jmjatlanta some peerplays @@ -112,7 +112,7 @@ BOOST_FIXTURE_TEST_CASE( cli_vote_for_2_witnesses, cli_fixture ) signed_transaction vote_witness1_tx = con.wallet_api_ptr->vote_for_witness("jmjatlanta", "init1", true, true); // generate a block to get things started - BOOST_CHECK(generate_block()); + generate_block(); // wait for a maintenance interval BOOST_CHECK(generate_maintenance_block()); @@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE( account_history_pagination ) "1.3.0", "Here are some CORE token for your new account", true); } - BOOST_CHECK(generate_block()); + generate_block(); // now get account history and make sure everything is there (and no duplicates) std::vector history = con.wallet_api_ptr->get_account_history("jmjatlanta", 300); @@ -489,7 +489,7 @@ BOOST_FIXTURE_TEST_CASE( saving_keys_wallet_test, cli_fixture ) graphene::wallet::plain_keys pk = decrypt_keys( "supersecret", wallet.cipher_keys ); BOOST_CHECK( pk.keys.size() == 1 ); // nathan key - BOOST_CHECK( generate_block() ); + generate_block(); fc::usleep( fc::seconds(1) ); wallet = fc::json::from_file( path ).as( 2 * GRAPHENE_MAX_NESTED_OBJECTS ); diff --git a/tests/cli/son.cpp b/tests/cli/son.cpp index e5f09faa..1d77608f 100644 --- a/tests/cli/son.cpp +++ b/tests/cli/son.cpp @@ -27,6 +27,9 @@ #include +#include +#include + class son_test_helper { cli_fixture& fixture_; @@ -36,6 +39,8 @@ public: fixture_(fixture) { fixture_.init_nathan(); + fixture_.generate_blocks(HARDFORK_SON_TIME); + fixture_.generate_block(); } void create_son(const std::string& account_name, const std::string& son_url, @@ -65,7 +70,7 @@ public: "nathan", account_name, "65000", "1.3.0", "Here are some CORE token for your new account", true ); - BOOST_CHECK(fixture_.generate_block()); + fixture_.generate_block(); // upgrade son account BOOST_TEST_MESSAGE("Upgrading son account to LTM"); @@ -75,16 +80,16 @@ public: // verify that the upgrade was successful BOOST_CHECK(son_account.is_lifetime_member()); - BOOST_CHECK(fixture_.generate_block()); + fixture_.generate_block(); // create deposit vesting fixture_.con.wallet_api_ptr->create_vesting_balance(account_name, "50", "1.3.0", vesting_balance_type::son, true); - BOOST_CHECK(fixture_.generate_block()); + fixture_.generate_block(); // create pay_vb vesting fixture_.con.wallet_api_ptr->create_vesting_balance(account_name, "1", "1.3.0", vesting_balance_type::normal, true); - BOOST_CHECK(fixture_.generate_block()); + fixture_.generate_block(); // check deposits are here auto deposits = fixture_.con.wallet_api_ptr->get_vesting_balances(account_name); @@ -169,10 +174,11 @@ BOOST_AUTO_TEST_CASE( cli_update_son ) // update SON signing key sidechain_public_keys.clear(); - con.wallet_api_ptr->update_son("sonmember", "http://sonmember_updated2", "TEST6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG", sidechain_public_keys, true); + std::string new_key = GRAPHENE_ADDRESS_PREFIX + std::string("6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG"); + con.wallet_api_ptr->update_son("sonmember", "http://sonmember_updated2", new_key, sidechain_public_keys, true); son_data = con.wallet_api_ptr->get_son("sonmember"); BOOST_CHECK(son_data.url == "http://sonmember_updated2"); - BOOST_CHECK(std::string(son_data.signing_key) == "TEST6Yaq5ZNTTkMM2kBBzV5jktr8ETsniCC3bnVD7eFmegRrLXfGGG"); + BOOST_CHECK(std::string(son_data.signing_key) == new_key); } catch( fc::exception& e ) { edump((e.to_detail_string())); @@ -421,7 +427,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) con.wallet_api_ptr->create_vesting_balance("nathan", "1000", "1.3.0", vesting_balance_type::gpos, true); update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, rejected, 2, true); - BOOST_CHECK(generate_block()); + generate_block(); BOOST_CHECK(generate_maintenance_block()); // Verify the votes @@ -461,7 +467,7 @@ BOOST_AUTO_TEST_CASE( update_son_votes_test ) rejected.push_back("son1accnt"); BOOST_CHECK_THROW(update_votes_tx = con.wallet_api_ptr->update_son_votes("nathan", accepted, rejected, 1, true), fc::exception); - BOOST_CHECK(generate_block()); + generate_block(); // Verify the votes son1_obj = con.wallet_api_ptr->get_son("son1account"); @@ -675,7 +681,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test ) // put SON in maintenance mode con.wallet_api_ptr->request_son_maintenance(name, true); - BOOST_CHECK(generate_block()); + generate_block(); // check SON is in request_maintenance son_obj = con.wallet_api_ptr->get_son(name); @@ -683,7 +689,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test ) // restore SON activity con.wallet_api_ptr->cancel_request_son_maintenance(name, true); - BOOST_CHECK(generate_block()); + generate_block(); // check SON is active son_obj = con.wallet_api_ptr->get_son(name); @@ -691,7 +697,7 @@ BOOST_AUTO_TEST_CASE( maintenance_test ) // put SON in maintenance mode con.wallet_api_ptr->request_son_maintenance(name, true); - BOOST_CHECK(generate_block()); + generate_block(); // check SON is in request_maintenance son_obj = con.wallet_api_ptr->get_son(name); diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index d1c8a2b6..42fd6137 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -57,8 +57,10 @@ using namespace graphene::chain::test; +//redefining parameters here to as per updated TESTNET parameters to verify unit test cases uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700002; + namespace graphene { namespace chain { using std::cout; @@ -234,8 +236,9 @@ string database_fixture::generate_anon_acct_name() void database_fixture::verify_asset_supplies( const database& db ) { //wlog("*** Begin asset supply verification ***"); - const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db); - BOOST_CHECK(core_asset_data.fee_pool == 0); + // It seems peerplays by default DO have core fee pool in genesis so commenting this out + //const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db); + //BOOST_CHECK(core_asset_data.fee_pool == 0); const auto& statistics_index = db.get_index_type().indices(); const auto& balance_index = db.get_index_type().indices(); diff --git a/tests/generate_empty_blocks/CMakeLists.txt b/tests/generate_empty_blocks/CMakeLists.txt index af53ee91..5a585070 100644 --- a/tests/generate_empty_blocks/CMakeLists.txt +++ b/tests/generate_empty_blocks/CMakeLists.txt @@ -4,7 +4,7 @@ if( UNIX AND NOT APPLE ) endif() target_link_libraries( generate_empty_blocks - PRIVATE graphene_app graphene_chain graphene_egenesis_none fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) + PRIVATE graphene_app graphene_egenesis_none ${PLATFORM_SPECIFIC_LIBS} ) install( TARGETS generate_empty_blocks diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index 74ae896c..86dd3d7f 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -1005,7 +1005,7 @@ BOOST_AUTO_TEST_CASE( issue_429_test ) const auto& fees = *db.get_global_properties().parameters.current_fees; auto fees_to_pay = fees.get(); - + { signed_transaction tx; asset_create_operation op; diff --git a/tests/tests/gpos_tests.cpp b/tests/tests/gpos_tests.cpp index 6de53eb7..14be6fe2 100644 --- a/tests/tests/gpos_tests.cpp +++ b/tests/tests/gpos_tests.cpp @@ -851,7 +851,10 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting ) { try { // advance to HF - generate_blocks(HARDFORK_GPOS_TIME); + fc::time_point_sec GPOS_HARDFORK_TIME = + fc::time_point_sec(1581976800); // Use mainnet GPOS hardfork time + + generate_blocks(GPOS_HARDFORK_TIME); generate_block(); // update default gpos global parameters to 4 days @@ -905,7 +908,7 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting ) vote_for(voter1_id, worker.vote_for, voter1_private_key); // first maint pass, coefficient will be 1 - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + generate_blocks(GPOS_HARDFORK_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes worker = worker_id_type()(db); BOOST_CHECK_EQUAL(worker.total_votes_for, 100); @@ -925,8 +928,8 @@ BOOST_AUTO_TEST_CASE( worker_dividends_voting ) generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); // worker is getting paid - BOOST_CHECK_EQUAL(worker_id_type()(db).worker.get().balance(db).balance.amount.value, 10); - BOOST_CHECK_EQUAL(worker.worker.get().balance(db).balance.amount.value, 10); + BOOST_CHECK_EQUAL(worker_id_type()(db).worker.get().balance(db).balance.amount.value, 5); + BOOST_CHECK_EQUAL(worker.worker.get().balance(db).balance.amount.value, 5); // second maint pass, coefficient will be 0.75 worker = worker_id_type()(db); @@ -966,7 +969,10 @@ BOOST_AUTO_TEST_CASE( account_multiple_vesting ) { try { // advance to HF - generate_blocks(HARDFORK_GPOS_TIME); + fc::time_point_sec GPOS_HARDFORK_TIME = + fc::time_point_sec(1581976800); // Use mainnet GPOS hardfork time + + generate_blocks(GPOS_HARDFORK_TIME); generate_block(); set_expiration(db, trx); @@ -1009,7 +1015,7 @@ BOOST_AUTO_TEST_CASE( account_multiple_vesting ) vote_for(sam_id, witness1.vote_id, sam_private_key); vote_for(patty_id, witness1.vote_id, patty_private_key); - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + generate_blocks(GPOS_HARDFORK_TIME + fc::hours(12)); //forward 1/2 sub-period so that it consider only gpos votes // amount in vested balanced will sum up as voting power witness1 = witness_id_type(1)(db); diff --git a/tests/tests/network_broadcast_api_tests.cpp b/tests/tests/network_broadcast_api_tests.cpp index 4c3e7ed4..aefb7534 100644 --- a/tests/tests/network_broadcast_api_tests.cpp +++ b/tests/tests/network_broadcast_api_tests.cpp @@ -89,7 +89,7 @@ namespace } } -BOOST_FIXTURE_TEST_SUITE( check_tansaction_for_duplicated_operations, database_fixture ) +BOOST_FIXTURE_TEST_SUITE( check_transaction_for_duplicated_operations, database_fixture ) BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_twice ) { @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_tw auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( check_passes_without_duplication ) ACTORS((alice)) auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); - BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx)); + BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx)); } catch( const fc::exception& e ) { @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_the_same_operation_with_different_assets create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501))}); - BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx)); + BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx)); } catch( const fc::exception& e ) { @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplication_in_transaction_with_several_op auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)), make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)), make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_operations_types ) create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")}); - BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx)); + BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx)); } catch( const fc::exception& e ) { @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_same_member_create_operations ) auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")}); //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_member_create_operations ) create_proposal(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")}); auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1001), account_id_type(), "test url")}); - BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx)); + BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx)); } catch( const fc::exception& e ) { @@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_several_operations_of_mixed_type ) make_committee_member_create_operation(asset(1002), account_id_type(), "test url")}); //Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes - BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_duplicates_in_pending_transactions_list ) push_proposal(*this, moneyman, {duplicate}); auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate}); - BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -323,7 +323,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_no_duplicates_in_pending_transactions_lis push_proposal(*this, moneyman, {make_transfer_operation(alice.id, moneyman.get_id(), asset(100))}); auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(alice.id, moneyman.get_id(), asset(101))}); - BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx)); + BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx)); } catch( const fc::exception& e ) { @@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_several_transactions_with_duplicates_in_pe auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate, make_transfer_operation(alice.id, moneyman.get_id(), asset(102))}); - BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception); + BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception); } catch( const fc::exception& e ) { @@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_duplicated_betting_market_or_group ) create_proposal(*this, { pcop1, pcop2 }); auto trx = make_signed_transaction_with_proposed_operation(*this, { pcop1, pcop2 }); - BOOST_CHECK_NO_THROW( db.check_tansaction_for_duplicated_operations(trx) ); + BOOST_CHECK_NO_THROW( db.check_transaction_for_duplicated_operations(trx) ); } catch( const fc::exception& e ) {