-
Notifications
You must be signed in to change notification settings - Fork 6
Vacuity detection + repair ladder: fix setup root causes instead of filtering methods #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
207c61f
Add vacuous-method detection over per-rule sanity results
shellygr 806e6e1
Wire vacuity alert into prover reports and guard verify_spec stamping
shellygr 0c3bdb9
Register edit_config and write_mock repair tools for the authoring agent
shellygr 38cad69
Teach author and judge prompts the vacuity repair ladder
shellygr 734c5f5
Prevent vacuity at autosetup time: payable-NONDET guard + optimistic_…
shellygr 3aa952b
Harden the vacuity guard: token-boundary filter matching, expect_rule…
shellygr 40963ea
Tighten the >=2-rules vacuity-detection arm to require no healthy ins…
shellygr 571b761
Replace the lexical vacuity escape hatch with a structural acknowledg…
shellygr f7abf80
Hold write_mock output in graph state; materialize per-run and persis…
shellygr ea436df
Cover the agent-mutable setup in the validation digest; feed vacuity …
shellygr c758071
Clamp agent-settable prover flags: 2x-default timeout, loop_iter <= 5…
shellygr 16e18f6
Remove empty mock namespace dirs after prover-run materialization
shellygr 9255055
Restore certora_autosetup to origin/master; autosetup work moves to i…
shellygr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,25 @@ def dispatchers_added(self) -> int: | |
| return 0 | ||
|
|
||
|
|
||
| def is_unresolved_value_transfer(call: CallResolutionInfo) -> bool: | ||
| """Whether ``call`` is a low-level value transfer (``.call{value: ...}``, ``send``, | ||
| ``transfer``) with no resolvable target. | ||
|
|
||
| Such a call HAVOCs and — crucially — can always be *assumed to fail*, which makes every | ||
| caller able to revert on all paths (the vacuous-rule failure mode). ``optimistic_fallback`` | ||
| assumes these calls succeed instead, hence the recommendation built from this predicate. | ||
|
|
||
| The selector check keeps high-level calls that merely look alike out: an unresolved | ||
| ERC20-style ``token.transfer(...)`` carries a resolvable selector, while native value | ||
| transfers have none (``[?].[?]`` in the report legend). | ||
| """ | ||
| snippet = (call.call_site_snippet or "").replace(" ", "") | ||
| if not any(marker in snippet for marker in (".call{value", ".send(", ".transfer(")): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh no. another case that something HAS NOT BEEN THOUGHT LONG AND HARD ABOUT. |
||
| return False | ||
| # Cheap field check first: extract_sighash_from_callee may shell out to `cast sig`. | ||
| return call.selector is None and extract_sighash_from_callee(call.callee_name) is None | ||
|
|
||
|
|
||
| class CallResolutionPhase: | ||
| """ | ||
| Iterative call resolution: | ||
|
|
@@ -169,6 +188,12 @@ def __init__( | |
| self.current_iteration = 0 | ||
| self._last_unresolved_calls: List[CallResolutionInfo] = [] | ||
|
|
||
| # Structured conf-flag recommendation derived from the calls left unresolved when | ||
| # the loop finishes (currently only {"optimistic_fallback": True}, emitted when an | ||
| # unresolved low-level value transfer remains). The autosetup call site merges these | ||
| # into the emitted conf via the ConfigManager extra-flags whitelist. | ||
| self.recommended_extra_flags: Dict[str, Any] = {} | ||
|
|
||
| # Report state: tracks every contract added to the scene with its provenance, | ||
| # every proxy-detection scan result (hits and misses), and the prover job URL | ||
| # for each iteration (None for local runs that don't produce a cloud URL). | ||
|
|
@@ -337,6 +362,17 @@ async def execute( | |
| else: | ||
| logger.info(f" {call.caller_name} -> {call.callee_name}") | ||
|
|
||
| # Recommend optimistic_fallback when unresolved low-level value transfers remain: | ||
| # no link/dispatcher can ever resolve a native `.call{value: ...}`/`send`/`transfer` | ||
| # target, so without the flag every caller can vacuously revert. | ||
| value_transfers = [c for c in remaining if is_unresolved_value_transfer(c)] | ||
| if value_transfers: | ||
| self.recommended_extra_flags["optimistic_fallback"] = True | ||
| logger.info( | ||
| f"Recommending optimistic_fallback for {self.contract_name}: " | ||
| f"{len(value_transfers)} unresolved low-level value transfer(s) remain" | ||
| ) | ||
|
|
||
| # An empty `remaining` only means "all resolved" when the loop finished cleanly. | ||
| # If a prover run failed, the loop broke before refreshing `remaining`, so the | ||
| # spec is incomplete regardless of how many calls earlier iterations resolved. | ||
|
|
@@ -553,6 +589,12 @@ def _generate_report(self, report_file: Path, limit_reached: bool) -> None: | |
| prior_parts = [f"[{n}]({u})" if u else f"{n}" for n, u in prior] | ||
| headline += f" (earlier iterations {', '.join(prior_parts)})" | ||
| lines.append(headline) | ||
| if self.recommended_extra_flags: | ||
| lines.append( | ||
| f"- **Recommended conf flags:** {self.recommended_extra_flags} " | ||
| "(unresolved low-level value transfer(s) remain; without `optimistic_fallback` " | ||
| "every caller of such a call can vacuously revert)" | ||
| ) | ||
| lines.append("") | ||
|
|
||
| # Section B: Proxy Detection | ||
|
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised we do not include optimistic_fallback already.