solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Inherited modifier which invokes private function should not compile

Open CryptoKiddies opened this issue 3 years ago • 0 comments

Description

Since the modifier is a code rollup that inlines code into functions that it decorates, it's expected that functions invoked in an inherited modifier which are private will fail when compiled. However there is no such issue in extended contracts, which inherit such modifiers from base contracts.

Environment

  • Compiler version: 0.8.13
  • Target EVM version (as per compiler settings): London
  • Framework/IDE (e.g. Truffle or Remix): Hardhat
  • EVM execution environment / backend / blockchain client: any
  • Operating system: Fedora

Steps to Reproduce

abstract contract MyAbstractParent {
    modifier checkSomething(uint256 tag) {
            _checkActuallyTheThing(tag);
            _;
        }

    function _checkActuallyTheThing(uint256 tag) private view {
        if (
          ...  stuff...
        ) {
            revert("reverting");
        }
    }
}

Comments

Perhaps this is the expected behavior for a modifier as it seems reasonable. I'm not sure whether it's intended to be loosely spec'ed or rule hasn't been finalized yet, which is I've submitted.

CryptoKiddies avatar Jul 29 '22 03:07 CryptoKiddies