Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
329ffe6
Uncomment and update LibOpCall tests for Float encoding
thedavidmeister Feb 17, 2026
c29c937
Require audit agents to write findings to dated files
thedavidmeister Feb 17, 2026
fea91ac
Clarify jidoka process: session precedence, test definition, audit re…
thedavidmeister Feb 17, 2026
35a3ac4
Add ContextGridOverflow guard to subParserContext
thedavidmeister Feb 17, 2026
f441f02
Add tests for ContextGridOverflow in subParserContext
thedavidmeister Feb 17, 2026
565dcd5
Add Pass 0 (process review), fix audit naming convention, remove hard…
thedavidmeister Feb 17, 2026
9674e36
Remove Pass 0 same-conversation instruction to match separate convers…
thedavidmeister Feb 17, 2026
d608204
Reorder jidoka cycle: build before test
thedavidmeister Feb 17, 2026
752cad9
Define severity classification scale for audit findings
thedavidmeister Feb 17, 2026
6537dec
Move checkParseMemoryOverflow implementation into LibParseState
thedavidmeister Feb 17, 2026
3d2e705
Replace hardcoded ParseState struct offsets with named constants
thedavidmeister Feb 17, 2026
8d4fb62
Document 8-bit opcode and 16-bit operand caller constraints on pushOp…
thedavidmeister Feb 17, 2026
8b86dc8
Document 16-bit pointer truncation risk in pushSubParser
thedavidmeister Feb 17, 2026
141b962
Document unchecked addition safety constraints in push and pushInputs
thedavidmeister Feb 17, 2026
63ec23c
Document unchecked arithmetic safety in LibParseLiteralRepeat
thedavidmeister Feb 17, 2026
7f21958
Add audit/known-false-positives.md to track triaged false positives
thedavidmeister Feb 17, 2026
031fba2
Document LibOpCall integrity and run functions
thedavidmeister Feb 17, 2026
624781b
Add LibOpExtern tests for BadOutputsLength and zero inputs/outputs
thedavidmeister Feb 17, 2026
116023d
Document ASCII-only input constraint in LibParse
thedavidmeister Feb 17, 2026
d1fc0c6
Document sub-parser trust model in LibSubParse
thedavidmeister Feb 17, 2026
3b36dea
Add BadSubParserResult tests for wrong-length sub-parser bytecode
thedavidmeister Feb 17, 2026
8f0c57c
Document checkParseMemoryOverflow dependency in newActiveSourcePointer
thedavidmeister Feb 17, 2026
62c550e
Guard against out-of-bounds read in parseSubParseable
thedavidmeister Feb 17, 2026
d6ef573
Document pop() direct subtraction and harden highwater overflow check
thedavidmeister Feb 17, 2026
f7b254b
Document ioByte and opcodeIndex range constraints in subParserExtern
thedavidmeister Feb 17, 2026
685dc1a
Add triage process and complete pass 1 triage
thedavidmeister Feb 17, 2026
738670c
Add direct extern() test and regenerate deploy constants
thedavidmeister Feb 17, 2026
6575278
Add test for extern() opcode mod-wrapping behavior
thedavidmeister Feb 17, 2026
da2c3ef
Add test for externIntegrity() happy path via direct call
thedavidmeister Feb 17, 2026
7f34586
Add boundary test for externIntegrity() at highest valid opcode
thedavidmeister Feb 17, 2026
5f84a07
Add test for SubParserIndexOutOfBounds revert in subParseWord2
thedavidmeister Feb 17, 2026
fc5de00
Add test for SubParserIndexOutOfBounds revert in subParseLiteral2
thedavidmeister Feb 17, 2026
59ce761
Consolidate subParser tests by function and add subParseLiteral2 unit…
thedavidmeister Feb 17, 2026
9e163d0
Add test for subParseWord2 with empty word parsers table
thedavidmeister Feb 17, 2026
40cfbd3
Add test for StackUnderflow revert in integrity check
thedavidmeister Feb 17, 2026
fcc6ab9
Add test for StackUnderflowHighwater revert in integrity check
thedavidmeister Feb 17, 2026
3d82780
Rename integrity test contracts to remove 'helper' suffix
thedavidmeister Feb 17, 2026
2b4ff3e
Add test for StackAllocationMismatch revert in integrity check
thedavidmeister Feb 17, 2026
cafb943
Add test for StackOutputsMismatch revert in integrity check
thedavidmeister Feb 17, 2026
b1a0f3c
Add test for HexLiteralOverflow revert in parseHex
thedavidmeister Feb 17, 2026
adc0f85
Add test for ZeroLengthHexLiteral revert in parseHex
thedavidmeister Feb 17, 2026
66f2d6f
Add test for OddLengthHexLiteral revert in parseHex
thedavidmeister Feb 17, 2026
18339c1
Add test for MalformedCommentStart revert in skipComment
thedavidmeister Feb 17, 2026
2878c38
Add test for NotAcceptingInputs revert in endLine
thedavidmeister Feb 17, 2026
9ff8560
Add test for ParseStackOverflow revert in highwater
thedavidmeister Feb 17, 2026
fe69234
Add test for ParenOverflow revert in LibParse
thedavidmeister Feb 17, 2026
4cbcff6
Add test for OpcodeIOOverflow revert in endLine
thedavidmeister Feb 17, 2026
8238969
Add test for literalParserFunctionPointers output length
thedavidmeister Feb 17, 2026
c7e6530
Add test for operandHandlerFunctionPointers output length
thedavidmeister Feb 17, 2026
efe2a7f
Add test for authoringMetaV2 content correctness
thedavidmeister Feb 17, 2026
1efea00
Add test for four-array ordering consistency in LibAllStandardOps
thedavidmeister Feb 17, 2026
5059421
Add test for InputsLengthMismatch too-few-inputs direction
thedavidmeister Feb 17, 2026
49bfd65
Add audit pass 1-3 results and triage files
thedavidmeister Feb 17, 2026
789f04c
Fix duplicate -i short flag in CLI fork args and add pass 4 audit res…
thedavidmeister Feb 17, 2026
0c0edc4
Remove dead constants NOT_LOW_16_BIT_MASK and ACTIVE_SOURCE_MASK from…
thedavidmeister Feb 17, 2026
3361fda
Fix FSM NatSpec to match actual bit positions in LibParseState
thedavidmeister Feb 17, 2026
751606d
Fix literal parser function pointer mutability from pure to view
thedavidmeister Feb 17, 2026
5e688b0
Remove unused serde and serde_bytes dependencies from CLI crate
thedavidmeister Feb 17, 2026
498252f
Fix unwrap on traces and search_trace_by_path parent tracking bug
thedavidmeister Feb 17, 2026
7b8a414
Fix Rust crate edition consistency and move parse_pragma_text to trait
thedavidmeister Feb 17, 2026
f1effe6
Add LibInterpreterStateDataContract test coverage
thedavidmeister Feb 18, 2026
3b1f508
Add LibParseStackTracker unit tests for all error paths
thedavidmeister Feb 18, 2026
6060475
Format Rust CLI eval.rs
thedavidmeister Feb 18, 2026
a2f7b56
Mark remaining Pass 2 HIGHs as fixed
thedavidmeister Feb 18, 2026
48fb634
Format LibInterpreterStateDataContract test file
thedavidmeister Feb 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ docs

# This is for our deploy scripts that report the addresses of deployed contracts
deployments
audit
22 changes: 20 additions & 2 deletions AUDIT.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Audit Review

An audit consists of four separate passes. All four passes are mandatory. Do not combine them into a single pass. Each pass must be run as its own separate conversation to avoid hitting context limits.
An audit consists of the passes defined below. All passes are mandatory. Do not combine them into a single pass. Each pass must be run as its own separate conversation to avoid hitting context limits.

Each pass will need multiple agents to cover the full codebase. When partitioning files across agents, assign one file per agent. This ensures each agent reads its file thoroughly rather than skimming across many files. For passes that require cross-file context (e.g., Pass 2 needs both source and test files), the agent receives the source file plus its corresponding test file(s) — this is still a single-file-per-agent partition from the source file perspective.

Agents are assigned sequential IDs (A01, A02, ...) based on alphabetical order of their source file paths. Each agent prefixes its findings with its ID (e.g., A03-1, A03-2). This produces a stable global ordering: sort by agent ID, then by finding number within each agent. The ordering is deterministic because it derives from the file list, which is fixed for a given codebase snapshot.

Every pass requires reading every assigned file in full. Do not rely on grepping as a substitute for reading — systematic line-by-line review catches issues that keyword searches miss. Grepping is appropriate for cross-referencing (e.g., checking if an error name appears in test files) but not for understanding code.

After reading each file, the agent must list evidence of thorough reading before reporting findings. For each file, list:
Expand All @@ -13,7 +15,23 @@ After reading each file, the agent must list evidence of thorough reading before

This evidence must appear in the agent's output before any findings for that file. If the evidence is missing or incomplete, the audit of that file is invalid and must be re-run.

Findings from all passes should be reported, not fixed. Fixes are a separate step after findings are reviewed.
Findings from all passes should be reported, not fixed. Fixes are a separate step after findings are reviewed. Each finding must be classified as one of: **CRITICAL** (exploitable now with direct impact), **HIGH** (significant risk requiring specific conditions), **MEDIUM** (real concern with mitigating factors), **LOW** (minor issue or theoretical risk), **INFO** (observation with no direct risk).

Each agent must write its findings to `audit/<YYYY-MM-DD>-<NN>/pass<M>/<FileName>.md` where `<NN>` is a zero-padded incrementing integer starting at 01, `<M>` is the pass number, and `<FileName>` matches the source file name (e.g. `LibEval.md` for `LibEval.sol`). To determine `<NN>`, glob for `audit/<YYYY-MM-DD>-*` and use one higher than the highest existing number, or 01 if none exist. All passes of the same audit share the same `<NN>`. Each audit run uses this namespace so previous runs are preserved as history. Findings that only exist in agent task output are lost when context compacts — the file is the record of truth.

## Triage

During triage, maintain `audit/<YYYY-MM-DD>-<NN>/triage.md` recording the disposition of every LOW+ finding, keyed by finding ID (e.g., A03-1). Each entry has a status: **FIXED** (code changed), **DOCUMENTED** (NatSpec/comments added), **DISMISSED** (no action needed), or **PENDING** (not yet triaged). This file is the durable record of triage progress — conversation context is lost on compaction, but the file persists. Before presenting the next finding, check the triage file for the first PENDING ID in sort order. Present findings neutrally and let the user decide the disposition.

## Pass 0: Process Review

Review CLAUDE.md and AUDIT.md for issues that would cause future sessions to misinterpret instructions. This pass reviews process documents, not source code. No subagents needed — the documents are small enough to review in the main conversation. Record findings to `audit/<YYYY-MM-DD>-<NN>/pass0/process.md`.

Check for:
- Ambiguous instructions a future session could misinterpret (e.g. reused placeholder names, unclear defaults)
- Instructions that are fragile under context compression (e.g. relying on subtle distinctions)
- Missing defaults or undefined terms
- Inconsistencies between CLAUDE.md and AUDIT.md

## Pass 1: Security

Expand Down
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

**This file takes precedence over session summaries.** When a session is restored from a compressed summary, the summary may contain incorrect interpretations of processes defined here. Always re-read and follow this file as written — do not rely on the summary's framing of what a process means or what the user intended.

## Build Environment

This project uses **Nix flakes** for development. All commands must be run inside `nix develop` or prefixed with `nix develop -c`. The `.envrc` auto-loads the nix shell via direnv.
Expand Down Expand Up @@ -109,7 +111,7 @@ External contracts can extend the interpreter with additional opcodes. `src/conc

## Process (Jidoka)

Each fix is a complete cycle: understand → fix → testbuild → verify. Do not move to the next item with incomplete work. When a process defect is found, stop and fix the process before resuming. When the user asks "why" about a defect, they are asking for root cause analysis of the process failure — not requesting that you go do the thing. Answer the "why" first, agree on the process fix, then resume.
Each fix is a complete cycle: understand → fix → buildtest → verify. Do not move to the next item with incomplete work. The "test" step means both: write tests for any new code paths introduced by the fix, then run the full test suite to confirm nothing is broken. New code must meet the same audit requirements defined in `AUDIT.md` — a fix that introduces untested error paths, missing NatSpec, or other audit findings is not complete. When a process defect is found, stop and fix the process before resuming. When the user asks "why" about a defect, they are asking for root cause analysis of the process failure — not requesting that you go do the thing. Answer the "why" first, agree on the process fix, then resume.

## Audit Review

Expand Down
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions audit/2026-02-17-02/pass0/process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Pass 0 (Process Review) -- CLAUDE.md and AUDIT.md

## Evidence of Thorough Reading

### CLAUDE.md
- Precedence statement (line 5)
- Build Environment: prerequisites (lines 11-17), common commands (lines 23-41), build pipeline (lines 45-52)
- Architecture: four core components (lines 56-66), opcode system (lines 68-76), extern system (lines 78-80), rust crates (lines 82-89), deployment (lines 91-93)
- Solidity Conventions (lines 95-103)
- Test Conventions (lines 105-110)
- Process (Jidoka) (lines 112-114)
- Audit Review (lines 116-118)

### AUDIT.md
- General instructions (lines 1-16): pass count, agent partitioning, evidence requirements, file naming
- Pass 0: Process Review (lines 18-26)
- Pass 1: Security (lines 28-44)
- Pass 2: Test Coverage (lines 46-53)
- Pass 3: Documentation (lines 55-62)
- Pass 4: Code Quality (lines 64-72)

---

## Findings

### [P0-1] AUDIT.md says "four separate passes" but there are now five

- **File**: AUDIT.md line 3
- **Description**: Opening sentence says "An audit consists of four separate passes." With Pass 0 added, there are five (0-4).
- **Impact**: A future session may skip Pass 0 because the opening line says four.

### [P0-2] "Each pass in its own conversation" conflicts with Pass 0

- **File**: AUDIT.md line 3 vs line 20
- **Description**: Line 3 says "Each pass must be run as its own separate conversation." Line 20 says Pass 0 should "Run in the main conversation before launching code audit agents." These contradict.
- **Impact**: A future session may either skip Pass 0 (following line 3's rule) or waste a conversation on it.

### [P0-3] General instructions assume all passes use agents

- **File**: AUDIT.md lines 5-14
- **Description**: Lines 5-6 describe agent partitioning ("one file per agent"). Lines 9-14 require evidence of thorough reading per file. Pass 0 doesn't use agents and doesn't audit source files. A future session trying to apply these general rules to Pass 0 will be confused.
- **Impact**: Ambiguity about which general rules apply to Pass 0.

### [P0-4] `<FileName>` convention doesn't apply to Pass 0

- **File**: AUDIT.md line 16 vs line 20
- **Description**: Line 16 says `<FileName>` matches the source file name. Line 20 says Pass 0 output is `pass0/process.md`. These are inconsistent — Pass 0 doesn't audit source files.
- **Impact**: Minor inconsistency. Pass 0 has its own explicit path so this is unlikely to cause confusion in practice.

### [P0-5] Jidoka cycle order "test -> build" doesn't match bytecode change workflow

- **File**: CLAUDE.md line 114
- **Description**: The jidoka cycle is "understand -> fix -> test -> build -> verify." For changes affecting bytecode, you must build (pointer regeneration) before running tests, because the build generates constants that tests depend on. Following the cycle literally would fail.
- **Impact**: A future session may attempt to run tests before building and encounter compilation errors, then waste time debugging a process issue.

### [P0-6] Pointer regeneration and jidoka cycle are two overlapping sequences with no cross-reference

- **File**: CLAUDE.md line 52 vs line 114
- **Description**: Line 52 describes the build pipeline sequence (i9r-prelude -> BuildPointers -> forge fmt -> LibInterpreterDeployTest -> update constants -> repeat). Line 114 describes the jidoka fix cycle (understand -> fix -> test -> build -> verify). These describe overlapping activities with different step orders and no reference to each other.
- **Impact**: A future session may follow one sequence and miss steps from the other.

### [P0-7] Deprecated audit directory doesn't match new naming convention

- **File**: Filesystem: `audit/2026-02-17/` and `audit/pass1/`
- **Description**: These directories predate the `<YYYY-MM-DD>-<NN>` convention. A glob for `audit/2026-02-17-*` won't match them. Their presence may confuse a future session.
- **Impact**: Low. Could cause incorrect `<NN>` calculation if a future session checks for existing directories by a different method than globbing.

### [P0-8] No severity classification defined for findings

- **File**: AUDIT.md (all pass sections)
- **Description**: No pass defines how to classify finding severity. The previous audit used CRITICAL/HIGH/MEDIUM/LOW/INFO but this isn't documented. Without a defined scale, different agents may use inconsistent schemes.
- **Impact**: Makes triage harder when consolidating findings across agents.

## Summary

9 findings total. Key themes: Pass 0 doesn't fit the general instructions written for code audit passes (P0-1 through P0-4), and the jidoka cycle order conflicts with the bytecode change build pipeline (P0-5, P0-6).
30 changes: 30 additions & 0 deletions audit/2026-02-17-03/pass0/process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Pass 0 (Process Review) -- CLAUDE.md and AUDIT.md

## Evidence of Thorough Reading

### CLAUDE.md
- Precedence statement (line 5)
- Build Environment: prerequisites (lines 11-17), common commands (lines 23-41), build pipeline (lines 45-52)
- Architecture: four core components (lines 56-66), opcode system (lines 68-76), extern system (lines 78-80), rust crates (lines 82-89), deployment (lines 91-93)
- Solidity Conventions (lines 95-103)
- Test Conventions (lines 105-110)
- Process / Jidoka (lines 112-114)
- Audit Review (lines 116-118)

### AUDIT.md
- General instructions (lines 1-18): pass structure, agent partitioning, evidence requirements, severity classification, file naming
- Pass 0: Process Review (lines 20-28)
- Pass 1: Security (lines 30-46)
- Pass 2: Test Coverage (lines 48-55)
- Pass 3: Documentation (lines 57-64)
- Pass 4: Code Quality (lines 66-74)

---

## Findings

No findings. Both documents are internally consistent, unambiguous, and robust to context compression.

## Summary

Clean pass. No CRITICAL, HIGH, MEDIUM, LOW, or INFO findings.
Loading