You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Solidity: _grantRole and grantRole share one node id, so one function vanishes and its calls go to the other #5057
I have checked the Troubleshooting section in the README
What happened?
In Solidity, _grantRole(bytes32,address) and grantRole(bytes32,address) in the same contract get ONE node id, because the id drops the leading _. One of the two functions disappears from the graph, and the calls made inside it are credited to its twin. So the graph shows calls the function never makes, and calls to the hidden one link nowhere.
OpenZeppelin uses this _name / name pattern everywhere. In OpenZeppelin Contracts v5.4.0 there are 38 such merged pairs. Compared with the solc 0.8.28 AST, they cause 104 wrong calls edges and 158 missed ones. (C# had the same problem, fixed in #4415.)
Steps to reproduce
AccessControl.sol
// SPDX-License-Identifier: MITpragma solidity^0.8.20;
contractAccessControl {
event RoleGranted(bytes32role, addressaccount);
function hasRole(bytes32role, addressaccount) publicviewreturns (bool) { returnfalse; }
function grantRole(bytes32role, addressaccount) public { _grantRole(role, account); }
function _grantRole(bytes32role, addressaccount) internalreturns (bool) {
if (hasRole(role, account)) returnfalse;
emitRoleGranted(role, account);
returntrue;
}
}
Activity
github-actions commentedon Nov 6, 2026
Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.