From 2f429e07f100702ffc2f6a6a37119e96be717c20 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Mon, 13 Jul 2015 16:06:02 -0400 Subject: [PATCH] Rename bad references to delegate -> committee member; #147 --- README.md | 2 +- libraries/app/api.cpp | 38 +++--- libraries/app/include/graphene/app/api.hpp | 30 ++--- libraries/chain/CMakeLists.txt | 4 +- libraries/chain/asset_evaluator.cpp | 2 +- ...tor.cpp => committee_member_evaluator.cpp} | 18 +-- libraries/chain/db_init.cpp | 18 +-- libraries/chain/db_maint.cpp | 28 ++--- libraries/chain/evaluator.cpp | 2 +- .../include/graphene/chain/account_object.hpp | 6 +- .../include/graphene/chain/asset_object.hpp | 2 +- ...tor.hpp => committee_member_evaluator.hpp} | 18 +-- ...object.hpp => committee_member_object.hpp} | 28 ++--- .../chain/include/graphene/chain/config.hpp | 4 +- .../chain/include/graphene/chain/database.hpp | 2 +- .../include/graphene/chain/exceptions.hpp | 16 +-- .../graphene/chain/global_property_object.hpp | 10 +- .../graphene/chain/protocol/asset_ops.hpp | 2 +- .../chain/protocol/chain_parameters.hpp | 2 +- .../chain/protocol/committee_member.hpp | 59 +++++++++ .../graphene/chain/protocol/delegate.hpp | 59 --------- .../graphene/chain/protocol/operations.hpp | 6 +- .../include/graphene/chain/protocol/types.hpp | 14 +-- .../{delegate.cpp => committee_member.cpp} | 6 +- .../chain/transaction_evaluation_state.cpp | 2 +- libraries/chain/witness_evaluator.cpp | 2 +- libraries/wallet/cache.cpp | 6 +- .../wallet/include/graphene/wallet/wallet.hpp | 94 +++++++-------- libraries/wallet/wallet.cpp | 112 +++++++++--------- tests/common/database_fixture.cpp | 38 +++--- tests/common/database_fixture.hpp | 2 +- tests/tests/authority_tests.cpp | 40 +++---- tests/tests/block_tests.cpp | 20 ++-- tests/tests/operation_tests.cpp | 20 ++-- tests/tests/operation_tests2.cpp | 2 +- 35 files changed, 357 insertions(+), 357 deletions(-) rename libraries/chain/{delegate_evaluator.cpp => committee_member_evaluator.cpp} (73%) rename libraries/chain/include/graphene/chain/{delegate_evaluator.hpp => committee_member_evaluator.hpp} (66%) rename libraries/chain/include/graphene/chain/{delegate_object.hpp => committee_member_object.hpp} (67%) create mode 100644 libraries/chain/include/graphene/chain/protocol/committee_member.hpp delete mode 100644 libraries/chain/include/graphene/chain/protocol/delegate.hpp rename libraries/chain/protocol/{delegate.cpp => committee_member.cpp} (60%) diff --git a/README.md b/README.md index 7740f786..53f74942 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ Questions 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 "committee account," - which is controlled by the delegates and has a few abilities and restrictions other accounts + which is controlled by the committee members and has a few abilities and restrictions other accounts do not). All asset ID's are of the form `1.3.x`. If you were the 29th asset to be registered, diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 958eb2dc..f192c765 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -247,9 +247,9 @@ namespace graphene { namespace app { return result; } - fc::optional database_api::get_delegate_by_account(account_id_type account) const + fc::optional database_api::get_committee_member_by_account(account_id_type account) const { - const auto& idx = _db.get_index_type().indices().get(); + const auto& idx = _db.get_index_type().indices().get(); auto itr = idx.find(account); if( itr != idx.end() ) return *itr; @@ -293,27 +293,27 @@ namespace graphene { namespace app { return witnesses_by_account_name; } - map database_api::lookup_delegate_accounts(const string& lower_bound_name, uint32_t limit)const + map database_api::lookup_committee_member_accounts(const string& lower_bound_name, uint32_t limit)const { FC_ASSERT( limit <= 1000 ); - const auto& delegates_by_id = _db.get_index_type().indices().get(); + const auto& committee_members_by_id = _db.get_index_type().indices().get(); - // we want to order delegates by account name, but that name is in the account object - // so the delegate_index doesn't have a quick way to access it. + // we want to order committee_members by account name, but that name is in the account object + // so the committee_member_index doesn't have a quick way to access it. // get all the names and look them all up, sort them, then figure out what // records to return. This could be optimized, but we expect the - // number of delegates to be few and the frequency of calls to be rare - std::map delegates_by_account_name; - for (const delegate_object& delegate : delegates_by_id) - if (auto account_iter = _db.find(delegate.delegate_account)) + // number of committee_members to be few and the frequency of calls to be rare + std::map committee_members_by_account_name; + for (const committee_member_object& committee_member : committee_members_by_id) + if (auto account_iter = _db.find(committee_member.committee_member_account)) if (account_iter->name >= lower_bound_name) // we can ignore anything below lower_bound_name - delegates_by_account_name.insert(std::make_pair(account_iter->name, delegate.id)); + committee_members_by_account_name.insert(std::make_pair(account_iter->name, committee_member.id)); - auto end_iter = delegates_by_account_name.begin(); - while (end_iter != delegates_by_account_name.end() && limit--) + auto end_iter = committee_members_by_account_name.begin(); + while (end_iter != committee_members_by_account_name.end() && limit--) ++end_iter; - delegates_by_account_name.erase(end_iter, delegates_by_account_name.end()); - return delegates_by_account_name; + committee_members_by_account_name.erase(end_iter, committee_members_by_account_name.end()); + return committee_members_by_account_name; } vector> database_api::get_witnesses(const vector& witness_ids)const @@ -328,11 +328,11 @@ namespace graphene { namespace app { return result; } - vector> database_api::get_delegates(const vector& delegate_ids)const + vector> database_api::get_committee_members(const vector& committee_member_ids)const { - vector> result; result.reserve(delegate_ids.size()); - std::transform(delegate_ids.begin(), delegate_ids.end(), std::back_inserter(result), - [this](delegate_id_type id) -> optional { + vector> result; result.reserve(committee_member_ids.size()); + std::transform(committee_member_ids.begin(), committee_member_ids.end(), std::back_inserter(result), + [this](committee_member_id_type id) -> optional { if(auto o = _db.find(id)) return *o; return {}; diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index b3f471c2..b1e96a34 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -170,11 +170,11 @@ namespace graphene { namespace app { vector list_assets(const string& lower_bound_symbol, uint32_t limit)const; /** - * @brief Get the delegate owned by a given account - * @param account The ID of the account whose delegate should be retrieved - * @return The delegate object, or null if the account does not have a delegate + * @brief Get the committee_member owned by a given account + * @param account The ID of the account whose committee_member should be retrieved + * @return The committee_member object, or null if the account does not have a committee_member */ - fc::optional get_delegate_by_account(account_id_type account)const; + fc::optional get_committee_member_by_account(account_id_type account)const; /** * @brief Get the witness owned by a given account * @param account The ID of the account whose witness should be retrieved @@ -196,12 +196,12 @@ namespace graphene { namespace app { map lookup_witness_accounts(const string& lower_bound_name, uint32_t limit)const; /** - * @brief Get names and IDs for registered delegates + * @brief Get names and IDs for registered committee_members * @param lower_bound_name Lower bound of the first name to return * @param limit Maximum number of results to return -- must not exceed 1000 - * @return Map of delegate names to corresponding IDs + * @return Map of committee_member names to corresponding IDs */ - map lookup_delegate_accounts(const string& lower_bound_name, uint32_t limit)const; + map lookup_committee_member_accounts(const string& lower_bound_name, uint32_t limit)const; /** * @brief Get a list of witnesses by ID @@ -213,13 +213,13 @@ namespace graphene { namespace app { vector> get_witnesses(const vector& witness_ids)const; /** - * @brief Get a list of delegates by ID - * @param delegate_ids IDs of the delegates to retrieve - * @return The delegates corresponding to the provided IDs + * @brief Get a list of committee_members by ID + * @param committee_member_ids IDs of the committee_members to retrieve + * @return The committee_members corresponding to the provided IDs * * This function has semantics identical to @ref get_objects */ - vector> get_delegates(const vector& delegate_ids)const; + vector> get_committee_members(const vector& committee_member_ids)const; /** * @group Push Notification Methods @@ -471,13 +471,13 @@ FC_API(graphene::app::database_api, (get_call_orders) (get_settle_orders) (list_assets) - (get_delegate_by_account) + (get_committee_member_by_account) (get_witnesses) - (get_delegates) + (get_committee_members) (get_witness_by_account) (get_witness_count) (lookup_witness_accounts) - (lookup_delegate_accounts) + (lookup_committee_member_accounts) (subscribe_to_objects) (unsubscribe_from_objects) (subscribe_to_market) diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index ffc76df4..698b5089 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -8,7 +8,7 @@ add_library( graphene_chain protocol/assert.cpp protocol/account.cpp protocol/transfer.cpp - protocol/delegate.cpp + protocol/committee_member.cpp protocol/witness.cpp protocol/market.cpp protocol/proposal.cpp @@ -29,7 +29,7 @@ add_library( graphene_chain account_evaluator.cpp assert_evaluator.cpp witness_evaluator.cpp - delegate_evaluator.cpp + committee_member_evaluator.cpp asset_evaluator.cpp transfer_evaluator.cpp proposal_evaluator.cpp diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index dba363d9..2c7a17fd 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -450,7 +450,7 @@ void_result asset_publish_feeds_evaluator::do_evaluate(const asset_publish_feed_ //Verify that the publisher is authoritative to publish a feed if( base.issuer == account_id_type() ) { - //It's a delegate-fed asset. Verify that publisher is an active delegate or witness. + //It's a committee_member-fed asset. Verify that publisher is an active committee_member or witness. FC_ASSERT(d.get(GRAPHENE_COMMITTEE_ACCOUNT).active.account_auths.count(o.publisher) || d.get_global_properties().witness_accounts.count(o.publisher)); } else { diff --git a/libraries/chain/delegate_evaluator.cpp b/libraries/chain/committee_member_evaluator.cpp similarity index 73% rename from libraries/chain/delegate_evaluator.cpp rename to libraries/chain/committee_member_evaluator.cpp index 966fe8c4..345b9b77 100644 --- a/libraries/chain/delegate_evaluator.cpp +++ b/libraries/chain/committee_member_evaluator.cpp @@ -15,8 +15,8 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include #include @@ -24,21 +24,21 @@ namespace graphene { namespace chain { -void_result delegate_create_evaluator::do_evaluate( const delegate_create_operation& op ) +void_result committee_member_create_evaluator::do_evaluate( const committee_member_create_operation& op ) { try { - FC_ASSERT(db().get(op.delegate_account).is_lifetime_member()); + FC_ASSERT(db().get(op.committee_member_account).is_lifetime_member()); return void_result(); } FC_CAPTURE_AND_RETHROW( (op) ) } -object_id_type delegate_create_evaluator::do_apply( const delegate_create_operation& op ) +object_id_type committee_member_create_evaluator::do_apply( const committee_member_create_operation& op ) { try { vote_id_type vote_id; db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) { vote_id = p.get_next_vote_id(vote_id_type::committee); }); - const auto& new_del_object = db().create( [&]( delegate_object& obj ){ - obj.delegate_account = op.delegate_account; + const auto& new_del_object = db().create( [&]( committee_member_object& obj ){ + obj.committee_member_account = op.committee_member_account; obj.vote_id = vote_id; obj.url = op.url; }); @@ -47,14 +47,14 @@ object_id_type delegate_create_evaluator::do_apply( const delegate_create_operat -void_result delegate_update_global_parameters_evaluator::do_evaluate(const delegate_update_global_parameters_operation& o) +void_result committee_member_update_global_parameters_evaluator::do_evaluate(const committee_member_update_global_parameters_operation& o) { try { FC_ASSERT(trx_state->_is_proposed_trx); return void_result(); } FC_CAPTURE_AND_RETHROW( (o) ) } -void_result delegate_update_global_parameters_evaluator::do_apply(const delegate_update_global_parameters_operation& o) +void_result committee_member_update_global_parameters_evaluator::do_apply(const committee_member_update_global_parameters_operation& o) { try { db().modify(db().get_global_properties(), [&o](global_property_object& p) { p.pending_parameters = o.new_parameters; diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index 00c59bf9..bf3e16bf 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -75,8 +75,8 @@ const uint8_t block_summary_object::type_id; const uint8_t call_order_object::space_id; const uint8_t call_order_object::type_id; -const uint8_t delegate_object::space_id; -const uint8_t delegate_object::type_id; +const uint8_t committee_member_object::space_id; +const uint8_t committee_member_object::type_id; const uint8_t force_settlement_object::space_id; const uint8_t force_settlement_object::type_id; @@ -119,8 +119,8 @@ void database::initialize_evaluators() register_evaluator(); register_evaluator(); register_evaluator(); - register_evaluator(); - register_evaluator(); + register_evaluator(); + register_evaluator(); register_evaluator(); register_evaluator(); register_evaluator(); @@ -165,7 +165,7 @@ void database::initialize_indexes() acnt_index->add_secondary_index(); acnt_index->add_secondary_index(); - add_index< primary_index >(); + add_index< primary_index >(); add_index< primary_index >(); add_index< primary_index >(); add_index< primary_index >(); @@ -476,8 +476,8 @@ void database::init_genesis(const genesis_state_type& genesis_state) // Create initial committee members std::for_each(genesis_state.initial_committee_candidates.begin(), genesis_state.initial_committee_candidates.end(), [&](const genesis_state_type::initial_committee_member_type& member) { - delegate_create_operation op; - op.delegate_account = get_account_id(member.owner_name); + committee_member_create_operation op; + op.committee_member_account = get_account_id(member.owner_name); apply_operation(genesis_eval_state, op); }); diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 65be3dbe..e886aee7 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -191,21 +191,21 @@ void database::update_active_witnesses() }); } FC_CAPTURE_AND_RETHROW() } -void database::update_active_delegates() +void database::update_active_committee_members() { try { assert( _committee_count_histogram_buffer.size() > 0 ); uint64_t stake_target = _total_voting_stake / 2; uint64_t stake_tally = _committee_count_histogram_buffer[0]; - size_t delegate_count = 0; + size_t committee_member_count = 0; if( stake_target > 0 ) - while( (delegate_count < _committee_count_histogram_buffer.size() - 1) + while( (committee_member_count < _committee_count_histogram_buffer.size() - 1) && (stake_tally <= stake_target) ) - stake_tally += _committee_count_histogram_buffer[++delegate_count]; + stake_tally += _committee_count_histogram_buffer[++committee_member_count]; - auto delegates = sort_votable_objects(std::max(delegate_count*2+1, (size_t)GRAPHENE_MIN_DELEGATE_COUNT)); + auto committee_members = sort_votable_objects(std::max(committee_member_count*2+1, (size_t)GRAPHENE_MIN_COMMITTEE_MEMBER_COUNT)); // Update committee authorities - if( !delegates.empty() ) + if( !committee_members.empty() ) { modify(get(GRAPHENE_COMMITTEE_ACCOUNT), [&](account_object& a) { uint64_t total_votes = 0; @@ -213,9 +213,9 @@ void database::update_active_delegates() a.active.weight_threshold = 0; a.active.clear(); - for( const delegate_object& del : delegates ) + for( const committee_member_object& del : committee_members ) { - weights.emplace(del.delegate_account, _vote_tally_buffer[del.vote_id]); + weights.emplace(del.committee_member_account, _vote_tally_buffer[del.vote_id]); total_votes += _vote_tally_buffer[del.vote_id]; } @@ -238,10 +238,10 @@ void database::update_active_delegates() }); } modify(get_global_properties(), [&](global_property_object& gp) { - gp.active_delegates.clear(); - std::transform(delegates.begin(), delegates.end(), - std::inserter(gp.active_delegates, gp.active_delegates.begin()), - [](const delegate_object& d) { return d.id; }); + gp.active_committee_members.clear(); + std::transform(committee_members.begin(), committee_members.end(), + std::inserter(gp.active_committee_members, gp.active_committee_members.begin()), + [](const committee_member_object& d) { return d.id; }); }); } FC_CAPTURE_AND_RETHROW() } @@ -457,7 +457,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g c(_vote_tally_buffer); update_active_witnesses(); - update_active_delegates(); + update_active_committee_members(); modify(gpo, [this](global_property_object& p) { // Remove scaling of account registration fee diff --git a/libraries/chain/evaluator.cpp b/libraries/chain/evaluator.cpp index e4922858..13d78646 100644 --- a/libraries/chain/evaluator.cpp +++ b/libraries/chain/evaluator.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/account_object.hpp b/libraries/chain/include/graphene/chain/account_object.hpp index f176fbc8..79faebfe 100644 --- a/libraries/chain/include/graphene/chain/account_object.hpp +++ b/libraries/chain/include/graphene/chain/account_object.hpp @@ -108,7 +108,7 @@ namespace graphene { namespace chain { * @ingroup protocol * * Accounts are the primary unit of authority on the graphene system. Users must have an account in order to use - * assets, trade in the markets, vote for delegates, etc. + * assets, trade in the markets, vote for committee_members, etc. */ class account_object : public graphene::db::annotated_object { @@ -231,7 +231,7 @@ namespace graphene { namespace chain { static const uint8_t type_id = meta_account_object_type; public_key_type memo_key; - delegate_id_type delegate_id; // optional + committee_member_id_type committee_member_id; // optional }; /** @@ -334,7 +334,7 @@ FC_REFLECT_DERIVED( graphene::chain::account_balance_object, FC_REFLECT_DERIVED( graphene::chain::meta_account_object, (graphene::db::object), - (memo_key)(delegate_id) ) + (memo_key)(committee_member_id) ) FC_REFLECT_DERIVED( graphene::chain::account_statistics_object, (graphene::chain::object), (most_recent_op) diff --git a/libraries/chain/include/graphene/chain/asset_object.hpp b/libraries/chain/include/graphene/chain/asset_object.hpp index 3c8e91bc..01376bc5 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -168,7 +168,7 @@ namespace graphene { namespace chain { bitasset_options options; /// 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 + /// accounts; otherwise, the feed publishers are the currently active committee_members 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> feeds; /// This is the currently active price feed, calculated as the median of values from the currently active diff --git a/libraries/chain/include/graphene/chain/delegate_evaluator.hpp b/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp similarity index 66% rename from libraries/chain/include/graphene/chain/delegate_evaluator.hpp rename to libraries/chain/include/graphene/chain/committee_member_evaluator.hpp index c6f2af88..1728e77e 100644 --- a/libraries/chain/include/graphene/chain/delegate_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp @@ -17,26 +17,26 @@ */ #pragma once #include -#include +#include namespace graphene { namespace chain { - class delegate_create_evaluator : public evaluator + class committee_member_create_evaluator : public evaluator { public: - typedef delegate_create_operation operation_type; + typedef committee_member_create_operation operation_type; - void_result do_evaluate( const delegate_create_operation& o ); - object_id_type do_apply( const delegate_create_operation& o ); + void_result do_evaluate( const committee_member_create_operation& o ); + object_id_type do_apply( const committee_member_create_operation& o ); }; - class delegate_update_global_parameters_evaluator : public evaluator + class committee_member_update_global_parameters_evaluator : public evaluator { public: - typedef delegate_update_global_parameters_operation operation_type; + typedef committee_member_update_global_parameters_operation operation_type; - void_result do_evaluate( const delegate_update_global_parameters_operation& o ); - void_result do_apply( const delegate_update_global_parameters_operation& o ); + void_result do_evaluate( const committee_member_update_global_parameters_operation& o ); + void_result do_apply( const committee_member_update_global_parameters_operation& o ); }; diff --git a/libraries/chain/include/graphene/chain/delegate_object.hpp b/libraries/chain/include/graphene/chain/committee_member_object.hpp similarity index 67% rename from libraries/chain/include/graphene/chain/delegate_object.hpp rename to libraries/chain/include/graphene/chain/committee_member_object.hpp index f6f1e5a6..447e51bf 100644 --- a/libraries/chain/include/graphene/chain/delegate_object.hpp +++ b/libraries/chain/include/graphene/chain/committee_member_object.hpp @@ -26,41 +26,41 @@ namespace graphene { namespace chain { class account_object; /** - * @brief tracks information about a delegate account. + * @brief tracks information about a committee_member account. * @ingroup object * - * A delegate is responsible for setting blockchain parameters and has + * A committee_member is responsible for setting blockchain parameters and has * dynamic multi-sig control over the committee account. The current set of - * active delegates has control. + * active committee_members has control. * - * Delegates were separated into a separate object to make iterating over - * the set of delegate easy. + * committee_members were separated into a separate object to make iterating over + * the set of committee_member easy. */ - class delegate_object : public abstract_object + class committee_member_object : public abstract_object { public: static const uint8_t space_id = protocol_ids; - static const uint8_t type_id = delegate_object_type; + static const uint8_t type_id = committee_member_object_type; - account_id_type delegate_account; + account_id_type committee_member_account; vote_id_type vote_id; string url; }; struct by_account; - using delegate_multi_index_type = multi_index_container< - delegate_object, + using committee_member_multi_index_type = multi_index_container< + committee_member_object, indexed_by< ordered_unique< tag, member >, hashed_unique< tag, - member + member > > >; - using delegate_index = generic_index; + using committee_member_index = generic_index; } } // graphene::chain -FC_REFLECT_DERIVED( graphene::chain::delegate_object, (graphene::db::object), - (delegate_account)(vote_id)(url) ) +FC_REFLECT_DERIVED( graphene::chain::committee_member_object, (graphene::db::object), + (committee_member_account)(vote_id)(url) ) diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index 0c865e15..61add015 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -32,9 +32,9 @@ #define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */ #define GRAPHENE_MAX_SIG_CHECK_DEPTH 2 #define GRAPHENE_MIN_WITNESS_COUNT 10 -#define GRAPHENE_MIN_DELEGATE_COUNT 10 +#define GRAPHENE_MIN_COMMITTEE_MEMBER_COUNT 10 /** - * Don't allow the delegates to publish a limit that would + * Don't allow the committee_members to publish a limit that would * make the network unable to operate. */ #define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024 diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index bc9472f3..bbd001d6 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -441,7 +441,7 @@ namespace graphene { namespace chain { void pay_workers( share_type& budget ); void perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props); void update_active_witnesses(); - void update_active_delegates(); + void update_active_committee_members(); template void perform_account_maintenance(std::tuple helpers); diff --git a/libraries/chain/include/graphene/chain/exceptions.hpp b/libraries/chain/include/graphene/chain/exceptions.hpp index abc5a507..b18859a2 100644 --- a/libraries/chain/include/graphene/chain/exceptions.hpp +++ b/libraries/chain/include/graphene/chain/exceptions.hpp @@ -100,7 +100,7 @@ namespace graphene { namespace chain { //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_settle ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_global_settle ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_publish_feed ); - //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( delegate_create ); + //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( committee_member_create ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( witness_create ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( witness_withdraw_pay ); @@ -154,7 +154,7 @@ namespace graphene { namespace chain { FC_DECLARE_DERIVED_EXCEPTION( time_in_past, graphene::chain::chain_exception, 30018, "time is in the past" ) FC_DECLARE_DERIVED_EXCEPTION( time_in_future, graphene::chain::chain_exception, 30019, "time is in the future" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_block_digest, graphene::chain::chain_exception, 30020, "invalid block digest" ) - FC_DECLARE_DERIVED_EXCEPTION( invalid_delegate_signee, graphene::chain::chain_exception, 30021, "invalid delegate signee" ) + FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_member_signee, graphene::chain::chain_exception, 30021, "invalid committee_member signee" ) FC_DECLARE_DERIVED_EXCEPTION( failed_checkpoint_verification, graphene::chain::chain_exception, 30022, "failed checkpoint verification" ) FC_DECLARE_DERIVED_EXCEPTION( wrong_chain_id, graphene::chain::chain_exception, 30023, "wrong chain id" ) FC_DECLARE_DERIVED_EXCEPTION( unknown_block, graphene::chain::chain_exception, 30024, "unknown block" ) @@ -162,14 +162,14 @@ namespace graphene { namespace chain { FC_DECLARE_EXCEPTION( evaluation_error, 31000, "Evaluation Error" ) FC_DECLARE_DERIVED_EXCEPTION( negative_deposit, graphene::chain::evaluation_error, 31001, "negative deposit" ) - FC_DECLARE_DERIVED_EXCEPTION( not_a_delegate, graphene::chain::evaluation_error, 31002, "not a delegate" ) + FC_DECLARE_DERIVED_EXCEPTION( not_a_committee_member, graphene::chain::evaluation_error, 31002, "not a committee_member" ) FC_DECLARE_DERIVED_EXCEPTION( unknown_balance_record, graphene::chain::evaluation_error, 31003, "unknown balance record" ) FC_DECLARE_DERIVED_EXCEPTION( insufficient_funds, graphene::chain::evaluation_error, 31004, "insufficient funds" ) FC_DECLARE_DERIVED_EXCEPTION( missing_signature, graphene::chain::evaluation_error, 31005, "missing signature" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_claim_password, graphene::chain::evaluation_error, 31006, "invalid claim password" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_withdraw_condition, graphene::chain::evaluation_error, 31007, "invalid withdraw condition" ) FC_DECLARE_DERIVED_EXCEPTION( negative_withdraw, graphene::chain::evaluation_error, 31008, "negative withdraw" ) - FC_DECLARE_DERIVED_EXCEPTION( not_an_active_delegate, graphene::chain::evaluation_error, 31009, "not an active delegate" ) + FC_DECLARE_DERIVED_EXCEPTION( not_an_active_committee_member, graphene::chain::evaluation_error, 31009, "not an active committee_member" ) FC_DECLARE_DERIVED_EXCEPTION( expired_transaction, graphene::chain::evaluation_error, 31010, "expired transaction" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_transaction_expiration, graphene::chain::evaluation_error, 31011, "invalid transaction expiration" ) FC_DECLARE_DERIVED_EXCEPTION( oversized_transaction, graphene::chain::evaluation_error, 31012, "transaction exceeded the maximum transaction size" ) @@ -184,11 +184,11 @@ namespace graphene { namespace chain { FC_DECLARE_DERIVED_EXCEPTION( account_key_in_use, graphene::chain::evaluation_error, 32008, "account key already in use" ) FC_DECLARE_DERIVED_EXCEPTION( account_retracted, graphene::chain::evaluation_error, 32009, "account retracted" ) FC_DECLARE_DERIVED_EXCEPTION( unknown_parent_account_name, graphene::chain::evaluation_error, 32010, "unknown parent account name" ) - FC_DECLARE_DERIVED_EXCEPTION( unknown_delegate_slate, graphene::chain::evaluation_error, 32011, "unknown delegate slate" ) - FC_DECLARE_DERIVED_EXCEPTION( too_may_delegates_in_slate, graphene::chain::evaluation_error, 32012, "too many delegates in slate" ) + FC_DECLARE_DERIVED_EXCEPTION( unknown_committee_member_slate, graphene::chain::evaluation_error, 32011, "unknown committee_member slate" ) + FC_DECLARE_DERIVED_EXCEPTION( too_may_committee_members_in_slate, graphene::chain::evaluation_error, 32012, "too many committee_members in slate" ) FC_DECLARE_DERIVED_EXCEPTION( pay_balance_remaining, graphene::chain::evaluation_error, 32013, "pay balance remaining" ) - FC_DECLARE_DERIVED_EXCEPTION( not_a_delegate_signature, graphene::chain::evaluation_error, 33002, "not delegates signature" ) + FC_DECLARE_DERIVED_EXCEPTION( not_a_committee_member_signature, graphene::chain::evaluation_error, 33002, "not committee_members signature" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_precision, graphene::chain::evaluation_error, 35001, "invalid precision" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_symbol, graphene::chain::evaluation_error, 35002, "invalid asset symbol" ) @@ -202,7 +202,7 @@ namespace graphene { namespace chain { FC_DECLARE_DERIVED_EXCEPTION( not_user_issued, graphene::chain::evaluation_error, 35010, "not user issued" ) FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_name, graphene::chain::evaluation_error, 35011, "invalid asset name" ) - FC_DECLARE_DERIVED_EXCEPTION( delegate_vote_limit, graphene::chain::evaluation_error, 36001, "delegate_vote_limit" ) + FC_DECLARE_DERIVED_EXCEPTION( committee_member_vote_limit, graphene::chain::evaluation_error, 36001, "committee_member_vote_limit" ) FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::chain::evaluation_error, 36002, "insufficient fee" ) FC_DECLARE_DERIVED_EXCEPTION( negative_fee, graphene::chain::evaluation_error, 36003, "negative fee" ) FC_DECLARE_DERIVED_EXCEPTION( missing_deposit, graphene::chain::evaluation_error, 36004, "missing deposit" ) diff --git a/libraries/chain/include/graphene/chain/global_property_object.hpp b/libraries/chain/include/graphene/chain/global_property_object.hpp index 763c5c15..67d7e7b5 100644 --- a/libraries/chain/include/graphene/chain/global_property_object.hpp +++ b/libraries/chain/include/graphene/chain/global_property_object.hpp @@ -24,11 +24,11 @@ namespace graphene { namespace chain { /** * @class global_property_object - * @brief Maintains global state information (delegate list, current fees) + * @brief Maintains global state information (committee_member list, current fees) * @ingroup object * @ingroup implementation * - * This is an implementation detail. The values here are set by delegates to tune the blockchain parameters. + * This is an implementation detail. The values here are set by committee_members to tune the blockchain parameters. */ class global_property_object : public graphene::db::abstract_object { @@ -40,7 +40,7 @@ namespace graphene { namespace chain { optional pending_parameters; uint32_t next_available_vote_id = 0; - vector active_delegates; // updated once per maintenance interval + vector active_committee_members; // updated once per maintenance interval flat_set active_witnesses; // updated once per maintenance interval // n.b. witness scheduling is done by witness_schedule object flat_set witness_accounts; // updated once per maintenance interval @@ -54,7 +54,7 @@ namespace graphene { namespace chain { /** * @class dynamic_global_property_object - * @brief Maintains global state information (delegate list, current fees) + * @brief Maintains global state information (committee_member list, current fees) * @ingroup object * @ingroup implementation * @@ -102,7 +102,7 @@ FC_REFLECT_DERIVED( graphene::chain::global_property_object, (graphene::db::obje (parameters) (pending_parameters) (next_available_vote_id) - (active_delegates) + (active_committee_members) (active_witnesses) (chain_id) ) diff --git a/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp b/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp index d75bcc4a..5cdc6661 100644 --- a/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp +++ b/libraries/chain/include/graphene/chain/protocol/asset_ops.hpp @@ -311,7 +311,7 @@ namespace graphene { namespace chain { * * Price feed providers use this operation to publish their price feeds for market-issued assets. A price feed is * used to tune the market for a particular market-issued asset. For each value in the feed, the median across all - * delegate feeds for that asset is calculated and the market for the asset is configured with the median of that + * committee_member feeds for that asset is calculated and the market for the asset is configured with the median of that * value. * * The feed in the operation contains three prices: a call price limit, a short price limit, and a settlement price. diff --git a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp index a0725aa3..55a068c0 100644 --- a/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp +++ b/libraries/chain/include/graphene/chain/protocol/chain_parameters.hpp @@ -45,7 +45,7 @@ namespace graphene { namespace chain { uint8_t maximum_asset_whitelist_authorities = GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES; ///< maximum number of accounts which an asset may list as authorities for its whitelist OR blacklist uint8_t maximum_asset_feed_publishers = GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS; ///< the maximum number of feed publishers for a given asset uint16_t maximum_witness_count = GRAPHENE_DEFAULT_MAX_WITNESSES; ///< maximum number of active witnesses - uint16_t maximum_committee_count = GRAPHENE_DEFAULT_MAX_COMMITTEE; ///< maximum number of active delegates + uint16_t maximum_committee_count = GRAPHENE_DEFAULT_MAX_COMMITTEE; ///< maximum number of active committee_members uint16_t maximum_authority_membership = GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP; ///< largest number of keys/accounts an authority can have uint16_t reserve_percent_of_fee = GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE; ///< the percentage of the network's allocation of a fee that is taken out of circulation uint16_t network_percent_of_fee = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE; ///< percent of transaction fees paid to network diff --git a/libraries/chain/include/graphene/chain/protocol/committee_member.hpp b/libraries/chain/include/graphene/chain/protocol/committee_member.hpp new file mode 100644 index 00000000..0b774468 --- /dev/null +++ b/libraries/chain/include/graphene/chain/protocol/committee_member.hpp @@ -0,0 +1,59 @@ +#pragma once +#include +#include + +namespace graphene { namespace chain { + + /** + * @brief Create a committee_member object, as a bid to hold a committee_member seat on the network. + * @ingroup operations + * + * Accounts which wish to become committee_members may use this operation to create a committee_member object which stakeholders may + * vote on to approve its position as a committee_member. + */ + struct committee_member_create_operation : public base_operation + { + struct fee_parameters_type { uint64_t fee = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION; }; + + asset fee; + /// The account which owns the committee_member. This account pays the fee for this operation. + account_id_type committee_member_account; + string url; + + account_id_type fee_payer()const { return committee_member_account; } + void validate()const; + }; + + /** + * @brief Used by committee_members to update the global parameters of the blockchain. + * @ingroup operations + * + * This operation allows the committee_members to update the global parameters on the blockchain. These control various + * tunable aspects of the chain, including block and maintenance intervals, maximum data sizes, the fees charged by + * the network, etc. + * + * This operation may only be used in a proposed transaction, and a proposed transaction which contains this + * operation must have a review period specified in the current global parameters before it may be accepted. + */ + struct committee_member_update_global_parameters_operation : public base_operation + { + struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; }; + + asset fee; + chain_parameters new_parameters; + + account_id_type fee_payer()const { return account_id_type(); } + void validate()const; + }; + + /// TODO: committee_member_resign_operation : public base_operation + +} } // graphene::chain +FC_REFLECT( graphene::chain::committee_member_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::chain::committee_member_update_global_parameters_operation::fee_parameters_type, (fee) ) + + +FC_REFLECT( graphene::chain::committee_member_create_operation, + (fee)(committee_member_account)(url) ) + +FC_REFLECT( graphene::chain::committee_member_update_global_parameters_operation, (fee)(new_parameters) ); diff --git a/libraries/chain/include/graphene/chain/protocol/delegate.hpp b/libraries/chain/include/graphene/chain/protocol/delegate.hpp deleted file mode 100644 index 0782fbb1..00000000 --- a/libraries/chain/include/graphene/chain/protocol/delegate.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include - -namespace graphene { namespace chain { - - /** - * @brief Create a delegate object, as a bid to hold a delegate seat on the network. - * @ingroup operations - * - * Accounts which wish to become delegates may use this operation to create a delegate object which stakeholders may - * vote on to approve its position as a delegate. - */ - struct delegate_create_operation : public base_operation - { - struct fee_parameters_type { uint64_t fee = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION; }; - - asset fee; - /// The account which owns the delegate. This account pays the fee for this operation. - account_id_type delegate_account; - string url; - - account_id_type fee_payer()const { return delegate_account; } - void validate()const; - }; - - /** - * @brief Used by delegates to update the global parameters of the blockchain. - * @ingroup operations - * - * This operation allows the delegates to update the global parameters on the blockchain. These control various - * tunable aspects of the chain, including block and maintenance intervals, maximum data sizes, the fees charged by - * the network, etc. - * - * This operation may only be used in a proposed transaction, and a proposed transaction which contains this - * operation must have a review period specified in the current global parameters before it may be accepted. - */ - struct delegate_update_global_parameters_operation : public base_operation - { - struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; }; - - asset fee; - chain_parameters new_parameters; - - account_id_type fee_payer()const { return account_id_type(); } - void validate()const; - }; - - /// TODO: delegate_resign_operation : public base_operation - -} } // graphene::chain -FC_REFLECT( graphene::chain::delegate_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::delegate_update_global_parameters_operation::fee_parameters_type, (fee) ) - - -FC_REFLECT( graphene::chain::delegate_create_operation, - (fee)(delegate_account)(url) ) - -FC_REFLECT( graphene::chain::delegate_update_global_parameters_operation, (fee)(new_parameters) ); diff --git a/libraries/chain/include/graphene/chain/protocol/operations.hpp b/libraries/chain/include/graphene/chain/protocol/operations.hpp index e162ed8c..8a63d0b9 100644 --- a/libraries/chain/include/graphene/chain/protocol/operations.hpp +++ b/libraries/chain/include/graphene/chain/protocol/operations.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,8 +52,8 @@ namespace graphene { namespace chain { withdraw_permission_update_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation, - delegate_create_operation, - delegate_update_global_parameters_operation, + committee_member_create_operation, + committee_member_update_global_parameters_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, worker_create_operation, diff --git a/libraries/chain/include/graphene/chain/protocol/types.hpp b/libraries/chain/include/graphene/chain/protocol/types.hpp index 1354d4cf..b9a1a0fb 100644 --- a/libraries/chain/include/graphene/chain/protocol/types.hpp +++ b/libraries/chain/include/graphene/chain/protocol/types.hpp @@ -112,7 +112,7 @@ namespace graphene { namespace chain { account_object_type, asset_object_type, force_settlement_object_type, - delegate_object_type, + committee_member_object_type, witness_object_type, limit_order_object_type, call_order_object_type, @@ -133,7 +133,7 @@ namespace graphene { namespace chain { impl_index_meta_object_type, impl_asset_dynamic_data_type, impl_asset_bitasset_data_type, - impl_delegate_feeds_object_type, + impl_committee_member_feeds_object_type, impl_account_balance_object_type, impl_account_statistics_object_type, impl_account_debt_object_type, @@ -155,7 +155,7 @@ namespace graphene { namespace chain { //typedef fc::unsigned_int object_id_type; //typedef uint64_t object_id_type; class account_object; - class delegate_object; + class committee_member_object; class witness_object; class asset_object; class force_settlement_object; @@ -173,7 +173,7 @@ namespace graphene { namespace chain { typedef object_id< protocol_ids, account_object_type, account_object> account_id_type; typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type; typedef object_id< protocol_ids, force_settlement_object_type, force_settlement_object> force_settlement_id_type; - typedef object_id< protocol_ids, delegate_object_type, delegate_object> delegate_id_type; + typedef object_id< protocol_ids, committee_member_object_type, committee_member_object> committee_member_id_type; typedef object_id< protocol_ids, witness_object_type, witness_object> witness_id_type; typedef object_id< protocol_ids, limit_order_object_type, limit_order_object> limit_order_id_type; typedef object_id< protocol_ids, call_order_object_type, call_order_object> call_order_id_type; @@ -365,7 +365,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type, (account_object_type) (force_settlement_object_type) (asset_object_type) - (delegate_object_type) + (committee_member_object_type) (witness_object_type) (limit_order_object_type) (call_order_object_type) @@ -384,7 +384,7 @@ FC_REFLECT_ENUM( graphene::chain::impl_object_type, (impl_index_meta_object_type) (impl_asset_dynamic_data_type) (impl_asset_bitasset_data_type) - (impl_delegate_feeds_object_type) + (impl_committee_member_feeds_object_type) (impl_account_balance_object_type) (impl_account_statistics_object_type) (impl_account_debt_object_type) @@ -401,7 +401,7 @@ FC_REFLECT_TYPENAME( graphene::chain::share_type ) FC_REFLECT_TYPENAME( graphene::chain::account_id_type ) FC_REFLECT_TYPENAME( graphene::chain::asset_id_type ) FC_REFLECT_TYPENAME( graphene::chain::force_settlement_id_type ) -FC_REFLECT_TYPENAME( graphene::chain::delegate_id_type ) +FC_REFLECT_TYPENAME( graphene::chain::committee_member_id_type ) FC_REFLECT_TYPENAME( graphene::chain::witness_id_type ) FC_REFLECT_TYPENAME( graphene::chain::limit_order_id_type ) FC_REFLECT_TYPENAME( graphene::chain::call_order_id_type ) diff --git a/libraries/chain/protocol/delegate.cpp b/libraries/chain/protocol/committee_member.cpp similarity index 60% rename from libraries/chain/protocol/delegate.cpp rename to libraries/chain/protocol/committee_member.cpp index dd44168a..75b9193a 100644 --- a/libraries/chain/protocol/delegate.cpp +++ b/libraries/chain/protocol/committee_member.cpp @@ -1,15 +1,15 @@ /* Copyright (C) Cryptonomex, Inc - All Rights Reserved **/ -#include +#include namespace graphene { namespace chain { -void delegate_create_operation::validate()const +void committee_member_create_operation::validate()const { FC_ASSERT( fee.amount >= 0 ); FC_ASSERT(url.size() < GRAPHENE_MAX_URL_LENGTH ); } -void delegate_update_global_parameters_operation::validate() const +void committee_member_update_global_parameters_operation::validate() const { FC_ASSERT( fee.amount >= 0 ); new_parameters.validate(); diff --git a/libraries/chain/transaction_evaluation_state.cpp b/libraries/chain/transaction_evaluation_state.cpp index 0d79d39d..4e6dae18 100644 --- a/libraries/chain/transaction_evaluation_state.cpp +++ b/libraries/chain/transaction_evaluation_state.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/libraries/chain/witness_evaluator.cpp b/libraries/chain/witness_evaluator.cpp index 7b06592d..65a2387a 100644 --- a/libraries/chain/witness_evaluator.cpp +++ b/libraries/chain/witness_evaluator.cpp @@ -17,7 +17,7 @@ */ #include #include -#include +#include #include #include diff --git a/libraries/wallet/cache.cpp b/libraries/wallet/cache.cpp index 051058a9..1c06e8b2 100644 --- a/libraries/wallet/cache.cpp +++ b/libraries/wallet/cache.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -62,8 +62,8 @@ object* create_object( const variant& v ) return create_object_of_type< asset_object >( v ); case force_settlement_object_type: return create_object_of_type< force_settlement_object >( v ); - case delegate_object_type: - return create_object_of_type< delegate_object >( v ); + case committee_member_object_type: + return create_object_of_type< committee_member_object >( v ); case witness_object_type: return create_object_of_type< witness_object >( v ); case limit_order_object_type: diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 253cfb88..759f2f98 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -182,7 +182,7 @@ class wallet_api /** Returns the block chain's slowly-changing settings. * This object contains all of the properties of the blockchain that are fixed * or that change only once per maintenance interval (daily) such as the - * current list of witnesses, delegates, block interval, etc. + * current list of witnesses, committee_members, block interval, etc. * @see \c get_dynamic_global_properties() for frequently changing properties * @returns the global properties */ @@ -686,7 +686,7 @@ class wallet_api * * Price feed providers use this command to publish their price feeds for market-issued assets. A price feed is * used to tune the market for a particular market-issued asset. For each value in the feed, the median across all - * delegate feeds for that asset is calculated and the market for the asset is configured with the median of that + * committee_member feeds for that asset is calculated and the market for the asset is configured with the median of that * value. * * The feed object in this command contains three prices: a call price limit, a short price limit, and a settlement price. @@ -807,17 +807,17 @@ class wallet_api account_whitelist_operation::account_listing new_listing_status, bool broadcast = false); - /** Creates a delegate object owned by the given account. + /** Creates a committee_member object owned by the given account. * - * An account can have at most one delegate object. + * An account can have at most one committee_member object. * - * @param owner_account the name or id of the account which is creating the delegate - * @param url a URL to include in the delegate record in the blockchain. Clients may - * display this when showing a list of delegates. May be blank. + * @param owner_account the name or id of the account which is creating the committee_member + * @param url a URL to include in the committee_member record in the blockchain. Clients may + * display this when showing a list of committee_members. May be blank. * @param broadcast true to broadcast the transaction on the network - * @returns the signed transaction registering a delegate + * @returns the signed transaction registering a committee_member */ - signed_transaction create_delegate(string owner_account, + signed_transaction create_committee_member(string owner_account, string url, bool broadcast = false); @@ -836,20 +836,20 @@ class wallet_api */ map list_witnesses(const string& lowerbound, uint32_t limit); - /** Lists all delegates registered in the blockchain. - * This returns a list of all account names that own delegates, and the associated delegate id, - * sorted by name. This lists delegates whether they are currently voted in or not. + /** Lists all committee_members registered in the blockchain. + * This returns a list of all account names that own committee_members, and the associated committee_member id, + * sorted by name. This lists committee_members whether they are currently voted in or not. * - * Use the \c lowerbound and limit parameters to page through the list. To retrieve all delegates, + * Use the \c lowerbound and limit parameters to page through the list. To retrieve all committee_members, * start by setting \c lowerbound to the empty string \c "", and then each iteration, pass - * the last delegate name returned as the \c lowerbound for the next \c list_delegates() call. + * the last committee_member name returned as the \c lowerbound for the next \c list_committee_members() call. * - * @param lowerbound the name of the first delegate to return. If the named delegate does not exist, - * the list will start at the delegate that comes after \c lowerbound - * @param limit the maximum number of delegates to return (max: 1000) - * @returns a list of delegates mapping delegate names to delegate ids + * @param lowerbound the name of the first committee_member to return. If the named committee_member does not exist, + * the list will start at the committee_member that comes after \c lowerbound + * @param limit the maximum number of committee_members to return (max: 1000) + * @returns a list of committee_members mapping committee_member names to committee_member ids */ - map list_delegates(const string& lowerbound, uint32_t limit); + map list_committee_members(const string& lowerbound, uint32_t limit); /** Returns information about the given witness. * @param owner_account the name or id of the witness account owner, or the id of the witness @@ -857,11 +857,11 @@ class wallet_api */ witness_object get_witness(string owner_account); - /** Returns information about the given delegate. - * @param owner_account the name or id of the delegate account owner, or the id of the delegate - * @returns the information about the delegate stored in the block chain + /** Returns information about the given committee_member. + * @param owner_account the name or id of the committee_member account owner, or the id of the committee_member + * @returns the information about the committee_member stored in the block chain */ - delegate_object get_delegate(string owner_account); + committee_member_object get_committee_member(string owner_account); /** Creates a witness object owned by the given account. * @@ -877,25 +877,25 @@ class wallet_api string url, bool broadcast = false); - /** Vote for a given delegate. + /** Vote for a given committee_member. * - * An account can publish a list of all delegatees they approve of. This - * command allows you to add or remove delegatees from this list. + * An account can publish a list of all committee_memberes they approve of. This + * command allows you to add or remove committee_memberes from this list. * Each account's vote is weighted according to the number of shares of the * core asset owned by that account at the time the votes are tallied. * - * @note you cannot vote against a delegate, you can only vote for the delegate - * or not vote for the delegate. + * @note you cannot vote against a committee_member, you can only vote for the committee_member + * or not vote for the committee_member. * * @param voting_account the name or id of the account who is voting with their shares - * @param delegate the name or id of the delegate' owner account - * @param approve true if you wish to vote in favor of that delegate, false to - * remove your vote in favor of that delegate + * @param committee_member the name or id of the committee_member' owner account + * @param approve true if you wish to vote in favor of that committee_member, false to + * remove your vote in favor of that committee_member * @param broadcast true if you wish to broadcast the transaction - * @return the signed transaction changing your vote for the given delegate + * @return the signed transaction changing your vote for the given committee_member */ - signed_transaction vote_for_delegate(string voting_account, - string delegate, + signed_transaction vote_for_committee_member(string voting_account, + string committee_member, bool approve, bool broadcast = false); @@ -943,13 +943,13 @@ class wallet_api optional voting_account, bool broadcast = false); - /** Set your vote for the number of witnesses and delegates in the system. + /** Set your vote for the number of witnesses and committee_members in the system. * - * Each account can voice their opinion on how many delegates and how many - * witnesses there should be in the active delegate/active witness list. These + * Each account can voice their opinion on how many committee_members and how many + * witnesses there should be in the active committee_member/active witness list. These * are independent of each other. You must vote your approval of at least as many - * delegates or witnesses as you claim there should be (you can't say that there should - * be 20 delegates but only vote for 10). + * committee_members or witnesses as you claim there should be (you can't say that there should + * be 20 committee_members but only vote for 10). * * There are maximum values for each set in the blockchain parameters (currently * defaulting to 1001). @@ -958,14 +958,14 @@ class wallet_api * set, your preferences will be ignored. * * @param account_to_modify the name or id of the account to update - * @param number_of_delegates the number + * @param number_of_committee_members the number * * @param broadcast true if you wish to broadcast the transaction * @return the signed transaction changing your vote proxy settings */ - signed_transaction set_desired_witness_and_delegate_count(string account_to_modify, + signed_transaction set_desired_witness_and_committee_member_count(string account_to_modify, uint16_t desired_number_of_witnesses, - uint16_t desired_number_of_delegates, + uint16_t desired_number_of_committee_members, bool broadcast = false); /** Signs a transaction. @@ -1070,16 +1070,16 @@ FC_API( graphene::wallet::wallet_api, (global_settle_asset) (settle_asset) (whitelist_account) - (create_delegate) + (create_committee_member) (get_witness) - (get_delegate) + (get_committee_member) (list_witnesses) - (list_delegates) + (list_committee_members) (create_witness) - (vote_for_delegate) + (vote_for_committee_member) (vote_for_witness) (set_voting_proxy) - (set_desired_witness_and_delegate_count) + (set_desired_witness_and_committee_member_count) (get_account) (get_account_id) (get_block) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 4d2fbd7b..13ac46c3 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -400,7 +400,7 @@ public: result["next_maintenance_time"] = fc::get_approximate_relative_time_string(dynamic_props.next_maintenance_time); result["chain_id"] = global_props.chain_id; result["active_witnesses"] = global_props.active_witnesses; - result["active_delegates"] = global_props.active_delegates; + result["active_committee_members"] = global_props.active_committee_members; result["entropy"] = dynamic_props.random; return result; } @@ -1117,18 +1117,18 @@ public: return sign_transaction( tx, broadcast ); } FC_CAPTURE_AND_RETHROW( (authorizing_account)(account_to_list)(new_listing_status)(broadcast) ) } - signed_transaction create_delegate(string owner_account, string url, + signed_transaction create_committee_member(string owner_account, string url, bool broadcast /* = false */) { try { - delegate_create_operation delegate_create_op; - delegate_create_op.delegate_account = get_account_id(owner_account); - delegate_create_op.url = url; - if (_remote_db->get_delegate_by_account(delegate_create_op.delegate_account)) - FC_THROW("Account ${owner_account} is already a delegate", ("owner_account", owner_account)); + committee_member_create_operation committee_member_create_op; + committee_member_create_op.committee_member_account = get_account_id(owner_account); + committee_member_create_op.url = url; + if (_remote_db->get_committee_member_by_account(committee_member_create_op.committee_member_account)) + FC_THROW("Account ${owner_account} is already a committee_member", ("owner_account", owner_account)); signed_transaction tx; - tx.operations.push_back( delegate_create_op ); + tx.operations.push_back( committee_member_create_op ); set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees); tx.validate(); @@ -1170,19 +1170,19 @@ public: FC_CAPTURE_AND_RETHROW( (owner_account) ) } - delegate_object get_delegate(string owner_account) + committee_member_object get_committee_member(string owner_account) { try { - fc::optional delegate_id = maybe_id(owner_account); - if (delegate_id) + fc::optional committee_member_id = maybe_id(owner_account); + if (committee_member_id) { - std::vector ids_to_get; - ids_to_get.push_back(*delegate_id); - std::vector> delegate_objects = _remote_db->get_delegates(ids_to_get); - if (delegate_objects.front()) - return *delegate_objects.front(); - FC_THROW("No delegate is registered for id ${id}", ("id", owner_account)); + std::vector ids_to_get; + ids_to_get.push_back(*committee_member_id); + std::vector> committee_member_objects = _remote_db->get_committee_members(ids_to_get); + if (committee_member_objects.front()) + return *committee_member_objects.front(); + FC_THROW("No committee_member is registered for id ${id}", ("id", owner_account)); } else { @@ -1190,15 +1190,15 @@ public: try { account_id_type owner_account_id = get_account_id(owner_account); - fc::optional delegate = _remote_db->get_delegate_by_account(owner_account_id); - if (delegate) - return *delegate; + fc::optional committee_member = _remote_db->get_committee_member_by_account(owner_account_id); + if (committee_member) + return *committee_member; else - FC_THROW("No delegate is registered for account ${account}", ("account", owner_account)); + FC_THROW("No committee_member is registered for account ${account}", ("account", owner_account)); } catch (const fc::exception&) { - FC_THROW("No account or delegate named ${account}", ("account", owner_account)); + FC_THROW("No account or committee_member named ${account}", ("account", owner_account)); } } } @@ -1238,27 +1238,27 @@ public: return sign_transaction( tx, broadcast ); } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) } - signed_transaction vote_for_delegate(string voting_account, - string delegate, + signed_transaction vote_for_committee_member(string voting_account, + string committee_member, bool approve, bool broadcast /* = false */) { try { account_object voting_account_object = get_account(voting_account); - account_id_type delegate_owner_account_id = get_account_id(delegate); - fc::optional delegate_obj = _remote_db->get_delegate_by_account(delegate_owner_account_id); - if (!delegate_obj) - FC_THROW("Account ${delegate} is not registered as a delegate", ("delegate", delegate)); + account_id_type committee_member_owner_account_id = get_account_id(committee_member); + fc::optional committee_member_obj = _remote_db->get_committee_member_by_account(committee_member_owner_account_id); + if (!committee_member_obj) + FC_THROW("Account ${committee_member} is not registered as a committee_member", ("committee_member", committee_member)); if (approve) { - auto insert_result = voting_account_object.options.votes.insert(delegate_obj->vote_id); + auto insert_result = voting_account_object.options.votes.insert(committee_member_obj->vote_id); if (!insert_result.second) - FC_THROW("Account ${account} was already voting for delegate ${delegate}", ("account", voting_account)("delegate", delegate)); + FC_THROW("Account ${account} was already voting for committee_member ${committee_member}", ("account", voting_account)("committee_member", committee_member)); } else { - unsigned votes_removed = voting_account_object.options.votes.erase(delegate_obj->vote_id); + unsigned votes_removed = voting_account_object.options.votes.erase(committee_member_obj->vote_id); if (!votes_removed) - FC_THROW("Account ${account} is already not voting for delegate ${delegate}", ("account", voting_account)("delegate", delegate)); + FC_THROW("Account ${account} is already not voting for committee_member ${committee_member}", ("account", voting_account)("committee_member", committee_member)); } account_update_operation account_update_op; account_update_op.account = voting_account_object.id; @@ -1270,7 +1270,7 @@ public: tx.validate(); return sign_transaction( tx, broadcast ); - } FC_CAPTURE_AND_RETHROW( (voting_account)(delegate)(approve)(broadcast) ) } + } FC_CAPTURE_AND_RETHROW( (voting_account)(committee_member)(approve)(broadcast) ) } signed_transaction vote_for_witness(string voting_account, string witness, @@ -1337,19 +1337,19 @@ public: return sign_transaction( tx, broadcast ); } FC_CAPTURE_AND_RETHROW( (account_to_modify)(voting_account)(broadcast) ) } - signed_transaction set_desired_witness_and_delegate_count(string account_to_modify, + signed_transaction set_desired_witness_and_committee_member_count(string account_to_modify, uint16_t desired_number_of_witnesses, - uint16_t desired_number_of_delegates, + uint16_t desired_number_of_committee_members, bool broadcast /* = false */) { try { account_object account_object_to_modify = get_account(account_to_modify); if (account_object_to_modify.options.num_witness == desired_number_of_witnesses && - account_object_to_modify.options.num_committee == desired_number_of_delegates) - FC_THROW("Account ${account} is already voting for ${witnesses} witnesses and ${delegates} delegates", - ("account", account_to_modify)("witnesses", desired_number_of_witnesses)("delegates",desired_number_of_witnesses)); + account_object_to_modify.options.num_committee == desired_number_of_committee_members) + FC_THROW("Account ${account} is already voting for ${witnesses} witnesses and ${committee_members} committee_members", + ("account", account_to_modify)("witnesses", desired_number_of_witnesses)("committee_members",desired_number_of_witnesses)); account_object_to_modify.options.num_witness = desired_number_of_witnesses; - account_object_to_modify.options.num_committee = desired_number_of_delegates; + account_object_to_modify.options.num_committee = desired_number_of_committee_members; account_update_operation account_update_op; account_update_op.account = account_object_to_modify.id; @@ -1361,7 +1361,7 @@ public: tx.validate(); return sign_transaction( tx, broadcast ); - } FC_CAPTURE_AND_RETHROW( (account_to_modify)(desired_number_of_witnesses)(desired_number_of_delegates)(broadcast) ) } + } FC_CAPTURE_AND_RETHROW( (account_to_modify)(desired_number_of_witnesses)(desired_number_of_committee_members)(broadcast) ) } signed_transaction sign_transaction(signed_transaction tx, bool broadcast = false) { @@ -2095,10 +2095,10 @@ signed_transaction wallet_api::whitelist_account(string authorizing_account, return my->whitelist_account(authorizing_account, account_to_list, new_listing_status, broadcast); } -signed_transaction wallet_api::create_delegate(string owner_account, string url, +signed_transaction wallet_api::create_committee_member(string owner_account, string url, bool broadcast /* = false */) { - return my->create_delegate(owner_account, url, broadcast); + return my->create_committee_member(owner_account, url, broadcast); } map wallet_api::list_witnesses(const string& lowerbound, uint32_t limit) @@ -2106,9 +2106,9 @@ map wallet_api::list_witnesses(const string& lowerbound, return my->_remote_db->lookup_witness_accounts(lowerbound, limit); } -map wallet_api::list_delegates(const string& lowerbound, uint32_t limit) +map wallet_api::list_committee_members(const string& lowerbound, uint32_t limit) { - return my->_remote_db->lookup_delegate_accounts(lowerbound, limit); + return my->_remote_db->lookup_committee_member_accounts(lowerbound, limit); } witness_object wallet_api::get_witness(string owner_account) @@ -2116,9 +2116,9 @@ witness_object wallet_api::get_witness(string owner_account) return my->get_witness(owner_account); } -delegate_object wallet_api::get_delegate(string owner_account) +committee_member_object wallet_api::get_committee_member(string owner_account) { - return my->get_delegate(owner_account); + return my->get_committee_member(owner_account); } signed_transaction wallet_api::create_witness(string owner_account, @@ -2128,12 +2128,12 @@ signed_transaction wallet_api::create_witness(string owner_account, return my->create_witness(owner_account, url, broadcast); } -signed_transaction wallet_api::vote_for_delegate(string voting_account, +signed_transaction wallet_api::vote_for_committee_member(string voting_account, string witness, bool approve, bool broadcast /* = false */) { - return my->vote_for_delegate(voting_account, witness, approve, broadcast); + return my->vote_for_committee_member(voting_account, witness, approve, broadcast); } signed_transaction wallet_api::vote_for_witness(string voting_account, @@ -2151,13 +2151,13 @@ signed_transaction wallet_api::set_voting_proxy(string account_to_modify, return my->set_voting_proxy(account_to_modify, voting_account, broadcast); } -signed_transaction wallet_api::set_desired_witness_and_delegate_count(string account_to_modify, +signed_transaction wallet_api::set_desired_witness_and_committee_member_count(string account_to_modify, uint16_t desired_number_of_witnesses, - uint16_t desired_number_of_delegates, + uint16_t desired_number_of_committee_members, bool broadcast /* = false */) { - return my->set_desired_witness_and_delegate_count(account_to_modify, desired_number_of_witnesses, - desired_number_of_delegates, broadcast); + return my->set_desired_witness_and_committee_member_count(account_to_modify, desired_number_of_witnesses, + desired_number_of_committee_members, broadcast); } void wallet_api::set_wallet_filename(string wallet_filename) @@ -2186,14 +2186,14 @@ operation wallet_api::get_prototype_operation(string operation_name) return graphene::chain::account_upgrade_operation(); if (operation_name == "account_transfer_operation") return graphene::chain::account_transfer_operation(); - if (operation_name == "delegate_create_operation") - return graphene::chain::delegate_create_operation(); + if (operation_name == "committee_member_create_operation") + return graphene::chain::committee_member_create_operation(); if (operation_name == "witness_create_operation") return graphene::chain::witness_create_operation(); if (operation_name == "witness_withdraw_pay_operation") return graphene::chain::witness_withdraw_pay_operation(); - if (operation_name == "delegate_update_global_parameters_operation") - return graphene::chain::delegate_update_global_parameters_operation(); + if (operation_name == "committee_member_update_global_parameters_operation") + return graphene::chain::committee_member_update_global_parameters_operation(); if (operation_name == "transfer_operation") return graphene::chain::transfer_operation(); if (operation_name == "override_transfer_operation") diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 9c510674..69d557d8 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -335,15 +335,15 @@ account_create_operation database_fixture::make_account( create_account.active = authority(321, key, 321); create_account.options.memo_key = key; - auto& active_delegates = db.get_global_properties().active_delegates; - if( active_delegates.size() > 0 ) + auto& active_committee_members = db.get_global_properties().active_committee_members; + if( active_committee_members.size() > 0 ) { set votes; - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); create_account.options.votes = flat_set(votes.begin(), votes.end()); } create_account.options.num_committee = create_account.options.votes.size(); @@ -373,15 +373,15 @@ account_create_operation database_fixture::make_account( create_account.active = authority(321, key, 321); create_account.options.memo_key = key; - const vector& active_delegates = db.get_global_properties().active_delegates; - if( active_delegates.size() > 0 ) + const vector& active_committee_members = db.get_global_properties().active_committee_members; + if( active_committee_members.size() > 0 ) { set votes; - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); - votes.insert(active_delegates[rand() % active_delegates.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); + votes.insert(active_committee_members[rand() % active_committee_members.size()](db).vote_id); create_account.options.votes = flat_set(votes.begin(), votes.end()); } create_account.options.num_committee = create_account.options.votes.size(); @@ -568,15 +568,15 @@ const account_object& database_fixture::create_account( FC_CAPTURE_AND_RETHROW( (name)(registrar_id)(referrer_id) ) } -const delegate_object& database_fixture::create_delegate( const account_object& owner ) +const committee_member_object& database_fixture::create_committee_member( const account_object& owner ) { - delegate_create_operation op; - op.delegate_account = owner.id; + committee_member_create_operation op; + op.committee_member_account = owner.id; trx.operations.push_back(op); trx.validate(); processed_transaction ptx = db.push_transaction(trx, ~0); trx.operations.clear(); - return db.get(ptx.operation_results[0].get()); + return db.get(ptx.operation_results[0].get()); } const witness_object&database_fixture::create_witness(account_id_type owner, const fc::ecc::private_key& signing_private_key) diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index c24b0102..328a3be6 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -243,7 +243,7 @@ struct database_fixture { uint8_t referrer_percent = 100 ); - const delegate_object& create_delegate( const account_object& owner ); + const committee_member_object& create_committee_member( const account_object& owner ); const witness_object& create_witness(account_id_type owner, const fc::ecc::private_key& signing_private_key = generate_private_key("null_key")); const witness_object& create_witness(const account_object& owner, diff --git a/tests/tests/authority_tests.cpp b/tests/tests/authority_tests.cpp index 41dfd5c7..b178bf12 100644 --- a/tests/tests/authority_tests.cpp +++ b/tests/tests/authority_tests.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -473,18 +473,18 @@ BOOST_AUTO_TEST_CASE( committee_authority ) BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 100000); } FC_LOG_AND_RETHROW() } -BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture ) +BOOST_FIXTURE_TEST_CASE( fired_committee_members, database_fixture ) { try { generate_block(); fc::ecc::private_key committee_key = init_account_priv_key; - fc::ecc::private_key delegate_key = fc::ecc::private_key::generate(); + fc::ecc::private_key committee_member_key = fc::ecc::private_key::generate(); //Meet nathan. He has a little money. const account_object* nathan = &create_account("nathan"); transfer(account_id_type()(db), *nathan, asset(5000)); generate_block(); nathan = &get_account("nathan"); - flat_set delegates; + flat_set committee_members; db.modify(db.get_global_properties(), [](global_property_object& p) { // Turn the review period WAY down, so it doesn't take long to produce blocks to that point in simulated time. @@ -493,9 +493,9 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture ) for( int i = 0; i < 15; ++i ) { - const auto& account = create_account("delegate" + fc::to_string(i+1), delegate_key.get_public_key()); + const auto& account = create_account("committee-member" + fc::to_string(i+1), committee_member_key.get_public_key()); upgrade_to_lifetime_member(account); - delegates.insert(create_delegate(account).vote_id); + committee_members.insert(create_committee_member(account).vote_id); } //A proposal is created to give nathan lots more money. @@ -545,11 +545,11 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture ) BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); { - //Oh noes! Nathan votes for a whole new slate of delegates! + //Oh noes! Nathan votes for a whole new slate of committee_members! account_update_operation op; op.account = nathan->id; op.new_options = nathan->options; - op.new_options->votes = delegates; + op.new_options->votes = committee_members; trx.operations.push_back(op); trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION); PUSH_TX( db, trx, ~0 ); @@ -558,9 +558,9 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture ) // still no money BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); - //Time passes... the set of active delegates gets updated. + //Time passes... the set of active committee_members gets updated. generate_blocks(maintenance_time); - //The proposal is no longer authorized, because the active delegates got changed. + //The proposal is no longer authorized, because the active committee_members got changed. BOOST_CHECK(!pid(db).is_authorized_to_execute(db)); // still no money BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); @@ -1032,8 +1032,8 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture ) ACTORS((nathan)(vikram)); upgrade_to_lifetime_member(nathan_id); upgrade_to_lifetime_member(vikram_id); - delegate_id_type nathan_delegate = create_delegate(nathan_id(db)).id; - delegate_id_type vikram_delegate = create_delegate(vikram_id(db)).id; + committee_member_id_type nathan_committee_member = create_committee_member(nathan_id(db)).id; + committee_member_id_type vikram_committee_member = create_committee_member(vikram_id(db)).id; //wdump((db.get_balance(account_id_type(), asset_id_type()))); generate_block(); @@ -1047,7 +1047,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture ) op.account = nathan_id; op.new_options = nathan_id(db).options; op.new_options->voting_account = vikram_id; - op.new_options->votes = flat_set{nathan_delegate(db).vote_id}; + op.new_options->votes = flat_set{nathan_committee_member(db).vote_id}; op.new_options->num_committee = 1; trx.operations.push_back(op); trx.sign(nathan_private_key); @@ -1058,7 +1058,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture ) account_update_operation op; op.account = vikram_id; op.new_options = vikram_id(db).options; - op.new_options->votes.insert(vikram_delegate(db).vote_id); + op.new_options->votes.insert(vikram_committee_member(db).vote_id); op.new_options->num_committee = 11; trx.operations.push_back(op); trx.sign(vikram_private_key); @@ -1073,12 +1073,12 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture ) } generate_blocks(db.get_dynamic_global_properties().next_maintenance_time + GRAPHENE_DEFAULT_BLOCK_INTERVAL); - BOOST_CHECK(std::find(db.get_global_properties().active_delegates.begin(), - db.get_global_properties().active_delegates.end(), - nathan_delegate) == db.get_global_properties().active_delegates.end()); - BOOST_CHECK(std::find(db.get_global_properties().active_delegates.begin(), - db.get_global_properties().active_delegates.end(), - vikram_delegate) != db.get_global_properties().active_delegates.end()); + BOOST_CHECK(std::find(db.get_global_properties().active_committee_members.begin(), + db.get_global_properties().active_committee_members.end(), + nathan_committee_member) == db.get_global_properties().active_committee_members.end()); + BOOST_CHECK(std::find(db.get_global_properties().active_committee_members.begin(), + db.get_global_properties().active_committee_members.end(), + vikram_committee_member) != db.get_global_properties().active_committee_members.end()); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/tests/block_tests.cpp b/tests/tests/block_tests.cpp index 5887c763..c7e3a575 100644 --- a/tests/tests/block_tests.cpp +++ b/tests/tests/block_tests.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -507,12 +507,12 @@ BOOST_FIXTURE_TEST_CASE( maintenance_interval, database_fixture ) auto initial_properties = db.get_global_properties(); const account_object& nathan = create_account("nathan"); upgrade_to_lifetime_member(nathan); - const delegate_object nathans_delegate = create_delegate(nathan); + const committee_member_object nathans_committee_member = create_committee_member(nathan); { account_update_operation op; op.account = nathan.id; op.new_options = nathan.options; - op.new_options->votes.insert(nathans_delegate.vote_id); + op.new_options->votes.insert(nathans_committee_member.vote_id); trx.operations.push_back(op); PUSH_TX( db, trx, ~0 ); trx.operations.clear(); @@ -526,15 +526,15 @@ BOOST_FIXTURE_TEST_CASE( maintenance_interval, database_fixture ) db.head_block_time().sec_since_epoch() + db.get_global_properties().parameters.block_interval); // shuffling is now handled by the witness_schedule_object. BOOST_CHECK(db.get_global_properties().active_witnesses == initial_properties.active_witnesses); - BOOST_CHECK(db.get_global_properties().active_delegates == initial_properties.active_delegates); + BOOST_CHECK(db.get_global_properties().active_committee_members == initial_properties.active_committee_members); generate_block(); auto new_properties = db.get_global_properties(); - BOOST_CHECK(new_properties.active_delegates != initial_properties.active_delegates); - BOOST_CHECK(std::find(new_properties.active_delegates.begin(), - new_properties.active_delegates.end(), nathans_delegate.id) != - new_properties.active_delegates.end()); + BOOST_CHECK(new_properties.active_committee_members != initial_properties.active_committee_members); + BOOST_CHECK(std::find(new_properties.active_committee_members.begin(), + new_properties.active_committee_members.end(), nathans_committee_member.id) != + new_properties.active_committee_members.end()); BOOST_CHECK_EQUAL(db.get_dynamic_global_properties().next_maintenance_time.sec_since_epoch(), maintenence_time.sec_since_epoch() + new_properties.parameters.maintenance_interval); maintenence_time = db.get_dynamic_global_properties().next_maintenance_time; @@ -649,13 +649,13 @@ BOOST_FIXTURE_TEST_CASE( change_block_interval, database_fixture ) 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; + committee_member_update_global_parameters_operation uop; uop.new_parameters.block_interval = 1; cop.proposed_ops.emplace_back(uop); trx.operations.push_back(cop); db.push_transaction(trx); } - BOOST_TEST_MESSAGE( "Updating proposal by signing with the delegate private key" ); + BOOST_TEST_MESSAGE( "Updating proposal by signing with the committee_member private key" ); { proposal_update_operation uop; uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT; diff --git a/tests/tests/operation_tests.cpp b/tests/tests/operation_tests.cpp index a5ce96a5..acf2ff26 100644 --- a/tests/tests/operation_tests.cpp +++ b/tests/tests/operation_tests.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -360,7 +360,7 @@ BOOST_AUTO_TEST_CASE( update_account ) const account_object& nathan = create_account("nathan", init_account_pub_key); const fc::ecc::private_key nathan_new_key = fc::ecc::private_key::generate(); const public_key_type key_id = nathan_new_key.get_public_key(); - const auto& active_delegates = db.get_global_properties().active_delegates; + const auto& active_committee_members = db.get_global_properties().active_committee_members; transfer(account_id_type()(db), nathan, asset(1000000000)); @@ -370,7 +370,7 @@ BOOST_AUTO_TEST_CASE( update_account ) op.owner = authority(2, key_id, 1, init_account_pub_key, 1); op.active = authority(2, key_id, 1, init_account_pub_key, 1); op.new_options = nathan.options; - op.new_options->votes = flat_set({active_delegates[0](db).vote_id, active_delegates[5](db).vote_id}); + op.new_options->votes = flat_set({active_committee_members[0](db).vote_id, active_committee_members[5](db).vote_id}); op.new_options->num_committee = 2; trx.operations.push_back(op); BOOST_TEST_MESSAGE( "Updating account" ); @@ -451,23 +451,23 @@ BOOST_AUTO_TEST_CASE( transfer_core_asset ) } } -BOOST_AUTO_TEST_CASE( create_delegate ) +BOOST_AUTO_TEST_CASE( create_committee_member ) { try { - delegate_create_operation op; - op.delegate_account = account_id_type(); + committee_member_create_operation op; + op.committee_member_account = account_id_type(); op.fee = asset(); trx.operations.push_back(op); - REQUIRE_THROW_WITH_VALUE(op, delegate_account, account_id_type(99999999)); + REQUIRE_THROW_WITH_VALUE(op, committee_member_account, account_id_type(99999999)); REQUIRE_THROW_WITH_VALUE(op, fee, asset(-600)); trx.operations.back() = op; - delegate_id_type delegate_id = db.get_index_type>>().get_next_id(); + committee_member_id_type committee_member_id = db.get_index_type>>().get_next_id(); PUSH_TX( db, trx, ~0 ); - const delegate_object& d = delegate_id(db); + const committee_member_object& d = committee_member_id(db); - BOOST_CHECK(d.delegate_account == account_id_type()); + BOOST_CHECK(d.committee_member_account == account_id_type()); } catch (fc::exception& e) { edump((e.to_detail_string())); throw; diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index c0c05a5f..be752ec2 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include