The LOCK role is special in AccessControl because it has itself as the admin role (like ROOT) but no members. This means that calling `setRoleAdmin(msg.sig, LOCK)"means no one can grant/revoke thatmsg.sig` role anymore, and it gets locked irreversibly. This means it disables admin-based permissioning management of that role and therefore is very powerful in its impact.
Given this, there is a special function lockRole(), which is specifically meant to enforce LOCK as the admin for the specified role parameter. For all other role admin creations, the generic setRoleAdmin() may be used. However, setRoleAdmin() does not prevent specifying the use of LOCK as the admin. If this is accidentally used, it leads to disabling that roles admin management, which is irreversibly similar to the lockRole() function.
It is safer to force admins to use lockRole() as the only way to set admin to LOCK and prevent the use of LOCK as the adminRole parameter in setRoleAdmin(), because doing so will make the intention of the caller clearer as lockRole() clearly has that functionality specified in its name and thats the only thing it does.
Alice who is the admin for foo() wants to give the admin rights to Bob (0xFFFFFFF0) but instead of calling setRoleAdmin(foo.sig, 0xFFFFFFF0), she calls setRoleAdmin(foo.sig, 0xFFFFFFFF) where 0xFFFFFFFF is LOCK. This makes LOCK as the admin for foo() and prevents any further admin-based access control management for foo().
Recommend preventing the use of LOCK as the adminRole parameter in setRoleAdmin().
albertocuestacanada (Yield) confirmed
