Rename bad references to genesis account -> committee account; #147

This commit is contained in:
Vikram Rajkumar 2015-07-13 15:19:36 -04:00
parent 12d8f3732e
commit 70b77be3bc
22 changed files with 115 additions and 115 deletions

View file

@ -191,9 +191,9 @@ Questions
Yes. Documentation of the code base, including APIs, can be generated using Doxygen. Simply run `doxygen` in this directory.
If both Doxygen and perl are available in your build environment, the CLI wallet's `help` and `gethelp`
commands will display help generated from the doxygen documentation.
commands will display help generated from the doxygen documentation.
If your CLI wallet's `help` command displays descriptions without parameter names like
If your CLI wallet's `help` command displays descriptions without parameter names like
`signed_transaction transfer(string, string, string, string, string, bool)`
it means CMake was unable to find Doxygen or perl during configuration. If found, the
output should look like this:
@ -231,7 +231,7 @@ Questions
- The answer to the previous question was really confusing. Can you make it clearer?
All account ID's are of the form `1.2.x`. If you were the 9735th account to be registered,
your account's ID will be `1.2.9735`. Account `0` is special (it's the "genesis account,"
your account's ID will be `1.2.9735`. Account `0` is special (it's the "committee account,"
which is controlled by the delegates and has a few abilities and restrictions other accounts
do not).

View file

@ -325,7 +325,7 @@ void_result asset_update_feed_producers_evaluator::do_evaluate(const asset_updat
const asset_object& a = o.asset_to_update(d);
FC_ASSERT(a.is_market_issued(), "Cannot update feed producers on a non-BitAsset.");
FC_ASSERT(a.issuer != account_id_type(), "Cannot set feed producers on a genesis-issued asset.");
FC_ASSERT(a.issuer != GRAPHENE_COMMITTEE_ACCOUNT, "Cannot set feed producers on a committee-issued asset.");
const asset_bitasset_data_object& b = a.bitasset_data(d);
bitasset_to_update = &b;

View file

@ -204,7 +204,7 @@ void database::update_active_delegates()
auto delegates = sort_votable_objects<delegate_index>(std::max(delegate_count*2+1, (size_t)GRAPHENE_MIN_DELEGATE_COUNT));
// Update genesis authorities
// Update committee authorities
if( !delegates.empty() )
{
modify(get(GRAPHENE_COMMITTEE_ACCOUNT), [&](account_object& a) {

View file

@ -167,7 +167,7 @@ namespace graphene { namespace chain {
/// The tunable options for BitAssets are stored in this field.
bitasset_options options;
/// Feeds published for this asset. If issuer is not genesis, the keys in this map are the feed publishing
/// Feeds published for this asset. If issuer is not committee, the keys in this map are the feed publishing
/// accounts; otherwise, the feed publishers are the currently active delegates and witnesses and this map
/// should be treated as an implementation detail. The timestamp on each feed is the time it was published.
flat_map<account_id_type, pair<time_point_sec,price_feed>> feeds;

View file

@ -30,7 +30,7 @@ namespace graphene { namespace chain {
* @ingroup object
*
* A delegate is responsible for setting blockchain parameters and has
* dynamic multi-sig control over the genesis account. The current set of
* dynamic multi-sig control over the committee account. The current set of
* active delegates has control.
*
* Delegates were separated into a separate object to make iterating over

View file

@ -282,7 +282,7 @@ namespace graphene { namespace chain {
* This operation is used to specify which accounts may produce feeds for a given BitAsset.
*
* @pre @ref issuer MUST be an existing account, and MUST match asset_object::issuer on @ref asset_to_update
* @pre @ref issuer MUST NOT be the genesis account
* @pre @ref issuer MUST NOT be the committee account
* @pre @ref asset_to_update MUST be a BitAsset, i.e. @ref asset_object::is_market_issued() returns true
* @pre @ref fee MUST be nonnegative, and @ref issuer MUST have a sufficient balance to pay it
* @pre Cardinality of @ref new_feed_producers MUST NOT exceed @ref chain_parameters::maximum_asset_feed_publishers

View file

@ -36,7 +36,7 @@ namespace graphene { namespace chain {
smart_ref<fee_schedule> current_fees; ///< current schedule of fees
uint8_t block_interval = GRAPHENE_DEFAULT_BLOCK_INTERVAL; ///< interval in seconds between blocks
uint32_t maintenance_interval = GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL; ///< interval in sections between blockchain maintenance events
uint32_t committee_proposal_review_period = GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC; ///< minimum time in seconds that a proposed transaction requiring genesis authority may not be signed, prior to expiration
uint32_t committee_proposal_review_period = GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC; ///< minimum time in seconds that a proposed transaction requiring committee authority may not be signed, prior to expiration
uint32_t maximum_transaction_size = GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE; ///< maximum allowable size in bytes for a transaction
uint32_t maximum_block_size = GRAPHENE_DEFAULT_MAX_BLOCK_SIZE; ///< maximum allowable size in bytes for a block
uint32_t maximum_undo_history = GRAPHENE_DEFAULT_MAX_UNDO_HISTORY; ///< maximum number of undo states to keep in RAM
@ -89,7 +89,7 @@ namespace graphene { namespace chain {
FC_ASSERT( maximum_time_until_expiration > block_interval,
"Maximum transaction expiration time must be greater than a block interval" );
FC_ASSERT( maximum_proposal_lifetime - committee_proposal_review_period > block_interval,
"Genesis proposal review period must be less than the maximum proposal lifetime" );
"Committee proposal review period must be less than the maximum proposal lifetime" );
}
};

View file

@ -57,9 +57,9 @@ namespace graphene { namespace chain {
optional<uint32_t> review_period_seconds;
extensions_type extensions;
/// Constructs a proposal_create_operation suitable for genesis proposals, with fee, expiration time and review
/// Constructs a proposal_create_operation suitable for committee proposals, with fee, expiration time and review
/// period set appropriately.
static proposal_create_operation genesis_proposal(const chain_parameters& param, fc::time_point_sec head_block_time );
static proposal_create_operation committee_proposal(const chain_parameters& param, fc::time_point_sec head_block_time );
account_id_type fee_payer()const { return fee_paying_account; }
void validate()const;

View file

@ -35,7 +35,7 @@ void_result proposal_create_evaluator::do_evaluate(const proposal_create_operati
"Proposal review period must be less than its overall lifetime." );
{
// If we're dealing with the genesis authority, make sure this transaction has a sufficient review period.
// If we're dealing with the committee authority, make sure this transaction has a sufficient review period.
flat_set<account_id_type> auths;
vector<authority> other;
for( auto& op : o.proposed_ops )

View file

@ -4,7 +4,7 @@
namespace graphene { namespace chain {
proposal_create_operation proposal_create_operation::genesis_proposal(const chain_parameters& global_params, fc::time_point_sec head_block_time )
proposal_create_operation proposal_create_operation::committee_proposal(const chain_parameters& global_params, fc::time_point_sec head_block_time )
{
proposal_create_operation op;
op.expiration_time = head_block_time + global_params.maximum_proposal_lifetime;

View file

@ -132,9 +132,9 @@ int main( int argc, char** argv )
//fc::configure_logging( cfg );
fc::ecc::private_key genesis_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
fc::ecc::private_key committee_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
idump( (key_to_wif( genesis_private_key ) ) );
idump( (key_to_wif( committee_private_key ) ) );
fc::ecc::private_key nathan_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
idump( (key_to_wif( nathan_private_key ) ) );

View file

@ -105,9 +105,9 @@ int main( int argc, char** argv )
//fc::configure_logging( cfg );
fc::ecc::private_key genesis_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
fc::ecc::private_key committee_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
idump( (key_to_wif( genesis_private_key ) ) );
idump( (key_to_wif( committee_private_key ) ) );
fc::ecc::private_key nathan_private_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
public_key_type nathan_pub_key = nathan_private_key.get_public_key();

View file

@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE( two_node_network )
ilog("Connected!");
fc::ecc::private_key nathan_key = fc::ecc::private_key::generate();
fc::ecc::private_key genesis_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan")));
graphene::chain::signed_transaction trx;
trx.set_expiration(now + fc::seconds(30));
std::shared_ptr<chain::database> db2 = app2.chain_database();
@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE( two_node_network )
now += GRAPHENE_DEFAULT_BLOCK_INTERVAL;
app2.p2p_node()->broadcast(graphene::net::block_message(db2->generate_block(now,
db2->get_scheduled_witness(1).first,
genesis_key,
committee_key,
database::skip_nothing)));
fc::usleep(fc::milliseconds(500));

View file

@ -120,9 +120,9 @@ database_fixture::~database_fixture()
fc::ecc::private_key database_fixture::generate_private_key(string seed)
{
static const fc::ecc::private_key genesis = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
static const fc::ecc::private_key committee = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")));
if( seed == "null_key" )
return genesis;
return committee;
return fc::ecc::private_key::regenerate(fc::sha256::hash(seed));
}

View file

@ -141,8 +141,8 @@ struct database_fixture {
genesis_state_type genesis_state;
chain::database &db;
signed_transaction trx;
public_key_type genesis_key;
account_id_type genesis_account;
public_key_type committee_key;
account_id_type committee_account;
fc::ecc::private_key private_key = fc::ecc::private_key::generate();
fc::ecc::private_key delegate_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) );
public_key_type delegate_pub_key;

View file

@ -49,7 +49,7 @@ BOOST_FIXTURE_TEST_CASE( update_account_keys, database_fixture )
;
// Sam is the creator of accounts
private_key_type genesis_key = delegate_priv_key;
private_key_type committee_key = delegate_priv_key;
private_key_type sam_key = generate_private_key("sam");
//
@ -78,9 +78,9 @@ BOOST_FIXTURE_TEST_CASE( update_account_keys, database_fixture )
transaction tx;
processed_transaction ptx;
account_object genesis_account_object = genesis_account(db);
// transfer from genesis account to Sam account
transfer(genesis_account_object, sam_account_object, core.amount(100000));
account_object committee_account_object = committee_account(db);
// transfer from committee account to Sam account
transfer(committee_account_object, sam_account_object, core.amount(100000));
const int num_keys = 5;
vector< private_key_type > numbered_private_keys;
@ -410,7 +410,7 @@ BOOST_FIXTURE_TEST_CASE( tapos_rollover, database_fixture )
const auto& core = asset_id_type()(db);
BOOST_TEST_MESSAGE( "Give Alice some money" );
transfer(genesis_account, alice_id, asset(10000));
transfer(committee_account, alice_id, asset(10000));
generate_block();
BOOST_TEST_MESSAGE( "Generate up to block 0xFF00" );

View file

@ -34,12 +34,12 @@ BOOST_AUTO_TEST_CASE( transfer_benchmark )
{
fc::ecc::private_key nathan_key = fc::ecc::private_key::generate();
const key_object& key = register_key(nathan_key.get_public_key());
const auto& genesis = account_id_type()(db);
const auto& committee_account = account_id_type()(db);
auto start = fc::time_point::now();
for( uint32_t i = 0; i < 1000*1000; ++i )
{
const auto& a = create_account("a"+fc::to_string(i), key.id);
transfer( genesis, a, asset(1000) );
transfer( committee_account, a, asset(1000) );
}
auto end = fc::time_point::now();
auto elapsed = end - start;

View file

@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE( recursive_accounts )
BOOST_CHECK_EQUAL(get_balance(child, core), old_balance - 2000);
trx.clear();
BOOST_TEST_MESSAGE( "Update grandparent account authority to be genesis account" );
BOOST_TEST_MESSAGE( "Update grandparent account authority to be committee account" );
{
account_update_operation op;
op.account = grandparent.id;
@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE( proposed_single_account )
try {
INVOKE(any_two_of_three);
fc::ecc::private_key genesis_key = delegate_priv_key;
fc::ecc::private_key committee_key = delegate_priv_key;
fc::ecc::private_key nathan_key1 = fc::ecc::private_key::regenerate(fc::digest("key1"));
fc::ecc::private_key nathan_key2 = fc::ecc::private_key::regenerate(fc::digest("key2"));
fc::ecc::private_key nathan_key3 = fc::ecc::private_key::regenerate(fc::digest("key3"));
@ -355,14 +355,14 @@ BOOST_AUTO_TEST_CASE( proposed_single_account )
pup.active_approvals_to_add.insert(nathan.id);
trx.operations = {pup};
trx.sign( genesis_key );
//Genesis may not add nathan's approval.
trx.sign( committee_key );
//committee may not add nathan's approval.
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
pup.active_approvals_to_add.clear();
pup.active_approvals_to_add.insert(account_id_type());
trx.operations = {pup};
trx.sign( genesis_key );
//Genesis has no stake in the transaction.
trx.sign( committee_key );
//committee has no stake in the transaction.
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
trx.signatures.clear();
@ -382,11 +382,11 @@ BOOST_AUTO_TEST_CASE( proposed_single_account )
}
}
/// Verify that genesis authority cannot be invoked in a normal transaction
BOOST_AUTO_TEST_CASE( genesis_authority )
/// Verify that committee authority cannot be invoked in a normal transaction
BOOST_AUTO_TEST_CASE( committee_authority )
{ try {
fc::ecc::private_key nathan_key = fc::ecc::private_key::generate();
fc::ecc::private_key genesis_key = delegate_priv_key;
fc::ecc::private_key committee_key = delegate_priv_key;
const account_object nathan = create_account("nathan", nathan_key.get_public_key());
const auto& global_params = db.get_global_properties().parameters;
@ -398,12 +398,12 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
p.parameters.committee_proposal_review_period = fc::days(1).to_seconds();
});
BOOST_TEST_MESSAGE( "transfering 100000 CORE to nathan, signing with genesis key" );
BOOST_TEST_MESSAGE( "transfering 100000 CORE to nathan, signing with committee key" );
transfer_operation top;
top.to = nathan.id;
top.amount = asset(100000);
trx.operations.push_back(top);
sign(trx, genesis_key);
sign(trx, committee_key);
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
auto sign = [&] { trx.signatures.clear(); trx.sign(nathan_key); };
@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
uop.proposal = prop.id;
uop.key_approvals_to_add.emplace(genesis_key.get_public_key());
uop.key_approvals_to_add.emplace(committee_key.get_public_key());
/*
uop.key_approvals_to_add.emplace(1);
uop.key_approvals_to_add.emplace(2);
@ -456,16 +456,16 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
uop.key_approvals_to_add.emplace(6);
*/
trx.operations.push_back(uop);
trx.sign(genesis_key);
trx.sign(committee_key);
db.push_transaction(trx);
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 0);
BOOST_CHECK(db.get<proposal_object>(prop.id).is_authorized_to_execute(db));
generate_blocks(*prop.review_period_time);
uop.key_approvals_to_add.clear();
uop.key_approvals_to_add.insert(genesis_key.get_public_key()); // was 7
uop.key_approvals_to_add.insert(committee_key.get_public_key()); // was 7
trx.operations.back() = uop;
trx.sign( genesis_key);
trx.sign( committee_key);
// Should throw because the transaction is now in review.
GRAPHENE_CHECK_THROW(PUSH_TX( db, trx ), fc::exception);
@ -476,7 +476,7 @@ BOOST_AUTO_TEST_CASE( genesis_authority )
BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture )
{ try {
generate_block();
fc::ecc::private_key genesis_key = delegate_priv_key;
fc::ecc::private_key committee_key = delegate_priv_key;
fc::ecc::private_key delegate_key = fc::ecc::private_key::generate();
//Meet nathan. He has a little money.
@ -499,7 +499,7 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture )
}
//A proposal is created to give nathan lots more money.
proposal_create_operation pop = proposal_create_operation::genesis_proposal(db.get_global_properties().parameters, db.head_block_time());
proposal_create_operation pop = proposal_create_operation::committee_proposal(db.get_global_properties().parameters, db.head_block_time());
pop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
pop.expiration_time = db.head_block_time() + *pop.review_period_seconds * 3;
@ -512,7 +512,7 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture )
proposal_id_type pid = prop.id;
BOOST_CHECK(!pid(db).is_authorized_to_execute(db));
//Genesis key approves of the proposal.
//committee key approves of the proposal.
proposal_update_operation uop;
uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
uop.proposal = pid;
@ -528,7 +528,7 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture )
uop.key_approvals_to_add.emplace(9);
*/
trx.operations.back() = uop;
trx.sign(genesis_key);
trx.sign(committee_key);
PUSH_TX( db, trx );
BOOST_CHECK(pid(db).is_authorized_to_execute(db));
@ -882,17 +882,17 @@ BOOST_FIXTURE_TEST_CASE( max_authority_membership, database_fixture )
transaction tx;
processed_transaction ptx;
private_key_type genesis_key = delegate_priv_key;
private_key_type committee_key = delegate_priv_key;
// Sam is the creator of accounts
private_key_type sam_key = generate_private_key("sam");
account_object sam_account_object = create_account( "sam", sam_key );
upgrade_to_lifetime_member(sam_account_object);
account_object genesis_account_object = genesis_account(db);
account_object committee_account_object = committee_account(db);
const asset_object& core = asset_id_type()(db);
transfer(genesis_account_object, sam_account_object, core.amount(100000));
transfer(committee_account_object, sam_account_object, core.amount(100000));
// have Sam create some keys
@ -968,13 +968,13 @@ BOOST_FIXTURE_TEST_CASE( bogus_signature, database_fixture )
{
try
{
private_key_type genesis_key = delegate_priv_key;
private_key_type committee_key = delegate_priv_key;
// Sam is the creator of accounts
private_key_type alice_key = generate_private_key("alice");
private_key_type bob_key = generate_private_key("bob");
private_key_type charlie_key = generate_private_key("charlie");
account_object genesis_account_object = genesis_account(db);
account_object committee_account_object = committee_account(db);
account_object alice_account_object = create_account( "alice", alice_key );
account_object bob_account_object = create_account( "bob", bob_key );
account_object charlie_account_object = create_account( "charlie", charlie_key );
@ -987,7 +987,7 @@ BOOST_FIXTURE_TEST_CASE( bogus_signature, database_fixture )
// send from Sam -> Alice, signed by Sam
const asset_object& core = asset_id_type()(db);
transfer(genesis_account_object, alice_account_object, core.amount(100000));
transfer(committee_account_object, alice_account_object, core.amount(100000));
transfer_operation xfer_op;
xfer_op.from = alice_account_object.id;

View file

@ -555,9 +555,9 @@ BOOST_FIXTURE_TEST_CASE( limit_order_expiration, database_fixture )
auto* test = &create_bitasset("TEST");
auto* core = &asset_id_type()(db);
auto* nathan = &create_account("nathan");
auto* genesis = &account_id_type()(db);
auto* committee = &account_id_type()(db);
transfer(*genesis, *nathan, core->amount(50000));
transfer(*committee, *nathan, core->amount(50000));
BOOST_CHECK_EQUAL( get_balance(*nathan, *core), 50000 );
@ -584,7 +584,7 @@ BOOST_FIXTURE_TEST_CASE( limit_order_expiration, database_fixture )
test = &get_asset("TEST");
core = &asset_id_type()(db);
nathan = &get_account("nathan");
genesis = &account_id_type()(db);
committee = &account_id_type()(db);
BOOST_CHECK(db.find_object(id) == nullptr);
BOOST_CHECK_EQUAL( get_balance(*nathan, *core), 50000 );
@ -646,7 +646,7 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture )
BOOST_TEST_MESSAGE( "Creating a proposal to change the block_interval to 1 second" );
{
proposal_create_operation cop = proposal_create_operation::genesis_proposal(db.get_global_properties().parameters, db.head_block_time());
proposal_create_operation cop = proposal_create_operation::committee_proposal(db.get_global_properties().parameters, db.head_block_time());
cop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
cop.expiration_time = db.head_block_time() + *cop.review_period_seconds + 10;
delegate_update_global_parameters_operation uop;
@ -710,7 +710,7 @@ BOOST_FIXTURE_TEST_CASE( unimp_force_settlement, database_fixture )
/*
try {
auto private_key = delegate_priv_key;
auto private_key = generate_private_key("genesis");
auto private_key = generate_private_key("committee");
>>>>>>> short_refactor
account_id_type nathan_id = create_account("nathan").get_id();
account_id_type shorter1_id = create_account("shorter1").get_id();
@ -848,7 +848,7 @@ BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture )
const asset_object& core = asset_id_type()(db);
// Sam is the creator of accounts
private_key_type genesis_key = delegate_priv_key;
private_key_type committee_key = delegate_priv_key;
private_key_type sam_key = generate_private_key("sam");
account_object sam_account_object = create_account("sam", sam_key);
@ -862,9 +862,9 @@ BOOST_FIXTURE_TEST_CASE( pop_block_twice, database_fixture )
transaction tx;
processed_transaction ptx;
account_object genesis_account_object = genesis_account(db);
// transfer from genesis account to Sam account
transfer(genesis_account_object, sam_account_object, core.amount(100000));
account_object committee_account_object = committee_account(db);
// transfer from committee account to Sam account
transfer(committee_account_object, sam_account_object, core.amount(100000));
generate_block(skip_flags);

View file

@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE( call_order_update_test )
const auto& bitusd = create_bitasset("BITUSD");
const auto& core = asset_id_type()(db);
transfer(genesis_account, dan_id, asset(10000000));
transfer(committee_account, dan_id, asset(10000000));
update_feed_producers( bitusd, {sam.id} );
price_feed current_feed; current_feed.settlement_price = bitusd.amount( 100 ) / core.amount(100);
@ -162,9 +162,9 @@ BOOST_AUTO_TEST_CASE( margin_call_limit_test )
int64_t init_balance(1000000);
transfer(genesis_account, buyer_id, asset(init_balance));
transfer(genesis_account, borrower_id, asset(init_balance));
transfer(genesis_account, borrower2_id, asset(init_balance));
transfer(committee_account, buyer_id, asset(init_balance));
transfer(committee_account, borrower_id, asset(init_balance));
transfer(committee_account, borrower2_id, asset(init_balance));
update_feed_producers( bitusd, {feedproducer.id} );
price_feed current_feed;
@ -221,9 +221,9 @@ BOOST_AUTO_TEST_CASE( black_swan )
int64_t init_balance(1000000);
transfer(genesis_account, buyer_id, asset(init_balance));
transfer(genesis_account, borrower_id, asset(init_balance));
transfer(genesis_account, borrower2_id, asset(init_balance));
transfer(committee_account, buyer_id, asset(init_balance));
transfer(committee_account, borrower_id, asset(init_balance));
transfer(committee_account, borrower2_id, asset(init_balance));
update_feed_producers(bitusd, {feedproducer.id});
price_feed current_feed;
@ -267,9 +267,9 @@ BOOST_AUTO_TEST_CASE( prediction_market )
const auto& core = asset_id_type()(db);
int64_t init_balance(1000000);
transfer(genesis_account, judge_id, asset(init_balance));
transfer(genesis_account, dan_id, asset(init_balance));
transfer(genesis_account, nathan_id, asset(init_balance));
transfer(committee_account, judge_id, asset(init_balance));
transfer(committee_account, dan_id, asset(init_balance));
transfer(committee_account, nathan_id, asset(init_balance));
BOOST_TEST_MESSAGE( "Require throw for mismatch collateral amounts" );
GRAPHENE_REQUIRE_THROW( borrow( dan, pmark.amount(1000), asset(2000) ), fc::exception );
@ -339,11 +339,11 @@ BOOST_AUTO_TEST_CASE( create_account_test )
BOOST_CHECK(nathan_account.name == "nathan");
BOOST_REQUIRE(nathan_account.owner.num_auths() == 1);
BOOST_CHECK(nathan_account.owner.key_auths.at(genesis_key) == 123);
BOOST_CHECK(nathan_account.owner.key_auths.at(committee_key) == 123);
BOOST_REQUIRE(nathan_account.active.num_auths() == 1);
BOOST_CHECK(nathan_account.active.key_auths.at(genesis_key) == 321);
BOOST_CHECK(nathan_account.active.key_auths.at(committee_key) == 321);
BOOST_CHECK(nathan_account.options.voting_account == account_id_type());
BOOST_CHECK(nathan_account.options.memo_key == genesis_key);
BOOST_CHECK(nathan_account.options.memo_key == committee_key);
const account_statistics_object& statistics = nathan_account.statistics(db);
BOOST_CHECK(statistics.id.space() == implementation_ids);
@ -409,12 +409,12 @@ BOOST_AUTO_TEST_CASE( transfer_core_asset )
try {
INVOKE(create_account_test);
account_id_type genesis_account;
asset genesis_balance = db.get_balance(account_id_type(), asset_id_type());
account_id_type committee_account;
asset committee_balance = db.get_balance(account_id_type(), asset_id_type());
const account_object& nathan_account = *db.get_index_type<account_index>().indices().get<by_name>().find("nathan");
transfer_operation top;
top.from = genesis_account;
top.from = committee_account;
top.to = nathan_account.id;
top.amount = asset( 10000);
trx.operations.push_back(top);
@ -425,14 +425,14 @@ BOOST_AUTO_TEST_CASE( transfer_core_asset )
PUSH_TX( db, trx, ~0 );
BOOST_CHECK_EQUAL(get_balance(account_id_type()(db), asset_id_type()(db)),
(genesis_balance.amount - 10000 - fee.amount).value);
genesis_balance = db.get_balance(account_id_type(), asset_id_type());
(committee_balance.amount - 10000 - fee.amount).value);
committee_balance = db.get_balance(account_id_type(), asset_id_type());
BOOST_CHECK_EQUAL(get_balance(nathan_account, asset_id_type()(db)), 10000);
trx = signed_transaction();
top.from = nathan_account.id;
top.to = genesis_account;
top.to = committee_account;
top.amount = asset(2000);
trx.operations.push_back(top);
@ -443,7 +443,7 @@ BOOST_AUTO_TEST_CASE( transfer_core_asset )
PUSH_TX( db, trx, ~0 );
BOOST_CHECK_EQUAL(get_balance(nathan_account, asset_id_type()(db)), 8000 - fee.amount.value);
BOOST_CHECK_EQUAL(get_balance(account_id_type()(db), asset_id_type()(db)), genesis_balance.amount.value + 2000);
BOOST_CHECK_EQUAL(get_balance(account_id_type()(db), asset_id_type()(db)), committee_balance.amount.value + 2000);
} catch (fc::exception& e) {
edump((e.to_detail_string()));
@ -698,22 +698,22 @@ BOOST_AUTO_TEST_CASE( transfer_uia )
const asset_object& uia = *db.get_index_type<asset_index>().indices().get<by_symbol>().find("TEST");
const account_object& nathan = *db.get_index_type<account_index>().indices().get<by_name>().find("nathan");
const account_object& genesis = account_id_type()(db);
const account_object& committee = account_id_type()(db);
BOOST_CHECK_EQUAL(get_balance(nathan, uia), 10000000);
transfer_operation top;
top.from = nathan.id;
top.to = genesis.id;
top.to = committee.id;
top.amount = uia.amount(5000);
trx.operations.push_back(top);
BOOST_TEST_MESSAGE( "Transfering 5000 TEST from nathan to genesis" );
BOOST_TEST_MESSAGE( "Transfering 5000 TEST from nathan to committee" );
PUSH_TX( db, trx, ~0 );
BOOST_CHECK_EQUAL(get_balance(nathan, uia), 10000000 - 5000);
BOOST_CHECK_EQUAL(get_balance(genesis, uia), 5000);
BOOST_CHECK_EQUAL(get_balance(committee, uia), 5000);
PUSH_TX( db, trx, ~0 );
BOOST_CHECK_EQUAL(get_balance(nathan, uia), 10000000 - 10000);
BOOST_CHECK_EQUAL(get_balance(genesis, uia), 10000);
BOOST_CHECK_EQUAL(get_balance(committee, uia), 10000);
} catch(fc::exception& e) {
edump((e.to_detail_string()));
throw;
@ -730,7 +730,7 @@ BOOST_AUTO_TEST_CASE( create_buy_uia_multiple_match_new )
const account_object& buyer_account = create_account( "buyer" );
const account_object& seller_account = create_account( "seller" );
transfer( genesis_account(db), buyer_account, test_asset.amount( 10000 ) );
transfer( committee_account(db), buyer_account, test_asset.amount( 10000 ) );
transfer( nathan_account, seller_account, core_asset.amount(10000) );
BOOST_CHECK_EQUAL( get_balance( buyer_account, test_asset ), 10000 );
@ -770,7 +770,7 @@ BOOST_AUTO_TEST_CASE( create_buy_exact_match_uia )
const account_object& buyer_account = create_account( "buyer" );
const account_object& seller_account = create_account( "seller" );
transfer( genesis_account(db), seller_account, asset( 10000 ) );
transfer( committee_account(db), seller_account, asset( 10000 ) );
transfer( nathan_account, buyer_account, test_asset.amount(10000) );
BOOST_CHECK_EQUAL( get_balance( buyer_account, test_asset ), 10000 );
@ -811,7 +811,7 @@ BOOST_AUTO_TEST_CASE( create_buy_uia_multiple_match_new_reverse )
const account_object& buyer_account = create_account( "buyer" );
const account_object& seller_account = create_account( "seller" );
transfer( genesis_account(db), seller_account, asset( 10000 ) );
transfer( committee_account(db), seller_account, asset( 10000 ) );
transfer( nathan_account, buyer_account, test_asset.amount(10000),test_asset.amount(0) );
BOOST_CHECK_EQUAL( get_balance( buyer_account, test_asset ), 10000 );
@ -851,7 +851,7 @@ BOOST_AUTO_TEST_CASE( create_buy_uia_multiple_match_new_reverse_fract )
const account_object& buyer_account = create_account( "buyer" );
const account_object& seller_account = create_account( "seller" );
transfer( genesis_account(db), seller_account, asset( 30 ) );
transfer( committee_account(db), seller_account, asset( 30 ) );
transfer( nathan_account, buyer_account, test_asset.amount(10000),test_asset.amount(0) );
BOOST_CHECK_EQUAL( get_balance( buyer_account, test_asset ), 10000 );
@ -896,15 +896,15 @@ BOOST_AUTO_TEST_CASE( uia_fees )
const asset_object& test_asset = get_asset("TEST");
const asset_dynamic_data_object& asset_dynamic = test_asset.dynamic_asset_data_id(db);
const account_object& nathan_account = get_account("nathan");
const account_object& genesis_account = account_id_type()(db);
const account_object& committee_account = account_id_type()(db);
fund_fee_pool(genesis_account, test_asset, 1000*CORE);
fund_fee_pool(committee_account, test_asset, 1000*CORE);
BOOST_CHECK(asset_dynamic.fee_pool == 1000*CORE);
transfer_operation op;
op.fee = test_asset.amount(0);
op.from = nathan_account.id;
op.to = genesis_account.id;
op.to = committee_account.id;
op.amount = test_asset.amount(100);
op.fee = db.current_fee_schedule().calculate_fee( op, test_asset.options.core_exchange_rate );
BOOST_CHECK(op.fee.asset_id == test_asset.id);
@ -917,7 +917,7 @@ BOOST_AUTO_TEST_CASE( uia_fees )
BOOST_CHECK_EQUAL(get_balance(nathan_account, test_asset),
(old_balance - fee - test_asset.amount(100)).amount.value);
BOOST_CHECK_EQUAL(get_balance(genesis_account, test_asset), 100);
BOOST_CHECK_EQUAL(get_balance(committee_account, test_asset), 100);
BOOST_CHECK(asset_dynamic.accumulated_fees == fee.amount);
BOOST_CHECK(asset_dynamic.fee_pool == 1000*CORE - core_fee.amount);
@ -925,7 +925,7 @@ BOOST_AUTO_TEST_CASE( uia_fees )
PUSH_TX( db, trx, ~0 );
BOOST_CHECK_EQUAL(get_balance(nathan_account, test_asset),
(old_balance - fee - fee - test_asset.amount(200)).amount.value);
BOOST_CHECK_EQUAL(get_balance(genesis_account, test_asset), 200);
BOOST_CHECK_EQUAL(get_balance(committee_account, test_asset), 200);
BOOST_CHECK(asset_dynamic.accumulated_fees == fee.amount + fee.amount);
BOOST_CHECK(asset_dynamic.fee_pool == 1000*CORE - core_fee.amount - core_fee.amount);
@ -934,7 +934,7 @@ BOOST_AUTO_TEST_CASE( uia_fees )
op.amount = asset(20);
BOOST_CHECK_EQUAL(get_balance(nathan_account, asset_id_type()(db)), 0);
transfer(genesis_account, nathan_account, asset(20));
transfer(committee_account, nathan_account, asset(20));
BOOST_CHECK_EQUAL(get_balance(nathan_account, asset_id_type()(db)), 20);
trx.operations.emplace_back(std::move(op));
@ -943,7 +943,7 @@ BOOST_AUTO_TEST_CASE( uia_fees )
BOOST_CHECK_EQUAL(get_balance(nathan_account, asset_id_type()(db)), 0);
BOOST_CHECK_EQUAL(get_balance(nathan_account, test_asset),
(old_balance - fee - fee - fee - test_asset.amount(200)).amount.value);
BOOST_CHECK_EQUAL(get_balance(genesis_account, test_asset), 200);
BOOST_CHECK_EQUAL(get_balance(committee_account, test_asset), 200);
BOOST_CHECK(asset_dynamic.accumulated_fees == fee.amount.value * 3);
BOOST_CHECK(asset_dynamic.fee_pool == 1000*CORE - core_fee.amount.value * 3);
} catch (fc::exception& e) {
@ -958,7 +958,7 @@ BOOST_AUTO_TEST_CASE( cancel_limit_order_test )
const asset_object& test_asset = get_asset( "TEST" );
const account_object& buyer_account = create_account( "buyer" );
transfer( genesis_account(db), buyer_account, asset( 10000 ) );
transfer( committee_account(db), buyer_account, asset( 10000 ) );
BOOST_CHECK_EQUAL( get_balance(buyer_account, asset_id_type()(db)), 10000 );
auto sell_order = create_sell_order( buyer_account, asset(1000), test_asset.amount(100+450*1) );
@ -1049,7 +1049,7 @@ BOOST_AUTO_TEST_CASE( trade_amount_equals_zero )
const account_object& core_seller = create_account( "shorter1" );
const account_object& core_buyer = get_account("nathan");
transfer( genesis_account(db), core_seller, asset( 100000000 ) );
transfer( committee_account(db), core_seller, asset( 100000000 ) );
BOOST_CHECK_EQUAL(get_balance(core_buyer, core), 0);
BOOST_CHECK_EQUAL(get_balance(core_buyer, test), 10000000);
@ -1334,7 +1334,7 @@ BOOST_AUTO_TEST_CASE( vesting_balance_create_test )
const account_object& alice_account = create_account("alice");
const account_object& bob_account = create_account("bob");
transfer(genesis_account(db), alice_account, core.amount(100000));
transfer(committee_account(db), alice_account, core.amount(100000));
op.creator = alice_account.get_id();
op.owner = alice_account.get_id();
@ -1383,7 +1383,7 @@ BOOST_AUTO_TEST_CASE( vesting_balance_withdraw_test )
const account_object& alice_account = create_account( "alice" );
const account_object& bob_account = create_account( "bob" );
transfer( genesis_account(db), alice_account, core.amount( 1000000 ) );
transfer( committee_account(db), alice_account, core.amount( 1000000 ) );
auto spin_vbo_clock = [&]( const vesting_balance_object& vbo, uint32_t dt_secs )
{
@ -1422,7 +1422,7 @@ BOOST_AUTO_TEST_CASE( vesting_balance_withdraw_test )
auto top_up = [&]()
{
trx.clear();
transfer( genesis_account(db),
transfer( committee_account(db),
alice_account,
core.amount( 1000000 - db.get_balance( alice_account, core ).amount )
);

View file

@ -413,7 +413,7 @@ BOOST_AUTO_TEST_CASE( witness_create )
trx.clear();
witness_id_type nathan_witness_id = create_witness(nathan_id, nathan_private_key).id;
// Give nathan some voting stake
transfer(genesis_account, nathan_id, asset(10000000));
transfer(committee_account, nathan_id, asset(10000000));
generate_block();
trx.set_expiration(db.head_block_id());
@ -488,9 +488,9 @@ BOOST_AUTO_TEST_CASE( global_settle_test )
feed.maximum_short_squeeze_ratio = 150 * GRAPHENE_COLLATERAL_RATIO_DENOM / 100;
publish_feed( bit_usd_id(db), nathan, feed );
transfer(genesis_account, ben_id, asset(10000));
transfer(genesis_account, valentine_id, asset(10000));
transfer(genesis_account, dan_id, asset(10000));
transfer(committee_account, ben_id, asset(10000));
transfer(committee_account, valentine_id, asset(10000));
transfer(committee_account, dan_id, asset(10000));
borrow(ben, asset(1000, bit_usd_id), asset(1000));
BOOST_CHECK_EQUAL(get_balance(ben_id, bit_usd_id), 1000);
BOOST_CHECK_EQUAL(get_balance(ben_id, asset_id_type()), 9000);
@ -597,7 +597,7 @@ BOOST_AUTO_TEST_CASE( worker_pay_test )
INVOKE(worker_create_test);
GET_ACTOR(nathan);
generate_blocks(db.get_dynamic_global_properties().next_maintenance_time);
transfer(genesis_account, nathan_id, asset(100000));
transfer(committee_account, nathan_id, asset(100000));
{
account_update_operation op;
@ -710,7 +710,7 @@ BOOST_AUTO_TEST_CASE( refund_worker_test )
BOOST_CHECK(worker.vote_for.type() == vote_id_type::worker);
BOOST_CHECK(worker.vote_against.type() == vote_id_type::worker);
transfer(genesis_account, nathan_id, asset(100000));
transfer(committee_account, nathan_id, asset(100000));
{
account_update_operation op;
@ -783,7 +783,7 @@ BOOST_AUTO_TEST_CASE( burn_worker_test )
BOOST_CHECK(worker.vote_for.type() == vote_id_type::worker);
BOOST_CHECK(worker.vote_against.type() == vote_id_type::worker);
transfer(genesis_account, nathan_id, asset(100000));
transfer(committee_account, nathan_id, asset(100000));
{
account_update_operation op;
@ -827,7 +827,7 @@ BOOST_AUTO_TEST_CASE( unimp_force_settlement_unavailable )
/*
try {
auto private_key = delegate_priv_key;
auto private_key = generate_private_key("genesis");
auto private_key = generate_private_key("committee");
>>>>>>> short_refactor
account_id_type nathan_id = create_account("nathan").get_id();
account_id_type shorter1_id = create_account("shorter1").get_id();

View file

@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE( transfer_whitelist_uia )
BOOST_CHECK(!nathan.is_authorized_asset(advanced));
GRAPHENE_REQUIRE_THROW(PUSH_TX( db, trx, ~0 ), fc::exception);
//Remove nathan from genesis' whitelist, add him to dan's. This should not authorize him to hold ADVANCED.
//Remove nathan from committee's whitelist, add him to dan's. This should not authorize him to hold ADVANCED.
wop.authorizing_account = account_id_type();
wop.account_to_list = nathan.id;
wop.new_listing = account_whitelist_operation::no_listing;