solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Private functions not overridden by other contracts

Open davidBar-On opened this issue 1 year ago • 2 comments

Fixes #11889

Suggested fix for preventing error about overriding private functions by inheriting/other contracts. The fix is based on the previous suggested fix by PR #13328, with the enhancements required by @ekpyron in that PR to make sure during code generation that private functions are not used by other contracts. For that, a new origCallingContract item was added to FunctionCallAnnotation, that points to the contract that calls the function. This field is used to verify that a private function is called by the defining contract, instead of using mostDerivedContract, since in case of a contract calling internal library function that calls a library's private function, mostDerivedContract points to the contract and not the library.

The test cases are practically the same as suggested by in PR #13328.

davidBar-On avatar Jun 25 '23 09:06 davidBar-On

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

github-actions[bot] avatar Jun 25 '23 09:06 github-actions[bot]

I apologize for taking our time with getting back to you on this - the test coverage now indeed looks more reassuring. It also has codegen assertions now as a safety net. This will still need very careful review, but I think we can work towards merging it. It will definitely need a Changelog entry to start with.

ekpyron avatar Jan 08 '24 15:01 ekpyron