未验证 提交 4cfd2e3f 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge pull request #1508 from EOSIO/DAWN-646

DAWN 646 - Fix problem where validation fails when creating new permission
......@@ -181,14 +181,19 @@ void apply_eosio_updateauth(apply_context& context) {
if (act_auth.permission == config::owner_name || act_auth.permission == update.permission) {
return true;
}
auto current = db.get<permission_object, by_owner>(boost::make_tuple(update.account, update.permission));
while(current.name != config::owner_name) {
if (current.name == act_auth.permission) {
const permission_object *current = db.find<permission_object, by_owner>(boost::make_tuple(update.account, update.permission));
// Permission doesn't exist yet, check parent permission
if (current == nullptr) current = db.find<permission_object, by_owner>(boost::make_tuple(update.account, update.parent));
// Ensure either the permission or parent's permission exists
EOS_ASSERT(current != nullptr, permission_query_exception,
"Fail to retrieve permission for: {\"actor\": \"${actor}\", \"permission\": \"${permission}\" }",
("actor", update.account)("permission", update.parent));
while(current->name != config::owner_name) {
if (current->name == act_auth.permission) {
return true;
}
current = db.get<permission_object>(current.parent);
current = &db.get<permission_object>(current->parent);
}
return false;
......
......@@ -23,6 +23,8 @@ namespace eosio { namespace chain {
FC_DECLARE_DERIVED_EXCEPTION( chain_type_exception, eosio::chain::chain_exception, 3120000, "chain type exception" )
FC_DECLARE_DERIVED_EXCEPTION( missing_plugin_exception, eosio::chain::chain_exception, 3130000, "missing plugin exception" )
FC_DECLARE_DERIVED_EXCEPTION( permission_query_exception, eosio::chain::database_query_exception, 3010001, "permission query exception" )
FC_DECLARE_DERIVED_EXCEPTION( block_tx_output_exception, eosio::chain::block_validate_exception, 3020001, "transaction outputs in block do not match transaction outputs from applying block" )
FC_DECLARE_DERIVED_EXCEPTION( block_concurrency_exception, eosio::chain::block_validate_exception, 3020002, "block does not guarantee concurrent exection without conflicts" )
FC_DECLARE_DERIVED_EXCEPTION( block_lock_exception, eosio::chain::block_validate_exception, 3020003, "shard locks in block are incorrect or mal-formed" )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册