In a contract action I've got the following:
require_auth(from); // NOTICE THIS LINE...
INLINE_ACTION_SENDER(contract, transfer)(
N(contract),
{from, N(active)}, // ... AND THIS LINE.
{from, to, price, memo});
When I invoke the action I get:
Error 3030002: signatures 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":"myaccount","permission":"active"}', but does not have signatures for it.
Notice that require_auth(from)
passes but the inline action fails because the authorization {from, N(active)}
is not present.
How is that possible? Doesn't require_auth(from)
in effect check for the authorization {from, N(active)}
?
Methodology
I'm invoking the action as follows:
cleos push action contract action \
'[ myaccount theiraccount "16 BTC" "DD => PP (C=8)" ]' -p myaccount@active
-p myaccount@active
explicitly provides myaccount@active
authorization, a fact that I can verify by running, for example, the following...
cleos push action contract action \
'[ myaccount theiraccount "16 BTC" "DD => PP (C=8)" ]' -p essential@active
...which causes the require_auth(from)
to fail as expected...
Error 3030001: missing required authority
Ensure that you have the related authority inside your transaction!;
If you are currently using 'cleos push action' command, try to add the relevant authority using -p option.
Error Details:
missing authority of myaccount
...because I didn't provide -p myaccount@active
.