Skip to content

Commit

Permalink
Minimuze implementation for (future rc delegation code is commented o…
Browse files Browse the repository at this point in the history
…ut temporarily) #2705
  • Loading branch information
mvandeberg committed Jul 26, 2019
1 parent 9613bf3 commit f7d8fd0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
5 changes: 0 additions & 5 deletions libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2211,8 +2211,6 @@ void custom_json_evaluator::do_apply( const custom_json_operation& o )
{
database& d = db();

ilog( "custom_json_evaluator is_producing = ${p} operation = ${o}", ("p", d.is_producing())("o", o) );

if( d.is_producing() )
FC_ASSERT( o.json.length() <= STEEM_CUSTOM_OP_DATA_MAX_LENGTH,
"Operation JSON must be less than ${bytes} bytes.", ("bytes", STEEM_CUSTOM_OP_DATA_MAX_LENGTH) );
Expand All @@ -2227,7 +2225,6 @@ void custom_json_evaluator::do_apply( const custom_json_operation& o )
std::shared_ptr< custom_operation_interpreter > eval = d.get_custom_json_evaluator( o.id );
if( !eval )
{
ilog( "Accepting, no evaluator registered" );
return;
}

Expand All @@ -2239,10 +2236,8 @@ void custom_json_evaluator::do_apply( const custom_json_operation& o )
{
if( d.is_producing() )
{
ilog( "Re-throwing exception ${e}", ("e", e) );
throw e;
}
ilog( "Suppressing exception ${e}", ("e", e) );
}
catch(...)
{
Expand Down
17 changes: 11 additions & 6 deletions libraries/plugins/rc/include/steem/plugins/rc/rc_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct delegate_to_pool_operation : steem::protocol::base_operation
* - When increasing delegation, new DRC is always created to fill the new manabar section.
* - When removing delegation, DRC may be destroyed, but only to the extent necessary for the account not to exceed its newly reduced maximum.
*/
/*
struct delegate_drc_from_pool_operation : steem::protocol::base_operation
{
account_name_type from_pool;
Expand All @@ -63,6 +64,7 @@ struct delegate_drc_from_pool_operation : steem::protocol::base_operation
void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const { a.insert( from_pool ); }
};
*/

/**
* The purpose of set_slot_delegator_operation is to set the delegator allowed to delegate to a
Expand All @@ -73,6 +75,7 @@ struct delegate_drc_from_pool_operation : steem::protocol::base_operation
* the existing delegator, the account itself, or (in the case of slot 1, STEEM_RC_RECOVERY_SLOT_NUM)
* the slot may also be set by the account's recovery partner.
*/
/*
struct set_slot_delegator_operation : steem::protocol::base_operation
{
account_name_type from_pool;
Expand All @@ -85,16 +88,17 @@ struct set_slot_delegator_operation : steem::protocol::base_operation
void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const { a.insert( signer ); }
};
*/

typedef fc::static_variant<
delegate_to_pool_operation,
delegate_drc_from_pool_operation,
set_slot_delegator_operation
delegate_to_pool_operation
//delegate_drc_from_pool_operation,
//set_slot_delegator_operation
> rc_plugin_operation;

STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, delegate_to_pool );
STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, delegate_drc_from_pool );
STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, set_slot_delegator );
//STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, delegate_drc_from_pool );
//STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, set_slot_delegator );

} } } // steem::plugins::rc

Expand All @@ -104,6 +108,7 @@ FC_REFLECT( steem::plugins::rc::delegate_to_pool_operation,
(amount)
(extensions)
)
/*
FC_REFLECT( steem::plugins::rc::delegate_drc_from_pool_operation,
(from_pool)
(to_account)
Expand All @@ -119,6 +124,6 @@ FC_REFLECT( steem::plugins::rc::set_slot_delegator_operation,
(signer)
(extensions)
)

*/
STEEM_DECLARE_OPERATION_TYPE( steem::plugins::rc::rc_plugin_operation )
FC_REFLECT_TYPENAME( steem::plugins::rc::rc_plugin_operation )
6 changes: 4 additions & 2 deletions libraries/plugins/rc/rc_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void delegate_to_pool_operation::validate()const
FC_ASSERT( amount.symbol == VESTS_SYMBOL, "Currently can only delegate VESTS (SMT's not supported #2698)" );
FC_ASSERT( amount.amount.value >= 0, "Delegation to pool cannot be negative" );
}

/*
void delegate_drc_from_pool_operation::validate()const
{
validate_account_name( from_pool );
Expand All @@ -47,6 +47,7 @@ void set_slot_delegator_operation::validate()const
FC_ASSERT( to_slot >= 0 );
FC_ASSERT( to_slot < STEEM_RC_MAX_OUTDEL_SLOTS );
}
*/

void delegate_to_pool_evaluator::do_apply( const delegate_to_pool_operation& op )
{
Expand Down Expand Up @@ -148,7 +149,7 @@ void delegate_to_pool_evaluator::do_apply( const delegate_to_pool_operation& op
rca.vests_delegated_to_pools += asset( delta_max_rc, VESTS_SYMBOL );
} );
}

/*
void delegate_drc_from_pool_evaluator::do_apply( const delegate_drc_from_pool_operation& op )
{
FC_ASSERT( false, "Operation not yet supported" );
Expand All @@ -158,6 +159,7 @@ void set_slot_delegator_evaluator::do_apply( const set_slot_delegator_operation&
{
FC_ASSERT( false, "Operation not yet supported" );
}
*/

} } } // steem::plugins::rc

Expand Down
6 changes: 3 additions & 3 deletions libraries/plugins/rc/rc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ struct pre_apply_operation_visitor

void operator()( const delegate_to_pool_operation& op )const
{
ilog( "Regenerating ${acct}", ("acct", op.from_account) );
//ilog( "Regenerating ${acct}", ("acct", op.from_account) );
regenerate( op.from_account );
}

Expand Down Expand Up @@ -1302,8 +1302,8 @@ void rc_plugin::plugin_initialize( const boost::program_options::variables_map&

// Add each operation evaluator to the registry
my->_custom_operation_interpreter->register_evaluator< delegate_to_pool_evaluator >( this );
my->_custom_operation_interpreter->register_evaluator< delegate_drc_from_pool_evaluator >( this );
my->_custom_operation_interpreter->register_evaluator< set_slot_delegator_evaluator >( this );
//my->_custom_operation_interpreter->register_evaluator< delegate_drc_from_pool_evaluator >( this );
//my->_custom_operation_interpreter->register_evaluator< set_slot_delegator_evaluator >( this );

// Add the registry to the database so the database can delegate custom ops to the plugin
my->_db.register_custom_operation_interpreter( my->_custom_operation_interpreter );
Expand Down

0 comments on commit f7d8fd0

Please sign in to comment.