eos icon indicating copy to clipboard operation
eos copied to clipboard

Attempt to inline action from "eosio" with "eosio.code" permission level failed

Open bytemaster opened this issue 8 years ago • 3 comments

It failed because the permission level "eosio.code" did not exist. I thought this was a default permission / special permission flag that implicitly exists.

bytemaster avatar May 18 '18 18:05 bytemaster

eosio.code is a virtual permission. It doesn't actually exist, but the [email protected] permission level is automatically considered satisfied if it is encountered while traversing authorities under the context of sending an inline action or deferred transaction.

Because it doesn't actually exist, it means it doesn't have an authority that can be updated (which is desired behavior) nor can it be linked to as a minimum permission of an action (which is debatable regarding whether this is desired or undesired behavior).

Because it is a virtual permission, it means it can never be included in the authorizations of an action. If you want a contract to be able to send an inline action, the contract needs to add a real permission to the authorizations which is unilaterally satisfiable by the [email protected] permission.

This is possible to do (despite the fact that eosio.code is a virtual permission) because the updateauth action has a special case in which it allows the eosio.code permission name to be included in an authority even though the permission does not really exist.

arhag avatar May 18 '18 19:05 arhag

Given the above, I added the permission via set account permission active '{"threshold": 1, "keys": [{ "key": "", "weight": 1 }], "accounts": [{ "permission": {"actor": "", "permission": "eosio.code"}, "weight": 1 }]}' owner -p

The result is the account added to active auth with a permission of eosio.code "perm_name": "active", "parent": "owner", "required_auth": { "threshold": 1, "keys": [{ "key": "EOS5ZcPRFtk36Pi22ifsm291ZhBMqWMxsbCa3AKZAjM1SpTqKFp9t", "weight": 1 } ], "accounts": [{ "permission": { "actor": "ptdirectedio", "permission": "eosio.code" }, "weight": 1 } ], "waits": [] An still get inline action's authorizations include a non-existent permission when using inline as action(permission_level{N(), N(eosio.code) },

Can you point out what I am doing wrong. Thanks

PatientDirected avatar Jul 31 '18 20:07 PatientDirected

"permission": {"actor": "", @PatientDirected Why actor is empty?

gberlian avatar Aug 19 '18 22:08 gberlian