Skip to content

Conversation

tarasbob
Copy link

@tarasbob tarasbob commented Jun 7, 2025

Problem

Internal functions parsed from bytecode often lack return type information, causing "Bad internal method returns: Different arities" errors when users try to provide CVL summaries with return types.

Solution

Added special handling in signature merging to trust CVL-specified return types when bytecode provides no return type information.

Impact

Enables verification of contracts using OpenZeppelin's Context and similar patterns where internal functions like _msgSender() are used for access control.

I haven't tested it very thoroughly. Please make sure this doesn't break anything.

Fixes #20

Internal functions parsed from bytecode often lack return type information (empty 'res' field), while CVL summaries specify return types. This caused "Bad internal method returns: Different arities" errors when trying to merge signatures.

This fix adds special handling in two places:

1. CVLASTBuilder: Trust CVL-specified return types when bytecode has none

2. QualifiedFunctionName.mergeReturns: Handle asymmetric return types

This enables summarization of internal functions like OpenZeppelin's Context._msgSender() which are commonly used for access control.

Added test case in Public/TestEVM/Summarization/InternalFunctionReturns/ demonstrating the fix with a minimal Context pattern implementation.
@naftali-g
Copy link
Contributor

See the comment in #20 - I believe there's nothing to fix here. Waiting for your confirmation there before closing this PR though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certora Prover cannot summarise Context._msgSender() – prevents proving “success” path for contracts inheriting OpenZeppelin Context
2 participants