Rename bad references to delegate -> committee member; #147

This commit is contained in:
Vikram Rajkumar 2015-07-13 16:06:02 -04:00
parent 6043586d15
commit 2f429e07f1
35 changed files with 357 additions and 357 deletions

View file

@ -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, 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," 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). do not).
All asset ID's are of the form `1.3.x`. If you were the 29th asset to be registered, All asset ID's are of the form `1.3.x`. If you were the 29th asset to be registered,

View file

@ -247,9 +247,9 @@ namespace graphene { namespace app {
return result; return result;
} }
fc::optional<delegate_object> database_api::get_delegate_by_account(account_id_type account) const fc::optional<committee_member_object> database_api::get_committee_member_by_account(account_id_type account) const
{ {
const auto& idx = _db.get_index_type<delegate_index>().indices().get<by_account>(); const auto& idx = _db.get_index_type<committee_member_index>().indices().get<by_account>();
auto itr = idx.find(account); auto itr = idx.find(account);
if( itr != idx.end() ) if( itr != idx.end() )
return *itr; return *itr;
@ -293,27 +293,27 @@ namespace graphene { namespace app {
return witnesses_by_account_name; return witnesses_by_account_name;
} }
map<string, delegate_id_type> database_api::lookup_delegate_accounts(const string& lower_bound_name, uint32_t limit)const map<string, committee_member_id_type> database_api::lookup_committee_member_accounts(const string& lower_bound_name, uint32_t limit)const
{ {
FC_ASSERT( limit <= 1000 ); FC_ASSERT( limit <= 1000 );
const auto& delegates_by_id = _db.get_index_type<delegate_index>().indices().get<by_id>(); const auto& committee_members_by_id = _db.get_index_type<committee_member_index>().indices().get<by_id>();
// we want to order delegates by account name, but that name is in the account object // we want to order committee_members by account name, but that name is in the account object
// so the delegate_index doesn't have a quick way to access it. // 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 // 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 // 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 // number of committee_members to be few and the frequency of calls to be rare
std::map<std::string, delegate_id_type> delegates_by_account_name; std::map<std::string, committee_member_id_type> committee_members_by_account_name;
for (const delegate_object& delegate : delegates_by_id) for (const committee_member_object& committee_member : committee_members_by_id)
if (auto account_iter = _db.find(delegate.delegate_account)) 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 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(); auto end_iter = committee_members_by_account_name.begin();
while (end_iter != delegates_by_account_name.end() && limit--) while (end_iter != committee_members_by_account_name.end() && limit--)
++end_iter; ++end_iter;
delegates_by_account_name.erase(end_iter, delegates_by_account_name.end()); committee_members_by_account_name.erase(end_iter, committee_members_by_account_name.end());
return delegates_by_account_name; return committee_members_by_account_name;
} }
vector<optional<witness_object>> database_api::get_witnesses(const vector<witness_id_type>& witness_ids)const vector<optional<witness_object>> database_api::get_witnesses(const vector<witness_id_type>& witness_ids)const
@ -328,11 +328,11 @@ namespace graphene { namespace app {
return result; return result;
} }
vector<optional<delegate_object>> database_api::get_delegates(const vector<delegate_id_type>& delegate_ids)const vector<optional<committee_member_object>> database_api::get_committee_members(const vector<committee_member_id_type>& committee_member_ids)const
{ {
vector<optional<delegate_object>> result; result.reserve(delegate_ids.size()); vector<optional<committee_member_object>> result; result.reserve(committee_member_ids.size());
std::transform(delegate_ids.begin(), delegate_ids.end(), std::back_inserter(result), std::transform(committee_member_ids.begin(), committee_member_ids.end(), std::back_inserter(result),
[this](delegate_id_type id) -> optional<delegate_object> { [this](committee_member_id_type id) -> optional<committee_member_object> {
if(auto o = _db.find(id)) if(auto o = _db.find(id))
return *o; return *o;
return {}; return {};

View file

@ -22,7 +22,7 @@
#include <graphene/chain/operation_history_object.hpp> #include <graphene/chain/operation_history_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
#include <graphene/chain/proposal_object.hpp> #include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/balance_object.hpp> #include <graphene/chain/balance_object.hpp>
@ -170,11 +170,11 @@ namespace graphene { namespace app {
vector<asset_object> list_assets(const string& lower_bound_symbol, uint32_t limit)const; vector<asset_object> list_assets(const string& lower_bound_symbol, uint32_t limit)const;
/** /**
* @brief Get the delegate owned by a given account * @brief Get the committee_member owned by a given account
* @param account The ID of the account whose delegate should be retrieved * @param account The ID of the account whose committee_member should be retrieved
* @return The delegate object, or null if the account does not have a delegate * @return The committee_member object, or null if the account does not have a committee_member
*/ */
fc::optional<delegate_object> get_delegate_by_account(account_id_type account)const; fc::optional<committee_member_object> get_committee_member_by_account(account_id_type account)const;
/** /**
* @brief Get the witness owned by a given account * @brief Get the witness owned by a given account
* @param account The ID of the account whose witness should be retrieved * @param account The ID of the account whose witness should be retrieved
@ -196,12 +196,12 @@ namespace graphene { namespace app {
map<string, witness_id_type> lookup_witness_accounts(const string& lower_bound_name, uint32_t limit)const; map<string, witness_id_type> 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 lower_bound_name Lower bound of the first name to return
* @param limit Maximum number of results to return -- must not exceed 1000 * @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<string, delegate_id_type> lookup_delegate_accounts(const string& lower_bound_name, uint32_t limit)const; map<string, committee_member_id_type> lookup_committee_member_accounts(const string& lower_bound_name, uint32_t limit)const;
/** /**
* @brief Get a list of witnesses by ID * @brief Get a list of witnesses by ID
@ -213,13 +213,13 @@ namespace graphene { namespace app {
vector<optional<witness_object>> get_witnesses(const vector<witness_id_type>& witness_ids)const; vector<optional<witness_object>> get_witnesses(const vector<witness_id_type>& witness_ids)const;
/** /**
* @brief Get a list of delegates by ID * @brief Get a list of committee_members by ID
* @param delegate_ids IDs of the delegates to retrieve * @param committee_member_ids IDs of the committee_members to retrieve
* @return The delegates corresponding to the provided IDs * @return The committee_members corresponding to the provided IDs
* *
* This function has semantics identical to @ref get_objects * This function has semantics identical to @ref get_objects
*/ */
vector<optional<delegate_object>> get_delegates(const vector<delegate_id_type>& delegate_ids)const; vector<optional<committee_member_object>> get_committee_members(const vector<committee_member_id_type>& committee_member_ids)const;
/** /**
* @group Push Notification Methods * @group Push Notification Methods
@ -471,13 +471,13 @@ FC_API(graphene::app::database_api,
(get_call_orders) (get_call_orders)
(get_settle_orders) (get_settle_orders)
(list_assets) (list_assets)
(get_delegate_by_account) (get_committee_member_by_account)
(get_witnesses) (get_witnesses)
(get_delegates) (get_committee_members)
(get_witness_by_account) (get_witness_by_account)
(get_witness_count) (get_witness_count)
(lookup_witness_accounts) (lookup_witness_accounts)
(lookup_delegate_accounts) (lookup_committee_member_accounts)
(subscribe_to_objects) (subscribe_to_objects)
(unsubscribe_from_objects) (unsubscribe_from_objects)
(subscribe_to_market) (subscribe_to_market)

View file

@ -8,7 +8,7 @@ add_library( graphene_chain
protocol/assert.cpp protocol/assert.cpp
protocol/account.cpp protocol/account.cpp
protocol/transfer.cpp protocol/transfer.cpp
protocol/delegate.cpp protocol/committee_member.cpp
protocol/witness.cpp protocol/witness.cpp
protocol/market.cpp protocol/market.cpp
protocol/proposal.cpp protocol/proposal.cpp
@ -29,7 +29,7 @@ add_library( graphene_chain
account_evaluator.cpp account_evaluator.cpp
assert_evaluator.cpp assert_evaluator.cpp
witness_evaluator.cpp witness_evaluator.cpp
delegate_evaluator.cpp committee_member_evaluator.cpp
asset_evaluator.cpp asset_evaluator.cpp
transfer_evaluator.cpp transfer_evaluator.cpp
proposal_evaluator.cpp proposal_evaluator.cpp

View file

@ -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 //Verify that the publisher is authoritative to publish a feed
if( base.issuer == account_id_type() ) 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) || FC_ASSERT(d.get(GRAPHENE_COMMITTEE_ACCOUNT).active.account_auths.count(o.publisher) ||
d.get_global_properties().witness_accounts.count(o.publisher)); d.get_global_properties().witness_accounts.count(o.publisher));
} else { } else {

View file

@ -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 * 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. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <graphene/chain/delegate_evaluator.hpp> #include <graphene/chain/committee_member_evaluator.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/database.hpp> #include <graphene/chain/database.hpp>
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp> #include <graphene/chain/protocol/fee_schedule.hpp>
@ -24,21 +24,21 @@
namespace graphene { namespace chain { 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 { { 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(); return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) } } 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 { { try {
vote_id_type vote_id; vote_id_type vote_id;
db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) { db().modify(db().get_global_properties(), [&vote_id](global_property_object& p) {
vote_id = p.get_next_vote_id(vote_id_type::committee); vote_id = p.get_next_vote_id(vote_id_type::committee);
}); });
const auto& new_del_object = db().create<delegate_object>( [&]( delegate_object& obj ){ const auto& new_del_object = db().create<committee_member_object>( [&]( committee_member_object& obj ){
obj.delegate_account = op.delegate_account; obj.committee_member_account = op.committee_member_account;
obj.vote_id = vote_id; obj.vote_id = vote_id;
obj.url = op.url; 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 { { try {
FC_ASSERT(trx_state->_is_proposed_trx); FC_ASSERT(trx_state->_is_proposed_trx);
return void_result(); return void_result();
} FC_CAPTURE_AND_RETHROW( (o) ) } } 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 { { try {
db().modify(db().get_global_properties(), [&o](global_property_object& p) { db().modify(db().get_global_properties(), [&o](global_property_object& p) {
p.pending_parameters = o.new_parameters; p.pending_parameters = o.new_parameters;

View file

@ -21,7 +21,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/block_summary_object.hpp> #include <graphene/chain/block_summary_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/global_property_object.hpp> #include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/balance_object.hpp> #include <graphene/chain/balance_object.hpp>
#include <graphene/chain/proposal_object.hpp> #include <graphene/chain/proposal_object.hpp>
@ -35,7 +35,7 @@
#include <graphene/chain/asset_evaluator.hpp> #include <graphene/chain/asset_evaluator.hpp>
#include <graphene/chain/assert_evaluator.hpp> #include <graphene/chain/assert_evaluator.hpp>
#include <graphene/chain/custom_evaluator.hpp> #include <graphene/chain/custom_evaluator.hpp>
#include <graphene/chain/delegate_evaluator.hpp> #include <graphene/chain/committee_member_evaluator.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/proposal_evaluator.hpp> #include <graphene/chain/proposal_evaluator.hpp>
#include <graphene/chain/transfer_evaluator.hpp> #include <graphene/chain/transfer_evaluator.hpp>
@ -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::space_id;
const uint8_t call_order_object::type_id; const uint8_t call_order_object::type_id;
const uint8_t delegate_object::space_id; const uint8_t committee_member_object::space_id;
const uint8_t delegate_object::type_id; const uint8_t committee_member_object::type_id;
const uint8_t force_settlement_object::space_id; const uint8_t force_settlement_object::space_id;
const uint8_t force_settlement_object::type_id; const uint8_t force_settlement_object::type_id;
@ -119,8 +119,8 @@ void database::initialize_evaluators()
register_evaluator<account_update_evaluator>(); register_evaluator<account_update_evaluator>();
register_evaluator<account_upgrade_evaluator>(); register_evaluator<account_upgrade_evaluator>();
register_evaluator<account_whitelist_evaluator>(); register_evaluator<account_whitelist_evaluator>();
register_evaluator<delegate_create_evaluator>(); register_evaluator<committee_member_create_evaluator>();
register_evaluator<delegate_update_global_parameters_evaluator>(); register_evaluator<committee_member_update_global_parameters_evaluator>();
register_evaluator<custom_evaluator>(); register_evaluator<custom_evaluator>();
register_evaluator<asset_create_evaluator>(); register_evaluator<asset_create_evaluator>();
register_evaluator<asset_issue_evaluator>(); register_evaluator<asset_issue_evaluator>();
@ -165,7 +165,7 @@ void database::initialize_indexes()
acnt_index->add_secondary_index<account_member_index>(); acnt_index->add_secondary_index<account_member_index>();
acnt_index->add_secondary_index<account_referrer_index>(); acnt_index->add_secondary_index<account_referrer_index>();
add_index< primary_index<delegate_index> >(); add_index< primary_index<committee_member_index> >();
add_index< primary_index<witness_index> >(); add_index< primary_index<witness_index> >();
add_index< primary_index<limit_order_index > >(); add_index< primary_index<limit_order_index > >();
add_index< primary_index<call_order_index > >(); add_index< primary_index<call_order_index > >();
@ -476,8 +476,8 @@ void database::init_genesis(const genesis_state_type& genesis_state)
// Create initial committee members // Create initial committee members
std::for_each(genesis_state.initial_committee_candidates.begin(), genesis_state.initial_committee_candidates.end(), std::for_each(genesis_state.initial_committee_candidates.begin(), genesis_state.initial_committee_candidates.end(),
[&](const genesis_state_type::initial_committee_member_type& member) { [&](const genesis_state_type::initial_committee_member_type& member) {
delegate_create_operation op; committee_member_create_operation op;
op.delegate_account = get_account_id(member.owner_name); op.committee_member_account = get_account_id(member.owner_name);
apply_operation(genesis_eval_state, op); apply_operation(genesis_eval_state, op);
}); });

View file

@ -20,7 +20,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/global_property_object.hpp> #include <graphene/chain/global_property_object.hpp>
#include <graphene/chain/vesting_balance_object.hpp> #include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
@ -191,21 +191,21 @@ void database::update_active_witnesses()
}); });
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
void database::update_active_delegates() void database::update_active_committee_members()
{ try { { try {
assert( _committee_count_histogram_buffer.size() > 0 ); assert( _committee_count_histogram_buffer.size() > 0 );
uint64_t stake_target = _total_voting_stake / 2; uint64_t stake_target = _total_voting_stake / 2;
uint64_t stake_tally = _committee_count_histogram_buffer[0]; uint64_t stake_tally = _committee_count_histogram_buffer[0];
size_t delegate_count = 0; size_t committee_member_count = 0;
if( stake_target > 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 <= stake_target) )
stake_tally += _committee_count_histogram_buffer[++delegate_count]; stake_tally += _committee_count_histogram_buffer[++committee_member_count];
auto delegates = sort_votable_objects<delegate_index>(std::max(delegate_count*2+1, (size_t)GRAPHENE_MIN_DELEGATE_COUNT)); auto committee_members = sort_votable_objects<committee_member_index>(std::max(committee_member_count*2+1, (size_t)GRAPHENE_MIN_COMMITTEE_MEMBER_COUNT));
// Update committee authorities // Update committee authorities
if( !delegates.empty() ) if( !committee_members.empty() )
{ {
modify(get(GRAPHENE_COMMITTEE_ACCOUNT), [&](account_object& a) { modify(get(GRAPHENE_COMMITTEE_ACCOUNT), [&](account_object& a) {
uint64_t total_votes = 0; uint64_t total_votes = 0;
@ -213,9 +213,9 @@ void database::update_active_delegates()
a.active.weight_threshold = 0; a.active.weight_threshold = 0;
a.active.clear(); 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]; 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) { modify(get_global_properties(), [&](global_property_object& gp) {
gp.active_delegates.clear(); gp.active_committee_members.clear();
std::transform(delegates.begin(), delegates.end(), std::transform(committee_members.begin(), committee_members.end(),
std::inserter(gp.active_delegates, gp.active_delegates.begin()), std::inserter(gp.active_committee_members, gp.active_committee_members.begin()),
[](const delegate_object& d) { return d.id; }); [](const committee_member_object& d) { return d.id; });
}); });
} FC_CAPTURE_AND_RETHROW() } } FC_CAPTURE_AND_RETHROW() }
@ -457,7 +457,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
c(_vote_tally_buffer); c(_vote_tally_buffer);
update_active_witnesses(); update_active_witnesses();
update_active_delegates(); update_active_committee_members();
modify(gpo, [this](global_property_object& p) { modify(gpo, [this](global_property_object& p) {
// Remove scaling of account registration fee // Remove scaling of account registration fee

View file

@ -22,7 +22,7 @@
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp> #include <graphene/chain/protocol/fee_schedule.hpp>

View file

@ -108,7 +108,7 @@ namespace graphene { namespace chain {
* @ingroup protocol * @ingroup protocol
* *
* Accounts are the primary unit of authority on the graphene system. Users must have an account in order to use * 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<account_object> class account_object : public graphene::db::annotated_object<account_object>
{ {
@ -231,7 +231,7 @@ namespace graphene { namespace chain {
static const uint8_t type_id = meta_account_object_type; static const uint8_t type_id = meta_account_object_type;
public_key_type memo_key; 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, FC_REFLECT_DERIVED( graphene::chain::meta_account_object,
(graphene::db::object), (graphene::db::object),
(memo_key)(delegate_id) ) (memo_key)(committee_member_id) )
FC_REFLECT_DERIVED( graphene::chain::account_statistics_object, (graphene::chain::object), FC_REFLECT_DERIVED( graphene::chain::account_statistics_object, (graphene::chain::object),
(most_recent_op) (most_recent_op)

View file

@ -168,7 +168,7 @@ namespace graphene { namespace chain {
bitasset_options options; bitasset_options options;
/// Feeds published for this asset. If issuer is not committee, 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 /// 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. /// 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; flat_map<account_id_type, pair<time_point_sec,price_feed>> feeds;
/// This is the currently active price feed, calculated as the median of values from the currently active /// This is the currently active price feed, calculated as the median of values from the currently active

View file

@ -17,26 +17,26 @@
*/ */
#pragma once #pragma once
#include <graphene/chain/evaluator.hpp> #include <graphene/chain/evaluator.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
class delegate_create_evaluator : public evaluator<delegate_create_evaluator> class committee_member_create_evaluator : public evaluator<committee_member_create_evaluator>
{ {
public: public:
typedef delegate_create_operation operation_type; typedef committee_member_create_operation operation_type;
void_result do_evaluate( const delegate_create_operation& o ); void_result do_evaluate( const committee_member_create_operation& o );
object_id_type do_apply( const delegate_create_operation& o ); object_id_type do_apply( const committee_member_create_operation& o );
}; };
class delegate_update_global_parameters_evaluator : public evaluator<delegate_update_global_parameters_evaluator> class committee_member_update_global_parameters_evaluator : public evaluator<committee_member_update_global_parameters_evaluator>
{ {
public: 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_evaluate( const committee_member_update_global_parameters_operation& o );
void_result do_apply( const delegate_update_global_parameters_operation& o ); void_result do_apply( const committee_member_update_global_parameters_operation& o );
}; };

View file

@ -26,41 +26,41 @@ namespace graphene { namespace chain {
class account_object; class account_object;
/** /**
* @brief tracks information about a delegate account. * @brief tracks information about a committee_member account.
* @ingroup object * @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 * 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 * committee_members were separated into a separate object to make iterating over
* the set of delegate easy. * the set of committee_member easy.
*/ */
class delegate_object : public abstract_object<delegate_object> class committee_member_object : public abstract_object<committee_member_object>
{ {
public: public:
static const uint8_t space_id = protocol_ids; 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; vote_id_type vote_id;
string url; string url;
}; };
struct by_account; struct by_account;
using delegate_multi_index_type = multi_index_container< using committee_member_multi_index_type = multi_index_container<
delegate_object, committee_member_object,
indexed_by< indexed_by<
ordered_unique< tag<by_id>, ordered_unique< tag<by_id>,
member<object, object_id_type, &object::id> member<object, object_id_type, &object::id>
>, >,
hashed_unique< tag<by_account>, hashed_unique< tag<by_account>,
member<delegate_object, account_id_type, &delegate_object::delegate_account> member<committee_member_object, account_id_type, &committee_member_object::committee_member_account>
> >
> >
>; >;
using delegate_index = generic_index<delegate_object, delegate_multi_index_type>; using committee_member_index = generic_index<committee_member_object, committee_member_multi_index_type>;
} } // graphene::chain } } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::delegate_object, (graphene::db::object), FC_REFLECT_DERIVED( graphene::chain::committee_member_object, (graphene::db::object),
(delegate_account)(vote_id)(url) ) (committee_member_account)(vote_id)(url) )

View file

@ -32,9 +32,9 @@
#define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */ #define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */
#define GRAPHENE_MAX_SIG_CHECK_DEPTH 2 #define GRAPHENE_MAX_SIG_CHECK_DEPTH 2
#define GRAPHENE_MIN_WITNESS_COUNT 10 #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. * make the network unable to operate.
*/ */
#define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024 #define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024

View file

@ -441,7 +441,7 @@ namespace graphene { namespace chain {
void pay_workers( share_type& budget ); void pay_workers( share_type& budget );
void perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props); void perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props);
void update_active_witnesses(); void update_active_witnesses();
void update_active_delegates(); void update_active_committee_members();
template<class... Types> template<class... Types>
void perform_account_maintenance(std::tuple<Types...> helpers); void perform_account_maintenance(std::tuple<Types...> helpers);

View file

@ -100,7 +100,7 @@ namespace graphene { namespace chain {
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_settle ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_settle );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_global_settle ); //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_global_settle );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_publish_feed ); //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_create );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( witness_withdraw_pay ); //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_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( 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_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( 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( wrong_chain_id, graphene::chain::chain_exception, 30023, "wrong chain id" )
FC_DECLARE_DERIVED_EXCEPTION( unknown_block, graphene::chain::chain_exception, 30024, "unknown block" ) 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_EXCEPTION( evaluation_error, 31000, "Evaluation Error" )
FC_DECLARE_DERIVED_EXCEPTION( negative_deposit, graphene::chain::evaluation_error, 31001, "negative deposit" ) 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( 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( 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( 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_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( 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( 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( 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( 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" ) 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_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( 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_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( unknown_committee_member_slate, graphene::chain::evaluation_error, 32011, "unknown committee_member slate" )
FC_DECLARE_DERIVED_EXCEPTION( too_may_delegates_in_slate, graphene::chain::evaluation_error, 32012, "too many delegates in 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( 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_precision, graphene::chain::evaluation_error, 35001, "invalid precision" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_asset_symbol, graphene::chain::evaluation_error, 35002, "invalid asset symbol" ) 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( 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( 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( 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( negative_fee, graphene::chain::evaluation_error, 36003, "negative fee" )
FC_DECLARE_DERIVED_EXCEPTION( missing_deposit, graphene::chain::evaluation_error, 36004, "missing deposit" ) FC_DECLARE_DERIVED_EXCEPTION( missing_deposit, graphene::chain::evaluation_error, 36004, "missing deposit" )

View file

@ -24,11 +24,11 @@ namespace graphene { namespace chain {
/** /**
* @class global_property_object * @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 object
* @ingroup implementation * @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<global_property_object> class global_property_object : public graphene::db::abstract_object<global_property_object>
{ {
@ -40,7 +40,7 @@ namespace graphene { namespace chain {
optional<chain_parameters> pending_parameters; optional<chain_parameters> pending_parameters;
uint32_t next_available_vote_id = 0; uint32_t next_available_vote_id = 0;
vector<delegate_id_type> active_delegates; // updated once per maintenance interval vector<committee_member_id_type> active_committee_members; // updated once per maintenance interval
flat_set<witness_id_type> active_witnesses; // updated once per maintenance interval flat_set<witness_id_type> active_witnesses; // updated once per maintenance interval
// n.b. witness scheduling is done by witness_schedule object // n.b. witness scheduling is done by witness_schedule object
flat_set<account_id_type> witness_accounts; // updated once per maintenance interval flat_set<account_id_type> witness_accounts; // updated once per maintenance interval
@ -54,7 +54,7 @@ namespace graphene { namespace chain {
/** /**
* @class dynamic_global_property_object * @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 object
* @ingroup implementation * @ingroup implementation
* *
@ -102,7 +102,7 @@ FC_REFLECT_DERIVED( graphene::chain::global_property_object, (graphene::db::obje
(parameters) (parameters)
(pending_parameters) (pending_parameters)
(next_available_vote_id) (next_available_vote_id)
(active_delegates) (active_committee_members)
(active_witnesses) (active_witnesses)
(chain_id) (chain_id)
) )

View file

@ -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 * 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 * 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. * value.
* *
* The feed in the operation contains three prices: a call price limit, a short price limit, and a settlement price. * The feed in the operation contains three prices: a call price limit, a short price limit, and a settlement price.

View file

@ -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_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 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_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 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 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 uint16_t network_percent_of_fee = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE; ///< percent of transaction fees paid to network

View file

@ -0,0 +1,59 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/protocol/chain_parameters.hpp>
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) );

View file

@ -1,59 +0,0 @@
#pragma once
#include <graphene/chain/protocol/base.hpp>
#include <graphene/chain/protocol/chain_parameters.hpp>
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) );

View file

@ -6,7 +6,7 @@
#include <graphene/chain/protocol/asset_ops.hpp> #include <graphene/chain/protocol/asset_ops.hpp>
#include <graphene/chain/protocol/balance.hpp> #include <graphene/chain/protocol/balance.hpp>
#include <graphene/chain/protocol/custom.hpp> #include <graphene/chain/protocol/custom.hpp>
#include <graphene/chain/protocol/delegate.hpp> #include <graphene/chain/protocol/committee_member.hpp>
#include <graphene/chain/protocol/market.hpp> #include <graphene/chain/protocol/market.hpp>
#include <graphene/chain/protocol/proposal.hpp> #include <graphene/chain/protocol/proposal.hpp>
#include <graphene/chain/protocol/transfer.hpp> #include <graphene/chain/protocol/transfer.hpp>
@ -52,8 +52,8 @@ namespace graphene { namespace chain {
withdraw_permission_update_operation, withdraw_permission_update_operation,
withdraw_permission_claim_operation, withdraw_permission_claim_operation,
withdraw_permission_delete_operation, withdraw_permission_delete_operation,
delegate_create_operation, committee_member_create_operation,
delegate_update_global_parameters_operation, committee_member_update_global_parameters_operation,
vesting_balance_create_operation, vesting_balance_create_operation,
vesting_balance_withdraw_operation, vesting_balance_withdraw_operation,
worker_create_operation, worker_create_operation,

View file

@ -112,7 +112,7 @@ namespace graphene { namespace chain {
account_object_type, account_object_type,
asset_object_type, asset_object_type,
force_settlement_object_type, force_settlement_object_type,
delegate_object_type, committee_member_object_type,
witness_object_type, witness_object_type,
limit_order_object_type, limit_order_object_type,
call_order_object_type, call_order_object_type,
@ -133,7 +133,7 @@ namespace graphene { namespace chain {
impl_index_meta_object_type, impl_index_meta_object_type,
impl_asset_dynamic_data_type, impl_asset_dynamic_data_type,
impl_asset_bitasset_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_balance_object_type,
impl_account_statistics_object_type, impl_account_statistics_object_type,
impl_account_debt_object_type, impl_account_debt_object_type,
@ -155,7 +155,7 @@ namespace graphene { namespace chain {
//typedef fc::unsigned_int object_id_type; //typedef fc::unsigned_int object_id_type;
//typedef uint64_t object_id_type; //typedef uint64_t object_id_type;
class account_object; class account_object;
class delegate_object; class committee_member_object;
class witness_object; class witness_object;
class asset_object; class asset_object;
class force_settlement_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, 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, 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, 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, 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, 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; 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) (account_object_type)
(force_settlement_object_type) (force_settlement_object_type)
(asset_object_type) (asset_object_type)
(delegate_object_type) (committee_member_object_type)
(witness_object_type) (witness_object_type)
(limit_order_object_type) (limit_order_object_type)
(call_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_index_meta_object_type)
(impl_asset_dynamic_data_type) (impl_asset_dynamic_data_type)
(impl_asset_bitasset_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_balance_object_type)
(impl_account_statistics_object_type) (impl_account_statistics_object_type)
(impl_account_debt_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::account_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_id_type ) FC_REFLECT_TYPENAME( graphene::chain::asset_id_type )
FC_REFLECT_TYPENAME( graphene::chain::force_settlement_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::witness_id_type )
FC_REFLECT_TYPENAME( graphene::chain::limit_order_id_type ) FC_REFLECT_TYPENAME( graphene::chain::limit_order_id_type )
FC_REFLECT_TYPENAME( graphene::chain::call_order_id_type ) FC_REFLECT_TYPENAME( graphene::chain::call_order_id_type )

View file

@ -1,15 +1,15 @@
/* Copyright (C) Cryptonomex, Inc - All Rights Reserved **/ /* Copyright (C) Cryptonomex, Inc - All Rights Reserved **/
#include <graphene/chain/protocol/delegate.hpp> #include <graphene/chain/protocol/committee_member.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
void delegate_create_operation::validate()const void committee_member_create_operation::validate()const
{ {
FC_ASSERT( fee.amount >= 0 ); FC_ASSERT( fee.amount >= 0 );
FC_ASSERT(url.size() < GRAPHENE_MAX_URL_LENGTH ); 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 ); FC_ASSERT( fee.amount >= 0 );
new_parameters.validate(); new_parameters.validate();

View file

@ -18,7 +18,7 @@
#include <graphene/chain/transaction_evaluation_state.hpp> #include <graphene/chain/transaction_evaluation_state.hpp>
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/database.hpp> #include <graphene/chain/database.hpp>
#include <graphene/chain/exceptions.hpp> #include <graphene/chain/exceptions.hpp>

View file

@ -17,7 +17,7 @@
*/ */
#include <graphene/chain/witness_evaluator.hpp> #include <graphene/chain/witness_evaluator.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/database.hpp> #include <graphene/chain/database.hpp>

View file

@ -18,7 +18,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/proposal_object.hpp> #include <graphene/chain/proposal_object.hpp>
@ -62,8 +62,8 @@ object* create_object( const variant& v )
return create_object_of_type< asset_object >( v ); return create_object_of_type< asset_object >( v );
case force_settlement_object_type: case force_settlement_object_type:
return create_object_of_type< force_settlement_object >( v ); return create_object_of_type< force_settlement_object >( v );
case delegate_object_type: case committee_member_object_type:
return create_object_of_type< delegate_object >( v ); return create_object_of_type< committee_member_object >( v );
case witness_object_type: case witness_object_type:
return create_object_of_type< witness_object >( v ); return create_object_of_type< witness_object >( v );
case limit_order_object_type: case limit_order_object_type:

View file

@ -182,7 +182,7 @@ class wallet_api
/** Returns the block chain's slowly-changing settings. /** Returns the block chain's slowly-changing settings.
* This object contains all of the properties of the blockchain that are fixed * 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 * 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 * @see \c get_dynamic_global_properties() for frequently changing properties
* @returns the global 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 * 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 * 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. * value.
* *
* The feed object in this command contains three prices: a call price limit, a short price limit, and a settlement price. * 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, account_whitelist_operation::account_listing new_listing_status,
bool broadcast = false); 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 owner_account the name or id of the account which is creating the committee_member
* @param url a URL to include in the delegate record in the blockchain. Clients may * @param url a URL to include in the committee_member record in the blockchain. Clients may
* display this when showing a list of delegates. May be blank. * display this when showing a list of committee_members. May be blank.
* @param broadcast true to broadcast the transaction on the network * @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, string url,
bool broadcast = false); bool broadcast = false);
@ -836,20 +836,20 @@ class wallet_api
*/ */
map<string,witness_id_type> list_witnesses(const string& lowerbound, uint32_t limit); map<string,witness_id_type> list_witnesses(const string& lowerbound, uint32_t limit);
/** Lists all delegates registered in the blockchain. /** Lists all committee_members registered in the blockchain.
* This returns a list of all account names that own delegates, and the associated delegate id, * This returns a list of all account names that own committee_members, and the associated committee_member id,
* sorted by name. This lists delegates whether they are currently voted in or not. * 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 * 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, * @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 delegate that comes after \c lowerbound * the list will start at the committee_member that comes after \c lowerbound
* @param limit the maximum number of delegates to return (max: 1000) * @param limit the maximum number of committee_members to return (max: 1000)
* @returns a list of delegates mapping delegate names to delegate ids * @returns a list of committee_members mapping committee_member names to committee_member ids
*/ */
map<string, delegate_id_type> list_delegates(const string& lowerbound, uint32_t limit); map<string, committee_member_id_type> list_committee_members(const string& lowerbound, uint32_t limit);
/** Returns information about the given witness. /** Returns information about the given witness.
* @param owner_account the name or id of the witness account owner, or the id of the 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); witness_object get_witness(string owner_account);
/** Returns information about the given delegate. /** Returns information about the given committee_member.
* @param owner_account the name or id of the delegate account owner, or the id of the delegate * @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 delegate stored in the block chain * @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. /** Creates a witness object owned by the given account.
* *
@ -877,25 +877,25 @@ class wallet_api
string url, string url,
bool broadcast = false); 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 * An account can publish a list of all committee_memberes they approve of. This
* command allows you to add or remove delegatees from this list. * 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 * 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. * 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 * @note you cannot vote against a committee_member, you can only vote for the committee_member
* or not vote for the delegate. * or not vote for the committee_member.
* *
* @param voting_account the name or id of the account who is voting with their shares * @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 committee_member the name or id of the committee_member' owner account
* @param approve true if you wish to vote in favor of that delegate, false to * @param approve true if you wish to vote in favor of that committee_member, false to
* remove your vote in favor of that delegate * remove your vote in favor of that committee_member
* @param broadcast true if you wish to broadcast the transaction * @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, signed_transaction vote_for_committee_member(string voting_account,
string delegate, string committee_member,
bool approve, bool approve,
bool broadcast = false); bool broadcast = false);
@ -943,13 +943,13 @@ class wallet_api
optional<string> voting_account, optional<string> voting_account,
bool broadcast = false); 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 * Each account can voice their opinion on how many committee_members and how many
* witnesses there should be in the active delegate/active witness list. These * 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 * 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 * committee_members or witnesses as you claim there should be (you can't say that there should
* be 20 delegates but only vote for 10). * be 20 committee_members but only vote for 10).
* *
* There are maximum values for each set in the blockchain parameters (currently * There are maximum values for each set in the blockchain parameters (currently
* defaulting to 1001). * defaulting to 1001).
@ -958,14 +958,14 @@ class wallet_api
* set, your preferences will be ignored. * set, your preferences will be ignored.
* *
* @param account_to_modify the name or id of the account to update * @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 * @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote proxy settings * @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_witnesses,
uint16_t desired_number_of_delegates, uint16_t desired_number_of_committee_members,
bool broadcast = false); bool broadcast = false);
/** Signs a transaction. /** Signs a transaction.
@ -1070,16 +1070,16 @@ FC_API( graphene::wallet::wallet_api,
(global_settle_asset) (global_settle_asset)
(settle_asset) (settle_asset)
(whitelist_account) (whitelist_account)
(create_delegate) (create_committee_member)
(get_witness) (get_witness)
(get_delegate) (get_committee_member)
(list_witnesses) (list_witnesses)
(list_delegates) (list_committee_members)
(create_witness) (create_witness)
(vote_for_delegate) (vote_for_committee_member)
(vote_for_witness) (vote_for_witness)
(set_voting_proxy) (set_voting_proxy)
(set_desired_witness_and_delegate_count) (set_desired_witness_and_committee_member_count)
(get_account) (get_account)
(get_account_id) (get_account_id)
(get_block) (get_block)

View file

@ -400,7 +400,7 @@ public:
result["next_maintenance_time"] = fc::get_approximate_relative_time_string(dynamic_props.next_maintenance_time); result["next_maintenance_time"] = fc::get_approximate_relative_time_string(dynamic_props.next_maintenance_time);
result["chain_id"] = global_props.chain_id; result["chain_id"] = global_props.chain_id;
result["active_witnesses"] = global_props.active_witnesses; 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; result["entropy"] = dynamic_props.random;
return result; return result;
} }
@ -1117,18 +1117,18 @@ public:
return sign_transaction( tx, broadcast ); return sign_transaction( tx, broadcast );
} FC_CAPTURE_AND_RETHROW( (authorizing_account)(account_to_list)(new_listing_status)(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 */) bool broadcast /* = false */)
{ try { { try {
delegate_create_operation delegate_create_op; committee_member_create_operation committee_member_create_op;
delegate_create_op.delegate_account = get_account_id(owner_account); committee_member_create_op.committee_member_account = get_account_id(owner_account);
delegate_create_op.url = url; committee_member_create_op.url = url;
if (_remote_db->get_delegate_by_account(delegate_create_op.delegate_account)) if (_remote_db->get_committee_member_by_account(committee_member_create_op.committee_member_account))
FC_THROW("Account ${owner_account} is already a delegate", ("owner_account", owner_account)); FC_THROW("Account ${owner_account} is already a committee_member", ("owner_account", owner_account));
signed_transaction tx; 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); set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees);
tx.validate(); tx.validate();
@ -1170,19 +1170,19 @@ public:
FC_CAPTURE_AND_RETHROW( (owner_account) ) FC_CAPTURE_AND_RETHROW( (owner_account) )
} }
delegate_object get_delegate(string owner_account) committee_member_object get_committee_member(string owner_account)
{ {
try try
{ {
fc::optional<delegate_id_type> delegate_id = maybe_id<delegate_id_type>(owner_account); fc::optional<committee_member_id_type> committee_member_id = maybe_id<committee_member_id_type>(owner_account);
if (delegate_id) if (committee_member_id)
{ {
std::vector<delegate_id_type> ids_to_get; std::vector<committee_member_id_type> ids_to_get;
ids_to_get.push_back(*delegate_id); ids_to_get.push_back(*committee_member_id);
std::vector<fc::optional<delegate_object>> delegate_objects = _remote_db->get_delegates(ids_to_get); std::vector<fc::optional<committee_member_object>> committee_member_objects = _remote_db->get_committee_members(ids_to_get);
if (delegate_objects.front()) if (committee_member_objects.front())
return *delegate_objects.front(); return *committee_member_objects.front();
FC_THROW("No delegate is registered for id ${id}", ("id", owner_account)); FC_THROW("No committee_member is registered for id ${id}", ("id", owner_account));
} }
else else
{ {
@ -1190,15 +1190,15 @@ public:
try try
{ {
account_id_type owner_account_id = get_account_id(owner_account); account_id_type owner_account_id = get_account_id(owner_account);
fc::optional<delegate_object> delegate = _remote_db->get_delegate_by_account(owner_account_id); fc::optional<committee_member_object> committee_member = _remote_db->get_committee_member_by_account(owner_account_id);
if (delegate) if (committee_member)
return *delegate; return *committee_member;
else 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&) 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 ); return sign_transaction( tx, broadcast );
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) } } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
signed_transaction vote_for_delegate(string voting_account, signed_transaction vote_for_committee_member(string voting_account,
string delegate, string committee_member,
bool approve, bool approve,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
account_object voting_account_object = get_account(voting_account); account_object voting_account_object = get_account(voting_account);
account_id_type delegate_owner_account_id = get_account_id(delegate); account_id_type committee_member_owner_account_id = get_account_id(committee_member);
fc::optional<delegate_object> delegate_obj = _remote_db->get_delegate_by_account(delegate_owner_account_id); fc::optional<committee_member_object> committee_member_obj = _remote_db->get_committee_member_by_account(committee_member_owner_account_id);
if (!delegate_obj) if (!committee_member_obj)
FC_THROW("Account ${delegate} is not registered as a delegate", ("delegate", delegate)); FC_THROW("Account ${committee_member} is not registered as a committee_member", ("committee_member", committee_member));
if (approve) 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) 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 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) 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_operation account_update_op;
account_update_op.account = voting_account_object.id; account_update_op.account = voting_account_object.id;
@ -1270,7 +1270,7 @@ public:
tx.validate(); tx.validate();
return sign_transaction( tx, broadcast ); 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, signed_transaction vote_for_witness(string voting_account,
string witness, string witness,
@ -1337,19 +1337,19 @@ public:
return sign_transaction( tx, broadcast ); return sign_transaction( tx, broadcast );
} FC_CAPTURE_AND_RETHROW( (account_to_modify)(voting_account)(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_witnesses,
uint16_t desired_number_of_delegates, uint16_t desired_number_of_committee_members,
bool broadcast /* = false */) bool broadcast /* = false */)
{ try { { try {
account_object account_object_to_modify = get_account(account_to_modify); account_object account_object_to_modify = get_account(account_to_modify);
if (account_object_to_modify.options.num_witness == desired_number_of_witnesses && if (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)
FC_THROW("Account ${account} is already voting for ${witnesses} witnesses and ${delegates} delegates", FC_THROW("Account ${account} is already voting for ${witnesses} witnesses and ${committee_members} committee_members",
("account", account_to_modify)("witnesses", desired_number_of_witnesses)("delegates",desired_number_of_witnesses)); ("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_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_operation account_update_op;
account_update_op.account = account_object_to_modify.id; account_update_op.account = account_object_to_modify.id;
@ -1361,7 +1361,7 @@ public:
tx.validate(); tx.validate();
return sign_transaction( tx, broadcast ); 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) 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); 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 */) bool broadcast /* = false */)
{ {
return my->create_delegate(owner_account, url, broadcast); return my->create_committee_member(owner_account, url, broadcast);
} }
map<string,witness_id_type> wallet_api::list_witnesses(const string& lowerbound, uint32_t limit) map<string,witness_id_type> wallet_api::list_witnesses(const string& lowerbound, uint32_t limit)
@ -2106,9 +2106,9 @@ map<string,witness_id_type> wallet_api::list_witnesses(const string& lowerbound,
return my->_remote_db->lookup_witness_accounts(lowerbound, limit); return my->_remote_db->lookup_witness_accounts(lowerbound, limit);
} }
map<string,delegate_id_type> wallet_api::list_delegates(const string& lowerbound, uint32_t limit) map<string,committee_member_id_type> 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) 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); 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, 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); 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, string witness,
bool approve, bool approve,
bool broadcast /* = false */) 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, 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); 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_witnesses,
uint16_t desired_number_of_delegates, uint16_t desired_number_of_committee_members,
bool broadcast /* = false */) bool broadcast /* = false */)
{ {
return my->set_desired_witness_and_delegate_count(account_to_modify, desired_number_of_witnesses, return my->set_desired_witness_and_committee_member_count(account_to_modify, desired_number_of_witnesses,
desired_number_of_delegates, broadcast); desired_number_of_committee_members, broadcast);
} }
void wallet_api::set_wallet_filename(string wallet_filename) 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(); return graphene::chain::account_upgrade_operation();
if (operation_name == "account_transfer_operation") if (operation_name == "account_transfer_operation")
return graphene::chain::account_transfer_operation(); return graphene::chain::account_transfer_operation();
if (operation_name == "delegate_create_operation") if (operation_name == "committee_member_create_operation")
return graphene::chain::delegate_create_operation(); return graphene::chain::committee_member_create_operation();
if (operation_name == "witness_create_operation") if (operation_name == "witness_create_operation")
return graphene::chain::witness_create_operation(); return graphene::chain::witness_create_operation();
if (operation_name == "witness_withdraw_pay_operation") if (operation_name == "witness_withdraw_pay_operation")
return graphene::chain::witness_withdraw_pay_operation(); return graphene::chain::witness_withdraw_pay_operation();
if (operation_name == "delegate_update_global_parameters_operation") if (operation_name == "committee_member_update_global_parameters_operation")
return graphene::chain::delegate_update_global_parameters_operation(); return graphene::chain::committee_member_update_global_parameters_operation();
if (operation_name == "transfer_operation") if (operation_name == "transfer_operation")
return graphene::chain::transfer_operation(); return graphene::chain::transfer_operation();
if (operation_name == "override_transfer_operation") if (operation_name == "override_transfer_operation")

View file

@ -25,7 +25,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/vesting_balance_object.hpp> #include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
@ -335,15 +335,15 @@ account_create_operation database_fixture::make_account(
create_account.active = authority(321, key, 321); create_account.active = authority(321, key, 321);
create_account.options.memo_key = key; create_account.options.memo_key = key;
auto& active_delegates = db.get_global_properties().active_delegates; auto& active_committee_members = db.get_global_properties().active_committee_members;
if( active_delegates.size() > 0 ) if( active_committee_members.size() > 0 )
{ {
set<vote_id_type> votes; set<vote_id_type> votes;
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_delegates[rand() % active_delegates.size()](db).vote_id); votes.insert(active_committee_members[rand() % active_committee_members.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_delegates[rand() % active_delegates.size()](db).vote_id); votes.insert(active_committee_members[rand() % active_committee_members.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);
create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end()); create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end());
} }
create_account.options.num_committee = create_account.options.votes.size(); 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.active = authority(321, key, 321);
create_account.options.memo_key = key; create_account.options.memo_key = key;
const vector<delegate_id_type>& active_delegates = db.get_global_properties().active_delegates; const vector<committee_member_id_type>& active_committee_members = db.get_global_properties().active_committee_members;
if( active_delegates.size() > 0 ) if( active_committee_members.size() > 0 )
{ {
set<vote_id_type> votes; set<vote_id_type> votes;
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_delegates[rand() % active_delegates.size()](db).vote_id); votes.insert(active_committee_members[rand() % active_committee_members.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_delegates[rand() % active_delegates.size()](db).vote_id); votes.insert(active_committee_members[rand() % active_committee_members.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);
create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end()); create_account.options.votes = flat_set<vote_id_type>(votes.begin(), votes.end());
} }
create_account.options.num_committee = create_account.options.votes.size(); 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) ) 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; committee_member_create_operation op;
op.delegate_account = owner.id; op.committee_member_account = owner.id;
trx.operations.push_back(op); trx.operations.push_back(op);
trx.validate(); trx.validate();
processed_transaction ptx = db.push_transaction(trx, ~0); processed_transaction ptx = db.push_transaction(trx, ~0);
trx.operations.clear(); trx.operations.clear();
return db.get<delegate_object>(ptx.operation_results[0].get<object_id_type>()); return db.get<committee_member_object>(ptx.operation_results[0].get<object_id_type>());
} }
const witness_object&database_fixture::create_witness(account_id_type owner, const fc::ecc::private_key& signing_private_key) const witness_object&database_fixture::create_witness(account_id_type owner, const fc::ecc::private_key& signing_private_key)

View file

@ -243,7 +243,7 @@ struct database_fixture {
uint8_t referrer_percent = 100 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 witness_object& create_witness(account_id_type owner,
const fc::ecc::private_key& signing_private_key = generate_private_key("null_key")); const fc::ecc::private_key& signing_private_key = generate_private_key("null_key"));
const witness_object& create_witness(const account_object& owner, const witness_object& create_witness(const account_object& owner,

View file

@ -24,7 +24,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/proposal_object.hpp> #include <graphene/chain/proposal_object.hpp>
#include <graphene/db/simple_index.hpp> #include <graphene/db/simple_index.hpp>
@ -473,18 +473,18 @@ BOOST_AUTO_TEST_CASE( committee_authority )
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 100000); BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 100000);
} FC_LOG_AND_RETHROW() } } FC_LOG_AND_RETHROW() }
BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture ) BOOST_FIXTURE_TEST_CASE( fired_committee_members, database_fixture )
{ try { { try {
generate_block(); generate_block();
fc::ecc::private_key committee_key = init_account_priv_key; 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. //Meet nathan. He has a little money.
const account_object* nathan = &create_account("nathan"); const account_object* nathan = &create_account("nathan");
transfer(account_id_type()(db), *nathan, asset(5000)); transfer(account_id_type()(db), *nathan, asset(5000));
generate_block(); generate_block();
nathan = &get_account("nathan"); nathan = &get_account("nathan");
flat_set<vote_id_type> delegates; flat_set<vote_id_type> committee_members;
db.modify(db.get_global_properties(), [](global_property_object& p) { 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. // 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 ) 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); 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. //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); 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; account_update_operation op;
op.account = nathan->id; op.account = nathan->id;
op.new_options = nathan->options; op.new_options = nathan->options;
op.new_options->votes = delegates; op.new_options->votes = committee_members;
trx.operations.push_back(op); trx.operations.push_back(op);
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION); trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION);
PUSH_TX( db, trx, ~0 ); PUSH_TX( db, trx, ~0 );
@ -558,9 +558,9 @@ BOOST_FIXTURE_TEST_CASE( fired_delegates, database_fixture )
// still no money // still no money
BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); 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); 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)); BOOST_CHECK(!pid(db).is_authorized_to_execute(db));
// still no money // still no money
BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); 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)); ACTORS((nathan)(vikram));
upgrade_to_lifetime_member(nathan_id); upgrade_to_lifetime_member(nathan_id);
upgrade_to_lifetime_member(vikram_id); upgrade_to_lifetime_member(vikram_id);
delegate_id_type nathan_delegate = create_delegate(nathan_id(db)).id; committee_member_id_type nathan_committee_member = create_committee_member(nathan_id(db)).id;
delegate_id_type vikram_delegate = create_delegate(vikram_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()))); //wdump((db.get_balance(account_id_type(), asset_id_type())));
generate_block(); generate_block();
@ -1047,7 +1047,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture )
op.account = nathan_id; op.account = nathan_id;
op.new_options = nathan_id(db).options; op.new_options = nathan_id(db).options;
op.new_options->voting_account = vikram_id; op.new_options->voting_account = vikram_id;
op.new_options->votes = flat_set<vote_id_type>{nathan_delegate(db).vote_id}; op.new_options->votes = flat_set<vote_id_type>{nathan_committee_member(db).vote_id};
op.new_options->num_committee = 1; op.new_options->num_committee = 1;
trx.operations.push_back(op); trx.operations.push_back(op);
trx.sign(nathan_private_key); trx.sign(nathan_private_key);
@ -1058,7 +1058,7 @@ BOOST_FIXTURE_TEST_CASE( voting_account, database_fixture )
account_update_operation op; account_update_operation op;
op.account = vikram_id; op.account = vikram_id;
op.new_options = vikram_id(db).options; 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; op.new_options->num_committee = 11;
trx.operations.push_back(op); trx.operations.push_back(op);
trx.sign(vikram_private_key); 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); 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(), BOOST_CHECK(std::find(db.get_global_properties().active_committee_members.begin(),
db.get_global_properties().active_delegates.end(), db.get_global_properties().active_committee_members.end(),
nathan_delegate) == db.get_global_properties().active_delegates.end()); nathan_committee_member) == db.get_global_properties().active_committee_members.end());
BOOST_CHECK(std::find(db.get_global_properties().active_delegates.begin(), BOOST_CHECK(std::find(db.get_global_properties().active_committee_members.begin(),
db.get_global_properties().active_delegates.end(), db.get_global_properties().active_committee_members.end(),
vikram_delegate) != db.get_global_properties().active_delegates.end()); vikram_committee_member) != db.get_global_properties().active_committee_members.end());
} FC_LOG_AND_RETHROW() } } FC_LOG_AND_RETHROW() }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

View file

@ -21,7 +21,7 @@
#include <graphene/chain/database.hpp> #include <graphene/chain/database.hpp>
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/proposal_object.hpp> #include <graphene/chain/proposal_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/witness_schedule_object.hpp> #include <graphene/chain/witness_schedule_object.hpp>
@ -507,12 +507,12 @@ BOOST_FIXTURE_TEST_CASE( maintenance_interval, database_fixture )
auto initial_properties = db.get_global_properties(); auto initial_properties = db.get_global_properties();
const account_object& nathan = create_account("nathan"); const account_object& nathan = create_account("nathan");
upgrade_to_lifetime_member(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; account_update_operation op;
op.account = nathan.id; op.account = nathan.id;
op.new_options = nathan.options; 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); trx.operations.push_back(op);
PUSH_TX( db, trx, ~0 ); PUSH_TX( db, trx, ~0 );
trx.operations.clear(); 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); db.head_block_time().sec_since_epoch() + db.get_global_properties().parameters.block_interval);
// shuffling is now handled by the witness_schedule_object. // 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_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(); generate_block();
auto new_properties = db.get_global_properties(); auto new_properties = db.get_global_properties();
BOOST_CHECK(new_properties.active_delegates != initial_properties.active_delegates); BOOST_CHECK(new_properties.active_committee_members != initial_properties.active_committee_members);
BOOST_CHECK(std::find(new_properties.active_delegates.begin(), BOOST_CHECK(std::find(new_properties.active_committee_members.begin(),
new_properties.active_delegates.end(), nathans_delegate.id) != new_properties.active_committee_members.end(), nathans_committee_member.id) !=
new_properties.active_delegates.end()); new_properties.active_committee_members.end());
BOOST_CHECK_EQUAL(db.get_dynamic_global_properties().next_maintenance_time.sec_since_epoch(), 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.sec_since_epoch() + new_properties.parameters.maintenance_interval);
maintenence_time = db.get_dynamic_global_properties().next_maintenance_time; 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()); 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.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;
cop.expiration_time = db.head_block_time() + *cop.review_period_seconds + 10; 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; uop.new_parameters.block_interval = 1;
cop.proposed_ops.emplace_back(uop); cop.proposed_ops.emplace_back(uop);
trx.operations.push_back(cop); trx.operations.push_back(cop);
db.push_transaction(trx); 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; proposal_update_operation uop;
uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT; uop.fee_paying_account = GRAPHENE_TEMP_ACCOUNT;

View file

@ -21,7 +21,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp> #include <graphene/chain/asset_object.hpp>
#include <graphene/chain/database.hpp> #include <graphene/chain/database.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/vesting_balance_object.hpp> #include <graphene/chain/vesting_balance_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp> #include <graphene/chain/withdraw_permission_object.hpp>
@ -360,7 +360,7 @@ BOOST_AUTO_TEST_CASE( update_account )
const account_object& nathan = create_account("nathan", init_account_pub_key); 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 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 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)); 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.owner = authority(2, key_id, 1, init_account_pub_key, 1);
op.active = 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 = nathan.options;
op.new_options->votes = flat_set<vote_id_type>({active_delegates[0](db).vote_id, active_delegates[5](db).vote_id}); op.new_options->votes = flat_set<vote_id_type>({active_committee_members[0](db).vote_id, active_committee_members[5](db).vote_id});
op.new_options->num_committee = 2; op.new_options->num_committee = 2;
trx.operations.push_back(op); trx.operations.push_back(op);
BOOST_TEST_MESSAGE( "Updating account" ); 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 { try {
delegate_create_operation op; committee_member_create_operation op;
op.delegate_account = account_id_type(); op.committee_member_account = account_id_type();
op.fee = asset(); op.fee = asset();
trx.operations.push_back(op); 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)); REQUIRE_THROW_WITH_VALUE(op, fee, asset(-600));
trx.operations.back() = op; trx.operations.back() = op;
delegate_id_type delegate_id = db.get_index_type<primary_index<simple_index<delegate_object>>>().get_next_id(); committee_member_id_type committee_member_id = db.get_index_type<primary_index<simple_index<committee_member_object>>>().get_next_id();
PUSH_TX( db, trx, ~0 ); 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) { } catch (fc::exception& e) {
edump((e.to_detail_string())); edump((e.to_detail_string()));
throw; throw;

View file

@ -25,7 +25,7 @@
#include <graphene/chain/account_object.hpp> #include <graphene/chain/account_object.hpp>
#include <graphene/chain/balance_object.hpp> #include <graphene/chain/balance_object.hpp>
#include <graphene/chain/witness_object.hpp> #include <graphene/chain/witness_object.hpp>
#include <graphene/chain/delegate_object.hpp> #include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/market_evaluator.hpp> #include <graphene/chain/market_evaluator.hpp>
#include <graphene/chain/worker_evaluator.hpp> #include <graphene/chain/worker_evaluator.hpp>
#include <graphene/chain/vesting_balance_object.hpp> #include <graphene/chain/vesting_balance_object.hpp>