Repository navigation
feat(solidity-import): value calls, try/catch, self-delegatecall, boolean while, dynamic selector encoding, and Struct[] enum ABI - #2942
Conversation
…ts/reasons, struct field diagnostics
- Closed YulMemoryValueCall transport (Verity/Core/Model/ECM.lean & Denote.lean)
for (bool ok, bytes memory ret) = target.call{value: v}(data);
- Interface try/catch with single scalar return value and catch (bytes memory reason),
plus revert(add(b, 32), mload(b)) over bytes memory locals.
- Report actual type name for unsupported struct fields (enum/UDVT/contract) in AbiSchema.
- Synthetic smoke checks (ValueCallChecks, TryCatchChecks, StructFieldTypeSurveyChecks),
updated rejection controls, mutation anchors, and TRUST_ASSUMPTIONS.md.
…s, bytes4 selectors, self-delegatecall and raw-slot bytes - Closed YulMemoryDelegateCall transport (Verity/Core/Model/ECM.lean & Denote.lean) for address(this).delegatecall(data) self-delegatecalls. - Fixed-bytes constants (bytes16 etc.), general while loop conditions (division, bit-shift, linear), bytes4 selector expressions, and raw-slot bytes/string members. - Synthetic smoke fixtures (FixedBytesConstWhileSelectorSequence, SelfDelegateAndRawSlotEip712Checks).
….encodeWithSelector, boolean while helpers, named external/try args, and Struct[] enum ABI - Helper for-loop early return with general uint256 bounds, non-zero starts, multi-return/void helpers, and unchecked body increments. - abi.encodeWithSelector/Signature with dynamic bytes/string/array arguments using exact Solidity ABI head/tail encoding. - General boolean helper/iterator calls in while conditions and unchecked prefix/postfix inc/dec statements inside while bodies. - Named arguments on typed external calls and external try calls with parameter reordering and competing-panic evaluation-order guard. - new bytes(0) / new string(0) empty allocations and enum fields inside Struct[] ABI schemas with uint8 variant bounds checks. - Synthetic smoke fixtures (HelperLoopAndWhileExt, DynamicSelectorNamedTryEnumArray), updated rejection controls, and re-pinned mutation anchors.
…rite smoke checks independent of post-CALL state access
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| \n### CI Failure Hints\n\nFailed jobs: `build`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n``` |
…legateLoopCEIClean Match onlyClosedTransportCEIBarriers and onlyStaticCallCEIBarriers by requiring (stmtListCEIViolation body false).isSome before enabling allowPostInteractionWrites, so CEI-clean trailing-call functions such as InterfaceVoidCallSequence.signalWord do not spuriously set the opt-out.
|
Needs changes. Review of #2942 (Th0rgal, draft) at head SummaryMost of the new lowerings are careful and match solc where I checked them:
The diff adds no axiom, There are three problems.
Findings (severity-ordered)
Related work
CI (
|
|
Hi @Th0rgal, Ben asked us to help land this one, so we'll push fix commits for the review findings above directly on top of your branch (our own commits only: nothing of yours is rewritten or force-pushed). Each push gets a fresh review and a verdict on its exact head. If you're pushing too, just let us know and we'll rebase our part. |
|
Thanks @fricoben! We're actively addressing all review findings from your review and will push fix commits directly on top of this branch (no force-push / no history rewrite, unless a clean rebase is needed after an earlier PR in the stack merges). Let's coordinate here so we don't duplicate effort. |
…all, value-call A/B/C, and controls Address all review findings on #2942: - [High] Restore the <= 256 iteration cap on early returns in helper for/while loops (lowerHelperFrom, lowerVoidHelperFrom, lowerHelperLoopStmtsWithReturn, lowerLinearWhile?, lowerGeneralBoolWhile?, and isTailWindowFor), restore the flipped helper-for-return rejection rows in check_storage_rejections.py, add a helper-while-uint256-return-over rejection row, and update HelperLoopAndWhileExt fixtures with bounded positive tests plus unbounded negative controls. - [High] Document YulMemoryDelegateCall in docs/TRUST_ASSUMPTIONS.md, add Denote observations in SelfDelegateAndRawSlotEip712Checks (success, outer sender/value preservation, custom-error revert bubbling, empty revert, and batch rollback), and add an A/B/C differential campaign (check_self_delegate_call + imported-model-self-delegate-v1 wired into suite.py). - [Medium] Fix executeByteYulMemoryCallWithKind delegatecall EVM context to preserve outer state.world.sender and state.world.msgValue, and reject payable self-delegatecall callers with a located negative control. - [Medium] Add --variant value A/B/C campaign to check_yul_memory_call (using RecordingValueCallResponder, recording-value-call-responder-v1, and optional selfBalance seeding in SequenceRunner/denote/anvil), wire yul-memory-value-call into suite.py, and add value-call mutation anchors (denote-yul-value-call-debit, ecm-yul-value-call-swap) in check_memory_call_mutations.py. - [Low] Add located negative controls for widened stmtAfterTrailingCall (post-call forEach storage read and post-call value-call loop), tighten exprIsLoopInvariant / exprIsLoopInvariantOut max/min base check to type(...), and document reliance on Solidity local/memory-array immutability across helpers.
There was a problem hiding this comment.
OpenCodeReview first-pass review
🟡 Scout triage + 0/4 paquet(s) reviewés sémantiquement. 8 finding(s) (2 high / 6 medium); les hunks hors paquets restent à couvrir par un humain ou Codex.
Paquets non couverts par la review sémantique
- Compiler/SolidityImport/AbiSchema.lean — timeout (spawnSync ocr ETIMEDOUT)
- Verity/Core/Model/Denote.lean — timeout (spawnSync ocr ETIMEDOUT)
- Contracts/SolidityImportSmoke/FixedBytesConstWhileSelectorSequenceModel.lean — timeout (spawnSync ocr ETIMEDOUT)
- Contracts/SolidityImportSmoke/SelfDelegateCallSequenceModel.lean — error (Command failed: ocr review --from 4e6e87b --to f52d065 --format json --audience agent --rule /home/ubuntu/actions-runner-verity-ocr/_work/_temp/ocr-tools/rules.json --concurr)
📝 4 groupe(s) de paquets au-delà du budget n'ont eu que le triage scout.
Large Lean diff routed to bounded packet review: 25 Lean file(s), 4966 changed supported line(s). Scout triage fallback_deterministic; strong packet review required. Full-file OCR was not attempted.
✅ Posted 8 inline comment(s).
OCR pilot metrics & packet coverage
OCR pilot metrics
- Routing: large-lean-hotspots (router-v11)
- Changed files: 49 supported / 49 total; Lean 25, trust docs 1, workflow/scripts 12, contracts 10, docs 1
- Changed lines: 4966 supported; thresholds large Lean >=3 files or >800 lines
- OCR: status scout_triage; comments 8; files 8; tokens 0; tool calls 0; warnings 1; duration 2435s
- Largest changed files: Compiler/SolidityImport/Import.lean (+1685/-197), Contracts/SolidityImportSmoke/HelperLoopAndWhileExt.sol (+282/-0), scripts/solidity_differential/check_self_delegate_call.py (+200/-0), Contracts/SolidityImportSmoke/DynamicSelectorNamedTryEnumArray.sol (+190/-0), Contracts/SolidityImportSmoke/SelfDelegateAndRawSlotEip712Checks.lean (+184/-0)
Packet coverage
- Packet review: enabled; selected 8/8 packet(s)
- Scout: configured; status fallback_deterministic; model reviewer_scout
- Scout lenses: provenance, verification-independence, environment-determinism, proof-soundness; rubric items checked 3
- Scout provider HTTP status: 502
- Scout provider error: <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]--> <head> <title>thomas.md | 502: Bad gateway</title> <meta charset="UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="I
- Strong review: required; status blocked_packet_input
- Residual risk: Triaged top 8 deterministically ranked packet(s); remaining changed hunks/files require Codex or human proof review, and selected packets still need strong reviewer analysis.
- Strong packet-review blocker: Selected packets require semantic review; see packet review outcomes for actual coverage.
- Covered packets:
- Compiler/SolidityImport/AbiSchema.lean:55 score 106 — theorem/public statement changed, public declaration/signature changed
- Verity/Core/Model/Denote.lean:1729 score 95 — theorem/public statement changed, public declaration/signature changed
- Contracts/SolidityImportSmoke/FixedBytesConstWhileSelectorSequenceModel.lean:1 score 80 — public declaration/signature changed, changed imports
- Contracts/SolidityImportSmoke/SelfDelegateCallSequenceModel.lean:1 score 77 — public declaration/signature changed, changed imports
- Contracts/SolidityImportSmoke/ValueCallSequenceModel.lean:1 score 77 — public declaration/signature changed, changed imports
- scripts/solidity_differential/check_self_delegate_call.py:1 score 74 — public declaration/signature changed, changed imports
- docs/TRUST_ASSUMPTIONS.md:2195 score 66 — trust-boundary docs drift
- Compiler/SolidityImport/TransportBarriers.lean:244 score 63 — public declaration/signature changed
Pilot mode: advisory only. Codex Review remains the merge gate.
| | .address => .address | ||
| | .bool => .bool | ||
| | .bytes32 => .bytes32 | ||
| | .enum _ => .uintN 8 |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [high]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: theorem/public statement changed, public declaration/signature changed; 58 changed line(s) near Compiler/SolidityImport/AbiSchema.lean:55. Signals: theorem/public statement changed, public declaration/signature changed.
Added-line sample:
- L55:
/-- The diagnostic for a user-defined type name ′ty′ that does not resolve to a struct - L56:
declaration: it names the field's actual type (an ′enum′, a user-defined value type or a - L57:
contract type, from solc's type descriptions) rather than reporting an unresolved struct. - L58:
Such fields need their own ABI semantics (an enum's range check, a value type's underlying - L59:
type) before admission. -/
| world | ||
| bindings := bindValue state.bindings resultVar (if observed.success then 1 else 0) | ||
| rawReturndata := Option.some observed.returndata | ||
| byteCallAccesses := state.byteCallAccesses ++ observed.touched }, observed.touched) |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [high]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: theorem/public statement changed, public declaration/signature changed; 89 changed line(s) near Verity/Core/Model/Denote.lean:1729. Signals: theorem/public statement changed, public declaration/signature changed.
Added-line sample:
- L1729:
/-- Inline-assembly ′call′ / ′staticcall′ / ′delegatecall′ over physical memory. The calldata is - L1730:
the ′[inOffset, inOffset + inSize)′ bytes and the gas is the call boundary's allowance. For - L1731:
′call′ and ′staticcall′, the request carries ′caller := thisAddress′ and ′value := 0′; for - L1732:
′delegatecall′, the EVM preserves the outer frame's ′CALLER′ (′state.world.sender′) and - L1733:
′CALLVALUE′ (′state.world.msgValue′). As on the EVM, the first ′min(outSize, returndatasize)′
| | _ => | ||
| Compiler.CompilationModel.SolidityImport.SequenceRunner.run | ||
| SolidityImportSmoke.FixedBytesConstWhileSelectorSequenceModel.model | ||
| SolidityImportSmoke.FixedBytesConstWhileSelectorSequenceModel.oracle args |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: public declaration/signature changed, changed imports; 90 changed line(s) near Contracts/SolidityImportSmoke/FixedBytesConstWhileSelectorSequenceModel.lean:1. Signals: public declaration/signature changed, changed imports.
Added-line sample:
- L1:
import Compiler.SolidityImport.Import - L2:
import Compiler.SolidityImport.Differential - L3:
import Compiler.SolidityImport.SequenceRunner - L4:
import Compiler.CompilationModel - L5:
import Compiler.Codegen
| SolidityImportSmoke.SelfDelegateCallSequenceModel.oracle args | ||
| (configure := Compiler.CompilationModel.SolidityImport.ModelResponders.configureSelfDelegate | ||
| SolidityImportSmoke.SelfDelegateCallSequenceModel.oracle | ||
| SolidityImportSmoke.SelfDelegateCallSequenceModel.model) |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: public declaration/signature changed, changed imports; 39 changed line(s) near Contracts/SolidityImportSmoke/SelfDelegateCallSequenceModel.lean:1. Signals: public declaration/signature changed, changed imports.
Added-line sample:
- L1:
import Compiler.SolidityImport.Import - L2:
import Compiler.SolidityImport.Differential - L3:
import Compiler.SolidityImport.SequenceRunner - L4:
import Compiler.SolidityImport.ModelResponders - L5:
import Compiler.CompilationModel
| Compiler.CompilationModel.SolidityImport.SequenceRunner.run | ||
| SolidityImportSmoke.ValueCallSequenceModel.model | ||
| SolidityImportSmoke.ValueCallSequenceModel.oracle args | ||
| (configure := Compiler.CompilationModel.SolidityImport.CallResponderMocks.configure) |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: public declaration/signature changed, changed imports; 39 changed line(s) near Contracts/SolidityImportSmoke/ValueCallSequenceModel.lean:1. Signals: public declaration/signature changed, changed imports.
Added-line sample:
- L1:
import Compiler.SolidityImport.Import - L2:
import Compiler.SolidityImport.Differential - L3:
import Compiler.SolidityImport.SequenceRunner - L4:
import Compiler.SolidityImport.CallResponderMocks - L5:
import Compiler.CompilationModel
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(main()) |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: public declaration/signature changed, changed imports; 200 changed line(s) near scripts/solidity_differential/check_self_delegate_call.py:1. Signals: public declaration/signature changed, changed imports.
Added-line sample:
- L1:
"""Imported self-dispatch ′address(this).delegatecall(...)′ through source EVM, Denote and compiled model. - L2:
(empty) - L3:
The fixture runs ′multicall(bytes[])′ and ′selfDispatchSingle(bytes)′ against its own - L4:
external entry points (′addAmount(uint256)′ and ′failEmpty()′). Route B configures - L5:
′imported-model-self-delegate-v1′ so Denote replays the imported model's own functions in
| controls for external targets, `{gas: ...}`, post-loop writes, and `payable` callers, and | ||
| the A/B/C differential campaign `check_self_delegate_call` (`SelfDelegateCallSequence` | ||
| against `imported-model-self-delegate-v1`). | ||
|
|
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: trust-boundary docs drift; 85 changed line(s) near docs/TRUST_ASSUMPTIONS.md:2195. Signals: trust-boundary docs drift.
Added-line sample:
- L2195:
### Imported external ′try′ with a return value or a revert-data catch clause - L2196:
(empty) - L2197:
′solidity_import′ also admits ′try I(a).f(args...) returns (T v) { A } catch { B }′ for an - L2198:
interface function with one return value ′T′ among ′uint*′, ′int256′, ′bool′, ′address′, - L2199:
contract types, ′bytes1′, ′bytes4′ and ′bytes32′ (as a ′staticcall′ when ′f′ is ′view′ or
| (Compiler.CompilationModel.stmtListCEIViolation body false).isSome && | ||
| onlyTrailingCallReentrancyWindows body && | ||
| (Compiler.CompilationModel.stmtListCEIViolation (body.map eraseClosedSelfDelegateCalls) false).isNone | ||
|
|
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [medium]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: public declaration/signature changed; 87 changed line(s) near Compiler/SolidityImport/TransportBarriers.lean:244. Signals: public declaration/signature changed.
Added-line sample:
- L244:
local bindings, memory writes (including copies of the call's return data), checks, - L245:
returns, memory reverts, reverts (including panics of checked arithmetic and forwarding - L246:
the call's return data) and further closed low-level calls, none of which reads or writes - L247:
storage or logs. (A second CALL after the first still fails the separate CEI check, since - L248:
the first CALL is not erased.) A code-hash read is not admitted: the call can change the
Summary
try/catch(#2703,#2700,#2841partial):YulMemoryValueCalltransport (Verity/Core/Model/ECM.lean,Verity/Core/Model/Denote.lean) for(bool ok, bytes memory ret) = target.call{value: v}(data);with balance debit/refund andextract_returndata.catch (bytes memory reason)on external interfacetrycalls, plusrevert(add(b, 32), mload(b))overbytes memorylocals.enum/ UDVT /contract) for unsupported struct fields inAbiSchema.lean.while,bytes4selectors, & raw-slotbytes:YulMemoryDelegateCalltransport (Verity/Core/Model/ECM.lean,Verity/Core/Model/Denote.lean) foraddress(this).delegatecall(data).bytes16, etc.), generalwhileloop conditions (division, bit-shift, linear),bytes4selector expressions, and raw-slotbytes/stringstruct members.whilehelpers, dynamic selector ABI encoding, named external/tryargs, &Struct[]enum ABI:uint256bounds, non-zero starts, multi-return/void helpers, and unchecked body increments in helperfor-loop early returns.whileconditions and unchecked prefix/postfix++/--steps insidewhilebodies.abi.encodeWithSelector/abi.encodeWithSignaturewith dynamicbytes/string/array arguments (exact Solidity ABI head/tail layout).trycalls with parameter reordering and competing-panic evaluation-order guard.new bytes(0)/new string(0)empty allocations andenumfields insideStruct[]ABI schemas (SolidityAbi.lean,AbiSchema.lean,AbiLowering.lean).Scope
feat/solidity-import-storage-layout-loops-and-staticcalls(#2941).ValueCall*,TryCatch*,StructFieldTypeSurvey*,FixedBytesConstWhileSelectorSequence*,SelfDelegateAndRawSlotEip712Checks*,HelperLoopAndWhileExt*,DynamicSelectorNamedTryEnumArray*).docs/TRUST_ASSUMPTIONS.mdanddocs/SOLIDITY_IMPORT.md.Verification Receipts (Head
4b617dd03bb643e47d592450ca3e70969a5cf981)lake buildofVerity.Core.Model.{ECM,Denote},Compiler.SolidityImport.{SolidityAbi,AbiSchema,AbiLowering,Coverage,Quote,StorageLayout,TransactionAccess,TransportBarriers,TypesAndRecords,Import}, and all 8 smoke suites (CollectUnsupportedSurveyChecks,StructFieldTypeSurveyChecks,TryCatchChecks,ValueCallChecks,FixedBytesConstWhileSelectorSequenceModel,SelfDelegateAndRawSlotEip712Checks,HelperLoopAndWhileExtChecks,DynamicSelectorNamedTryEnumArrayChecks): PASS (0 sorry/0 axiom/0 native_decidein diff).python3 scripts/check_proof_length.py: PASS (0 proofs over 50 lines).make check(all lints, axioms, trust-surface registry, docs sync, macro health, storage layout, andpython3 -m unittest discover -s scripts -p 'test_*.py'): PASS (1025 tests OK).python3 scripts/check_importer_name_selection.py: PASS (48 importer files).