Skip to content

Latest commit

 

History

History
67 lines (60 loc) · 7.1 KB

File metadata and controls

67 lines (60 loc) · 7.1 KB

FIXES.md — Critical Fix Queue

CURRENT_FIX

(None — all fixes complete)

COMPLETED

  • FIX-1: _classifyType empty-list misclassification (commit 6a47a93, +5 tests)
  • FIX-2: _classifyType returns TYPE_BOOL for 0 and 1 (commit b104a09, +16 tests)
  • FIX-3: None vs -1 collision (commit 147ca96, +8 tests)
  • FIX-4: Integer range / string ID collision (commit 3b70c02, +6 tests)
  • FIX-5: Float tag false positives (commit pending, +6 tests)
  • FIX-6: Exception handling — multiple except & finally JUMP backpatch (+6 tests)
  • FIX-7: Augmented assignment to non-simple targets (+5 tests)
  • FIX-8: Temp variable slot exhaustion in lst[i] = value (+3 tests)
  • FIX-9: GC actually decrements refs (+4 tests)
  • FIX-10: Float precision documented as 6-digit fixed-point (ISA.md, ARCHITECTURE.md)

QUEUE (in priority order — DO NOT REORDER)

  • FIX-1: _classifyType empty-list misclassification
  • FIX-2: _classifyType returns TYPE_BOOL for 0 and 1
  • FIX-3: None vs -1 collision
  • FIX-4: Integer range / string ID collision
  • FIX-5: Float tag false positives on extreme values
  • FIX-6: Exception handling — multiple except & finally JUMP backpatch
  • FIX-7: Augmented assignment to non-simple targets
  • FIX-8: Temp variable slot exhaustion in lst[i] = value
  • FIX-9: GC actually decrements refs
  • FIX-10: Float precision is 6-digit fixed point, not IEEE 754
  • FIX-11: Self-hosting bootstrap is not real
  • FIX-12: Solidity & Yul backends produce unverified output
  • FIX-13: Test assertions strengthen
  • FIX-14: Documentation drift
  • FIX-15: Parser _funcPs/_funcPc storage-as-return-value
  • FIX-16: _callArgs reset between Parser uses

BLOCKERS

  • FIX-1: len([]) returns 0 which is also a valid list ID. This is a value-space collision that requires type tagging (FIX-2) to fully resolve. Decision: accept this limitation for FIX-1, document it. FIX-2 will introduce BOOL_TAG and address 0/1 ambiguity.
  • FIX-3: is keyword was not parsed as comparison operator. Fixed by adding KW_IS to _isCmp/_cmpOp, mapping is → EQ and is not → NEQ.
  • FIX-3: -1 (2^256-1) collides with string ID range (>= 2^62). isinstance(-1, int) returns TYPE_STR. This is FIX-4's domain. Decision: test -1 == None instead of isinstance(-1, int) for FIX-3.
  • FIX-6: Three bugs in _genTryStmt: (1) handlerPC backpatch used relative offset but _execRaise treats it as absolute — fixed with code.length backpatch. (2) code.length included 7-byte header but VM code starts at index 0 — fixed with code.length - HEADER_SIZE. (3) Finally block body not generated because _genBlock received FINALLY_BRANCH wrapper node — fixed by dereferencing through _c1(finallyBranch).
  • FIX-7: _genAugAssign only handled IDENTIFIER_REF targets. lst[i] += value was silently ignored. Fixed by adding INDEX_ACCESS handling: load current value via LIST_GET, apply op, store via LIST_SET with temp variable for intermediate result.
  • FIX-8: List/augmented assignment codegen used unique temp variable names per statement (__asgn0, __asgn1, ...) via _forTempCounter, exhausting uint8 variable slots in loops. Fixed by using a single reusable temp name __tmp per scope — safe because temps are always stored then loaded within the same statement.
  • FIX-9: Three issues: (1) Code generator never emitted OP_GC_UNREF — added LOAD_VAR + GC_UNREF before every STORE_VAR. (2) _gcDecRef/_gcIncRef treated ID 0 as sentinel (id == 0 early return), but list IDs start at 0 — removed the sentinel check, relying solely on gcLive[id]. (3) GC_UNREF on first-assignment variables incorrectly unrefed the default value 0 — added varInitialized tracking to only emit GC_UNREF on reassignment.
  • FIX-10: Documentation-only fix. ISA.md said "Float: NOT SUPPORTED in v1" but floats are implemented using 6-digit fixed-point (FLOAT_SCALE=1,000,000). Updated ISA.md and ARCHITECTURE.md to accurately describe the tagged fixed-point representation.
  • FIX-11: Documentation-only fix. "Self-hosting Bootstrap" was misleading — the mini_lexer.py is compiled by the Solidity compiler, not by itself. True self-hosting would require the compiler to compile its own source code. Updated GOAL.md to clarify this is a "Bootstrap Demo", not self-hosting.
  • FIX-12: Added structural validation tests for Solidity backend: balanced braces, non-trivial output, correct pragma/contract headers. 4 new tests across multiple program patterns (conditionals, loops, functions). Note: full end-to-end verification (compile generated Solidity and execute) is still not implemented.
  • FIX-13: Strengthened test assertions in Exception.t.sol: parser tests now check minimum node counts (assertGe instead of assertTrue > 0), lexer keyword tests check minimum token counts.
  • FIX-14: Updated ARCHITECTURE.md limitations (removed "no global variables" and "no import system" since both are implemented, added GC cycle detection limitation). Updated GOAL.md Phase 6 test count from 177 to 629.
  • FIX-15: _funcPs and _funcPc were storage variables shared across all function definitions. Nested function definitions would overwrite them before the outer function's _emit call, causing the outer function to get the inner function's parameter count. Fixed by making _parseFuncParams return (uint256 ps, uint256 pc) and using local variables in _funcDef.
  • FIX-16: Both Lexer and Parser accumulated state in storage arrays across multiple calls. Lexer's tokenize() and Parser's parse() didn't reset their storage arrays, so reusing the same contract instance contaminated subsequent calls. Fixed by adding array resets at the start of both functions.

FOLLOW_UPS

  • Closures (lexical scoping): inner functions cannot access outer function's parameters. Not a FIX-15 bug — requires full closure support which is not implemented.
  • Bootstrap execution: mini_lexer.py compiles but execution hits stack underflow at runtime. Documented as KNOWN_LIMITATION in Bootstrap.t.sol.
  • Backend limitations: Solidity and Yul backends don't support try/except, dict/set types, or slice. Documented in BACKEND_LIMITATIONS.md.

TEST_COUNT

644 passing / 644 total

AUDIT_RESULTS

  • AUDIT-1: [FIXED] Import/VFS/Venv/Bootstrap — 16 weak assertions strengthened with Print event value checks
  • AUDIT-2: [FIXED] Yul backend — 5 structural validation tests added (_balancedBraces, non-trivial output, function placement). Created BACKEND_LIMITATIONS.md.
  • AUDIT-3: [CLEAN] GC shared reference — verified list ID 0 not falsely freed on variable assignment. 2 tests added confirming safety.
  • AUDIT-4: [FIXED] Negative int classification — _classifyType returned TYPE_STR for -1 (2^256-1 >= 2^62). Added val >= INT_MIN check before string check. 4 tests added. Real bug fixed.
  • AUDIT-5: [CLEAN] Bool tagging arithmetic — all arithmetic ops untagBool, all comparisons return tagged bools. 45/45 TypeClassify tests pass.
  • AUDIT-6: [CLEAN] No TODO/FIXME/HACK in source. Backend "not supported" comments are documented feature gaps.
  • AUDIT-7: [FIXED] Nested function execution — added end-to-end test testNestedFunctionDefinition (outer(5)=11). Parser test existed but no execution test. 1 test added.