From de99437be49a4f295366c14e55532be5c41506b7 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 22 Jun 2015 17:29:40 -0400 Subject: [PATCH] remove min_market_fee due to potential attack vector with many small partial matches --- libraries/chain/asset_object.cpp | 1 - libraries/chain/db_market.cpp | 4 +--- libraries/chain/include/graphene/chain/asset_object.hpp | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libraries/chain/asset_object.cpp b/libraries/chain/asset_object.cpp index f3e5bf07..f5bab206 100644 --- a/libraries/chain/asset_object.cpp +++ b/libraries/chain/asset_object.cpp @@ -85,7 +85,6 @@ void asset_object::asset_options::validate()const FC_ASSERT( max_supply <= GRAPHENE_MAX_SHARE_SUPPLY ); FC_ASSERT( market_fee_percent <= GRAPHENE_100_PERCENT ); FC_ASSERT( max_market_fee >= 0 && max_market_fee <= GRAPHENE_MAX_SHARE_SUPPLY ); - FC_ASSERT( min_market_fee >= 0 && min_market_fee <= GRAPHENE_MAX_SHARE_SUPPLY ); // There must be no high bits in permissions whose meaning is not known. FC_ASSERT( !(issuer_permissions & ~ASSET_ISSUER_PERMISSION_MASK) ); // There must be no high bits in flags which are not also high in permissions. diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index 59b35430..3822566f 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -471,7 +471,7 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass if( !trade_asset.charges_market_fees() ) return trade_asset.amount(0); if( trade_asset.options.market_fee_percent == 0 ) - return trade_asset.amount(trade_asset.options.min_market_fee); + return trade_asset.amount(0); fc::uint128 a(trade_amount.amount.value); a *= trade_asset.options.market_fee_percent; @@ -480,8 +480,6 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass if( percent_fee.amount > trade_asset.options.max_market_fee ) percent_fee.amount = trade_asset.options.max_market_fee; - else if( percent_fee.amount < trade_asset.options.min_market_fee ) - percent_fee.amount = trade_asset.options.min_market_fee; return percent_fee; } diff --git a/libraries/chain/include/graphene/chain/asset_object.hpp b/libraries/chain/include/graphene/chain/asset_object.hpp index c3cd7481..63ea1cdd 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -128,7 +128,6 @@ namespace graphene { namespace chain { /// in this field means a 1% fee is charged on market trades of this asset. uint16_t market_fee_percent = 0; share_type max_market_fee = GRAPHENE_MAX_SHARE_SUPPLY; - share_type min_market_fee; /// The flags which the issuer has permission to update. See @ref asset_issuer_permission_flags uint16_t issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK; @@ -320,7 +319,6 @@ FC_REFLECT( graphene::chain::asset_object::asset_options, (max_supply) (market_fee_percent) (max_market_fee) - (min_market_fee) (issuer_permissions) (flags) (core_exchange_rate)