assert_evaluator.cpp: Remove skip_unknown_predicate flag, add max_predicate_opcode check
This commit is contained in:
parent
548c760e46
commit
c43c71372d
2 changed files with 13 additions and 12 deletions
|
|
@ -24,13 +24,13 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
struct predicate_visitor
|
||||
struct predicate_visitor
|
||||
{
|
||||
typedef bool result_type;
|
||||
const database& db;
|
||||
|
||||
predicate_visitor( const database& d ):db(d){}
|
||||
|
||||
|
||||
bool operator()( const verify_account_name& p )const
|
||||
{
|
||||
return p.account_id(db).name == p.account_name;
|
||||
|
|
@ -45,6 +45,7 @@ void_result assert_evaluator::do_evaluate( const assert_operation& o )
|
|||
{
|
||||
const database& _db = db();
|
||||
uint32_t skip = _db.get_node_properties().skip_flags;
|
||||
auto max_predicate_opcode = _db.get_global_properties().parameters.max_predicate_opcode;
|
||||
|
||||
if( skip & database::skip_assert_evaluation )
|
||||
return void_result();
|
||||
|
|
@ -53,14 +54,15 @@ void_result assert_evaluator::do_evaluate( const assert_operation& o )
|
|||
{
|
||||
fc::datastream<const char*> ds( pdata.data(), pdata.size() );
|
||||
predicate p;
|
||||
try {
|
||||
fc::raw::unpack( ds, p );
|
||||
} catch ( const fc::exception& e )
|
||||
{
|
||||
if( skip & database::skip_unknown_predicate )
|
||||
continue;
|
||||
throw;
|
||||
}
|
||||
//
|
||||
// FC_ASSERT deep in the bowels of static_variant implementation
|
||||
// will trip if we get a predicate which isn't in our code's
|
||||
// static_variant. This is desired behavior.
|
||||
//
|
||||
fc::raw::unpack( ds, p );
|
||||
|
||||
FC_ASSERT( p.which() >= 0 );
|
||||
FC_ASSERT( unsigned(p.which()) < max_predicate_opcode );
|
||||
FC_ASSERT( p.visit( predicate_visitor( _db ) ) );
|
||||
}
|
||||
return void_result();
|
||||
|
|
|
|||
|
|
@ -118,8 +118,7 @@ namespace graphene { namespace chain {
|
|||
skip_tapos_check = 0x80, ///< used while reindexing -- note this skips expiration check as well
|
||||
skip_authority_check = 0x100, ///< used while reindexing -- disables any checking of authority on transactions
|
||||
skip_merkle_check = 0x200, ///< used while reindexing
|
||||
skip_assert_evaluation = 0x400, ///< used while reindexing
|
||||
skip_unknown_predicate = 0x800 ///< used by non-witness nodes to allow unknown predicates
|
||||
skip_assert_evaluation = 0x400 ///< used while reindexing
|
||||
};
|
||||
|
||||
void open(const fc::path& data_dir, const genesis_state_type& initial_allocation = genesis_state_type());
|
||||
|
|
|
|||
Loading…
Reference in a new issue