Fix broken update_mia test
This commit is contained in:
parent
19f1e04986
commit
626b5cbb23
4 changed files with 22 additions and 20 deletions
|
|
@ -122,7 +122,9 @@ namespace graphene { namespace chain {
|
|||
{ try {
|
||||
if( !settlement_price.is_null() )
|
||||
settlement_price.validate();
|
||||
FC_ASSERT( maximum_short_squeeze_ratio >= 1000 );
|
||||
FC_ASSERT( maximum_short_squeeze_ratio >= GRAPHENE_MIN_COLLATERAL_RATIO );
|
||||
FC_ASSERT( maximum_short_squeeze_ratio <= GRAPHENE_MAX_COLLATERAL_RATIO );
|
||||
FC_ASSERT( maintenance_collateral_ratio >= GRAPHENE_MIN_COLLATERAL_RATIO );
|
||||
FC_ASSERT( maintenance_collateral_ratio <= maximum_short_squeeze_ratio );
|
||||
} FC_CAPTURE_AND_RETHROW( (*this) ) }
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10
|
||||
#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10
|
||||
|
||||
// These are NOT percentages
|
||||
#define GRAPHENE_MIN_COLLATERAL_RATIO 1001 // lower than this could result in divide by 0
|
||||
#define GRAPHENE_MAX_COLLATERAL_RATIO 32000 // higher than this is unnecessary and may exceed int16 storage
|
||||
#define GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO 1500 // We require collateral of 1.5x or more
|
||||
|
|
|
|||
|
|
@ -456,8 +456,7 @@ BOOST_AUTO_TEST_CASE( create_mia )
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( broken_update_mia, 1 )
|
||||
BOOST_AUTO_TEST_CASE( broken_update_mia )
|
||||
BOOST_AUTO_TEST_CASE( update_mia )
|
||||
{
|
||||
try {
|
||||
INVOKE(create_mia);
|
||||
|
|
@ -477,7 +476,6 @@ BOOST_AUTO_TEST_CASE( broken_update_mia )
|
|||
trx.operations.back() = op;
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
|
||||
//idump((bit_usd));
|
||||
{
|
||||
asset_publish_feed_operation pop;
|
||||
pop.asset_id = bit_usd.get_id();
|
||||
|
|
@ -485,8 +483,9 @@ BOOST_AUTO_TEST_CASE( broken_update_mia )
|
|||
price_feed feed;
|
||||
feed.settlement_price = price(bit_usd.amount(5), bit_usd.amount(5));
|
||||
REQUIRE_THROW_WITH_VALUE(pop, feed, feed);
|
||||
feed.settlement_price = price(bit_usd.amount(5), asset(5));
|
||||
feed.settlement_price = ~price(bit_usd.amount(5), asset(5));
|
||||
REQUIRE_THROW_WITH_VALUE(pop, feed, feed);
|
||||
feed.settlement_price = price(bit_usd.amount(5), asset(5));
|
||||
pop.feed = feed;
|
||||
REQUIRE_THROW_WITH_VALUE(pop, feed.maintenance_collateral_ratio, 0);
|
||||
trx.operations.back() = pop;
|
||||
|
|
|
|||
|
|
@ -356,8 +356,8 @@ BOOST_AUTO_TEST_CASE( mia_feeds )
|
|||
|
||||
op.publisher = dan_id;
|
||||
op.feed.settlement_price = ~price(asset(GRAPHENE_BLOCKCHAIN_PRECISION),bit_usd.amount(40));
|
||||
op.feed.maximum_short_squeeze_ratio = 1000;
|
||||
op.feed.maintenance_collateral_ratio = 1000;
|
||||
op.feed.maximum_short_squeeze_ratio = 1001;
|
||||
op.feed.maintenance_collateral_ratio = 1001;
|
||||
trx.operations.back() = op;
|
||||
PUSH_TX( db, trx, ~0 );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue