autosetup: instantiate $ templates against the contract's real methods - #106
Merged
jar-ben merged 6 commits intoJul 27, 2026
Merged
Conversation
naftali-g
approved these changes
Jul 26, 2026
Base automatically changed from
jaroslav/autosetup-fix-optimize-map-reconciliation
to
master
July 27, 2026 09:58
jar-ben
deleted the
jaroslav/autosetup-extload-method-aware-instantiation
branch
July 27, 2026 10:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
process_template_in_placeblindly substituted$CONTRACT_NAME$and emitted every entry a template declares. Theextloadtemplate listsextsload/exttload/extSloadoverloads and return variants that come from different mixins (UniswapExtsload/Exttload, AaveExtSload), so any given contract implements only a subset. Emitting the rest produced two hard CVL typecheck failures:combineFunctions"un-mergeable signature …" — the template has two entries for the same signature with different returns (extsload(bytes32,uint256)→bytes32[]and→bytes; same forexttload(bytes32[])), which CVL can't merge.DELETEsummary emitted for a method the contract doesn't have.Fix
_filter_template_entries_to_contractkeeps only the materializedmethods{}entries matching a real method of the contract — by (name, parameter types, return type) — usingmethods_parser.get_methods_by_originating_contract. Consequences:→bytes32[]and→bytesprojects stay supported — the per-contract instantiation resolves it);_.) and all non-entry lines (CVL helper functions, comments) are preserved verbatim;Why not just delete the
→bytesvariants / separate templatesThe
→bytesvariants are original (pre-existing) and intended for real projects, so deleting them loses coverage. Separate templates don't help — the registry matches by name, so both would still apply. The discriminator is the return type, which only the contract's actual method carries; hence method-aware instantiation.Validation
tests/test_extload_template_filter.py(new, 4 cases): keep-only-matching, no-duplicate-signatures, keeps-bytes-variant-when-that's-what-the-contract-has (the two-return case), and unknown-methods-leaves-content-unchanged. Full summary unit suite green (23 passed).Dependencies & follow-ups
extSloadmatching) exposed