hyperledger-iroha / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
443 stars 278 forks source link

[BUG] Can't grant custom tokens #3834

Open mversic opened 1 year ago

mversic commented 1 year ago

If a custom token (the one that is not part of default.rs) is defined in the validator every attempt to grant it to an account will fail with "undefined permission token". This happens because visit_grant_account_permission implementation only looks for tokens that are defined within default.rs it never takes into consideration that there are other tokens outside default.rs

mversic commented 1 year ago

the reason why GrantBox::execute passes in validator_with_custom_token test is because it skips the validation. Which indicates we should better add a test to guard against this sort of a bug

mversic commented 1 year ago

As I tried to properly solve this issue I found that it would be quite useful to first implement #3640

Arjentix commented 1 year ago

Users should not use default implementation in such places if they have some custom permission tokens defined. Need to think how we can force them to worry about it.

mversic commented 12 months ago

one possibility is to remove visit_grant_account_permission from macro generation and force users to always write manual implementations