From bf9537fec6bb9d5191b71b1079799480e7c74310 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 24 Dec 2018 10:47:13 -0300 Subject: [PATCH 01/11] add support for existing tests after hf1270 --- tests/common/database_fixture.hpp | 1 + tests/tests/market_tests.cpp | 88 ++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 18 deletions(-) diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index 78f7b65d19..4a71f1d05f 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -186,6 +186,7 @@ struct database_fixture { optional data_dir; bool skip_key_index_test = false; uint32_t anon_acct_count; + bool hf1270 = false; database_fixture(); ~database_fixture(); diff --git a/tests/tests/market_tests.cpp b/tests/tests/market_tests.cpp index 9447a06b79..fefcb895eb 100644 --- a/tests/tests/market_tests.cpp +++ b/tests/tests/market_tests.cpp @@ -231,9 +231,11 @@ BOOST_AUTO_TEST_CASE(issue_338_etc) */ BOOST_AUTO_TEST_CASE(hardfork_core_338_test) { try { - auto mi = db.get_global_properties().parameters.maintenance_interval; - generate_blocks(HARDFORK_CORE_343_TIME - mi); // assume all hard forks occur at same time - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + + if(hf1270) + generate_blocks(HARDFORK_CORE_1270_TIME); + else + generate_blocks(HARDFORK_CORE_343_TIME); set_expiration( db, trx ); @@ -325,7 +327,8 @@ BOOST_AUTO_TEST_CASE(hardfork_core_338_test) // call's call_price will be updated after the match, to 741/31/1.75 CORE/USD = 2964/217 // it's above settlement price (10/1) so won't be margin called again - BOOST_CHECK( price(asset(2964),asset(217,usd_id)) == call.call_price ); + if(!hf1270) // can use call price only if we are before hf1270 + BOOST_CHECK( price(asset(2964),asset(217,usd_id)) == call.call_price ); // This would match with call before, but would match with call2 after #343 fixed BOOST_CHECK( !create_sell_order(seller, bitusd.amount(700), core.amount(6000) ) ); @@ -342,7 +345,8 @@ BOOST_AUTO_TEST_CASE(hardfork_core_338_test) BOOST_CHECK_EQUAL( 1000, call3.debt.value ); BOOST_CHECK_EQUAL( 16000, call3.collateral.value ); // call2's call_price will be updated after the match, to 78/3/1.75 CORE/USD = 312/21 - BOOST_CHECK( price(asset(312),asset(21,usd_id)) == call2.call_price ); + if(!hf1270) // can use call price only if we are before hf1270 + BOOST_CHECK( price(asset(312),asset(21,usd_id)) == call2.call_price ); // it's above settlement price (10/1) so won't be margin called // at this moment, collateralization of call is 7410 / 310 = 23.9 @@ -406,9 +410,11 @@ BOOST_AUTO_TEST_CASE(hardfork_core_338_test) */ BOOST_AUTO_TEST_CASE(hardfork_core_453_test) { try { - auto mi = db.get_global_properties().parameters.maintenance_interval; - generate_blocks(HARDFORK_CORE_453_TIME - mi); // assume all hard forks occur at same time - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + + if(hf1270) + generate_blocks(HARDFORK_CORE_1270_TIME); + else + generate_blocks(HARDFORK_CORE_343_TIME); set_expiration( db, trx ); @@ -478,7 +484,6 @@ BOOST_AUTO_TEST_CASE(hardfork_core_453_test) // generate a block generate_block(); - } FC_LOG_AND_RETHROW() } /*** @@ -486,9 +491,11 @@ BOOST_AUTO_TEST_CASE(hardfork_core_453_test) */ BOOST_AUTO_TEST_CASE(hardfork_core_625_big_limit_order_test) { try { - auto mi = db.get_global_properties().parameters.maintenance_interval; - generate_blocks(HARDFORK_CORE_625_TIME - mi); // assume all hard forks occur at same time - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + + if(hf1270) + generate_blocks(HARDFORK_CORE_1270_TIME); + else + generate_blocks(HARDFORK_CORE_625_TIME); set_expiration( db, trx ); @@ -1195,9 +1202,11 @@ BOOST_AUTO_TEST_CASE(hard_fork_343_cross_test) */ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) { try { - auto mi = db.get_global_properties().parameters.maintenance_interval; - generate_blocks(HARDFORK_CORE_834_TIME - mi); - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + + if(hf1270) + generate_blocks(HARDFORK_CORE_1270_TIME); + else + generate_blocks(HARDFORK_CORE_834_TIME); set_expiration( db, trx ); @@ -1284,6 +1293,8 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) // even though call2 has a higher CR, since call's TCR is less than call2's TCR, so we expect call will cover less when called BOOST_CHECK_LT( call_to_cover.value, call2_to_cover.value ); + print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + // Create a big sell order slightly below the call price, will be matched with several orders BOOST_CHECK( !create_sell_order(seller, bitusd.amount(700*4), core.amount(5900*4) ) ); @@ -1293,6 +1304,9 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_CHECK_EQUAL( 10, get_balance(buyer3, bitusd) ); BOOST_CHECK_EQUAL( init_balance - 111, get_balance(buyer3, core) ); + print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + return; + // then it will match with call, at mssp: 1/11 = 1000/11000 const call_order_object* tmp_call = db.find( call_id ); BOOST_CHECK( tmp_call != nullptr ); @@ -1373,9 +1387,11 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) */ BOOST_AUTO_TEST_CASE(target_cr_test_call_limit) { try { - auto mi = db.get_global_properties().parameters.maintenance_interval; - generate_blocks(HARDFORK_CORE_834_TIME - mi); - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + + if(hf1270) + generate_blocks(HARDFORK_CORE_1270_TIME); + else + generate_blocks(HARDFORK_CORE_834_TIME); set_expiration( db, trx ); @@ -1817,4 +1833,40 @@ BOOST_AUTO_TEST_CASE(mcr_bug_cross1270) } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE(hardfork_core_338_test_after_hf1270) +{ try { + hf1270 = true; + INVOKE(hardfork_core_338_test); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(hardfork_core_453_test_after_hf1270) +{ try { + hf1270 = true; + INVOKE(hardfork_core_453_test); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(hardfork_core_625_big_limit_order_test_after_hf1270) +{ try { + hf1270 = true; + INVOKE(hardfork_core_625_big_limit_order_test); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(target_cr_test_limit_call_after_hf1270) +{ try { + hf1270 = true; + INVOKE(target_cr_test_limit_call); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(target_cr_test_call_limit_after_hf1270) +{ try { + hf1270 = true; + INVOKE(target_cr_test_call_limit); + +} FC_LOG_AND_RETHROW() } + + BOOST_AUTO_TEST_SUITE_END() From 9f063640d18473a29898410b8c300ff836557bfc Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 25 Dec 2018 15:11:22 -0300 Subject: [PATCH 02/11] print call orders instead of market in target_cr_test_limit_call --- tests/tests/market_tests.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tests/market_tests.cpp b/tests/tests/market_tests.cpp index fefcb895eb..4c5e2e0c06 100644 --- a/tests/tests/market_tests.cpp +++ b/tests/tests/market_tests.cpp @@ -1293,7 +1293,8 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) // even though call2 has a higher CR, since call's TCR is less than call2's TCR, so we expect call will cover less when called BOOST_CHECK_LT( call_to_cover.value, call2_to_cover.value ); - print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + //print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + print_call_orders(); // Create a big sell order slightly below the call price, will be matched with several orders BOOST_CHECK( !create_sell_order(seller, bitusd.amount(700*4), core.amount(5900*4) ) ); @@ -1304,7 +1305,8 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_CHECK_EQUAL( 10, get_balance(buyer3, bitusd) ); BOOST_CHECK_EQUAL( init_balance - 111, get_balance(buyer3, core) ); - print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + //print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); + print_call_orders(); return; // then it will match with call, at mssp: 1/11 = 1000/11000 From 3aec53d9266c33e265e8aabad7348d59d70e0308 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 25 Dec 2018 20:55:11 -0300 Subject: [PATCH 03/11] remove prints after fix --- tests/tests/market_tests.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/tests/market_tests.cpp b/tests/tests/market_tests.cpp index 4c5e2e0c06..b08257fe24 100644 --- a/tests/tests/market_tests.cpp +++ b/tests/tests/market_tests.cpp @@ -1292,10 +1292,7 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_CHECK_LT( call2_to_cover.value, call2_id(db).debt.value ); // even though call2 has a higher CR, since call's TCR is less than call2's TCR, so we expect call will cover less when called BOOST_CHECK_LT( call_to_cover.value, call2_to_cover.value ); - - //print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); - print_call_orders(); - + // Create a big sell order slightly below the call price, will be matched with several orders BOOST_CHECK( !create_sell_order(seller, bitusd.amount(700*4), core.amount(5900*4) ) ); @@ -1305,10 +1302,6 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_CHECK_EQUAL( 10, get_balance(buyer3, bitusd) ); BOOST_CHECK_EQUAL( init_balance - 111, get_balance(buyer3, core) ); - //print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol); - print_call_orders(); - return; - // then it will match with call, at mssp: 1/11 = 1000/11000 const call_order_object* tmp_call = db.find( call_id ); BOOST_CHECK( tmp_call != nullptr ); From 46e2943698effedb346f5729519119f3eb04ff1a Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 27 Dec 2018 13:19:23 -0300 Subject: [PATCH 04/11] add hf1270 swan tests --- tests/tests/swan_tests.cpp | 94 +++++++++++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 7 deletions(-) diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index f0d7ce9aab..040060c915 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -114,6 +114,10 @@ struct swan_fixture : database_fixture { generate_blocks( HARDFORK_CORE_216_TIME ); generate_block(); } + void wait_for_hf_core_1270() { + generate_blocks( HARDFORK_CORE_1270_TIME ); + generate_block(); + } void wait_for_maintenance() { generate_blocks( db.get_dynamic_global_properties().next_maintenance_time ); @@ -141,6 +145,9 @@ BOOST_FIXTURE_TEST_SUITE( swan_tests, swan_fixture ) */ BOOST_AUTO_TEST_CASE( black_swan ) { try { + if(hf1270) + wait_for_hf_core_1270(); + init_standard_swan(); force_settle( borrower(), swan().amount(100) ); @@ -167,6 +174,11 @@ BOOST_AUTO_TEST_CASE( black_swan ) */ BOOST_AUTO_TEST_CASE( black_swan_issue_346 ) { try { + if(hf1270) { + wait_for_hf_core_1270(); + set_expiration(db, trx); + } + ACTORS((buyer)(seller)(borrower)(borrower2)(settler)(feeder)); const asset_object& core = asset_id_type()(db); @@ -246,11 +258,11 @@ BOOST_AUTO_TEST_CASE( black_swan_issue_346 ) force_settle( settler, bitusd.amount(100) ); // wait for forced settlement to execute - // this would throw on Sep.18 testnet, see #346 + // this would throw on Sep.18 testnet, see #346 (https://github.com/cryptonomex/graphene/issues/346) wait_for_settlement(); } - // issue 350 + // issue 350 (https://github.com/cryptonomex/graphene/issues/350) { // ok, new asset const asset_object& bitusd = setup_asset(); @@ -265,6 +277,8 @@ BOOST_AUTO_TEST_CASE( black_swan_issue_346 ) // We attempt to match against $0.019 order and black swan, // and this is intended behavior. See discussion in ticket. // + print_market(bitusd.symbol, core.symbol); + BOOST_CHECK( bitusd.bitasset_data(db).has_settlement() ); BOOST_CHECK( db.find_object( oid_019 ) != nullptr ); BOOST_CHECK( db.find_object( oid_020 ) == nullptr ); @@ -282,7 +296,10 @@ BOOST_AUTO_TEST_CASE( revive_recovered ) { try { init_standard_swan( 700 ); - wait_for_hf_core_216(); + if(hf1270) + wait_for_hf_core_1270(); + else + wait_for_hf_core_216(); // revive after price recovers set_feed( 700, 800 ); @@ -304,7 +321,10 @@ BOOST_AUTO_TEST_CASE( recollateralize ) // no hardfork yet GRAPHENE_REQUIRE_THROW( bid_collateral( borrower2(), back().amount(1000), swan().amount(100) ), fc::exception ); - wait_for_hf_core_216(); + if(hf1270) + wait_for_hf_core_1270(); + else + wait_for_hf_core_216(); int64_t b2_balance = get_balance( borrower2(), back() ); bid_collateral( borrower2(), back().amount(1000), swan().amount(100) ); @@ -396,7 +416,10 @@ BOOST_AUTO_TEST_CASE( revive_empty_recovered ) { try { limit_order_id_type oid = init_standard_swan( 1000 ); - wait_for_hf_core_216(); + if(hf1270) + wait_for_hf_core_1270(); + else + wait_for_hf_core_216(); set_expiration( db, trx ); cancel_limit_order( oid(db) ); @@ -423,7 +446,10 @@ BOOST_AUTO_TEST_CASE( revive_empty_recovered ) */ BOOST_AUTO_TEST_CASE( revive_empty ) { try { - wait_for_hf_core_216(); + if(hf1270) + wait_for_hf_core_1270(); + else + wait_for_hf_core_216(); limit_order_id_type oid = init_standard_swan( 1000 ); @@ -447,7 +473,10 @@ BOOST_AUTO_TEST_CASE( revive_empty ) */ BOOST_AUTO_TEST_CASE( revive_empty_with_bid ) { try { - wait_for_hf_core_216(); + if(hf1270) + wait_for_hf_core_1270(); + else + wait_for_hf_core_216(); standard_users(); standard_asset(); @@ -491,4 +520,55 @@ BOOST_AUTO_TEST_CASE( revive_empty_with_bid ) } } +BOOST_AUTO_TEST_CASE(black_swan_after_hf1270) +{ try { + hf1270 = true; + INVOKE(black_swan); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(black_swan_issue_346_hf1270) +{ try { + hf1270 = true; + INVOKE(black_swan_issue_346); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(revive_recovered_hf1270) +{ try { + hf1270 = true; + INVOKE(revive_recovered); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(recollateralize_hf1270) +{ try { + hf1270 = true; + INVOKE(recollateralize); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(revive_empty_recovered_hf1270) +{ try { + hf1270 = true; + INVOKE(revive_empty_recovered); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(revive_empty_hf1270) +{ try { + hf1270 = true; + INVOKE(revive_empty); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(revive_empty_with_bid_hf1270) +{ try { + hf1270 = true; + INVOKE(revive_empty_with_bid); + +} FC_LOG_AND_RETHROW() } + + + BOOST_AUTO_TEST_SUITE_END() From 4e2514c40305c501271d36cc322b46c0324c0469 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 16 Jan 2019 17:31:16 -0300 Subject: [PATCH 05/11] skip black_swan_issue_346 test after hf1270 --- tests/tests/swan_tests.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index 040060c915..eb36bb67d7 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -174,10 +174,6 @@ BOOST_AUTO_TEST_CASE( black_swan ) */ BOOST_AUTO_TEST_CASE( black_swan_issue_346 ) { try { - if(hf1270) { - wait_for_hf_core_1270(); - set_expiration(db, trx); - } ACTORS((buyer)(seller)(borrower)(borrower2)(settler)(feeder)); @@ -277,8 +273,6 @@ BOOST_AUTO_TEST_CASE( black_swan_issue_346 ) // We attempt to match against $0.019 order and black swan, // and this is intended behavior. See discussion in ticket. // - print_market(bitusd.symbol, core.symbol); - BOOST_CHECK( bitusd.bitasset_data(db).has_settlement() ); BOOST_CHECK( db.find_object( oid_019 ) != nullptr ); BOOST_CHECK( db.find_object( oid_020 ) == nullptr ); @@ -527,12 +521,7 @@ BOOST_AUTO_TEST_CASE(black_swan_after_hf1270) } FC_LOG_AND_RETHROW() } -BOOST_AUTO_TEST_CASE(black_swan_issue_346_hf1270) -{ try { - hf1270 = true; - INVOKE(black_swan_issue_346); - -} FC_LOG_AND_RETHROW() } +// black_swan_issue_346_hf1270 is skipped as it is already failing with HARDFORK_CORE_834_TIME BOOST_AUTO_TEST_CASE(revive_recovered_hf1270) { try { @@ -569,6 +558,4 @@ BOOST_AUTO_TEST_CASE(revive_empty_with_bid_hf1270) } FC_LOG_AND_RETHROW() } - - BOOST_AUTO_TEST_SUITE_END() From 7abf7c574ca3dc60ecec872a3d4907e216847221 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 17 Jan 2019 00:08:13 -0300 Subject: [PATCH 06/11] update bitasset tests for hf1270 --- tests/tests/bitasset_tests.cpp | 54 ++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/tests/tests/bitasset_tests.cpp b/tests/tests/bitasset_tests.cpp index 759ea8744e..017e20a94a 100644 --- a/tests/tests/bitasset_tests.cpp +++ b/tests/tests/bitasset_tests.cpp @@ -453,6 +453,10 @@ BOOST_AUTO_TEST_CASE( hf_890_test ) generate_blocks(HARDFORK_615_TIME, true, skip); // get around Graphene issue #615 feed expiration bug generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); + auto hf_time = HARDFORK_CORE_868_890_TIME; + if(hf1270) + hf_time = HARDFORK_CORE_1270_TIME; + for( int i=0; i<2; ++i ) { int blocks = 0; @@ -460,7 +464,7 @@ BOOST_AUTO_TEST_CASE( hf_890_test ) if( i == 1 ) // go beyond hard fork { - blocks += generate_blocks(HARDFORK_CORE_868_890_TIME - mi, true, skip); + blocks += generate_blocks(hf_time - mi, true, skip); blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); } set_expiration( db, trx ); @@ -526,7 +530,7 @@ BOOST_AUTO_TEST_CASE( hf_890_test ) ba_op.asset_to_update = usd_id; ba_op.issuer = asset_to_update.issuer; ba_op.new_options = asset_to_update.bitasset_data(db).options; - ba_op.new_options.feed_lifetime_sec = HARDFORK_CORE_868_890_TIME.sec_since_epoch() + ba_op.new_options.feed_lifetime_sec = hf_time.sec_since_epoch() - db.head_block_time().sec_since_epoch() + mi + 1800; @@ -542,7 +546,7 @@ BOOST_AUTO_TEST_CASE( hf_890_test ) BOOST_CHECK( db.find( sell_id ) ); // go beyond hard fork - blocks += generate_blocks(HARDFORK_CORE_868_890_TIME - mi, true, skip); + blocks += generate_blocks(hf_time - mi, true, skip); blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); } @@ -924,7 +928,7 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); generate_block( skip ); - for( int i = 0; i < 6; ++i ) + for( int i = 0; i < 8; ++i ) { idump( (i) ); int blocks = 0; @@ -940,6 +944,10 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) generate_blocks( HARDFORK_CORE_935_TIME - mi, true, skip ); generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); } + else if( i == 6 ) // go beyond hard fork 1270 + { + generate_blocks( HARDFORK_CORE_1270_TIME, true, skip ); + } set_expiration( db, trx ); ACTORS( (seller)(borrower)(feedproducer)(feedproducer2)(feedproducer3) ); @@ -1050,7 +1058,7 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) ba_op.asset_to_update = usd_id; ba_op.issuer = asset_to_update.issuer; ba_op.new_options = asset_to_update.bitasset_data(db).options; - ba_op.new_options.feed_lifetime_sec = HARDFORK_CORE_935_TIME.sec_since_epoch() + ba_op.new_options.feed_lifetime_sec = HARDFORK_CORE_1270_TIME.sec_since_epoch() + mi * 3 + 86400 * 2 - db.head_block_time().sec_since_epoch(); trx.operations.push_back(ba_op); @@ -1103,22 +1111,30 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); } - // after hard fork 935, the limit order should be filled + // after hard fork 935, the limit order is filled only for the MSSR test + if( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_935_TIME && + db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_1270_TIME ) { // check median BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); - if( i % 2 == 0 ) // MCR test, median MCR should be 350% - BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500 ); - else // MSSR test, MSSR should be 125% - BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250 ); - // the limit order should have been filled - // TODO FIXME this test case is failing for MCR test, - // because call_order's call_price didn't get updated after MCR changed - // BOOST_CHECK( !db.find( sell_id ) ); - if( i % 2 == 1 ) // MSSR test - BOOST_CHECK( !db.find( sell_id ) ); + if( i % 2 != 0 ) { // MSSR test, MSSR should be 125%, order filled + BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250); + BOOST_CHECK(!db.find(sell_id)); + } + // go beyond hard fork 1270 + blocks += generate_blocks(HARDFORK_CORE_1270_TIME, true, skip); } + // after hard fork 1270 + if( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_1270_TIME) + { + // check median + BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); + if( i % 2 == 0 ) { // MCR test, median MCR should be 350%, order filled + BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); + BOOST_CHECK(!db.find(sell_id)); // MCR bug fixed + } + } // undo above tx's and reset generate_block( skip ); @@ -1376,5 +1392,11 @@ BOOST_AUTO_TEST_CASE( reset_backing_asset_switching_to_witness_fed ) } } */ +BOOST_AUTO_TEST_CASE(hf_890_test_hf1270) +{ try { + hf1270 = true; + INVOKE(hf_890_test); + +} FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_SUITE_END() From a2d5fac585a1436c1328ec711e82cbe5ce8896ea Mon Sep 17 00:00:00 2001 From: Alfredo Date: Thu, 24 Jan 2019 15:21:44 -0300 Subject: [PATCH 07/11] accurate block generation for hf1270 in market and swan tests --- tests/tests/market_tests.cpp | 60 +++++++++++++++++++++++++----------- tests/tests/swan_tests.cpp | 5 +-- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/tests/tests/market_tests.cpp b/tests/tests/market_tests.cpp index b08257fe24..933ed8cd00 100644 --- a/tests/tests/market_tests.cpp +++ b/tests/tests/market_tests.cpp @@ -232,10 +232,14 @@ BOOST_AUTO_TEST_CASE(issue_338_etc) BOOST_AUTO_TEST_CASE(hardfork_core_338_test) { try { + auto mi = db.get_global_properties().parameters.maintenance_interval; + if(hf1270) - generate_blocks(HARDFORK_CORE_1270_TIME); + generate_blocks(HARDFORK_CORE_1270_TIME - mi); else - generate_blocks(HARDFORK_CORE_343_TIME); + generate_blocks(HARDFORK_CORE_343_TIME - mi); + + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); set_expiration( db, trx ); @@ -411,10 +415,14 @@ BOOST_AUTO_TEST_CASE(hardfork_core_338_test) BOOST_AUTO_TEST_CASE(hardfork_core_453_test) { try { + auto mi = db.get_global_properties().parameters.maintenance_interval; + if(hf1270) - generate_blocks(HARDFORK_CORE_1270_TIME); + generate_blocks(HARDFORK_CORE_1270_TIME - mi); else - generate_blocks(HARDFORK_CORE_343_TIME); + generate_blocks(HARDFORK_CORE_343_TIME - mi); + + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); set_expiration( db, trx ); @@ -492,10 +500,14 @@ BOOST_AUTO_TEST_CASE(hardfork_core_453_test) BOOST_AUTO_TEST_CASE(hardfork_core_625_big_limit_order_test) { try { + auto mi = db.get_global_properties().parameters.maintenance_interval; + if(hf1270) - generate_blocks(HARDFORK_CORE_1270_TIME); + generate_blocks(HARDFORK_CORE_1270_TIME - mi); else - generate_blocks(HARDFORK_CORE_625_TIME); + generate_blocks(HARDFORK_CORE_625_TIME - mi); + + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); set_expiration( db, trx ); @@ -1203,10 +1215,14 @@ BOOST_AUTO_TEST_CASE(hard_fork_343_cross_test) BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) { try { + auto mi = db.get_global_properties().parameters.maintenance_interval; + if(hf1270) - generate_blocks(HARDFORK_CORE_1270_TIME); + generate_blocks(HARDFORK_CORE_1270_TIME - mi); else - generate_blocks(HARDFORK_CORE_834_TIME); + generate_blocks(HARDFORK_CORE_834_TIME - mi); + + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); set_expiration( db, trx ); @@ -1383,10 +1399,14 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_AUTO_TEST_CASE(target_cr_test_call_limit) { try { + auto mi = db.get_global_properties().parameters.maintenance_interval; + if(hf1270) - generate_blocks(HARDFORK_CORE_1270_TIME); + generate_blocks(HARDFORK_CORE_1270_TIME - mi); else - generate_blocks(HARDFORK_CORE_834_TIME); + generate_blocks(HARDFORK_CORE_834_TIME - mi); + + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); set_expiration( db, trx ); @@ -1521,8 +1541,9 @@ BOOST_AUTO_TEST_CASE(target_cr_test_call_limit) BOOST_AUTO_TEST_CASE(mcr_bug_increase_before1270) { try { - generate_blocks(HARDFORK_CORE_453_TIME); - + auto mi = db.get_global_properties().parameters.maintenance_interval; + generate_blocks(HARDFORK_CORE_453_TIME - mi); + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); set_expiration( db, trx ); @@ -1585,8 +1606,9 @@ BOOST_AUTO_TEST_CASE(mcr_bug_increase_before1270) BOOST_AUTO_TEST_CASE(mcr_bug_increase_after1270) { try { - generate_blocks(HARDFORK_CORE_1270_TIME); - + auto mi = db.get_global_properties().parameters.maintenance_interval; + generate_blocks(HARDFORK_CORE_1270_TIME - mi); + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); set_expiration( db, trx ); @@ -1650,8 +1672,9 @@ BOOST_AUTO_TEST_CASE(mcr_bug_increase_after1270) BOOST_AUTO_TEST_CASE(mcr_bug_decrease_before1270) { try { - generate_blocks(HARDFORK_CORE_453_TIME); - + auto mi = db.get_global_properties().parameters.maintenance_interval; + generate_blocks(HARDFORK_CORE_453_TIME - mi); + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); set_expiration( db, trx ); @@ -1719,8 +1742,9 @@ BOOST_AUTO_TEST_CASE(mcr_bug_decrease_before1270) BOOST_AUTO_TEST_CASE(mcr_bug_decrease_after1270) { try { - generate_blocks(HARDFORK_CORE_1270_TIME); - + auto mi = db.get_global_properties().parameters.maintenance_interval; + generate_blocks(HARDFORK_CORE_1270_TIME - mi); + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); generate_block(); set_expiration( db, trx ); diff --git a/tests/tests/swan_tests.cpp b/tests/tests/swan_tests.cpp index eb36bb67d7..25b59f232e 100644 --- a/tests/tests/swan_tests.cpp +++ b/tests/tests/swan_tests.cpp @@ -115,8 +115,9 @@ struct swan_fixture : database_fixture { generate_block(); } void wait_for_hf_core_1270() { - generate_blocks( HARDFORK_CORE_1270_TIME ); - generate_block(); + auto mi = db.get_global_properties().parameters.maintenance_interval; + generate_blocks(HARDFORK_CORE_1270_TIME - mi); + wait_for_maintenance(); } void wait_for_maintenance() { From 8466e198badff212eb95ad7254157630459630eb Mon Sep 17 00:00:00 2001 From: Alfredo Date: Fri, 25 Jan 2019 17:03:34 -0300 Subject: [PATCH 08/11] changes in bitasset_tests/hf_935_test --- tests/tests/bitasset_tests.cpp | 67 ++++++++++------------------------ 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/tests/tests/bitasset_tests.cpp b/tests/tests/bitasset_tests.cpp index 017e20a94a..30466a9beb 100644 --- a/tests/tests/bitasset_tests.cpp +++ b/tests/tests/bitasset_tests.cpp @@ -928,26 +928,22 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); generate_block( skip ); - for( int i = 0; i < 8; ++i ) + for( int i = 0; i < 6; ++i ) { idump( (i) ); int blocks = 0; auto mi = db.get_global_properties().parameters.maintenance_interval; - if( i == 2 ) // go beyond hard fork 890 + if( i == 2 ) // go beyond hard fork 890, 343, 935 { generate_blocks( HARDFORK_CORE_868_890_TIME - mi, true, skip ); - generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); } - else if( i == 4 ) // go beyond hard fork 935 + else if( i == 4 ) // go beyond hard fork 1270 { - generate_blocks( HARDFORK_CORE_935_TIME - mi, true, skip ); - generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); - } - else if( i == 6 ) // go beyond hard fork 1270 - { - generate_blocks( HARDFORK_CORE_1270_TIME, true, skip ); + generate_blocks( HARDFORK_CORE_1270_TIME - mi, true, skip ); } + generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); + set_expiration( db, trx ); ACTORS( (seller)(borrower)(feedproducer)(feedproducer2)(feedproducer3) ); @@ -1066,45 +1062,12 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) trx.clear(); } - bool affected_by_hf_343 = false; - - // check - if( i / 2 == 0 ) // before hard fork 890 + if( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_935_TIME ) { // median feed won't change (issue 890) BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 1750 ); BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1100 ); - // limit order is still there - BOOST_CHECK( db.find( sell_id ) ); - - // go beyond hard fork 890 - blocks += generate_blocks( HARDFORK_CORE_868_890_TIME - mi, true, skip ); - bool was_before_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_343_TIME ); - - blocks += generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); - bool now_after_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_343_TIME ); - - if( was_before_hf_343 && now_after_hf_343 ) // if hf 343 executed at same maintenance interval, actually after hf 890 - affected_by_hf_343 = true; - } - - // after hard fork 890, if it's before hard fork 935 - if( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_935_TIME ) - { - // median should have changed - BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); - if( i % 2 == 0 ) // MCR test, MCR should be 350% - BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500 ); - else // MSSR test, MSSR should be 125% - BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250 ); - - if( affected_by_hf_343 ) // if updated bitasset before hf 890, and hf 343 executed after hf 890 - // the limit order should have been filled - BOOST_CHECK( !db.find( sell_id ) ); - else // if not affected by hf 343 - // the limit order should be still there, because `check_call_order` was incorrectly skipped - BOOST_CHECK( db.find( sell_id ) ); // go beyond hard fork 935 blocks += generate_blocks(HARDFORK_CORE_935_TIME - mi, true, skip); @@ -1113,16 +1076,21 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) // after hard fork 935, the limit order is filled only for the MSSR test if( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_935_TIME && - db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_1270_TIME ) + db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_1270_TIME && i > 4) { // check median BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); - if( i % 2 != 0 ) { // MSSR test, MSSR should be 125%, order filled + if( i % 2 == 0 ) { // MCR bug + BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); + BOOST_CHECK(db.find(sell_id)); // order still here + } + else { // MSSR test, MSSR should be 125%, order filled BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250); BOOST_CHECK(!db.find(sell_id)); } // go beyond hard fork 1270 - blocks += generate_blocks(HARDFORK_CORE_1270_TIME, true, skip); + blocks += generate_blocks(HARDFORK_CORE_1270_TIME - mi, true, skip); + blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); } // after hard fork 1270 @@ -1134,11 +1102,16 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); BOOST_CHECK(!db.find(sell_id)); // MCR bug fixed } + else { // MSSR test, MSSR should be 125%, order filled + BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250); + BOOST_CHECK(!db.find(sell_id)); + } } // undo above tx's and reset generate_block( skip ); ++blocks; + while( blocks > 0 ) { db.pop_block(); From ece99b6d1def2bb50d8323b2bdda315a7de54915 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 29 Jan 2019 15:14:32 -0300 Subject: [PATCH 09/11] workaround hf_935_test --- tests/tests/bitasset_tests.cpp | 79 ++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/tests/tests/bitasset_tests.cpp b/tests/tests/bitasset_tests.cpp index 30466a9beb..c25e27bd10 100644 --- a/tests/tests/bitasset_tests.cpp +++ b/tests/tests/bitasset_tests.cpp @@ -928,22 +928,30 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); generate_block( skip ); - for( int i = 0; i < 6; ++i ) + // need additional block to avoid prev: popping block would leave head block null error + generate_block( skip ); + + for( int i = 0; i < 8; ++i ) { idump( (i) ); int blocks = 0; auto mi = db.get_global_properties().parameters.maintenance_interval; - if( i == 2 ) // go beyond hard fork 890, 343, 935 + if( i == 2 ) // go beyond hard fork 890 { generate_blocks( HARDFORK_CORE_868_890_TIME - mi, true, skip ); + generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); + } + else if( i == 4 ) // go beyond hard fork 935 + { + generate_blocks( HARDFORK_CORE_935_TIME - mi, true, skip ); + generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); } - else if( i == 4 ) // go beyond hard fork 1270 + else if( i == 6 ) // go beyond hard fork 1270 { generate_blocks( HARDFORK_CORE_1270_TIME - mi, true, skip ); + generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); } - generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); - set_expiration( db, trx ); ACTORS( (seller)(borrower)(feedproducer)(feedproducer2)(feedproducer3) ); @@ -1062,12 +1070,48 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) trx.clear(); } - if( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_935_TIME ) + bool affected_by_hf_343 = false; + + // check + if( i / 2 == 0 ) // before hard fork 890 { // median feed won't change (issue 890) BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 1750 ); BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1100 ); + // limit order is still there + BOOST_CHECK( db.find( sell_id ) ); + + // go beyond hard fork 890 + blocks += generate_blocks( HARDFORK_CORE_868_890_TIME - mi, true, skip ); + bool was_before_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_343_TIME ); + + blocks += generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); + bool now_after_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_343_TIME ); + + // order is filled here + BOOST_CHECK( !db.find( sell_id ) ); + + if( was_before_hf_343 && now_after_hf_343 ) // if hf 343 executed at same maintenance interval, actually after hf 890 + affected_by_hf_343 = true; + } + + // after hard fork 890, if it's before hard fork 935 + if( db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_935_TIME ) + { + // median should have changed + BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); + if( i % 2 == 0 ) // MCR test, MCR should be 350% + BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500 ); + else // MSSR test, MSSR should be 125% + BOOST_CHECK_EQUAL( usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250 ); + + if( affected_by_hf_343 ) // if updated bitasset before hf 890, and hf 343 executed after hf 890 + // the limit order should have been filled + BOOST_CHECK( !db.find( sell_id ) ); + else // if not affected by hf 343 + // the limit order should be still there, because `check_call_order` was incorrectly skipped + BOOST_CHECK( db.find( sell_id ) ); // go beyond hard fork 935 blocks += generate_blocks(HARDFORK_CORE_935_TIME - mi, true, skip); @@ -1076,34 +1120,34 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) // after hard fork 935, the limit order is filled only for the MSSR test if( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_935_TIME && - db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_1270_TIME && i > 4) + db.get_dynamic_global_properties().next_maintenance_time <= HARDFORK_CORE_1270_TIME) { // check median BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); - if( i % 2 == 0 ) { // MCR bug + if( i % 2 == 0) { // MCR test, median MCR should be 350% and order will not be filled except when i = 0 BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); - BOOST_CHECK(db.find(sell_id)); // order still here + if(i / 2 == 0) // order is filled with i = 0 at HARDFORK_CORE_343_TIME + mi + BOOST_CHECK(!db.find(sell_id)); + else + BOOST_CHECK(db.find(sell_id)); // MCR bug, order still there } - else { // MSSR test, MSSR should be 125%, order filled + else { // MSSR test, MSSR should be 125% and order is filled BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250); - BOOST_CHECK(!db.find(sell_id)); + BOOST_CHECK(!db.find(sell_id)); // order filled } + // go beyond hard fork 1270 blocks += generate_blocks(HARDFORK_CORE_1270_TIME - mi, true, skip); blocks += generate_blocks(db.get_dynamic_global_properties().next_maintenance_time, true, skip); } - // after hard fork 1270 + // after hard fork 1270, the limit order should be filled for MCR test if( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_1270_TIME) { // check median BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); - if( i % 2 == 0 ) { // MCR test, median MCR should be 350%, order filled + if( i % 2 == 0 ) { // MCR test, order filled BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); - BOOST_CHECK(!db.find(sell_id)); // MCR bug fixed - } - else { // MSSR test, MSSR should be 125%, order filled - BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maximum_short_squeeze_ratio, 1250); BOOST_CHECK(!db.find(sell_id)); } } @@ -1111,7 +1155,6 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) // undo above tx's and reset generate_block( skip ); ++blocks; - while( blocks > 0 ) { db.pop_block(); From 1aad691e29bcbf4a0759b6529caac0fdcf52a688 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 30 Jan 2019 14:28:13 -0300 Subject: [PATCH 10/11] use affected_by_hf_343 flag --- tests/tests/bitasset_tests.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/tests/bitasset_tests.cpp b/tests/tests/bitasset_tests.cpp index c25e27bd10..c9f3a4d85b 100644 --- a/tests/tests/bitasset_tests.cpp +++ b/tests/tests/bitasset_tests.cpp @@ -1089,9 +1089,6 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) blocks += generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip ); bool now_after_hf_343 = ( db.get_dynamic_global_properties().next_maintenance_time > HARDFORK_CORE_343_TIME ); - // order is filled here - BOOST_CHECK( !db.find( sell_id ) ); - if( was_before_hf_343 && now_after_hf_343 ) // if hf 343 executed at same maintenance interval, actually after hf 890 affected_by_hf_343 = true; } @@ -1126,7 +1123,7 @@ BOOST_AUTO_TEST_CASE( hf_935_test ) BOOST_CHECK( usd_id(db).bitasset_data(db).current_feed.settlement_price == current_feed.settlement_price ); if( i % 2 == 0) { // MCR test, median MCR should be 350% and order will not be filled except when i = 0 BOOST_CHECK_EQUAL(usd_id(db).bitasset_data(db).current_feed.maintenance_collateral_ratio, 3500); - if(i / 2 == 0) // order is filled with i = 0 at HARDFORK_CORE_343_TIME + mi + if( affected_by_hf_343 ) BOOST_CHECK(!db.find(sell_id)); else BOOST_CHECK(db.find(sell_id)); // MCR bug, order still there From ca1e045bbf19365aa61c6fdb5c398db5c69845f3 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 30 Jan 2019 15:03:20 -0300 Subject: [PATCH 11/11] remove trailing white spaces --- tests/tests/market_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/market_tests.cpp b/tests/tests/market_tests.cpp index 933ed8cd00..413ffd42f9 100644 --- a/tests/tests/market_tests.cpp +++ b/tests/tests/market_tests.cpp @@ -1308,7 +1308,7 @@ BOOST_AUTO_TEST_CASE(target_cr_test_limit_call) BOOST_CHECK_LT( call2_to_cover.value, call2_id(db).debt.value ); // even though call2 has a higher CR, since call's TCR is less than call2's TCR, so we expect call will cover less when called BOOST_CHECK_LT( call_to_cover.value, call2_to_cover.value ); - + // Create a big sell order slightly below the call price, will be matched with several orders BOOST_CHECK( !create_sell_order(seller, bitusd.amount(700*4), core.amount(5900*4) ) );