eos icon indicating copy to clipboard operation
eos copied to clipboard

Permission issue for action in contract

Open mjshin82 opened this issue 8 years ago • 9 comments

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

mjshin82 avatar May 14 '18 02:05 mjshin82

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

gpmn avatar May 14 '18 08:05 gpmn

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

abc.zip

gpmn avatar May 14 '18 08:05 gpmn

+1

woshidama323 avatar May 14 '18 11:05 woshidama323

We enhanced the security under Dawn 4.0, you need to set the permission level "[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.

bytemaster avatar May 14 '18 22:05 bytemaster

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

chenlian2015 avatar May 16 '18 03:05 chenlian2015

Yes, It works to me. from

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

to

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

mjshin82 avatar May 16 '18 03:05 mjshin82

We enhanced the security under Dawn 4.0, you need to set the permission level "[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"}

boy-good avatar Oct 16 '18 08:10 boy-good

{"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".

shawnmuggle avatar Oct 18 '18 19:10 shawnmuggle

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

anqiuy avatar Mar 01 '19 13:03 anqiuy