WIP: maxStore example + stdlib slot helpers#1
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Th0rgal
pushed a commit
that referenced
this pull request
Feb 10, 2026
**Critical Bugbot Fixes:**
1. **HIGH SEVERITY - SafeCounter overflow protection restored**
- Added `Expr.gt` and `Expr.le` operators to ContractSpec DSL
- Implemented overflow check in SafeCounter.increment: `require (count + 1 > count)`
- On overflow (MAX_UINT + 1 = 0), check fails: 0 is NOT > MAX_UINT
- Generated Yul now includes: `if iszero(gt(add(sload(0), 1), sload(0))) { revert(0, 0) }`
- Matches original manual Yul and EDSL safeAdd semantics
- All 80 Foundry tests passing including overflow protection tests
2. **MEDIUM SEVERITY - Zip function safety**
- Added compile-time validation in Compiler/Specs.lean
- 7 #guard statements ensure selector count matches function count
- Build fails immediately if mismatch occurs
- Prevents silent function dropping at compile time
3. **LOW SEVERITY - Dead code removal**
- Deleted Compiler/Parser.lean (141 lines, never imported)
- Was placeholder for future AST parsing, never used
**CI Fixes:**
4. **Fix hardcoded path in differential tests**
- Removed `/workspaces/mission-482e3014/dumbcontracts` path (local-only)
- Changed to relative path: `export PATH="$HOME/.elan/bin:$PATH" && lake exe ...`
- Works in both local dev and GitHub Actions CI
- Commented out random-gen call (not needed, using inline PRNG)
**Test Results:**
```
All 80 Foundry tests passing:
- 76 original tests ✓
- 4 differential tests ✓ (including 100 random transactions)
- SafeCounter overflow protection ✓
- All contracts compile ✓
- All 252 Lean proofs verify ✓
```
**Files Changed:**
- Compiler/ContractSpec.lean: Added gt/le operators, updated codegen
- Compiler/Specs.lean: Added overflow check to SafeCounter, compile-time validation
- Compiler/Parser.lean: Deleted (unused)
- compiler/yul/SafeCounter.yul: Regenerated with overflow check
- test/DifferentialSimpleStorage.t.sol: Fixed CI path issues
**Bugbot Review Thread Responses:**
Issue #1 (SafeCounter overflow): Fixed - overflow check restored with new gt operator
Issue #2 (Parser dead code): Fixed - file deleted
Issue #3 (Zip silent truncation): Fixed - compile-time guards added
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Th0rgal
pushed a commit
that referenced
this pull request
Feb 14, 2026
Critical finding: Layer 3 statement proofs are blocked by fundamental architectural issue that must be resolved first. Problem: - execIRStmt is marked 'partial' (unprovable in Lean) - execYulStmtFuel uses fuel parameter (provable) - Cannot prove equivalence between partial and total functions - All theorem stubs in StatementEquivalence.lean need 'sorry' Solution: - Add execIRStmtFuel: fuel-parametric version of execIRStmt - Mirror structure of execYulStmtFuel - Update execIRStmtsFuel to use it - Prove adequacy: fuel version equals partial version - Update theorem stubs to use fuel versions Impact: - BLOCKS all 8 statement proofs until resolved - Estimated 1 week of work to implement - Once complete, statement proofs become straightforward Updates to roadmap: - Added item #0: "Add execIRStmtFuel" as prerequisite - Marked as blocker for items #1-8 - Added detailed explanation section - Updated effort estimates (3-5 weeks total, up from 2-4) - Updated status count (0/10 instead of 0/9) This explains why StatementEquivalence.lean has all 'sorry' statements - the proof infrastructure wasn't complete yet! Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Feb 14, 2026
Closed
This was referenced Mar 5, 2026
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.
Summary
maxStoreexamplesloadVar/sstoreVar)Testing
PATH=/opt/lean-4.27.0/bin:$PATH lake buildforge testNote
Medium Risk
Touches contract entrypoint dispatch/selector wiring and adds new CI execution paths, so failures would surface at build/test time but could break generated artifacts if selectors or asm mismatch.
Overview
Adds a small EDSL “stdlib” (
DumbContracts/Stdlib.lean) with wrappers likerequire/unlessand slot/var helpers, then refactors the largeExamples.leanmonolith into focused modules underDumbContracts/Examples/.Introduces a new
maxStoreexample end-to-end: new entrypoint inCompiler.lean(andexampleEntries/healthEntrieswiring), updated hand-written dispatcher inEvmAsm.lean, plus a new generated-contract Foundry testGeneratedMaxStore.t.sol.CI is extended to run legacy Foundry tests via a new
foundry-legacyjob and adds theforge-stdgit submodule/lockfile needed bylegacy/foundry, alongside doc/status updates.Written by Cursor Bugbot for commit 0974d96. This will update automatically on new commits. Configure here.