iroha icon indicating copy to clipboard operation
iroha copied to clipboard

bug: executor_with_admin isn't correct

Open Erigara opened this issue 1 year ago • 0 comments

Current approach to handling admin account isn't correct (check comment inside the code):

fn visit_instruction(executor: &mut Executor, authority: &AccountId, isi: &InstructionBox) {
    // multihash equals to integration::upgrade::ADMIN_PUBLIC_KEY_MULTIHASH
    let admin_id = "ed012076E5CA9698296AF9BE2CA45F525CB3BCFDEB7EE068BA56F973E9DD90564EF4FC@admin";
    if *authority == parse!(AccountId, admin_id) {
        // PROBLEM is that some additional logic might be defined in `visit_*` functions not necessary related to validation
        // e.g. we remove domain-related permission tokens on domain removal (this logic is defined inside `visit_unregister_domain`)
        // but with such direct execute this logic isn't executed
        execute!(executor, isi);
    }

    iroha_executor::default::visit_instruction(executor, authority, isi);
}

Erigara avatar Jun 10 '24 09:06 Erigara