Move some unacceptably slow tests to intense_tests
Speeds up chain_tests runs from ~30s to ~5s on my system.
This commit is contained in:
parent
efc1505612
commit
b134fbe43c
3 changed files with 95 additions and 119 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include <graphene/chain/account_object.hpp>
|
#include <graphene/chain/account_object.hpp>
|
||||||
#include <graphene/chain/proposal_object.hpp>
|
#include <graphene/chain/proposal_object.hpp>
|
||||||
#include <graphene/chain/witness_schedule_object.hpp>
|
#include <graphene/chain/witness_schedule_object.hpp>
|
||||||
|
#include <graphene/chain/vesting_balance_object.hpp>
|
||||||
|
|
||||||
#include <fc/crypto/digest.hpp>
|
#include <fc/crypto/digest.hpp>
|
||||||
|
|
||||||
|
|
@ -401,4 +402,91 @@ BOOST_FIXTURE_TEST_CASE( generic_scheduler_mc_test, database_fixture )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_FIXTURE_TEST_CASE( tapos_rollover, database_fixture )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ACTORS((alice)(bob));
|
||||||
|
const auto& core = asset_id_type()(db);
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Give Alice some money" );
|
||||||
|
transfer(genesis_account, alice_id, asset(10000));
|
||||||
|
generate_block();
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Generate up to block 0xFF00" );
|
||||||
|
generate_blocks( 0xFF00 );
|
||||||
|
signed_transaction xfer_tx;
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Transfer money at/about 0xFF00" );
|
||||||
|
transfer_operation xfer_op;
|
||||||
|
xfer_op.from = alice_id;
|
||||||
|
xfer_op.to = bob_id;
|
||||||
|
xfer_op.amount = asset(1000);
|
||||||
|
|
||||||
|
xfer_tx.operations.push_back( xfer_op );
|
||||||
|
xfer_tx.set_expiration( db.head_block_id(), 0x1000 );
|
||||||
|
sign( xfer_tx, alice_private_key );
|
||||||
|
PUSH_TX( db, xfer_tx, 0 );
|
||||||
|
generate_block();
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Sign new tx's" );
|
||||||
|
xfer_tx.set_expiration( db.head_block_id(), 0x1000 );
|
||||||
|
xfer_tx.signatures.clear();
|
||||||
|
sign( xfer_tx, alice_private_key );
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Generate up to block 0x10010" );
|
||||||
|
generate_blocks( 0x110 );
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Transfer at/about block 0x10010 using reference block at/about 0xFF00" );
|
||||||
|
PUSH_TX( db, xfer_tx, 0 );
|
||||||
|
generate_block();
|
||||||
|
}
|
||||||
|
catch (fc::exception& e)
|
||||||
|
{
|
||||||
|
edump((e.to_detail_string()));
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_FIXTURE_TEST_CASE(bulk_discount, database_fixture)
|
||||||
|
{ try {
|
||||||
|
ACTOR(nathan);
|
||||||
|
// Give nathan ALLLLLL the money!
|
||||||
|
transfer(GRAPHENE_COMMITTEE_ACCOUNT, nathan_id, db.get_balance(GRAPHENE_COMMITTEE_ACCOUNT, asset_id_type()));
|
||||||
|
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
||||||
|
upgrade_to_lifetime_member(nathan_id);
|
||||||
|
share_type new_fees;
|
||||||
|
while( nathan_id(db).statistics(db).lifetime_fees_paid + new_fees < GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN )
|
||||||
|
{
|
||||||
|
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
||||||
|
new_fees += transfer_operation().calculate_fee(db.current_fee_schedule());
|
||||||
|
}
|
||||||
|
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
||||||
|
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
||||||
|
auto old_cashback = nathan_id(db).cashback_balance(db).balance;
|
||||||
|
|
||||||
|
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
||||||
|
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
||||||
|
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(nathan_id(db).cashback_balance(db).balance.amount.value,
|
||||||
|
old_cashback.amount.value + GRAPHENE_BLOCKCHAIN_PRECISION * 8);
|
||||||
|
|
||||||
|
new_fees = 0;
|
||||||
|
while( nathan_id(db).statistics(db).lifetime_fees_paid + new_fees < GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX )
|
||||||
|
{
|
||||||
|
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
||||||
|
new_fees += transfer_operation().calculate_fee(db.current_fee_schedule());
|
||||||
|
}
|
||||||
|
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
||||||
|
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
||||||
|
old_cashback = nathan_id(db).cashback_balance(db).balance;
|
||||||
|
|
||||||
|
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
||||||
|
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(nathan_id(db).cashback_balance(db).balance.amount.value,
|
||||||
|
old_cashback.amount.value + GRAPHENE_BLOCKCHAIN_PRECISION * 9);
|
||||||
|
} FC_LOG_AND_RETHROW() }
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
||||||
|
|
@ -823,7 +823,7 @@ BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture )
|
||||||
// Sam is the creator of accounts
|
// Sam is the creator of accounts
|
||||||
private_key_type genesis_key = delegate_priv_key;
|
private_key_type genesis_key = delegate_priv_key;
|
||||||
private_key_type sam_key = generate_private_key("sam");
|
private_key_type sam_key = generate_private_key("sam");
|
||||||
account_object sam_account_object = create_account( "sam", sam_key );
|
account_object sam_account_object = create_account("sam", sam_key);
|
||||||
|
|
||||||
//Get a sane head block time
|
//Get a sane head block time
|
||||||
generate_block( skip_flags );
|
generate_block( skip_flags );
|
||||||
|
|
@ -839,18 +839,16 @@ BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture )
|
||||||
// transfer from genesis account to Sam account
|
// transfer from genesis account to Sam account
|
||||||
transfer(genesis_account_object, sam_account_object, core.amount(100000));
|
transfer(genesis_account_object, sam_account_object, core.amount(100000));
|
||||||
|
|
||||||
generate_block( skip_flags );
|
generate_block(skip_flags);
|
||||||
|
|
||||||
create_account( "alice" );
|
create_account("alice");
|
||||||
generate_block( skip_flags );
|
generate_block(skip_flags);
|
||||||
create_account( "bob" );
|
create_account("bob");
|
||||||
generate_block( skip_flags );
|
generate_block(skip_flags);
|
||||||
|
|
||||||
db.pop_block();
|
db.pop_block();
|
||||||
db.pop_block();
|
db.pop_block();
|
||||||
}
|
} catch(const fc::exception& e) {
|
||||||
catch( const fc::exception& e )
|
|
||||||
{
|
|
||||||
edump( (e.to_detail_string()) );
|
edump( (e.to_detail_string()) );
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
@ -882,73 +880,4 @@ BOOST_FIXTURE_TEST_CASE( witness_scheduler_missed_blocks, database_fixture )
|
||||||
});
|
});
|
||||||
} FC_LOG_AND_RETHROW() }
|
} FC_LOG_AND_RETHROW() }
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE( account_create_fee_scaling, database_fixture )
|
|
||||||
{ try {
|
|
||||||
auto accounts_per_scale = db.get_global_properties().parameters.accounts_per_fee_scale;
|
|
||||||
enable_fees(1);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees.account_create_fee, 1);
|
|
||||||
for( int i = db.get_dynamic_global_properties().accounts_registered_this_interval; i < accounts_per_scale; ++i )
|
|
||||||
create_account("shill" + fc::to_string(i));
|
|
||||||
generate_block();
|
|
||||||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees.account_create_fee, 16);
|
|
||||||
for( int i = 0; i < accounts_per_scale; ++i )
|
|
||||||
create_account("moreshills" + fc::to_string(i));
|
|
||||||
generate_block();
|
|
||||||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees.account_create_fee, 256);
|
|
||||||
for( int i = 0; i < accounts_per_scale; ++i )
|
|
||||||
create_account("moarshills" + fc::to_string(i));
|
|
||||||
generate_block();
|
|
||||||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees.account_create_fee, 4096);
|
|
||||||
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
|
||||||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.current_fees.account_create_fee, 1);
|
|
||||||
} FC_LOG_AND_RETHROW() }
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE( tapos_rollover, database_fixture )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ACTORS((alice)(bob));
|
|
||||||
const auto& core = asset_id_type()(db);
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Give Alice some money" );
|
|
||||||
transfer(genesis_account, alice_id, asset(10000));
|
|
||||||
generate_block();
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Generate up to block 0xFF00" );
|
|
||||||
generate_blocks( 0xFF00 );
|
|
||||||
signed_transaction xfer_tx;
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Transfer money at/about 0xFF00" );
|
|
||||||
transfer_operation xfer_op;
|
|
||||||
xfer_op.from = alice_id;
|
|
||||||
xfer_op.to = bob_id;
|
|
||||||
xfer_op.amount = asset(1000);
|
|
||||||
|
|
||||||
xfer_tx.operations.push_back( xfer_op );
|
|
||||||
xfer_tx.set_expiration( db.head_block_id(), 0x1000 );
|
|
||||||
sign( xfer_tx, alice_private_key );
|
|
||||||
PUSH_TX( db, xfer_tx, 0 );
|
|
||||||
generate_block();
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Sign new tx's" );
|
|
||||||
xfer_tx.set_expiration( db.head_block_id(), 0x1000 );
|
|
||||||
xfer_tx.signatures.clear();
|
|
||||||
sign( xfer_tx, alice_private_key );
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Generate up to block 0x10010" );
|
|
||||||
generate_blocks( 0x110 );
|
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Transfer at/about block 0x10010 using reference block at/about 0xFF00" );
|
|
||||||
PUSH_TX( db, xfer_tx, 0 );
|
|
||||||
generate_block();
|
|
||||||
}
|
|
||||||
catch (fc::exception& e)
|
|
||||||
{
|
|
||||||
edump((e.to_detail_string()));
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
||||||
|
|
@ -130,45 +130,4 @@ BOOST_AUTO_TEST_CASE( cashback_test )
|
||||||
BOOST_CHECK_EQUAL(stud_id(db).cashback_balance(db).balance.amount.value, 25750);
|
BOOST_CHECK_EQUAL(stud_id(db).cashback_balance(db).balance.amount.value, 25750);
|
||||||
} FC_LOG_AND_RETHROW() }
|
} FC_LOG_AND_RETHROW() }
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(bulk_discount)
|
|
||||||
{ try {
|
|
||||||
ACTOR(nathan);
|
|
||||||
// Give nathan ALLLLLL the money!
|
|
||||||
transfer(GRAPHENE_COMMITTEE_ACCOUNT, nathan_id, db.get_balance(GRAPHENE_COMMITTEE_ACCOUNT, asset_id_type()));
|
|
||||||
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
|
||||||
upgrade_to_lifetime_member(nathan_id);
|
|
||||||
share_type new_fees;
|
|
||||||
while( nathan_id(db).statistics(db).lifetime_fees_paid + new_fees < GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN )
|
|
||||||
{
|
|
||||||
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
|
||||||
new_fees += transfer_operation().calculate_fee(db.current_fee_schedule());
|
|
||||||
}
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
|
||||||
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
|
||||||
auto old_cashback = nathan_id(db).cashback_balance(db).balance;
|
|
||||||
|
|
||||||
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
|
||||||
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(nathan_id(db).cashback_balance(db).balance.amount.value,
|
|
||||||
old_cashback.amount.value + GRAPHENE_BLOCKCHAIN_PRECISION * 8);
|
|
||||||
|
|
||||||
new_fees = 0;
|
|
||||||
while( nathan_id(db).statistics(db).lifetime_fees_paid + new_fees < GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX )
|
|
||||||
{
|
|
||||||
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
|
||||||
new_fees += transfer_operation().calculate_fee(db.current_fee_schedule());
|
|
||||||
}
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
|
||||||
enable_fees(GRAPHENE_BLOCKCHAIN_PRECISION*10);
|
|
||||||
old_cashback = nathan_id(db).cashback_balance(db).balance;
|
|
||||||
|
|
||||||
transfer(nathan_id, GRAPHENE_COMMITTEE_ACCOUNT, asset(1));
|
|
||||||
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(nathan_id(db).cashback_balance(db).balance.amount.value,
|
|
||||||
old_cashback.amount.value + GRAPHENE_BLOCKCHAIN_PRECISION * 9);
|
|
||||||
} FC_LOG_AND_RETHROW() }
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue