From 78a6fa50206633f920e1a5d76ba4605dfe3725d1 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 22 Aug 2018 13:26:57 -0300 Subject: [PATCH 001/108] refactor get_assets to accept id or name --- libraries/app/database_api.cpp | 43 +++++++++++++++---- .../app/include/graphene/app/database_api.hpp | 4 +- libraries/wallet/wallet.cpp | 9 +++- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 77407e1045..f35dda15b0 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -98,7 +98,7 @@ class database_api_impl : public std::enable_shared_from_this vector get_vesting_balances( const std::string account_id_or_name )const; // Assets - vector> get_assets(const vector& asset_ids)const; + vector> get_assets(const vector& asset_names_or_ids)const; vector list_assets(const string& lower_bound_symbol, uint32_t limit)const; vector> lookup_asset_symbols(const vector& symbols_or_ids)const; uint64_t get_asset_count()const; @@ -227,6 +227,31 @@ class database_api_impl : public std::enable_shared_from_this return account; } + const asset_object* get_asset_from_string( const std::string& name_or_id ) const + { + // TODO cache the result to avoid repeatly fetching from db + FC_ASSERT( name_or_id.size() > 0); + const asset_object* asset = nullptr; + if (std::isdigit(name_or_id[0])) + asset = _db.find(fc::variant(name_or_id, 1).as(1)); + else + { + const auto& idx = _db.get_index_type().indices().get(); + auto itr = idx.find(name_or_id); + if (itr != idx.end()) + asset = &*itr; + } + FC_ASSERT( asset, "no such asset" ); + return asset; + } + std::string asset_id_to_string(asset_id_type id) const + { + std::string asset_id = fc::to_string(id.space_id) + + "." + fc::to_string(id.type_id) + + "." + fc::to_string(id.instance.value); + return asset_id; + } + template const std::pair get_order_market( const T& order ) { @@ -1049,16 +1074,18 @@ vector database_api_impl::get_vesting_balances( const st // // ////////////////////////////////////////////////////////////////////// -vector> database_api::get_assets(const vector& asset_ids)const +vector> database_api::get_assets(const vector& asset_names_or_ids)const { - return my->get_assets( asset_ids ); + return my->get_assets( asset_names_or_ids ); } -vector> database_api_impl::get_assets(const vector& asset_ids)const +vector> database_api_impl::get_assets(const vector& asset_names_or_ids)const { - vector> result; result.reserve(asset_ids.size()); - std::transform(asset_ids.begin(), asset_ids.end(), std::back_inserter(result), - [this](asset_id_type id) -> optional { + vector> result; result.reserve(asset_names_or_ids.size()); + std::transform(asset_names_or_ids.begin(), asset_names_or_ids.end(), std::back_inserter(result), + [this](std::string id_or_name) -> optional { + const asset_object* asset = get_asset_from_string(id_or_name); + asset_id_type id = asset->id; if(auto o = _db.find(id)) { subscribe_to_item( id ); @@ -1453,7 +1480,7 @@ vector database_api_impl::get_top_markets(uint32_t limit)const { market_volume mv; mv.time = now; - const auto assets = get_assets( { itr->base, itr->quote } ); + const auto assets = get_assets( { asset_id_to_string(itr->base), asset_id_to_string(itr->quote) } ); mv.base = assets[0]->symbol; mv.quote = assets[1]->symbol; mv.base_volume = uint128_amount_to_string( itr->base_volume, assets[0]->precision ); diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 7102ffe62c..d379dbe722 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -375,12 +375,12 @@ class database_api /** * @brief Get a list of assets by ID - * @param asset_ids IDs of the assets to retrieve + * @param asset_names_or_ids Names or IDs of the assets to retrieve * @return The assets corresponding to the provided IDs * * This function has semantics identical to @ref get_objects */ - vector> get_assets(const vector& asset_ids)const; + vector> get_assets(const vector& asset_names_or_ids)const; /** * @brief Get assets alphabetically by symbol name diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 991d84874c..90d880d111 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -608,9 +608,16 @@ class wallet_api_impl { return get_account(account_name_or_id).get_id(); } + std::string asset_id_to_string(asset_id_type id) const + { + std::string asset_id = fc::to_string(id.space_id) + + "." + fc::to_string(id.type_id) + + "." + fc::to_string(id.instance.value); + return asset_id; + } optional find_asset(asset_id_type id)const { - auto rec = _remote_db->get_assets({id}).front(); + auto rec = _remote_db->get_assets({asset_id_to_string(id)}).front(); return rec; } optional find_asset(string asset_symbol_or_id)const From 8a5fae486b05e048ad1723d9168f70177c01c638 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 22 Aug 2018 17:45:27 -0300 Subject: [PATCH 002/108] change argument name --- libraries/app/database_api.cpp | 12 ++++++------ libraries/app/include/graphene/app/database_api.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index f35dda15b0..01035f1aab 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -98,7 +98,7 @@ class database_api_impl : public std::enable_shared_from_this vector get_vesting_balances( const std::string account_id_or_name )const; // Assets - vector> get_assets(const vector& asset_names_or_ids)const; + vector> get_assets(const vector& asset_symbols_or_ids)const; vector list_assets(const string& lower_bound_symbol, uint32_t limit)const; vector> lookup_asset_symbols(const vector& symbols_or_ids)const; uint64_t get_asset_count()const; @@ -1074,15 +1074,15 @@ vector database_api_impl::get_vesting_balances( const st // // ////////////////////////////////////////////////////////////////////// -vector> database_api::get_assets(const vector& asset_names_or_ids)const +vector> database_api::get_assets(const vector& asset_symbols_or_ids)const { - return my->get_assets( asset_names_or_ids ); + return my->get_assets( asset_symbols_or_ids ); } -vector> database_api_impl::get_assets(const vector& asset_names_or_ids)const +vector> database_api_impl::get_assets(const vector& asset_symbols_or_ids)const { - vector> result; result.reserve(asset_names_or_ids.size()); - std::transform(asset_names_or_ids.begin(), asset_names_or_ids.end(), std::back_inserter(result), + vector> result; result.reserve(asset_symbols_or_ids.size()); + std::transform(asset_symbols_or_ids.begin(), asset_symbols_or_ids.end(), std::back_inserter(result), [this](std::string id_or_name) -> optional { const asset_object* asset = get_asset_from_string(id_or_name); asset_id_type id = asset->id; diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index d379dbe722..0c2f62c234 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -375,12 +375,12 @@ class database_api /** * @brief Get a list of assets by ID - * @param asset_names_or_ids Names or IDs of the assets to retrieve + * @param asset_symbols_or_ids Symbol names or IDs of the assets to retrieve * @return The assets corresponding to the provided IDs * * This function has semantics identical to @ref get_objects */ - vector> get_assets(const vector& asset_names_or_ids)const; + vector> get_assets(const vector& asset_symbols_or_ids)const; /** * @brief Get assets alphabetically by symbol name From 90bd42648cf942cffe81bb95be5559e46b8b4deb Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 22 Aug 2018 18:20:40 -0300 Subject: [PATCH 003/108] keep get_assets with vector of ids for internal use --- libraries/app/database_api.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 01035f1aab..4e9f128895 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -244,12 +244,19 @@ class database_api_impl : public std::enable_shared_from_this FC_ASSERT( asset, "no such asset" ); return asset; } - std::string asset_id_to_string(asset_id_type id) const + vector> get_assets(const vector& asset_ids)const { - std::string asset_id = fc::to_string(id.space_id) + - "." + fc::to_string(id.type_id) + - "." + fc::to_string(id.instance.value); - return asset_id; + vector> result; result.reserve(asset_ids.size()); + std::transform(asset_ids.begin(), asset_ids.end(), std::back_inserter(result), + [this](asset_id_type id) -> optional { + if(auto o = _db.find(id)) + { + subscribe_to_item( id ); + return *o; + } + return {}; + }); + return result; } template @@ -1480,7 +1487,7 @@ vector database_api_impl::get_top_markets(uint32_t limit)const { market_volume mv; mv.time = now; - const auto assets = get_assets( { asset_id_to_string(itr->base), asset_id_to_string(itr->quote) } ); + const auto assets = get_assets( { itr->base, itr->quote } ); mv.base = assets[0]->symbol; mv.quote = assets[1]->symbol; mv.base_volume = uint128_amount_to_string( itr->base_volume, assets[0]->precision ); From ee0a8cea82148eed8ebbcff55e2bdf3712d8145c Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 23 Aug 2018 11:07:35 -0300 Subject: [PATCH 004/108] refactor get_limit_orders to accept asset symbol or id --- libraries/app/database_api.cpp | 65 +++++++++++-------- .../app/include/graphene/app/database_api.hpp | 6 +- libraries/wallet/wallet.cpp | 4 +- 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 4e9f128895..965584509e 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -104,7 +104,7 @@ class database_api_impl : public std::enable_shared_from_this uint64_t get_asset_count()const; // Markets / feeds - vector get_limit_orders(asset_id_type a, asset_id_type b, uint32_t limit)const; + vector get_limit_orders(std::string a, std::string b, uint32_t limit)const; vector get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, @@ -258,6 +258,35 @@ class database_api_impl : public std::enable_shared_from_this }); return result; } + vector get_limit_orders(const asset_id_type& a, const asset_id_type& b, const uint32_t& limit)const + { + const auto& limit_order_idx = _db.get_index_type(); + const auto& limit_price_idx = limit_order_idx.indices().get(); + + vector result; + result.reserve(limit*2); + + uint32_t count = 0; + auto limit_itr = limit_price_idx.lower_bound(price::max(a,b)); + auto limit_end = limit_price_idx.upper_bound(price::min(a,b)); + while(limit_itr != limit_end && count < limit) + { + result.push_back(*limit_itr); + ++limit_itr; + ++count; + } + count = 0; + limit_itr = limit_price_idx.lower_bound(price::max(b,a)); + limit_end = limit_price_idx.upper_bound(price::min(b,a)); + while(limit_itr != limit_end && count < limit) + { + result.push_back(*limit_itr); + ++limit_itr; + ++count; + } + + return result; + } template const std::pair get_order_market( const T& order ) @@ -1165,7 +1194,7 @@ vector> database_api_impl::lookup_asset_symbols(const vec // // ////////////////////////////////////////////////////////////////////// -vector database_api::get_limit_orders(asset_id_type a, asset_id_type b, uint32_t limit)const +vector database_api::get_limit_orders(std::string a, std::string b, uint32_t limit)const { return my->get_limit_orders( a, b, limit ); } @@ -1173,33 +1202,17 @@ vector database_api::get_limit_orders(asset_id_type a, asset /** * @return the limit orders for both sides of the book for the two assets specified up to limit number on each side. */ -vector database_api_impl::get_limit_orders(asset_id_type a, asset_id_type b, uint32_t limit)const +vector database_api_impl::get_limit_orders(std::string a, std::string b, uint32_t limit)const { - const auto& limit_order_idx = _db.get_index_type(); - const auto& limit_price_idx = limit_order_idx.indices().get(); + FC_ASSERT( limit <= 100 ); + vector results; + results.reserve(limit*2); - vector result; + const asset_id_type asset_a_id = get_asset_from_string(a)->id; + const asset_id_type asset_b_id = get_asset_from_string(b)->id; - uint32_t count = 0; - auto limit_itr = limit_price_idx.lower_bound(price::max(a,b)); - auto limit_end = limit_price_idx.upper_bound(price::min(a,b)); - while(limit_itr != limit_end && count < limit) - { - result.push_back(*limit_itr); - ++limit_itr; - ++count; - } - count = 0; - limit_itr = limit_price_idx.lower_bound(price::max(b,a)); - limit_end = limit_price_idx.upper_bound(price::min(b,a)); - while(limit_itr != limit_end && count < limit) - { - result.push_back(*limit_itr); - ++limit_itr; - ++count; - } - - return result; + results = get_limit_orders(asset_a_id, asset_b_id, limit); + return results; } vector database_api::get_call_orders(asset_id_type a, uint32_t limit)const diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 0c2f62c234..a6b4bbdcac 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -411,12 +411,12 @@ class database_api /** * @brief Get limit orders in a given market - * @param a ID of asset being sold - * @param b ID of asset being purchased + * @param a Symbol or ID of asset being sold + * @param b Symbol or ID of asset being purchased * @param limit Maximum number of orders to retrieve * @return The limit orders, ordered from least price to greatest */ - vector get_limit_orders(asset_id_type a, asset_id_type b, uint32_t limit)const; + vector get_limit_orders(std::string a, std::string b, uint32_t limit)const; /** * @brief Get call orders in a given asset diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 90d880d111..3fe3b6a3ef 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -3098,9 +3098,9 @@ vector wallet_api::get_account_limit_orders( const string& n return my->_remote_db->get_account_limit_orders(name_or_id, base, quote, limit, ostart_id, ostart_price); } -vector wallet_api::get_limit_orders(string a, string b, uint32_t limit)const +vector wallet_api::get_limit_orders(std::string a, std::string b, uint32_t limit)const { - return my->_remote_db->get_limit_orders(get_asset(a).id, get_asset(b).id, limit); + return my->_remote_db->get_limit_orders(a, b, limit); } vector wallet_api::get_call_orders(string a, uint32_t limit)const From 80a562462a9b300eb02e85fdaee82d949b9cc09f Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 23 Aug 2018 17:20:25 -0300 Subject: [PATCH 005/108] apply some changes from @abit review --- libraries/app/database_api.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 965584509e..f0fc2f0aae 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -104,7 +104,7 @@ class database_api_impl : public std::enable_shared_from_this uint64_t get_asset_count()const; // Markets / feeds - vector get_limit_orders(std::string a, std::string b, uint32_t limit)const; + vector get_limit_orders(std::string& a, std::string& b, uint32_t limit)const; vector get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, @@ -258,8 +258,10 @@ class database_api_impl : public std::enable_shared_from_this }); return result; } - vector get_limit_orders(const asset_id_type& a, const asset_id_type& b, const uint32_t& limit)const + vector get_limit_orders(const asset_id_type a, const asset_id_type b, const uint32_t limit)const { + FC_ASSERT( limit <= 300 ); + const auto& limit_order_idx = _db.get_index_type(); const auto& limit_price_idx = limit_order_idx.indices().get(); @@ -1202,17 +1204,14 @@ vector database_api::get_limit_orders(std::string a, std::st /** * @return the limit orders for both sides of the book for the two assets specified up to limit number on each side. */ -vector database_api_impl::get_limit_orders(std::string a, std::string b, uint32_t limit)const +vector database_api_impl::get_limit_orders(std::string& a, std::string& b, uint32_t limit)const { - FC_ASSERT( limit <= 100 ); - vector results; - results.reserve(limit*2); + FC_ASSERT( limit <= 300 ); const asset_id_type asset_a_id = get_asset_from_string(a)->id; const asset_id_type asset_b_id = get_asset_from_string(b)->id; - results = get_limit_orders(asset_a_id, asset_b_id, limit); - return results; + return get_limit_orders(asset_a_id, asset_b_id, limit); } vector database_api::get_call_orders(asset_id_type a, uint32_t limit)const From 482f72c4fc7fb93f0a48ab3c7fc49b3b661bd2c1 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 23 Aug 2018 17:50:17 -0300 Subject: [PATCH 006/108] add const to new reference arguments --- libraries/app/database_api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index f0fc2f0aae..72e791c759 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -104,7 +104,7 @@ class database_api_impl : public std::enable_shared_from_this uint64_t get_asset_count()const; // Markets / feeds - vector get_limit_orders(std::string& a, std::string& b, uint32_t limit)const; + vector get_limit_orders(const std::string& a, const std::string& b, uint32_t limit)const; vector get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, @@ -1204,7 +1204,7 @@ vector database_api::get_limit_orders(std::string a, std::st /** * @return the limit orders for both sides of the book for the two assets specified up to limit number on each side. */ -vector database_api_impl::get_limit_orders(std::string& a, std::string& b, uint32_t limit)const +vector database_api_impl::get_limit_orders(const std::string& a, const std::string& b, uint32_t limit)const { FC_ASSERT( limit <= 300 ); From b1d6a97f0f497fc6f1d7f046fd1f2e0ee2632930 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 30 Aug 2018 11:22:23 -0300 Subject: [PATCH 007/108] get_call_orders asset symbol or id support --- libraries/app/database_api.cpp | 11 +++++++---- libraries/app/include/graphene/app/database_api.hpp | 4 ++-- libraries/wallet/wallet.cpp | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 72e791c759..90b61e064d 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -110,7 +110,7 @@ class database_api_impl : public std::enable_shared_from_this const string "e, uint32_t limit, optional ostart_id, optional ostart_price ); - vector get_call_orders(asset_id_type a, uint32_t limit)const; + vector get_call_orders(const std::string& a, uint32_t limit)const; vector get_settle_orders(asset_id_type a, uint32_t limit)const; vector get_margin_positions( const std::string account_id_or_name )const; vector get_collateral_bids(const asset_id_type asset, uint32_t limit, uint32_t start)const; @@ -1214,15 +1214,18 @@ vector database_api_impl::get_limit_orders(const std::string return get_limit_orders(asset_a_id, asset_b_id, limit); } -vector database_api::get_call_orders(asset_id_type a, uint32_t limit)const +vector database_api::get_call_orders(const std::string& a, uint32_t limit)const { return my->get_call_orders( a, limit ); } -vector database_api_impl::get_call_orders(asset_id_type a, uint32_t limit)const +vector database_api_impl::get_call_orders(const std::string& a, uint32_t limit)const { + FC_ASSERT( limit <= 300 ); + + const asset_id_type asset_a_id = get_asset_from_string(a)->id; const auto& call_index = _db.get_index_type().indices().get(); - const asset_object& mia = _db.get(a); + const asset_object& mia = _db.get(asset_a_id); price index_price = price::min(mia.bitasset_data(_db).options.short_backing_asset, mia.get_id()); vector< call_order_object> result; diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index a6b4bbdcac..d0e840d648 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -420,11 +420,11 @@ class database_api /** * @brief Get call orders in a given asset - * @param a ID of asset being called + * @param a Symbol or ID of asset being called * @param limit Maximum number of orders to retrieve * @return The call orders, ordered from earliest to be called to latest */ - vector get_call_orders(asset_id_type a, uint32_t limit)const; + vector get_call_orders(const std::string& a, uint32_t limit)const; /** * @brief Get forced settlement orders in a given asset diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 3fe3b6a3ef..95597ae085 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -3103,9 +3103,9 @@ vector wallet_api::get_limit_orders(std::string a, std::stri return my->_remote_db->get_limit_orders(a, b, limit); } -vector wallet_api::get_call_orders(string a, uint32_t limit)const +vector wallet_api::get_call_orders(std::string a, uint32_t limit)const { - return my->_remote_db->get_call_orders(get_asset(a).id, limit); + return my->_remote_db->get_call_orders(a, limit); } vector wallet_api::get_settle_orders(string a, uint32_t limit)const From 82c4fb11c9b8bb39791cbccc9613a8b933ca7f42 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 30 Aug 2018 11:51:55 -0300 Subject: [PATCH 008/108] get_settle_orders asset symbol or id support --- libraries/app/database_api.cpp | 11 +++++++---- libraries/app/include/graphene/app/database_api.hpp | 4 ++-- libraries/wallet/wallet.cpp | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 90b61e064d..3cefdee530 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -111,7 +111,7 @@ class database_api_impl : public std::enable_shared_from_this optional ostart_id, optional ostart_price ); vector get_call_orders(const std::string& a, uint32_t limit)const; - vector get_settle_orders(asset_id_type a, uint32_t limit)const; + vector get_settle_orders(const std::string& a, uint32_t limit)const; vector get_margin_positions( const std::string account_id_or_name )const; vector get_collateral_bids(const asset_id_type asset, uint32_t limit, uint32_t start)const; @@ -1239,15 +1239,18 @@ vector database_api_impl::get_call_orders(const std::string& return result; } -vector database_api::get_settle_orders(asset_id_type a, uint32_t limit)const +vector database_api::get_settle_orders(const std::string& a, uint32_t limit)const { return my->get_settle_orders( a, limit ); } -vector database_api_impl::get_settle_orders(asset_id_type a, uint32_t limit)const +vector database_api_impl::get_settle_orders(const std::string& a, uint32_t limit)const { + FC_ASSERT( limit <= 300 ); + + const asset_id_type asset_a_id = get_asset_from_string(a)->id; const auto& settle_index = _db.get_index_type().indices().get(); - const asset_object& mia = _db.get(a); + const asset_object& mia = _db.get(asset_a_id); vector result; auto itr_min = settle_index.lower_bound(mia.get_id()); diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index d0e840d648..9a128f6dba 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -428,11 +428,11 @@ class database_api /** * @brief Get forced settlement orders in a given asset - * @param a ID of asset being settled + * @param a Symbol or ID of asset being settled * @param limit Maximum number of orders to retrieve * @return The settle orders, ordered from earliest settlement date to latest */ - vector get_settle_orders(asset_id_type a, uint32_t limit)const; + vector get_settle_orders(const std::string& a, uint32_t limit)const; /** * @brief Get collateral_bid_objects for a given asset diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 95597ae085..6737407484 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -3108,9 +3108,9 @@ vector wallet_api::get_call_orders(std::string a, uint32_t li return my->_remote_db->get_call_orders(a, limit); } -vector wallet_api::get_settle_orders(string a, uint32_t limit)const +vector wallet_api::get_settle_orders(std::string a, uint32_t limit)const { - return my->_remote_db->get_settle_orders(get_asset(a).id, limit); + return my->_remote_db->get_settle_orders(a, limit); } vector wallet_api::get_collateral_bids(string asset, uint32_t limit, uint32_t start)const From fc6cec02b25b19acedd620cbc3eae14c04a8043c Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 30 Aug 2018 12:40:12 -0300 Subject: [PATCH 009/108] get_collateral_bids asset symbol or id support --- libraries/app/database_api.cpp | 9 +++++---- .../app/include/graphene/app/database_api.hpp | 4 ++-- libraries/wallet/wallet.cpp | 4 ++-- tests/tests/swan_tests.cpp | 14 ++++++++------ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 3cefdee530..65ceaf1d3c 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -113,7 +113,7 @@ class database_api_impl : public std::enable_shared_from_this vector get_call_orders(const std::string& a, uint32_t limit)const; vector get_settle_orders(const std::string& a, uint32_t limit)const; vector get_margin_positions( const std::string account_id_or_name )const; - vector get_collateral_bids(const asset_id_type asset, uint32_t limit, uint32_t start)const; + vector get_collateral_bids(const std::string& asset, uint32_t limit, uint32_t start)const; void subscribe_to_market(std::function callback, asset_id_type a, asset_id_type b); void unsubscribe_from_market(asset_id_type a, asset_id_type b); @@ -1287,14 +1287,15 @@ vector database_api_impl::get_margin_positions( const std::st } FC_CAPTURE_AND_RETHROW( (account_id_or_name) ) } -vector database_api::get_collateral_bids(const asset_id_type asset, uint32_t limit, uint32_t start)const +vector database_api::get_collateral_bids(const std::string& asset, uint32_t limit, uint32_t start)const { return my->get_collateral_bids( asset, limit, start ); } -vector database_api_impl::get_collateral_bids(const asset_id_type asset_id, uint32_t limit, uint32_t skip)const +vector database_api_impl::get_collateral_bids(const std::string& asset, uint32_t limit, uint32_t skip)const { try { FC_ASSERT( limit <= 100 ); + const asset_id_type asset_id = get_asset_from_string(asset)->id; const asset_object& swan = asset_id(_db); FC_ASSERT( swan.is_market_issued() ); const asset_bitasset_data_object& bad = swan.bitasset_data(_db); @@ -1311,7 +1312,7 @@ vector database_api_impl::get_collateral_bids(const asset ++start; } return result; -} FC_CAPTURE_AND_RETHROW( (asset_id)(limit)(skip) ) } +} FC_CAPTURE_AND_RETHROW( (asset)(limit)(skip) ) } void database_api::subscribe_to_market(std::function callback, asset_id_type a, asset_id_type b) { diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 9a128f6dba..39a80ad4fe 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -436,12 +436,12 @@ class database_api /** * @brief Get collateral_bid_objects for a given asset - * @param a ID of asset + * @param a Symbol or ID of asset * @param limit Maximum number of objects to retrieve * @param start skip that many results * @return The settle orders, ordered from earliest settlement date to latest */ - vector get_collateral_bids(const asset_id_type asset, uint32_t limit, uint32_t start)const; + vector get_collateral_bids(const std::string& a, uint32_t limit, uint32_t start)const; /** * @return all open margin positions for a given account id or name. diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 6737407484..a2e7384d61 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -3113,9 +3113,9 @@ vector wallet_api::get_settle_orders(std::string a, uin return my->_remote_db->get_settle_orders(a, limit); } -vector wallet_api::get_collateral_bids(string asset, uint32_t limit, uint32_t start)const +vector wallet_api::get_collateral_bids(std::string asset, uint32_t limit, uint32_t start)const { - return my->_remote_db->get_collateral_bids(get_asset(asset).id, limit, start); + return my->_remote_db->get_collateral_bids(asset, limit, start); } brain_key_info wallet_api::suggest_brain_key()const diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index f0d7ce9aab..56fe2c1615 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -366,14 +366,15 @@ BOOST_AUTO_TEST_CASE( recollateralize ) // check get_collateral_bids graphene::app::database_api db_api(db); - GRAPHENE_REQUIRE_THROW( db_api.get_collateral_bids(back().id, 100, 0), fc::assert_exception ); - vector bids = db_api.get_collateral_bids(_swan, 100, 1); + GRAPHENE_REQUIRE_THROW( db_api.get_collateral_bids(back().symbol, 100, 0), fc::assert_exception ); + auto swan_symbol = _swan(db).symbol; + vector bids = db_api.get_collateral_bids(swan_symbol, 100, 1); BOOST_CHECK_EQUAL( 1, bids.size() ); FC_ASSERT( _borrower2 == bids[0].bidder ); - bids = db_api.get_collateral_bids(_swan, 1, 0); + bids = db_api.get_collateral_bids(swan_symbol, 1, 0); BOOST_CHECK_EQUAL( 1, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); - bids = db_api.get_collateral_bids(_swan, 100, 0); + bids = db_api.get_collateral_bids(swan_symbol, 100, 0); BOOST_CHECK_EQUAL( 2, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); FC_ASSERT( _borrower2 == bids[1].bidder ); @@ -382,7 +383,7 @@ BOOST_AUTO_TEST_CASE( recollateralize ) // revive wait_for_maintenance(); BOOST_CHECK( !swan().bitasset_data(db).has_settlement() ); - bids = db_api.get_collateral_bids(_swan, 100, 0); + bids = db_api.get_collateral_bids(swan_symbol, 100, 0); BOOST_CHECK( bids.empty() ); } catch( const fc::exception& e) { edump((e.to_detail_string())); @@ -477,7 +478,8 @@ BOOST_AUTO_TEST_CASE( revive_empty_with_bid ) wait_for_maintenance(); BOOST_CHECK( !swan().bitasset_data(db).has_settlement() ); graphene::app::database_api db_api(db); - vector bids = db_api.get_collateral_bids(_swan, 100, 0); + auto swan_symbol = _swan(db).symbol; + vector bids = db_api.get_collateral_bids(swan_symbol, 100, 0); BOOST_CHECK( bids.empty() ); auto& call_idx = db.get_index_type().indices().get(); From ce849a4fea159754e178ee6e022eb15aa9273a2d Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 30 Aug 2018 18:44:53 -0300 Subject: [PATCH 010/108] subscribe_to_market and unsubscribe_from_market asset symbol or id support --- libraries/app/database_api.cpp | 30 +++++++++++-------- .../app/include/graphene/app/database_api.hpp | 12 ++++---- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 65ceaf1d3c..d86710e727 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -115,8 +115,8 @@ class database_api_impl : public std::enable_shared_from_this vector get_margin_positions( const std::string account_id_or_name )const; vector get_collateral_bids(const std::string& asset, uint32_t limit, uint32_t start)const; - void subscribe_to_market(std::function callback, asset_id_type a, asset_id_type b); - void unsubscribe_from_market(asset_id_type a, asset_id_type b); + void subscribe_to_market(std::function callback, const std::string& a, const std::string& b); + void unsubscribe_from_market(const std::string& a, const std::string& b); market_ticker get_ticker( const string& base, const string& quote, bool skip_order_book = false )const; market_volume get_24_volume( const string& base, const string& quote )const; @@ -1314,28 +1314,34 @@ vector database_api_impl::get_collateral_bids(const std:: return result; } FC_CAPTURE_AND_RETHROW( (asset)(limit)(skip) ) } -void database_api::subscribe_to_market(std::function callback, asset_id_type a, asset_id_type b) +void database_api::subscribe_to_market(std::function callback, const std::string& a, const std::string& b) { my->subscribe_to_market( callback, a, b ); } -void database_api_impl::subscribe_to_market(std::function callback, asset_id_type a, asset_id_type b) +void database_api_impl::subscribe_to_market(std::function callback, const std::string& a, const std::string& b) { - if(a > b) std::swap(a,b); - FC_ASSERT(a != b); - _market_subscriptions[ std::make_pair(a,b) ] = callback; + auto asset_a_id = get_asset_from_string(a)->id; + auto asset_b_id = get_asset_from_string(b)->id; + + if(asset_a_id > asset_b_id) std::swap(asset_a_id,asset_b_id); + FC_ASSERT(asset_a_id != asset_b_id); + _market_subscriptions[ std::make_pair(asset_a_id,asset_b_id) ] = callback; } -void database_api::unsubscribe_from_market(asset_id_type a, asset_id_type b) +void database_api::unsubscribe_from_market(const std::string& a, const std::string& b) { my->unsubscribe_from_market( a, b ); } -void database_api_impl::unsubscribe_from_market(asset_id_type a, asset_id_type b) +void database_api_impl::unsubscribe_from_market(const std::string& a, const std::string& b) { - if(a > b) std::swap(a,b); - FC_ASSERT(a != b); - _market_subscriptions.erase(std::make_pair(a,b)); + auto asset_a_id = get_asset_from_string(a)->id; + auto asset_b_id = get_asset_from_string(b)->id; + + if(a > b) std::swap(asset_a_id,asset_b_id); + FC_ASSERT(asset_a_id != asset_b_id); + _market_subscriptions.erase(std::make_pair(asset_a_id,asset_b_id)); } string database_api_impl::price_to_string( const price& _price, const asset_object& _base, const asset_object& _quote ) diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 39a80ad4fe..b92adf3cde 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -451,21 +451,21 @@ class database_api /** * @brief Request notification when the active orders in the market between two assets changes * @param callback Callback method which is called when the market changes - * @param a First asset ID - * @param b Second asset ID + * @param a First asset Symbol or ID + * @param b Second asset Symbol or ID * * Callback will be passed a variant containing a vector>. The vector will * contain, in order, the operations which changed the market, and their results. */ void subscribe_to_market(std::function callback, - asset_id_type a, asset_id_type b); + const std::string& a, const std::string& b); /** * @brief Unsubscribe from updates to a given market - * @param a First asset ID - * @param b Second asset ID + * @param a First asset Symbol ID + * @param b Second asset Symbol ID */ - void unsubscribe_from_market( asset_id_type a, asset_id_type b ); + void unsubscribe_from_market( const std::string& a, const std::string& b ); /** * @brief Returns the ticker for the market assetA:assetB From 9e0fa4fd3795533c3f710489e95cc16f26975569 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 30 Aug 2018 19:40:59 -0300 Subject: [PATCH 011/108] get_requiered_fees asset symbol or id support --- libraries/app/database_api.cpp | 10 +++++----- libraries/app/include/graphene/app/database_api.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index d86710e727..a4f89de794 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -155,7 +155,7 @@ class database_api_impl : public std::enable_shared_from_this bool verify_authority( const signed_transaction& trx )const; bool verify_account_authority( const string& account_name_or_id, const flat_set& signers )const; processed_transaction validate_transaction( const signed_transaction& trx )const; - vector< fc::variant > get_required_fees( const vector& ops, asset_id_type id )const; + vector< fc::variant > get_required_fees( const vector& ops, const std::string& asset_id_or_symbol )const; // Proposed transactions vector get_proposed_transactions( const std::string account_id_or_name )const; @@ -2150,9 +2150,9 @@ processed_transaction database_api_impl::validate_transaction( const signed_tran return _db.validate_transaction(trx); } -vector< fc::variant > database_api::get_required_fees( const vector& ops, asset_id_type id )const +vector< fc::variant > database_api::get_required_fees( const vector& ops, const std::string& asset_id_or_symbol )const { - return my->get_required_fees( ops, id ); + return my->get_required_fees( ops, asset_id_or_symbol ); } /** @@ -2211,7 +2211,7 @@ struct get_required_fees_helper uint32_t current_recursion = 0; }; -vector< fc::variant > database_api_impl::get_required_fees( const vector& ops, asset_id_type id )const +vector< fc::variant > database_api_impl::get_required_fees( const vector& ops, const std::string& asset_id_or_symbol )const { vector< operation > _ops = ops; // @@ -2221,7 +2221,7 @@ vector< fc::variant > database_api_impl::get_required_fees( const vector result; result.reserve(ops.size()); - const asset_object& a = id(_db); + const asset_object& a = *get_asset_from_string(asset_id_or_symbol); get_required_fees_helper helper( _db.current_fee_schedule(), a.options.core_exchange_rate, diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index b92adf3cde..7c1d53231d 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -676,7 +676,7 @@ class database_api * For each operation calculate the required fee in the specified asset type. If the asset type does * not have a valid core_exchange_rate */ - vector< fc::variant > get_required_fees( const vector& ops, asset_id_type id )const; + vector< fc::variant > get_required_fees( const vector& ops, const std::string& asset_id_or_symbol )const; /////////////////////////// // Proposed transactions // From 6d274b39007e09ffa25565498f750a85d2729851 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 28 Mar 2016 23:14:52 +0200 Subject: [PATCH 012/108] Ported network mapper from old bitshares --- programs/CMakeLists.txt | 1 + programs/network_mapper/CMakeLists.txt | 3 + programs/network_mapper/network_mapper.cpp | 317 +++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100644 programs/network_mapper/CMakeLists.txt create mode 100644 programs/network_mapper/network_mapper.cpp diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index b17a972c96..88894ddf70 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory( witness_node ) add_subdirectory( delayed_node ) add_subdirectory( js_operation_serializer ) add_subdirectory( size_checker ) +add_subdirectory( network_mapper ) diff --git a/programs/network_mapper/CMakeLists.txt b/programs/network_mapper/CMakeLists.txt new file mode 100644 index 0000000000..7d3326c1eb --- /dev/null +++ b/programs/network_mapper/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable( network_mapper network_mapper.cpp ) +target_link_libraries( network_mapper fc graphene_chain graphene_net ) + diff --git a/programs/network_mapper/network_mapper.cpp b/programs/network_mapper/network_mapper.cpp new file mode 100644 index 0000000000..1f878e262f --- /dev/null +++ b/programs/network_mapper/network_mapper.cpp @@ -0,0 +1,317 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +class peer_probe : public graphene::net::peer_connection_delegate +{ +public: + bool _peer_closed_connection; + bool _we_closed_connection; + graphene::net::peer_connection_ptr _connection; + std::vector _peers; + fc::ecc::public_key _node_id; + bool _connection_was_rejected; + bool _done; + fc::promise::ptr _probe_complete_promise; + +public: + peer_probe() : + _peer_closed_connection(false), + _we_closed_connection(false), + _connection(graphene::net::peer_connection::make_shared(this)), + _connection_was_rejected(false), + _done(false), + _probe_complete_promise(fc::promise::ptr(new fc::promise("probe_complete"))) + {} + + void start(const fc::ip::endpoint& endpoint_to_probe, + const fc::ecc::private_key& my_node_id, + const graphene::chain::chain_id_type& chain_id) + { + fc::future connect_task = fc::async([=](){ _connection->connect_to(endpoint_to_probe); }, "connect_task"); + try + { + connect_task.wait(fc::seconds(10)); + } + catch (const fc::timeout_exception&) + { + ilog("timeout connecting to node ${endpoint}", ("endpoint", endpoint_to_probe)); + connect_task.cancel(__FUNCTION__); + throw; + } + + fc::sha256::encoder shared_secret_encoder; + fc::sha512 shared_secret = _connection->get_shared_secret(); + shared_secret_encoder.write(shared_secret.data(), sizeof(shared_secret)); + fc::ecc::compact_signature signature = my_node_id.sign_compact(shared_secret_encoder.result()); + + graphene::net::hello_message hello("network_mapper", + GRAPHENE_NET_PROTOCOL_VERSION, + fc::ip::address(), 0, 0, + my_node_id.get_public_key(), + signature, + chain_id, + fc::variant_object()); + + _connection->send_message(hello); + } + + void on_message(graphene::net::peer_connection* originating_peer, + const graphene::net::message& received_message) override + { + graphene::net::message_hash_type message_hash = received_message.id(); + dlog( "handling message ${type} ${hash} size ${size} from peer ${endpoint}", + ( "type", graphene::net::core_message_type_enum(received_message.msg_type ) )("hash", message_hash )("size", received_message.size )("endpoint", originating_peer->get_remote_endpoint() ) ); + switch ( received_message.msg_type ) + { + case graphene::net::core_message_type_enum::hello_message_type: + on_hello_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::connection_accepted_message_type: + on_connection_accepted_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::connection_rejected_message_type: + on_connection_rejected_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::address_request_message_type: + on_address_request_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::address_message_type: + on_address_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::closing_connection_message_type: + on_closing_connection_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::current_time_request_message_type: + on_current_time_request_message( originating_peer, received_message.as() ); + break; + case graphene::net::core_message_type_enum::current_time_reply_message_type: + on_current_time_reply_message( originating_peer, received_message.as() ); + break; + } + } + + void on_hello_message(graphene::net::peer_connection* originating_peer, + const graphene::net::hello_message& hello_message_received) + { + _node_id = hello_message_received.node_public_key; + if (hello_message_received.user_data.contains("node_id")) + originating_peer->node_id = hello_message_received.user_data["node_id"].as(); + originating_peer->send_message(graphene::net::connection_rejected_message()); + } + + void on_connection_accepted_message(graphene::net::peer_connection* originating_peer, + const graphene::net::connection_accepted_message& connection_accepted_message_received) + { + _connection_was_rejected = false; + originating_peer->send_message(graphene::net::address_request_message()); + } + + void on_connection_rejected_message( graphene::net::peer_connection* originating_peer, + const graphene::net::connection_rejected_message& connection_rejected_message_received ) + { + _connection_was_rejected = true; + originating_peer->send_message(graphene::net::address_request_message()); + } + + void on_address_request_message(graphene::net::peer_connection* originating_peer, + const graphene::net::address_request_message& address_request_message_received) + { + originating_peer->send_message(graphene::net::address_message()); + } + + + void on_address_message(graphene::net::peer_connection* originating_peer, + const graphene::net::address_message& address_message_received) + { + _peers = address_message_received.addresses; + originating_peer->send_message(graphene::net::closing_connection_message("Thanks for the info")); + _we_closed_connection = true; + } + + void on_closing_connection_message(graphene::net::peer_connection* originating_peer, + const graphene::net::closing_connection_message& closing_connection_message_received) + { + if (_we_closed_connection) + _connection->close_connection(); + else + _peer_closed_connection = true; + } + + void on_current_time_request_message(graphene::net::peer_connection* originating_peer, + const graphene::net::current_time_request_message& current_time_request_message_received) + { + } + + void on_current_time_reply_message(graphene::net::peer_connection* originating_peer, + const graphene::net::current_time_reply_message& current_time_reply_message_received) + { + } + + void on_connection_closed(graphene::net::peer_connection* originating_peer) override + { + _done = true; + _probe_complete_promise->set_value(); + } + + graphene::net::message get_message_for_item(const graphene::net::item_id& item) override + { + return graphene::net::item_not_available_message(item); + } + + void wait() + { + _probe_complete_promise->wait(); + } +}; + +static std::vector resolve_endpoints(const std::string& endpoint_string) +{ + std::string::size_type colon_pos = endpoint_string.find(':'); + if (colon_pos == std::string::npos) + FC_THROW("Missing required port number in endpoint string \"${endpoint_string}\"", + ("endpoint_string", endpoint_string)); + std::string port_string = endpoint_string.substr(colon_pos + 1); + uint16_t port = boost::lexical_cast(port_string); + std::string hostname = endpoint_string.substr(0, colon_pos); + return fc::resolve(hostname, port); +} + +int main(int argc, char** argv) +{ + std::queue nodes_to_visit; + std::set nodes_to_visit_set; + std::set nodes_already_visited; + + if ( argc < 3 ) { + std::cerr << "Usage: " << argv[0] << " [ ...]\n"; + exit(1); + } + + graphene::chain::chain_id_type chain_id( argv[1] ); + for ( int i = 2; i < argc; i++ ) { + std::vector addrs = resolve_endpoints( argv[i] ); + for ( auto it = addrs.begin(); it != addrs.end(); it++ ) { + if (nodes_to_visit_set.find(*it) == nodes_to_visit_set.end()) + { + nodes_to_visit.push( *it ); + nodes_to_visit_set.insert( *it ); + } + } + } + + fc::path data_dir = fc::temp_directory_path() / ("network_map_" + (fc::string) chain_id); + fc::create_directories(data_dir); + + fc::ip::endpoint seed_node1 = nodes_to_visit.front(); + + fc::ecc::private_key my_node_id = fc::ecc::private_key::generate(); + std::map address_info_by_node_id; + std::map > connections_by_node_id; + + while (!nodes_to_visit.empty()) + { + graphene::net::address_info this_node_info; + this_node_info.direction = graphene::net::peer_connection_direction::outbound; + this_node_info.firewalled = graphene::net::firewalled_state::not_firewalled; + + this_node_info.remote_endpoint = nodes_to_visit.front();; + nodes_to_visit.pop(); + nodes_to_visit_set.erase(this_node_info.remote_endpoint); + nodes_already_visited.insert(this_node_info.remote_endpoint); + + peer_probe probe; + try + { + probe.start(this_node_info.remote_endpoint, + my_node_id, chain_id); + probe.wait(); + + this_node_info.node_id = probe._node_id; + + connections_by_node_id[this_node_info.node_id] = probe._peers; + if (address_info_by_node_id.find(probe._node_id) == address_info_by_node_id.end()) + address_info_by_node_id[probe._node_id] = this_node_info; + + for (const graphene::net::address_info& info : probe._peers) + { + if (nodes_already_visited.find(info.remote_endpoint) == nodes_already_visited.end() && + info.firewalled == graphene::net::firewalled_state::not_firewalled && + nodes_to_visit_set.find(info.remote_endpoint) == nodes_to_visit_set.end()) + { + nodes_to_visit.push(info.remote_endpoint); + nodes_to_visit_set.insert(info.remote_endpoint); + } + if (address_info_by_node_id.find(info.node_id) == address_info_by_node_id.end()) + address_info_by_node_id[info.node_id] = info; + } + } + catch (const fc::exception&) + { + } + std::cout << "Traversed " << nodes_already_visited.size() << " of " << (nodes_already_visited.size() + nodes_to_visit.size()) << " known nodes\n"; + } + + graphene::net::node_id_t seed_node_id; + std::set non_firewalled_nodes_set; + for (const auto& address_info_for_node : address_info_by_node_id) + { + if (address_info_for_node.second.remote_endpoint == seed_node1) + seed_node_id = address_info_for_node.first; + if (address_info_for_node.second.firewalled == graphene::net::firewalled_state::not_firewalled) + non_firewalled_nodes_set.insert(address_info_for_node.first); + } + std::set seed_node_connections; + for (const graphene::net::address_info& info : connections_by_node_id[seed_node_id]) + seed_node_connections.insert(info.node_id); + std::set seed_node_missing_connections; + std::set_difference(non_firewalled_nodes_set.begin(), non_firewalled_nodes_set.end(), + seed_node_connections.begin(), seed_node_connections.end(), + std::inserter(seed_node_missing_connections, seed_node_missing_connections.end())); + seed_node_missing_connections.erase(seed_node_id); + + std::ofstream dot_stream((data_dir / "network_graph.dot").string().c_str()); + std::map all_known_nodes; + + dot_stream << "graph G {\n"; + dot_stream << " // Total " << address_info_by_node_id.size() << " nodes, firewalled: " << (address_info_by_node_id.size() - non_firewalled_nodes_set.size()) + << ", non-firewalled: " << non_firewalled_nodes_set.size() << "\n"; + dot_stream << " // Seed node is " << (std::string)address_info_by_node_id[seed_node_id].remote_endpoint << " id: " << fc::variant(seed_node_id).as_string() << "\n"; + dot_stream << " // Seed node is connected to " << connections_by_node_id[seed_node_id].size() << " nodes\n"; + dot_stream << " // Seed node is missing connections to " << seed_node_missing_connections.size() << " non-firewalled nodes:\n"; + for (const graphene::net::node_id_t& id : seed_node_missing_connections) + dot_stream << " // " << (std::string)address_info_by_node_id[id].remote_endpoint << "\n"; + + dot_stream << " layout=\"circo\";\n"; + //for (const auto& node_and_connections : connections_by_node_id) + // all_known_nodes[node_and_connections.first] = address_info_by_node_id[node_and_connections.first].remote_endpoint; + + for (const auto& address_info_for_node : address_info_by_node_id) + { + dot_stream << " \"" << fc::variant(address_info_for_node.first).as_string() << "\"[label=\"" << (std::string)address_info_for_node.second.remote_endpoint << "\""; + if (address_info_for_node.second.firewalled != graphene::net::firewalled_state::not_firewalled) + dot_stream << ",shape=rectangle"; + dot_stream << "];\n"; + } + for (auto& node_and_connections : connections_by_node_id) + for (const graphene::net::address_info& this_connection : node_and_connections.second) + dot_stream << " \"" << fc::variant(node_and_connections.first).as_string() << "\" -- \"" << fc::variant(this_connection.node_id).as_string() << "\";\n"; + + dot_stream << "}\n"; + + return 0; +} From 0e412c5c90830b41b428f0ba92f12759c6ef86bf Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Thu, 6 Sep 2018 17:09:50 +0200 Subject: [PATCH 013/108] Adapted to lastest fc, ported parallel execution from muse --- programs/network_mapper/network_mapper.cpp | 194 ++++++++++----------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/programs/network_mapper/network_mapper.cpp b/programs/network_mapper/network_mapper.cpp index 1f878e262f..6ff51f7eba 100644 --- a/programs/network_mapper/network_mapper.cpp +++ b/programs/network_mapper/network_mapper.cpp @@ -4,18 +4,15 @@ #include #include #include -#include +#include #include #include #include +#include -#include -#include - +#include #include -#include - class peer_probe : public graphene::net::peer_connection_delegate { public: @@ -24,6 +21,7 @@ class peer_probe : public graphene::net::peer_connection_delegate graphene::net::peer_connection_ptr _connection; std::vector _peers; fc::ecc::public_key _node_id; + fc::ip::endpoint _remote; bool _connection_was_rejected; bool _done; fc::promise::ptr _probe_complete_promise; @@ -42,7 +40,8 @@ class peer_probe : public graphene::net::peer_connection_delegate const fc::ecc::private_key& my_node_id, const graphene::chain::chain_id_type& chain_id) { - fc::future connect_task = fc::async([=](){ _connection->connect_to(endpoint_to_probe); }, "connect_task"); + _remote = endpoint_to_probe; + fc::future connect_task = fc::async([this](){ _connection->connect_to(_remote); }, "connect_task"); try { connect_task.wait(fc::seconds(10)); @@ -60,12 +59,12 @@ class peer_probe : public graphene::net::peer_connection_delegate fc::ecc::compact_signature signature = my_node_id.sign_compact(shared_secret_encoder.result()); graphene::net::hello_message hello("network_mapper", - GRAPHENE_NET_PROTOCOL_VERSION, - fc::ip::address(), 0, 0, - my_node_id.get_public_key(), - signature, - chain_id, - fc::variant_object()); + GRAPHENE_NET_PROTOCOL_VERSION, + fc::ip::address(), 0, 0, + my_node_id.get_public_key(), + signature, + chain_id, + fc::variant_object()); _connection->send_message(hello); } @@ -96,11 +95,7 @@ class peer_probe : public graphene::net::peer_connection_delegate case graphene::net::core_message_type_enum::closing_connection_message_type: on_closing_connection_message( originating_peer, received_message.as() ); break; - case graphene::net::core_message_type_enum::current_time_request_message_type: - on_current_time_request_message( originating_peer, received_message.as() ); - break; - case graphene::net::core_message_type_enum::current_time_reply_message_type: - on_current_time_reply_message( originating_peer, received_message.as() ); + default: break; } } @@ -110,7 +105,7 @@ class peer_probe : public graphene::net::peer_connection_delegate { _node_id = hello_message_received.node_public_key; if (hello_message_received.user_data.contains("node_id")) - originating_peer->node_id = hello_message_received.user_data["node_id"].as(); + originating_peer->node_id = hello_message_received.user_data["node_id"].as( 1 ); originating_peer->send_message(graphene::net::connection_rejected_message()); } @@ -152,16 +147,6 @@ class peer_probe : public graphene::net::peer_connection_delegate _peer_closed_connection = true; } - void on_current_time_request_message(graphene::net::peer_connection* originating_peer, - const graphene::net::current_time_request_message& current_time_request_message_received) - { - } - - void on_current_time_reply_message(graphene::net::peer_connection* originating_peer, - const graphene::net::current_time_reply_message& current_time_reply_message_received) - { - } - void on_connection_closed(graphene::net::peer_connection* originating_peer) override { _done = true; @@ -173,24 +158,12 @@ class peer_probe : public graphene::net::peer_connection_delegate return graphene::net::item_not_available_message(item); } - void wait() + void wait( const fc::microseconds& timeout_us ) { - _probe_complete_promise->wait(); + _probe_complete_promise->wait( timeout_us ); } }; -static std::vector resolve_endpoints(const std::string& endpoint_string) -{ - std::string::size_type colon_pos = endpoint_string.find(':'); - if (colon_pos == std::string::npos) - FC_THROW("Missing required port number in endpoint string \"${endpoint_string}\"", - ("endpoint_string", endpoint_string)); - std::string port_string = endpoint_string.substr(colon_pos + 1); - uint16_t port = boost::lexical_cast(port_string); - std::string hostname = endpoint_string.substr(0, colon_pos); - return fc::resolve(hostname, port); -} - int main(int argc, char** argv) { std::queue nodes_to_visit; @@ -198,20 +171,22 @@ int main(int argc, char** argv) std::set nodes_already_visited; if ( argc < 3 ) { - std::cerr << "Usage: " << argv[0] << " [ ...]\n"; - exit(1); + std::cerr << "Usage: " << argv[0] << " [ ...]\n"; + exit(1); } - graphene::chain::chain_id_type chain_id( argv[1] ); - for ( int i = 2; i < argc; i++ ) { - std::vector addrs = resolve_endpoints( argv[i] ); - for ( auto it = addrs.begin(); it != addrs.end(); it++ ) { - if (nodes_to_visit_set.find(*it) == nodes_to_visit_set.end()) - { - nodes_to_visit.push( *it ); - nodes_to_visit_set.insert( *it ); - } - } + const graphene::chain::chain_id_type chain_id( argv[1] ); + for ( int i = 2; i < argc; i++ ) + { + std::string ep(argv[i]); + uint16_t port; + auto pos = ep.find(':'); + if (pos > 0) + port = boost::lexical_cast( ep.substr( pos+1, ep.size() ) ); + else + port = 1776; + for (const auto& addr : fc::resolve( ep.substr( 0, pos > 0 ? pos : ep.size() ), port )) + nodes_to_visit.push( addr ); } fc::path data_dir = fc::temp_directory_path() / ("network_map_" + (fc::string) chain_id); @@ -222,48 +197,76 @@ int main(int argc, char** argv) fc::ecc::private_key my_node_id = fc::ecc::private_key::generate(); std::map address_info_by_node_id; std::map > connections_by_node_id; + std::vector> probes; - while (!nodes_to_visit.empty()) + while (!nodes_to_visit.empty() || !probes.empty()) { - graphene::net::address_info this_node_info; - this_node_info.direction = graphene::net::peer_connection_direction::outbound; - this_node_info.firewalled = graphene::net::firewalled_state::not_firewalled; - - this_node_info.remote_endpoint = nodes_to_visit.front();; - nodes_to_visit.pop(); - nodes_to_visit_set.erase(this_node_info.remote_endpoint); - nodes_already_visited.insert(this_node_info.remote_endpoint); - - peer_probe probe; - try + while (!nodes_to_visit.empty()) { - probe.start(this_node_info.remote_endpoint, - my_node_id, chain_id); - probe.wait(); - - this_node_info.node_id = probe._node_id; - - connections_by_node_id[this_node_info.node_id] = probe._peers; - if (address_info_by_node_id.find(probe._node_id) == address_info_by_node_id.end()) - address_info_by_node_id[probe._node_id] = this_node_info; - - for (const graphene::net::address_info& info : probe._peers) - { - if (nodes_already_visited.find(info.remote_endpoint) == nodes_already_visited.end() && - info.firewalled == graphene::net::firewalled_state::not_firewalled && - nodes_to_visit_set.find(info.remote_endpoint) == nodes_to_visit_set.end()) - { - nodes_to_visit.push(info.remote_endpoint); - nodes_to_visit_set.insert(info.remote_endpoint); - } - if (address_info_by_node_id.find(info.node_id) == address_info_by_node_id.end()) - address_info_by_node_id[info.node_id] = info; - } + fc::ip::endpoint remote = nodes_to_visit.front(); + nodes_to_visit.pop(); + nodes_to_visit_set.erase( remote ); + nodes_already_visited.insert( remote ); + + try + { + std::shared_ptr probe(new peer_probe()); + probe->start(remote, my_node_id, chain_id); + probes.push_back( probe ); + } + catch (const fc::exception&) + { + std::cerr << "Failed to connect " << fc::string(remote) << " - skipping!" << std::endl; + } } - catch (const fc::exception&) + + if (!probes.empty()) { + try { + probes[0]->wait( fc::microseconds(10000) ); + } catch ( fc::timeout_exception& e ) { /* ignore */ } + + std::vector> running; + for ( auto& probe : probes ) { + if (probe->_probe_complete_promise->error()) + { + std::cerr << fc::string(probe->_remote) << " ran into an error!\n"; + continue; + } + if (!probe->_probe_complete_promise->ready()) + { + running.push_back( probe ); + continue; + } + + graphene::net::address_info this_node_info; + this_node_info.direction = graphene::net::peer_connection_direction::outbound; + this_node_info.firewalled = graphene::net::firewalled_state::not_firewalled; + this_node_info.remote_endpoint = probe->_remote; + this_node_info.node_id = probe->_node_id; + + connections_by_node_id[this_node_info.node_id] = probe->_peers; + if (address_info_by_node_id.find(probe->_node_id) == address_info_by_node_id.end()) + address_info_by_node_id[probe->_node_id] = this_node_info; + + for (const graphene::net::address_info& info : probe->_peers) + { + if (nodes_already_visited.find(info.remote_endpoint) == nodes_already_visited.end() && + info.firewalled == graphene::net::firewalled_state::not_firewalled && + nodes_to_visit_set.find(info.remote_endpoint) == nodes_to_visit_set.end()) + { + nodes_to_visit.push(info.remote_endpoint); + nodes_to_visit_set.insert(info.remote_endpoint); + } + if (address_info_by_node_id.find(info.node_id) == address_info_by_node_id.end()) + address_info_by_node_id[info.node_id] = info; + } + } + probes = std::move( running ); + std::cout << address_info_by_node_id.size() << " checked, " + << probes.size() << " active, " + << nodes_to_visit.size() << " to do\n"; } - std::cout << "Traversed " << nodes_already_visited.size() << " of " << (nodes_already_visited.size() + nodes_to_visit.size()) << " known nodes\n"; } graphene::net::node_id_t seed_node_id; @@ -285,31 +288,28 @@ int main(int argc, char** argv) seed_node_missing_connections.erase(seed_node_id); std::ofstream dot_stream((data_dir / "network_graph.dot").string().c_str()); - std::map all_known_nodes; dot_stream << "graph G {\n"; dot_stream << " // Total " << address_info_by_node_id.size() << " nodes, firewalled: " << (address_info_by_node_id.size() - non_firewalled_nodes_set.size()) << ", non-firewalled: " << non_firewalled_nodes_set.size() << "\n"; - dot_stream << " // Seed node is " << (std::string)address_info_by_node_id[seed_node_id].remote_endpoint << " id: " << fc::variant(seed_node_id).as_string() << "\n"; + dot_stream << " // Seed node is " << (std::string)address_info_by_node_id[seed_node_id].remote_endpoint << " id: " << fc::variant( seed_node_id, 1 ).as_string() << "\n"; dot_stream << " // Seed node is connected to " << connections_by_node_id[seed_node_id].size() << " nodes\n"; dot_stream << " // Seed node is missing connections to " << seed_node_missing_connections.size() << " non-firewalled nodes:\n"; for (const graphene::net::node_id_t& id : seed_node_missing_connections) dot_stream << " // " << (std::string)address_info_by_node_id[id].remote_endpoint << "\n"; dot_stream << " layout=\"circo\";\n"; - //for (const auto& node_and_connections : connections_by_node_id) - // all_known_nodes[node_and_connections.first] = address_info_by_node_id[node_and_connections.first].remote_endpoint; for (const auto& address_info_for_node : address_info_by_node_id) { - dot_stream << " \"" << fc::variant(address_info_for_node.first).as_string() << "\"[label=\"" << (std::string)address_info_for_node.second.remote_endpoint << "\""; + dot_stream << " \"" << fc::variant( address_info_for_node.first, 1 ).as_string() << "\"[label=\"" << (std::string)address_info_for_node.second.remote_endpoint << "\""; if (address_info_for_node.second.firewalled != graphene::net::firewalled_state::not_firewalled) dot_stream << ",shape=rectangle"; dot_stream << "];\n"; } for (auto& node_and_connections : connections_by_node_id) for (const graphene::net::address_info& this_connection : node_and_connections.second) - dot_stream << " \"" << fc::variant(node_and_connections.first).as_string() << "\" -- \"" << fc::variant(this_connection.node_id).as_string() << "\";\n"; + dot_stream << " \"" << fc::variant( node_and_connections.first, 2 ).as_string() << "\" -- \"" << fc::variant( this_connection.node_id, 1 ).as_string() << "\";\n"; dot_stream << "}\n"; From 5f699b41806283a9dd11ee9d6f1390a4b2e842e7 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 31 Oct 2018 14:20:45 +0100 Subject: [PATCH 014/108] Fix: waiting for a promise with a timeout can lead to the promise erroring out --- programs/network_mapper/network_mapper.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/programs/network_mapper/network_mapper.cpp b/programs/network_mapper/network_mapper.cpp index 6ff51f7eba..6fef314254 100644 --- a/programs/network_mapper/network_mapper.cpp +++ b/programs/network_mapper/network_mapper.cpp @@ -212,7 +212,7 @@ int main(int argc, char** argv) { std::shared_ptr probe(new peer_probe()); probe->start(remote, my_node_id, chain_id); - probes.push_back( probe ); + probes.emplace_back( std::move( probe ) ); } catch (const fc::exception&) { @@ -222,10 +222,7 @@ int main(int argc, char** argv) if (!probes.empty()) { - try { - probes[0]->wait( fc::microseconds(10000) ); - } catch ( fc::timeout_exception& e ) { /* ignore */ } - + fc::yield(); std::vector> running; for ( auto& probe : probes ) { if (probe->_probe_complete_promise->error()) From 0abcff9fb8b6d7e369e61bd09557ca3bd1ae2d51 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Wed, 7 Nov 2018 08:05:21 -0600 Subject: [PATCH 015/108] Allow required plugins As far as I can tell, there was no way previously for an application to register a plugin and ensure that plugin got loaded -- it would be necessary to manually edit the config and specify the plugin be loaded. This is suboptimal; if third party code wishes to track third party extensions on the blockchain, the correct way to do this is with a plugin, and this third party build should be able to load these required plugins regardless of whether the config lists them or not. This commit adds a boolean parameter to application::register_plugin which defaults to false for backwards compatibility; however, if set to true, the plugin will automatically be enabled when the app initializes. --- .../app/include/graphene/app/application.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libraries/app/include/graphene/app/application.hpp b/libraries/app/include/graphene/app/application.hpp index 4892bb9a27..bea72bf8ed 100644 --- a/libraries/app/include/graphene/app/application.hpp +++ b/libraries/app/include/graphene/app/application.hpp @@ -48,18 +48,17 @@ namespace graphene { namespace app { application(); ~application(); - void set_program_options( boost::program_options::options_description& command_line_options, - boost::program_options::options_description& configuration_file_options )const; - void initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); - void initialize_plugins( const boost::program_options::variables_map& options ); + void set_program_options(boost::program_options::options_description& command_line_options, + boost::program_options::options_description& configuration_file_options)const; + void initialize(const fc::path& data_dir, const boost::program_options::variables_map& options); + void initialize_plugins(const boost::program_options::variables_map& options); void startup(); void shutdown(); void startup_plugins(); void shutdown_plugins(); template - std::shared_ptr register_plugin() - { + std::shared_ptr register_plugin(bool auto_load = false) { auto plug = std::make_shared(); plug->plugin_set_app(this); @@ -72,6 +71,10 @@ namespace graphene { namespace app { _cfg_options.add(plugin_cfg_options); add_available_plugin( plug ); + + if (auto_load) + enable_plugin(plug->plugin_name()); + return plug; } std::shared_ptr get_plugin( const string& name )const; From b5362ceddb5d6d793a5ff943e4b8a9e180cb7f60 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Wed, 7 Nov 2018 20:28:09 -0600 Subject: [PATCH 016/108] Clean up plugin loader That code was nasty and... kinda wrong. So fix it up all shiny-like. But I also removed the super annoying default "wanted" plugins list, which only causes problems for third parties like me, and in general is just poor form. In my opinion, 5220425d433c1ce7af4f3b243655d74afa6c4e7a provides a much cleaner way to do this, in a way that is friendly rather than hostile to third parties. Would Be Nice: A generalized plugin conflict system added at the abstract_plugin level, so, for example, the elasticsearch plugin can conflict account_history and we deal with this in a general fashion rather than having this dirty special case check here. --- libraries/app/application.cpp | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index b77da4b711..98d187763a 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -1007,31 +1007,17 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti fc::asio::default_io_service_scope::set_num_threads(num_threads); } - std::vector wanted; - if( options.count("plugins") ) - { - boost::split(wanted, options.at("plugins").as(), [](char c){return c == ' ';}); - } - else - { - wanted.push_back("witness"); - wanted.push_back("account_history"); - wanted.push_back("market_history"); - wanted.push_back("grouped_orders"); - } - int es_ah_conflict_counter = 0; - for (auto& it : wanted) - { - if(it == "account_history") - ++es_ah_conflict_counter; - if(it == "elasticsearch") - ++es_ah_conflict_counter; + if (options.count("plugins")) { + std::set plugins; + boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); - if(es_ah_conflict_counter > 1) { - elog("Can't start program with elasticsearch and account_history plugin at the same time"); - std::exit(EXIT_FAILURE); - } - if (!it.empty()) enable_plugin(it); + FC_ASSERT(!(plugins.count("account_history") && plugins.count("elasticsearch")), + "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin"); + + std::for_each(plugins.begin(), plugins.end(), [this](const string& plug) mutable { + if (!plug.empty()) + enable_plugin(plug); + }); } } From f5031bde96c5f3e20fc71c1d34a519bb417e850d Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 15 Nov 2018 17:54:24 -0300 Subject: [PATCH 017/108] move plugins option to witness_node executable --- libraries/app/application.cpp | 14 --------- .../app/include/graphene/app/application.hpp | 3 +- programs/witness_node/main.cpp | 31 +++++++++++++++++-- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 98d187763a..62748a7bcb 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -947,7 +947,6 @@ void application::set_program_options(boost::program_options::options_descriptio ("genesis-json", bpo::value(), "File to read Genesis State from") ("dbg-init-key", bpo::value(), "Block signing key to use for init witnesses, overrides genesis file") ("api-access", bpo::value(), "JSON file specifying API permissions") - ("plugins", bpo::value(), "Space-separated list of plugins to activate") ("io-threads", bpo::value()->implicit_value(0), "Number of IO threads, default to 0 for auto-configuration") ("enable-subscribe-to-all", bpo::value()->implicit_value(true), "Whether allow API clients to subscribe to universal object creation and removal events") @@ -1006,19 +1005,6 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti const uint16_t num_threads = options["io-threads"].as(); fc::asio::default_io_service_scope::set_num_threads(num_threads); } - - if (options.count("plugins")) { - std::set plugins; - boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); - - FC_ASSERT(!(plugins.count("account_history") && plugins.count("elasticsearch")), - "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin"); - - std::for_each(plugins.begin(), plugins.end(), [this](const string& plug) mutable { - if (!plug.empty()) - enable_plugin(plug); - }); - } } void application::startup() diff --git a/libraries/app/include/graphene/app/application.hpp b/libraries/app/include/graphene/app/application.hpp index bea72bf8ed..66a73f3999 100644 --- a/libraries/app/include/graphene/app/application.hpp +++ b/libraries/app/include/graphene/app/application.hpp @@ -101,8 +101,9 @@ namespace graphene { namespace app { const application_options& get_options(); - private: void enable_plugin( const string& name ); + + private: void add_available_plugin( std::shared_ptr p ); std::shared_ptr my; diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 07c17a9010..3141c0957a 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ int main(int argc, char** argv) { ("help,h", "Print this help message and exit.") ("data-dir,d", bpo::value()->default_value("witness_node_data_dir"), "Directory containing databases, configuration file, etc.") ("version,v", "Display version information") - ; + ("plugins", bpo::value(), "Space-separated list of plugins to activate"); bpo::variables_map options; @@ -90,10 +91,34 @@ int main(int argc, char** argv) { } catch (const boost::program_options::error& e) { - std::cerr << "Error parsing command line: " << e.what() << "\n"; - return 1; + std::cerr << "Error parsing command line: " << e.what() << "\n"; + return 1; } + if (options.count("plugins")) { + + std::set plugins; + boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); + + if(plugins.count("account_history") && plugins.count("elasticsearch")) { + std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n"; + return 1; + } + + std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { + if (!plug.empty()) { + node->enable_plugin(plug); + } + }); + } + else { + node->enable_plugin("witness"); + node->enable_plugin("account_history"); + node->enable_plugin("market_history"); + node->enable_plugin("grouped_orders"); + } + + if( options.count("help") ) { std::cout << app_options << "\n"; From adef6a2984c13ce882261036a01ba610fe11ff1d Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 15 Nov 2018 18:54:02 -0300 Subject: [PATCH 018/108] fix cli wallet test --- tests/cli/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 393dce4d83..16b29e125d 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -114,10 +114,10 @@ int get_available_port() std::shared_ptr start_application(fc::temp_directory& app_dir, int& server_port_number) { std::shared_ptr app1(new graphene::app::application{}); - app1->register_plugin(); - app1->register_plugin< graphene::market_history::market_history_plugin >(); - app1->register_plugin< graphene::witness_plugin::witness_plugin >(); - app1->register_plugin< graphene::grouped_orders::grouped_orders_plugin>(); + app1->register_plugin(true); + app1->register_plugin< graphene::market_history::market_history_plugin >(true); + app1->register_plugin< graphene::witness_plugin::witness_plugin >(true); + app1->register_plugin< graphene::grouped_orders::grouped_orders_plugin>(true); app1->startup_plugins(); boost::program_options::variables_map cfg; #ifdef _WIN32 From 9647ad117b297aad4885565d4dedf9393a0f9917 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 15 Nov 2018 19:28:56 -0300 Subject: [PATCH 019/108] remove double space line --- programs/witness_node/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 3141c0957a..05679766b6 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -117,8 +117,7 @@ int main(int argc, char** argv) { node->enable_plugin("market_history"); node->enable_plugin("grouped_orders"); } - - + if( options.count("help") ) { std::cout << app_options << "\n"; From ce35a798669660fa1515f536a9e9b319eae47d48 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sat, 17 Nov 2018 19:02:57 -0300 Subject: [PATCH 020/108] add default plugin values to option --- programs/witness_node/main.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 05679766b6..f0fd5da66a 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -65,9 +65,11 @@ int main(int argc, char** argv) { bpo::options_description cfg_options("Graphene Witness Node"); app_options.add_options() ("help,h", "Print this help message and exit.") - ("data-dir,d", bpo::value()->default_value("witness_node_data_dir"), "Directory containing databases, configuration file, etc.") + ("data-dir,d", bpo::value()->default_value("witness_node_data_dir"), + "Directory containing databases, configuration file, etc.") ("version,v", "Display version information") - ("plugins", bpo::value(), "Space-separated list of plugins to activate"); + ("plugins", bpo::value()->default_value("witness account_history market_history grouped_orders"), + "Space-separated list of plugins to activate"); bpo::variables_map options; @@ -111,12 +113,6 @@ int main(int argc, char** argv) { } }); } - else { - node->enable_plugin("witness"); - node->enable_plugin("account_history"); - node->enable_plugin("market_history"); - node->enable_plugin("grouped_orders"); - } if( options.count("help") ) { From 58ad814bc74992153e668ed6911c72f4a214d700 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sun, 18 Nov 2018 11:05:18 -0300 Subject: [PATCH 021/108] remove not needed check --- programs/witness_node/main.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index f0fd5da66a..336639b1ba 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -97,22 +97,19 @@ int main(int argc, char** argv) { return 1; } - if (options.count("plugins")) { + std::set plugins; + boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); - std::set plugins; - boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); + if(plugins.count("account_history") && plugins.count("elasticsearch")) { + std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n"; + return 1; + } - if(plugins.count("account_history") && plugins.count("elasticsearch")) { - std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n"; - return 1; + std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { + if (!plug.empty()) { + node->enable_plugin(plug); } - - std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { - if (!plug.empty()) { - node->enable_plugin(plug); - } - }); - } + }); if( options.count("help") ) { From 7089d2a95b76e0263ce1c34700db2c084ab1395b Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 30 Nov 2018 16:35:40 -0300 Subject: [PATCH 022/108] fix delayed node --- programs/delayed_node/main.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 0ba1e6944d..137ae22627 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -60,7 +60,7 @@ fc::optional load_logging_config_from_ini_file(const fc::pat int main(int argc, char** argv) { try { - app::application node; + app::application* node = new app::application(); bpo::options_description app_options("Graphene Delayed Node"); bpo::options_description cfg_options("Graphene Delayed Node"); app_options.add_options() @@ -70,14 +70,14 @@ int main(int argc, char** argv) { bpo::variables_map options; - auto delayed_plug = node.register_plugin(); - auto history_plug = node.register_plugin(); - auto market_history_plug = node.register_plugin(); + auto delayed_plug = node->register_plugin(); + auto history_plug = node->register_plugin(); + auto market_history_plug = node->register_plugin(); try { bpo::options_description cli, cfg; - node.set_program_options(cli, cfg); + node->set_program_options(cli, cfg); app_options.add(cli); cfg_options.add(cfg); bpo::store(bpo::parse_command_line(argc, argv, app_options), options); @@ -88,6 +88,13 @@ int main(int argc, char** argv) { return 1; } + std::set plugins = {"delayed_node", "account_history", "market_history"}; + std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { + if (!plug.empty()) { + node->enable_plugin(plug); + } + }); + if( options.count("help") ) { std::cout << app_options << "\n"; @@ -160,26 +167,24 @@ int main(int argc, char** argv) { elog("Error parsing configuration file: ${e}", ("e", e.what())); return 1; } - if( !options.count("plugins") ) - options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); - node.initialize(data_dir, options); - node.initialize_plugins( options ); + node->initialize(data_dir, options); + node->initialize_plugins( options ); - node.startup(); - node.startup_plugins(); + node->startup(); + node->startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); fc::set_signal_handler([&exit_promise](int signal) { exit_promise->set_value(signal); }, SIGINT); - ilog("Started delayed node on a chain with ${h} blocks.", ("h", node.chain_database()->head_block_num())); - ilog("Chain ID is ${id}", ("id", node.chain_database()->get_chain_id()) ); + ilog("Started delayed node on a chain with ${h} blocks.", ("h", node->chain_database()->head_block_num())); + ilog("Chain ID is ${id}", ("id", node->chain_database()->get_chain_id()) ); int signal = exit_promise->wait(); ilog("Exiting from signal ${n}", ("n", signal)); - node.shutdown_plugins(); + node->shutdown_plugins(); return 0; } catch( const fc::exception& e ) { elog("Exiting with error:\n${e}", ("e", e.to_detail_string())); From 1dd719f94ddadcbf13486494d8c2eb1b8eb8d566 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 5 Dec 2018 10:02:21 -0300 Subject: [PATCH 023/108] use auto load plugins in delayed node --- programs/delayed_node/main.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 137ae22627..311911adcb 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -70,9 +70,9 @@ int main(int argc, char** argv) { bpo::variables_map options; - auto delayed_plug = node->register_plugin(); - auto history_plug = node->register_plugin(); - auto market_history_plug = node->register_plugin(); + auto delayed_plug = node->register_plugin(true); + auto history_plug = node->register_plugin(true); + auto market_history_plug = node->register_plugin(true); try { @@ -88,13 +88,6 @@ int main(int argc, char** argv) { return 1; } - std::set plugins = {"delayed_node", "account_history", "market_history"}; - std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable { - if (!plug.empty()) { - node->enable_plugin(plug); - } - }); - if( options.count("help") ) { std::cout << app_options << "\n"; From a8020a7da022cf8ec24063b64a84a46a06ab82c8 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 17 Dec 2018 10:46:38 -0300 Subject: [PATCH 024/108] reverse delayed node and only add auto to needed plugins --- programs/delayed_node/main.cpp | 50 ++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 311911adcb..a8ef7daddb 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -60,32 +60,32 @@ fc::optional load_logging_config_from_ini_file(const fc::pat int main(int argc, char** argv) { try { - app::application* node = new app::application(); + app::application node; bpo::options_description app_options("Graphene Delayed Node"); bpo::options_description cfg_options("Graphene Delayed Node"); app_options.add_options() - ("help,h", "Print this help message and exit.") - ("data-dir,d", bpo::value()->default_value("delayed_node_data_dir"), "Directory containing databases, configuration file, etc.") - ; + ("help,h", "Print this help message and exit.") + ("data-dir,d", bpo::value()->default_value("delayed_node_data_dir"), "Directory containing databases, configuration file, etc.") + ; bpo::variables_map options; - auto delayed_plug = node->register_plugin(true); - auto history_plug = node->register_plugin(true); - auto market_history_plug = node->register_plugin(true); + auto delayed_plug = node.register_plugin(true); + auto history_plug = node.register_plugin(true); + auto market_history_plug = node.register_plugin(true); try { bpo::options_description cli, cfg; - node->set_program_options(cli, cfg); + node.set_program_options(cli, cfg); app_options.add(cli); cfg_options.add(cfg); bpo::store(bpo::parse_command_line(argc, argv, app_options), options); } catch (const boost::program_options::error& e) { - std::cerr << "Error parsing command line: " << e.what() << "\n"; - return 1; + std::cerr << "Error parsing command line: " << e.what() << "\n"; + return 1; } if( options.count("help") ) @@ -160,24 +160,26 @@ int main(int argc, char** argv) { elog("Error parsing configuration file: ${e}", ("e", e.what())); return 1; } + if( !options.count("plugins") ) + options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); - node->initialize(data_dir, options); - node->initialize_plugins( options ); + node.initialize(data_dir, options); + node.initialize_plugins( options ); - node->startup(); - node->startup_plugins(); + node.startup(); + node.startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); fc::set_signal_handler([&exit_promise](int signal) { - exit_promise->set_value(signal); + exit_promise->set_value(signal); }, SIGINT); - ilog("Started delayed node on a chain with ${h} blocks.", ("h", node->chain_database()->head_block_num())); - ilog("Chain ID is ${id}", ("id", node->chain_database()->get_chain_id()) ); + ilog("Started delayed node on a chain with ${h} blocks.", ("h", node.chain_database()->head_block_num())); + ilog("Chain ID is ${id}", ("id", node.chain_database()->get_chain_id()) ); int signal = exit_promise->wait(); ilog("Exiting from signal ${n}", ("n", signal)); - node->shutdown_plugins(); + node.shutdown_plugins(); return 0; } catch( const fc::exception& e ) { elog("Exiting with error:\n${e}", ("e", e.to_detail_string())); @@ -239,14 +241,14 @@ fc::optional load_logging_config_from_ini_file(const fc::pat // stdout/stderr will be taken from ini file, everything else hard-coded here fc::console_appender::config console_appender_config; console_appender_config.level_colors.emplace_back( - fc::console_appender::level_color(fc::log_level::debug, - fc::console_appender::color::green)); + fc::console_appender::level_color(fc::log_level::debug, + fc::console_appender::color::green)); console_appender_config.level_colors.emplace_back( - fc::console_appender::level_color(fc::log_level::warn, - fc::console_appender::color::brown)); + fc::console_appender::level_color(fc::log_level::warn, + fc::console_appender::color::brown)); console_appender_config.level_colors.emplace_back( - fc::console_appender::level_color(fc::log_level::error, - fc::console_appender::color::cyan)); + fc::console_appender::level_color(fc::log_level::error, + fc::console_appender::color::cyan)); console_appender_config.stream = fc::variant(stream_name, 1).as(1); logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config, GRAPHENE_MAX_NESTED_OBJECTS))); found_logging_config = true; From 1326a5c126d8fcf99cfa717925dac58c0bbb0a0d Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 17 Dec 2018 11:15:13 -0300 Subject: [PATCH 025/108] make plugins option work in delayed --- programs/delayed_node/main.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index a8ef7daddb..4a43535ac6 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -66,13 +66,15 @@ int main(int argc, char** argv) { app_options.add_options() ("help,h", "Print this help message and exit.") ("data-dir,d", bpo::value()->default_value("delayed_node_data_dir"), "Directory containing databases, configuration file, etc.") + ("plugins", bpo::value()->default_value("delayed_node account_history market_history"), + "Space-separated list of plugins to activate"); ; bpo::variables_map options; - auto delayed_plug = node.register_plugin(true); - auto history_plug = node.register_plugin(true); - auto market_history_plug = node.register_plugin(true); + auto delayed_plug = node.register_plugin(); + auto history_plug = node.register_plugin(); + auto market_history_plug = node.register_plugin(); try { @@ -160,9 +162,20 @@ int main(int argc, char** argv) { elog("Error parsing configuration file: ${e}", ("e", e.what())); return 1; } - if( !options.count("plugins") ) - options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); + std::set plugins; + boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); + + if(plugins.count("account_history") && plugins.count("elasticsearch")) { + std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n"; + return 1; + } + + std::for_each(plugins.begin(), plugins.end(), [&](const std::string& plug) mutable { + if (!plug.empty()) { + node.enable_plugin(plug); + } + }); node.initialize(data_dir, options); node.initialize_plugins( options ); From 53d3538495c1654e6d1ac80f7d5d6bafc5a41d1a Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 25 Dec 2018 09:47:24 -0500 Subject: [PATCH 026/108] create test --- tests/common/database_fixture.cpp | 22 ++++++++++++++-------- tests/tests/history_api_tests.cpp | 31 ++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 874e2f8241..a77854cd22 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -111,8 +111,17 @@ database_fixture::database_fixture() open_database(); + /** + * Test specific settings + */ + auto current_test_name = boost::unit_test::framework::current_test_case().p_name.value; + auto current_test_suite_id = boost::unit_test::framework::current_test_case().p_parent_id; + if (current_test_name == "get_account_history_operations") + { + options.insert(std::make_pair("max-ops-per-account", boost::program_options::variable_value((uint64_t)75, false))); + } // add account tracking for ahplugin for special test case with track-account enabled - if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account") { + if( !options.count("track-account") && current_test_name == "track_account") { std::vector track_account; std::string track = "\"1.2.17\""; track_account.push_back(track); @@ -120,7 +129,7 @@ database_fixture::database_fixture() options.insert(std::make_pair("partial-operations", boost::program_options::variable_value(true, false))); } // account tracking 2 accounts - if( !options.count("track-account") && boost::unit_test::framework::current_test_case().p_name.value == "track_account2") { + if( !options.count("track-account") && current_test_name == "track_account2") { std::vector track_account; std::string track = "\"1.2.0\""; track_account.push_back(track); @@ -133,10 +142,7 @@ database_fixture::database_fixture() boost::unit_test::framework::current_test_case().p_name.value == "track_votes_committee_disabled") { app.chain_database()->enable_standby_votes_tracking( false ); } - - auto test_name = boost::unit_test::framework::current_test_case().p_name.value; - auto test_suite_id = boost::unit_test::framework::current_test_case().p_parent_id; - if(test_name == "elasticsearch_account_history" || test_name == "elasticsearch_suite") { + if(current_test_name == "elasticsearch_account_history" || current_test_name == "elasticsearch_suite") { auto esplugin = app.register_plugin(); esplugin->plugin_set_app(&app); @@ -149,7 +155,7 @@ database_fixture::database_fixture() esplugin->plugin_initialize(options); esplugin->plugin_startup(); } - else if( boost::unit_test::framework::get(test_suite_id).p_name.value != "performance_tests" ) + else if( boost::unit_test::framework::get(current_test_suite_id).p_name.value != "performance_tests" ) { auto ahplugin = app.register_plugin(); ahplugin->plugin_set_app(&app); @@ -157,7 +163,7 @@ database_fixture::database_fixture() ahplugin->plugin_startup(); } - if(test_name == "elasticsearch_objects" || test_name == "elasticsearch_suite") { + if(current_test_name == "elasticsearch_objects" || current_test_name == "elasticsearch_suite") { auto esobjects_plugin = app.register_plugin(); esobjects_plugin->plugin_set_app(&app); diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 1255864c20..f1935caf57 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -549,32 +549,53 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { int asset_create_op_id = operation::tag::value; int account_create_op_id = operation::tag::value; + int transfer_op_id = operation::tag::value; //account_id_type() did 1 asset_create op - vector histories = hist_api.get_account_history_operations("committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); + vector histories = hist_api.get_account_history_operations( + "committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); BOOST_CHECK_EQUAL(histories.size(), 1); BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); BOOST_CHECK_EQUAL(histories[0].op.which(), asset_create_op_id); //account_id_type() did 2 account_create ops - histories = hist_api.get_account_history_operations("committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); + histories = hist_api.get_account_history_operations( + "committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); BOOST_CHECK_EQUAL(histories.size(), 2); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // No asset_create op larger than id1 - histories = hist_api.get_account_history_operations("committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(1), 100); + histories = hist_api.get_account_history_operations( + "committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(1), 100); BOOST_CHECK_EQUAL(histories.size(), 0); // Limit 1 returns 1 result - histories = hist_api.get_account_history_operations("committee-account", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 1); + histories = hist_api.get_account_history_operations( + "committee-account", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 1); BOOST_CHECK_EQUAL(histories.size(), 1); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // alice has 1 op - histories = hist_api.get_account_history_operations("alice", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 100); + histories = hist_api.get_account_history_operations( + "alice", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 100); BOOST_CHECK_EQUAL(histories.size(), 1); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); + // create a bunch of accounts + for(int i = 0; i < 110; ++i) + { + std::string acct_name = "mytempacct" + std::to_string(i); + create_account(acct_name); + } + generate_block(); + + histories = hist_api.get_account_history_operations( + "committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); + BOOST_CHECK_EQUAL(histories.size(), 100); + if (histories.size() > 0) + BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); + + } catch (fc::exception &e) { edump((e.to_detail_string())); throw; From 20a2f6270d82f3e1953ab9106487e9e7e5935b05 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 25 Dec 2018 09:58:47 -0500 Subject: [PATCH 027/108] catching exception if history_object no longer in memory --- libraries/app/api.cpp | 9 ++++++--- tests/tests/history_api_tests.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index f3cffa70ff..877a49e788 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -376,9 +376,12 @@ namespace graphene { namespace app { else node = &node->next(db); } if( stop.instance.value == 0 && result.size() < limit ) { - const account_transaction_history_object head = account_transaction_history_id_type()(db); - if( head.account == account && head.operation_id(db).op.which() == operation_id ) - result.push_back(head.operation_id(db)); + try + { + const account_transaction_history_object head = account_transaction_history_id_type()(db); + if( head.account == account && head.operation_id(db).op.which() == operation_id ) + result.push_back(head.operation_id(db)); + } catch (fc::exception& ignore) { /* limit of history reached, head not found */ } } return result; } diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index f1935caf57..b8f8856384 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -582,16 +582,19 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // create a bunch of accounts - for(int i = 0; i < 110; ++i) + for(int i = 0; i < 80; ++i) { std::string acct_name = "mytempacct" + std::to_string(i); create_account(acct_name); } generate_block(); + // history is set to limit transactions to 75 (see database_fixture.hpp) + // so asking for more should only return 75 (and not throw exception, + // see https://github.com/bitshares/bitshares-core/issues/1490 histories = hist_api.get_account_history_operations( "committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 100); + BOOST_CHECK_EQUAL(histories.size(), 75); if (histories.size() > 0) BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); From 35037685c75a8b7af031462b77f47c6a2f230768 Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 27 Dec 2018 17:54:07 -0500 Subject: [PATCH 028/108] limit subscribed accounts to 100 --- libraries/app/database_api.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index f067a101e8..5e53c74713 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -259,7 +259,7 @@ class database_api_impl : public std::enable_shared_from_this bool _notify_remove_create = false; mutable fc::bloom_filter _subscribe_filter; - std::set _subscribed_accounts; + mutable std::set _subscribed_accounts; std::function _subscribe_callback; std::function _pending_trx_callback; std::function _block_applied_callback; @@ -594,8 +594,16 @@ vector> database_api_impl::get_key_references( vector Date: Fri, 28 Dec 2018 06:11:57 -0500 Subject: [PATCH 029/108] Add ilog message when plugin starts --- libraries/app/application.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index cc7828034f..f2cf80285d 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -1151,7 +1151,10 @@ void application::initialize_plugins( const boost::program_options::variables_ma void application::startup_plugins() { for( auto& entry : my->_active_plugins ) + { entry.second->plugin_startup(); + ilog( "Plugin ${name} started", ( "name", entry.second->plugin_name() ) ); + } return; } From bbd6773e148ff65f5c4eedef4df8de57543f08dc Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 09:45:01 -0500 Subject: [PATCH 030/108] Reduce warning messages, constructor still throws --- libraries/db/include/graphene/db/undo_database.hpp | 12 +----------- libraries/db/undo_database.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index cf6f06247d..f2f77d607d 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -59,17 +59,7 @@ namespace graphene { namespace db { { mv._apply_undo = false; } - ~session() { - try { - if( _apply_undo ) _db.undo(); - } - catch ( const fc::exception& e ) - { - elog( "${e}", ("e",e.to_detail_string() ) ); - throw; // maybe crash.. - } - if( _disable_on_exit ) _db.disable(); - } + ~session(); // defined in implementation file to prevent repeated compiler warnings void commit() { _apply_undo = false; _db.commit(); } void undo() { if( _apply_undo ) _db.undo(); _apply_undo = false; } void merge() { if( _apply_undo ) _db.merge(); _apply_undo = false; } diff --git a/libraries/db/undo_database.cpp b/libraries/db/undo_database.cpp index c5f2ef65df..bb05f2a6eb 100644 --- a/libraries/db/undo_database.cpp +++ b/libraries/db/undo_database.cpp @@ -30,6 +30,19 @@ namespace graphene { namespace db { void undo_database::enable() { _disabled = false; } void undo_database::disable() { _disabled = true; } +undo_database::session::~session() +{ + try { + if( _apply_undo ) _db.undo(); + } + catch ( const fc::exception& e ) + { + elog( "${e}", ("e",e.to_detail_string() ) ); + throw; // maybe crash.. + } + if( _disable_on_exit ) _db.disable(); +} + undo_database::session undo_database::start_undo_session( bool force_enable ) { if( _disabled && !force_enable ) return session(*this); From f52636d69c3ce4039672daaf34ec639e00cd95f9 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 09:53:01 -0500 Subject: [PATCH 031/108] Squelch memaccess and parentheses warnings --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faf3a59f6d..b81422ae50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ else( WIN32 ) # Apple AND Linux else( APPLE ) # Linux Specific Options Here message( STATUS "Configuring BitShares on Linux" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall -Wno-class-memaccess -Wno-parentheses" ) if(USE_PROFILER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) endif( USE_PROFILER ) From d4231adee917f8ba1f8651b6e3b45ddd43e59000 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 11:01:28 -0500 Subject: [PATCH 032/108] fixed comparison warnings --- tests/app/main.cpp | 26 +- tests/cli/main.cpp | 2 +- tests/tests/asset_api_tests.cpp | 2 +- tests/tests/authority_tests.cpp | 4 +- tests/tests/block_tests.cpp | 20 +- tests/tests/database_tests.cpp | 12 +- tests/tests/fee_tests.cpp | 30 +- tests/tests/history_api_tests.cpp | 374 ++++++++++---------- tests/tests/market_rounding_tests.cpp | 4 +- tests/tests/network_broadcast_api_tests.cpp | 2 +- tests/tests/operation_tests.cpp | 24 +- tests/tests/operation_tests2.cpp | 4 +- tests/tests/smartcoin_tests.cpp | 268 +++++++------- tests/tests/swan_tests.cpp | 6 +- tests/tests/voting_tests.cpp | 81 +++-- 15 files changed, 429 insertions(+), 430 deletions(-) diff --git a/tests/app/main.cpp b/tests/app/main.cpp index b68cdf78a0..26e494d10d 100644 --- a/tests/app/main.cpp +++ b/tests/app/main.cpp @@ -78,8 +78,8 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_logging_files_create /// check post-conditions BOOST_CHECK(fc::exists(config_ini_file)); BOOST_CHECK(fc::exists(logging_ini_file)); - BOOST_CHECK_GT(fc::file_size(config_ini_file), 0); - BOOST_CHECK_GT(fc::file_size(logging_ini_file), 0); + BOOST_CHECK_GT(fc::file_size(config_ini_file), 0u); + BOOST_CHECK_GT(fc::file_size(logging_ini_file), 0u); } BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_ini_options) @@ -109,8 +109,8 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_ini_options) /// check the options values are parsed into the output map BOOST_CHECK(!options.empty()); - BOOST_CHECK_EQUAL(options.count("option1"), 1); - BOOST_CHECK_EQUAL(options.count("option2"), 1); + BOOST_CHECK_EQUAL(options.count("option1"), 1u); + BOOST_CHECK_EQUAL(options.count("option2"), 1u); BOOST_CHECK_EQUAL(options["option1"].as(), "is present"); BOOST_CHECK_EQUAL(options["option2"].as(), 1); @@ -151,9 +151,9 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_logging_ini_options) /// this is a little bit tricky since load_configuration_options() doesn't provide output variable for logging_config auto logger_map = fc::get_logger_map(); auto appender_map = fc::get_appender_map(); - BOOST_CHECK_EQUAL(logger_map.size(), 1); + BOOST_CHECK_EQUAL(logger_map.size(), 1u); BOOST_CHECK(logger_map.count("default")); - BOOST_CHECK_EQUAL(appender_map.size(), 1); + BOOST_CHECK_EQUAL(appender_map.size(), 1u); BOOST_CHECK(appender_map.count("default")); } @@ -195,16 +195,16 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_legacy_config_ini_options) /// check the options values are parsed into the output map BOOST_CHECK(!options.empty()); - BOOST_CHECK_EQUAL(options.count("option1"), 1); - BOOST_CHECK_EQUAL(options.count("option2"), 1); + BOOST_CHECK_EQUAL(options.count("option1"), 1u); + BOOST_CHECK_EQUAL(options.count("option2"), 1u); BOOST_CHECK_EQUAL(options["option1"].as(), "is present"); BOOST_CHECK_EQUAL(options["option2"].as(), 1); auto logger_map = fc::get_logger_map(); auto appender_map = fc::get_appender_map(); - BOOST_CHECK_EQUAL(logger_map.size(), 1); + BOOST_CHECK_EQUAL(logger_map.size(), 1u); BOOST_CHECK(logger_map.count("default")); - BOOST_CHECK_EQUAL(appender_map.size(), 1); + BOOST_CHECK_EQUAL(appender_map.size(), 1u); BOOST_CHECK(appender_map.count("default")); } @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE( two_node_network ) app2.startup(); fc::usleep(fc::milliseconds(500)); - BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1); + BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1u); BOOST_CHECK_EQUAL(std::string(app1.p2p_node()->get_connected_peers().front().host.get_address()), "127.0.0.1"); BOOST_TEST_MESSAGE( "app1 and app2 successfully connected" ); @@ -321,8 +321,8 @@ BOOST_AUTO_TEST_CASE( two_node_network ) fc::usleep(fc::milliseconds(500)); BOOST_TEST_MESSAGE( "Verifying nodes are still connected" ); - BOOST_CHECK_EQUAL(app1.p2p_node()->get_connection_count(), 1); - BOOST_CHECK_EQUAL(app1.chain_database()->head_block_num(), 1); + BOOST_CHECK_EQUAL(app1.p2p_node()->get_connection_count(), 1u); + BOOST_CHECK_EQUAL(app1.chain_database()->head_block_num(), 1u); BOOST_TEST_MESSAGE( "Checking GRAPHENE_NULL_ACCOUNT has balance" ); } catch( fc::exception& e ) { diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 393dce4d83..4ef2552073 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -549,7 +549,7 @@ BOOST_FIXTURE_TEST_CASE( account_history_pagination, cli_fixture ) // 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); - BOOST_CHECK_EQUAL(201, history.size() ); + BOOST_CHECK_EQUAL(201u, history.size() ); std::set operation_ids; diff --git a/tests/tests/asset_api_tests.cpp b/tests/tests/asset_api_tests.cpp index aaa517a962..332f1b13b4 100644 --- a/tests/tests/asset_api_tests.cpp +++ b/tests/tests/asset_api_tests.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE( asset_holders ) // make call vector holders = asset_api.get_asset_holders(asset_id_type(), 0, 100); - BOOST_CHECK_EQUAL(holders.size(), 4); + BOOST_CHECK_EQUAL(holders.size(), 4u); // by now we can guarantee the order BOOST_CHECK(holders[0].name == "committee-account"); diff --git a/tests/tests/authority_tests.cpp b/tests/tests/authority_tests.cpp index cf9df59142..bb32f806e9 100644 --- a/tests/tests/authority_tests.cpp +++ b/tests/tests/authority_tests.cpp @@ -1734,7 +1734,7 @@ BOOST_AUTO_TEST_CASE( self_approving_proposal ) trx.operations.push_back(pop); const proposal_id_type pid1 = PUSH_TX( db, trx, ~0 ).operation_results[0].get(); trx.clear(); - BOOST_REQUIRE_EQUAL( 0, pid1.instance.value ); + BOOST_REQUIRE_EQUAL( 0u, pid1.instance.value ); db.get(pid1); trx.operations.push_back(pup); @@ -1765,7 +1765,7 @@ BOOST_AUTO_TEST_CASE( self_deleting_proposal ) trx.operations.push_back( pop ); const proposal_id_type pid1 = PUSH_TX( db, trx, ~0 ).operation_results[0].get(); trx.clear(); - BOOST_REQUIRE_EQUAL( 0, pid1.instance.value ); + BOOST_REQUIRE_EQUAL( 0u, pid1.instance.value ); db.get(pid1); proposal_update_operation pup; diff --git a/tests/tests/block_tests.cpp b/tests/tests/block_tests.cpp index 76d9c0b75c..2c7eec7d05 100644 --- a/tests/tests/block_tests.cpp +++ b/tests/tests/block_tests.cpp @@ -847,7 +847,7 @@ BOOST_FIXTURE_TEST_CASE( maintenance_interval, database_fixture ) { try { generate_block(); - BOOST_CHECK_EQUAL(db.head_block_num(), 2); + BOOST_CHECK_EQUAL(db.head_block_num(), 2u); fc::time_point_sec maintenence_time = db.get_dynamic_global_properties().next_maintenance_time; BOOST_CHECK_GT(maintenence_time.sec_since_epoch(), db.head_block_time().sec_since_epoch()); @@ -1024,17 +1024,17 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture ) } BOOST_TEST_MESSAGE( "Verifying that the interval didn't change immediately" ); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5u); auto past_time = db.head_block_time().sec_since_epoch(); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 5); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 5u); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 10); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 10u); BOOST_TEST_MESSAGE( "Generating blocks until proposal expires" ); generate_blocks(proposal_id_type()(db).expiration_time + 5); BOOST_TEST_MESSAGE( "Verify that the block interval is still 5 seconds" ); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5u); BOOST_TEST_MESSAGE( "Generating blocks until next maintenance interval" ); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); @@ -1044,9 +1044,9 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture ) BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 1); past_time = db.head_block_time().sec_since_epoch(); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 1); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 1u); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 2); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 2u); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture ) @@ -1122,7 +1122,7 @@ BOOST_FIXTURE_TEST_CASE( rsf_missed_blocks, database_fixture ) "1111111111111111111111111111111111111111111111111111111111111111" "1111111111111111111111111111111111111111111111111111111111111111" ); - BOOST_CHECK_EQUAL( db.witness_participation_rate(), GRAPHENE_100_PERCENT ); + BOOST_CHECK_EQUAL( db.witness_participation_rate(), (uint32_t)GRAPHENE_100_PERCENT ); generate_block( ~0, init_account_priv_key, 1 ); BOOST_CHECK_EQUAL( rsf(), @@ -1419,7 +1419,7 @@ BOOST_AUTO_TEST_CASE( genesis_reserve_ids ) BOOST_FIXTURE_TEST_CASE( miss_some_blocks, database_fixture ) { try { std::vector witnesses = witness_schedule_id_type()(db).current_shuffled_witnesses; - BOOST_CHECK_EQUAL( 10, witnesses.size() ); + BOOST_CHECK_EQUAL( 10u, witnesses.size() ); // database_fixture constructor calls generate_block once, signed by witnesses[0] generate_block(); // witnesses[1] generate_block(); // witnesses[2] @@ -1914,7 +1914,7 @@ BOOST_FIXTURE_TEST_CASE( block_size_test, database_fixture ) idump( (fc::raw::pack_size(good_block)) ); } // make sure we have tested at least once pushing a large block - BOOST_CHECK_GT( large_block_count, 0 ); + BOOST_CHECK_GT( large_block_count, 0u ); } catch( fc::exception& e ) { diff --git a/tests/tests/database_tests.cpp b/tests/tests/database_tests.cpp index 6158c2eb05..748fab041d 100644 --- a/tests/tests/database_tests.cpp +++ b/tests/tests/database_tests.cpp @@ -73,13 +73,13 @@ BOOST_AUTO_TEST_CASE(failed_modify_test) obj.owner = account_id_type(123); }); account_balance_id_type obj_id = obj.id; - BOOST_CHECK_EQUAL(obj.owner.instance.value, 123); + BOOST_CHECK_EQUAL(obj.owner.instance.value, 123u); // Modify dummy object, check that changes stick db.modify(obj, [](account_balance_object& obj) { obj.owner = account_id_type(234); }); - BOOST_CHECK_EQUAL(obj_id(db).owner.instance.value, 234); + BOOST_CHECK_EQUAL(obj_id(db).owner.instance.value, 234u); // Throw exception when modifying object, check that object still exists after BOOST_CHECK_THROW(db.modify(obj, [](account_balance_object& obj) { @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) graphene::db::primary_index< account_index, 8 > my_accounts( db ); const auto& direct = my_accounts.get_secondary_index>(); - BOOST_CHECK_EQUAL( 0, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 0u, my_accounts.indices().size() ); BOOST_CHECK( nullptr == direct.find( account_id_type( 1 ) ) ); // BOOST_CHECK_THROW( direct.find( asset_id_type( 1 ) ), fc::assert_exception ); // compile-time error BOOST_CHECK_THROW( direct.find( object_id_type( asset_id_type( 1 ) ) ), fc::assert_exception ); @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) my_accounts.load( fc::raw::pack( test_account ) ); - BOOST_CHECK_EQUAL( 1, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 1u, my_accounts.indices().size() ); BOOST_CHECK( nullptr == direct.find( account_id_type( 0 ) ) ); BOOST_CHECK( nullptr == direct.find( account_id_type( 2 ) ) ); BOOST_CHECK( nullptr != direct.find( account_id_type( 1 ) ) ); @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) // direct.next is now 103, but index sequence counter is 0 my_accounts.create( [] ( object& o ) { account_object& acct = dynamic_cast< account_object& >( o ); - BOOST_CHECK_EQUAL( 0, acct.id.instance() ); + BOOST_CHECK_EQUAL( 0u, acct.id.instance() ); acct.name = "account0"; } ); @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) GRAPHENE_REQUIRE_THROW( my_accounts.load( fc::raw::pack( test_account ) ), fc::assert_exception ); // This is actually undefined behaviour. The object has been inserted into // the primary index, but the secondary has refused to insert it! - BOOST_CHECK_EQUAL( 5, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 5u, my_accounts.indices().size() ); uint32_t count = 0; for( uint32_t i = 0; i < 250; i++ ) diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index 587814815c..a9b24d0ab3 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -437,11 +437,11 @@ BOOST_AUTO_TEST_CASE( cashback_test ) PREP_ACTOR(stud); PREP_ACTOR(pleb); // use ##_public_key vars to silence unused variable warning - BOOST_CHECK_GT(ann_public_key.key_data.size(), 0); - BOOST_CHECK_GT(scud_public_key.key_data.size(), 0); - BOOST_CHECK_GT(dumy_public_key.key_data.size(), 0); - BOOST_CHECK_GT(stud_public_key.key_data.size(), 0); - BOOST_CHECK_GT(pleb_public_key.key_data.size(), 0); + BOOST_CHECK_GT(ann_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(scud_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(dumy_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(stud_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(pleb_public_key.key_data.size(), 0u); account_id_type ann_id, scud_id, dumy_id, stud_id, pleb_id; actor_audit alife, arog, aann, ascud, adumy, astud, apleb; @@ -716,23 +716,23 @@ BOOST_AUTO_TEST_CASE( account_create_fee_scaling ) for( int i = db.get_dynamic_global_properties().accounts_registered_this_interval; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1u); create_account("shill" + fc::to_string(i)); } for( int i = 0; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 16); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 16u); create_account("moreshills" + fc::to_string(i)); } for( int i = 0; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 256); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 256u); create_account("moarshills" + fc::to_string(i)); } - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 4096); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 4096u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1u); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( fee_refund_test ) @@ -3651,31 +3651,31 @@ BOOST_AUTO_TEST_CASE( defaults_test ) // no fees set yet -> default asset fee = schedule.calculate_fee( limit_order_create_operation() ); - BOOST_CHECK_EQUAL( default_order_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)default_order_fee.fee, fee.amount.value ); limit_order_create_operation::fee_parameters_type new_order_fee; new_order_fee.fee = 123; // set fee + check schedule.parameters.insert( new_order_fee ); fee = schedule.calculate_fee( limit_order_create_operation() ); - BOOST_CHECK_EQUAL( new_order_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_order_fee.fee, fee.amount.value ); // bid_collateral fee defaults to call_order_update fee // call_order_update fee is unset -> default const call_order_update_operation::fee_parameters_type default_short_fee {}; call_order_update_operation::fee_parameters_type new_short_fee; new_short_fee.fee = 123; fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( default_short_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)default_short_fee.fee, fee.amount.value ); // set call_order_update fee + check bid_collateral fee schedule.parameters.insert( new_short_fee ); fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( new_short_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_short_fee.fee, fee.amount.value ); // set bid_collateral fee + check bid_collateral_operation::fee_parameters_type new_bid_fee; new_bid_fee.fee = 124; schedule.parameters.insert( new_bid_fee ); fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( new_bid_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_bid_fee.fee, fee.amount.value ); } catch( const fc::exception& e ) { diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 1255864c20..8f135d08f5 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -56,25 +56,25 @@ BOOST_AUTO_TEST_CASE(get_account_history) { //account_id_type() did 3 ops and includes id0 vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 7u); BOOST_CHECK_EQUAL(histories[2].op.which(), asset_create_op_id); // 1 account_create op larger than id1 histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK(histories[0].id.instance() != 0); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // Limit 2 returns 2 result histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 2, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 2); + BOOST_CHECK_EQUAL(histories.size(), 2u); BOOST_CHECK(histories[1].id.instance() != 0); BOOST_CHECK_EQUAL(histories[1].op.which(), account_create_op_id); // bob has 1 op histories = hist_api.get_account_history("bob", operation_history_id_type(), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); @@ -93,14 +93,14 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // no history at all in the chain vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); create_bitasset("USD", account_id_type()); // create op 0 generate_block(); // what if the account only has one history entry and it is 0? histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); const account_object& dan = create_account("dan"); // create op 1 @@ -114,262 +114,262 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // f(A, 0, 4, 9) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 6) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 5) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 4) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 4, 3) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 4, 2) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 4, 1) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 4, 0) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 1, 5, 9) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 6) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 5) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 4) = { 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // f(A, 1, 5, 3) = { 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // f(A, 1, 5, 2) = { } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 1, 5, 1) = { } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 1, 5, 0) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 0, 3, 9) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 6) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 5) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 4) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 3, 3) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 3, 2) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 3, 1) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 3, 0) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 9) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 0, 4, 6) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 0, 4, 5) = { 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 4) = { 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 3) = { 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); // f(B, 0, 4, 2) = { 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); // f(B, 0, 4, 1) = { 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); // f(B, 0, 4, 0) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 2, 4, 9) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // f(B, 2, 4, 6) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // f(B, 2, 4, 5) = { 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); // f(B, 2, 4, 4) = { 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); // f(B, 2, 4, 3) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 2) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 1) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 0) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // 0 limits histories = hist_api.get_account_history("dan", operation_history_id_type(0), 0, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(3), 0, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // non existent account histories = hist_api.get_account_history("1.2.18", operation_history_id_type(0), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // create a new account C = alice { 7 } create_account("alice"); @@ -378,21 +378,21 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // f(C, 0, 4, 10) = { 7 } histories = hist_api.get_account_history("alice", operation_history_id_type(0), 4, operation_history_id_type(10)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 7); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 7u); // f(C, 8, 4, 10) = { } histories = hist_api.get_account_history("alice", operation_history_id_type(8), 4, operation_history_id_type(10)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 0, 10, 0) = { 7, 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 5); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 7); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[4].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 5u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 7u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[4].id.instance(), 0u); } catch (fc::exception &e) { @@ -425,25 +425,25 @@ BOOST_AUTO_TEST_CASE(track_account) { // anything against account_id_type() should be {} vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // anything against alice should be {} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("alice", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("alice", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // dan should have history histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // create more ops, starting with an untracked account create_bitasset( "BTC", account_id_type() ); @@ -452,10 +452,10 @@ BOOST_AUTO_TEST_CASE(track_account) { generate_block( ~database::skip_fork_db ); histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); db.pop_block(); @@ -466,10 +466,10 @@ BOOST_AUTO_TEST_CASE(track_account) { generate_block(); histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); } catch (fc::exception &e) { edump((e.to_detail_string())); throw; @@ -499,35 +499,35 @@ BOOST_AUTO_TEST_CASE(track_account2) { // all account_id_type() should have 4 ops {4,2,1,0} vector histories = hist_api.get_account_history("committee-account", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // all alice account should have 2 ops {3, 0} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // alice first op should be {0} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 1, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); // alice second op should be {3} histories = hist_api.get_account_history("alice", operation_history_id_type(1), 1, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // anything against dan should be {} histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("dan", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("dan", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); } catch (fc::exception &e) { edump((e.to_detail_string())); @@ -552,27 +552,27 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { //account_id_type() did 1 asset_create op vector histories = hist_api.get_account_history_operations("committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); BOOST_CHECK_EQUAL(histories[0].op.which(), asset_create_op_id); //account_id_type() did 2 account_create ops histories = hist_api.get_account_history_operations("committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 2); + BOOST_CHECK_EQUAL(histories.size(), 2u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // No asset_create op larger than id1 histories = hist_api.get_account_history_operations("committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(1), 100); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // Limit 1 returns 1 result histories = hist_api.get_account_history_operations("committee-account", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 1); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // alice has 1 op histories = hist_api.get_account_history_operations("alice", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); } catch (fc::exception &e) { diff --git a/tests/tests/market_rounding_tests.cpp b/tests/tests/market_rounding_tests.cpp index 8c406f32e7..b71e1cd0ff 100644 --- a/tests/tests/market_rounding_tests.cpp +++ b/tests/tests/market_rounding_tests.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE( trade_amount_equals_zero ) fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread auto result = get_market_order_history(core_id, test_id); - BOOST_CHECK_EQUAL(result.size(), 4); + BOOST_CHECK_EQUAL(result.size(), 4u); BOOST_CHECK(result[0].op.pays == core_id(db).amount(0)); BOOST_CHECK(result[0].op.receives == test_id(db).amount(1)); BOOST_CHECK(result[1].op.pays == test_id(db).amount(1)); @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE( trade_amount_equals_zero_after_hf_184 ) fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread auto result = get_market_order_history(core_id, test_id); - BOOST_CHECK_EQUAL(result.size(), 2); + BOOST_CHECK_EQUAL(result.size(), 2u); BOOST_CHECK(result[0].op.pays == core_id(db).amount(1)); BOOST_CHECK(result[0].op.receives == test_id(db).amount(2)); BOOST_CHECK(result[1].op.pays == test_id(db).amount(2)); diff --git a/tests/tests/network_broadcast_api_tests.cpp b/tests/tests/network_broadcast_api_tests.cpp index 83d4c7fd1d..a566750b67 100644 --- a/tests/tests/network_broadcast_api_tests.cpp +++ b/tests/tests/network_broadcast_api_tests.cpp @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE( broadcast_transaction_with_callback_test ) { fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread - BOOST_CHECK_EQUAL( called, 1 ); + BOOST_CHECK_EQUAL( called, 1u ); } FC_LOG_AND_RETHROW() } diff --git a/tests/tests/operation_tests.cpp b/tests/tests/operation_tests.cpp index 398eb42b11..b2edab15ad 100644 --- a/tests/tests/operation_tests.cpp +++ b/tests/tests/operation_tests.cpp @@ -1731,7 +1731,7 @@ BOOST_AUTO_TEST_CASE( witness_feeds ) vector active_witnesses; for( const witness_id_type& wit_id : global_props.active_witnesses ) active_witnesses.push_back( wit_id(db).witness_account ); - BOOST_REQUIRE_EQUAL(active_witnesses.size(), 10); + BOOST_REQUIRE_EQUAL(active_witnesses.size(), 10u); asset_publish_feed_operation op; op.publisher = active_witnesses[0]; @@ -1828,7 +1828,7 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) const asset_object* core = &asset_id_type()(db); const account_object* nathan = &get_account("nathan"); enable_fees(); - BOOST_CHECK_GT(db.current_fee_schedule().get().membership_lifetime_fee, 0); + BOOST_CHECK_GT(db.current_fee_schedule().get().membership_lifetime_fee, 0u); // Based on the size of the reserve fund later in the test, the witness budget will be set to this value const uint64_t ref_budget = ((uint64_t( db.current_fee_schedule().get().membership_lifetime_fee ) @@ -1838,10 +1838,10 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) ) >> GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS ; // change this if ref_budget changes - BOOST_CHECK_EQUAL( ref_budget, 594 ); + BOOST_CHECK_EQUAL( ref_budget, 594u ); const uint64_t witness_ppb = ref_budget * 10 / 23 + 1; // change this if ref_budget changes - BOOST_CHECK_EQUAL( witness_ppb, 259 ); + BOOST_CHECK_EQUAL( witness_ppb, 259u ); // following two inequalities need to hold for maximal code coverage BOOST_CHECK_LT( witness_ppb * 2, ref_budget ); BOOST_CHECK_GT( witness_ppb * 3, ref_budget ); @@ -1887,28 +1887,28 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) generate_block(); BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, 0 ); } - BOOST_CHECK_EQUAL( db.head_block_time().sec_since_epoch() - pay_fee_time, 24 * block_interval ); + BOOST_CHECK_EQUAL( db.head_block_time().sec_since_epoch() - pay_fee_time, 24u * block_interval ); schedule_maint(); // The 80% lifetime referral fee went to the committee account, which burned it. Check that it's here. BOOST_CHECK( core->reserved(db).value == 8000*prec ); generate_block(); BOOST_CHECK_EQUAL( core->reserved(db).value, 999999406 ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)ref_budget ); // first witness paid from old budget (so no pay) BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, 0 ); // second witness finally gets paid! generate_block(); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget - witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)(ref_budget - witness_ppb) ); generate_block(); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget - 2 * witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)(ref_budget - 2 * witness_ppb) ); generate_block(); - BOOST_CHECK_LT( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, ref_budget - 2 * witness_ppb ); + BOOST_CHECK_LT( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)(ref_budget - 2 * witness_ppb) ); BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, 0 ); generate_block(); diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index 15df1b2ece..a5c7b839c9 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -968,7 +968,7 @@ BOOST_AUTO_TEST_CASE( mia_feeds ) } { const asset_bitasset_data_object& obj = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(obj.feeds.size(), 3); + BOOST_CHECK_EQUAL(obj.feeds.size(), 3u); BOOST_CHECK(obj.current_feed == price_feed()); } { @@ -1086,7 +1086,7 @@ BOOST_AUTO_TEST_CASE( witness_create ) witness_id_type nathan_witness_id = create_witness(nathan_id, nathan_private_key, skip).id; // nathan should be in the cache - BOOST_CHECK_EQUAL( caching_witnesses.count(nathan_witness_id), 1 ); + BOOST_CHECK_EQUAL( caching_witnesses.count(nathan_witness_id), 1u ); // nathan's key in the cache should still be null before a new block is generated auto nathan_itr = wit_key_cache.find( nathan_witness_id ); diff --git a/tests/tests/smartcoin_tests.cpp b/tests/tests/smartcoin_tests.cpp index ffa80f7551..9610e456ab 100644 --- a/tests/tests/smartcoin_tests.cpp +++ b/tests/tests/smartcoin_tests.cpp @@ -132,17 +132,17 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check current default witnesses, default chain is configured with 10 witnesses auto witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 10); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10); + BOOST_CHECK_EQUAL(witnesses.size(), 10u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10u); // We need to activate 11 witnesses by voting for each of them. // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -172,18 +172,18 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check my witnesses are now in control of the system witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 11); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 12); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 21); + BOOST_CHECK_EQUAL(witnesses.size(), 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 12u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 21u); // Adding 2 feeds with witnesses 0 and 1, checking if they get inserted const asset_object &core = asset_id_type()(db); @@ -192,18 +192,18 @@ BOOST_AUTO_TEST_CASE(bsip36) publish_feed(bit_usd_id(db), witness0_id(db), feed); asset_bitasset_data_object bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); feed.settlement_price = bit_usd_id(db).amount(2) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); // Activate witness11 with voting stake, will kick the witness with less votes(witness0) out of the active list transfer(committee_account, witness11_id, asset(121)); @@ -228,32 +228,32 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check active witness list now witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 12); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 12u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22u); // witness0 has been removed but it was a feeder before // Feed persist in the blockchain, this reproduces the issue bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Feed persist after expiration const auto feed_lifetime = bit_usd_id(db).bitasset_data(db).options.feed_lifetime_sec; generate_blocks(db.head_block_time() + feed_lifetime + 1); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Other witnesses add more feeds feed.settlement_price = bit_usd_id(db).amount(4) / core.amount(5); @@ -264,14 +264,14 @@ BOOST_AUTO_TEST_CASE(bsip36) // But the one from witness0 is never removed bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Feed from witness1 is also expired but never deleted // All feeds should be deleted at this point const auto minimum_feeds = bit_usd_id(db).bitasset_data(db).options.minimum_feeds; - BOOST_CHECK_EQUAL(minimum_feeds, 1); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); + BOOST_CHECK_EQUAL(minimum_feeds, 1u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); // Advancing into HF time generate_blocks(HARDFORK_CORE_518_TIME); @@ -281,15 +281,15 @@ BOOST_AUTO_TEST_CASE(bsip36) // All expired feeds are deleted bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); // witness1 start feed producing again feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // generate some blocks up to expiration but feed will not be deleted yet as need next maint time generate_blocks(itr[0].second.first + feed_lifetime + 1); @@ -298,10 +298,10 @@ BOOST_AUTO_TEST_CASE(bsip36) feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness2_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // make the first feed expire generate_blocks(itr[0].second.first + feed_lifetime + 1); @@ -309,23 +309,23 @@ BOOST_AUTO_TEST_CASE(bsip36) // feed from witness0 expires and gets deleted, feed from witness is on time so persist bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 18u); // expire everything generate_blocks(itr[0].second.first + feed_lifetime + 1); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); // add new feed with witness1 feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // Reactivate witness0 transfer(committee_account, witness0_id, asset(100)); @@ -350,29 +350,29 @@ BOOST_AUTO_TEST_CASE(bsip36) // Checking witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22u); // feed from witness1 is still here as the witness is no longer a producer but the feed is not yet expired - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // make feed from witness1 expire generate_blocks(itr[0].second.first + feed_lifetime + 1); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); } FC_LOG_AND_RETHROW() } @@ -418,11 +418,11 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Bitshares will create entries in the field feed after feed producers are added auto bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 18u); // Removing a feed producer { @@ -439,19 +439,19 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Feed for removed producer is removed bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // Feed persist after expiration const auto feed_lifetime = bit_usd_id(db).bitasset_data(db).options.feed_lifetime_sec; generate_blocks(db.head_block_time() + feed_lifetime + 1); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // Advancing into HF time generate_blocks(HARDFORK_CORE_518_TIME); @@ -462,9 +462,9 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Expired feeds persist, no changes bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); } FC_LOG_AND_RETHROW() } @@ -507,9 +507,9 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness5_id(db), feed); auto bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -517,10 +517,10 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness6_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -528,11 +528,11 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness7_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -540,12 +540,12 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness8_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -553,13 +553,13 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness9_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -567,27 +567,27 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness10_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 6); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 6u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[5].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[5].first.instance.value, 26u); // make the older feed expire generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 26u); // make older 2 feeds expire generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); @@ -596,41 +596,41 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // witness5 add new feed, feeds are sorted by witness_id not by feed_time feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness5_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 26u); // another feed expires generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // another feed expires generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // and so on diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index 5b9b5c3f20..8488e839fa 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -368,13 +368,13 @@ BOOST_AUTO_TEST_CASE( recollateralize ) graphene::app::database_api db_api(db); GRAPHENE_REQUIRE_THROW( db_api.get_collateral_bids(back().id, 100, 0), fc::assert_exception ); vector bids = db_api.get_collateral_bids(_swan, 100, 1); - BOOST_CHECK_EQUAL( 1, bids.size() ); + BOOST_CHECK_EQUAL( 1u, bids.size() ); FC_ASSERT( _borrower2 == bids[0].bidder ); bids = db_api.get_collateral_bids(_swan, 1, 0); - BOOST_CHECK_EQUAL( 1, bids.size() ); + BOOST_CHECK_EQUAL( 1u, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); bids = db_api.get_collateral_bids(_swan, 100, 0); - BOOST_CHECK_EQUAL( 2, bids.size() ); + BOOST_CHECK_EQUAL( 2u, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); FC_ASSERT( _borrower2 == bids[1].bidder ); diff --git a/tests/tests/voting_tests.cpp b/tests/tests/voting_tests.cpp index 141c19e0f3..df92ccf061 100644 --- a/tests/tests/voting_tests.cpp +++ b/tests/tests/voting_tests.cpp @@ -129,17 +129,17 @@ BOOST_AUTO_TEST_CASE(put_my_witnesses) // Check current default witnesses, default chain is configured with 10 witnesses auto witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 10); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10); + BOOST_CHECK_EQUAL(witnesses.size(), 10u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10u); // Activate all witnesses // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -168,18 +168,18 @@ BOOST_AUTO_TEST_CASE(put_my_witnesses) // Check my witnesses are now in control of the system witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 11); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 22); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 23); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 24); + BOOST_CHECK_EQUAL(witnesses.size(), 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 22u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 23u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 24u); } FC_LOG_AND_RETHROW() } @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(track_votes_witnesses_enabled) const account_id_type witness1_id= get_account("witness1").id; auto witness1_object = db_api1.get_witness_by_account(witness1_id(db).name); - BOOST_CHECK_EQUAL(witness1_object->total_votes, 111); + BOOST_CHECK_EQUAL(witness1_object->total_votes, 111u); } FC_LOG_AND_RETHROW() } @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(track_votes_witnesses_disabled) const account_id_type witness1_id= get_account("witness1").id; auto witness1_object = db_api1.get_witness_by_account(witness1_id(db).name); - BOOST_CHECK_EQUAL(witness1_object->total_votes, 0); + BOOST_CHECK_EQUAL(witness1_object->total_votes, 0u); } FC_LOG_AND_RETHROW() } @@ -306,17 +306,17 @@ BOOST_AUTO_TEST_CASE(put_my_committee_members) // Check current default witnesses, default chain is configured with 10 witnesses auto committee_members = db.get_global_properties().active_committee_members; - BOOST_CHECK_EQUAL(committee_members.size(), 10); - BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 0); - BOOST_CHECK_EQUAL(committee_members.begin()[1].instance.value, 1); - BOOST_CHECK_EQUAL(committee_members.begin()[2].instance.value, 2); - BOOST_CHECK_EQUAL(committee_members.begin()[3].instance.value, 3); - BOOST_CHECK_EQUAL(committee_members.begin()[4].instance.value, 4); - BOOST_CHECK_EQUAL(committee_members.begin()[5].instance.value, 5); - BOOST_CHECK_EQUAL(committee_members.begin()[6].instance.value, 6); - BOOST_CHECK_EQUAL(committee_members.begin()[7].instance.value, 7); - BOOST_CHECK_EQUAL(committee_members.begin()[8].instance.value, 8); - BOOST_CHECK_EQUAL(committee_members.begin()[9].instance.value, 9); + BOOST_CHECK_EQUAL(committee_members.size(), 10u); + BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 0u); + BOOST_CHECK_EQUAL(committee_members.begin()[1].instance.value, 1u); + BOOST_CHECK_EQUAL(committee_members.begin()[2].instance.value, 2u); + BOOST_CHECK_EQUAL(committee_members.begin()[3].instance.value, 3u); + BOOST_CHECK_EQUAL(committee_members.begin()[4].instance.value, 4u); + BOOST_CHECK_EQUAL(committee_members.begin()[5].instance.value, 5u); + BOOST_CHECK_EQUAL(committee_members.begin()[6].instance.value, 6u); + BOOST_CHECK_EQUAL(committee_members.begin()[7].instance.value, 7u); + BOOST_CHECK_EQUAL(committee_members.begin()[8].instance.value, 8u); + BOOST_CHECK_EQUAL(committee_members.begin()[9].instance.value, 9u); // Activate all committee // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -345,7 +345,7 @@ BOOST_AUTO_TEST_CASE(put_my_committee_members) // Check my witnesses are now in control of the system committee_members = db.get_global_properties().active_committee_members; - BOOST_CHECK_EQUAL(committee_members.size(), 11); + BOOST_CHECK_EQUAL(committee_members.size(), 11u); /* TODO we are not in full control, seems to committee members have votes by default BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 14); @@ -373,7 +373,7 @@ BOOST_AUTO_TEST_CASE(track_votes_committee_enabled) const account_id_type committee1_id= get_account("committee1").id; auto committee1_object = db_api1.get_committee_member_by_account(committee1_id(db).name); - BOOST_CHECK_EQUAL(committee1_object->total_votes, 111); + BOOST_CHECK_EQUAL(committee1_object->total_votes, 111u); } FC_LOG_AND_RETHROW() } @@ -388,7 +388,7 @@ BOOST_AUTO_TEST_CASE(track_votes_committee_disabled) const account_id_type committee1_id= get_account("committee1").id; auto committee1_object = db_api1.get_committee_member_by_account(committee1_id(db).name); - BOOST_CHECK_EQUAL(committee1_object->total_votes, 0); + BOOST_CHECK_EQUAL(committee1_object->total_votes, 0u); } FC_LOG_AND_RETHROW() } @@ -426,7 +426,7 @@ BOOST_AUTO_TEST_CASE(last_voting_date) auto witness1 = witness_id_type(1)(db); auto stats_obj = db.get_account_stats_by_owner(alice_id); - BOOST_CHECK_EQUAL(stats_obj.last_vote_time.sec_since_epoch(), 0); + BOOST_CHECK_EQUAL(stats_obj.last_vote_time.sec_since_epoch(), 0u); // alice votes graphene::chain::account_update_operation op; @@ -488,7 +488,6 @@ BOOST_AUTO_TEST_CASE(last_voting_date_proxy) PUSH_TX( db, trx, ~0 ); } // last_vote_time is not updated - auto round2 = db.head_block_time().sec_since_epoch(); alice_stats_obj = db.get_account_stats_by_owner(alice_id); BOOST_CHECK_EQUAL(alice_stats_obj.last_vote_time.sec_since_epoch(), round1); From bea4a5dbf4b2b9d45b5c0970bdec0a23f11165c4 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 15:04:48 -0500 Subject: [PATCH 033/108] revert accidental change --- tests/tests/history_api_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 8f135d08f5..fb397aa82b 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(get_account_history) { vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 100, operation_history_id_type()); BOOST_CHECK_EQUAL(histories.size(), 3u); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 7u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); BOOST_CHECK_EQUAL(histories[2].op.which(), asset_create_op_id); // 1 account_create op larger than id1 From 32847975eb326e46ea0bbaf809dbe6d4789b4308 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sun, 30 Dec 2018 10:10:44 +0100 Subject: [PATCH 034/108] Fixed linker error --- libraries/chain/db_management.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index 9167768f48..231cc3ebc9 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include From ebc860358a2a12a8163e71c93f75a029cb7496b4 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 31 Dec 2018 06:56:52 -0500 Subject: [PATCH 035/108] use find instead of try/catch --- libraries/app/api.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 877a49e788..61e9637a9f 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -370,18 +370,15 @@ namespace graphene { namespace app { if(node->operation_id(db).op.which() == operation_id) result.push_back( node->operation_id(db) ); - } + } if( node->next == account_transaction_history_id_type() ) node = nullptr; else node = &node->next(db); } if( stop.instance.value == 0 && result.size() < limit ) { - try - { - const account_transaction_history_object head = account_transaction_history_id_type()(db); - if( head.account == account && head.operation_id(db).op.which() == operation_id ) - result.push_back(head.operation_id(db)); - } catch (fc::exception& ignore) { /* limit of history reached, head not found */ } + auto head = db.find(account_transaction_history_id_type()); + if (head != nullptr && head->account == account && head->operation_id(db).op.which() == operation_id) + result.push_back(head->operation_id(db)); } return result; } From c6474f91458b74d48deb23080d6fa5a0d63f1ecd Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 1 Jan 2019 09:53:00 -0500 Subject: [PATCH 036/108] Do not subscribe to associated accounts --- libraries/app/database_api.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 5e53c74713..3afa4dc643 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -259,7 +259,7 @@ class database_api_impl : public std::enable_shared_from_this bool _notify_remove_create = false; mutable fc::bloom_filter _subscribe_filter; - mutable std::set _subscribed_accounts; + std::set _subscribed_accounts; std::function _subscribe_callback; std::function _pending_trx_callback; std::function _block_applied_callback; @@ -594,17 +594,6 @@ vector> database_api_impl::get_key_references( vector Date: Tue, 1 Jan 2019 10:28:19 -0500 Subject: [PATCH 037/108] Revert adding compile switches -Wno-??? --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b81422ae50..faf3a59f6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ else( WIN32 ) # Apple AND Linux else( APPLE ) # Linux Specific Options Here message( STATUS "Configuring BitShares on Linux" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall -Wno-class-memaccess -Wno-parentheses" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" ) if(USE_PROFILER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) endif( USE_PROFILER ) From 15882750e6396593bdf39ecd3bfb4600cab7c5d2 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 09:45:01 -0500 Subject: [PATCH 038/108] Reduce warning messages, constructor still throws --- libraries/db/include/graphene/db/undo_database.hpp | 12 +----------- libraries/db/undo_database.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index cf6f06247d..f2f77d607d 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -59,17 +59,7 @@ namespace graphene { namespace db { { mv._apply_undo = false; } - ~session() { - try { - if( _apply_undo ) _db.undo(); - } - catch ( const fc::exception& e ) - { - elog( "${e}", ("e",e.to_detail_string() ) ); - throw; // maybe crash.. - } - if( _disable_on_exit ) _db.disable(); - } + ~session(); // defined in implementation file to prevent repeated compiler warnings void commit() { _apply_undo = false; _db.commit(); } void undo() { if( _apply_undo ) _db.undo(); _apply_undo = false; } void merge() { if( _apply_undo ) _db.merge(); _apply_undo = false; } diff --git a/libraries/db/undo_database.cpp b/libraries/db/undo_database.cpp index c5f2ef65df..bb05f2a6eb 100644 --- a/libraries/db/undo_database.cpp +++ b/libraries/db/undo_database.cpp @@ -30,6 +30,19 @@ namespace graphene { namespace db { void undo_database::enable() { _disabled = false; } void undo_database::disable() { _disabled = true; } +undo_database::session::~session() +{ + try { + if( _apply_undo ) _db.undo(); + } + catch ( const fc::exception& e ) + { + elog( "${e}", ("e",e.to_detail_string() ) ); + throw; // maybe crash.. + } + if( _disable_on_exit ) _db.disable(); +} + undo_database::session undo_database::start_undo_session( bool force_enable ) { if( _disabled && !force_enable ) return session(*this); From c97988b39106dd16e11a0c45e00a0d092d77ab85 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 09:53:01 -0500 Subject: [PATCH 039/108] Squelch memaccess and parentheses warnings --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faf3a59f6d..b81422ae50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ else( WIN32 ) # Apple AND Linux else( APPLE ) # Linux Specific Options Here message( STATUS "Configuring BitShares on Linux" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall -Wno-class-memaccess -Wno-parentheses" ) if(USE_PROFILER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) endif( USE_PROFILER ) From 52b0fe3c45d1156b6b11b0dfa450f670214fd4c6 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 11:01:28 -0500 Subject: [PATCH 040/108] fixed comparison warnings --- tests/app/main.cpp | 26 +- tests/cli/main.cpp | 2 +- tests/tests/asset_api_tests.cpp | 2 +- tests/tests/authority_tests.cpp | 4 +- tests/tests/block_tests.cpp | 20 +- tests/tests/database_tests.cpp | 12 +- tests/tests/fee_tests.cpp | 30 +- tests/tests/history_api_tests.cpp | 376 ++++++++++---------- tests/tests/market_rounding_tests.cpp | 4 +- tests/tests/network_broadcast_api_tests.cpp | 2 +- tests/tests/operation_tests.cpp | 24 +- tests/tests/operation_tests2.cpp | 4 +- tests/tests/smartcoin_tests.cpp | 268 +++++++------- tests/tests/swan_tests.cpp | 6 +- tests/tests/voting_tests.cpp | 81 +++-- 15 files changed, 430 insertions(+), 431 deletions(-) diff --git a/tests/app/main.cpp b/tests/app/main.cpp index b68cdf78a0..26e494d10d 100644 --- a/tests/app/main.cpp +++ b/tests/app/main.cpp @@ -78,8 +78,8 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_logging_files_create /// check post-conditions BOOST_CHECK(fc::exists(config_ini_file)); BOOST_CHECK(fc::exists(logging_ini_file)); - BOOST_CHECK_GT(fc::file_size(config_ini_file), 0); - BOOST_CHECK_GT(fc::file_size(logging_ini_file), 0); + BOOST_CHECK_GT(fc::file_size(config_ini_file), 0u); + BOOST_CHECK_GT(fc::file_size(logging_ini_file), 0u); } BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_ini_options) @@ -109,8 +109,8 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_config_ini_options) /// check the options values are parsed into the output map BOOST_CHECK(!options.empty()); - BOOST_CHECK_EQUAL(options.count("option1"), 1); - BOOST_CHECK_EQUAL(options.count("option2"), 1); + BOOST_CHECK_EQUAL(options.count("option1"), 1u); + BOOST_CHECK_EQUAL(options.count("option2"), 1u); BOOST_CHECK_EQUAL(options["option1"].as(), "is present"); BOOST_CHECK_EQUAL(options["option2"].as(), 1); @@ -151,9 +151,9 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_logging_ini_options) /// this is a little bit tricky since load_configuration_options() doesn't provide output variable for logging_config auto logger_map = fc::get_logger_map(); auto appender_map = fc::get_appender_map(); - BOOST_CHECK_EQUAL(logger_map.size(), 1); + BOOST_CHECK_EQUAL(logger_map.size(), 1u); BOOST_CHECK(logger_map.count("default")); - BOOST_CHECK_EQUAL(appender_map.size(), 1); + BOOST_CHECK_EQUAL(appender_map.size(), 1u); BOOST_CHECK(appender_map.count("default")); } @@ -195,16 +195,16 @@ BOOST_AUTO_TEST_CASE(load_configuration_options_test_legacy_config_ini_options) /// check the options values are parsed into the output map BOOST_CHECK(!options.empty()); - BOOST_CHECK_EQUAL(options.count("option1"), 1); - BOOST_CHECK_EQUAL(options.count("option2"), 1); + BOOST_CHECK_EQUAL(options.count("option1"), 1u); + BOOST_CHECK_EQUAL(options.count("option2"), 1u); BOOST_CHECK_EQUAL(options["option1"].as(), "is present"); BOOST_CHECK_EQUAL(options["option2"].as(), 1); auto logger_map = fc::get_logger_map(); auto appender_map = fc::get_appender_map(); - BOOST_CHECK_EQUAL(logger_map.size(), 1); + BOOST_CHECK_EQUAL(logger_map.size(), 1u); BOOST_CHECK(logger_map.count("default")); - BOOST_CHECK_EQUAL(appender_map.size(), 1); + BOOST_CHECK_EQUAL(appender_map.size(), 1u); BOOST_CHECK(appender_map.count("default")); } @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE( two_node_network ) app2.startup(); fc::usleep(fc::milliseconds(500)); - BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1); + BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1u); BOOST_CHECK_EQUAL(std::string(app1.p2p_node()->get_connected_peers().front().host.get_address()), "127.0.0.1"); BOOST_TEST_MESSAGE( "app1 and app2 successfully connected" ); @@ -321,8 +321,8 @@ BOOST_AUTO_TEST_CASE( two_node_network ) fc::usleep(fc::milliseconds(500)); BOOST_TEST_MESSAGE( "Verifying nodes are still connected" ); - BOOST_CHECK_EQUAL(app1.p2p_node()->get_connection_count(), 1); - BOOST_CHECK_EQUAL(app1.chain_database()->head_block_num(), 1); + BOOST_CHECK_EQUAL(app1.p2p_node()->get_connection_count(), 1u); + BOOST_CHECK_EQUAL(app1.chain_database()->head_block_num(), 1u); BOOST_TEST_MESSAGE( "Checking GRAPHENE_NULL_ACCOUNT has balance" ); } catch( fc::exception& e ) { diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 393dce4d83..4ef2552073 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -549,7 +549,7 @@ BOOST_FIXTURE_TEST_CASE( account_history_pagination, cli_fixture ) // 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); - BOOST_CHECK_EQUAL(201, history.size() ); + BOOST_CHECK_EQUAL(201u, history.size() ); std::set operation_ids; diff --git a/tests/tests/asset_api_tests.cpp b/tests/tests/asset_api_tests.cpp index aaa517a962..332f1b13b4 100644 --- a/tests/tests/asset_api_tests.cpp +++ b/tests/tests/asset_api_tests.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE( asset_holders ) // make call vector holders = asset_api.get_asset_holders(asset_id_type(), 0, 100); - BOOST_CHECK_EQUAL(holders.size(), 4); + BOOST_CHECK_EQUAL(holders.size(), 4u); // by now we can guarantee the order BOOST_CHECK(holders[0].name == "committee-account"); diff --git a/tests/tests/authority_tests.cpp b/tests/tests/authority_tests.cpp index cf9df59142..bb32f806e9 100644 --- a/tests/tests/authority_tests.cpp +++ b/tests/tests/authority_tests.cpp @@ -1734,7 +1734,7 @@ BOOST_AUTO_TEST_CASE( self_approving_proposal ) trx.operations.push_back(pop); const proposal_id_type pid1 = PUSH_TX( db, trx, ~0 ).operation_results[0].get(); trx.clear(); - BOOST_REQUIRE_EQUAL( 0, pid1.instance.value ); + BOOST_REQUIRE_EQUAL( 0u, pid1.instance.value ); db.get(pid1); trx.operations.push_back(pup); @@ -1765,7 +1765,7 @@ BOOST_AUTO_TEST_CASE( self_deleting_proposal ) trx.operations.push_back( pop ); const proposal_id_type pid1 = PUSH_TX( db, trx, ~0 ).operation_results[0].get(); trx.clear(); - BOOST_REQUIRE_EQUAL( 0, pid1.instance.value ); + BOOST_REQUIRE_EQUAL( 0u, pid1.instance.value ); db.get(pid1); proposal_update_operation pup; diff --git a/tests/tests/block_tests.cpp b/tests/tests/block_tests.cpp index 76d9c0b75c..2c7eec7d05 100644 --- a/tests/tests/block_tests.cpp +++ b/tests/tests/block_tests.cpp @@ -847,7 +847,7 @@ BOOST_FIXTURE_TEST_CASE( maintenance_interval, database_fixture ) { try { generate_block(); - BOOST_CHECK_EQUAL(db.head_block_num(), 2); + BOOST_CHECK_EQUAL(db.head_block_num(), 2u); fc::time_point_sec maintenence_time = db.get_dynamic_global_properties().next_maintenance_time; BOOST_CHECK_GT(maintenence_time.sec_since_epoch(), db.head_block_time().sec_since_epoch()); @@ -1024,17 +1024,17 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture ) } BOOST_TEST_MESSAGE( "Verifying that the interval didn't change immediately" ); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5u); auto past_time = db.head_block_time().sec_since_epoch(); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 5); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 5u); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 10); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 10u); BOOST_TEST_MESSAGE( "Generating blocks until proposal expires" ); generate_blocks(proposal_id_type()(db).expiration_time + 5); BOOST_TEST_MESSAGE( "Verify that the block interval is still 5 seconds" ); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 5u); BOOST_TEST_MESSAGE( "Generating blocks until next maintenance interval" ); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); @@ -1044,9 +1044,9 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture ) BOOST_CHECK_EQUAL(db.get_global_properties().parameters.block_interval, 1); past_time = db.head_block_time().sec_since_epoch(); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 1); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 1u); generate_block(); - BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 2); + BOOST_CHECK_EQUAL(db.head_block_time().sec_since_epoch() - past_time, 2u); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture ) @@ -1122,7 +1122,7 @@ BOOST_FIXTURE_TEST_CASE( rsf_missed_blocks, database_fixture ) "1111111111111111111111111111111111111111111111111111111111111111" "1111111111111111111111111111111111111111111111111111111111111111" ); - BOOST_CHECK_EQUAL( db.witness_participation_rate(), GRAPHENE_100_PERCENT ); + BOOST_CHECK_EQUAL( db.witness_participation_rate(), (uint32_t)GRAPHENE_100_PERCENT ); generate_block( ~0, init_account_priv_key, 1 ); BOOST_CHECK_EQUAL( rsf(), @@ -1419,7 +1419,7 @@ BOOST_AUTO_TEST_CASE( genesis_reserve_ids ) BOOST_FIXTURE_TEST_CASE( miss_some_blocks, database_fixture ) { try { std::vector witnesses = witness_schedule_id_type()(db).current_shuffled_witnesses; - BOOST_CHECK_EQUAL( 10, witnesses.size() ); + BOOST_CHECK_EQUAL( 10u, witnesses.size() ); // database_fixture constructor calls generate_block once, signed by witnesses[0] generate_block(); // witnesses[1] generate_block(); // witnesses[2] @@ -1914,7 +1914,7 @@ BOOST_FIXTURE_TEST_CASE( block_size_test, database_fixture ) idump( (fc::raw::pack_size(good_block)) ); } // make sure we have tested at least once pushing a large block - BOOST_CHECK_GT( large_block_count, 0 ); + BOOST_CHECK_GT( large_block_count, 0u ); } catch( fc::exception& e ) { diff --git a/tests/tests/database_tests.cpp b/tests/tests/database_tests.cpp index 6158c2eb05..748fab041d 100644 --- a/tests/tests/database_tests.cpp +++ b/tests/tests/database_tests.cpp @@ -73,13 +73,13 @@ BOOST_AUTO_TEST_CASE(failed_modify_test) obj.owner = account_id_type(123); }); account_balance_id_type obj_id = obj.id; - BOOST_CHECK_EQUAL(obj.owner.instance.value, 123); + BOOST_CHECK_EQUAL(obj.owner.instance.value, 123u); // Modify dummy object, check that changes stick db.modify(obj, [](account_balance_object& obj) { obj.owner = account_id_type(234); }); - BOOST_CHECK_EQUAL(obj_id(db).owner.instance.value, 234); + BOOST_CHECK_EQUAL(obj_id(db).owner.instance.value, 234u); // Throw exception when modifying object, check that object still exists after BOOST_CHECK_THROW(db.modify(obj, [](account_balance_object& obj) { @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) graphene::db::primary_index< account_index, 8 > my_accounts( db ); const auto& direct = my_accounts.get_secondary_index>(); - BOOST_CHECK_EQUAL( 0, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 0u, my_accounts.indices().size() ); BOOST_CHECK( nullptr == direct.find( account_id_type( 1 ) ) ); // BOOST_CHECK_THROW( direct.find( asset_id_type( 1 ) ), fc::assert_exception ); // compile-time error BOOST_CHECK_THROW( direct.find( object_id_type( asset_id_type( 1 ) ) ), fc::assert_exception ); @@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) my_accounts.load( fc::raw::pack( test_account ) ); - BOOST_CHECK_EQUAL( 1, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 1u, my_accounts.indices().size() ); BOOST_CHECK( nullptr == direct.find( account_id_type( 0 ) ) ); BOOST_CHECK( nullptr == direct.find( account_id_type( 2 ) ) ); BOOST_CHECK( nullptr != direct.find( account_id_type( 1 ) ) ); @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) // direct.next is now 103, but index sequence counter is 0 my_accounts.create( [] ( object& o ) { account_object& acct = dynamic_cast< account_object& >( o ); - BOOST_CHECK_EQUAL( 0, acct.id.instance() ); + BOOST_CHECK_EQUAL( 0u, acct.id.instance() ); acct.name = "account0"; } ); @@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE( direct_index_test ) GRAPHENE_REQUIRE_THROW( my_accounts.load( fc::raw::pack( test_account ) ), fc::assert_exception ); // This is actually undefined behaviour. The object has been inserted into // the primary index, but the secondary has refused to insert it! - BOOST_CHECK_EQUAL( 5, my_accounts.indices().size() ); + BOOST_CHECK_EQUAL( 5u, my_accounts.indices().size() ); uint32_t count = 0; for( uint32_t i = 0; i < 250; i++ ) diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index 587814815c..a9b24d0ab3 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -437,11 +437,11 @@ BOOST_AUTO_TEST_CASE( cashback_test ) PREP_ACTOR(stud); PREP_ACTOR(pleb); // use ##_public_key vars to silence unused variable warning - BOOST_CHECK_GT(ann_public_key.key_data.size(), 0); - BOOST_CHECK_GT(scud_public_key.key_data.size(), 0); - BOOST_CHECK_GT(dumy_public_key.key_data.size(), 0); - BOOST_CHECK_GT(stud_public_key.key_data.size(), 0); - BOOST_CHECK_GT(pleb_public_key.key_data.size(), 0); + BOOST_CHECK_GT(ann_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(scud_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(dumy_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(stud_public_key.key_data.size(), 0u); + BOOST_CHECK_GT(pleb_public_key.key_data.size(), 0u); account_id_type ann_id, scud_id, dumy_id, stud_id, pleb_id; actor_audit alife, arog, aann, ascud, adumy, astud, apleb; @@ -716,23 +716,23 @@ BOOST_AUTO_TEST_CASE( account_create_fee_scaling ) for( int i = db.get_dynamic_global_properties().accounts_registered_this_interval; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1u); create_account("shill" + fc::to_string(i)); } for( int i = 0; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 16); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 16u); create_account("moreshills" + fc::to_string(i)); } for( int i = 0; i < accounts_per_scale; ++i ) { - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 256); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 256u); create_account("moarshills" + fc::to_string(i)); } - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 4096); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 4096u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); - BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1); + BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees->get().basic_fee, 1u); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( fee_refund_test ) @@ -3651,31 +3651,31 @@ BOOST_AUTO_TEST_CASE( defaults_test ) // no fees set yet -> default asset fee = schedule.calculate_fee( limit_order_create_operation() ); - BOOST_CHECK_EQUAL( default_order_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)default_order_fee.fee, fee.amount.value ); limit_order_create_operation::fee_parameters_type new_order_fee; new_order_fee.fee = 123; // set fee + check schedule.parameters.insert( new_order_fee ); fee = schedule.calculate_fee( limit_order_create_operation() ); - BOOST_CHECK_EQUAL( new_order_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_order_fee.fee, fee.amount.value ); // bid_collateral fee defaults to call_order_update fee // call_order_update fee is unset -> default const call_order_update_operation::fee_parameters_type default_short_fee {}; call_order_update_operation::fee_parameters_type new_short_fee; new_short_fee.fee = 123; fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( default_short_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)default_short_fee.fee, fee.amount.value ); // set call_order_update fee + check bid_collateral fee schedule.parameters.insert( new_short_fee ); fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( new_short_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_short_fee.fee, fee.amount.value ); // set bid_collateral fee + check bid_collateral_operation::fee_parameters_type new_bid_fee; new_bid_fee.fee = 124; schedule.parameters.insert( new_bid_fee ); fee = schedule.calculate_fee( bid_collateral_operation() ); - BOOST_CHECK_EQUAL( new_bid_fee.fee, fee.amount.value ); + BOOST_CHECK_EQUAL( (int64_t)new_bid_fee.fee, fee.amount.value ); } catch( const fc::exception& e ) { diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index b8f8856384..495a26aa06 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -56,25 +56,25 @@ BOOST_AUTO_TEST_CASE(get_account_history) { //account_id_type() did 3 ops and includes id0 vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 7u); BOOST_CHECK_EQUAL(histories[2].op.which(), asset_create_op_id); // 1 account_create op larger than id1 histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK(histories[0].id.instance() != 0); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // Limit 2 returns 2 result histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 2, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 2); + BOOST_CHECK_EQUAL(histories.size(), 2u); BOOST_CHECK(histories[1].id.instance() != 0); BOOST_CHECK_EQUAL(histories[1].op.which(), account_create_op_id); // bob has 1 op histories = hist_api.get_account_history("bob", operation_history_id_type(), 100, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); @@ -93,14 +93,14 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // no history at all in the chain vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); create_bitasset("USD", account_id_type()); // create op 0 generate_block(); // what if the account only has one history entry and it is 0? histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); const account_object& dan = create_account("dan"); // create op 1 @@ -114,262 +114,262 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // f(A, 0, 4, 9) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 6) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 5) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 0, 4, 4) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 4, 3) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 4, 2) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 4, 1) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 4, 0) = { 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // f(A, 1, 5, 9) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 6) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 5) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 1, 5, 4) = { 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // f(A, 1, 5, 3) = { 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // f(A, 1, 5, 2) = { } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 1, 5, 1) = { } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 1, 5, 0) = { 5, 3 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 5, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // f(A, 0, 3, 9) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 6) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 5) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(A, 0, 3, 4) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 3, 3) = { 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); // f(A, 0, 3, 2) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 3, 1) = { 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // f(A, 0, 3, 0) = { 5, 3, 1 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 3, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 9) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 0, 4, 6) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 0, 4, 5) = { 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 4) = { 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); // f(B, 0, 4, 3) = { 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); // f(B, 0, 4, 2) = { 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 1u); // f(B, 0, 4, 1) = { 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 1u); // f(B, 0, 4, 0) = { 6, 4, 2, 1 } histories = hist_api.get_account_history("dan", operation_history_id_type(), 4, operation_history_id_type()); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); // f(B, 2, 4, 9) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // f(B, 2, 4, 6) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(6)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // f(B, 2, 4, 5) = { 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(5)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); // f(B, 2, 4, 4) = { 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(4)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); // f(B, 2, 4, 3) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(3)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 2) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 1) = { } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(B, 2, 4, 0) = { 6, 4 } histories = hist_api.get_account_history("dan", operation_history_id_type(2), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); // 0 limits histories = hist_api.get_account_history("dan", operation_history_id_type(0), 0, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(3), 0, operation_history_id_type(9)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // non existent account histories = hist_api.get_account_history("1.2.18", operation_history_id_type(0), 4, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // create a new account C = alice { 7 } create_account("alice"); @@ -378,21 +378,21 @@ BOOST_AUTO_TEST_CASE(get_account_history_additional) { // f(C, 0, 4, 10) = { 7 } histories = hist_api.get_account_history("alice", operation_history_id_type(0), 4, operation_history_id_type(10)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 7); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 7u); // f(C, 8, 4, 10) = { } histories = hist_api.get_account_history("alice", operation_history_id_type(8), 4, operation_history_id_type(10)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // f(A, 0, 10, 0) = { 7, 5, 3, 1, 0 } histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 5); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 7); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 5); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[4].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 5u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 7u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 5u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[4].id.instance(), 0u); } catch (fc::exception &e) { @@ -425,25 +425,25 @@ BOOST_AUTO_TEST_CASE(track_account) { // anything against account_id_type() should be {} vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("1.2.0", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // anything against alice should be {} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("alice", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("alice", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // dan should have history histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 3u); // create more ops, starting with an untracked account create_bitasset( "BTC", account_id_type() ); @@ -452,10 +452,10 @@ BOOST_AUTO_TEST_CASE(track_account) { generate_block( ~database::skip_fork_db ); histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); db.pop_block(); @@ -466,10 +466,10 @@ BOOST_AUTO_TEST_CASE(track_account) { generate_block(); histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 3); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 6); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 3u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 6u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 3u); } catch (fc::exception &e) { edump((e.to_detail_string())); throw; @@ -499,35 +499,35 @@ BOOST_AUTO_TEST_CASE(track_account2) { // all account_id_type() should have 4 ops {4,2,1,0} vector histories = hist_api.get_account_history("committee-account", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 4); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 4); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 2); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 1); - BOOST_CHECK_EQUAL(histories[3].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 4u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 4u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 2u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 1u); + BOOST_CHECK_EQUAL(histories[3].id.instance(), 0u); // all alice account should have 2 ops {3, 0} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 2); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); - BOOST_CHECK_EQUAL(histories[1].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 2u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); + BOOST_CHECK_EQUAL(histories[1].id.instance(), 0u); // alice first op should be {0} histories = hist_api.get_account_history("alice", operation_history_id_type(0), 1, operation_history_id_type(1)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); // alice second op should be {3} histories = hist_api.get_account_history("alice", operation_history_id_type(1), 1, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 3); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 3u); // anything against dan should be {} histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("dan", operation_history_id_type(1), 10, operation_history_id_type(0)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); histories = hist_api.get_account_history("dan", operation_history_id_type(1), 1, operation_history_id_type(2)); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); } catch (fc::exception &e) { edump((e.to_detail_string())); @@ -554,31 +554,31 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { //account_id_type() did 1 asset_create op vector histories = hist_api.get_account_history_operations( "committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 1); - BOOST_CHECK_EQUAL(histories[0].id.instance(), 0); + BOOST_CHECK_EQUAL(histories.size(), 1u); + BOOST_CHECK_EQUAL(histories[0].id.instance(), 0u); BOOST_CHECK_EQUAL(histories[0].op.which(), asset_create_op_id); //account_id_type() did 2 account_create ops histories = hist_api.get_account_history_operations( "committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 2); + BOOST_CHECK_EQUAL(histories.size(), 2u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // No asset_create op larger than id1 histories = hist_api.get_account_history_operations( "committee-account", asset_create_op_id, operation_history_id_type(), operation_history_id_type(1), 100); - BOOST_CHECK_EQUAL(histories.size(), 0); + BOOST_CHECK_EQUAL(histories.size(), 0u); // Limit 1 returns 1 result histories = hist_api.get_account_history_operations( "committee-account", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 1); - BOOST_CHECK_EQUAL(histories.size(), 1); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // alice has 1 op histories = hist_api.get_account_history_operations( - "alice", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 1); + "alice", account_create_op_id, operation_history_id_type(),operation_history_id_type(), 100); + BOOST_CHECK_EQUAL(histories.size(), 1u); BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); // create a bunch of accounts diff --git a/tests/tests/market_rounding_tests.cpp b/tests/tests/market_rounding_tests.cpp index 8c406f32e7..b71e1cd0ff 100644 --- a/tests/tests/market_rounding_tests.cpp +++ b/tests/tests/market_rounding_tests.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE( trade_amount_equals_zero ) fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread auto result = get_market_order_history(core_id, test_id); - BOOST_CHECK_EQUAL(result.size(), 4); + BOOST_CHECK_EQUAL(result.size(), 4u); BOOST_CHECK(result[0].op.pays == core_id(db).amount(0)); BOOST_CHECK(result[0].op.receives == test_id(db).amount(1)); BOOST_CHECK(result[1].op.pays == test_id(db).amount(1)); @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE( trade_amount_equals_zero_after_hf_184 ) fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread auto result = get_market_order_history(core_id, test_id); - BOOST_CHECK_EQUAL(result.size(), 2); + BOOST_CHECK_EQUAL(result.size(), 2u); BOOST_CHECK(result[0].op.pays == core_id(db).amount(1)); BOOST_CHECK(result[0].op.receives == test_id(db).amount(2)); BOOST_CHECK(result[1].op.pays == test_id(db).amount(2)); diff --git a/tests/tests/network_broadcast_api_tests.cpp b/tests/tests/network_broadcast_api_tests.cpp index 83d4c7fd1d..a566750b67 100644 --- a/tests/tests/network_broadcast_api_tests.cpp +++ b/tests/tests/network_broadcast_api_tests.cpp @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE( broadcast_transaction_with_callback_test ) { fc::usleep(fc::milliseconds(200)); // sleep a while to execute callback in another thread - BOOST_CHECK_EQUAL( called, 1 ); + BOOST_CHECK_EQUAL( called, 1u ); } FC_LOG_AND_RETHROW() } diff --git a/tests/tests/operation_tests.cpp b/tests/tests/operation_tests.cpp index 398eb42b11..b2edab15ad 100644 --- a/tests/tests/operation_tests.cpp +++ b/tests/tests/operation_tests.cpp @@ -1731,7 +1731,7 @@ BOOST_AUTO_TEST_CASE( witness_feeds ) vector active_witnesses; for( const witness_id_type& wit_id : global_props.active_witnesses ) active_witnesses.push_back( wit_id(db).witness_account ); - BOOST_REQUIRE_EQUAL(active_witnesses.size(), 10); + BOOST_REQUIRE_EQUAL(active_witnesses.size(), 10u); asset_publish_feed_operation op; op.publisher = active_witnesses[0]; @@ -1828,7 +1828,7 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) const asset_object* core = &asset_id_type()(db); const account_object* nathan = &get_account("nathan"); enable_fees(); - BOOST_CHECK_GT(db.current_fee_schedule().get().membership_lifetime_fee, 0); + BOOST_CHECK_GT(db.current_fee_schedule().get().membership_lifetime_fee, 0u); // Based on the size of the reserve fund later in the test, the witness budget will be set to this value const uint64_t ref_budget = ((uint64_t( db.current_fee_schedule().get().membership_lifetime_fee ) @@ -1838,10 +1838,10 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) ) >> GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS ; // change this if ref_budget changes - BOOST_CHECK_EQUAL( ref_budget, 594 ); + BOOST_CHECK_EQUAL( ref_budget, 594u ); const uint64_t witness_ppb = ref_budget * 10 / 23 + 1; // change this if ref_budget changes - BOOST_CHECK_EQUAL( witness_ppb, 259 ); + BOOST_CHECK_EQUAL( witness_ppb, 259u ); // following two inequalities need to hold for maximal code coverage BOOST_CHECK_LT( witness_ppb * 2, ref_budget ); BOOST_CHECK_GT( witness_ppb * 3, ref_budget ); @@ -1887,28 +1887,28 @@ BOOST_AUTO_TEST_CASE( witness_pay_test ) generate_block(); BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, 0 ); } - BOOST_CHECK_EQUAL( db.head_block_time().sec_since_epoch() - pay_fee_time, 24 * block_interval ); + BOOST_CHECK_EQUAL( db.head_block_time().sec_since_epoch() - pay_fee_time, 24u * block_interval ); schedule_maint(); // The 80% lifetime referral fee went to the committee account, which burned it. Check that it's here. BOOST_CHECK( core->reserved(db).value == 8000*prec ); generate_block(); BOOST_CHECK_EQUAL( core->reserved(db).value, 999999406 ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)ref_budget ); // first witness paid from old budget (so no pay) BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, 0 ); // second witness finally gets paid! generate_block(); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget - witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)(ref_budget - witness_ppb) ); generate_block(); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget - 2 * witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, (int64_t)(ref_budget - 2 * witness_ppb) ); generate_block(); - BOOST_CHECK_LT( last_witness_vbo_balance().value, witness_ppb ); - BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, ref_budget - 2 * witness_ppb ); + BOOST_CHECK_LT( last_witness_vbo_balance().value, (int64_t)witness_ppb ); + BOOST_CHECK_EQUAL( last_witness_vbo_balance().value, (int64_t)(ref_budget - 2 * witness_ppb) ); BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, 0 ); generate_block(); diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index 15df1b2ece..a5c7b839c9 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -968,7 +968,7 @@ BOOST_AUTO_TEST_CASE( mia_feeds ) } { const asset_bitasset_data_object& obj = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(obj.feeds.size(), 3); + BOOST_CHECK_EQUAL(obj.feeds.size(), 3u); BOOST_CHECK(obj.current_feed == price_feed()); } { @@ -1086,7 +1086,7 @@ BOOST_AUTO_TEST_CASE( witness_create ) witness_id_type nathan_witness_id = create_witness(nathan_id, nathan_private_key, skip).id; // nathan should be in the cache - BOOST_CHECK_EQUAL( caching_witnesses.count(nathan_witness_id), 1 ); + BOOST_CHECK_EQUAL( caching_witnesses.count(nathan_witness_id), 1u ); // nathan's key in the cache should still be null before a new block is generated auto nathan_itr = wit_key_cache.find( nathan_witness_id ); diff --git a/tests/tests/smartcoin_tests.cpp b/tests/tests/smartcoin_tests.cpp index ffa80f7551..9610e456ab 100644 --- a/tests/tests/smartcoin_tests.cpp +++ b/tests/tests/smartcoin_tests.cpp @@ -132,17 +132,17 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check current default witnesses, default chain is configured with 10 witnesses auto witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 10); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10); + BOOST_CHECK_EQUAL(witnesses.size(), 10u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10u); // We need to activate 11 witnesses by voting for each of them. // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -172,18 +172,18 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check my witnesses are now in control of the system witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 11); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 12); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 21); + BOOST_CHECK_EQUAL(witnesses.size(), 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 12u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 21u); // Adding 2 feeds with witnesses 0 and 1, checking if they get inserted const asset_object &core = asset_id_type()(db); @@ -192,18 +192,18 @@ BOOST_AUTO_TEST_CASE(bsip36) publish_feed(bit_usd_id(db), witness0_id(db), feed); asset_bitasset_data_object bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); feed.settlement_price = bit_usd_id(db).amount(2) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); // Activate witness11 with voting stake, will kick the witness with less votes(witness0) out of the active list transfer(committee_account, witness11_id, asset(121)); @@ -228,32 +228,32 @@ BOOST_AUTO_TEST_CASE(bsip36) // Check active witness list now witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 12); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 12u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22u); // witness0 has been removed but it was a feeder before // Feed persist in the blockchain, this reproduces the issue bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Feed persist after expiration const auto feed_lifetime = bit_usd_id(db).bitasset_data(db).options.feed_lifetime_sec; generate_blocks(db.head_block_time() + feed_lifetime + 1); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Other witnesses add more feeds feed.settlement_price = bit_usd_id(db).amount(4) / core.amount(5); @@ -264,14 +264,14 @@ BOOST_AUTO_TEST_CASE(bsip36) // But the one from witness0 is never removed bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); // Feed from witness1 is also expired but never deleted // All feeds should be deleted at this point const auto minimum_feeds = bit_usd_id(db).bitasset_data(db).options.minimum_feeds; - BOOST_CHECK_EQUAL(minimum_feeds, 1); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); + BOOST_CHECK_EQUAL(minimum_feeds, 1u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); // Advancing into HF time generate_blocks(HARDFORK_CORE_518_TIME); @@ -281,15 +281,15 @@ BOOST_AUTO_TEST_CASE(bsip36) // All expired feeds are deleted bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); // witness1 start feed producing again feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // generate some blocks up to expiration but feed will not be deleted yet as need next maint time generate_blocks(itr[0].second.first + feed_lifetime + 1); @@ -298,10 +298,10 @@ BOOST_AUTO_TEST_CASE(bsip36) feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness2_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // make the first feed expire generate_blocks(itr[0].second.first + feed_lifetime + 1); @@ -309,23 +309,23 @@ BOOST_AUTO_TEST_CASE(bsip36) // feed from witness0 expires and gets deleted, feed from witness is on time so persist bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 18u); // expire everything generate_blocks(itr[0].second.first + feed_lifetime + 1); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); // add new feed with witness1 feed.settlement_price = bit_usd_id(db).amount(1) / core.amount(5); publish_feed(bit_usd_id(db), witness1_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // Reactivate witness0 transfer(committee_account, witness0_id, asset(100)); @@ -350,29 +350,29 @@ BOOST_AUTO_TEST_CASE(bsip36) // Checking witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 13u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 22u); // feed from witness1 is still here as the witness is no longer a producer but the feed is not yet expired - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); // make feed from witness1 expire generate_blocks(itr[0].second.first + feed_lifetime + 1); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 0u); } FC_LOG_AND_RETHROW() } @@ -418,11 +418,11 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Bitshares will create entries in the field feed after feed producers are added auto bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 16u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 18u); // Removing a feed producer { @@ -439,19 +439,19 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Feed for removed producer is removed bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // Feed persist after expiration const auto feed_lifetime = bit_usd_id(db).bitasset_data(db).options.feed_lifetime_sec; generate_blocks(db.head_block_time() + feed_lifetime + 1); bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); // Advancing into HF time generate_blocks(HARDFORK_CORE_518_TIME); @@ -462,9 +462,9 @@ BOOST_AUTO_TEST_CASE(bsip36_update_feed_producers) // Expired feeds persist, no changes bitasset_data = bit_usd_id(db).bitasset_data(db); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 17u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 18u); } FC_LOG_AND_RETHROW() } @@ -507,9 +507,9 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness5_id(db), feed); auto bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 1u); auto itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -517,10 +517,10 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness6_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -528,11 +528,11 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness7_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -540,12 +540,12 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness8_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -553,13 +553,13 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness9_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25u); generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); @@ -567,27 +567,27 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness10_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 6); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 6u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[5].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[5].first.instance.value, 26u); // make the older feed expire generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 5u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 22); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 23); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[4].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 22u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 23u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[4].first.instance.value, 26u); // make older 2 feeds expire generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); @@ -596,41 +596,41 @@ BOOST_AUTO_TEST_CASE(bsip36_additional) generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // witness5 add new feed, feeds are sorted by witness_id not by feed_time feed.settlement_price = bit_usd_id(db).amount(1) / core_id(db).amount(5); publish_feed(bit_usd_id(db), witness5_id(db), feed); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 4u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 24); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[3].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 24u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[3].first.instance.value, 26u); // another feed expires generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 3u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[1].first.instance.value, 25u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // another feed expires generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); bitasset_data = bit_usd_id(db).bitasset_data(db); - BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2); + BOOST_CHECK_EQUAL(bitasset_data.feeds.size(), 2u); itr = bitasset_data.feeds.begin(); - BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21); - BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26); + BOOST_CHECK_EQUAL(itr[0].first.instance.value, 21u); + BOOST_CHECK_EQUAL(itr[2].first.instance.value, 26u); // and so on diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index 5b9b5c3f20..8488e839fa 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -368,13 +368,13 @@ BOOST_AUTO_TEST_CASE( recollateralize ) graphene::app::database_api db_api(db); GRAPHENE_REQUIRE_THROW( db_api.get_collateral_bids(back().id, 100, 0), fc::assert_exception ); vector bids = db_api.get_collateral_bids(_swan, 100, 1); - BOOST_CHECK_EQUAL( 1, bids.size() ); + BOOST_CHECK_EQUAL( 1u, bids.size() ); FC_ASSERT( _borrower2 == bids[0].bidder ); bids = db_api.get_collateral_bids(_swan, 1, 0); - BOOST_CHECK_EQUAL( 1, bids.size() ); + BOOST_CHECK_EQUAL( 1u, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); bids = db_api.get_collateral_bids(_swan, 100, 0); - BOOST_CHECK_EQUAL( 2, bids.size() ); + BOOST_CHECK_EQUAL( 2u, bids.size() ); FC_ASSERT( _borrower == bids[0].bidder ); FC_ASSERT( _borrower2 == bids[1].bidder ); diff --git a/tests/tests/voting_tests.cpp b/tests/tests/voting_tests.cpp index 141c19e0f3..df92ccf061 100644 --- a/tests/tests/voting_tests.cpp +++ b/tests/tests/voting_tests.cpp @@ -129,17 +129,17 @@ BOOST_AUTO_TEST_CASE(put_my_witnesses) // Check current default witnesses, default chain is configured with 10 witnesses auto witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 10); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10); + BOOST_CHECK_EQUAL(witnesses.size(), 10u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 1u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 2u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 3u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 4u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 5u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 6u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 7u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 8u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 9u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 10u); // Activate all witnesses // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -168,18 +168,18 @@ BOOST_AUTO_TEST_CASE(put_my_witnesses) // Check my witnesses are now in control of the system witnesses = db.get_global_properties().active_witnesses; - BOOST_CHECK_EQUAL(witnesses.size(), 11); - BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 14); - BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 15); - BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 16); - BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 17); - BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 18); - BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 19); - BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 20); - BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 21); - BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 22); - BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 23); - BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 24); + BOOST_CHECK_EQUAL(witnesses.size(), 11u); + BOOST_CHECK_EQUAL(witnesses.begin()[0].instance.value, 14u); + BOOST_CHECK_EQUAL(witnesses.begin()[1].instance.value, 15u); + BOOST_CHECK_EQUAL(witnesses.begin()[2].instance.value, 16u); + BOOST_CHECK_EQUAL(witnesses.begin()[3].instance.value, 17u); + BOOST_CHECK_EQUAL(witnesses.begin()[4].instance.value, 18u); + BOOST_CHECK_EQUAL(witnesses.begin()[5].instance.value, 19u); + BOOST_CHECK_EQUAL(witnesses.begin()[6].instance.value, 20u); + BOOST_CHECK_EQUAL(witnesses.begin()[7].instance.value, 21u); + BOOST_CHECK_EQUAL(witnesses.begin()[8].instance.value, 22u); + BOOST_CHECK_EQUAL(witnesses.begin()[9].instance.value, 23u); + BOOST_CHECK_EQUAL(witnesses.begin()[10].instance.value, 24u); } FC_LOG_AND_RETHROW() } @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(track_votes_witnesses_enabled) const account_id_type witness1_id= get_account("witness1").id; auto witness1_object = db_api1.get_witness_by_account(witness1_id(db).name); - BOOST_CHECK_EQUAL(witness1_object->total_votes, 111); + BOOST_CHECK_EQUAL(witness1_object->total_votes, 111u); } FC_LOG_AND_RETHROW() } @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(track_votes_witnesses_disabled) const account_id_type witness1_id= get_account("witness1").id; auto witness1_object = db_api1.get_witness_by_account(witness1_id(db).name); - BOOST_CHECK_EQUAL(witness1_object->total_votes, 0); + BOOST_CHECK_EQUAL(witness1_object->total_votes, 0u); } FC_LOG_AND_RETHROW() } @@ -306,17 +306,17 @@ BOOST_AUTO_TEST_CASE(put_my_committee_members) // Check current default witnesses, default chain is configured with 10 witnesses auto committee_members = db.get_global_properties().active_committee_members; - BOOST_CHECK_EQUAL(committee_members.size(), 10); - BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 0); - BOOST_CHECK_EQUAL(committee_members.begin()[1].instance.value, 1); - BOOST_CHECK_EQUAL(committee_members.begin()[2].instance.value, 2); - BOOST_CHECK_EQUAL(committee_members.begin()[3].instance.value, 3); - BOOST_CHECK_EQUAL(committee_members.begin()[4].instance.value, 4); - BOOST_CHECK_EQUAL(committee_members.begin()[5].instance.value, 5); - BOOST_CHECK_EQUAL(committee_members.begin()[6].instance.value, 6); - BOOST_CHECK_EQUAL(committee_members.begin()[7].instance.value, 7); - BOOST_CHECK_EQUAL(committee_members.begin()[8].instance.value, 8); - BOOST_CHECK_EQUAL(committee_members.begin()[9].instance.value, 9); + BOOST_CHECK_EQUAL(committee_members.size(), 10u); + BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 0u); + BOOST_CHECK_EQUAL(committee_members.begin()[1].instance.value, 1u); + BOOST_CHECK_EQUAL(committee_members.begin()[2].instance.value, 2u); + BOOST_CHECK_EQUAL(committee_members.begin()[3].instance.value, 3u); + BOOST_CHECK_EQUAL(committee_members.begin()[4].instance.value, 4u); + BOOST_CHECK_EQUAL(committee_members.begin()[5].instance.value, 5u); + BOOST_CHECK_EQUAL(committee_members.begin()[6].instance.value, 6u); + BOOST_CHECK_EQUAL(committee_members.begin()[7].instance.value, 7u); + BOOST_CHECK_EQUAL(committee_members.begin()[8].instance.value, 8u); + BOOST_CHECK_EQUAL(committee_members.begin()[9].instance.value, 9u); // Activate all committee // Each witness is voted with incremental stake so last witness created will be the ones with more votes @@ -345,7 +345,7 @@ BOOST_AUTO_TEST_CASE(put_my_committee_members) // Check my witnesses are now in control of the system committee_members = db.get_global_properties().active_committee_members; - BOOST_CHECK_EQUAL(committee_members.size(), 11); + BOOST_CHECK_EQUAL(committee_members.size(), 11u); /* TODO we are not in full control, seems to committee members have votes by default BOOST_CHECK_EQUAL(committee_members.begin()[0].instance.value, 14); @@ -373,7 +373,7 @@ BOOST_AUTO_TEST_CASE(track_votes_committee_enabled) const account_id_type committee1_id= get_account("committee1").id; auto committee1_object = db_api1.get_committee_member_by_account(committee1_id(db).name); - BOOST_CHECK_EQUAL(committee1_object->total_votes, 111); + BOOST_CHECK_EQUAL(committee1_object->total_votes, 111u); } FC_LOG_AND_RETHROW() } @@ -388,7 +388,7 @@ BOOST_AUTO_TEST_CASE(track_votes_committee_disabled) const account_id_type committee1_id= get_account("committee1").id; auto committee1_object = db_api1.get_committee_member_by_account(committee1_id(db).name); - BOOST_CHECK_EQUAL(committee1_object->total_votes, 0); + BOOST_CHECK_EQUAL(committee1_object->total_votes, 0u); } FC_LOG_AND_RETHROW() } @@ -426,7 +426,7 @@ BOOST_AUTO_TEST_CASE(last_voting_date) auto witness1 = witness_id_type(1)(db); auto stats_obj = db.get_account_stats_by_owner(alice_id); - BOOST_CHECK_EQUAL(stats_obj.last_vote_time.sec_since_epoch(), 0); + BOOST_CHECK_EQUAL(stats_obj.last_vote_time.sec_since_epoch(), 0u); // alice votes graphene::chain::account_update_operation op; @@ -488,7 +488,6 @@ BOOST_AUTO_TEST_CASE(last_voting_date_proxy) PUSH_TX( db, trx, ~0 ); } // last_vote_time is not updated - auto round2 = db.head_block_time().sec_since_epoch(); alice_stats_obj = db.get_account_stats_by_owner(alice_id); BOOST_CHECK_EQUAL(alice_stats_obj.last_vote_time.sec_since_epoch(), round1); From 33d6d99bb50beb23ebb9a29870c659c8a6d4ff77 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 28 Dec 2018 15:04:48 -0500 Subject: [PATCH 041/108] revert accidental change --- tests/tests/history_api_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 495a26aa06..48e4833da2 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(get_account_history) { vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(), 100, operation_history_id_type()); BOOST_CHECK_EQUAL(histories.size(), 3u); - BOOST_CHECK_EQUAL(histories[2].id.instance(), 7u); + BOOST_CHECK_EQUAL(histories[2].id.instance(), 0u); BOOST_CHECK_EQUAL(histories[2].op.which(), asset_create_op_id); // 1 account_create op larger than id1 From d3c2b57338d169ea68920a135ebb57dc79637099 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 1 Jan 2019 10:28:19 -0500 Subject: [PATCH 042/108] Revert adding compile switches -Wno-??? --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b81422ae50..faf3a59f6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ else( WIN32 ) # Apple AND Linux else( APPLE ) # Linux Specific Options Here message( STATUS "Configuring BitShares on Linux" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall -Wno-class-memaccess -Wno-parentheses" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" ) if(USE_PROFILER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) endif( USE_PROFILER ) From a97880500ea41415b285e61ac2a98781466515ca Mon Sep 17 00:00:00 2001 From: John Jones Date: Wed, 2 Jan 2019 09:57:09 -0500 Subject: [PATCH 043/108] prevent throw in destructor --- libraries/db/undo_database.cpp | 2 +- tests/common/database_fixture.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libraries/db/undo_database.cpp b/libraries/db/undo_database.cpp index bb05f2a6eb..3e340728e3 100644 --- a/libraries/db/undo_database.cpp +++ b/libraries/db/undo_database.cpp @@ -38,7 +38,7 @@ undo_database::session::~session() catch ( const fc::exception& e ) { elog( "${e}", ("e",e.to_detail_string() ) ); - throw; // maybe crash.. + std::terminate(); } if( _disable_on_exit ) _db.disable(); } diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index a77854cd22..1f08d0ef25 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -208,16 +208,20 @@ database_fixture::database_fixture() } database_fixture::~database_fixture() -{ try { - // If we're unwinding due to an exception, don't do any more checks. - // This way, boost test's last checkpoint tells us approximately where the error was. - if( !std::uncaught_exception() ) - { - verify_asset_supplies(db); - BOOST_CHECK( db.get_node_properties().skip_flags == database::skip_nothing ); +{ + try { + // If we're unwinding due to an exception, don't do any more checks. + // This way, boost test's last checkpoint tells us approximately where the error was. + if( !std::uncaught_exception() ) + { + verify_asset_supplies(db); + BOOST_CHECK( db.get_node_properties().skip_flags == database::skip_nothing ); + } + return; + } catch (fc::exception& ex) { + BOOST_FAIL( ex.to_detail_string() ); } - return; -} FC_CAPTURE_AND_RETHROW() } +} fc::ecc::private_key database_fixture::generate_private_key(string seed) { From 14f71f23becb4933bc1761930c45d69e2d2b4d3d Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 4 Jan 2019 08:18:06 -0500 Subject: [PATCH 044/108] removed boost signals (no longer used) --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faf3a59f6d..948d7412cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,6 @@ LIST(APPEND BOOST_COMPONENTS thread system filesystem program_options - signals serialization chrono unit_test_framework From e338fdbd5773e07ef817bf530e60bde1acb52eb0 Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Mon, 7 Jan 2019 10:47:53 -0500 Subject: [PATCH 045/108] refactor template instantiation --- libraries/chain/db_management.cpp | 1 - libraries/chain/fork_database.cpp | 2 -- libraries/chain/protocol/fee_schedule.cpp | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index 231cc3ebc9..9167768f48 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index 71da27629b..c77b7ee58e 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -24,8 +24,6 @@ #include #include -#include - namespace graphene { namespace chain { fork_database::fork_database() { diff --git a/libraries/chain/protocol/fee_schedule.cpp b/libraries/chain/protocol/fee_schedule.cpp index 911f7ac924..d71c58a0aa 100644 --- a/libraries/chain/protocol/fee_schedule.cpp +++ b/libraries/chain/protocol/fee_schedule.cpp @@ -33,6 +33,7 @@ namespace fc //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; + template smart_ref::smart_ref(smart_ref const&); } #define MAX_FEE_STABILIZATION_ITERATION 4 From 07bedf78f5f62ae6fea84eb6757f41b978eac8dd Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Mon, 7 Jan 2019 12:05:45 -0500 Subject: [PATCH 046/108] switch variable from size_t to uint64_t --- libraries/db/include/graphene/db/index.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/index.hpp b/libraries/db/include/graphene/db/index.hpp index 4b54862899..2ba0c76a3c 100644 --- a/libraries/db/include/graphene/db/index.hpp +++ b/libraries/db/include/graphene/db/index.hpp @@ -210,7 +210,7 @@ namespace graphene { namespace db { // private static const size_t MAX_HOLE = 100; static const size_t _mask = ((1 << chunkbits) - 1); - size_t next = 0; + uint64_t next = 0; vector< vector< const Object* > > content; std::stack< object_id_type > ids_being_modified; From 53feeff43874a85bddb052f5d32befe9700002ae Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 7 Jan 2019 13:58:55 -0500 Subject: [PATCH 047/108] Reject get_key_references with > 100 keys --- libraries/app/database_api.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 3afa4dc643..28182fd08d 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -539,6 +539,7 @@ dynamic_global_property_object database_api_impl::get_dynamic_global_properties( vector> database_api::get_key_references( vector key )const { + FC_ASSERT(key.size() <= 100, "Number of keys must be 100 or less"); return my->get_key_references( key ); } From 87dcfa1658e79aaa8fbfe1a0fa604d02a65bf3b6 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 7 Jan 2019 14:32:50 -0500 Subject: [PATCH 048/108] Remove use of skip_fork_db flag --- libraries/chain/db_block.cpp | 134 +++++++++--------- .../chain/include/graphene/chain/database.hpp | 1 - tests/tests/history_api_tests.cpp | 4 +- 3 files changed, 66 insertions(+), 73 deletions(-) diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index fdf4b4a15e..6571586445 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -129,77 +129,74 @@ bool database::push_block(const signed_block& new_block, uint32_t skip) bool database::_push_block(const signed_block& new_block) { try { uint32_t skip = get_node_properties().skip_flags; - if( !(skip&skip_fork_db) ) - { - /// TODO: if the block is greater than the head block and before the next maitenance interval - // verify that the block signer is in the current set of active witnesses. + /// TODO: if the block is greater than the head block and before the next maitenance interval + // verify that the block signer is in the current set of active witnesses. - shared_ptr new_head = _fork_db.push_block(new_block); - //If the head block from the longest chain does not build off of the current head, we need to switch forks. - if( new_head->data.previous != head_block_id() ) + shared_ptr new_head = _fork_db.push_block(new_block); + //If the head block from the longest chain does not build off of the current head, we need to switch forks. + if( new_head->data.previous != head_block_id() ) + { + //If the newly pushed block is the same height as head, we get head back in new_head + //Only switch forks if new_head is actually higher than head + if( new_head->data.block_num() > head_block_num() ) { - //If the newly pushed block is the same height as head, we get head back in new_head - //Only switch forks if new_head is actually higher than head - if( new_head->data.block_num() > head_block_num() ) + wlog( "Switching to fork: ${id}", ("id",new_head->data.id()) ); + auto branches = _fork_db.fetch_branch_from(new_head->data.id(), head_block_id()); + + // pop blocks until we hit the forked block + while( head_block_id() != branches.second.back()->data.previous ) + { + ilog( "popping block #${n} ${id}", ("n",head_block_num())("id",head_block_id()) ); + pop_block(); + } + + // push all blocks on the new fork + for( auto ritr = branches.first.rbegin(); ritr != branches.first.rend(); ++ritr ) { - wlog( "Switching to fork: ${id}", ("id",new_head->data.id()) ); - auto branches = _fork_db.fetch_branch_from(new_head->data.id(), head_block_id()); - - // pop blocks until we hit the forked block - while( head_block_id() != branches.second.back()->data.previous ) - { - ilog( "popping block #${n} ${id}", ("n",head_block_num())("id",head_block_id()) ); - pop_block(); - } - - // push all blocks on the new fork - for( auto ritr = branches.first.rbegin(); ritr != branches.first.rend(); ++ritr ) - { - ilog( "pushing block from fork #${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); - optional except; - try { - undo_database::session session = _undo_db.start_undo_session(); - apply_block( (*ritr)->data, skip ); - _block_id_to_block.store( (*ritr)->id, (*ritr)->data ); - session.commit(); - } - catch ( const fc::exception& e ) { except = e; } - if( except ) - { - wlog( "exception thrown while switching forks ${e}", ("e",except->to_detail_string() ) ); - // remove the rest of branches.first from the fork_db, those blocks are invalid - while( ritr != branches.first.rend() ) - { - ilog( "removing block from fork_db #${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); - _fork_db.remove( (*ritr)->id ); - ++ritr; - } - _fork_db.set_head( branches.second.front() ); - - // pop all blocks from the bad fork - while( head_block_id() != branches.second.back()->data.previous ) - { - ilog( "popping block #${n} ${id}", ("n",head_block_num())("id",head_block_id()) ); - pop_block(); - } - - ilog( "Switching back to fork: ${id}", ("id",branches.second.front()->data.id()) ); - // restore all blocks from the good fork - for( auto ritr2 = branches.second.rbegin(); ritr2 != branches.second.rend(); ++ritr2 ) - { - ilog( "pushing block #${n} ${id}", ("n",(*ritr2)->data.block_num())("id",(*ritr2)->id) ); - auto session = _undo_db.start_undo_session(); - apply_block( (*ritr2)->data, skip ); - _block_id_to_block.store( (*ritr2)->id, (*ritr2)->data ); - session.commit(); - } - throw *except; - } - } - return true; + ilog( "pushing block from fork #${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); + optional except; + try { + undo_database::session session = _undo_db.start_undo_session(); + apply_block( (*ritr)->data, skip ); + _block_id_to_block.store( (*ritr)->id, (*ritr)->data ); + session.commit(); + } + catch ( const fc::exception& e ) { except = e; } + if( except ) + { + wlog( "exception thrown while switching forks ${e}", ("e",except->to_detail_string() ) ); + // remove the rest of branches.first from the fork_db, those blocks are invalid + while( ritr != branches.first.rend() ) + { + ilog( "removing block from fork_db #${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); + _fork_db.remove( (*ritr)->id ); + ++ritr; + } + _fork_db.set_head( branches.second.front() ); + + // pop all blocks from the bad fork + while( head_block_id() != branches.second.back()->data.previous ) + { + ilog( "popping block #${n} ${id}", ("n",head_block_num())("id",head_block_id()) ); + pop_block(); + } + + ilog( "Switching back to fork: ${id}", ("id",branches.second.front()->data.id()) ); + // restore all blocks from the good fork + for( auto ritr2 = branches.second.rbegin(); ritr2 != branches.second.rend(); ++ritr2 ) + { + ilog( "pushing block #${n} ${id}", ("n",(*ritr2)->data.block_num())("id",(*ritr2)->id) ); + auto session = _undo_db.start_undo_session(); + apply_block( (*ritr2)->data, skip ); + _block_id_to_block.store( (*ritr2)->id, (*ritr2)->data ); + session.commit(); + } + throw *except; + } } - else return false; + return true; } + else return false; } try { @@ -209,10 +206,7 @@ bool database::_push_block(const signed_block& new_block) session.commit(); } catch ( const fc::exception& e ) { elog("Failed to push new block:\n${e}", ("e", e.to_detail_string())); - if( !(skip&skip_fork_db) ) - { - _fork_db.remove( new_block.id() ); - } + _fork_db.remove( new_block.id() ); throw; } diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 84e4ad4190..7fa190cb66 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -66,7 +66,6 @@ namespace graphene { namespace chain { skip_witness_signature = 1 << 0, ///< used while reindexing skip_transaction_signatures = 1 << 1, ///< used by non-witness nodes skip_transaction_dupe_check = 1 << 2, ///< used while reindexing - skip_fork_db = 1 << 3, ///< used while reindexing skip_block_size_check = 1 << 4, ///< used when applying locally generated transactions skip_tapos_check = 1 << 5, ///< used while reindexing -- note this skips expiration check as well // skip_authority_check = 1 << 6, ///< removed because effectively identical to skip_transaction_signatures diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index b8f8856384..8a21d37aee 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -421,7 +421,7 @@ BOOST_AUTO_TEST_CASE(track_account) { // dan makes 1 op create_bitasset("EUR", dan_id); - generate_block( ~database::skip_fork_db ); + generate_block(); // anything against account_id_type() should be {} vector histories = hist_api.get_account_history("1.2.0", operation_history_id_type(0), 10, operation_history_id_type(0)); @@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE(track_account) { create_bitasset( "BTC", account_id_type() ); create_bitasset( "GBP", dan_id ); - generate_block( ~database::skip_fork_db ); + generate_block(); histories = hist_api.get_account_history("dan", operation_history_id_type(0), 10, operation_history_id_type(0)); BOOST_CHECK_EQUAL(histories.size(), 3); From 7fa01fbf0d8d9b3582981208c085d973e1f2a179 Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Mon, 7 Jan 2019 12:05:45 -0500 Subject: [PATCH 049/108] change seq. counter 'next' used by db indexes to uint64_t --- libraries/db/include/graphene/db/index.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/index.hpp b/libraries/db/include/graphene/db/index.hpp index 4b54862899..2ba0c76a3c 100644 --- a/libraries/db/include/graphene/db/index.hpp +++ b/libraries/db/include/graphene/db/index.hpp @@ -210,7 +210,7 @@ namespace graphene { namespace db { // private static const size_t MAX_HOLE = 100; static const size_t _mask = ((1 << chunkbits) - 1); - size_t next = 0; + uint64_t next = 0; vector< vector< const Object* > > content; std::stack< object_id_type > ids_being_modified; From 0e6b07e0707a6afa9fbf3327d9d8534cd61e6c80 Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Tue, 8 Jan 2019 10:39:02 -0500 Subject: [PATCH 050/108] added template specialization for mac release builds --- libraries/chain/protocol/fee_schedule.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/libraries/chain/protocol/fee_schedule.cpp b/libraries/chain/protocol/fee_schedule.cpp index d71c58a0aa..649f90dff4 100644 --- a/libraries/chain/protocol/fee_schedule.cpp +++ b/libraries/chain/protocol/fee_schedule.cpp @@ -27,23 +27,20 @@ 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; - template smart_ref::smart_ref(smart_ref const&); + // these are required on certain platforms in Release mode + template<> + bool smart_ref::operator !()const + { + throw std::logic_error("Not Implemented"); + } + + template class smart_ref; } #define MAX_FEE_STABILIZATION_ITERATION 4 namespace graphene { namespace chain { - typedef fc::smart_ref smart_fee_schedule; - - static smart_fee_schedule tmp; - fee_schedule::fee_schedule() { } From b4bd649268402de7b8cf8d94f386d42685c4ea4b Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 8 Jan 2019 17:05:53 -0500 Subject: [PATCH 051/108] Make sure price_to_string works and throws as it should --- tests/tests/app_util_tests.cpp | 54 +++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/tests/tests/app_util_tests.cpp b/tests/tests/app_util_tests.cpp index 9b913fd7cd..71e750cc0a 100644 --- a/tests/tests/app_util_tests.cpp +++ b/tests/tests/app_util_tests.cpp @@ -214,30 +214,36 @@ BOOST_AUTO_TEST_CASE(price_to_string_test) { GRAPHENE_REQUIRE_THROW( price_to_string( p[i][j], 0, 20 ), fc::exception ); } try { - idump( (i) (j) (p[i][j]) ); - idump( - (price_to_string(p[i][j],0,0)) - (price_to_string(p[i][j],0,1)) - (price_to_string(p[i][j],0,2)) - (price_to_string(p[i][j],0,8)) - (price_to_string(p[i][j],0,19)) - (price_to_string(p[i][j],1,0)) - (price_to_string(p[i][j],1,15)) - (price_to_string(p[i][j],2,6)) - (price_to_string(p[i][j],2,10)) - (price_to_string(p[i][j],5,0)) - (price_to_string(p[i][j],9,1)) - (price_to_string(p[i][j],9,9)) - (price_to_string(p[i][j],9,19)) - (price_to_string(p[i][j],18,10)) - (price_to_string(p[i][j],18,13)) - (price_to_string(p[i][j],18,19)) - (price_to_string(p[i][j],19,0)) - (price_to_string(p[i][j],19,7)) - (price_to_string(p[i][j],19,19)) - (price_diff_percent_string(p[i][j],p[j][i])) - ); - } catch(...) {} + price pr = p[i][j]; + idump( (i) (j) (pr) ); + if ( pr.base.amount == 0 || (pr.base.amount > 0 && pr.quote.amount >= 0 ) ) + { + idump( (price_to_string( pr ,0,0)) ); + idump( (price_to_string( pr ,0,1)) ); + idump( (price_to_string( pr ,0,2)) ); + idump( (price_to_string( pr ,0,8)) ); + idump( (price_to_string( pr ,0,19)) ); + idump( (price_to_string( pr ,1,0)) ); + idump( (price_to_string( pr ,1,15)) ); + idump( (price_to_string( pr ,2,6)) ); + idump( (price_to_string( pr ,2,10)) ); + idump( (price_to_string( pr ,5,0)) ); + idump( (price_to_string( pr ,9,1)) ); + idump( (price_to_string( pr ,9,9)) ); + idump( (price_to_string( pr ,9,19)) ); + idump( (price_to_string( pr ,18,10)) ); + idump( (price_to_string( pr ,18,13)) ); + idump( (price_to_string( pr ,18,19)) ); + idump( (price_to_string( pr ,19,0)) ); + idump( (price_to_string( pr ,19,7)) ); + idump( (price_to_string( pr ,19,19)) ); + idump( (price_diff_percent_string( pr ,p[j][i])) ); + } else { + GRAPHENE_REQUIRE_THROW( price_to_string( pr, 0, 0 ), fc::exception ); + } + } catch(...) { + BOOST_FAIL( "Failure to log price_to_string" ); + } } } From 834e47635d441464043a1abb3dc464ae2c0e0fb4 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 11 Jan 2019 10:20:14 -0500 Subject: [PATCH 052/108] Separate throws from edge cases that should work --- tests/tests/app_util_tests.cpp | 79 +++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/tests/tests/app_util_tests.cpp b/tests/tests/app_util_tests.cpp index 71e750cc0a..b85c9a3e8d 100644 --- a/tests/tests/app_util_tests.cpp +++ b/tests/tests/app_util_tests.cpp @@ -32,7 +32,7 @@ using namespace graphene::chain; using namespace graphene::chain::test; using namespace graphene::app; -BOOST_FIXTURE_TEST_SUITE(app_util_tests, database_fixture) +BOOST_AUTO_TEST_SUITE(app_util_tests) BOOST_AUTO_TEST_CASE(uint128_amount_to_string_test) { @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(uint128_amount_to_string_test) { } -BOOST_AUTO_TEST_CASE(price_to_string_test) { +BOOST_AUTO_TEST_CASE(price_to_string_throws) { int64_t m = std::numeric_limits::max(); int64_t n = -1; @@ -194,8 +194,10 @@ BOOST_AUTO_TEST_CASE(price_to_string_test) { p[i][j] = price( asset( a[i] ), asset( a[j] ) ); for( int i = 0; i < 11; ++i ) + { for( int j = 0; j < 11; ++j ) { + price pr = p[i][j]; if( i == 0 ) { GRAPHENE_REQUIRE_THROW( price_to_string( p[i][j], 0, 0 ), fc::exception ); @@ -214,38 +216,65 @@ BOOST_AUTO_TEST_CASE(price_to_string_test) { GRAPHENE_REQUIRE_THROW( price_to_string( p[i][j], 0, 20 ), fc::exception ); } try { - price pr = p[i][j]; - idump( (i) (j) (pr) ); if ( pr.base.amount == 0 || (pr.base.amount > 0 && pr.quote.amount >= 0 ) ) { - idump( (price_to_string( pr ,0,0)) ); - idump( (price_to_string( pr ,0,1)) ); - idump( (price_to_string( pr ,0,2)) ); - idump( (price_to_string( pr ,0,8)) ); - idump( (price_to_string( pr ,0,19)) ); - idump( (price_to_string( pr ,1,0)) ); - idump( (price_to_string( pr ,1,15)) ); - idump( (price_to_string( pr ,2,6)) ); - idump( (price_to_string( pr ,2,10)) ); - idump( (price_to_string( pr ,5,0)) ); - idump( (price_to_string( pr ,9,1)) ); - idump( (price_to_string( pr ,9,9)) ); - idump( (price_to_string( pr ,9,19)) ); - idump( (price_to_string( pr ,18,10)) ); - idump( (price_to_string( pr ,18,13)) ); - idump( (price_to_string( pr ,18,19)) ); - idump( (price_to_string( pr ,19,0)) ); - idump( (price_to_string( pr ,19,7)) ); - idump( (price_to_string( pr ,19,19)) ); - idump( (price_diff_percent_string( pr ,p[j][i])) ); + // idump( (i) (j) (pr) ); // for debugging + // These should not throw + // TODO: Verify results + BOOST_CHECK( !price_to_string( pr ,0,0).empty() ); + BOOST_CHECK( !price_to_string( pr ,0,1).empty() ); + BOOST_CHECK( !price_to_string( pr ,0,2).empty() ); + BOOST_CHECK( !price_to_string( pr ,0,8).empty() ); + BOOST_CHECK( !price_to_string( pr ,0,19).empty() ); + BOOST_CHECK( !price_to_string( pr ,1,0).empty() ); + BOOST_CHECK( !price_to_string( pr ,1,15).empty() ); + BOOST_CHECK( !price_to_string( pr ,2,6).empty() ); + BOOST_CHECK( !price_to_string( pr ,2,10).empty() ); + BOOST_CHECK( !price_to_string( pr ,5,0).empty() ); + BOOST_CHECK( !price_to_string( pr ,9,1).empty() ); + BOOST_CHECK( !price_to_string( pr ,9,9).empty() ); + BOOST_CHECK( !price_to_string( pr ,9,19).empty() ); + BOOST_CHECK( !price_to_string( pr ,18,10).empty() ); + BOOST_CHECK( !price_to_string( pr ,18,13).empty() ); + BOOST_CHECK( !price_to_string( pr ,18,19).empty() ); + BOOST_CHECK( !price_to_string( pr ,19,0).empty() ); + BOOST_CHECK( !price_to_string( pr ,19,7).empty() ); + BOOST_CHECK( !price_to_string( pr ,19,19).empty() ); + price new_price = p[j][i]; + if (pr.quote.amount >= 0) + BOOST_CHECK( !price_diff_percent_string( pr, new_price ).empty() ); + else + GRAPHENE_REQUIRE_THROW( price_diff_percent_string( pr, new_price ), fc::exception ); } else { GRAPHENE_REQUIRE_THROW( price_to_string( pr, 0, 0 ), fc::exception ); } + } catch(fc::exception& fcx) { + BOOST_FAIL( "FC Exception logging price_to_string: " + fcx.to_detail_string() ); } catch(...) { - BOOST_FAIL( "Failure to log price_to_string" ); + BOOST_FAIL( "Uncaught exception in price_to_string. i=" + std::to_string(i) + " j=" + std::to_string(j)); } } + } +} +/** + * Verify that price_to_string comes back with the correct results. Put edge cases here. + */ +BOOST_AUTO_TEST_CASE(price_to_string_verify) +{ + try + { + BOOST_CHECK_EQUAL( price_to_string( price{ asset(1), asset(1) }, 0, 0 ), "1" ); + BOOST_CHECK_EQUAL( price_to_string( price{ asset(10), asset(10) }, 0, 0), "1" ); + int64_t mx = std::numeric_limits::max(); + BOOST_CHECK_EQUAL( price_to_string( price{ asset(mx), asset(mx) }, 0, 0), "1" ); + BOOST_CHECK_EQUAL( price_to_string( price{ asset(1), asset(mx) }, 0, 0), "0.0000000000000000001" ); + BOOST_CHECK_EQUAL( price_to_string( price{ asset(mx), asset(1) }, 0, 0), "9223372036854775807" ); + } + catch (fc::exception& fx) + { + BOOST_FAIL( "FC Exception: " + fx.to_detail_string() ); + } } BOOST_AUTO_TEST_SUITE_END() From e9f03124a90e5af7f9dc22b8c56d57c972c1fd0a Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 14 Jan 2019 10:53:51 -0500 Subject: [PATCH 053/108] Fix comment typo --- libraries/chain/db_block.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 6571586445..28a6608c19 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -129,7 +129,7 @@ bool database::push_block(const signed_block& new_block, uint32_t skip) bool database::_push_block(const signed_block& new_block) { try { uint32_t skip = get_node_properties().skip_flags; - /// TODO: if the block is greater than the head block and before the next maitenance interval + // TODO: If the block is greater than the head block and before the next maitenance interval // verify that the block signer is in the current set of active witnesses. shared_ptr new_head = _fork_db.push_block(new_block); From 60e8a8d7607dd183e4d208d25c3cf729825acb50 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 14 Jan 2019 13:54:27 -0500 Subject: [PATCH 054/108] shut down without calling exit --- libraries/app/application.cpp | 18 ++++++++++-------- libraries/app/application_impl.hxx | 2 +- .../app/include/graphene/app/application.hpp | 12 ++++++++++-- programs/delayed_node/main.cpp | 10 ++++++++-- programs/witness_node/main.cpp | 12 ++++++++++-- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index f2cf80285d..3cf7cff63b 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -318,7 +318,7 @@ void application_impl::set_dbg_init_key( graphene::chain::genesis_state_type& ge genesis.initial_witness_candidates[i].block_signing_key = init_pubkey; } -void application_impl::startup() +bool application_impl::startup() { try { fc::create_directories(_data_dir / "blockchain"); @@ -454,7 +454,7 @@ void application_impl::startup() { elog("Failed to load file from ${path}", ("path", _options->at("api-access").as().string())); - std::exit(EXIT_FAILURE); + return false; } } else @@ -475,6 +475,7 @@ void application_impl::startup() reset_p2p_node(_data_dir); reset_websocket_server(); reset_websocket_tls_server(); + return true; } FC_LOG_AND_RETHROW() } optional< api_access_info > application_impl::get_api_access_info(const string& username)const @@ -1000,7 +1001,7 @@ void application::set_program_options(boost::program_options::options_descriptio configuration_file_options.add(_cfg_options); } -void application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) +bool application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) { my->_data_dir = data_dir; my->_options = &options; @@ -1018,7 +1019,7 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti << "\nWould you like to replace it? [y/N] "; char response = std::cin.get(); if( toupper(response) != 'Y' ) - return; + return false; } std::cerr << "Updating genesis state in file " << genesis_out.generic_string() << "\n"; @@ -1027,7 +1028,7 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti } fc::json::save_to_file(genesis_state, genesis_out); - std::exit(EXIT_SUCCESS); + return false; } if ( options.count("io-threads") ) @@ -1058,16 +1059,17 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti if(es_ah_conflict_counter > 1) { elog("Can't start program with elasticsearch and account_history plugin at the same time"); - std::exit(EXIT_FAILURE); + return false; } if (!it.empty()) enable_plugin(it); } + return true; } -void application::startup() +bool application::startup() { try { - my->startup(); + return my->startup(); } catch ( const fc::exception& e ) { elog( "${e}", ("e",e.to_detail_string()) ); throw; diff --git a/libraries/app/application_impl.hxx b/libraries/app/application_impl.hxx index 9f601bce79..f5368da6a1 100644 --- a/libraries/app/application_impl.hxx +++ b/libraries/app/application_impl.hxx @@ -42,7 +42,7 @@ class application_impl : public net::node_delegate void set_dbg_init_key( graphene::chain::genesis_state_type& genesis, const std::string& init_key ); - void startup(); + bool startup(); fc::optional< api_access_info > get_api_access_info(const string& username)const; diff --git a/libraries/app/include/graphene/app/application.hpp b/libraries/app/include/graphene/app/application.hpp index 4892bb9a27..96684a65a0 100644 --- a/libraries/app/include/graphene/app/application.hpp +++ b/libraries/app/include/graphene/app/application.hpp @@ -50,9 +50,17 @@ namespace graphene { namespace app { void set_program_options( boost::program_options::options_description& command_line_options, boost::program_options::options_description& configuration_file_options )const; - void initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); + /** + * Initializes the application + * @returns true if the calling method should continue, false otherwise + */ + bool initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); void initialize_plugins( const boost::program_options::variables_map& options ); - void startup(); + /*** + * Performs startup + * @returns true if the calling method should continue, false otherwise + */ + bool startup(); void shutdown(); void startup_plugins(); void shutdown_plugins(); diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 0ba1e6944d..76d68c7bec 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -163,10 +163,15 @@ int main(int argc, char** argv) { if( !options.count("plugins") ) options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); - node.initialize(data_dir, options); + if (!node.initialize(data_dir, options)) + return 0; + node.initialize_plugins( options ); - node.startup(); + if (!node.startup()) + { + return 0; + } node.startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); @@ -180,6 +185,7 @@ int main(int argc, char** argv) { int signal = exit_promise->wait(); ilog("Exiting from signal ${n}", ("n", signal)); node.shutdown_plugins(); + node.shutdown(); return 0; } catch( const fc::exception& e ) { elog("Exiting with error:\n${e}", ("e", e.to_detail_string())); diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 07c17a9010..0d5cbd1cfd 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -120,10 +120,18 @@ int main(int argc, char** argv) { app::load_configuration_options(data_dir, cfg_options, options); bpo::notify(options); - node->initialize(data_dir, options); + if (!node->initialize(data_dir, options)) + { + delete node; + return 0; + } node->initialize_plugins( options ); - node->startup(); + if (!node->startup()) + { + delete node; + return 0; + } node->startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); From 7c3968b589a07fa40eb64d4b050784c4440de78a Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 14 Jan 2019 13:55:13 -0500 Subject: [PATCH 055/108] prevent segfault when destructing application obj --- libraries/chain/db_management.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index 231cc3ebc9..16e38f43da 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -223,6 +223,9 @@ void database::open( void database::close(bool rewind) { + if (!_opened) + return; + // TODO: Save pending tx's on close() clear_pending(); From 02299573e5d1ae0d5bdcf11ce17b124c405c9e97 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 14 Jan 2019 16:08:27 -0500 Subject: [PATCH 056/108] Added human-readable message to assert --- libraries/chain/market_evaluator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 62dfc7c7b4..9badba481b 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -49,9 +49,11 @@ void_result limit_order_create_evaluator::do_evaluate(const limit_order_create_o _receive_asset = &op.min_to_receive.asset_id(d); if( _sell_asset->options.whitelist_markets.size() ) - FC_ASSERT( _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end() ); + FC_ASSERT( _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end(), + "This market has not been whitelisted." ); if( _sell_asset->options.blacklist_markets.size() ) - FC_ASSERT( _sell_asset->options.blacklist_markets.find(_receive_asset->id) == _sell_asset->options.blacklist_markets.end() ); + FC_ASSERT( _sell_asset->options.blacklist_markets.find(_receive_asset->id) == _sell_asset->options.blacklist_markets.end(), + "This market has been blacklisted." ); FC_ASSERT( is_authorized_asset( d, *_seller, *_sell_asset ) ); FC_ASSERT( is_authorized_asset( d, *_seller, *_receive_asset ) ); From 28875e1435164256723d412e2165239cfc9de249 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 14 Jan 2019 16:26:33 -0500 Subject: [PATCH 057/108] fixed long lines --- libraries/chain/market_evaluator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 9badba481b..58dd0ac53f 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -49,10 +49,12 @@ void_result limit_order_create_evaluator::do_evaluate(const limit_order_create_o _receive_asset = &op.min_to_receive.asset_id(d); if( _sell_asset->options.whitelist_markets.size() ) - FC_ASSERT( _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end(), + FC_ASSERT( _sell_asset->options.whitelist_markets.find(_receive_asset->id) + != _sell_asset->options.whitelist_markets.end(), "This market has not been whitelisted." ); if( _sell_asset->options.blacklist_markets.size() ) - FC_ASSERT( _sell_asset->options.blacklist_markets.find(_receive_asset->id) == _sell_asset->options.blacklist_markets.end(), + FC_ASSERT( _sell_asset->options.blacklist_markets.find(_receive_asset->id) + == _sell_asset->options.blacklist_markets.end(), "This market has been blacklisted." ); FC_ASSERT( is_authorized_asset( d, *_seller, *_sell_asset ) ); From 3b0891a17ec6dbd210a29973394ee109c5623781 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 15 Jan 2019 10:06:07 -0500 Subject: [PATCH 058/108] keep return value --- libraries/app/application.cpp | 16 ++++++++-------- libraries/app/application_impl.hxx | 2 +- .../app/include/graphene/app/application.hpp | 12 ++++++++---- programs/delayed_node/main.cpp | 16 ++++++++-------- programs/witness_node/main.cpp | 15 +++++++++------ 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 3cf7cff63b..6ae8dfea78 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -318,7 +318,7 @@ void application_impl::set_dbg_init_key( graphene::chain::genesis_state_type& ge genesis.initial_witness_candidates[i].block_signing_key = init_pubkey; } -bool application_impl::startup() +uint8_t application_impl::startup() { try { fc::create_directories(_data_dir / "blockchain"); @@ -454,7 +454,7 @@ bool application_impl::startup() { elog("Failed to load file from ${path}", ("path", _options->at("api-access").as().string())); - return false; + return EXIT_FAILURE; } } else @@ -475,7 +475,7 @@ bool application_impl::startup() reset_p2p_node(_data_dir); reset_websocket_server(); reset_websocket_tls_server(); - return true; + return DO_NOT_EXIT; } FC_LOG_AND_RETHROW() } optional< api_access_info > application_impl::get_api_access_info(const string& username)const @@ -1001,7 +1001,7 @@ void application::set_program_options(boost::program_options::options_descriptio configuration_file_options.add(_cfg_options); } -bool application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) +uint8_t application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) { my->_data_dir = data_dir; my->_options = &options; @@ -1019,7 +1019,7 @@ bool application::initialize(const fc::path& data_dir, const boost::program_opti << "\nWould you like to replace it? [y/N] "; char response = std::cin.get(); if( toupper(response) != 'Y' ) - return false; + return EXIT_FAILURE; } std::cerr << "Updating genesis state in file " << genesis_out.generic_string() << "\n"; @@ -1028,7 +1028,7 @@ bool application::initialize(const fc::path& data_dir, const boost::program_opti } fc::json::save_to_file(genesis_state, genesis_out); - return false; + return EXIT_SUCCESS; } if ( options.count("io-threads") ) @@ -1059,14 +1059,14 @@ bool application::initialize(const fc::path& data_dir, const boost::program_opti if(es_ah_conflict_counter > 1) { elog("Can't start program with elasticsearch and account_history plugin at the same time"); - return false; + return EXIT_FAILURE; } if (!it.empty()) enable_plugin(it); } return true; } -bool application::startup() +uint8_t application::startup() { try { return my->startup(); diff --git a/libraries/app/application_impl.hxx b/libraries/app/application_impl.hxx index f5368da6a1..25f7ee9d4c 100644 --- a/libraries/app/application_impl.hxx +++ b/libraries/app/application_impl.hxx @@ -42,7 +42,7 @@ class application_impl : public net::node_delegate void set_dbg_init_key( graphene::chain::genesis_state_type& genesis, const std::string& init_key ); - bool startup(); + uint8_t startup(); fc::optional< api_access_info > get_api_access_info(const string& username)const; diff --git a/libraries/app/include/graphene/app/application.hpp b/libraries/app/include/graphene/app/application.hpp index 96684a65a0..579f49fdc0 100644 --- a/libraries/app/include/graphene/app/application.hpp +++ b/libraries/app/include/graphene/app/application.hpp @@ -29,6 +29,10 @@ #include +#ifndef DO_NOT_EXIT + #define DO_NOT_EXIT 254 +#endif + namespace graphene { namespace app { namespace detail { class application_impl; } using std::string; @@ -52,15 +56,15 @@ namespace graphene { namespace app { boost::program_options::options_description& configuration_file_options )const; /** * Initializes the application - * @returns true if the calling method should continue, false otherwise + * @returns DO_NOT_EXIT if the calling method should continue, otherwise EXIT_SUCCESS or EXIT_FAILURE */ - bool initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); + uint8_t initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); void initialize_plugins( const boost::program_options::variables_map& options ); /*** * Performs startup - * @returns true if the calling method should continue, false otherwise + * @returns DO_NOT_EXIT if the calling method should continue, otherwise EXIT_SUCCESS or EXIT_FAILURE */ - bool startup(); + uint8_t startup(); void shutdown(); void startup_plugins(); void shutdown_plugins(); diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 76d68c7bec..ff2284962a 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -163,15 +163,15 @@ int main(int argc, char** argv) { if( !options.count("plugins") ) options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); - if (!node.initialize(data_dir, options)) - return 0; + uint8_t ret_val; + if ( (ret_val = node.initialize(data_dir, options)) != DO_NOT_EXIT ) + return ret_val; node.initialize_plugins( options ); - if (!node.startup()) - { - return 0; - } + if ( (ret_val = node.startup()) != DO_NOT_EXIT ) + return ret_val; + node.startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); @@ -186,10 +186,10 @@ int main(int argc, char** argv) { ilog("Exiting from signal ${n}", ("n", signal)); node.shutdown_plugins(); node.shutdown(); - return 0; + return EXIT_SUCCESS; } catch( const fc::exception& e ) { elog("Exiting with error:\n${e}", ("e", e.to_detail_string())); - return 1; + return EXIT_FAILURE; } } diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index 0d5cbd1cfd..dabcdd46a8 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -120,18 +120,21 @@ int main(int argc, char** argv) { app::load_configuration_options(data_dir, cfg_options, options); bpo::notify(options); - if (!node->initialize(data_dir, options)) + + uint8_t ret_val; + if ( ( ret_val = node->initialize(data_dir, options)) != DO_NOT_EXIT ) { delete node; - return 0; + return ret_val; } node->initialize_plugins( options ); - if (!node->startup()) + if ( (ret_val = node->startup()) != DO_NOT_EXIT ) { delete node; - return 0; + return ret_val; } + node->startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); @@ -154,7 +157,7 @@ int main(int argc, char** argv) { node->shutdown_plugins(); node->shutdown(); delete node; - return 0; + return EXIT_SUCCESS; } catch( const fc::exception& e ) { // deleting the node can yield, so do this outside the exception handler unhandled_exception = e; @@ -165,7 +168,7 @@ int main(int argc, char** argv) { elog("Exiting with error:\n${e}", ("e", unhandled_exception->to_detail_string())); node->shutdown(); delete node; - return 1; + return EXIT_FAILURE; } } From 7462d398ab3caecb50d8ae776e591730e67f4f2e Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 15 Jan 2019 10:50:35 -0500 Subject: [PATCH 059/108] Fix typo --- libraries/chain/db_block.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 28a6608c19..3b0a985c66 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -129,7 +129,7 @@ bool database::push_block(const signed_block& new_block, uint32_t skip) bool database::_push_block(const signed_block& new_block) { try { uint32_t skip = get_node_properties().skip_flags; - // TODO: If the block is greater than the head block and before the next maitenance interval + // TODO: If the block is greater than the head block and before the next maintenance interval // verify that the block signer is in the current set of active witnesses. shared_ptr new_head = _fork_db.push_block(new_block); From a590c25c52573d2391a44bb532d1a10c8e791edd Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 16 Jan 2019 10:58:30 -0300 Subject: [PATCH 060/108] remove useless check --- programs/delayed_node/main.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index 4a43535ac6..b13fafff92 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -166,11 +166,6 @@ int main(int argc, char** argv) { std::set plugins; boost::split(plugins, options.at("plugins").as(), [](char c){return c == ' ';}); - if(plugins.count("account_history") && plugins.count("elasticsearch")) { - std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n"; - return 1; - } - std::for_each(plugins.begin(), plugins.end(), [&](const std::string& plug) mutable { if (!plug.empty()) { node.enable_plugin(plug); From caf7f7fe99aa9b53898ced00effd0142204f46c9 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 16 Jan 2019 10:59:02 -0300 Subject: [PATCH 061/108] add default value to trusted-node --- libraries/plugins/delayed_node/delayed_node_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/plugins/delayed_node/delayed_node_plugin.cpp b/libraries/plugins/delayed_node/delayed_node_plugin.cpp index 24a46cc066..57b271b896 100644 --- a/libraries/plugins/delayed_node/delayed_node_plugin.cpp +++ b/libraries/plugins/delayed_node/delayed_node_plugin.cpp @@ -58,7 +58,7 @@ delayed_node_plugin::~delayed_node_plugin() void delayed_node_plugin::plugin_set_program_options(bpo::options_description& cli, bpo::options_description& cfg) { cli.add_options() - ("trusted-node", boost::program_options::value(), "RPC endpoint of a trusted validating node (required)") + ("trusted-node", boost::program_options::value()->default_value("127.0.0.1:8090"), "RPC endpoint of a trusted validating node (required)") ; cfg.add(cli); } From 6e11c31d40a8e63f52402887860349d9f96d883b Mon Sep 17 00:00:00 2001 From: abitmore Date: Wed, 16 Jan 2019 15:47:26 +0000 Subject: [PATCH 062/108] Remove gui_version file which is no longer used --- gui_version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 gui_version diff --git a/gui_version b/gui_version deleted file mode 100644 index f7a4e4ce15..0000000000 --- a/gui_version +++ /dev/null @@ -1 +0,0 @@ -2.0.170522 From 241e605f9df8a60938083c359e891e150f0844f4 Mon Sep 17 00:00:00 2001 From: abitmore Date: Wed, 16 Jan 2019 15:49:24 +0000 Subject: [PATCH 063/108] Remove old testnet files --- testnet-shared-accounts.txt | 556 --------------------------- testnet-shared-balances.txt | 41 -- testnet-shared-committee-members.txt | 204 ---------- testnet-shared-private-keys.txt | 10 - testnet-shared-vesting-balances.txt | 71 ---- testnet-shared-witnesses.txt | 304 --------------- 6 files changed, 1186 deletions(-) delete mode 100644 testnet-shared-accounts.txt delete mode 100644 testnet-shared-balances.txt delete mode 100644 testnet-shared-committee-members.txt delete mode 100644 testnet-shared-private-keys.txt delete mode 100644 testnet-shared-vesting-balances.txt delete mode 100644 testnet-shared-witnesses.txt diff --git a/testnet-shared-accounts.txt b/testnet-shared-accounts.txt deleted file mode 100644 index 99392365ca..0000000000 --- a/testnet-shared-accounts.txt +++ /dev/null @@ -1,556 +0,0 @@ - "initial_accounts": [{ - "name": "init0", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init1", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init2", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init3", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init4", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init5", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init6", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init7", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init8", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init9", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init10", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init11", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init12", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init13", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init14", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init15", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init16", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init17", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init18", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init19", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init20", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init21", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init22", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init23", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init24", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init25", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init26", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init27", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init28", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init29", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init30", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init31", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init32", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init33", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init34", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init35", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init36", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init37", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init38", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init39", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init40", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init41", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init42", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init43", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init44", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init45", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init46", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init47", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init48", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init49", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init50", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init51", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init52", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init53", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init54", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init55", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init56", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init57", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init58", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init59", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init60", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init61", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init62", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init63", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init64", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init65", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init66", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init67", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init68", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init69", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init70", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init71", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init72", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init73", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init74", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init75", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init76", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init77", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init78", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init79", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init80", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init81", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init82", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init83", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init84", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init85", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init86", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init87", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init88", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init89", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init90", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init91", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init92", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init93", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init94", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init95", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init96", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init97", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init98", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init99", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "init100", - "owner_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "active_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "is_lifetime_member": true - },{ - "name": "dummy0", - "owner_key": "BTS6qkMe8pHmQ4zUetLV1bbVKoQJYTNb1fSUbkQzuzpscYhonWpgk", - "active_key": "BTS6qkMe8pHmQ4zUetLV1bbVKoQJYTNb1fSUbkQzuzpscYhonWpgk", - "is_lifetime_member": true - },{ - "name": "dummy1", - "owner_key": "BTS7wXsTzBBR2QEetjrgxcSmN7Kuzey3RAzQWNNHwbPQsKYxkP6fp", - "active_key": "BTS7wXsTzBBR2QEetjrgxcSmN7Kuzey3RAzQWNNHwbPQsKYxkP6fp", - "is_lifetime_member": true - },{ - "name": "dummy2", - "owner_key": "BTS7rzifzfJxS8RWhev9aU8HDYoJi1EGwJRHG9B2fJKxnZAiF2Rsh", - "active_key": "BTS7rzifzfJxS8RWhev9aU8HDYoJi1EGwJRHG9B2fJKxnZAiF2Rsh", - "is_lifetime_member": true - },{ - "name": "dummy3", - "owner_key": "BTS6QZdcwFEFMtHsfW27YBGTv9KLaLTvgx5wgGrPHeUxDTrYEQJ2d", - "active_key": "BTS6QZdcwFEFMtHsfW27YBGTv9KLaLTvgx5wgGrPHeUxDTrYEQJ2d", - "is_lifetime_member": true - },{ - "name": "dummy4", - "owner_key": "BTS7q5MqhSP2a6CRTWaJk77ZcGdpnv14JbT4cVzbXaoAsWJoCxFJG", - "active_key": "BTS7q5MqhSP2a6CRTWaJk77ZcGdpnv14JbT4cVzbXaoAsWJoCxFJG", - "is_lifetime_member": true - },{ - "name": "dummy5", - "owner_key": "BTS5sRXxgDCnteHLUS623xtxJM5WKKVygwDMzEso6LigwxvprJqBA", - "active_key": "BTS5sRXxgDCnteHLUS623xtxJM5WKKVygwDMzEso6LigwxvprJqBA", - "is_lifetime_member": true - },{ - "name": "dummy6", - "owner_key": "BTS5V4HEQJbVbMjUWASeknQ42NT3NP9bZaygt83XMuvy6v4QMJuSP", - "active_key": "BTS5V4HEQJbVbMjUWASeknQ42NT3NP9bZaygt83XMuvy6v4QMJuSP", - "is_lifetime_member": true - },{ - "name": "dummy7", - "owner_key": "BTS86ukuPAufzKouerZf1dCxjVSmxQPA5kLwvnYEjn9GRqi5qXBop", - "active_key": "BTS86ukuPAufzKouerZf1dCxjVSmxQPA5kLwvnYEjn9GRqi5qXBop", - "is_lifetime_member": true - },{ - "name": "dummy8", - "owner_key": "BTS7Sdg3kQuz2pPT8mA8Yr3mkBe7zr6293mnBmoR36z9xxtRdiMmJ", - "active_key": "BTS7Sdg3kQuz2pPT8mA8Yr3mkBe7zr6293mnBmoR36z9xxtRdiMmJ", - "is_lifetime_member": true - },{ - "name": "dummy9", - "owner_key": "BTS5WCj1mMiiqEE4QRs7xhaFfSaiFroejUp3GuZE9wvfue9nxhPPn", - "active_key": "BTS5WCj1mMiiqEE4QRs7xhaFfSaiFroejUp3GuZE9wvfue9nxhPPn", - "is_lifetime_member": true - },{ diff --git a/testnet-shared-balances.txt b/testnet-shared-balances.txt deleted file mode 100644 index dc9061fa77..0000000000 --- a/testnet-shared-balances.txt +++ /dev/null @@ -1,41 +0,0 @@ - "initial_balances": [{ - "owner": "BTSHYhQcrjVg5kBzCoeeD38eQdncCC5pBgee", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTSPgQZg5929ht1NBdEvsGKqoQ7buRu3nKf4", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTSC9zrLXSAPUQaVmQPk1S9dMqSzT7jPqYU7", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTS93aQPtbbkXwaSjtHaREsNVcCvbfHo93aZ", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTS6RM4UfsYFPDuhbmgkvDS9ip8Kvqundvyk", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTSNVkZXdqWWSzqHVxvfetMe347is6kEkC4K", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTS5GHzWZ64Luoajqsz6JGjTKVMgWYkGV9SQ", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTSDCVRFez92bW9doRLjnFCKLJnpM58mgmMb", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTS5CCdX3JYLBptYMuCjbsezqGYzN9vG9JCu", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ - "owner": "BTSEQ3yQdr3EMDL2eRqGiceMCpoanaW16Puw", - "asset_symbol": "CORE", - "amount": 100000000000 - },{ diff --git a/testnet-shared-committee-members.txt b/testnet-shared-committee-members.txt deleted file mode 100644 index 7d7ae11b04..0000000000 --- a/testnet-shared-committee-members.txt +++ /dev/null @@ -1,204 +0,0 @@ - "initial_committee_candidates": [{ - "owner_name": "init0" - },{ - "owner_name": "init1" - },{ - "owner_name": "init2" - },{ - "owner_name": "init3" - },{ - "owner_name": "init4" - },{ - "owner_name": "init5" - },{ - "owner_name": "init6" - },{ - "owner_name": "init7" - },{ - "owner_name": "init8" - },{ - "owner_name": "init9" - },{ - "owner_name": "init10" - },{ - "owner_name": "init11" - },{ - "owner_name": "init12" - },{ - "owner_name": "init13" - },{ - "owner_name": "init14" - },{ - "owner_name": "init15" - },{ - "owner_name": "init16" - },{ - "owner_name": "init17" - },{ - "owner_name": "init18" - },{ - "owner_name": "init19" - },{ - "owner_name": "init20" - },{ - "owner_name": "init21" - },{ - "owner_name": "init22" - },{ - "owner_name": "init23" - },{ - "owner_name": "init24" - },{ - "owner_name": "init25" - },{ - "owner_name": "init26" - },{ - "owner_name": "init27" - },{ - "owner_name": "init28" - },{ - "owner_name": "init29" - },{ - "owner_name": "init30" - },{ - "owner_name": "init31" - },{ - "owner_name": "init32" - },{ - "owner_name": "init33" - },{ - "owner_name": "init34" - },{ - "owner_name": "init35" - },{ - "owner_name": "init36" - },{ - "owner_name": "init37" - },{ - "owner_name": "init38" - },{ - "owner_name": "init39" - },{ - "owner_name": "init40" - },{ - "owner_name": "init41" - },{ - "owner_name": "init42" - },{ - "owner_name": "init43" - },{ - "owner_name": "init44" - },{ - "owner_name": "init45" - },{ - "owner_name": "init46" - },{ - "owner_name": "init47" - },{ - "owner_name": "init48" - },{ - "owner_name": "init49" - },{ - "owner_name": "init50" - },{ - "owner_name": "init51" - },{ - "owner_name": "init52" - },{ - "owner_name": "init53" - },{ - "owner_name": "init54" - },{ - "owner_name": "init55" - },{ - "owner_name": "init56" - },{ - "owner_name": "init57" - },{ - "owner_name": "init58" - },{ - "owner_name": "init59" - },{ - "owner_name": "init60" - },{ - "owner_name": "init61" - },{ - "owner_name": "init62" - },{ - "owner_name": "init63" - },{ - "owner_name": "init64" - },{ - "owner_name": "init65" - },{ - "owner_name": "init66" - },{ - "owner_name": "init67" - },{ - "owner_name": "init68" - },{ - "owner_name": "init69" - },{ - "owner_name": "init70" - },{ - "owner_name": "init71" - },{ - "owner_name": "init72" - },{ - "owner_name": "init73" - },{ - "owner_name": "init74" - },{ - "owner_name": "init75" - },{ - "owner_name": "init76" - },{ - "owner_name": "init77" - },{ - "owner_name": "init78" - },{ - "owner_name": "init79" - },{ - "owner_name": "init80" - },{ - "owner_name": "init81" - },{ - "owner_name": "init82" - },{ - "owner_name": "init83" - },{ - "owner_name": "init84" - },{ - "owner_name": "init85" - },{ - "owner_name": "init86" - },{ - "owner_name": "init87" - },{ - "owner_name": "init88" - },{ - "owner_name": "init89" - },{ - "owner_name": "init90" - },{ - "owner_name": "init91" - },{ - "owner_name": "init92" - },{ - "owner_name": "init93" - },{ - "owner_name": "init94" - },{ - "owner_name": "init95" - },{ - "owner_name": "init96" - },{ - "owner_name": "init97" - },{ - "owner_name": "init98" - },{ - "owner_name": "init99" - },{ - "owner_name": "init100" - } - ], diff --git a/testnet-shared-private-keys.txt b/testnet-shared-private-keys.txt deleted file mode 100644 index e2a8d7ddc0..0000000000 --- a/testnet-shared-private-keys.txt +++ /dev/null @@ -1,10 +0,0 @@ -5KCNDLVGqvX8p3GcMFun9sMe6XbMvycVTm4bGrkB5aZGWCbAAtr -5HvFQ1bcAWk8H1A2qXj1AqSNp93GUAb6b2w5TVfLb1jWL6yNF3f -5JSxv2kgaBSm9nGseRNhLhgEKTBmoKJ5CkgLbbk5RW4RBCNsLJC -5K5E2TQtrodDFzsqPq3oVFi9rVX15AN8sLE3iTHfVsX1b49y49J -5HxC3fwN7VDZXKVkbbX3SzCczh18Fetx8TXBfJ3z3ovDUSPKvVd -5KSr4w978PDanQDYtftarcfJVvGe4wedYb1sYbdH6HNpi15heRa -5Kan4si6qWvDVpZuqug4c6KQH4zkvDhwspaGQiFKYniJv6qji6t -5KcZri5DDsMcDp1DjNeMkZSijkWurPoAoR7gBKTnnetNQ9CpXoJ -5K5TRZyEhC6GPgi57t5FhiSMRGVTHEbwXngbBEtCA41gM8LPFhF -5KXVG4oP4Vj3RawRpta79UFAg7pWp17FGf4DnrKfkr69ELytDMv diff --git a/testnet-shared-vesting-balances.txt b/testnet-shared-vesting-balances.txt deleted file mode 100644 index 1dd0023014..0000000000 --- a/testnet-shared-vesting-balances.txt +++ /dev/null @@ -1,71 +0,0 @@ - "initial_vesting_balances": [{ - "owner": "BTSHYhQcrjVg5kBzCoeeD38eQdncCC5pBgee", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTSPgQZg5929ht1NBdEvsGKqoQ7buRu3nKf4", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTSC9zrLXSAPUQaVmQPk1S9dMqSzT7jPqYU7", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTS93aQPtbbkXwaSjtHaREsNVcCvbfHo93aZ", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTS6RM4UfsYFPDuhbmgkvDS9ip8Kvqundvyk", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTSNVkZXdqWWSzqHVxvfetMe347is6kEkC4K", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTS5GHzWZ64Luoajqsz6JGjTKVMgWYkGV9SQ", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTSDCVRFez92bW9doRLjnFCKLJnpM58mgmMb", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTS5CCdX3JYLBptYMuCjbsezqGYzN9vG9JCu", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ - "owner": "BTSEQ3yQdr3EMDL2eRqGiceMCpoanaW16Puw", - "asset_symbol": "BTS", - "amount": 50000000000, - "begin_timestamp": "2014-11-06T00:00:00", - "vesting_duration_seconds": 63072000, - "begin_balance": 50000000000 - },{ diff --git a/testnet-shared-witnesses.txt b/testnet-shared-witnesses.txt deleted file mode 100644 index c09b132961..0000000000 --- a/testnet-shared-witnesses.txt +++ /dev/null @@ -1,304 +0,0 @@ - "initial_witness_candidates": [{ - "owner_name": "init0", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init1", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init2", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init3", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init4", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init5", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init6", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init7", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init8", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init9", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init10", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init11", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init12", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init13", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init14", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init15", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init16", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init17", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init18", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init19", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init20", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init21", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init22", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init23", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init24", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init25", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init26", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init27", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init28", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init29", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init30", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init31", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init32", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init33", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init34", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init35", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init36", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init37", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init38", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init39", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init40", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init41", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init42", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init43", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init44", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init45", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init46", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init47", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init48", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init49", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init50", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init51", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init52", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init53", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init54", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init55", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init56", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init57", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init58", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init59", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init60", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init61", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init62", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init63", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init64", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init65", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init66", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init67", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init68", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init69", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init70", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init71", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init72", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init73", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init74", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init75", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init76", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init77", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init78", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init79", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init80", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init81", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init82", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init83", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init84", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init85", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init86", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init87", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init88", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init89", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init90", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init91", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init92", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init93", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init94", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init95", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init96", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init97", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init98", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init99", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ - "owner_name": "init100", - "block_signing_key": "GPH6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" - },{ From e198552d0dd1a36dd68067b16195dc4706bc740c Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Thu, 17 Jan 2019 12:37:30 -0300 Subject: [PATCH 064/108] remove default option in delayed plugin --- libraries/plugins/delayed_node/delayed_node_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/plugins/delayed_node/delayed_node_plugin.cpp b/libraries/plugins/delayed_node/delayed_node_plugin.cpp index 9fec61c8c5..0329d018b2 100644 --- a/libraries/plugins/delayed_node/delayed_node_plugin.cpp +++ b/libraries/plugins/delayed_node/delayed_node_plugin.cpp @@ -58,7 +58,7 @@ delayed_node_plugin::~delayed_node_plugin() void delayed_node_plugin::plugin_set_program_options(bpo::options_description& cli, bpo::options_description& cfg) { cli.add_options() - ("trusted-node", boost::program_options::value()->default_value("127.0.0.1:8090"), "RPC endpoint of a trusted validating node (required for delayed_node)") + ("trusted-node", boost::program_options::value(), "RPC endpoint of a trusted validating node (required for delayed_node)") ; cfg.add(cli); } From 540a5362ab469cadd8b042b9d029195a8b794957 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 18 Jan 2019 12:02:47 -0300 Subject: [PATCH 065/108] add readme to libraries and programs --- libraries/README.md | 18 ++++++++++++++++++ programs/README.md | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 libraries/README.md create mode 100644 programs/README.md diff --git a/libraries/README.md b/libraries/README.md new file mode 100644 index 0000000000..fa7e4d5ce4 --- /dev/null +++ b/libraries/README.md @@ -0,0 +1,18 @@ +# BitShares Libraries + +The libraries are the core of the project and defines everything where applications can build on top. + +A **graphene** blockchain software will use the `app` library to define what the application will do, what services it will offer. The blockchain is defined by the `chain` library and include all the objects, types, operations, protocols that builds current consensus blockchain. The lowest level in memory database of Bitshares is developed at the `db` library. The `fc` is a helper module broadly used in the libraries code, `egenesis` will help with the genesis file, `plugins` will be loaded optionally to the application. Wallet software like the cli_wallet will benefit from the `wallet` library. + +Code in libraries is the most important part of **bitshares-core** project and it is maintained by the Bitshares Core Team and contributors. +# Available Libraries + +Folder | Name | Description | Category | Status +-----------------------------------|--------------------------|-----------------------------------------------------------------------------|----------------|--------------- +[app](app) | Application | Control the behaviour of the `witness_node` application, connect to the seeds, open he API, load plugins, etc. | Library | Active +[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Library | Active +[db](db) | Database | Define the internal database graphene uses. | Library | Active +[egenesis](egenesis) | Genesis | | Library | Active +[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Library | Active +[plugins](plugins) | Plugins | All plugin modules are stored here. | Library | Active +[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Library | Active | \ No newline at end of file diff --git a/programs/README.md b/programs/README.md new file mode 100644 index 0000000000..2fb1def850 --- /dev/null +++ b/programs/README.md @@ -0,0 +1,20 @@ +# BitShares Programs + +The bitshares programs are a collection of binaries to run the blockchain, interact with it or utilities. + +The main program is the `witness_node`, used to run a bitshares block producer, API or plugin node. The second in importance is the `cli_wallet`, used to interact with the blockchain. This 2 programs are the most used by the community and updated by the developers, rest of the programs are utilities. + +Programs in here are part of the **bitshares-core** project and are maintained by the bitshares core team and contributors. + + +# Available Programs + +Folder | Name | Description | Category | Status | Help +-----------------------------------|--------------------------|-----------------------------------------------------------------------------|----------------|---------------|--------------| +[witness_node](witness_node) | Witness Node | Main blockchain software | Node | Active | `./witness_node --help` +[cli_wallet](cli_wallet) | CLI Wallet | Command line wallet | Wallet | Active | `./cli_wallet --help` +[delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecatd in favour of `./witness_node --plugins "delayed_node"` | Node | Deprecated | `./delayed_node --help` +[js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` +[size_checker](size_checker) | Size Checker | Provides wire size average in bytes of all the operations | Tool | Old | `./size_checker` +[build_helpers](build_helpers) | Build Helpers | | Tool | Old | `./member_enumerator` and `./cat-parts` +[genesis_util](genesis_util) | Gensis Utils | | Tool | Old | \ No newline at end of file From 46e248ed30de0e207c53bdf9c1e10f970949fb23 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 18 Jan 2019 13:42:21 -0500 Subject: [PATCH 066/108] Remove create-genesis-json --- libraries/app/application.cpp | 65 ++++--------------- libraries/app/application_impl.hxx | 4 +- .../app/include/graphene/app/application.hpp | 16 +---- programs/delayed_node/main.cpp | 8 +-- programs/witness_node/main.cpp | 14 +--- 5 files changed, 22 insertions(+), 85 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 6ae8dfea78..c89ec21be0 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -318,7 +318,7 @@ void application_impl::set_dbg_init_key( graphene::chain::genesis_state_type& ge genesis.initial_witness_candidates[i].block_signing_key = init_pubkey; } -uint8_t application_impl::startup() +void application_impl::startup() { try { fc::create_directories(_data_dir / "blockchain"); @@ -444,18 +444,14 @@ uint8_t application_impl::startup() if( _options->count("api-access") ) { - if(fc::exists(_options->at("api-access").as())) - { - _apiaccess = fc::json::from_file( _options->at("api-access").as() ).as( 20 ); - ilog( "Using api access file from ${path}", - ("path", _options->at("api-access").as().string()) ); - } - else - { - elog("Failed to load file from ${path}", - ("path", _options->at("api-access").as().string())); - return EXIT_FAILURE; - } + fc::path api_access_file = _options->at("api-access").as(); + + FC_ASSERT( fc::exists(api_access_file), + "Failed to load file from ${path}", ("path", api_access_file) ); + + _apiaccess = fc::json::from_file( api_access_file ).as( 20 ); + ilog( "Using api access file from ${path}", + ("path", api_access_file) ); } else { @@ -475,7 +471,6 @@ uint8_t application_impl::startup() reset_p2p_node(_data_dir); reset_websocket_server(); reset_websocket_tls_server(); - return DO_NOT_EXIT; } FC_LOG_AND_RETHROW() } optional< api_access_info > application_impl::get_api_access_info(const string& username)const @@ -986,10 +981,6 @@ void application::set_program_options(boost::program_options::options_descriptio ; command_line_options.add(configuration_file_options); command_line_options.add_options() - ("create-genesis-json", bpo::value(), - "Path to create a Genesis State at. If a well-formed JSON file exists at the path, it will be parsed and any " - "missing fields in a Genesis State will be added, and any unknown fields will be removed. If no file or an " - "invalid file is found, it will be replaced with an example Genesis State.") ("replay-blockchain", "Rebuild object graph by replaying all blocks without validation") ("revalidate-blockchain", "Rebuild object graph by replaying all blocks with full validation") ("resync-blockchain", "Delete all blocks and re-sync with network from scratch") @@ -1001,36 +992,11 @@ void application::set_program_options(boost::program_options::options_descriptio configuration_file_options.add(_cfg_options); } -uint8_t application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) +void application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options) { my->_data_dir = data_dir; my->_options = &options; - if( options.count("create-genesis-json") ) - { - fc::path genesis_out = options.at("create-genesis-json").as(); - genesis_state_type genesis_state = detail::create_example_genesis(); - if( fc::exists(genesis_out) ) - { - try { - genesis_state = fc::json::from_file(genesis_out).as( 20 ); - } catch(const fc::exception& e) { - std::cerr << "Unable to parse existing genesis file:\n" << e.to_string() - << "\nWould you like to replace it? [y/N] "; - char response = std::cin.get(); - if( toupper(response) != 'Y' ) - return EXIT_FAILURE; - } - - std::cerr << "Updating genesis state in file " << genesis_out.generic_string() << "\n"; - } else { - std::cerr << "Creating example genesis state in file " << genesis_out.generic_string() << "\n"; - } - fc::json::save_to_file(genesis_state, genesis_out); - - return EXIT_SUCCESS; - } - if ( options.count("io-threads") ) { const uint16_t num_threads = options["io-threads"].as(); @@ -1057,19 +1023,16 @@ uint8_t application::initialize(const fc::path& data_dir, const boost::program_o if(it == "elasticsearch") ++es_ah_conflict_counter; - if(es_ah_conflict_counter > 1) { - elog("Can't start program with elasticsearch and account_history plugin at the same time"); - return EXIT_FAILURE; - } + FC_ASSERT(es_ah_conflict_counter <= 1, "Can't start program with elasticsearch and account_history plugin at the same time"); + if (!it.empty()) enable_plugin(it); } - return true; } -uint8_t application::startup() +void application::startup() { try { - return my->startup(); + my->startup(); } catch ( const fc::exception& e ) { elog( "${e}", ("e",e.to_detail_string()) ); throw; diff --git a/libraries/app/application_impl.hxx b/libraries/app/application_impl.hxx index 25f7ee9d4c..2d5d48080d 100644 --- a/libraries/app/application_impl.hxx +++ b/libraries/app/application_impl.hxx @@ -36,13 +36,13 @@ class application_impl : public net::node_delegate { } - ~application_impl() + virtual ~application_impl() { } void set_dbg_init_key( graphene::chain::genesis_state_type& genesis, const std::string& init_key ); - uint8_t startup(); + void startup(); fc::optional< api_access_info > get_api_access_info(const string& username)const; diff --git a/libraries/app/include/graphene/app/application.hpp b/libraries/app/include/graphene/app/application.hpp index 579f49fdc0..4892bb9a27 100644 --- a/libraries/app/include/graphene/app/application.hpp +++ b/libraries/app/include/graphene/app/application.hpp @@ -29,10 +29,6 @@ #include -#ifndef DO_NOT_EXIT - #define DO_NOT_EXIT 254 -#endif - namespace graphene { namespace app { namespace detail { class application_impl; } using std::string; @@ -54,17 +50,9 @@ namespace graphene { namespace app { void set_program_options( boost::program_options::options_description& command_line_options, boost::program_options::options_description& configuration_file_options )const; - /** - * Initializes the application - * @returns DO_NOT_EXIT if the calling method should continue, otherwise EXIT_SUCCESS or EXIT_FAILURE - */ - uint8_t initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); + void initialize(const fc::path& data_dir, const boost::program_options::variables_map&options); void initialize_plugins( const boost::program_options::variables_map& options ); - /*** - * Performs startup - * @returns DO_NOT_EXIT if the calling method should continue, otherwise EXIT_SUCCESS or EXIT_FAILURE - */ - uint8_t startup(); + void startup(); void shutdown(); void startup_plugins(); void shutdown_plugins(); diff --git a/programs/delayed_node/main.cpp b/programs/delayed_node/main.cpp index ff2284962a..ac44686d46 100644 --- a/programs/delayed_node/main.cpp +++ b/programs/delayed_node/main.cpp @@ -163,14 +163,10 @@ int main(int argc, char** argv) { if( !options.count("plugins") ) options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) ); - uint8_t ret_val; - if ( (ret_val = node.initialize(data_dir, options)) != DO_NOT_EXIT ) - return ret_val; - + node.initialize(data_dir, options); node.initialize_plugins( options ); - if ( (ret_val = node.startup()) != DO_NOT_EXIT ) - return ret_val; + node.startup(); node.startup_plugins(); diff --git a/programs/witness_node/main.cpp b/programs/witness_node/main.cpp index dabcdd46a8..41bbce769f 100644 --- a/programs/witness_node/main.cpp +++ b/programs/witness_node/main.cpp @@ -121,20 +121,10 @@ int main(int argc, char** argv) { bpo::notify(options); - uint8_t ret_val; - if ( ( ret_val = node->initialize(data_dir, options)) != DO_NOT_EXIT ) - { - delete node; - return ret_val; - } + node->initialize(data_dir, options); node->initialize_plugins( options ); - if ( (ret_val = node->startup()) != DO_NOT_EXIT ) - { - delete node; - return ret_val; - } - + node->startup(); node->startup_plugins(); fc::promise::ptr exit_promise = new fc::promise("UNIX Signal Handler"); From e49c04951e4a8ccc782d226473ecef4fd663d6bf Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 18 Jan 2019 14:21:13 -0500 Subject: [PATCH 067/108] Removed comment --- libraries/db/include/graphene/db/undo_database.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index f2f77d607d..5234ac65aa 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -59,7 +59,7 @@ namespace graphene { namespace db { { mv._apply_undo = false; } - ~session(); // defined in implementation file to prevent repeated compiler warnings + ~session(); void commit() { _apply_undo = false; _db.commit(); } void undo() { if( _apply_undo ) _db.undo(); _apply_undo = false; } void merge() { if( _apply_undo ) _db.merge(); _apply_undo = false; } From 9fc89830a94d159184bfdf0ff5ef3117fbab55ca Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 18 Jan 2019 14:22:45 -0500 Subject: [PATCH 068/108] Removed comment --- libraries/db/include/graphene/db/undo_database.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index f2f77d607d..5234ac65aa 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -59,7 +59,7 @@ namespace graphene { namespace db { { mv._apply_undo = false; } - ~session(); // defined in implementation file to prevent repeated compiler warnings + ~session(); void commit() { _apply_undo = false; _db.commit(); } void undo() { if( _apply_undo ) _db.undo(); _apply_undo = false; } void merge() { if( _apply_undo ) _db.merge(); _apply_undo = false; } From f2acea8e1f25dc94177545bb94a21000c9c7999f Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 21 Jan 2019 11:01:57 -0300 Subject: [PATCH 069/108] add utilities, net libraries, change app description --- libraries/README.md | 20 +++++++++++--------- programs/README.md | 18 +++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/libraries/README.md b/libraries/README.md index fa7e4d5ce4..c59fbf7135 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -7,12 +7,14 @@ A **graphene** blockchain software will use the `app` library to define what the Code in libraries is the most important part of **bitshares-core** project and it is maintained by the Bitshares Core Team and contributors. # Available Libraries -Folder | Name | Description | Category | Status ------------------------------------|--------------------------|-----------------------------------------------------------------------------|----------------|--------------- -[app](app) | Application | Control the behaviour of the `witness_node` application, connect to the seeds, open he API, load plugins, etc. | Library | Active -[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Library | Active -[db](db) | Database | Define the internal database graphene uses. | Library | Active -[egenesis](egenesis) | Genesis | | Library | Active -[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Library | Active -[plugins](plugins) | Plugins | All plugin modules are stored here. | Library | Active -[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Library | Active | \ No newline at end of file +Folder | Name | Description | Category | Status +---|---|---|---|--- +[app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Library | Active +[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Library | Active +[db](db) | Database | Define the internal database graphene uses. | Library | Active +[egenesis](egenesis) | Genesis | | Library | Active +[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Library | Active +[net](net) | Network | The graphene p2p layer. | Library | Active +[plugins](plugins) | Plugins | All plugin modules are stored here. | Library | Active +[utilities](utilities) | Network | Provide common utility calls used in applications or other libraries. | Library | Active +[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Library | Active diff --git a/programs/README.md b/programs/README.md index 2fb1def850..5f126447f1 100644 --- a/programs/README.md +++ b/programs/README.md @@ -9,12 +9,12 @@ Programs in here are part of the **bitshares-core** project and are maintained b # Available Programs -Folder | Name | Description | Category | Status | Help ------------------------------------|--------------------------|-----------------------------------------------------------------------------|----------------|---------------|--------------| -[witness_node](witness_node) | Witness Node | Main blockchain software | Node | Active | `./witness_node --help` -[cli_wallet](cli_wallet) | CLI Wallet | Command line wallet | Wallet | Active | `./cli_wallet --help` -[delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecatd in favour of `./witness_node --plugins "delayed_node"` | Node | Deprecated | `./delayed_node --help` -[js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` -[size_checker](size_checker) | Size Checker | Provides wire size average in bytes of all the operations | Tool | Old | `./size_checker` -[build_helpers](build_helpers) | Build Helpers | | Tool | Old | `./member_enumerator` and `./cat-parts` -[genesis_util](genesis_util) | Gensis Utils | | Tool | Old | \ No newline at end of file +Folder | Name | Description | Category | Status | Help +---|---|---|---|---|--- +[witness_node](witness_node) | Witness Node | Main blockchain software | Node | Active | `./witness_node --help` +[cli_wallet](cli_wallet) | CLI Wallet | Command line wallet | Wallet | Active | `./cli_wallet --help` +[delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecatd in favour of `./witness_node --plugins "delayed_node"` | Node | Deprecated | `./delayed_node --help` +[js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` +[size_checker](size_checker) | Size Checker | Provides wire size average in bytes of all the operations | Tool | Old | `./size_checker` +[build_helpers](build_helpers) | Build Helpers | | Tool | Old | `./member_enumerator` and `./cat-parts` +[genesis_util](genesis_util) | Genesis Utils | | Tool | Old | \ No newline at end of file From 4f079fa86b69cd1eb5eae91b70ac49152c2909a9 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 22 Jan 2019 11:38:14 -0300 Subject: [PATCH 070/108] remove category column --- libraries/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/README.md b/libraries/README.md index c59fbf7135..36ded3611a 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -7,14 +7,14 @@ A **graphene** blockchain software will use the `app` library to define what the Code in libraries is the most important part of **bitshares-core** project and it is maintained by the Bitshares Core Team and contributors. # Available Libraries -Folder | Name | Description | Category | Status ----|---|---|---|--- -[app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Library | Active -[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Library | Active -[db](db) | Database | Define the internal database graphene uses. | Library | Active +Folder | Name | Description | Status +---|---|---|--- +[app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Active +[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active +[db](db) | Database | Define the internal database graphene uses. | Active [egenesis](egenesis) | Genesis | | Library | Active -[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Library | Active +[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Active [net](net) | Network | The graphene p2p layer. | Library | Active -[plugins](plugins) | Plugins | All plugin modules are stored here. | Library | Active -[utilities](utilities) | Network | Provide common utility calls used in applications or other libraries. | Library | Active -[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Library | Active +[plugins](plugins) | Plugins | All plugin modules are stored here. | Active +[utilities](utilities) | Network | Provide common utility calls used in applications or other libraries. | Active +[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Active From f3da5289677fc2639542030c416cbc2e4247c0d6 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 22 Jan 2019 11:52:30 -0300 Subject: [PATCH 071/108] change some descriptions in libraries --- libraries/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/README.md b/libraries/README.md index 36ded3611a..39909d4c24 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -10,11 +10,11 @@ Code in libraries is the most important part of **bitshares-core** project and i Folder | Name | Description | Status ---|---|---|--- [app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Active -[chain](chain) | Blockchain | Define all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active -[db](db) | Database | Define the internal database graphene uses. | Active -[egenesis](egenesis) | Genesis | | Library | Active +[chain](chain) | Blockchain | Defines all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active +[db](db) | Database | Defines the internal database graphene uses. | Active +[egenesis](egenesis) | Genesis | | Active [fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Active -[net](net) | Network | The graphene p2p layer. | Library | Active -[plugins](plugins) | Plugins | All plugin modules are stored here. | Active -[utilities](utilities) | Network | Provide common utility calls used in applications or other libraries. | Active +[net](net) | Network | The graphene p2p layer. | Active +[plugins](plugins) | Plugins | Collection of singleton designed modules used for extending the bitshares-core. | Active +[utilities](utilities) | Network | Common utility calls used in applications or other libraries. | Active [wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Active From 8624fad31375dedaef86a0b1bb31c13223d24c53 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 22 Jan 2019 12:21:22 -0300 Subject: [PATCH 072/108] change some descriptions in programs --- programs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/programs/README.md b/programs/README.md index 5f126447f1..2726bcdf37 100644 --- a/programs/README.md +++ b/programs/README.md @@ -11,10 +11,10 @@ Programs in here are part of the **bitshares-core** project and are maintained b Folder | Name | Description | Category | Status | Help ---|---|---|---|---|--- -[witness_node](witness_node) | Witness Node | Main blockchain software | Node | Active | `./witness_node --help` -[cli_wallet](cli_wallet) | CLI Wallet | Command line wallet | Wallet | Active | `./cli_wallet --help` -[delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecatd in favour of `./witness_node --plugins "delayed_node"` | Node | Deprecated | `./delayed_node --help` +[witness_node](witness_node) | Witness Node | Main software used to sign blocks or provide services. | Node | Active | `./witness_node --help` +[cli_wallet](cli_wallet) | CLI Wallet | Software to interact with the blockchain by command line. | Wallet | Active | `./cli_wallet --help` +[delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecated in favour of `./witness_node --plugins "delayed_node"`. | Node | Deprecated | `./delayed_node --help` [js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` -[size_checker](size_checker) | Size Checker | Provides wire size average in bytes of all the operations | Tool | Old | `./size_checker` +[size_checker](size_checker) | Size Checker | Return wire size average in bytes of all the operations. | Tool | Old | `./size_checker` [build_helpers](build_helpers) | Build Helpers | | Tool | Old | `./member_enumerator` and `./cat-parts` [genesis_util](genesis_util) | Genesis Utils | | Tool | Old | \ No newline at end of file From a4588a620507b44c6ea67fd8096849de8b034485 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 22 Jan 2019 18:41:38 -0300 Subject: [PATCH 073/108] add subprograms --- programs/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/programs/README.md b/programs/README.md index 2726bcdf37..794645c439 100644 --- a/programs/README.md +++ b/programs/README.md @@ -16,5 +16,8 @@ Folder | Name | Description | Category | Status | Help [delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecated in favour of `./witness_node --plugins "delayed_node"`. | Node | Deprecated | `./delayed_node --help` [js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` [size_checker](size_checker) | Size Checker | Return wire size average in bytes of all the operations. | Tool | Old | `./size_checker` -[build_helpers](build_helpers) | Build Helpers | | Tool | Old | `./member_enumerator` and `./cat-parts` -[genesis_util](genesis_util) | Genesis Utils | | Tool | Old | \ No newline at end of file +[cat-parts](build_helpers/cat-parts.cpp) | Cat parts | Used to create `hardfork.hpp` from individual files. | Tool | Old | `./cat-parts` +[check_reflect](build_helpers/check_reflect.py) | Check reflect | Check reflected fields automatically(https://github.com/cryptonomex/graphene/issues/562) | Tool | Old | `doxygen;cp -rf doxygen programs/build_helpers; ./check_reflect.py` +[member_enumerator](build_helpers/member_enumerator.cpp) | Member enumerator | | Tool | Deprecated | `./member_enumerator` +[get_dev_key](genesis_util/get_dev_key.cpp) | Get Dev Key | Create public, private and address keys. Useful in private testnets, `genesis.json` files, new blockchain creation and others. | Tool | Active | `/programs/genesis_util/get_dev_key -h` +[genesis_util](genesis_util) | Genesis Utils | Other utilities for genesis creation. | Tool | Old | From 41bff6ead331c4f340e874c5c9102d23deb487be Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 24 Jan 2019 16:08:23 -0300 Subject: [PATCH 074/108] add egenesis library description --- libraries/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/README.md b/libraries/README.md index 39909d4c24..256d15029b 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -12,9 +12,9 @@ Folder | Name | Description | Status [app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Active [chain](chain) | Blockchain | Defines all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active [db](db) | Database | Defines the internal database graphene uses. | Active -[egenesis](egenesis) | Genesis | | Active +[egenesis](egenesis) | Genesis | Hardcodes the `genesis.json` file into the `witness_node` executable.| Active [fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Active [net](net) | Network | The graphene p2p layer. | Active [plugins](plugins) | Plugins | Collection of singleton designed modules used for extending the bitshares-core. | Active -[utilities](utilities) | Network | Common utility calls used in applications or other libraries. | Active +[utilities](utilities) | Utilities | Common utility calls used in applications or other libraries. | Active [wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Active From 10f528214d8d97ce4975ded33ca4cdb71d489b46 Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 24 Jan 2019 14:33:03 -0500 Subject: [PATCH 075/108] Fix CMake Doxygen Perl reference --- libraries/wallet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/wallet/CMakeLists.txt b/libraries/wallet/CMakeLists.txt index cd0000e58a..8ff42dc95f 100644 --- a/libraries/wallet/CMakeLists.txt +++ b/libraries/wallet/CMakeLists.txt @@ -17,7 +17,7 @@ if( PERL_FOUND AND DOXYGEN_FOUND AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja" ) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/doxygen/perlmod/DoxyDocs.pm ) else(MSVC) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp - COMMAND PERLLIB=${CMAKE_CURRENT_SOURCE_DIR} ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new + COMMAND PERLLIB=${CMAKE_CURRENT_BINARY_DIR} ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/doxygen/perlmod/DoxyDocs.pm ) From accc38152b38d6264e62245957bcbcb2eefdad59 Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 24 Jan 2019 15:38:01 -0500 Subject: [PATCH 076/108] catch exception in destructor --- tests/common/database_fixture.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 1f08d0ef25..ac379db839 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -219,7 +219,11 @@ database_fixture::~database_fixture() } return; } catch (fc::exception& ex) { - BOOST_FAIL( ex.to_detail_string() ); + BOOST_FAIL( std::string("fc::exception in ~database_fixture: ") + ex.to_detail_string() ); + } catch (std::exception& e) { + BOOST_FAIL( std::string("std::exception in ~database_fixture:") + e.what() ); + } catch (...) { + BOOST_FAIL( "Uncaught exception in ~database_fixture" ); } } From a26dc47ad31379cb6e1bb0744777cfab7ba3585a Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 24 Jan 2019 15:38:27 -0500 Subject: [PATCH 077/108] fix warnings in test --- tests/tests/history_api_tests.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/tests/history_api_tests.cpp b/tests/tests/history_api_tests.cpp index 48e4833da2..72fc4010f3 100644 --- a/tests/tests/history_api_tests.cpp +++ b/tests/tests/history_api_tests.cpp @@ -549,7 +549,6 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { int asset_create_op_id = operation::tag::value; int account_create_op_id = operation::tag::value; - int transfer_op_id = operation::tag::value; //account_id_type() did 1 asset_create op vector histories = hist_api.get_account_history_operations( @@ -594,7 +593,7 @@ BOOST_AUTO_TEST_CASE(get_account_history_operations) { // see https://github.com/bitshares/bitshares-core/issues/1490 histories = hist_api.get_account_history_operations( "committee-account", account_create_op_id, operation_history_id_type(), operation_history_id_type(), 100); - BOOST_CHECK_EQUAL(histories.size(), 75); + BOOST_CHECK_EQUAL(histories.size(), 75u); if (histories.size() > 0) BOOST_CHECK_EQUAL(histories[0].op.which(), account_create_op_id); From cf2682fb309c03c1e95620d63274f076ba490a64 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 25 Jan 2019 11:05:09 -0300 Subject: [PATCH 078/108] add es-objects-start-es-after-block option --- libraries/plugins/es_objects/es_objects.cpp | 158 ++++++++++---------- 1 file changed, 81 insertions(+), 77 deletions(-) diff --git a/libraries/plugins/es_objects/es_objects.cpp b/libraries/plugins/es_objects/es_objects.cpp index 5695064325..d588fdbe21 100644 --- a/libraries/plugins/es_objects/es_objects.cpp +++ b/libraries/plugins/es_objects/es_objects.cpp @@ -63,6 +63,7 @@ class es_objects_plugin_impl bool _es_objects_limit_orders = true; bool _es_objects_asset_bitasset = true; std::string _es_objects_index_prefix = "objects-"; + uint32_t _es_objects_start_es_after_block = 0; // disabled CURL *curl; // curl handler vector bulk; vector prepare; @@ -84,88 +85,87 @@ bool es_objects_plugin_impl::index_database( const vector& ids, block_time = db.head_block_time(); block_number = db.head_block_num(); - // check if we are in replay or in sync and change number of bulk documents accordingly - uint32_t limit_documents = 0; - if((fc::time_point::now() - block_time) < fc::seconds(30)) - limit_documents = _es_objects_bulk_sync; - else - limit_documents = _es_objects_bulk_replay; - - for(auto const& value: ids) { - if(value.is() && _es_objects_proposals) { - auto obj = db.find_object(value); - auto p = static_cast(obj); - if(p != nullptr) { - if(action == "delete") - remove_from_database(p->id, "proposal"); - else - prepareTemplate(*p, "proposal"); - } - } - else if(value.is() && _es_objects_accounts) { - auto obj = db.find_object(value); - auto a = static_cast(obj); - if(a != nullptr) { - if(action == "delete") - remove_from_database(a->id, "account"); - else - prepareTemplate(*a, "account"); - } - } - else if(value.is() && _es_objects_assets) { - auto obj = db.find_object(value); - auto a = static_cast(obj); - if(a != nullptr) { - if(action == "delete") - remove_from_database(a->id, "asset"); - else - prepareTemplate(*a, "asset"); - } - } - else if(value.is() && _es_objects_balances) { - auto obj = db.find_object(value); - auto b = static_cast(obj); - if(b != nullptr) { - if(action == "delete") - remove_from_database(b->id, "balance"); - else - prepareTemplate(*b, "balance"); - } - } - else if(value.is() && _es_objects_limit_orders) { - auto obj = db.find_object(value); - auto l = static_cast(obj); - if(l != nullptr) { - if(action == "delete") - remove_from_database(l->id, "limitorder"); - else - prepareTemplate(*l, "limitorder"); - } - } - else if(value.is() && _es_objects_asset_bitasset) { - auto obj = db.find_object(value); - auto ba = static_cast(obj); - if(ba != nullptr) { - if(action == "delete") - remove_from_database(ba->id, "bitasset"); - else - prepareTemplate(*ba, "bitasset"); + if(_es_objects_start_es_after_block == 0 || block_number > _es_objects_start_es_after_block) { + + // check if we are in replay or in sync and change number of bulk documents accordingly + uint32_t limit_documents = 0; + if ((fc::time_point::now() - block_time) < fc::seconds(30)) + limit_documents = _es_objects_bulk_sync; + else + limit_documents = _es_objects_bulk_replay; + + + for (auto const &value: ids) { + if (value.is() && _es_objects_proposals) { + auto obj = db.find_object(value); + auto p = static_cast(obj); + if (p != nullptr) { + if (action == "delete") + remove_from_database(p->id, "proposal"); + else + prepareTemplate(*p, "proposal"); + } + } else if (value.is() && _es_objects_accounts) { + auto obj = db.find_object(value); + auto a = static_cast(obj); + if (a != nullptr) { + if (action == "delete") + remove_from_database(a->id, "account"); + else + prepareTemplate(*a, "account"); + } + } else if (value.is() && _es_objects_assets) { + auto obj = db.find_object(value); + auto a = static_cast(obj); + if (a != nullptr) { + if (action == "delete") + remove_from_database(a->id, "asset"); + else + prepareTemplate(*a, "asset"); + } + } else if (value.is() && _es_objects_balances) { + auto obj = db.find_object(value); + auto b = static_cast(obj); + if (b != nullptr) { + if (action == "delete") + remove_from_database(b->id, "balance"); + else + prepareTemplate(*b, "balance"); + } + } else if (value.is() && _es_objects_limit_orders) { + auto obj = db.find_object(value); + auto l = static_cast(obj); + if (l != nullptr) { + if (action == "delete") + remove_from_database(l->id, "limitorder"); + else + prepareTemplate(*l, "limitorder"); + } + } else if (value.is() && _es_objects_asset_bitasset) { + auto obj = db.find_object(value); + auto ba = static_cast(obj); + if (ba != nullptr) { + if (action == "delete") + remove_from_database(ba->id, "bitasset"); + else + prepareTemplate(*ba, "bitasset"); + } } } - } - if (curl && bulk.size() >= limit_documents) { // we are in bulk time, ready to add data to elasticsearech + if (curl && bulk.size() >= limit_documents) { // we are in bulk time, ready to add data to elasticsearech - graphene::utilities::ES es; - es.curl = curl; - es.bulk_lines = bulk; - es.elasticsearch_url = _es_objects_elasticsearch_url; - es.auth = _es_objects_auth; + graphene::utilities::ES es; + es.curl = curl; + es.bulk_lines = bulk; + es.elasticsearch_url = _es_objects_elasticsearch_url; + es.auth = _es_objects_auth; - if(!graphene::utilities::SendBulk(std::move(es))) - return false; - else - bulk.clear(); + if (!graphene::utilities::SendBulk(std::move(es))) + return false; + else + bulk.clear(); + } } return true; @@ -257,6 +257,7 @@ void es_objects_plugin::plugin_set_program_options( ("es-objects-asset-bitasset", boost::program_options::value(), "Store feed data(true)") ("es-objects-index-prefix", boost::program_options::value(), "Add a prefix to the index(objects-)") ("es-objects-keep-only-current", boost::program_options::value(), "Keep only current state of the objects(true)") + ("es-objects-start-es-after-block", boost::program_options::value(), "Start doing ES job after block(0)") ; cfg.add(cli); } @@ -319,6 +320,9 @@ void es_objects_plugin::plugin_initialize(const boost::program_options::variable if (options.count("es-objects-keep-only-current")) { my->_es_objects_keep_only_current = options["es-objects-keep-only-current"].as(); } + if (options.count("es-objects-start-es-after-block")) { + my->_es_objects_start_es_after_block = options["es-objects-start-es-after-block"].as(); + } } void es_objects_plugin::plugin_startup() From bc48dae42c22a038754dd183012f6f06fb147cef Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 25 Jan 2019 18:45:49 -0300 Subject: [PATCH 079/108] change cat-parts from old to active --- programs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/README.md b/programs/README.md index 794645c439..26b2b36886 100644 --- a/programs/README.md +++ b/programs/README.md @@ -16,7 +16,7 @@ Folder | Name | Description | Category | Status | Help [delayed_node](delayed_node) | Delayed Node | Runs a node with `delayed_node` plugin loaded. This is deprecated in favour of `./witness_node --plugins "delayed_node"`. | Node | Deprecated | `./delayed_node --help` [js_operation_serializer](js_operation_serializer) | Operation Serializer | Dump all blockchain operations and types. Used by the UI. | Tool | Old | `./js_operation_serializer` [size_checker](size_checker) | Size Checker | Return wire size average in bytes of all the operations. | Tool | Old | `./size_checker` -[cat-parts](build_helpers/cat-parts.cpp) | Cat parts | Used to create `hardfork.hpp` from individual files. | Tool | Old | `./cat-parts` +[cat-parts](build_helpers/cat-parts.cpp) | Cat parts | Used to create `hardfork.hpp` from individual files. | Tool | Active | `./cat-parts` [check_reflect](build_helpers/check_reflect.py) | Check reflect | Check reflected fields automatically(https://github.com/cryptonomex/graphene/issues/562) | Tool | Old | `doxygen;cp -rf doxygen programs/build_helpers; ./check_reflect.py` [member_enumerator](build_helpers/member_enumerator.cpp) | Member enumerator | | Tool | Deprecated | `./member_enumerator` [get_dev_key](genesis_util/get_dev_key.cpp) | Get Dev Key | Create public, private and address keys. Useful in private testnets, `genesis.json` files, new blockchain creation and others. | Tool | Active | `/programs/genesis_util/get_dev_key -h` From 95b4aa66bd8878b0df76d37ca26d4c5cfe3f13bc Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 26 Jan 2019 22:54:13 +0000 Subject: [PATCH 080/108] Rename API param operation_id to operation_type in order to reduce confusion, because we usually use "operation_type" to indicate the type of an operation, but use "operation_id" for operation_history_id_type. --- libraries/app/api.cpp | 6 +++--- libraries/app/include/graphene/app/api.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 61e9637a9f..8bd48b6df4 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -345,7 +345,7 @@ namespace graphene { namespace app { } vector history_api::get_account_history_operations( const std::string account_id_or_name, - int operation_id, + int operation_type, operation_history_id_type start, operation_history_id_type stop, unsigned limit) const @@ -368,7 +368,7 @@ namespace graphene { namespace app { { if( node->operation_id.instance.value <= start.instance.value ) { - if(node->operation_id(db).op.which() == operation_id) + if(node->operation_id(db).op.which() == operation_type) result.push_back( node->operation_id(db) ); } if( node->next == account_transaction_history_id_type() ) @@ -377,7 +377,7 @@ namespace graphene { namespace app { } if( stop.instance.value == 0 && result.size() < limit ) { auto head = db.find(account_transaction_history_id_type()); - if (head != nullptr && head->account == account && head->operation_id(db).op.which() == operation_id) + if (head != nullptr && head->account == account && head->operation_id(db).op.which() == operation_type) result.push_back(head->operation_id(db)); } return result; diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index af34bbaf73..54ed6bfc20 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -153,7 +153,7 @@ namespace graphene { namespace app { /** * @brief Get only asked operations relevant to the specified account * @param account_id_or_name The account ID or name whose history should be queried - * @param operation_id The ID of the operation we want to get operations in the account + * @param operation_type The type of the operation we want to get operations in the account * ( 0 = transfer , 1 = limit order create, ...) * @param stop ID of the earliest operation to retrieve * @param limit Maximum number of operations to retrieve (must not exceed 100) @@ -162,7 +162,7 @@ namespace graphene { namespace app { */ vector get_account_history_operations( const std::string account_id_or_name, - int operation_id, + int operation_type, operation_history_id_type start = operation_history_id_type(), operation_history_id_type stop = operation_history_id_type(), unsigned limit = 100 From aa469bc8e2210e2860fc9f77576819ecc7fbcc25 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sun, 27 Jan 2019 10:27:38 -0300 Subject: [PATCH 081/108] remove special case 0 for start after block in both ES plugins --- libraries/plugins/elasticsearch/elasticsearch_plugin.cpp | 4 ++-- libraries/plugins/es_objects/es_objects.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp index 6af2df19ac..dd29c38b39 100644 --- a/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp +++ b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp @@ -59,7 +59,7 @@ class elasticsearch_plugin_impl std::string _elasticsearch_basic_auth = ""; std::string _elasticsearch_index_prefix = "bitshares-"; bool _elasticsearch_operation_object = false; - uint32_t _elasticsearch_start_es_after_block = 0; // disabled + uint32_t _elasticsearch_start_es_after_block = 0; CURL *curl; // curl handler vector bulk_lines; // vector of op lines vector prepare; @@ -283,7 +283,7 @@ bool elasticsearch_plugin_impl::add_elasticsearch( const account_id_type account const auto &stats_obj = getStatsObject(account_id); const auto &ath = addNewEntry(stats_obj, account_id, oho); growStats(stats_obj, ath); - if(_elasticsearch_start_es_after_block == 0 || block_number > _elasticsearch_start_es_after_block) { + if(block_number > _elasticsearch_start_es_after_block) { createBulkLine(ath); prepareBulk(ath.id); } diff --git a/libraries/plugins/es_objects/es_objects.cpp b/libraries/plugins/es_objects/es_objects.cpp index d588fdbe21..10ee8ba473 100644 --- a/libraries/plugins/es_objects/es_objects.cpp +++ b/libraries/plugins/es_objects/es_objects.cpp @@ -63,7 +63,7 @@ class es_objects_plugin_impl bool _es_objects_limit_orders = true; bool _es_objects_asset_bitasset = true; std::string _es_objects_index_prefix = "objects-"; - uint32_t _es_objects_start_es_after_block = 0; // disabled + uint32_t _es_objects_start_es_after_block = 0; CURL *curl; // curl handler vector bulk; vector prepare; @@ -85,7 +85,7 @@ bool es_objects_plugin_impl::index_database( const vector& ids, block_time = db.head_block_time(); block_number = db.head_block_num(); - if(_es_objects_start_es_after_block == 0 || block_number > _es_objects_start_es_after_block) { + if(block_number > _es_objects_start_es_after_block) { // check if we are in replay or in sync and change number of bulk documents accordingly uint32_t limit_documents = 0; From 8aa3ebdefee4a20ce90f9e9031b45e5999912328 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Tue, 29 Jan 2019 18:41:24 +0100 Subject: [PATCH 082/108] Try to make docker build work again --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index fa58c2da1b..363460d2c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,7 @@ RUN \ git submodule update --init --recursive && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ + -DGRAPHENE_DISABLE_UNITY_BUILD=ON \ . && \ make witness_node cli_wallet && \ install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \ From 16206f90226fcf959686ad6a2eb4854997287c89 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Tue, 29 Jan 2019 18:41:53 +0100 Subject: [PATCH 083/108] Remove unused boost::serialization dependency --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 948d7412cb..e10b61ac92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,6 @@ LIST(APPEND BOOST_COMPONENTS thread system filesystem program_options - serialization chrono unit_test_framework context From b579a544be459df636db38181c1925c67ca41f77 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 29 Jan 2019 16:10:23 -0500 Subject: [PATCH 084/108] Implement API changes --- libraries/app/api.cpp | 31 +++++++++++++------ libraries/app/database_api.cpp | 5 +++ libraries/app/include/graphene/app/api.hpp | 26 +++++++++------- .../app/include/graphene/app/database_api.hpp | 7 +++++ libraries/wallet/wallet.cpp | 2 +- tests/tests/asset_api_tests.cpp | 4 +-- 6 files changed, 51 insertions(+), 24 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 8bd48b6df4..ff8c65e50a 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -101,7 +101,7 @@ namespace graphene { namespace app { } else if( api_name == "asset_api" ) { - _asset_api = std::make_shared< asset_api >( std::ref( *_app.chain_database() ) ); + _asset_api = std::make_shared< asset_api >( _app ); } else if( api_name == "orders_api" ) { @@ -284,10 +284,12 @@ namespace graphene { namespace app { return *_debug_api; } - vector history_api::get_fill_order_history( asset_id_type a, asset_id_type b, uint32_t limit )const + vector history_api::get_fill_order_history( std::string asset_a, std::string asset_b, uint32_t limit )const { FC_ASSERT(_app.chain_database()); const auto& db = *_app.chain_database(); + asset_id_type a = database_api.get_asset_id_from_string( asset_a ); + asset_id_type b = database_api.get_asset_id_from_string( asset_b ); if( a > b ) std::swap(a,b); const auto& history_idx = db.get_index_type().indices().get(); history_key hkey; @@ -443,11 +445,13 @@ namespace graphene { namespace app { return result; } - vector history_api::get_market_history( asset_id_type a, asset_id_type b, + vector history_api::get_market_history( std::string asset_a, std::string asset_b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const { try { FC_ASSERT(_app.chain_database()); const auto& db = *_app.chain_database(); + asset_id_type a = database_api.get_asset_id_from_string( asset_a ); + asset_id_type b = database_api.get_asset_id_from_string( asset_b ); vector result; result.reserve(200); @@ -467,7 +471,7 @@ namespace graphene { namespace app { ++itr; } return result; - } FC_CAPTURE_AND_RETHROW( (a)(b)(bucket_seconds)(start)(end) ) } + } FC_CAPTURE_AND_RETHROW( (asset_a)(asset_b)(bucket_seconds)(start)(end) ) } crypto_api::crypto_api(){}; @@ -526,12 +530,17 @@ namespace graphene { namespace app { } // asset_api - asset_api::asset_api(graphene::chain::database& db) : _db(db) { } + asset_api::asset_api(graphene::app::application& app) : + _db( *app.chain_database()), + database_api( std::ref(*app.chain_database()), &(app.get_options()) + ) { } asset_api::~asset_api() { } - vector asset_api::get_asset_holders( asset_id_type asset_id, uint32_t start, uint32_t limit ) const { + vector asset_api::get_asset_holders( std::string asset, uint32_t start, uint32_t limit ) const { FC_ASSERT(limit <= 100); + asset_id_type asset_id = database_api.get_asset_id_from_string( asset ); + const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >(); auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) ); @@ -562,9 +571,10 @@ namespace graphene { namespace app { return result; } // get number of asset holders. - int asset_api::get_asset_holders_count( asset_id_type asset_id ) const { + int asset_api::get_asset_holders_count( std::string asset ) const { const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >(); + asset_id_type asset_id = database_api.get_asset_id_from_string( asset ); auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) ); int count = boost::distance(range) - 1; @@ -607,8 +617,8 @@ namespace graphene { namespace app { return plugin->tracked_groups(); } - vector< limit_order_group > orders_api::get_grouped_limit_orders( asset_id_type base_asset_id, - asset_id_type quote_asset_id, + vector< limit_order_group > orders_api::get_grouped_limit_orders( std::string base_asset, + std::string quote_asset, uint16_t group, optional start, uint32_t limit )const @@ -619,6 +629,9 @@ namespace graphene { namespace app { const auto& limit_groups = plugin->limit_order_groups(); vector< limit_order_group > result; + asset_id_type base_asset_id = database_api.get_asset_id_from_string( base_asset ); + asset_id_type quote_asset_id = database_api.get_asset_id_from_string( quote_asset ); + price max_price = price::max( base_asset_id, quote_asset_id ); price min_price = price::min( base_asset_id, quote_asset_id ); if( start.valid() && !start->is_null() ) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index d37cf5989a..ee55fce992 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1109,6 +1109,11 @@ vector database_api_impl::get_vesting_balances( const st // // ////////////////////////////////////////////////////////////////////// +asset_id_type database_api::get_asset_id_from_string(const std::string& name_or_id)const +{ + return my->get_asset_from_string( name_or_id )->id; // safe? +} + vector> database_api::get_assets(const vector& asset_symbols_or_ids)const { return my->get_assets( asset_symbols_or_ids ); diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index 54ed6bfc20..9109c8c453 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -192,7 +192,7 @@ namespace graphene { namespace app { * @param limit Maximum records to return * @return a list of order_history objects, in "most recent first" order */ - vector get_fill_order_history( asset_id_type a, asset_id_type b, uint32_t limit )const; + vector get_fill_order_history( std::string a, std::string b, uint32_t limit )const; /** * @brief Get OHLCV data of a trading pair in a time range @@ -205,7 +205,7 @@ namespace graphene { namespace app { * @return A list of OHLCV data, in "least recent first" order. * If there are more than 200 records in the specified time range, the first 200 records will be returned. */ - vector get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds, + vector get_market_history( std::string a, std::string b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const; /** @@ -438,24 +438,24 @@ namespace graphene { namespace app { class asset_api { public: - asset_api(graphene::chain::database& db); + asset_api(graphene::app::application& app); ~asset_api(); /** * @brief Get asset holders for a specific asset - * @param asset_id The specific asset + * @param asset The specific asset id or name * @param start The start index * @param limit Maximum limit must not exceed 100 * @return A list of asset holders for the specified asset */ - vector get_asset_holders( asset_id_type asset_id, uint32_t start, uint32_t limit )const; + vector get_asset_holders( std::string asset, uint32_t start, uint32_t limit )const; /** * @brief Get asset holders count for a specific asset - * @param asset_id The specific asset + * @param asset The specific asset id or name * @return Holders count for the specified asset */ - int get_asset_holders_count( asset_id_type asset_id )const; + int get_asset_holders_count( std::string asset )const; /** * @brief Get all asset holders @@ -465,6 +465,7 @@ namespace graphene { namespace app { private: graphene::chain::database& _db; + graphene::app::database_api database_api; }; /** @@ -473,7 +474,7 @@ namespace graphene { namespace app { class orders_api { public: - orders_api(application& app):_app(app){} + orders_api(application& app):_app(app), database_api( std::ref(*app.chain_database()), &(app.get_options()) ){} //virtual ~orders_api() {} /** @@ -485,21 +486,22 @@ namespace graphene { namespace app { /** * @breif Get grouped limit orders in given market. * - * @param base_asset_id ID of asset being sold - * @param quote_asset_id ID of asset being purchased + * @param base_asset ID or name of asset being sold + * @param quote_asset ID or name of asset being purchased * @param group Maximum price diff within each order group, have to be one of configured values * @param start Optional price to indicate the first order group to retrieve * @param limit Maximum number of order groups to retrieve (must not exceed 101) * @return The grouped limit orders, ordered from best offered price to worst */ - vector< limit_order_group > get_grouped_limit_orders( asset_id_type base_asset_id, - asset_id_type quote_asset_id, + vector< limit_order_group > get_grouped_limit_orders( std::string base_asset, + std::string quote_asset, uint16_t group, optional start, uint32_t limit )const; private: application& _app; + graphene::app::database_api database_api; }; /** diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 772476a8e3..b5437556bc 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -373,6 +373,13 @@ class database_api // Assets // //////////// + /** + * @brief Get asset id from a name or ID + * @param name_or_id ID or name of the asset + * @return asset id + */ + asset_id_type get_asset_id_from_string(const std::string& name_or_id) const; + /** * @brief Get a list of assets by ID * @param asset_symbols_or_ids Symbol names or IDs of the assets to retrieve diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index c980fb7b0d..f57110ed99 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -3190,7 +3190,7 @@ vector wallet_api::get_market_history( fc::time_point_sec start, fc::time_point_sec end )const { - return my->_remote_hist->get_market_history( get_asset_id(symbol1), get_asset_id(symbol2), bucket, start, end ); + return my->_remote_hist->get_market_history( symbol1, symbol2, bucket, start, end ); } vector wallet_api::get_account_limit_orders( diff --git a/tests/tests/asset_api_tests.cpp b/tests/tests/asset_api_tests.cpp index 332f1b13b4..ff3eeb9785 100644 --- a/tests/tests/asset_api_tests.cpp +++ b/tests/tests/asset_api_tests.cpp @@ -37,7 +37,7 @@ BOOST_FIXTURE_TEST_SUITE(asset_api_tests, database_fixture) BOOST_AUTO_TEST_CASE( asset_holders ) { - graphene::app::asset_api asset_api(db); + graphene::app::asset_api asset_api(app); // create an asset and some accounts create_bitasset("USD", account_id_type()); @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE( asset_holders ) transfer(account_id_type()(db), bob, asset(300)); // make call - vector holders = asset_api.get_asset_holders(asset_id_type(), 0, 100); + vector holders = asset_api.get_asset_holders( std::string( static_cast(asset_id_type())), 0, 100); BOOST_CHECK_EQUAL(holders.size(), 4u); // by now we can guarantee the order From 4c0062cb552eed801250767fee37ccd71eb5bb51 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Tue, 29 Jan 2019 21:38:11 +0100 Subject: [PATCH 085/108] Try to avoid travis timeouts better --- .travis.yml | 24 +++++------ programs/build_helpers/buildstep | 55 ++++++++++++++++++++++++++ programs/build_helpers/make_with_sonar | 8 ++++ 3 files changed, 76 insertions(+), 11 deletions(-) create mode 100755 programs/build_helpers/buildstep create mode 100755 programs/build_helpers/make_with_sonar diff --git a/.travis.yml b/.travis.yml index 236fa6ef78..7225d9d669 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,16 +27,18 @@ env: - CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros script: - - 'echo $((`date +%s` - 120)) >_start_time' + - programs/build_helpers/buildstep -s 3450 - ccache -s - - '( [ `ccache -s | grep "files in cache" | cut -c 20-` = 0 ] && touch _empty_cache ) || true' - - sed -i '/tests/d' libraries/fc/CMakeLists.txt - - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON . - - 'which build-wrapper-linux-x86-64 && build-wrapper-linux-x86-64 --out-dir bw-output make -j 2 cli_wallet witness_node chain_test cli_test || make -j 2 cli_wallet witness_node chain_test cli_test' + - programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt" + - programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ." + - programs/build_helpers/buildstep make.cli_wallet 2600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet" + - programs/build_helpers/buildstep make.witness_node 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node" + - programs/build_helpers/buildstep make.chain_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test" + - programs/build_helpers/buildstep make.cli_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test" - set -o pipefail - - '[ $((`date +%s` - `cat _start_time`)) -gt $((42 * 60)) ] && touch _empty_cache || true' - - '[ -r _empty_cache ] || tests/chain_test 2>&1 | cat' - - '[ -r _empty_cache ] || tests/cli_test 2>&1 | cat' - - 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null' - - '[ -r _empty_cache ] || ( which sonar-scanner && sonar-scanner || true )' - - '[ ! -r _empty_cache ] || ( echo "WARNING! Skipped some tests due to compile time! Please restart with populated cache." && false )' + - programs/build_helpers/buildstep run.chain_test 240 "tests/chain_test 2>&1 | cat" + - programs/build_helpers/buildstep run.cli_test 30 "tests/cli_test 2>&1 | cat" + - programs/build_helpers/buildstep prepare.sonar 20 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null' + - programs/build_helpers/buildstep run.sonar 1600 "which sonar-scanner && sonar-scanner || true" + - programs/build_helpers/buildstep end 0 + - ccache -s diff --git a/programs/build_helpers/buildstep b/programs/build_helpers/buildstep new file mode 100755 index 0000000000..35c164aabe --- /dev/null +++ b/programs/build_helpers/buildstep @@ -0,0 +1,55 @@ +#!/bin/sh + +usage () { + echo Usage: + echo " ${0##*/} [-h | --help] Display this help message" + echo " ${0##*/} -s | --start Initialize timing" + echo " ${0##*/} " + echo "The last form executes build step consisting of shell " + echo "if imated time is still available, otherwise it fails fast." + echo " and must be specified in seconds." + exit $1 +} + +if [ "$#" = 0 -o "$1" = "--help" -o "$1" = "-h" ]; then + usage `test "$#" = 1; echo $?` +fi + +NOW="$(date +%s)" + +if [ "$1" = "--start" -o "$1" = "-s" ]; then + if [ "$#" != 2 ]; then + usage 1 + fi + echo "$2 $NOW" >_start_time + echo "Starting at $(date --date=@$NOW)" + exit 0 +fi + +NAME="$1" +EST="$2" +CMD="$3" + +if [ ! -r _start_time ]; then + echo "Need to initialize with '$0 -s ' first!" 1>&2 + exit 1 +fi + +read max begin prev_name prev_begin <_start_time + +if [ "$prev_name" != "" ]; then + echo "'$prev_name' took $(($NOW - $prev_begin))s" +fi + +if [ "$CMD" != "" ]; then + if [ $(($NOW - $begin + $EST)) -lt $max ]; then + echo "Running '$NAME' at $NOW..." + echo "sh -c '$CMD'" + echo "$max $begin $NAME $NOW" >_start_time + exec sh -c "$CMD" + fi + echo "$(($begin + $max - $NOW))s left - insufficient to run '$NAME', exiting!" 1>&2 + exit 1 +fi + +exit 0 diff --git a/programs/build_helpers/make_with_sonar b/programs/build_helpers/make_with_sonar new file mode 100755 index 0000000000..a91470adf5 --- /dev/null +++ b/programs/build_helpers/make_with_sonar @@ -0,0 +1,8 @@ +#!/bin/sh + +OUT_DIR="$1" +shift +if which build-wrapper-linux-x86-64 >/dev/null; then + exec build-wrapper-linux-x86-64 --out-dir "$OUT_DIR" make "$@" +fi +exec make "$@" From f7212d76d102e74cbf89134cd57628723efe1e57 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 13:18:57 +0100 Subject: [PATCH 086/108] Try to resolve "Bad substitution" error --- programs/build_helpers/buildstep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/build_helpers/buildstep b/programs/build_helpers/buildstep index 35c164aabe..44d5458a10 100755 --- a/programs/build_helpers/buildstep +++ b/programs/build_helpers/buildstep @@ -46,7 +46,7 @@ if [ "$CMD" != "" ]; then echo "Running '$NAME' at $NOW..." echo "sh -c '$CMD'" echo "$max $begin $NAME $NOW" >_start_time - exec sh -c "$CMD" + exec bash -c "$CMD" fi echo "$(($begin + $max - $NOW))s left - insufficient to run '$NAME', exiting!" 1>&2 exit 1 From a4211b6a9858948a3ffea9a8b889d5dd51787e44 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 13:51:30 +0100 Subject: [PATCH 087/108] Removed unused boost-locale dependency --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e10b61ac92..1944af4dcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,8 +50,7 @@ LIST(APPEND BOOST_COMPONENTS thread program_options chrono unit_test_framework - context - locale) + context) SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" ) IF( WIN32 ) From f5cd910197d8e3e0aa4d95cfa7a84c2741176f8a Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 13:52:05 +0100 Subject: [PATCH 088/108] Only install required boost packages, not all - should remove locale and signals after fc bump --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7225d9d669..5c1ee0e064 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ sudo: true install: - echo "deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list - sudo apt-get update - - sudo apt-get install --allow-unauthenticated g++ libboost-all-dev cmake libreadline-dev libssl-dev autoconf parallel ccache + - sudo apt-get install --allow-unauthenticated g++ libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-locale-dev libboost-signals-dev libboost-coroutine-dev cmake libssl-dev autoconf parallel ccache addons: sonarcloud: From da0dba2b832d2e08ee7045c1577155bd8fd0bac6 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 13:58:57 +0100 Subject: [PATCH 089/108] Build more stuff, run tests in parallel --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c1ee0e064..b7da9ce30b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,11 +33,14 @@ script: - programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ." - programs/build_helpers/buildstep make.cli_wallet 2600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet" - programs/build_helpers/buildstep make.witness_node 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node" + - programs/build_helpers/buildstep make.serializer 20 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer" + - programs/build_helpers/buildstep make.get_dev_key 20 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key" - programs/build_helpers/buildstep make.chain_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test" - programs/build_helpers/buildstep make.cli_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test" + - programs/build_helpers/buildstep make.perf_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test" - set -o pipefail - - programs/build_helpers/buildstep run.chain_test 240 "tests/chain_test 2>&1 | cat" - - programs/build_helpers/buildstep run.cli_test 30 "tests/cli_test 2>&1 | cat" + - programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test" + - programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test" - programs/build_helpers/buildstep prepare.sonar 20 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null' - programs/build_helpers/buildstep run.sonar 1600 "which sonar-scanner && sonar-scanner || true" - programs/build_helpers/buildstep end 0 From d589b5b4bc93abb435f1d44136068950077c8a1a Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 15:18:13 +0100 Subject: [PATCH 090/108] Minor Dockerfile improvements --- Dockerfile | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 363460d2c5..25727cf1ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,16 +10,26 @@ RUN \ cmake \ git \ libbz2-dev \ - libreadline-dev \ - libboost-all-dev \ libcurl4-openssl-dev \ libssl-dev \ libncurses-dev \ + libboost-thread-dev \ + libboost-iostreams-dev \ + libboost-date-time-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev \ + libboost-chrono-dev \ + libboost-test-dev \ + libboost-context-dev \ + libboost-regex-dev \ + libboost-locale-dev \ + libboost-signals-dev \ + libboost-coroutine-dev \ doxygen \ ca-certificates \ + fish \ && \ - apt-get update -y && \ - apt-get install -y fish && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* @@ -40,8 +50,8 @@ RUN \ -DCMAKE_BUILD_TYPE=Release \ -DGRAPHENE_DISABLE_UNITY_BUILD=ON \ . && \ - make witness_node cli_wallet && \ - install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \ + make witness_node cli_wallet get_dev_key && \ + install -s programs/witness_node/witness_node programs/genesis_util/get_dev_key programs/cli_wallet/cli_wallet /usr/local/bin && \ # # Obtain version mkdir /etc/bitshares && \ From fb61b93a96221a0e9440f29b57761464d1159f94 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 15:21:42 +0100 Subject: [PATCH 091/108] travis: switch to xenial build env --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b7da9ce30b..5354f2aa39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,12 @@ cache: ccache git: depth: 1 -dist: trusty +dist: xenial sudo: true install: - - echo "deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list - - sudo apt-get update - - sudo apt-get install --allow-unauthenticated g++ libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-locale-dev libboost-signals-dev libboost-coroutine-dev cmake libssl-dev autoconf parallel ccache + - sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-locale-dev libboost-signals-dev libboost-coroutine-dev cmake parallel addons: sonarcloud: From dbd7eee97bb1bb3cd51cd7b192c0a3ad6c64a28c Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 17:14:28 +0100 Subject: [PATCH 092/108] Modified build time expectations --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5354f2aa39..ec5c8b7c24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,17 +25,17 @@ env: - CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros script: - - programs/build_helpers/buildstep -s 3450 + - programs/build_helpers/buildstep -s 3500 - ccache -s - programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt" - programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ." - - programs/build_helpers/buildstep make.cli_wallet 2600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet" - - programs/build_helpers/buildstep make.witness_node 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node" - - programs/build_helpers/buildstep make.serializer 20 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer" - - programs/build_helpers/buildstep make.get_dev_key 20 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key" - - programs/build_helpers/buildstep make.chain_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test" - - programs/build_helpers/buildstep make.cli_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test" - - programs/build_helpers/buildstep make.perf_test 1800 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test" + - programs/build_helpers/buildstep make.cli_wallet 1600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet" + - programs/build_helpers/buildstep make.witness_node 300 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node" + - programs/build_helpers/buildstep make.serializer 45 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer" + - programs/build_helpers/buildstep make.get_dev_key 10 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key" + - programs/build_helpers/buildstep make.chain_test 900 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test" + - programs/build_helpers/buildstep make.cli_test 200 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test" + - programs/build_helpers/buildstep make.perf_test 120 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test" - set -o pipefail - programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test" - programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test" From 62db8bf0e9e7391cb31e0201cd95f6dc0aecd8bf Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 17:40:07 +0100 Subject: [PATCH 093/108] Bumped fc + removed unused boost libs from travis + docker --- .travis.yml | 2 +- Dockerfile | 2 -- libraries/fc | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec5c8b7c24..eb1f3bc737 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ dist: xenial sudo: true install: - - sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-locale-dev libboost-signals-dev libboost-coroutine-dev cmake parallel + - sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-coroutine-dev cmake parallel addons: sonarcloud: diff --git a/Dockerfile b/Dockerfile index 25727cf1ac..6e36fd35c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,6 @@ RUN \ libboost-test-dev \ libboost-context-dev \ libboost-regex-dev \ - libboost-locale-dev \ - libboost-signals-dev \ libboost-coroutine-dev \ doxygen \ ca-certificates \ diff --git a/libraries/fc b/libraries/fc index 0468884ea6..9e6c5ab6e2 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 0468884ea675afe3a16ffc61371672fecf6e7dde +Subproject commit 9e6c5ab6e2860a29bac0ef077bbd8a39b99b5971 From 708f01757d9cd6307ab3eb188bf24aa29b59d9e7 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 22:35:17 +0100 Subject: [PATCH 094/108] Install libtool in docker build --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 6e36fd35c9..25fe0bb418 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ RUN \ libboost-context-dev \ libboost-regex-dev \ libboost-coroutine-dev \ + libtool \ doxygen \ ca-certificates \ fish \ From e1eb934154f6add9b52dd2b59f4e10d14c665826 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 30 Jan 2019 22:36:02 +0100 Subject: [PATCH 095/108] travis: adjust expected sonar time --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb1f3bc737..76424128a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,6 @@ script: - programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test" - programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test" - programs/build_helpers/buildstep prepare.sonar 20 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null' - - programs/build_helpers/buildstep run.sonar 1600 "which sonar-scanner && sonar-scanner || true" + - programs/build_helpers/buildstep run.sonar 400 "which sonar-scanner && sonar-scanner || true" - programs/build_helpers/buildstep end 0 - ccache -s From 052531b4998d3fd42d976d8546bd8e734a51f657 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 31 Jan 2019 17:33:25 -0300 Subject: [PATCH 096/108] refactor get_top_markets --- libraries/app/database_api.cpp | 131 ++++++++++-------- .../app/include/graphene/app/database_api.hpp | 12 +- 2 files changed, 80 insertions(+), 63 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 28182fd08d..61c85d19e7 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -121,7 +121,9 @@ class database_api_impl : public std::enable_shared_from_this market_ticker get_ticker( const string& base, const string& quote, bool skip_order_book = false )const; market_volume get_24_volume( const string& base, const string& quote )const; order_book get_order_book( const string& base, const string& quote, unsigned limit = 50 )const; - vector get_top_markets(uint32_t limit)const; + vector get_top_markets(uint32_t limit)const; + market_ticker build_ticker(const market_ticker_object& mto) const; + market_ticker append_orderbook_to_ticker(market_ticker& ticker) const; vector get_trade_history( const string& base, const string& quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit = 100 )const; vector get_trade_history_by_sequence( const string& base, const string& quote, int64_t start, fc::time_point_sec stop, unsigned limit = 100 )const; @@ -310,6 +312,47 @@ database_api_impl::~database_api_impl() elog("freeing database api ${x}", ("x",int64_t(this)) ); } +////////////////////////////////////////////////////////////////////// +// // +// Market ticker constructor // +// // +////////////////////////////////////////////////////////////////////// +market_ticker::market_ticker(const market_ticker_object& mto, + const fc::time_point_sec& now, + const asset_object& asset_base, + const asset_object& asset_quote) +{ + time = now; + base = asset_base.symbol; + quote = asset_quote.symbol; + fc::uint128 bv; + fc::uint128 qv; + price latest_price = asset( mto.latest_base, mto.base ) / asset( mto.latest_quote, mto.quote ); + if( mto.base != asset_base.id ) + latest_price = ~latest_price; + latest = database_api_impl::price_to_string( latest_price, asset_base, asset_quote ); + if( mto.last_day_base != 0 && mto.last_day_quote != 0 // has trade data before 24 hours + && ( mto.last_day_base != mto.latest_base || mto.last_day_quote != mto.latest_quote ) ) // price changed + { + price last_day_price = asset( mto.last_day_base, mto.base ) / asset( mto.last_day_quote, mto.quote ); + if( mto.base != asset_base.id ) + last_day_price = ~last_day_price; + percent_change = price_diff_percent_string( last_day_price, latest_price ); + } + if( asset_base.id == mto.base ) + { + bv = mto.base_volume; + qv = mto.quote_volume; + } + else + { + bv = mto.quote_volume; + qv = mto.base_volume; + } + base_volume = uint128_amount_to_string( bv, asset_base.precision ); + quote_volume = uint128_amount_to_string( qv, asset_quote.precision ); +} + ////////////////////////////////////////////////////////////////////// // // // Objects // @@ -1302,66 +1345,25 @@ market_ticker database_api_impl::get_ticker( const string& base, const string& q FC_ASSERT( _app_options && _app_options->has_market_history_plugin, "Market history plugin is not enabled." ); const auto assets = lookup_asset_symbols( {base, quote} ); + FC_ASSERT( assets[0], "Invalid base asset symbol: ${s}", ("s",base) ); FC_ASSERT( assets[1], "Invalid quote asset symbol: ${s}", ("s",quote) ); - const fc::time_point_sec now = _db.head_block_time(); - - market_ticker result; - result.time = now; - result.base = base; - result.quote = quote; - result.latest = "0"; - result.lowest_ask = "0"; - result.highest_bid = "0"; - result.percent_change = "0"; - auto base_id = assets[0]->id; auto quote_id = assets[1]->id; if( base_id > quote_id ) std::swap( base_id, quote_id ); - - fc::uint128 base_volume; - fc::uint128 quote_volume; - const auto& ticker_idx = _db.get_index_type().indices().get(); auto itr = ticker_idx.find( std::make_tuple( base_id, quote_id ) ); + market_ticker ticker; if( itr != ticker_idx.end() ) { - price latest_price = asset( itr->latest_base, itr->base ) / asset( itr->latest_quote, itr->quote ); - if( itr->base != assets[0]->id ) - latest_price = ~latest_price; - result.latest = price_to_string( latest_price, *assets[0], *assets[1] ); - if( itr->last_day_base != 0 && itr->last_day_quote != 0 // has trade data before 24 hours - && ( itr->last_day_base != itr->latest_base || itr->last_day_quote != itr->latest_quote ) ) // price changed - { - price last_day_price = asset( itr->last_day_base, itr->base ) / asset( itr->last_day_quote, itr->quote ); - if( itr->base != assets[0]->id ) - last_day_price = ~last_day_price; - result.percent_change = price_diff_percent_string( last_day_price, latest_price ); - } - if( assets[0]->id == itr->base ) - { - base_volume = itr->base_volume; - quote_volume = itr->quote_volume; - } - else - { - base_volume = itr->quote_volume; - quote_volume = itr->base_volume; - } + ticker = build_ticker(*itr); } - - result.base_volume = uint128_amount_to_string( base_volume, assets[0]->precision ); - result.quote_volume = uint128_amount_to_string( quote_volume, assets[1]->precision ); - if( !skip_order_book ) { - const auto orders = get_order_book( base, quote, 1 ); - if( !orders.asks.empty() ) result.lowest_ask = orders.asks[0].price; - if( !orders.bids.empty() ) result.highest_bid = orders.bids[0].price; + return append_orderbook_to_ticker(ticker); } - - return result; + return ticker; } market_volume database_api::get_24_volume( const string& base, const string& quote )const @@ -1428,12 +1430,12 @@ order_book database_api_impl::get_order_book( const string& base, const string& return result; } -vector database_api::get_top_markets(uint32_t limit)const +vector database_api::get_top_markets(uint32_t limit)const { return my->get_top_markets(limit); } -vector database_api_impl::get_top_markets(uint32_t limit)const +vector database_api_impl::get_top_markets(uint32_t limit)const { FC_ASSERT( _app_options && _app_options->has_market_history_plugin, "Market history plugin is not enabled." ); @@ -1441,25 +1443,34 @@ vector database_api_impl::get_top_markets(uint32_t limit)const const auto& volume_idx = _db.get_index_type().indices().get(); auto itr = volume_idx.rbegin(); - vector result; + vector result; result.reserve(limit); - const fc::time_point_sec now = fc::time_point::now(); - while( itr != volume_idx.rend() && result.size() < limit) { - market_volume mv; - mv.time = now; - const auto assets = get_assets( { itr->base, itr->quote } ); - mv.base = assets[0]->symbol; - mv.quote = assets[1]->symbol; - mv.base_volume = uint128_amount_to_string( itr->base_volume, assets[0]->precision ); - mv.quote_volume = uint128_amount_to_string( itr->quote_volume, assets[1]->precision ); - result.emplace_back( std::move(mv) ); + auto ticker = build_ticker(*itr); + result.emplace_back( append_orderbook_to_ticker(ticker) ); ++itr; } return result; } +market_ticker database_api_impl::build_ticker(const market_ticker_object& mto) const +{ + const auto& assets = get_assets( { mto.base, mto.quote } ); + const fc::time_point_sec now = _db.head_block_time(); + market_ticker ticker(mto, now, *assets[0], *assets[1]); + return ticker; +} + +market_ticker database_api_impl::append_orderbook_to_ticker(market_ticker& ticker) const +{ + const auto& orders = get_order_book(ticker.base, ticker.quote, 1); + if (!orders.asks.empty()) + ticker.lowest_ask = orders.asks[0].price; + if (!orders.bids.empty()) + ticker.highest_bid = orders.bids[0].price; + return ticker; +} vector database_api::get_trade_history( const string& base, const string& quote, diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 506b427597..6ca261ac68 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -90,6 +90,12 @@ struct market_ticker string percent_change; string base_volume; string quote_volume; + + market_ticker() {} + market_ticker(const market_ticker_object& mto, + const fc::time_point_sec& now, + const asset_object& asset_base, + const asset_object& asset_quote); }; struct market_volume @@ -493,12 +499,12 @@ class database_api order_book get_order_book( const string& base, const string& quote, unsigned limit = 50 )const; /** - * @brief Returns vector of 24 hour volume markets sorted by reverse base_volume + * @brief Returns vector of tickers sorted by reverse base_volume * Note: this API is experimental and subject to change in next releases * @param limit Max number of results - * @return Desc Sorted volume vector + * @return Desc Sorted ticker vector */ - vector get_top_markets(uint32_t limit)const; + vector get_top_markets(uint32_t limit)const; /** * @brief Returns recent trades for the market base:quote, ordered by time, most recent first. From c0ac89825f3b4995c5364b3b93f8b7c430b31b59 Mon Sep 17 00:00:00 2001 From: John Jones Date: Fri, 1 Feb 2019 11:46:26 -0500 Subject: [PATCH 097/108] Moved impl to fee_schedule.hpp --- libraries/app/api.cpp | 1 - libraries/app/application.cpp | 2 -- libraries/app/database_api.cpp | 1 - libraries/chain/account_evaluator.cpp | 2 -- libraries/chain/block_database.cpp | 1 - libraries/chain/committee_member_evaluator.cpp | 2 -- libraries/chain/confidential_evaluator.cpp | 2 -- libraries/chain/database.cpp | 1 - libraries/chain/db_block.cpp | 1 - libraries/chain/db_getter.cpp | 2 -- libraries/chain/db_init.cpp | 1 - libraries/chain/db_maint.cpp | 1 - libraries/chain/genesis_state.cpp | 3 +-- .../chain/include/graphene/chain/protocol/fee_schedule.hpp | 1 + libraries/chain/market_evaluator.cpp | 1 - libraries/chain/proposal_evaluator.cpp | 2 -- libraries/chain/protocol/fee_schedule.cpp | 1 - libraries/chain/protocol/proposal.cpp | 1 - libraries/chain/protocol/transaction.cpp | 1 - libraries/egenesis/embed_genesis.cpp | 1 - libraries/net/node.cpp | 1 - libraries/plugins/account_history/account_history_plugin.cpp | 1 - libraries/plugins/debug_witness/debug_api.cpp | 1 - libraries/plugins/debug_witness/debug_witness.cpp | 1 - libraries/plugins/delayed_node/delayed_node_plugin.cpp | 2 -- libraries/plugins/elasticsearch/elasticsearch_plugin.cpp | 1 - libraries/plugins/es_objects/es_objects.cpp | 2 -- libraries/plugins/market_history/market_history_plugin.cpp | 1 - libraries/plugins/witness/witness.cpp | 1 - libraries/wallet/wallet.cpp | 1 - programs/build_helpers/member_enumerator.cpp | 1 - programs/cli_wallet/main.cpp | 1 - programs/genesis_util/genesis_update.cpp | 1 - programs/js_operation_serializer/main.cpp | 1 - programs/size_checker/main.cpp | 1 - tests/app/main.cpp | 1 - tests/benchmarks/genesis_allocation.cpp | 1 - tests/cli/main.cpp | 1 - tests/common/database_fixture.cpp | 1 - tests/common/database_fixture.hpp | 1 - tests/generate_empty_blocks/main.cpp | 1 - tests/tests/fee_tests.cpp | 1 - 42 files changed, 2 insertions(+), 50 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 61e9637a9f..394d48e83b 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -37,7 +37,6 @@ #include #include -#include #include namespace graphene { namespace app { diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index f2cf80285d..9133bc1618 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -39,8 +39,6 @@ #include #include -#include - #include #include #include diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index f067a101e8..12227788d5 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/libraries/chain/account_evaluator.cpp b/libraries/chain/account_evaluator.cpp index 086953dcfb..98e0766652 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/block_database.cpp b/libraries/chain/block_database.cpp index 8ec20dcc13..c5fa6636a8 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 4e7eb827e5..b01fa95faa 100644 --- a/libraries/chain/committee_member_evaluator.cpp +++ b/libraries/chain/committee_member_evaluator.cpp @@ -29,8 +29,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 9323d2d9ba..9946b492d0 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 2d02b1840e..788a29f008 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_block.cpp" #include "db_debug.cpp" diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index fdf4b4a15e..095a6114ce 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -38,7 +38,6 @@ #include #include -#include namespace graphene { namespace chain { diff --git a/libraries/chain/db_getter.cpp b/libraries/chain/db_getter.cpp index 4b4c0ee10d..0de635c0e5 100644 --- a/libraries/chain/db_getter.cpp +++ b/libraries/chain/db_getter.cpp @@ -28,8 +28,6 @@ #include #include -#include - namespace graphene { namespace chain { const asset_object& database::get_core_asset() const diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index fe69967382..884a7b3c91 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -64,7 +64,6 @@ #include -#include #include #include diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 4ee7cb2825..2fdfa0f401 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/genesis_state.cpp b/libraries/chain/genesis_state.cpp index a278b68005..7c53c36ae3 100644 --- a/libraries/chain/genesis_state.cpp +++ b/libraries/chain/genesis_state.cpp @@ -24,8 +24,7 @@ #include -// these are required to serialize a genesis_state -#include // required for gcc in release mode +// this is required to serialize a genesis_state #include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp b/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp index a08ee98a2c..388dada2b0 100644 --- a/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp +++ b/libraries/chain/include/graphene/chain/protocol/fee_schedule.hpp @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #pragma once +#include #include namespace graphene { namespace chain { diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 62dfc7c7b4..5f380bc259 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 fce7fd2a35..348629d9ba 100644 --- a/libraries/chain/proposal_evaluator.cpp +++ b/libraries/chain/proposal_evaluator.cpp @@ -26,8 +26,6 @@ #include #include -#include - namespace graphene { namespace chain { diff --git a/libraries/chain/protocol/fee_schedule.cpp b/libraries/chain/protocol/fee_schedule.cpp index 649f90dff4..c52c229768 100644 --- a/libraries/chain/protocol/fee_schedule.cpp +++ b/libraries/chain/protocol/fee_schedule.cpp @@ -23,7 +23,6 @@ */ #include #include -#include namespace fc { diff --git a/libraries/chain/protocol/proposal.cpp b/libraries/chain/protocol/proposal.cpp index 54fd728bbd..7d072e4a90 100644 --- a/libraries/chain/protocol/proposal.cpp +++ b/libraries/chain/protocol/proposal.cpp @@ -23,7 +23,6 @@ */ #include #include -#include namespace graphene { namespace chain { diff --git a/libraries/chain/protocol/transaction.cpp b/libraries/chain/protocol/transaction.cpp index 1a1293ca76..b642dea72e 100644 --- a/libraries/chain/protocol/transaction.cpp +++ b/libraries/chain/protocol/transaction.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include namespace graphene { namespace chain { diff --git a/libraries/egenesis/embed_genesis.cpp b/libraries/egenesis/embed_genesis.cpp index 1eab728345..6854e9f6d3 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 612529f93c..b2fc5009b7 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -69,7 +69,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 59f238c43a..4697837faa 100644 --- a/libraries/plugins/account_history/account_history_plugin.cpp +++ b/libraries/plugins/account_history/account_history_plugin.cpp @@ -34,7 +34,6 @@ #include #include -#include #include namespace graphene { namespace account_history { diff --git a/libraries/plugins/debug_witness/debug_api.cpp b/libraries/plugins/debug_witness/debug_api.cpp index 823755f594..43ffd6cd38 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 66ef2f58ec..7268006d3b 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 0329d018b2..c56f8bb6b3 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/elasticsearch/elasticsearch_plugin.cpp b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp index 6af2df19ac..ab5f396dff 100644 --- a/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp +++ b/libraries/plugins/elasticsearch/elasticsearch_plugin.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/libraries/plugins/es_objects/es_objects.cpp b/libraries/plugins/es_objects/es_objects.cpp index 5695064325..1db0febc71 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/market_history/market_history_plugin.cpp b/libraries/plugins/market_history/market_history_plugin.cpp index 004c3891b3..f6948dc59e 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/witness/witness.cpp b/libraries/plugins/witness/witness.cpp index 5bebefb75f..af2101e9ea 100644 --- a/libraries/plugins/witness/witness.cpp +++ b/libraries/plugins/witness/witness.cpp @@ -28,7 +28,6 @@ #include -#include #include #include diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index ac33c180e9..db2a7e85ed 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -72,7 +72,6 @@ #include #include #include -#include #ifndef WIN32 # include diff --git a/programs/build_helpers/member_enumerator.cpp b/programs/build_helpers/member_enumerator.cpp index 16452c5bf8..53d1169037 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 88c027a20e..2a949417ae 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 6a4d28cd28..7e251de8a7 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 e955f8d7fa..db170a0280 100644 --- a/programs/js_operation_serializer/main.cpp +++ b/programs/js_operation_serializer/main.cpp @@ -37,7 +37,6 @@ #include #include -#include #include using namespace graphene::chain; diff --git a/programs/size_checker/main.cpp b/programs/size_checker/main.cpp index d6853d108f..72d7d85f85 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 b68cdf78a0..6a16163ea2 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 a17a16fa8e..63e75db568 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/cli/main.cpp b/tests/cli/main.cpp index 393dce4d83..ea191e892c 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index a77854cd22..ed850cf7cf 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -41,7 +41,6 @@ #include #include -#include #include diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index eceba6876b..dac219d69e 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/tests/generate_empty_blocks/main.cpp b/tests/generate_empty_blocks/main.cpp index ec399ea0d2..721747eef2 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 587814815c..7943be62a0 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ -#include #include #include From 04f20af8333390416944e602c0380315ca4f7a88 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 1 Feb 2019 18:27:44 -0300 Subject: [PATCH 098/108] refactor for in-place construction --- libraries/app/database_api.cpp | 52 ++++++++----------- .../app/include/graphene/app/database_api.hpp | 3 +- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 61c85d19e7..8c9f8bf215 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -121,9 +121,7 @@ class database_api_impl : public std::enable_shared_from_this market_ticker get_ticker( const string& base, const string& quote, bool skip_order_book = false )const; market_volume get_24_volume( const string& base, const string& quote )const; order_book get_order_book( const string& base, const string& quote, unsigned limit = 50 )const; - vector get_top_markets(uint32_t limit)const; - market_ticker build_ticker(const market_ticker_object& mto) const; - market_ticker append_orderbook_to_ticker(market_ticker& ticker) const; + vector get_top_markets( uint32_t limit )const; vector get_trade_history( const string& base, const string& quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit = 100 )const; vector get_trade_history_by_sequence( const string& base, const string& quote, int64_t start, fc::time_point_sec stop, unsigned limit = 100 )const; @@ -320,7 +318,8 @@ database_api_impl::~database_api_impl() market_ticker::market_ticker(const market_ticker_object& mto, const fc::time_point_sec& now, const asset_object& asset_base, - const asset_object& asset_quote) + const asset_object& asset_quote, + const order_book& orders) { time = now; base = asset_base.symbol; @@ -351,6 +350,11 @@ market_ticker::market_ticker(const market_ticker_object& mto, } base_volume = uint128_amount_to_string( bv, asset_base.precision ); quote_volume = uint128_amount_to_string( qv, asset_quote.precision ); + + if(!orders.asks.empty()) + lowest_ask = orders.asks[0].price; + if(!orders.bids.empty()) + highest_bid = orders.bids[0].price; } ////////////////////////////////////////////////////////////////////// @@ -1354,16 +1358,16 @@ market_ticker database_api_impl::get_ticker( const string& base, const string& q if( base_id > quote_id ) std::swap( base_id, quote_id ); const auto& ticker_idx = _db.get_index_type().indices().get(); auto itr = ticker_idx.find( std::make_tuple( base_id, quote_id ) ); - market_ticker ticker; + const fc::time_point_sec now = _db.head_block_time(); if( itr != ticker_idx.end() ) { - ticker = build_ticker(*itr); - } - if( !skip_order_book ) - { - return append_orderbook_to_ticker(ticker); + order_book orders; + if (!skip_order_book) + { + orders = get_order_book(assets[0]->symbol, assets[1]->symbol, 1); + } + return market_ticker(*itr, now, *assets[0], *assets[1], orders);; } - return ticker; } market_volume database_api::get_24_volume( const string& base, const string& quote )const @@ -1445,32 +1449,20 @@ vector database_api_impl::get_top_markets(uint32_t limit)const auto itr = volume_idx.rbegin(); vector result; result.reserve(limit); + const fc::time_point_sec now = _db.head_block_time(); while( itr != volume_idx.rend() && result.size() < limit) { - auto ticker = build_ticker(*itr); - result.emplace_back( append_orderbook_to_ticker(ticker) ); + const asset_object base = itr->base(_db); + const asset_object quote = itr->quote(_db); + order_book orders; + orders = get_order_book(base.symbol, quote.symbol, 1); + + result.emplace_back(market_ticker(*itr, now, base, quote, orders)); ++itr; } return result; } -market_ticker database_api_impl::build_ticker(const market_ticker_object& mto) const -{ - const auto& assets = get_assets( { mto.base, mto.quote } ); - const fc::time_point_sec now = _db.head_block_time(); - market_ticker ticker(mto, now, *assets[0], *assets[1]); - return ticker; -} - -market_ticker database_api_impl::append_orderbook_to_ticker(market_ticker& ticker) const -{ - const auto& orders = get_order_book(ticker.base, ticker.quote, 1); - if (!orders.asks.empty()) - ticker.lowest_ask = orders.asks[0].price; - if (!orders.bids.empty()) - ticker.highest_bid = orders.bids[0].price; - return ticker; -} vector database_api::get_trade_history( const string& base, const string& quote, diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 6ca261ac68..d5ef86e96a 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -95,7 +95,8 @@ struct market_ticker market_ticker(const market_ticker_object& mto, const fc::time_point_sec& now, const asset_object& asset_base, - const asset_object& asset_quote); + const asset_object& asset_quote, + const order_book& orders); }; struct market_volume From 18ac80a98f66c384a527ffc0295c7d44cb14bc9b Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sat, 2 Feb 2019 19:23:22 -0300 Subject: [PATCH 099/108] rename name_or_id with symbol_or_id --- libraries/app/database_api.cpp | 14 +++++++------- .../app/include/graphene/app/database_api.hpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index ee55fce992..1d88cca2d1 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -227,17 +227,17 @@ class database_api_impl : public std::enable_shared_from_this return account; } - const asset_object* get_asset_from_string( const std::string& name_or_id ) const + const asset_object* get_asset_from_string( const std::string& symbol_or_id ) const { // TODO cache the result to avoid repeatly fetching from db - FC_ASSERT( name_or_id.size() > 0); + FC_ASSERT( symbol_or_id.size() > 0); const asset_object* asset = nullptr; - if (std::isdigit(name_or_id[0])) - asset = _db.find(fc::variant(name_or_id, 1).as(1)); + if (std::isdigit(symbol_or_id[0])) + asset = _db.find(fc::variant(symbol_or_id, 1).as(1)); else { const auto& idx = _db.get_index_type().indices().get(); - auto itr = idx.find(name_or_id); + auto itr = idx.find(symbol_or_id); if (itr != idx.end()) asset = &*itr; } @@ -1109,9 +1109,9 @@ vector database_api_impl::get_vesting_balances( const st // // ////////////////////////////////////////////////////////////////////// -asset_id_type database_api::get_asset_id_from_string(const std::string& name_or_id)const +asset_id_type database_api::get_asset_id_from_string(const std::string& symbol_or_id)const { - return my->get_asset_from_string( name_or_id )->id; // safe? + return my->get_asset_from_string( symbol_or_id )->id; } vector> database_api::get_assets(const vector& asset_symbols_or_ids)const diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index b5437556bc..bece276b4b 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -374,11 +374,11 @@ class database_api //////////// /** - * @brief Get asset id from a name or ID - * @param name_or_id ID or name of the asset + * @brief Get asset id from a symbol or ID + * @param symbol_or_id ID or symbol of the asset * @return asset id */ - asset_id_type get_asset_id_from_string(const std::string& name_or_id) const; + asset_id_type get_asset_id_from_string(const std::string& symbol_or_id) const; /** * @brief Get a list of assets by ID From d256af696a972084ba8c002202f030b64c4dcf8b Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sat, 2 Feb 2019 19:52:31 -0300 Subject: [PATCH 100/108] expose get_asset_id_from_string --- libraries/app/database_api.cpp | 3 ++- libraries/app/include/graphene/app/database_api.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 1d88cca2d1..7988ced388 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -98,6 +98,7 @@ class database_api_impl : public std::enable_shared_from_this vector get_vesting_balances( const std::string account_id_or_name )const; // Assets + asset_id_type get_asset_id_from_string(const std::string& symbol_or_id)const; vector> get_assets(const vector& asset_symbols_or_ids)const; vector list_assets(const string& lower_bound_symbol, uint32_t limit)const; vector> lookup_asset_symbols(const vector& symbols_or_ids)const; @@ -698,7 +699,7 @@ bool database_api_impl::is_public_key_registered(string public_key) const account_id_type database_api::get_account_id_from_string(const std::string& name_or_id)const { - return my->get_account_from_string( name_or_id )->id; // safe? + return my->get_account_from_string( name_or_id )->id; } vector> database_api::get_accounts(const vector& account_names_or_ids)const diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index bece276b4b..9080e0a3da 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -797,6 +797,7 @@ FC_API(graphene::app::database_api, (list_assets) (lookup_asset_symbols) (get_asset_count) + (get_asset_id_from_string) // Markets / feeds (get_order_book) From 9eab093640d6d77a66381dd8db1ad2b7218677c6 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Sun, 3 Feb 2019 11:37:06 -0300 Subject: [PATCH 101/108] change asset id or name to asset id or symbol in descriptions of api.hpp --- libraries/app/include/graphene/app/api.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index 9109c8c453..b47445c0c4 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -443,7 +443,7 @@ namespace graphene { namespace app { /** * @brief Get asset holders for a specific asset - * @param asset The specific asset id or name + * @param asset The specific asset id or symbol * @param start The start index * @param limit Maximum limit must not exceed 100 * @return A list of asset holders for the specified asset @@ -452,7 +452,7 @@ namespace graphene { namespace app { /** * @brief Get asset holders count for a specific asset - * @param asset The specific asset id or name + * @param asset The specific asset id or symbol * @return Holders count for the specified asset */ int get_asset_holders_count( std::string asset )const; @@ -486,8 +486,8 @@ namespace graphene { namespace app { /** * @breif Get grouped limit orders in given market. * - * @param base_asset ID or name of asset being sold - * @param quote_asset ID or name of asset being purchased + * @param base_asset ID or symbol of asset being sold + * @param quote_asset ID or symbol of asset being purchased * @param group Maximum price diff within each order group, have to be one of configured values * @param start Optional price to indicate the first order group to retrieve * @param limit Maximum number of order groups to retrieve (must not exceed 101) From a38b5584c8838609c3c251155cbcaea9d2ebf230 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 4 Feb 2019 10:50:23 -0300 Subject: [PATCH 102/108] change some more docs --- libraries/app/include/graphene/app/api.hpp | 8 ++++---- libraries/app/include/graphene/app/database_api.hpp | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index b47445c0c4..7e1dc1552f 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -187,8 +187,8 @@ namespace graphene { namespace app { /** * @brief Get details of order executions occurred most recently in a trading pair - * @param a One asset in a trading pair - * @param b The other asset in the trading pair + * @param a Asset symbol or ID in a trading pair + * @param b The other asset symbol or ID in the trading pair * @param limit Maximum records to return * @return a list of order_history objects, in "most recent first" order */ @@ -196,8 +196,8 @@ namespace graphene { namespace app { /** * @brief Get OHLCV data of a trading pair in a time range - * @param a One asset in a trading pair - * @param b The other asset in the trading pair + * @param a Asset symbol or ID in a trading pair + * @param b The other asset symbol or ID in the trading pair * @param bucket_seconds Length of each time bucket in seconds. * Note: it need to be within result of get_market_history_buckets() API, otherwise no data will be returned * @param start The start of a time range, E.G. "2018-01-01T00:00:00" diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 9080e0a3da..a3856c239c 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -689,8 +689,7 @@ class database_api processed_transaction validate_transaction( const signed_transaction& trx )const; /** - * For each operation calculate the required fee in the specified asset type. If the asset type does - * not have a valid core_exchange_rate + * For each operation calculate the required fee in the specified asset type. */ vector< fc::variant > get_required_fees( const vector& ops, const std::string& asset_id_or_symbol )const; From 21a4d76cc31105e1ba642462446891142fddc9f0 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 4 Feb 2019 21:11:20 +0100 Subject: [PATCH 103/108] Fixed crash on empty/invalid node pubkey --- programs/network_mapper/network_mapper.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/programs/network_mapper/network_mapper.cpp b/programs/network_mapper/network_mapper.cpp index 6fef314254..2ecc724d8c 100644 --- a/programs/network_mapper/network_mapper.cpp +++ b/programs/network_mapper/network_mapper.cpp @@ -236,15 +236,18 @@ int main(int argc, char** argv) continue; } - graphene::net::address_info this_node_info; - this_node_info.direction = graphene::net::peer_connection_direction::outbound; - this_node_info.firewalled = graphene::net::firewalled_state::not_firewalled; - this_node_info.remote_endpoint = probe->_remote; - this_node_info.node_id = probe->_node_id; - - connections_by_node_id[this_node_info.node_id] = probe->_peers; - if (address_info_by_node_id.find(probe->_node_id) == address_info_by_node_id.end()) - address_info_by_node_id[probe->_node_id] = this_node_info; + if( probe->_node_id.valid() ) + { + graphene::net::address_info this_node_info; + this_node_info.direction = graphene::net::peer_connection_direction::outbound; + this_node_info.firewalled = graphene::net::firewalled_state::not_firewalled; + this_node_info.remote_endpoint = probe->_remote; + this_node_info.node_id = probe->_node_id; + + connections_by_node_id[this_node_info.node_id] = probe->_peers; + if (address_info_by_node_id.find(this_node_info.node_id) == address_info_by_node_id.end()) + address_info_by_node_id[this_node_info.node_id] = this_node_info; + } for (const graphene::net::address_info& info : probe->_peers) { From 82baee3112ca6fe6ca0e0d744479b628b473581c Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 5 Feb 2019 16:47:22 -0300 Subject: [PATCH 104/108] add network_mapper --- programs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/README.md b/programs/README.md index 26b2b36886..11c92094b1 100644 --- a/programs/README.md +++ b/programs/README.md @@ -21,3 +21,4 @@ Folder | Name | Description | Category | Status | Help [member_enumerator](build_helpers/member_enumerator.cpp) | Member enumerator | | Tool | Deprecated | `./member_enumerator` [get_dev_key](genesis_util/get_dev_key.cpp) | Get Dev Key | Create public, private and address keys. Useful in private testnets, `genesis.json` files, new blockchain creation and others. | Tool | Active | `/programs/genesis_util/get_dev_key -h` [genesis_util](genesis_util) | Genesis Utils | Other utilities for genesis creation. | Tool | Old | +[network_mapper](network_mapper) | Network Mapper | Generates .DOT file that can be rendered by graphviz to make images of node connectivity. | Tool | Active | `./programs/network_mapper/network_mapper` From 5cefa46456ff1bed1b82729fefd1aa994cc84c4e Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 5 Feb 2019 19:03:28 -0300 Subject: [PATCH 105/108] change status of network mapper --- programs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/README.md b/programs/README.md index 11c92094b1..24f646ac0d 100644 --- a/programs/README.md +++ b/programs/README.md @@ -21,4 +21,4 @@ Folder | Name | Description | Category | Status | Help [member_enumerator](build_helpers/member_enumerator.cpp) | Member enumerator | | Tool | Deprecated | `./member_enumerator` [get_dev_key](genesis_util/get_dev_key.cpp) | Get Dev Key | Create public, private and address keys. Useful in private testnets, `genesis.json` files, new blockchain creation and others. | Tool | Active | `/programs/genesis_util/get_dev_key -h` [genesis_util](genesis_util) | Genesis Utils | Other utilities for genesis creation. | Tool | Old | -[network_mapper](network_mapper) | Network Mapper | Generates .DOT file that can be rendered by graphviz to make images of node connectivity. | Tool | Active | `./programs/network_mapper/network_mapper` +[network_mapper](network_mapper) | Network Mapper | Generates .DOT file that can be rendered by graphviz to make images of node connectivity. | Tool | Experimental | `./programs/network_mapper/network_mapper` From f66c9a5eac655c27fb91a6480cb7a1e59d580128 Mon Sep 17 00:00:00 2001 From: John Jones Date: Tue, 5 Feb 2019 17:04:03 -0500 Subject: [PATCH 106/108] bump FC for std::min macOS --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 9e6c5ab6e2..8ebd99b786 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 9e6c5ab6e2860a29bac0ef077bbd8a39b99b5971 +Subproject commit 8ebd99b786623bc8d55e89d42df82644a71a6885 From 50fd49207bfefa4f367f01aa556f17c057822b22 Mon Sep 17 00:00:00 2001 From: abitmore Date: Tue, 12 Feb 2019 13:08:19 -0500 Subject: [PATCH 107/108] Reduce number of db queries in get_call_orders API --- libraries/app/database_api.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index c1520f4b41..41c3d6a841 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1273,10 +1273,9 @@ vector database_api_impl::get_call_orders(const std::string& { FC_ASSERT( limit <= 300 ); - const asset_id_type asset_a_id = get_asset_from_string(a)->id; + const asset_object* mia = get_asset_from_string(a); const auto& call_index = _db.get_index_type().indices().get(); - const asset_object& mia = _db.get(asset_a_id); - price index_price = price::min( mia.bitasset_data(_db).options.short_backing_asset, mia.get_id() ); + price index_price = price::min( mia->bitasset_data(_db).options.short_backing_asset, mia->get_id() ); vector< call_order_object> result; auto itr_min = call_index.lower_bound(index_price); From 2d5eb6c3a3cca859feb0d625c07266bbcd92805e Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 12 Feb 2019 16:30:23 -0300 Subject: [PATCH 108/108] add default empty result to get_ticker --- libraries/app/database_api.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 79c4716c88..c97db8273b 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1430,8 +1430,11 @@ market_ticker database_api_impl::get_ticker( const string& base, const string& q { orders = get_order_book(assets[0]->symbol, assets[1]->symbol, 1); } - return market_ticker(*itr, now, *assets[0], *assets[1], orders);; + return market_ticker(*itr, now, *assets[0], *assets[1], orders); } + // if no ticker is found for this market we return an empty ticker + market_ticker empty_result; + return empty_result; } market_volume database_api::get_24_volume( const string& base, const string& quote )const