Eos: Permission issue for action in contract

Created on 14 May 2018  Â·  9Comments  Â·  Source: EOSIO/eos

Here is my contract code. this contract code make a eosio.token's transfer action like a dice contract sample.

    void hireknight(account_name from, uint64_t type) {
        // ...

        // pay the cost
        action(permission_level{ from, N(active) },
               N(eosio.token), N(transfer),
               std::make_tuple(from, self, price, std::string(""))
        ).send();

       // ...
    }

And then,
Allow ck.code contract to make transfers on mk behalf

eos@ubuntu:~/eosio-wallet$ cleos set account permission mk active '{"threshold": 1,"keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}],"accounts": [{"permission":{"actor":"ck.code","permission":"active"},"weight":1}]}' owner -p mk

But it brings a permission error.

eos@ubuntu:~/eosio-wallet$ cleos push action ck.code hireknight '["mk", 1]' -p mk
Error 3090003: provided keys, permissions, and delays do not satisfy declared authorizations
Error Details:
transaction declares authority '{"actor":"mk","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms

It run fine on dawn3.0, but not on dawn 4.0

Most helpful comment

We enhanced the security under Dawn 4.0, you need to set the permission level "kc.[email protected]" rather than "kc.code@active". Actions dispatched by code are no longer dispatched with "active" authority, but with a special "eosio.code" authority level.

eos@ubuntu:~/eosio-wallet$ cleos set account permission mk active '{"threshold": 1,"keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}],"accounts": [{"permission":{"actor":"ck.code","permission":"eosio.code"},"weight":1}]}' owner -p mk

Therefore, the issue is a misconfigured authority on account mk.

All 9 comments

(>_<)
me too!!!!!!!!!!

that's my code and test script, asking for help!
so appreciate!

abc.zip

+1

We enhanced the security under Dawn 4.0, you need to set the permission level "kc.[email protected]" rather than "kc.code@active". Actions dispatched by code are no longer dispatched with "active" authority, but with a special "eosio.code" authority level.

eos@ubuntu:~/eosio-wallet$ cleos set account permission mk active '{"threshold": 1,"keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}],"accounts": [{"permission":{"actor":"ck.code","permission":"eosio.code"},"weight":1}]}' owner -p mk

Therefore, the issue is a misconfigured authority on account mk.

@cluestudio
Is the problem really solved? I have a unified problem.

Yes, It works to me.
from

[{"permission":{"actor":"ck.code","permission":"active"},"weight":1}]

to

[{"permission":{"actor":"ck.code","permission":"eosio.code"},"weight":1}]

We enhanced the security under Dawn 4.0, you need to set the permission level "kc.[email protected]" rather than "kc.code@active". Actions dispatched by code are no longer dispatched with "active" authority, but with a special "eosio.code" authority level.

eos@ubuntu:~/eosio-wallet$ cleos set account permission mk active '{"threshold": 1,"keys": [{"key": "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4","weight": 1}],"accounts": [{"permission":{"actor":"ck.code","permission":"eosio.code"},"weight":1}]}' owner -p mk

Therefore, the issue is a misconfigured authority on account mk.

Hello, what i how to solve this problem :
Exception Details: 3050003 eosio_assert_message_exception: eosio_assert_message assertion failure
assertion failure with message: attempt to add asset with different symbol
{"s":"attempt to add asset with different symbol"}

{"s":"attempt to add asset with different symbol"}

Are you running on a local node?

The default symbol is SYS on local node, not EOS. Try to use "1.0000 SYS" instead of "1.0000 EOS".

This command do same things with bytemaster's description, but brief...
cleos set account permission mk active ck.code --add-code

Was this page helpful?
0 / 5 - 0 ratings