Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix failing tests in testnet #1594

Merged
merged 4 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ database_fixture::database_fixture(const fc::time_point_sec &initial_timestamp)

genesis_state.initial_timestamp = initial_timestamp;

genesis_state.initial_active_witnesses = 10;
if(boost::unit_test::framework::current_test_case().p_name.value == "hf_935_test")
genesis_state.initial_active_witnesses = 20;
else
genesis_state.initial_active_witnesses = 10;

for( unsigned int i = 0; i < genesis_state.initial_active_witnesses; ++i )
{
auto name = "init"+fc::to_string(i);
Expand Down
3 changes: 0 additions & 3 deletions tests/tests/bitasset_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,6 @@ BOOST_AUTO_TEST_CASE( hf_935_test )
generate_blocks( db.get_dynamic_global_properties().next_maintenance_time, true, skip );
generate_block( skip );

// 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) );
Expand Down
13 changes: 7 additions & 6 deletions tests/tests/market_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1817,14 +1817,14 @@ BOOST_AUTO_TEST_CASE(mcr_bug_cross1270)
auto mi = db.get_global_properties().parameters.maintenance_interval;
generate_blocks(HARDFORK_CORE_1270_TIME - mi);

const asset_object& core = get_asset("BTS");
const asset_object& core = get_asset(GRAPHENE_SYMBOL);
const asset_object& bitusd = get_asset("USDBIT");
const asset_id_type bitusd_id = bitusd.id;
const account_object& feedproducer = get_account("feedproducer");

// feed is expired
BOOST_CHECK_EQUAL((*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio, 1750);
BOOST_CHECK_EQUAL((*bitusd_id(db).bitasset_data_id)(db).feed_is_expired(db.head_block_time()), false); // should be true?
auto mcr = (*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio;
BOOST_CHECK_EQUAL(mcr, GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO);

// make new feed
price_feed current_feed;
Expand All @@ -1833,15 +1833,16 @@ BOOST_AUTO_TEST_CASE(mcr_bug_cross1270)
current_feed.maximum_short_squeeze_ratio = 1100;
publish_feed( bitusd, feedproducer, current_feed );

BOOST_CHECK_EQUAL((*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio, 2000);
BOOST_CHECK_EQUAL((*bitusd_id(db).bitasset_data_id)(db).feed_is_expired(db.head_block_time()), false);
mcr = (*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio;
BOOST_CHECK_EQUAL(mcr, 2000);

// pass hardfork
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
generate_block();

// feed is still valid
BOOST_CHECK_EQUAL((*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio, 2000);
mcr = (*bitusd_id(db).bitasset_data_id)(db).current_feed.maintenance_collateral_ratio;
BOOST_CHECK_EQUAL(mcr, 2000);

// margin call is traded
print_market(asset_id_type(1)(db).symbol, asset_id_type()(db).symbol);
Expand Down