Repository navigation
Conversation
…st-value-call state/logs Two small soundness-preserving extensions to the Solidity importer: 1. Full-word unmasked hashed transient offset (`ExprHelpers.lean` `hashedSlotNames?`): Admit `add(B, i)` (either operand order) for a full-word (`uint256`/`bytes32`) local `i` alongside `B`, `add(B, k)` and `add(B, and(i, M))`. Because `B`, `i` and `v` are full 256-bit words (no narrow sub-word high bits where legacy and via-IR diverge) and transient state variables share the same `transientStorage` map with normalized `bool` loads, legacy, via-IR, Denote and compiled Yul agree bit-for-bit even on exact wrap-around `i = 2^256 - B` onto slot 0 (verified in `TransientStructuredAssemblyChecks` and live Anvil 3-route A/B/C in `check_transient_structured_assembly.py`). Narrow indices (`uint8`) stay strictly rejected. 2. Post-value-call storage access & logs (`TransportBarriers.lean` `eraseClosedInteractions`): Introduce `isClosedCallTransport` (`isClosedValueFreeLowLevelCall || yulMemoryValueCall`, keeping `YulMemoryDelegateCall` strictly trailing-only) so `onlyClosedCallStateWindows` admits storage reads, storage writes and logs after a closed `YulMemoryValueCall`. `executeByteYulMemoryValueCall` already runs against the unconstrained reentrant adversary with value debit/refund, so post-call state and logs execute against the exact world committed by the callee (verified in `PostCallStateAccessChecks`, `ValueCallChecks`, and live Anvil 3-route A/B/C in `check_yul_memory_call.py --variant value`).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
OpenCodeReview first-pass review
🟡 Scout triage + 0/4 paquet(s) reviewés sémantiquement. 8 finding(s) (1 high / 7 low); les hunks hors paquets restent à couvrir par un humain ou Codex.
Paquets non couverts par la review sémantique
- Compiler/SolidityImport/TransportBarriers.lean — error (Command failed: ocr review --from 8bd5dc8 --to 212fb59 --format json --audience agent --rule /home/ubuntu/actions-runner-verity-ocr/_work/_temp/ocr-tools/rules.json --concurr)
- Compiler/SolidityImport/ExprHelpers.lean — error (Command failed: ocr review --from 8bd5dc8 --to 212fb59 --format json --audience agent --rule /home/ubuntu/actions-runner-verity-ocr/_work/_temp/ocr-tools/rules.json --concurr)
- Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean — error (Command failed: ocr review --from 8bd5dc8 --to 212fb59 --format json --audience agent --rule /home/ubuntu/actions-runner-verity-ocr/_work/_temp/ocr-tools/rules.json --concurr)
- Contracts/SolidityImportSmoke/PostCallStateAccessChecks.lean — error (Command failed: ocr review --from 8bd5dc8 --to 212fb59 --format json --audience agent --rule /home/ubuntu/actions-runner-verity-ocr/_work/_temp/ocr-tools/rules.json --concurr)
📝 1 groupe(s) de paquets au-delà du budget n'ont eu que le triage scout.
Large Lean diff routed to bounded packet review: 7 Lean file(s), 167 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: 13 supported / 13 total; Lean 7, trust docs 0, workflow/scripts 3, contracts 2, docs 1
- Changed lines: 167 supported; thresholds large Lean >=3 files or >800 lines
- OCR: status scout_triage; comments 8; files 5; tokens 0; tool calls 0; warnings 1; duration 235s
- Largest changed files: Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean (+27/-25), Compiler/SolidityImport/TransportBarriers.lean (+20/-13), Compiler/SolidityImport/ExprHelpers.lean (+13/-8), docs/SOLIDITY_IMPORT.md (+6/-7), Contracts/SolidityImportSmoke/PostCallStateAccessChecks.lean (+11/-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/TransportBarriers.lean:50 score 104 — theorem/public statement changed, public declaration/signature changed
- Compiler/SolidityImport/TransportBarriers.lean:394 score 26 — hotspot path/churn
- Compiler/SolidityImport/ExprHelpers.lean:1584 score 25 — hotspot path/churn
- Compiler/SolidityImport/ExprHelpers.lean:2042 score 25 — hotspot path/churn
- Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean:144 score 14 — hotspot path/churn
- Contracts/SolidityImportSmoke/PostCallStateAccessChecks.lean:268 score 12 — hotspot path/churn
- Contracts/SolidityImportSmoke/ValueCallChecks.lean:126 score 12 — hotspot path/churn
- Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean:40 score 12 — hotspot path/churn
Pilot mode: advisory only. Codex Review remains the merge gate.
| /-- The closed optional-bool low-level call transport emitted by the importer. -/ | ||
| def isClosedLowLevelCall (mod : Compiler.ECM.ExternalCallModule) : Bool := | ||
| isClosedCallTransport mod || | ||
| match mod.byteTransport with |
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; 11 changed line(s) near Compiler/SolidityImport/TransportBarriers.lean:50. Signals: theorem/public statement changed, public declaration/signature changed.
Added-line sample:
- L50:
/-- Closed ′CALL′ transports (value-free or value-bearing) emitted by the importer - L51:
(excludes ′YulMemoryDelegateCall′, which stays trailing-only). -/ - L52:
def isClosedCallTransport (mod : Compiler.ECM.ExternalCallModule) : Bool := - L56:
| _ => false - L57:
(empty)
| (`ByteExternalCall.Response.commit`, with value debit/refund for `YulMemoryValueCall`), which | ||
| an unconstrained adversary chooses freely, including by re-entering this contract, so admission | ||
| assumes nothing about the callee. Any interaction that is not a closed `CALL` transport | ||
| (including `YulMemoryDelegateCall`) keeps the body out. -/ |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 22 changed line(s) near Compiler/SolidityImport/TransportBarriers.lean:394. Signals: hotspot path/churn.
Added-line sample:
- L394:
/-- ′eraseClosedTransports′, and additionally replace each closed ′CALL′ transport - L395:
(value-free or value-bearing ′YulMemoryValueCall′) by its zero-initialised result binding. - L396:
′YulMemoryDelegateCall′ stays unerased so self-delegatecall remains trailing-only. What remains - L397:
after erasure is every interaction not admitted for post-CALL state access. -/ - L400:
if isClosedCallTransport mod then .letVar (mod.resultVars.headD "") (.literal 0)
| sub-word high bits where legacy and via-IR diverge) and transient state variables share the same | ||
| `transientStorage` map with normalized `bool` loads, legacy, via-IR, Denote and compiled Yul | ||
| agree bit-for-bit even if `B + i` wraps modulo `2^256`. A narrow index local stays out because | ||
| it can carry high bits legacy does not clean. -/ |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 13 changed line(s) near Compiler/SolidityImport/ExprHelpers.lean:1584. Signals: hotspot path/churn.
Added-line sample:
- L1584:
reassigned), ′add(B, k)′ with a literal ′k′ and ′B + k < 2^256′, ′add(B, i)′ with a full-word - L1585:
(′uint256′ or ′bytes32′) local ′i′, or ′add(B, and(i, M))′ with a full-word local ′i′, a literal - L1586:
mask ′M < 2^128′ and ′B + M < 2^256′. Because ′B′, ′i′ and ′v′ are full 256-bit words (no narrow - L1587:
sub-word high bits where legacy and via-IR diverge) and transient state variables share the same - L1588:
′transientStorage′ map with normalized ′bool′ loads, legacy, via-IR, Denote and compiled Yul
| if let some i := yulIdentName? off then | ||
| guard ((localRef? refs i).any fun d => | ||
| declTypeStr d == "uint256" || declTypeStr d == "bytes32") | ||
| return [bName, i] |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 8 changed line(s) near Compiler/SolidityImport/ExprHelpers.lean:2042. Signals: hotspot path/churn.
Added-line sample:
- L2042:
/-- The names a hashed transient slot operand uses, when it is ′B′, ′add(B, k)′, ′add(B, i)′ - L2043:
for a full-word (′uint256′/′bytes32′) local ′i′, or ′add(B, and(i, M))′ (either argument order). -/ - L2057:
if let some i := yulIdentName? off then - L2058:
guard ((localRef? refs i).any fun d => - L2059:
declTypeStr d == "uint256" || declTypeStr d == "bytes32")
| -- A narrow `value` operand may carry dirty high bits on the legacy pipeline. | ||
| /-- | ||
| error: TransientStructuredAssemblySequence.sol:272:9: InlineAssembly: [solidity-import:unsupported] inline assembly in a closure that accesses transient state variable _locked is unsupported | ||
| error: TransientStructuredAssemblySequence.sol:273:9: InlineAssembly: [solidity-import:unsupported] inline assembly in a closure that accesses transient state variable _locked is unsupported |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 50 changed line(s) near Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean:144. Signals: hotspot path/churn.
Added-line sample:
- L144:
#guard (Compiler.CompilationModel.compile ir.model [1, 2, 3, 4, 5, 6, 7, 8, 9] .cancun).isOk - L145:
#guard (Compiler.CompilationModel.compile legacy.model [1, 2, 3, 4, 5, 6, 7, 8, 9] .cancun).isOk - L147:
-- Unmasked full-word index ′add(B, index)′: both normal slots and exact wrap-around to slot 0 - L148:
-- (′index = 2^256 - queueBase′, writing non-0/1 word ′2′ into ′_locked′'s slot) agree in both pipelines. - L149:
private def unmaskedWrapIndex : Nat := 2 ^ 256 - queueBase
| #guard onlyClosedCallStateWindows [write, closedCall, write, .emit "Notified" [.literal 1]] | ||
| #guard onlyClosedCallStateWindows [closedValueCall, write, .emit "Notified" [.literal 1]] | ||
| #guard onlyClosedCallStateWindows [closedCall, closedValueCall, .emit "Notified" [.literal 1]] | ||
| #guard !onlyClosedCallStateWindows [closedDelegateCall, write] |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 11 changed line(s) near Contracts/SolidityImportSmoke/PostCallStateAccessChecks.lean:268. Signals: hotspot path/churn.
Added-line sample:
- L268:
private def closedValueCall : Stmt := - L269:
.ecm (Compiler.ECM.YulMemoryValueCall.module "ok") - L270:
[.param "target", .param "amount", .literal 0, .literal 0, .literal 0, .literal 0] - L271:
(empty) - L272:
private def closedDelegateCall : Stmt :=
| | _ :: rest => valueCalls rest | ||
|
|
||
| #guard ["execute", "sendValue", "forward", "probe", "sendViaHelper"].all fun name => | ||
| #guard ["execute", "sendValue", "forward", "probe", "sendViaHelper", "sendValueAndLog"].all fun name => |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 7 changed line(s) near Contracts/SolidityImportSmoke/ValueCallChecks.lean:126. Signals: hotspot path/churn.
Added-line sample:
- L126:
-- Post-value-call storage update and log succeed on funded calls and roll back on failure. - L127:
#guard observe "sendValueAndLog" [echo, 7] == some (true, [], 993, 7, 7, 0) - L128:
#guard observe "sendValueAndLog" [failing, 7] == some (false, failedCall, 1000, 0, 0, 0) - L129:
#guard observe "sendValueAndLog" [echo, 2000] == some (false, failedCall, 1000, 0, 0, 0) - L130:
(empty)
| function queueAt(uint256) | ||
| function queueRevert(uint256) | ||
| function state() | ||
| function unmaskedWriteAndRead(uint256,uint256) |
There was a problem hiding this comment.
🟡 OCR scout — question de triage (non-review) [low]
Question de couverture pour le reviewer humain/Codex — pas une review sémantique finale ni une approbation.
Why flagged: hotspot path/churn; 2 changed line(s) near Contracts/SolidityImportSmoke/TransientStructuredAssemblyChecks.lean:40. Signals: hotspot path/churn.
Added-line sample:
- L40:
function unmaskedWriteAndRead(uint256,uint256) - L54:
function unmaskedWriteAndRead(uint256,uint256)
| \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``` |
Summary
Two small, soundness-preserving extensions to the Solidity importer:
Full-word unmasked hashed transient offset (
Compiler/SolidityImport/ExprHelpers.leanhashedSlotNames?):add(B, i)(either operand order) for a full-word (uint256/bytes32) localialongsideB,add(B, k), andadd(B, and(i, M)).B,i, andvare full 256-bit words (no narrow sub-word dirty bits where legacy and via-IR diverge) and transient state variables share the exact sametransientStoragemap with normalizedboolloads, legacy, via-IR, Denote, and compiled Yul agree bit-for-bit even on exact wrap-aroundi = 2^256 - Bwriting non-0/1 word2into slot0.uint8), low bases (< 2^128), reassigned bases, arbitrarytload(0), multi-statement blocks, scratch calls,delegatecall, and narrow value calls remain strictly rejected.Post-value-call storage access & logs (
Compiler/SolidityImport/TransportBarriers.leaneraseClosedInteractions):isClosedCallTransport(isClosedValueFreeLowLevelCall || yulMemoryValueCall, keepingYulMemoryDelegateCallstrictly trailing-only) soonlyClosedCallStateWindowsadmits storage reads, storage writes, and logs after a closedYulMemoryValueCall.executeByteYulMemoryValueCallalready executes against the unconstrained reentrant adversary with value debit/refund, so subsequent state access and logs run on the exact world committed by the callee.check_memory_call_mutations.pytarget line accordingly.Local Verification
lake build(131 jobs) onExprHelpers,TransportBarriers,Import,TransientStructuredAssemblyChecks,TransientStructuredAssemblySequenceModel,ValueCallChecks,ValueCallSequenceModel,PostCallStateAccessChecks,SelfDelegateAndRawSlotEip712Checks: PASSlake env leancheckeron all 6 modified/smoke modules: exit 0python3 -m solidity_differential.check_transient_structured_assembly: 96/96 Anvil 3-route A/B/C PASS (including wrap-aroundi = 2^256 - QUEUE_BASE, key = 2)python3 -m solidity_differential.check_yul_memory_call --variant value: Anvil 3-route A/B/C PASS (including post-value-call storage write & logsendValueAndLog)python3 -m unittest scripts/test_solidity_differential.py: 18/18 OKscripts/check_importer_name_selection.py& fullscripts/lean_lint.py: PASS