parent
133b41b65a
commit
5d48052da3
4 changed files with 21 additions and 18 deletions
|
|
@ -205,7 +205,7 @@ namespace graphene { namespace chain {
|
|||
const std::function<vector<authority>(account_id_type, const operation&)>& get_custom,
|
||||
bool ignore_custom_operation_required_auths,
|
||||
uint32_t max_recursion = GRAPHENE_MAX_SIG_CHECK_DEPTH,
|
||||
bool allow_committe = false,
|
||||
bool allow_committee = false,
|
||||
const flat_set<account_id_type>& active_aprovals = flat_set<account_id_type>(),
|
||||
const flat_set<account_id_type>& owner_approvals = flat_set<account_id_type>() );
|
||||
|
||||
|
|
|
|||
|
|
@ -207,16 +207,17 @@ struct proposal_operation_hardfork_visitor
|
|||
void_result proposal_create_evaluator::do_evaluate( const proposal_create_operation& o )
|
||||
{ try {
|
||||
const database& d = db();
|
||||
auto block_time = d.head_block_time();
|
||||
|
||||
proposal_operation_hardfork_visitor vtor( d.head_block_time() );
|
||||
proposal_operation_hardfork_visitor vtor( block_time );
|
||||
vtor( o );
|
||||
|
||||
const auto& global_parameters = d.get_global_properties().parameters;
|
||||
|
||||
FC_ASSERT( o.expiration_time > d.head_block_time(), "Proposal has already expired on creation." );
|
||||
FC_ASSERT( o.expiration_time <= d.head_block_time() + global_parameters.maximum_proposal_lifetime,
|
||||
FC_ASSERT( o.expiration_time > block_time, "Proposal has already expired on creation." );
|
||||
FC_ASSERT( o.expiration_time <= block_time + global_parameters.maximum_proposal_lifetime,
|
||||
"Proposal expiration time is too far in the future.");
|
||||
FC_ASSERT( !o.review_period_seconds || fc::seconds(*o.review_period_seconds) < (o.expiration_time - d.head_block_time()),
|
||||
FC_ASSERT( !o.review_period_seconds || fc::seconds(*o.review_period_seconds) < (o.expiration_time - block_time),
|
||||
"Proposal review period must be less than its overall lifetime." );
|
||||
|
||||
{
|
||||
|
|
@ -276,7 +277,7 @@ object_id_type proposal_create_evaluator::do_apply( const proposal_create_operat
|
|||
// TODO: consider caching values from evaluate?
|
||||
for( auto& op : _proposed_trx.operations )
|
||||
operation_get_required_authorities( op, required_active, proposal.required_owner_approvals, other,
|
||||
MUST_IGNORE_CUSTOM_OP_REQD_AUTHS(block_time) );
|
||||
MUST_IGNORE_CUSTOM_OP_REQD_AUTHS(chain_time) );
|
||||
|
||||
//All accounts which must provide both owner and active authority should be omitted from the active authority set;
|
||||
//owner authority approval implies active authority approval.
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ void verify_authority( const vector<operation>& ops, const flat_set<public_key_t
|
|||
const std::function<vector<authority>(account_id_type, const operation&)>& get_custom,
|
||||
bool ignore_custom_operation_required_auths,
|
||||
uint32_t max_recursion_depth,
|
||||
bool allow_committe,
|
||||
bool allow_committee,
|
||||
const flat_set<account_id_type>& active_aprovals,
|
||||
const flat_set<account_id_type>& owner_approvals )
|
||||
{ try {
|
||||
|
|
@ -416,7 +416,7 @@ set<public_key_type> signed_transaction::minimize_required_signatures(
|
|||
uint32_t max_recursion
|
||||
) const
|
||||
{
|
||||
set< public_key_type > s = get_required_signatures( chain_id, available_keys, get_active, get_owner,
|
||||
set< public_key_type > s = get_required_signatures( chain_id, available_keys, get_active, get_owner, get_custom,
|
||||
ignore_custom_operation_required_auths, max_recursion );
|
||||
flat_set< public_key_type > result( s.begin(), s.end() );
|
||||
|
||||
|
|
|
|||
|
|
@ -1205,9 +1205,9 @@ BOOST_FIXTURE_TEST_CASE( get_required_signatures_test, database_fixture )
|
|||
{
|
||||
//wdump( (tx)(available_keys) );
|
||||
set<public_key_type> result_set = tx.get_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, false, false);
|
||||
get_active, get_owner, get_custom, false);
|
||||
set<public_key_type> result_set2 = tx.get_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, true, false);
|
||||
get_active, get_owner, get_custom, true);
|
||||
//wdump( (result_set)(result_set2)(ref_set) );
|
||||
return result_set == ref_set && result_set2 == ref_set;
|
||||
} ;
|
||||
|
|
@ -1330,9 +1330,9 @@ BOOST_FIXTURE_TEST_CASE( nonminimal_sig_test, database_fixture )
|
|||
{
|
||||
//wdump( (tx)(available_keys) );
|
||||
set<public_key_type> result_set = tx.get_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, false, false);
|
||||
get_active, get_owner, get_custom, false);
|
||||
set<public_key_type> result_set2 = tx.get_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, true, false);
|
||||
get_active, get_owner, get_custom, true);
|
||||
//wdump( (result_set)(result_set2)(ref_set) );
|
||||
return result_set == ref_set && result_set2 == ref_set;
|
||||
} ;
|
||||
|
|
@ -1345,9 +1345,9 @@ BOOST_FIXTURE_TEST_CASE( nonminimal_sig_test, database_fixture )
|
|||
{
|
||||
//wdump( (tx)(available_keys) );
|
||||
set<public_key_type> result_set = tx.minimize_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, false, false);
|
||||
get_active, get_owner, get_custom, false);
|
||||
set<public_key_type> result_set2 = tx.minimize_required_signatures(db.get_chain_id(), available_keys,
|
||||
get_active, get_owner, true, false);
|
||||
get_active, get_owner, get_custom, true);
|
||||
//wdump( (result_set)(result_set2)(ref_set) );
|
||||
return result_set == ref_set && result_set2 == ref_set;
|
||||
} ;
|
||||
|
|
@ -1366,11 +1366,13 @@ BOOST_FIXTURE_TEST_CASE( nonminimal_sig_test, database_fixture )
|
|||
BOOST_CHECK( chk( tx, { alice_public_key, bob_public_key }, { alice_public_key, bob_public_key } ) );
|
||||
BOOST_CHECK( chk_min( tx, { alice_public_key, bob_public_key }, { alice_public_key } ) );
|
||||
|
||||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner, false, false ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner, true, false ), fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner, get_custom, false ),
|
||||
fc::exception );
|
||||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner, get_custom, true ),
|
||||
fc::exception );
|
||||
sign( tx, alice_private_key );
|
||||
tx.verify_authority( db.get_chain_id(), get_active, get_owner, false, false );
|
||||
tx.verify_authority( db.get_chain_id(), get_active, get_owner, true, false );
|
||||
tx.verify_authority( db.get_chain_id(), get_active, get_owner, get_custom, false );
|
||||
tx.verify_authority( db.get_chain_id(), get_active, get_owner, get_custom, true );
|
||||
}
|
||||
catch(fc::exception& e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue