solc 0.8.35 accepts `((new bytes))(4)` — grouping parens around a `new`
expression (Solidity has no 1-tuples) — and runs it as `new bytes(4)`, so
`run()` returns 4. The solc-AST importer failed closed with `unsupported
expression node 'NewExpression'`: the FunctionCall dispatch matched a
NewExpression callee only when it was the DIRECT `expression`, but a
parenthesized callee arrives wrapped in single-element TupleExpression grouping
nodes. It missed the newExpr branch and fell through to the generic Expr.call,
whose tuple collapse re-exposed a bare NewExpression (unsupported as an ordinary
expression).
Peel single-element grouping tuples off the callee before dispatching, so
`((new bytes))(4)` lowers to exactly the same `Expr.newExpr (Ty.bytes) [4]` as
bare `new bytes(4)`. Witness ParenNewBytesLength pins the target: the contract
is accepted and `run()` returns 4.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
A contract declaring a bare fixed-point state var (`ufixed y;` / `fixed y;`) is
accepted by solc 0.8.35 and runs to success, but the solc-AST importer failed
closed with `unsupported Solidity elementary type 'ufixed'`. solc emits the bare
alias name verbatim on the elementary-type node (its typeString is the canonical
`ufixed128x18`), and `type_from_name` only matched the explicit `ufixed<M>x<N>`
form, not the bare alias.
Map bare `ufixed` -> `Ty.ufixed 128 18` and bare `fixed` -> `Ty.fixed 128 18`
(the language-defined aliases). The Lean semantics already model these state
vars (cf. FixedPointBoundary.sol's `ufixed128x18 private plain;`); only the
importer spelling was unmapped. Witness FixedBareStateUfixed pins the target: the
contract is accepted and `run()` returns 1.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Measured on the 14-core review machine (2026-07-22):
- scripts/fast_inner_gate.sh (NEW): inner-loop build target for fix
iteration — semantic spine (Interpreter/ABI/Interface/TypeCheck/Checked)
+ cross-cutting law proofs (FuelMonotonicity/AdoptionLaws/Interaction)
+ the repro witness passed as arg. 381s vs >=1587s per iteration
head-to-head on the same Interface.lean delta. NOT a green-gate
substitute: the full lake build (all 87 witnesses) still runs once on
the final candidate. Lean checks every compiled module's proofs, so no
soundness is lost on intermediate iterations.
- contest/run_samples.py: the ~85 gate checks now run through a
ThreadPoolExecutor (CONTEST_SAMPLES_JOBS, default 8; =1 restores exact
serial behavior). Each check wraps its ORIGINAL call expression verbatim
in a thunk — per-item behavior unchanged, only scheduling. The two
run_simulated checks monkeypatch hb.run_solidity_lean_observable and
run strictly after the pool drains. Summary order preserved
(registration order). Exceptions in a check FAIL that check.
- contest/fingerprint.py: source_ast_hash's chdir window is now under a
module lock. os.chdir is process-wide; concurrent derivations corrupted
each other's cwd, silently degrading full-mode fingerprints to
parse-mode (observed: registry-invariant + dedup checks failing under
jobs=8, passing serial). Validated: parallel==serial across repeated
runs; 4 real concurrent adjudications 59s wall, correct verdicts.
- scripts/compare_forge_solc_interpreter.sh: --jobs ${JOBS:-10}
--timeout ${TIMEOUT:-600} defaults (cases are subprocess-isolated; OZ
lanes run ~290s and trip the old 300s default under contention).
Explicit args still win (argparse last-occurrence).
An internal function that returns an internal function pointer which is
immediately called — `pick(true)(x)` — failed closed at three points on an
in-scope, solc-accepted program:
1. Importer: solc annotates the callee expression of a call with
`argumentTypes` for every callee node shape. The `FunctionCall` callee case
(a returned pointer directly invoked) left
`FunctionCall.argumentTypes.typeIdentifier` / `.typeString` UNCLASSIFIED, so
the frontend fail-closed. Classify them as analysis metadata, consistent
with the already-classified `Identifier`/`MemberAccess`/`IndexAccess`/
`TupleExpression`/… callee shapes.
2. `abiTyWithInternalFunctionsEnv?`: the non-identifier-callee call arm typed
the callee via `abiTyWithEnv?`, which cannot resolve an internal call, so a
call-valued callee (`pick(true)`) had no inferred type. Use the
internal-functions variant so the returned pointer's return type resolves.
3. Executable lowering: the `Expr.call callee args` arm only handled a callee
the pure read lowering could evaluate. Factor `ptrBoundaryCallExprParts?`
into a core-taking `ptrBoundaryCallCoreParts?` and add a fallback that
hoists a call-valued callee into a temp fn-ptr (via the existing
single-return machinery) and dispatches through it — the same boundary as
`arr[i](x)`, `(c ? a : b)(x)`, and `s.fp(x)`.
Ground truth solc 0.8.35 + EVM for `run(3)`: `dbl(3) + trp(3) = 6 + 9 = 15`.
Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
An in-scope, solc-accepted program that calls directly through a ternary
selecting between two internal functions — `(tick() ? a1 : a2)(x)` — failed
closed twice:
* the solc-AST importer left `TupleExpression.argumentTypes.typeIdentifier`
/ `.typeString` UNCLASSIFIED. solc annotates the parenthesized callee node
with `argumentTypes` (the call's argument types) exactly as for the
Identifier/IndexAccess/MemberAccess/... callee shapes, but TupleExpression
was omitted, so import rejected before producing any AST; and
* the executable lowering could not lower a call whose callee is a ternary
with a side-effecting condition and function-identifier branches: routing it
as a call THROUGH the ternary as a function pointer cannot recover the
pointer type once the identifiers become dispatch-ID literals.
Fix: classify the two TupleExpression.argumentTypes fields as analysis fields
(purely additive), and DISTRIBUTE a call over a ternary callee
(`(c ? a : b)(args)` -> `c ? a(args) : b(args)`) in `FunctionDecl.toCore?`
before the fn-value dispatch-ID rewrite, so the branch functions stay
name-resolved direct calls handled by the existing internal-call ternary
lowering. solc evaluates the callee (hence `c`) first, then args, then the
selected function; distribution preserves that order and single-evaluation.
Real solc 0.8.35 + EVM ground truth for run(3): r1=a1(3)=4, r2=a2(3)=6, t=2,
returns 4*10000 + 6*100 + 2 = 40602 (0x9e9a), final storage t=2 — reproduced
end-to-end (importer -> checker -> interpreter) and pinned by the
FnPtrTernaryCall witness.
Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
An in-scope, solc-accepted program that calls through an element of a fixed
array of internal function pointers failed closed on this engine — first at
import, then (once import was fixed) in the executable lowering.
Two responsible gaps closed:
1. Importer (scripts/solc_ast_to_lean_source.py): the callee-context
`argumentTypes.typeIdentifier` / `.typeString` scalar fields were classified
as analysis metadata for every callee node shape EXCEPT `IndexAccess`. solc
emits these on an `IndexAccess` when it is the callee of a call (an element of
a function-pointer array), so the coverage self-check fail-closed on an
in-scope program. Added the two `IndexAccess` entries to ANALYSIS_SCALAR_FIELDS.
2. Executable lowering (SolidCore/Solidity/Interface.lean): every internal call
was keyed on a callee NAME, so a call through a non-identifier
function-pointer expression (an array element) was declined even though the
interpreter already supports `Stmt.internalCallPtr` with an arbitrary fn
expression. Generalized `ptrBoundaryCallParts?` to
`ptrBoundaryCallExprParts?` (callee expression + return prefix), taught
`Expr.abiTyWithInternalFunctionsEnv?` to type a call through a non-identifier
internal-fn-pointer callee, and added the non-identifier callee case to
`internalExprSingleReturnUseCore?` plus a narrow `return arr[i](x)` arm.
Non-pointer callees still decline to `none` (over-reject preserved).
Ground truth (solc 0.8.35 + EVM) for the reported program run(3) = 604 (0x25c):
arr[1](3)=a2(3)=6, arr[0](3)=a1(3)=4, 6*100+4=604.
Regression: SolidCore/Witness/FnPtrArrayIndexCall.lean (#guard run(3)=604,
run(5)=1006, run(0)=1). Full `lake build` (all proofs) green; smoke replay
(29 cases) paired_cases_passed=yes.
Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Two related fixes in abi.decode handling, matched to pinned solc 0.8.35.
FIX A (over-reject, replay-reachable): solc forces every top-level decoded
`address` component of abi.decode's result to `address payable`
(TypeChecker.cpp:150-152, typeCheckABIDecodeAndRetrieveReturnType). The model
returned plain `address`, so `address payable p = abi.decode(data,(address))`
and `.transfer`/`.send` on a decoded address over-rejected. Coerce each
top-level `Ty.address false` result component to `Ty.address true` in the
typechecker (TypeCheck.checkExpr abi.decode call site) and in the lowering
type oracle (Interface.Expr.abiTy?). The coercion is top-level only — addresses
nested inside a decoded array/struct are NOT rewritten (solc rejects
`abi.decode(data,(address[]))[0].transfer(1)` and a decoded struct address
member; both re-probed against the pinned binary).
FIX B (over-accept): the second argument to abi.decode must be a TUPLE of types
(TypeChecker.cpp:127-136, error 6444); bare `abi.decode(data, uint)` is rejected
while `(uint)` is accepted. The importer collapsed single-element tuples, making
`(uint)` and bare `uint` both `Expr.typeName` and indistinguishable. Preserve
the tuple wrapper for abi.decode's type argument in the importer, then reject
the bare `Expr.typeName` branch in checkAbiDecodeTypesExpr and
Expr.abiDecodeSourceTypes?. Only the parenthesized shape now accepts.
Gate: full `lake build` (1107 jobs) green. New sanctioned replay lane
abi-decode-address-payable (forge=ok, lean=ok, compare=pass). Existing
single-type decode lanes (abi-malformed, abi-struct-tuples,
uniswap-transfer-helper) still pass after the importer change. Four acceptance
witnesses added (bare reject; (uint), (uint,bool), address-payable accept).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The type-name member arm over-rejected several forms of member access read
THROUGH a contract/interface/library qualifier rather than through a value.
solc accepts all of them (verified against the pinned 0.8.35 binary); the model
failed to typecheck/lower them and rejected the whole contract. Fix each:
1. Qualified CONSTANT (`Base.K`, `L.LK`): checkExpr resolves the constant/state
member type; a `.`-joined qualified `ConstantEnv` (built from every
contract/library in scope) inlines the value in `inlineConstants`.
2. Qualified ENUM VALUE (`Base.E.C`): the importer now collapses a nested
type-expression MemberAccess (`Base.E`, `t_type$…`) into a single
`Ty.user {Base, E}` path, so it matches the existing `member (typeName path)
case` enum-value resolution.
3. Qualified STATE VARIABLE (`Base.v`): checkExpr resolves the inherited storage
var (lvalue + state read); `toCore?`/`toCoreLValue?` lower it to the same
storage/immutable slot as the bare identifier.
4. Qualified SELECTORs (`I.IE.selector`, `L.g.selector`, `L.LE.selector`):
checkExpr falls back to the type name's error/external-function table when
external-function-value resolution declines; lowering already resolved these.
5. Library-qualified error in a revert (`revert L.LE(9)`): checkExpr resolves the
error against the library's table, and library errors are added to the
CoreContract runtime error table so the selector + args encode soundly
(reverses the earlier conservative decline; the selector is scope-independent).
Adds the sanctioned replay lane `qualified-member` (own-call fixture + forge
ground truth; all 8 real-EVM values confirmed) and manifest entry. Full
`lake build` (1107 jobs) green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- evmyul pin 3c5c44a6 -> b08573c: the package now provides the pure total
Keccak-256 sponge as the Lean body of ffi.keccak256 (@[extern]-accelerated).
SolidCore/Solidity/Keccak.lean becomes pure re-exports (names unchanged);
the repo-owned implementation is deleted — source semantics and EVM/Yul
target semantics now share ONE keccak definition, so lowering seams need no
keccak-equality hypothesis. keccakParity retained as native-vs-Lean-body
witness (11 cases OK).
- Interaction.lean bridge imports move to EvmInteraction.Simulation.* (the
evm-interaction package's new module paths; namespaces unchanged).
- check_shared_interaction_hashes.py repurposed: byte-identity between two
live copies -> single-source assertion (evm-compiler stubs re-export the
package; real sources only in evm-interaction).
Verified: lake build green (1107 jobs); keccakParity OK; AST audit
rendered_sources=182 render_failures=0; FULL REPLAY GREEN:
forge_interpreter_compare=pass status=0 cases=189 paired_cases_passed=yes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dy3P966aQiG3jen2yKuNeu
A plain "..." string literal whose bytes are not valid UTF-8 (e.g.
"\xff\x00\x41") makes solc omit the AST `value` field and keep only
`hexValue`. The importer's `kind == "string"` branch fail()ed on the
missing value, excluding solc-ACCEPTED programs from the corpus.
Fall back to `hexValue` and lower as Literal.hexString (identical to the
sibling hexString branch). This matches solc's boundary exactly: such a
literal has type literal_string hex"..." — converts to bytes (ACCEPT in
both bytes(...) and bytes memory = contexts) but not to string (REJECT).
Literal.hexString.abiTy? = Ty.bytes reproduces this in Lean; no Lean
change needed. New path triggers only when `value` is absent, so no
existing fixture's import changes.
New lane nonutf8-string-literal pins length/bytes/keccak in both bytes
contexts plus invalid/StringNonUtf8.sol for the string-context reject.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 27450d881a63bc855e6e382c86c849d76caa5726)
`scripts/solc_ast_to_lean_source.py` built every Lean string literal with
`json.dumps(value)` (default `ensure_ascii=True`), which encodes a non-BMP
code point (e.g. U+1F600 GRINNING FACE) as a UTF-16 SURROGATE PAIR in the
generated `.lean` source. Lean 4 does not recombine surrogate escapes, so
`bytes(unicode"😀")` decoded to [0,0] (2 null bytes) instead of solc's
[240,159,152,128] (4 UTF-8 bytes), and `bytes2(unicode"😀")` spuriously
over-accepted (2 <= 2) while solc rejects (4 > 2).
Fix (importer only; no Lean semantics changed):
- `lean_string`: `json.dumps(value, ensure_ascii=False)` emits real Unicode
characters (Lean reads source as UTF-8) while still escaping
quotes/backslashes/control chars, so ASCII/BMP/2-3-byte literals import
unchanged.
- `main`: force `sys.stdout.reconfigure(encoding="utf-8")` so emitted
characters reach the harness regardless of process locale.
Verified: emoji round-trips to 4 bytes on both solc and the imported Lean
interpreter; 你 stays 3 bytes; ASCII unchanged. The now-correct 4-byte decode
makes the existing string->bytesN gate (`fixedBytesWordFromBytes?`,
`bytes.length <= size`) reject `bytes2(unicode"😀")` (checked via
`TypeCheck.checkExpr`), closing the over-accept.
New paired lane `unicode-nonbmp`: pure `unicode"😀"` + mixed `unicode"a你😀b"`
(byte length, individual UTF-8 bytes, keccak256(bytes(...))), plus a
`solc_rejects` fixture for `bytes2(unicode"😀")`. forge=ok lean=ok
forge_interpreter_compare=pass.
Full `lake build` green (1106 jobs). Importer output is byte-identical to
baseline for every ASCII-only fixture, so zero regressions from this shared
importer change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
solc 0.8.35 evaluates `new C{value, salt}(args)` as the {…} options in source
order FIRST, then the constructor argument LAST. solidity-lean diverged twice:
- DIV-CREATE-1 (try-create): Stmt.tryContractCreate sequenced args→value→salt
(args-first), disagreeing with solc and with the plain-create handler.
- DIV-CREATE-2 (plain-create): the lowering collapsed {value,salt} and
{salt,value} to an unordered pair and the handler evaluated right-to-left
(always salt→value→args), so {value,salt} came out value/salt swapped.
Fix (mirror of EO1): Expr.contractCreate and Stmt.tryContractCreate carry a
valueBeforeSalt : Bool threaded from lowering (like gasFirst for external
calls). Both handlers now evaluate the options in source order, then the args
last — the fixed top-level order imposed sequentially, each component's inner
children keeping the ambient child-eval order. The two handlers now agree with
each other and solc. FuelMonotonicity's tryContractCreate case updated to the
new options-first control flow (split on the option-eval, mirroring the EO1
tryExternalCall case).
New Forge-paired lane tests/forge-harness/create-order pins the observable:
value/salt/arg order-trace 123 for {value,salt} and 213 for {salt,value},
identically for plain `new` and `try new`. lake build green (1103 jobs incl
FuelMonotonicity + Witness); smoke replay green, no regressions; lane
forge=ok lean=ok compare=pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PK1 (over-reject, live differential edge) — solc accepts abi.encodePacked of a
nested STATIC array whose ultimate element is a static value type; reject only an
array whose base is a dynamically-sized array (typeSupportedByOldABIEncoder,
TypeChecker.cpp:55-68 / :2166-2174).
- TypeCheck.lean: Ty.isAbiEncodePackedArrayElementShape gains a Ty.array case
(accept iff inner dimension is static, recurse on element).
- Interpreter.lean: abiEncodePackedArrayElement? recurses into a fixedArray
element, padding each innermost value to a 32-byte word in-place.
Probe-confirmed: uint[2][3], uint[2][], uint[2][2][2] ACCEPT; uint[][3],
uint[2][][2], bytes[], string[] REJECT (9578).
CL1 (over-accept, importer-masked) — solc errors 1563 on a bare modifier-style
base-constructor call (constructor() Base {}, no arg list); Base() is fine
(ContractLevelChecker.cpp:366-382).
- Ast.lean: ModifierInvocation gains hasArgList : Bool := true.
- solc_ast_to_lean_source.py: emit hasArgList from solc arguments==null vs [].
- TypeCheck.lean: ModifierInvocation.check rejects a base-constructor modifier
with hasArgList=false.
Lanes: new manifest case packed-nested-static-array — Forge accept lane
(128-byte padded layout vs solc's abi.encodePacked) + solc-reject fixtures
(PackedDynamicInnerArray uint8[][3], BareModifierBaseConstructor) + solc_import
+ Lean typecheck/value witnesses. Harness: solc_rejects=ok forge=ok lean=ok
forge_interpreter_compare=pass. Smoke replay green (28/28, no regression).
docs: solc-implementation-divergences-3.md PK1/CL1 marked FIXED; DECISIONS.md
dated entries.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Since Solidity 0.8.19 `using {f as +} for T` binds an operator to a free
function; solc resolves `a + b` to a call of `f(a,b)` that runs with the
operator function's own checked/unchecked context. The importer dropped solc's
resolved operator reference and lowered the node to a builtin Expr.binary/unary,
so the interpreter applied the BUILTIN op on the raw underlying words — wrong
value AND wrongly accepted whenever the operator body differs from the builtin
(e.g. fixed-point `*` = (a*b)/1e18: applyInterest(500e18,0.1e18) was ~5e37, solc
is 550e18).
Fix (importer only): when a BinaryOperation/UnaryOperation carries solc's
non-null `function` FunctionDefinition id, render it as an ordinary call
`Expr.call (Expr.ident opFn) [a, b]` (unary `[a]`) instead of Expr.binary/unary.
The existing internal-call boundary (Stmt.internalCall) then resolves the free
function and resets checked:=true for the callee body, giving correct value,
per-body checked/unchecked semantics, bool comparison results, unary/binary `-`
disambiguation, and recursion. No trusted-Lean change needed.
- scripts/solc_ast_to_lean_source.py: collect_function_names_by_id (id->name),
user_defined_operator_name, and the two expr_from_node arms.
- New Forge-paired lane tests/forge-harness/udvt-operator-dispatch pinning
550e18, minus disambiguation, bool comparisons, and word-width checked/
unchecked-per-operator-body context.
Gates: lake build SolidCore green; smoke_replay 28/28 lean=ok compare=pass; new
lane + frontend-frontier forge=ok lean=ok. DECISIONS.md 2026-07-08 entry added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The interpreter core, surface AST, typechecker, and executable elaboration
already model tuple holes end-to-end (TupleItem.hole -> none slot ->
LValues.writeTuple). The only break was the solc-AST importer's coverage
AUDIT, not its renderer: a null entry in a TupleExpression.components list was
classified as an unclassified scalar field, hard-failing with
"unclassified Solidity AST scalar fields present: TupleExpression.components".
Fix: register ('TupleExpression', 'components') in SOURCE_SCALAR_FIELDS, exactly
mirroring the existing ('VariableDeclarationStatement', 'declarations') workaround
for declaration holes. One line; no Lean source changed.
Pinned by a new tuple-holes corpus lane: leading/middle/trailing holes in
assignment and declaration LHS with a side-effecting RHS (pokes++, proving the
held-out slot is still evaluated), the canonical value-carrying idiom
(bool ok, ) = t.call{value:1}("") observing the send debit, plus 3 solc_rejects
for the illegal forms (empty tuple target (,), hole+arity mismatches).
solc 0.8.35 boundary probed. Corpus: 102 cases, 445 lean_evals (+5),
314 solc_rejects (+3). Gates green: lake build SolidCore, smoke_replay (28),
--only tuple-holes, --only tuple-destructure --only low-level-call-options,
frontend audit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 200k default caps each #eval at ~50s of interpretation; construct-heavy OZ
lanes sat just under it pre-refactor and cross it after the function-boundary
refactor's ~1.7x elaboration overhead. The per-case wall-clock timeout remains
the perf gate.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The audit (5c26c24) corrected the gap registry's suspicion: A1 was recorded as
suspected unsoundness, but the NumberRat folder already folds in unbounded ℚ and
gates integer results on exact division (0 WRONG-VALUE divergences). The real
gap was OVER-REJECTION (completeness): NumberRat over Nat rejected any negative
fold (0-5, 3-10, 7/2*2-100 = -93) that solc accepts.
Engine (Interface.lean):
- NumberRat.num : Nat -> Int (den : Nat strictly positive; mk? canonicalizes
sign onto the numerator).
- NumberRat.sub is now total; BinaryOp.applyNumberRat? sub => some (lhs.sub rhs).
- div? routes the signed denominator through mk?; pow over Int handles negatives.
- New exactInt?; exactNat? = exactInt? filtered to >= 0 (bit/shift/mod and
unsigned targets still reject negatives).
- numberLiteralRat?/untypedNumberLiteralRat? gain a real unary-neg case; new
numberLiteralInt?.
- toCoreNumericLiteralAs? collapsed to one signed range test per target;
negatedNumberLiteralNat? and the split fit helpers removed.
- TypeCheck.fixedPointLiteralRaw? adjusted for the signed numerator.
Everything stays total (no partial).
Importer (solc_ast_to_lean_source.py): type_from_expression_node's array-length
in type-expression position gains the already-folded typeString/typeIdentifier
fallback the VariableDeclaration path already had.
Regression guard: new rational-constants corpus lane + SolidCore.Witness.
RationalConstants pin the three folds (-5/-7/-93), their acceptance into int256,
and that fractional-into-int and negative-into-unsigned still reject (no
over-correction into unsoundness).
Docs: docs/DECISIONS.md entry; ROADMAP gap registry marks the over-reject fixed
and records the audit found no unsoundness.
lake build SolidCore green; rational-constants lane green
(solc_rejects=ok forge=ok lean=ok); smoke_replay green (28 cases, no regression).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sub-step-1a changed the expression evaluator to return SolI but left two
constant-eval witnesses in Witness/Interface.lean matching Except.ok against it,
so `lake build SolidCore` was red at HEAD. The replay harness never builds
SolidCore.Witness.*, so the green replay hid the library break (a green replay is
not a green build). Wrap both scrutinees in SolI.foldExpr as the ...ByContext
adapters do (arms byte-identical; both still #eval to some true).
Harden scripts/smoke_replay.sh to `lake build SolidCore` first so this can't
recur. Add docs/phase5-propagation-plan.md (Fable-designed: control-flow model A
refined, 8 buildable stages, build-validated PoC) as the plan for the remaining
Stmt.eval -> Contract.call tree propagation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The harness ran the 98 cases sequentially on 1 of 14 cores; per case is ~4s of
fixed SolidCore olean loading plus a variable pure-Lean #eval (heavy contracts
run a minute+). Add an opt-in --jobs N flag (default 1 = byte-identical to the
original sequential loop, so the official full-replay gate command is unchanged):
cases run in a ThreadPoolExecutor with per-case stdout captured via a
thread-routing stdout proxy and replayed in manifest order.
(The first cut used contextlib.redirect_stdout, which swaps the process-global
sys.stdout and corrupts capture across threads — only 1 of 28 case lines
survived; a thread-local router fixes it. Verified --jobs 5 emits all cases in
manifest order with the correct pass summary; --jobs 1 output is byte-identical.)
smoke_replay.sh now passes --jobs 10 (override SMOKE_JOBS): sequential smoke 770s
-> parallel 272s (the floor is the single longest heavy case). Dropped the
redundant solmate-erc20 sentinel.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the expression evaluator to the shared interaction monad. The
...OrderFuel mutual block, the ...Order wrappers, and the evalReturn*Order family
now return SolI (Value × Runtime) instead of Except RevertData (Value × Runtime)
(Except.ok -> pure, Except.error e -> throw (SolidityFailure.revert e), via a
MonadLift (Except RevertData) SolI). The 2 live low-level-call sites now
emitLowLevelCall (a Query.external node) instead of resolveLowLevelCall. The
...ByContext boundary functions stay Except-returning and fold the SolI tree via
SolI.foldExpr fuel context (runFromContext against the replay-from-Context oracle),
fuel = orderFuel expr + 1.
Hardening from a Fable review of this increment (both dormant, fixed before
commit): callKindToLowLevel .callcode now maps to .callcode (not .call);
answerCall now matches the exact sent gas first (was none-first, which could
shadow a gas?=some row). Fuel bound verified safe (query count <= syntactic
lowLevelCall nodes <= orderFuel; .outOfFuel unreachable). Residue for sub-step-1b:
a third Stmt.eval external site and the 2 create sites still read the oracle.
Also add scripts/smoke_replay.sh: a curated ~29-case Lean-only (--skip-forge)
subset for the dev loop; the full replay remains the commit gate.
Full corpus replay green: forge_interpreter_compare=pass, cases=98,
paired_cases_passed=yes. Details in docs/DECISIONS.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the vestigial compiler-spine naming and start the target module tree.
- Three-sided rename SolidCore.Spine.L00_SourceSolidity -> SolidCore.Solidity:
6 Lean files, the manifest (1775 occurrences: imports, every eval expr,
every solc_import.namespace), and the 3 harness scripts' hardcoded
namespaces/imports. No collision with the existing SolidCore.Solidity.Source.*
runtime layer.
- Move the base modules to SolidCore/Solidity/{Interface,TypeCheck,Checked}.lean;
delete SolidCore/Spine/ and its stale READMEs; SolidCore.lean imports the
Solidity modules directly.
- Split the ~430-line surface AST (Literal/Expr/Stmt/FunctionDecl/SourceUnit/...)
out of Interface.lean into SolidCore/Solidity/Ast.lean at the clean
pre-`namespace Executable` boundary (zero forward refs). Interface.lean keeps
elaboration + the (Phase-4-doomed) observation layer and imports Ast.
Verified end-to-end on one case (generator+manifest+eval) before the full run.
Full corpus replay green: forge_interpreter_compare=pass, cases=98,
paired_cases_passed=yes; eval count unchanged (420). Decisions in docs/DECISIONS.md
(incl. deferring evaluator consolidation (3d) until after Phase 4, since most
old-evaluator call sites live in observe* walkers that Phase 4 deletes).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the sibling `evm-interaction` package (a verbatim, byte-identical extraction
of evm-compiler's EvmCompiler/Simulation/{Interaction,OpenWorld,Outcome}.lean) as
a Lake path dependency and program this repo against the real composition
alphabet from day one.
- lakefile: require «evm-interaction» from "../evm-interaction"; manifest updated
via `lake update` (path dep added; all other revs unchanged, Mathlib from cache).
- SolidCore/Solidity/Interaction.lean: bridge module importing the package and
aliasing Interaction/Query/Answer/OpenWorld/ForwardRel under
SolidCore.Solidity.Shared. Reachable from the SolidCore root so `lake build`
checks linkage; off the corpus build path so the corpus is unperturbed.
- scripts/check_shared_interaction_hashes.py: sha256-compares the sibling's three
Simulation files against ../evm-compiler's live sources read-only
(shared_interaction_hashes=pass). Guarantees drift-freedom; `skip`s (does not
fail) when the reference checkout is absent.
The closure separates cleanly — the three files import only the pinned evmyul
package + Mathlib, no other EvmCompiler.* module — so no in-repo vendoring was
needed. Full corpus replay green: forge_interpreter_compare=pass, cases=98,
paired_cases_passed=yes. Decisions in docs/DECISIONS.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>