Commit 0895c5d
fix: Address all Bugbot issues and fix CI
**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>1 parent f514220 commit 0895c5d
7 files changed
Lines changed: 291 additions & 157 deletions
File tree
- Compiler
- compiler
- yul-new
- yul
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
143 | 146 | | |
| 147 | + | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| 237 | + | |
233 | 238 | | |
234 | 239 | | |
235 | 240 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
| |||
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
381 | 403 | | |
0 commit comments