remove min_market_fee due to potential attack vector with many small partial matches

This commit is contained in:
Daniel Larimer 2015-06-22 17:29:40 -04:00
parent a1601cbc0f
commit de99437be4
3 changed files with 1 additions and 6 deletions

View file

@ -85,7 +85,6 @@ void asset_object::asset_options::validate()const
FC_ASSERT( max_supply <= GRAPHENE_MAX_SHARE_SUPPLY ); FC_ASSERT( max_supply <= GRAPHENE_MAX_SHARE_SUPPLY );
FC_ASSERT( market_fee_percent <= GRAPHENE_100_PERCENT ); FC_ASSERT( market_fee_percent <= GRAPHENE_100_PERCENT );
FC_ASSERT( max_market_fee >= 0 && max_market_fee <= GRAPHENE_MAX_SHARE_SUPPLY ); 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. // There must be no high bits in permissions whose meaning is not known.
FC_ASSERT( !(issuer_permissions & ~ASSET_ISSUER_PERMISSION_MASK) ); FC_ASSERT( !(issuer_permissions & ~ASSET_ISSUER_PERMISSION_MASK) );
// There must be no high bits in flags which are not also high in permissions. // There must be no high bits in flags which are not also high in permissions.

View file

@ -471,7 +471,7 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass
if( !trade_asset.charges_market_fees() ) if( !trade_asset.charges_market_fees() )
return trade_asset.amount(0); return trade_asset.amount(0);
if( trade_asset.options.market_fee_percent == 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); fc::uint128 a(trade_amount.amount.value);
a *= trade_asset.options.market_fee_percent; 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 ) if( percent_fee.amount > trade_asset.options.max_market_fee )
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; return percent_fee;
} }

View file

@ -128,7 +128,6 @@ namespace graphene { namespace chain {
/// in this field means a 1% fee is charged on market trades of this asset. /// in this field means a 1% fee is charged on market trades of this asset.
uint16_t market_fee_percent = 0; uint16_t market_fee_percent = 0;
share_type max_market_fee = GRAPHENE_MAX_SHARE_SUPPLY; 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 /// The flags which the issuer has permission to update. See @ref asset_issuer_permission_flags
uint16_t issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK; uint16_t issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK;
@ -320,7 +319,6 @@ FC_REFLECT( graphene::chain::asset_object::asset_options,
(max_supply) (max_supply)
(market_fee_percent) (market_fee_percent)
(max_market_fee) (max_market_fee)
(min_market_fee)
(issuer_permissions) (issuer_permissions)
(flags) (flags)
(core_exchange_rate) (core_exchange_rate)