AccessControl.sol vs AccessControlEnumerable for custom roles

Hi Gang,
First post. Great community and project!!

Question: I would like to add a custom role to a smart contract.

I am using AccessControl

pragma solidity ^0.8.8;
bytes32 public constant CUSTOMROLE= keccak256("CUSTOMROLE");
       _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); 
        _setupRole(CUSTOMROLE, msg.sender);

I am using REMIX to test it out but when I use grantRole() i get an error

transact to X.grantRole errored: Error encoding arguments: Error: invalid arrayify value (argument="value" value="126a15ce8f1f4efb980ea9b4e6f359d2f6eee35c358d0ded2504497076ceaacd" code=INVALID_ARGUMENT version=bytes/5.4.0)

I use role = 126a15ce8f1f4efb980ea9b4e6f359d2f6eee35c358d0ded2504497076ceaacd
(keccak256 version of CUSTOMROLE from

Do I need a different contract like AC_enum or am I just being dumb as per usual.
Thank you in advance.

Hi @level9, welcome to the community, sorry it took us a while to reply to you here.

This is an error in your use of Ethers.js. I think you're just missing the 0x prefix when you write the role id string as an argument in JavaScript.