EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.76k forks source link

Why is my local blockchain not requiring eosio.code permission when an inline action is executed? #11088

Open oliviera9 opened 2 years ago

oliviera9 commented 2 years ago

I am running a local blockchain with the following command:

nodeos -e -p "eosio" --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --delete-all-blocks > /dev/null 2>&1 &

(nodeos v2.0.6)

I have a contract exposing this action and deployed to 'contract' account:

void token::action1(const name &sender, const asset &quantity, const string &memo)
   {
      action(
        permission_level{sender, "active"_n},
        get_self(),
        "action2"_n,
        std::make_tuple(sender, quantity, memo, std::vector<uint8_t>(), std::vector<uint8_t>())
      ).send();
   }

Calling the action with

cleos push action contract action1 '["account1", "1 TTT", ""]' -p account1@active

Pushing the same action to mainnet returns

Error 3090003: Provided keys, permissions, and delays do not satisfy declared authorizations
Ensure that you have the related private keys inside your wallet and your wallet is unlocked.
Error Details:
transaction declares authority '{"actor":"account1","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [{"actor":"contract","permission":"eosio.code"}], provided keys [], and a delay max limit of 3888000000 ms
pending console output: 

and I need to add contract eosio.code permission (under accounts) to account1@active to let it run correctly.

Why is my local blockchain accepting the transaction without setting the eosio.code permission? Is it because of some parameters missing when starting the local blockchain?

oliviera9 commented 2 years ago

Probably the nodeos setup prevents to enter https://github.com/EOSIO/eos/blob/26a4d285d0be1052d962149e431eb81500782991/libraries/chain/apply_context.cpp#L358,

   // No need to check authorization if replaying irreversible blocks or contract is privileged

Probably we are in the replaying irreversible blocks case. Is it compatible with my nodeos configuration? How to configure nodeos in such a way this