diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1403ba24e..da6baf86e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ build: - rm -rf build - mkdir build - cd build - - cmake .. + - cmake -DCMAKE_BUILD_TYPE=Release .. - make -j$(nproc) artifacts: untracked: true diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 11d39f693..e1baf30f8 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -38,7 +38,6 @@ #include #include -#include #include #include diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index db73124f2..17a254d4d 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -37,8 +37,6 @@ #include #include -#include - #include #include #include @@ -80,7 +78,7 @@ namespace detail { auto nathan_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); dlog("Allocating all stake to ${key}", ("key", utilities::key_to_wif(nathan_key))); genesis_state_type initial_state; - initial_state.initial_parameters.current_fees = fee_schedule::get_default();//->set_all_fees(GRAPHENE_BLOCKCHAIN_PRECISION); + initial_state.initial_parameters.current_fees = std::make_shared(fee_schedule::get_default()); initial_state.initial_active_witnesses = GRAPHENE_DEFAULT_MIN_WITNESS_COUNT; initial_state.initial_timestamp = time_point_sec(time_point::now().sec_since_epoch() / initial_state.initial_parameters.block_interval * diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index a2c56c594..fbc98aa4b 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 73024f692..0a0e9c56b 100755 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -43,6 +43,7 @@ add_library( graphene_chain protocol/assert.cpp protocol/account.cpp protocol/transfer.cpp + protocol/chain_parameters.cpp protocol/committee_member.cpp protocol/witness.cpp protocol/market.cpp diff --git a/libraries/chain/account_evaluator.cpp b/libraries/chain/account_evaluator.cpp index a166e7e5c..aa199c84f 100644 --- a/libraries/chain/account_evaluator.cpp +++ b/libraries/chain/account_evaluator.cpp @@ -22,8 +22,6 @@ * THE SOFTWARE. */ -#include - #include #include #include diff --git a/libraries/chain/betting_market_evaluator.cpp b/libraries/chain/betting_market_evaluator.cpp index b40f276a9..1670ef788 100644 --- a/libraries/chain/betting_market_evaluator.cpp +++ b/libraries/chain/betting_market_evaluator.cpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #define DEFAULT_LOGGER "betting" -#include #include #include diff --git a/libraries/chain/block_database.cpp b/libraries/chain/block_database.cpp index 3dcdcba42..2dd9b7a2f 100644 --- a/libraries/chain/block_database.cpp +++ b/libraries/chain/block_database.cpp @@ -24,7 +24,6 @@ #include #include #include -#include namespace graphene { namespace chain { diff --git a/libraries/chain/committee_member_evaluator.cpp b/libraries/chain/committee_member_evaluator.cpp index 73d7703b3..01614f994 100644 --- a/libraries/chain/committee_member_evaluator.cpp +++ b/libraries/chain/committee_member_evaluator.cpp @@ -30,8 +30,6 @@ #include #include -#include - namespace graphene { namespace chain { void_result committee_member_create_evaluator::do_evaluate( const committee_member_create_operation& op ) diff --git a/libraries/chain/confidential_evaluator.cpp b/libraries/chain/confidential_evaluator.cpp index 9323d2d9b..9946b492d 100644 --- a/libraries/chain/confidential_evaluator.cpp +++ b/libraries/chain/confidential_evaluator.cpp @@ -29,8 +29,6 @@ #include #include -#include - namespace graphene { namespace chain { void_result transfer_to_blind_evaluator::do_evaluate( const transfer_to_blind_operation& o ) diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 7711f5439..1e124902d 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include #include "db_balance.cpp" #include "db_bet.cpp" #include "db_block.cpp" diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index e8a49199d..c7881906e 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -42,7 +42,6 @@ #include #include -#include namespace { diff --git a/libraries/chain/db_getter.cpp b/libraries/chain/db_getter.cpp index 07b96fea6..7588c9fea 100644 --- a/libraries/chain/db_getter.cpp +++ b/libraries/chain/db_getter.cpp @@ -34,8 +34,6 @@ #include #include -#include - #include #include @@ -68,7 +66,7 @@ const dynamic_global_property_object& database::get_dynamic_global_properties() const fee_schedule& database::current_fee_schedule()const { - return get_global_properties().parameters.current_fees; + return std::ref( *get_global_properties().parameters.current_fees ); } time_point_sec database::head_block_time()const diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index e857ed94a..43ba381d4 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -103,7 +103,6 @@ #include -#include #include #include diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index b8908f113..a64b6d653 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -24,7 +24,6 @@ #include -#include #include #include diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index 83d4880c4..1cb4f77bc 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -24,7 +24,6 @@ #include #include #include -#include namespace graphene { namespace chain { fork_database::fork_database() diff --git a/libraries/chain/genesis_state.cpp b/libraries/chain/genesis_state.cpp index 533110125..7907c79e8 100644 --- a/libraries/chain/genesis_state.cpp +++ b/libraries/chain/genesis_state.cpp @@ -25,7 +25,6 @@ #include // these are required to serialize a genesis_state -#include // required for gcc in release mode #include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp index de67aa286..c24a05760 100644 --- a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp +++ b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp @@ -22,10 +22,10 @@ * THE SOFTWARE. */ #pragma once +#include #include #include #include -#include #include #include <../hardfork.d/GPOS.hf> @@ -72,8 +72,13 @@ namespace graphene { namespace chain { struct chain_parameters { + chain_parameters(); + chain_parameters(const chain_parameters& other); + chain_parameters(chain_parameters&& other); + chain_parameters& operator=(const chain_parameters& other); + chain_parameters& operator=(chain_parameters&& other); /** using a smart ref breaks the circular dependency created between operations and the fee schedule */ - smart_ref current_fees; ///< current schedule of fees + std::shared_ptr current_fees; ///< current schedule of fees uint8_t block_interval = GRAPHENE_DEFAULT_BLOCK_INTERVAL; ///< interval in seconds between blocks uint32_t maintenance_interval = GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL; ///< interval in sections between blockchain maintenance events uint8_t maintenance_skip_slots = GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS; ///< number of block_intervals to skip at maintenance time @@ -207,6 +212,8 @@ namespace graphene { namespace chain { inline uint16_t maximum_son_count()const { return extensions.value.maximum_son_count.valid() ? *extensions.value.maximum_son_count : GRAPHENE_DEFAULT_MAX_SONS; } + private: + static void safe_copy(chain_parameters& to, const chain_parameters& from); }; } } // graphene::chain diff --git a/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp b/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp index 9baaffc7f..28a7e0528 100644 --- a/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp +++ b/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #pragma once -#include #include namespace graphene { namespace chain { @@ -84,6 +83,10 @@ namespace graphene { namespace chain { } } // graphene::chain +namespace fc { + template<> struct get_typename> { static const char* name() { return "shared_ptr"; } }; +} + FC_REFLECT_TYPENAME( graphene::chain::fee_parameters ) FC_REFLECT( graphene::chain::fee_schedule, (parameters)(scale) ) diff --git a/libraries/chain/include/graphene/chain/protocol/types.hpp b/libraries/chain/include/graphene/chain/protocol/types.hpp index 436197a72..56a4bb1cd 100644 --- a/libraries/chain/include/graphene/chain/protocol/types.hpp +++ b/libraries/chain/include/graphene/chain/protocol/types.hpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 60e076694..4f219565c 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -35,7 +35,6 @@ #include #include -#include namespace graphene { namespace chain { void_result limit_order_create_evaluator::do_evaluate(const limit_order_create_operation& op) diff --git a/libraries/chain/proposal_evaluator.cpp b/libraries/chain/proposal_evaluator.cpp index e7d216efb..3ea4a836a 100644 --- a/libraries/chain/proposal_evaluator.cpp +++ b/libraries/chain/proposal_evaluator.cpp @@ -32,8 +32,6 @@ #include #include -#include - namespace graphene { namespace chain { struct proposal_operation_hardfork_visitor diff --git a/libraries/chain/protocol/chain_parameters.cpp b/libraries/chain/protocol/chain_parameters.cpp new file mode 100644 index 000000000..a904b0e31 --- /dev/null +++ b/libraries/chain/protocol/chain_parameters.cpp @@ -0,0 +1,92 @@ +#include +#include + +namespace graphene { namespace chain { + chain_parameters::chain_parameters() { + current_fees = std::make_shared(); + } + + // copy constructor + chain_parameters::chain_parameters(const chain_parameters& other) + { + current_fees = std::make_shared(*other.current_fees); + safe_copy(*this, other); + } + + // copy assignment + chain_parameters& chain_parameters::operator=(const chain_parameters& other) + { + if (&other != this) + { + current_fees = std::make_shared(*other.current_fees); + safe_copy(*this, other); + } + return *this; + } + + // copies the easy stuff + void chain_parameters::safe_copy(chain_parameters& to, const chain_parameters& from) + { + to.block_interval = from.block_interval; + to.maintenance_interval = from.maintenance_interval; + to.maintenance_skip_slots = from.maintenance_skip_slots; + to.committee_proposal_review_period = from.committee_proposal_review_period; + to.maximum_transaction_size = from.maximum_transaction_size; + to.maximum_block_size = from.maximum_block_size; + to.maximum_time_until_expiration = from.maximum_time_until_expiration; + to.maximum_proposal_lifetime = from.maximum_proposal_lifetime; + to.maximum_asset_whitelist_authorities = from.maximum_asset_whitelist_authorities; + to.maximum_asset_feed_publishers = from.maximum_asset_feed_publishers; + to.maximum_witness_count = from.maximum_witness_count; + to.maximum_committee_count = from.maximum_committee_count; + to.maximum_authority_membership = from.maximum_authority_membership; + to.reserve_percent_of_fee = from.reserve_percent_of_fee; + to.network_percent_of_fee = from.network_percent_of_fee; + to.lifetime_referrer_percent_of_fee = from.lifetime_referrer_percent_of_fee; + to.cashback_vesting_period_seconds = from.cashback_vesting_period_seconds; + to.cashback_vesting_threshold = from.cashback_vesting_threshold; + to.count_non_member_votes = from.count_non_member_votes; + to.allow_non_member_whitelists = from.allow_non_member_whitelists; + to.witness_pay_per_block = from.witness_pay_per_block; + to.witness_pay_vesting_seconds = from.witness_pay_vesting_seconds; + to.worker_budget_per_day = from.worker_budget_per_day; + to.max_predicate_opcode = from.max_predicate_opcode; + to.fee_liquidation_threshold = from.fee_liquidation_threshold; + to.accounts_per_fee_scale = from.accounts_per_fee_scale; + to.account_fee_scale_bitshifts = from.account_fee_scale_bitshifts; + to.max_authority_depth = from.max_authority_depth; + to.witness_schedule_algorithm= from.witness_schedule_algorithm; + to.min_round_delay = from.min_round_delay; + to.max_round_delay = from.max_round_delay; + to.min_time_per_commit_move = from.min_time_per_commit_move; + to.max_time_per_commit_move = from.max_time_per_commit_move; + to.min_time_per_reveal_move = from.min_time_per_reveal_move; + to.max_time_per_reveal_move = from.max_time_per_reveal_move; + to.rake_fee_percentage = from.rake_fee_percentage; + to.maximum_registration_deadline = from.maximum_registration_deadline; + to.maximum_players_in_tournament = from.maximum_players_in_tournament; + to.maximum_tournament_whitelist_length = from.maximum_tournament_whitelist_length; + to.maximum_tournament_start_time_in_future= from.maximum_tournament_start_time_in_future; + to.maximum_tournament_start_delay = from.maximum_tournament_start_delay; + to.maximum_tournament_number_of_wins = from.maximum_tournament_number_of_wins; + to.extensions = from.extensions; + } + + // move constructor + chain_parameters::chain_parameters(chain_parameters&& other) + { + current_fees = std::move(other.current_fees); + safe_copy(*this, other); + } + + // move assignment + chain_parameters& chain_parameters::operator=(chain_parameters&& other) + { + if (&other != this) + { + current_fees = std::move(other.current_fees); + safe_copy(*this, other); + } + return *this; + } +}} diff --git a/libraries/chain/protocol/committee_member.cpp b/libraries/chain/protocol/committee_member.cpp index 1824870a9..3ce62783a 100644 --- a/libraries/chain/protocol/committee_member.cpp +++ b/libraries/chain/protocol/committee_member.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include #include #include diff --git a/libraries/chain/protocol/fee_schedule.cpp b/libraries/chain/protocol/fee_schedule.cpp index 6d494e37d..122136eae 100644 --- a/libraries/chain/protocol/fee_schedule.cpp +++ b/libraries/chain/protocol/fee_schedule.cpp @@ -23,17 +23,6 @@ */ #include #include -#include - -namespace fc -{ - // explicitly instantiate the smart_ref, gcc fails to instantiate it in some release builds - //template graphene::chain::fee_schedule& smart_ref::operator=(smart_ref&&); - //template graphene::chain::fee_schedule& smart_ref::operator=(U&&); - //template graphene::chain::fee_schedule& smart_ref::operator=(const smart_ref&); - //template smart_ref::smart_ref(); - //template const graphene::chain::fee_schedule& smart_ref::operator*() const; -} #include @@ -41,10 +30,6 @@ namespace fc namespace graphene { namespace chain { - typedef fc::smart_ref smart_fee_schedule; - - static smart_fee_schedule tmp; - fee_schedule::fee_schedule() { } diff --git a/libraries/chain/protocol/operations.cpp b/libraries/chain/protocol/operations.cpp index 385e14dcc..99c8a3761 100644 --- a/libraries/chain/protocol/operations.cpp +++ b/libraries/chain/protocol/operations.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include #include #include #include diff --git a/libraries/chain/protocol/proposal.cpp b/libraries/chain/protocol/proposal.cpp index c77e71e4b..f14f057a9 100644 --- a/libraries/chain/protocol/proposal.cpp +++ b/libraries/chain/protocol/proposal.cpp @@ -23,7 +23,6 @@ */ #include #include -#include #include diff --git a/libraries/chain/protocol/small_ops.cpp b/libraries/chain/protocol/small_ops.cpp index 8ab7cf436..cba4b1b73 100644 --- a/libraries/chain/protocol/small_ops.cpp +++ b/libraries/chain/protocol/small_ops.cpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ -#include #include #include #include diff --git a/libraries/chain/protocol/transaction.cpp b/libraries/chain/protocol/transaction.cpp index 98e172380..4c0684bd6 100644 --- a/libraries/chain/protocol/transaction.cpp +++ b/libraries/chain/protocol/transaction.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -106,6 +105,7 @@ void transaction::get_required_authorities( flat_set& active, +const flat_set empty_keyset; struct sign_state { @@ -231,7 +231,7 @@ struct sign_state sign_state( const flat_set& sigs, const std::function& a, - const flat_set& keys = flat_set() ) + const flat_set& keys = empty_keyset ) :get_active(a),available_keys(keys) { for( const auto& key : sigs ) @@ -446,7 +446,7 @@ void signed_transaction::verify_authority( bool ignore_custom_operation_required_auths, uint32_t max_recursion )const { try { - graphene::chain::verify_authority( operations, get_signature_keys( chain_id ), get_active, get_owner, get_custom, max_recursion ); + graphene::chain::verify_authority( operations, get_signature_keys( chain_id ), get_active, get_owner, get_custom, ignore_custom_operation_required_auths, max_recursion ); } FC_CAPTURE_AND_RETHROW( (*this) ) } } } // graphene::chain diff --git a/libraries/chain/small_objects.cpp b/libraries/chain/small_objects.cpp index a74fa116e..6b8af3d94 100644 --- a/libraries/chain/small_objects.cpp +++ b/libraries/chain/small_objects.cpp @@ -44,7 +44,6 @@ #include #include -#include GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::balance_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::block_summary_object ) diff --git a/libraries/db/include/graphene/db/generic_index.hpp b/libraries/db/include/graphene/db/generic_index.hpp index 10e5d19ee..fb11d44a3 100644 --- a/libraries/db/include/graphene/db/generic_index.hpp +++ b/libraries/db/include/graphene/db/generic_index.hpp @@ -73,7 +73,7 @@ namespace graphene { namespace chain { [&m, &exc](ObjectType& o) mutable { try { m(o); - } catch (fc::exception e) { + } catch (fc::exception& e) { exc = std::current_exception(); elog("Exception while modifying object: ${e} -- object may be corrupted", ("e", e)); diff --git a/libraries/egenesis/embed_genesis.cpp b/libraries/egenesis/embed_genesis.cpp index 262830801..c2ffd6864 100644 --- a/libraries/egenesis/embed_genesis.cpp +++ b/libraries/egenesis/embed_genesis.cpp @@ -30,7 +30,6 @@ #include #include -#include // required for gcc in release mode #include #include #include diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index 0fc61dde9..14e32306d 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -70,7 +70,6 @@ #include #include #include -#include #include #include diff --git a/libraries/plugins/account_history/account_history_plugin.cpp b/libraries/plugins/account_history/account_history_plugin.cpp index d1aa2f71d..6eb3ff0c0 100644 --- a/libraries/plugins/account_history/account_history_plugin.cpp +++ b/libraries/plugins/account_history/account_history_plugin.cpp @@ -35,7 +35,6 @@ #include #include -#include #include namespace graphene { namespace account_history { diff --git a/libraries/plugins/accounts_list/accounts_list_plugin.cpp b/libraries/plugins/accounts_list/accounts_list_plugin.cpp index 757891ea9..5a57cc63d 100644 --- a/libraries/plugins/accounts_list/accounts_list_plugin.cpp +++ b/libraries/plugins/accounts_list/accounts_list_plugin.cpp @@ -34,7 +34,6 @@ #include #include -#include #include namespace graphene { namespace accounts_list { diff --git a/libraries/plugins/affiliate_stats/affiliate_stats_api.cpp b/libraries/plugins/affiliate_stats/affiliate_stats_api.cpp index d37a03600..159f66999 100644 --- a/libraries/plugins/affiliate_stats/affiliate_stats_api.cpp +++ b/libraries/plugins/affiliate_stats/affiliate_stats_api.cpp @@ -24,7 +24,6 @@ #include #include -#include #include diff --git a/libraries/plugins/affiliate_stats/affiliate_stats_plugin.cpp b/libraries/plugins/affiliate_stats/affiliate_stats_plugin.cpp index da9c8a04b..03b546593 100644 --- a/libraries/plugins/affiliate_stats/affiliate_stats_plugin.cpp +++ b/libraries/plugins/affiliate_stats/affiliate_stats_plugin.cpp @@ -35,7 +35,6 @@ #include #include -#include #include namespace graphene { namespace affiliate_stats { diff --git a/libraries/plugins/bookie/bookie_api.cpp b/libraries/plugins/bookie/bookie_api.cpp index 838c038c8..9caa9c625 100644 --- a/libraries/plugins/bookie/bookie_api.cpp +++ b/libraries/plugins/bookie/bookie_api.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include diff --git a/libraries/plugins/bookie/bookie_plugin.cpp b/libraries/plugins/bookie/bookie_plugin.cpp index 261de241d..5bc31f14c 100644 --- a/libraries/plugins/bookie/bookie_plugin.cpp +++ b/libraries/plugins/bookie/bookie_plugin.cpp @@ -36,7 +36,6 @@ #include -#include #include #include diff --git a/libraries/plugins/debug_witness/debug_api.cpp b/libraries/plugins/debug_witness/debug_api.cpp index 823755f59..43ffd6cd3 100644 --- a/libraries/plugins/debug_witness/debug_api.cpp +++ b/libraries/plugins/debug_witness/debug_api.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include diff --git a/libraries/plugins/debug_witness/debug_witness.cpp b/libraries/plugins/debug_witness/debug_witness.cpp index 66ef2f58e..7268006d3 100644 --- a/libraries/plugins/debug_witness/debug_witness.cpp +++ b/libraries/plugins/debug_witness/debug_witness.cpp @@ -28,7 +28,6 @@ #include -#include #include #include diff --git a/libraries/plugins/delayed_node/delayed_node_plugin.cpp b/libraries/plugins/delayed_node/delayed_node_plugin.cpp index 3eadda344..71de7db5a 100644 --- a/libraries/plugins/delayed_node/delayed_node_plugin.cpp +++ b/libraries/plugins/delayed_node/delayed_node_plugin.cpp @@ -30,8 +30,6 @@ #include #include #include -#include - namespace graphene { namespace delayed_node { namespace bpo = boost::program_options; diff --git a/libraries/plugins/es_objects/es_objects.cpp b/libraries/plugins/es_objects/es_objects.cpp index b9083cbc5..5fd891070 100644 --- a/libraries/plugins/es_objects/es_objects.cpp +++ b/libraries/plugins/es_objects/es_objects.cpp @@ -24,8 +24,6 @@ #include -#include - #include #include #include diff --git a/libraries/plugins/generate_genesis/generate_genesis.cpp b/libraries/plugins/generate_genesis/generate_genesis.cpp index 337b42553..88da427e1 100644 --- a/libraries/plugins/generate_genesis/generate_genesis.cpp +++ b/libraries/plugins/generate_genesis/generate_genesis.cpp @@ -29,7 +29,6 @@ #include -#include #include #include diff --git a/libraries/plugins/generate_uia_sharedrop_genesis/generate_uia_sharedrop_genesis.cpp b/libraries/plugins/generate_uia_sharedrop_genesis/generate_uia_sharedrop_genesis.cpp index d6db850ac..05f7c9b34 100644 --- a/libraries/plugins/generate_uia_sharedrop_genesis/generate_uia_sharedrop_genesis.cpp +++ b/libraries/plugins/generate_uia_sharedrop_genesis/generate_uia_sharedrop_genesis.cpp @@ -29,7 +29,6 @@ #include -#include #include #include diff --git a/libraries/plugins/market_history/market_history_plugin.cpp b/libraries/plugins/market_history/market_history_plugin.cpp index 80876a48f..48c215f0c 100644 --- a/libraries/plugins/market_history/market_history_plugin.cpp +++ b/libraries/plugins/market_history/market_history_plugin.cpp @@ -34,7 +34,6 @@ #include #include -#include namespace graphene { namespace market_history { diff --git a/libraries/plugins/peerplays_sidechain/bitcoin/bitcoin_address.cpp b/libraries/plugins/peerplays_sidechain/bitcoin/bitcoin_address.cpp index 4c10899f7..69b28ee18 100644 --- a/libraries/plugins/peerplays_sidechain/bitcoin/bitcoin_address.cpp +++ b/libraries/plugins/peerplays_sidechain/bitcoin/bitcoin_address.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -99,7 +100,7 @@ bool bitcoin_address::is_p2pk() const { parse_hex(address); return true; } - } catch (fc::exception e) { + } catch (fc::exception &e) { return false; } return false; @@ -121,7 +122,7 @@ bool bitcoin_address::is_p2pkh() const { return true; } return false; - } catch (fc::exception e) { + } catch (fc::exception &e) { return false; } } @@ -134,7 +135,7 @@ bool bitcoin_address::is_p2sh() const { return true; } return false; - } catch (fc::exception e) { + } catch (fc::exception &e) { return false; } } @@ -269,7 +270,7 @@ void btc_weighted_multisig_address::create_redeem_script(const std::vector #include -#include - #include #include #include @@ -356,7 +354,7 @@ void peerplays_sidechain_plugin_impl::heartbeat_loop() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending heartbeat failed with exception ${e}", ("e", e.what())); return false; } @@ -468,7 +466,7 @@ void peerplays_sidechain_plugin_impl::approve_proposals() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending approval failed with exception ${e}", ("e", e.what())); return false; } @@ -544,7 +542,7 @@ void peerplays_sidechain_plugin_impl::create_son_down_proposals() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending son down proposal failed with exception ${e}", ("e", e.what())); return false; } @@ -579,7 +577,7 @@ void peerplays_sidechain_plugin_impl::create_son_deregister_proposals() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending son deregister proposal failed with exception ${e}", ("e", e.what())); return false; } diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp index ed404efe3..49c5f0224 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include @@ -138,7 +137,7 @@ bool sidechain_net_handler::approve_proposal(const proposal_id_type &proposal_id if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending approval from ${son_id} for proposal ${proposal_id} failed with exception ${e}", ("son_id", son_id)("proposal_id", proposal_id)("e", e.what())); return false; @@ -205,7 +204,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending son wallet deposit create operation by ${son} failed with exception ${e}", ("son", son_id)("e", e.what())); } } @@ -247,7 +246,7 @@ void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_ database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending son wallet withdraw create operation by ${son} failed with exception ${e}", ("son", son_id)("e", e.what())); } } @@ -460,7 +459,7 @@ void sidechain_net_handler::process_sidechain_transactions() { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for sidechain transaction sign operation failed with exception ${e}", ("e", e.what())); } }); @@ -495,7 +494,7 @@ void sidechain_net_handler::send_sidechain_transactions() { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for sidechain transaction send operation failed with exception ${e}", ("e", e.what())); } }); @@ -560,7 +559,7 @@ void sidechain_net_handler::settle_sidechain_transactions() { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for sidechain transaction settle operation failed with exception ${e}", ("e", e.what())); } }); diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp index 48f641c3d..dc5e88afb 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_bitcoin.cpp @@ -940,7 +940,7 @@ sidechain_net_handler_bitcoin::sidechain_net_handler_bitcoin(peerplays_sidechain fc::http::connection conn; try { conn.connect_to(fc::ip::endpoint(fc::ip::address(ip), rpc_port)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("No BTC node running at ${ip} or wrong rpc port: ${port}", ("ip", ip)("port", rpc_port)); FC_ASSERT(false); } @@ -1324,7 +1324,7 @@ void sidechain_net_handler_bitcoin::process_primary_wallet() { database.push_transaction(trx, database::validation_steps::skip_block_size_check); if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for son wallet update operation failed with exception ${e}", ("e", e.what())); return; } @@ -1375,7 +1375,7 @@ void sidechain_net_handler_bitcoin::process_sidechain_addresses() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for deposit sidechain transaction create operation failed with exception ${e}", ("e", e.what())); return false; } @@ -1420,7 +1420,7 @@ bool sidechain_net_handler_bitcoin::process_deposit(const son_wallet_deposit_obj if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for deposit sidechain transaction create operation failed with exception ${e}", ("e", e.what())); return false; } @@ -1464,7 +1464,7 @@ bool sidechain_net_handler_bitcoin::process_withdrawal(const son_wallet_withdraw if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for withdraw sidechain transaction create operation failed with exception ${e}", ("e", e.what())); return false; } diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp index 3388527a1..6037fabd1 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_peerplays.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -149,7 +150,7 @@ void sidechain_net_handler_peerplays::process_sidechain_addresses() { if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending transaction for update deposit address operation failed with exception ${e}", ("e", e.what())); return false; } @@ -203,7 +204,7 @@ bool sidechain_net_handler_peerplays::process_deposit(const son_wallet_deposit_o if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return true; - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sending proposal for deposit sidechain transaction create operation failed with exception ${e}", ("e", e.what())); return false; } @@ -254,7 +255,7 @@ std::string sidechain_net_handler_peerplays::send_sidechain_transaction(const si if (plugin.app().p2p_node()) plugin.app().p2p_node()->broadcast(net::trx_message(trx)); return trx.id().str(); - } catch (fc::exception e) { + } catch (fc::exception &e) { elog("Sidechain transaction failed with exception ${e}", ("e", e.what())); return ""; } diff --git a/libraries/plugins/witness/witness.cpp b/libraries/plugins/witness/witness.cpp index 6ef7798b9..1e7a9d6ed 100644 --- a/libraries/plugins/witness/witness.cpp +++ b/libraries/plugins/witness/witness.cpp @@ -30,7 +30,6 @@ #include -#include #include #include diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 4b44ad6e2..98dc122c6 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -84,7 +84,6 @@ #include #include #include -#include #ifndef WIN32 # include @@ -662,10 +661,10 @@ class wallet_api_impl return ob.template as( GRAPHENE_MAX_NESTED_OBJECTS ); } - void set_operation_fees( signed_transaction& tx, const fee_schedule& s ) + void set_operation_fees( signed_transaction& tx, std::shared_ptr s ) { for( auto& op : tx.operations ) - s.set_fee(op); + s->set_fee(op); } variant info() const @@ -1307,8 +1306,7 @@ class wallet_api_impl tx.operations.push_back( account_create_op ); - auto current_fees = _remote_db->get_global_properties().parameters.current_fees; - set_operation_fees( tx, current_fees ); + set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees ); vector paying_keys = registrar_account_object.active.get_keys(); @@ -3496,7 +3494,7 @@ class wallet_api_impl new_fees.scale = scale; chain_parameters new_params = current_params; - new_params.current_fees = new_fees; + new_params.current_fees = std::make_shared(new_fees); committee_member_update_global_parameters_operation update_op; update_op.new_parameters = new_params; diff --git a/programs/build_helpers/member_enumerator.cpp b/programs/build_helpers/member_enumerator.cpp index 915d7edf4..d956af388 100644 --- a/programs/build_helpers/member_enumerator.cpp +++ b/programs/build_helpers/member_enumerator.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include using namespace graphene::chain; diff --git a/programs/cli_wallet/main.cpp b/programs/cli_wallet/main.cpp index fda7f22dd..bb7afa1a9 100644 --- a/programs/cli_wallet/main.cpp +++ b/programs/cli_wallet/main.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/programs/genesis_util/genesis_update.cpp b/programs/genesis_util/genesis_update.cpp index e753b8b71..4df7091f3 100644 --- a/programs/genesis_util/genesis_update.cpp +++ b/programs/genesis_util/genesis_update.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/programs/js_operation_serializer/main.cpp b/programs/js_operation_serializer/main.cpp index 34b861b18..797a32a1e 100644 --- a/programs/js_operation_serializer/main.cpp +++ b/programs/js_operation_serializer/main.cpp @@ -55,7 +55,6 @@ #include #include -#include #include using namespace graphene::chain; @@ -128,7 +127,6 @@ struct js_name> template struct js_name> { static std::string name(){ return "bytes "+ fc::to_string(N); }; }; template struct js_name> { static std::string name(){ return "bytes "+ fc::to_string(N); }; }; template struct js_name< fc::optional > { static std::string name(){ return "optional " + js_name::name(); } }; -template struct js_name< fc::smart_ref > { static std::string name(){ return js_name::name(); } }; template<> struct js_name< object_id_type > { static std::string name(){ return "object_id_type"; } }; template struct js_name< fc::flat_set > { static std::string name(){ return "set " + js_name::name(); } }; template struct js_name< std::vector > { static std::string name(){ return "array " + js_name::name(); } }; @@ -256,14 +254,6 @@ struct serializer,false> static void generate() {} }; -template -struct serializer,false> -{ - static void init() { - serializer::init(); } - static void generate() {} -}; - template<> struct serializer,false> { diff --git a/programs/size_checker/main.cpp b/programs/size_checker/main.cpp index de071cfcf..188e88e40 100644 --- a/programs/size_checker/main.cpp +++ b/programs/size_checker/main.cpp @@ -23,7 +23,6 @@ */ #include -#include #include #include diff --git a/tests/app/main.cpp b/tests/app/main.cpp index 28b8a1fc6..bd58a518b 100644 --- a/tests/app/main.cpp +++ b/tests/app/main.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include diff --git a/tests/benchmarks/genesis_allocation.cpp b/tests/benchmarks/genesis_allocation.cpp index a17a16fa8..63e75db56 100644 --- a/tests/benchmarks/genesis_allocation.cpp +++ b/tests/benchmarks/genesis_allocation.cpp @@ -26,7 +26,6 @@ #include #include -#include #include diff --git a/tests/betting/betting_tests.cpp b/tests/betting/betting_tests.cpp index 4befe25ca..7dff8b823 100644 --- a/tests/betting/betting_tests.cpp +++ b/tests/betting/betting_tests.cpp @@ -1877,10 +1877,11 @@ 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); - delete_event_group(nhl.id); - BOOST_CHECK_THROW(delete_event_group(nhl.id), fc::exception); + BOOST_CHECK_THROW(delete_event_group(nhl_id), fc::exception); } FC_LOG_AND_RETHROW() } diff --git a/tests/cli/cli_fixture.cpp b/tests/cli/cli_fixture.cpp index 5b5fd7ad8..6148ccaab 100644 --- a/tests/cli/cli_fixture.cpp +++ b/tests/cli/cli_fixture.cpp @@ -12,7 +12,6 @@ #include #include -#include #ifdef _WIN32 #ifndef _WIN32_WINNT diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 36fb626cb..c6b587e82 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -24,7 +24,6 @@ #include "cli_fixture.hpp" #include -#include #include diff --git a/tests/cli/son.cpp b/tests/cli/son.cpp index 7b6259d13..e5f09faae 100644 --- a/tests/cli/son.cpp +++ b/tests/cli/son.cpp @@ -23,7 +23,6 @@ */ #include "cli_fixture.hpp" -#include #include #include diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index b5ce1f559..d1c8a2b62 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -48,7 +48,6 @@ #include #include -#include #include #include @@ -712,7 +711,7 @@ void database_fixture::change_fees( new_fees.scale = new_scale; chain_parameters new_chain_params = current_chain_params; - new_chain_params.current_fees = new_fees; + new_chain_params.current_fees = std::make_shared(new_fees); db.modify(db.get_global_properties(), [&](global_property_object& p) { p.parameters = new_chain_params; @@ -1039,7 +1038,7 @@ void database_fixture::enable_fees() { db.modify(global_property_id_type()(db), [](global_property_object& gpo) { - gpo.parameters.current_fees = fee_schedule::get_default(); + gpo.parameters.current_fees = std::make_shared(fee_schedule::get_default()); }); } diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index a190b9c6a..366e707ec 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include diff --git a/tests/generate_empty_blocks/main.cpp b/tests/generate_empty_blocks/main.cpp index 1960a1514..298b03cd6 100644 --- a/tests/generate_empty_blocks/main.cpp +++ b/tests/generate_empty_blocks/main.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index 964948991..74ae896cb 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ -#include #include #include @@ -334,7 +333,7 @@ BOOST_AUTO_TEST_CASE( cashback_test ) upgrade_to_lifetime_member(rog_id); BOOST_TEST_MESSAGE("Enable fees"); - const auto& fees = db.get_global_properties().parameters.current_fees; + const auto& fees = *db.get_global_properties().parameters.current_fees; #define CustomRegisterActor(actor_name, registrar_name, referrer_name, referrer_rate) \ { \ @@ -346,7 +345,7 @@ BOOST_AUTO_TEST_CASE( cashback_test ) op.options.memo_key = actor_name ## _private_key.get_public_key(); \ op.active = authority(1, public_key_type(actor_name ## _private_key.get_public_key()), 1); \ op.owner = op.active; \ - op.fee = fees->calculate_fee(op); \ + op.fee = fees.calculate_fee(op); \ trx.operations = {op}; \ sign( trx, registrar_name ## _private_key ); \ actor_name ## _id = PUSH_TX( db, trx ).operation_results.front().get(); \ @@ -372,10 +371,10 @@ BOOST_AUTO_TEST_CASE( cashback_test ) CustomAuditActor( pleb ); \ } - int64_t reg_fee = fees->get< account_create_operation >().premium_fee; - int64_t xfer_fee = fees->get< transfer_operation >().fee; - int64_t upg_an_fee = fees->get< account_upgrade_operation >().membership_annual_fee; - int64_t upg_lt_fee = fees->get< account_upgrade_operation >().membership_lifetime_fee; + int64_t reg_fee = fees.get< account_create_operation >().premium_fee; + int64_t xfer_fee = fees.get< transfer_operation >().fee; + int64_t upg_an_fee = fees.get< account_upgrade_operation >().membership_annual_fee; + int64_t upg_lt_fee = fees.get< account_upgrade_operation >().membership_lifetime_fee; // all percentages here are cut from whole pie! uint64_t network_pct = 20 * P1; uint64_t lt_pct = 375 * P100 / 1000; @@ -582,7 +581,7 @@ BOOST_AUTO_TEST_CASE( account_create_fee_scaling ) auto accounts_per_scale = db.get_global_properties().parameters.accounts_per_fee_scale; db.modify(global_property_id_type()(db), [](global_property_object& gpo) { - gpo.parameters.current_fees = fee_schedule::get_default(); + gpo.parameters.current_fees = std::make_shared(fee_schedule::get_default()); gpo.parameters.current_fees->get().basic_fee = 1; }); @@ -1004,8 +1003,9 @@ BOOST_AUTO_TEST_CASE( issue_429_test ) // make sure the database requires our fee to be nonzero enable_fees(); - auto fees_to_pay = db.get_global_properties().parameters.current_fees->get(); - + 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/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 8b8a1a517..f3b46fe70 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -30,7 +30,6 @@ #include "../common/database_fixture.hpp" -#include #include using namespace graphene::app;