Skip to content

Faithful SlithIR: name resolution, pipeline semantics, points-to and EVM-checked analyses - #3169

Open
0xalpharush wants to merge 1274 commits into
crytic:masterfrom
0xalpharush:slither-overhaul
Open

0xalpharush wants to merge 1274 commits into
crytic:masterfrom
0xalpharush:slither-overhaul

Conversation

@0xalpharush

@0xalpharush 0xalpharush commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The goal is a SlithIR that is faithful to the semantics of the code that runs, checked against the EVM, with analyses that are more precise than master's. Roughly:

  • Frontends. A typed solc AST (supersedes Rewrite/solc parsing #1565, the update of [wip] solc parser rewrite #627: both JSON flavors convert to slotted dataclasses, is_compact_ast checks go from 103 to 8); a scope-graph name resolver that binds every identifier by declaration (checked against solc's referencedDeclaration on solc's own test suite and every e2e AST), replacing find_variable and import renaming; Yul references bound through externalReferences, with one scope per Yul block; call options and member types decided from the AST rather than by name; a Vyper 0.4/0.5 frontend (Vyper 0.3.x is no longer supported).
  • IR. ?:, && and || lowered into the CFG with exact short-circuit semantics; reverts end their path and break/continue are linked while parsing; operand evaluation order and other semantics follow the unit's pipeline (legacy or via-IR, compilation_unit.via_ir); literals, Yul words and conversions typed as solc types them; Cooper-Harvey-Kennedy dominators; pruned SSA with no phi operations (merges are block parameters, call effects are operation results); an MLIR-like text format that --print slithir emits and Slither loads back.
  • Analyses. Flow- and field-sensitive storage and memory points-to; context-sensitive data dependency that keeps lengths, struct fields, raw and hashed storage slots and library storage apart; a compositional storage-effect reentrancy analysis covering the SAILFISH hazard classes; value-set analysis, used by missing-zero-check and ecrecover.
  • One Function per declaration. An inherited function is a binding (the declaration run in a contract) that shares its declaration's nodes, IR and SSA; the per-contract copies are gone. Calls resolve per binding through dispatch sites (binding.calls, Call.target), and the SSA is linked per binding (SSALinks). node.function is the declaration (Upgrading.md "One body per declaration"). On Aave this cut wall time by about 7.5% and peak memory by 25%.
  • Expression tree. The frontend's expression tree moved to slither/hir/ (slotted classes, typed fields, typed CallOptions, a separate VyperCall, exhaustive match dispatch); slither.core.expressions re-exports it. Only the frontends, IR lowering, pre-IR constants and three syntax detectors import it, enforced by a test; every detector, printer, tool and analysis reads IR. Constants are evaluated with Solidity's rational-literal semantics (constant_evaluation.py, checked against solc on generated expressions), and each literal-only subexpression lowers to one constant that keeps its source.
  • Verification. A SlithIR interpreter (including inline assembly and transient storage) compared against revm; replay of solc's semanticTests, Vyper's functional tests and an external corpus; generated-program fuzzing in both pipelines and Vyper; soundness oracles that check value analysis, data dependency, points-to and reentrancy against concrete executions; SSA, dominator and IR round-trip checks on real projects; annotation-based analysis tests (tests/unit/analyses/ui); every detector re-run on IR loaded back from text gives the same findings.
  • crytic-compile. Uses the unit's build-info to skip units Slither cannot parse; Foundry projects compile AST-only when no printer needs bytecode (requires Foundry: fix Yul and preprocessed sources, reuse forge's cache, add AST-only compilation crytic-compile#714; with the released crytic-compile the option is ignored and a full build is used).

How to review

The branch is a sequence of topic merges, each with its own commits. Reading merge by merge (git log --first-parent) is easier than the full diff:

Merge Topic
solc-parsing, exceptional-cf, cfg-printers typed AST, try/catch and revert CFG, loop jumps, printers and CLI
ssa-blockargs, ssa-v2, ssa-pointsto, no-phi SSA construction, dominators, aliasing, phi removal
storage-libs, pointsto points-to analysis
dataflow, reentrancy, unify-paths, reentrancy-precision dataflow framework, value analysis, reentrancy
resolve, resolve-yul, ir-fidelity name resolution, literal and builtin typing, call targets
ir-text, ir-text-mlir, ir-gaps, ir-gaps-2 text format, IR completeness, round trip
eval-order, eval-order-2, eval-order-fix, expr-cfg pipeline semantics, conditional lowering
vyper, vyper-fidelity, interp-vyper-ssa Vyper
interpreter, interp-coverage, corpora, corpus-crashes interpreter and external corpora
oracles, oracles-asm, analysis-tests soundness oracles, annotation tests
gate-triage, detector-precision, zero-address, cyclomatic, determinism, determinism-2 detector precision against master, deterministic output
perf, perf-2 performance
ty-strict, review-*, code-reduction, test-reduction, refactor typing, cleanup, removal of subsumed unit tests

API changes for scripts and plugins (phi operations, HighLevelCall.function, internal_calls, removed parser helpers) are listed with their replacements in docs/src/Upgrading.md.

Verification

  • pytest tests/unit tests/e2e (with the Vyper 0.5 tests): 21364 passed, 12 skipped, 1 strict xfail (the rebuilt-IR test cannot see state initializers for uninitialized-fptr-cst). ruff and ty check (strict) pass.

  • Differential fuzzing, 300 generated programs per configuration with SSA: no mismatches on solc 0.4.26, 0.6.12, 0.8.28 legacy and via-IR, and Vyper 0.4.3 and 0.5.

  • Interpreter vs revm on solc 0.8.39's semanticTests, legacy and via-IR (3,480 cases): 2,976 pass, 24 diverge, 0 crash, 289 unsupported, 36 format gaps, 155 skipped. The divergences: 10 where pyrevm 0.3.7 disagrees with solc's expected output (selfdestruct, block.gaslimit) and the interpreter matches it; 4 needing legacy codegen's dirty bits or gas; 2 under revertStrings: debug; 8 fixed on the tip since the run (4 on rational constants, 4 on super resolving to an unimplemented function). Unsupported is mostly dirty values in assembly (78), internal function pointers in storage (68) and memory addresses leaving assembly (24). Vyper 0.4.3 functional tests: 772 pass, 0 diverge, 0 crash, 6 unsupported, 279 skipped.

  • IR structure check (SSA, dominators, text round trip) on solc's semantic test suite: 3334 cases, 0 violations.

  • Soundness oracles, 300 programs per configuration: value analysis, taint and points-to report no violations. Reentrancy reports 2 violations on 0.6.12, both a check-effects-interactions pattern split around the call, which is not reported by design.

  • Detector output is byte-identical across PYTHONHASHSEED values (tests/e2e/test_determinism.py; also checked on Aave with 492 contracts).

  • SAILFISH: the paper's figures, its artifact and the solar test cases are e2e detector tests. On the hand-labelled SAILFISH set (701 of 750 contracts re-fetched from Sourcify, 669 compile on the branch, 648 on master), scored against the labels as true positives / false positives / false negatives:

    | | reentrancy | TOD |
    |---|---|---|
    | master | 13 / 73 / 13 | not run |
    | branch | 13 / 9 / 13 | 38 / 54 / 57 |
    | branch, --reentrancy-untrusted-fixed-callees | 13 / 37 / 13 | 38 / 58 / 57 |

    No true positive is lost. Trusting fixed callees by default removes 28 reentrancy false positives, all calls to addresses set in the constructor or by the owner. The 9 left are owner checks written as if in a modifier (2), an oraclize callback, one likely mislabel and 5 not yet triaged; an earlier reading of the false negatives found most of them mislabelled. The TOD false positives are mostly per-key writes, fresh indexes, non-payable functions, SafeMath reverts and mutually exclusive phases.

Master (97c1d10) vs this branch (9f62841; the Aave rows at a90fb63, after the points-to fix below), all detectors, same builds and machine, one Slither process at a time, two runs each (the runs agree within 1%):

Project master branch findings, master → branch
Solady 20.5 s / 1.22 GB 14.3 s / 0.94 GB 1778 → 1566
Uniswap v4-core 26.7 s / 1.04 GB 17.4 s / 0.76 GB 820 → 835
Solmate 26.0 s / 0.71 GB 11.7 s / 0.56 GB 1766 → 642
OpenZeppelin 48.3 s / 1.86 GB 42.7 s / 1.66 GB 1252 → 1316
Aave v3 with tests (492 contracts) 268.9 s / 9.02 GB 216.0 s / 5.87 GB 8247 → 8380
Aave v3, default build without tests (274 contracts) 16.9 s / 0.84 GB 18.7 s / 0.80 GB 876 → 940

The default Aave build took 46 s before a90fb63: a memory load returned the references stored in the loaded value's fields, so one function (UiPoolDataProviderV3.getReservesData) built exponentially many access paths. With the fix, detector output is unchanged on all six builds.

Master cannot generate IR for 38 functions on OpenZeppelin and 3 on Aave; the branch generates IR for every function. The differences from master were classified at 792caf5, and each later merge was gated against its parent with every changed finding classified. Removed findings are false positives, for example:

  • Solmate: reentrancy-benign 662 → 89, reentrancy-events 660 → 89.
  • Solady: write-after-write 61 → 0, incorrect-shift 52 → 3, incorrect-exp 16 → 0 (Yul code).
  • OpenZeppelin: unimplemented-functions 25 → 0, dead-code 88 → 45.
  • Aave and others: unused-return, uninitialized-local.

Added findings are true positives by the detector's definition, mostly code master does not model (Yul timestamp(), time packed into OpenZeppelin Time.Delay, interest accrual in Aave, unused imports), or come from the new detectors (transaction-order-dependence, read-only reentrancy).

Code size

Python lines in slither/: 71,097 on master, 119,056 here (+47,959). Tests: 10,863 → 22,103 lines of Python, plus test data and snapshots.

Area Lines added (net) What it is
slithir/interpreter +14,457 SlithIR interpreter and the differential harness against revm, used for verification (one detector imports its ABI helper is_dynamic)
analyses (dataflow, reentrancy, storage_pointer, data_dependency, access paths, pass manager) +13,440 dataflow framework, value analysis, taint flows, def-use, storage pointers, the reentrancy rewrite
slithir/text +5,497 MLIR-like text format: printer, parser and builder (round trip of every IR)
frontends (solc_parsing/ast, resolution, yul, vyper_parsing, minus the old declarations code) +4,860 typed AST of both solc JSON flavors, scope-graph name resolution, typed Yul, Vyper >= 0.4
IR and SSA (slithir/utils, slithir, visitors/slithir) +3,639 SSA with block arguments, SSA verifier, evaluation order, control-flow lowering
detectors +1,951 new detectors (read-only reentrancy, TOD, ecrecover, memory-safe comment) and precision fixes
utils +1,187
core and expression tree (core/declarations, hir replacing core/expressions) +960 bindings and the Call API; the moved expression tree is the same size
other (printers, tools, under 400 lines each) +1,968

User-visible changes

  • New detectors: evaluation-order and transaction-order-dependence. unused-import is registered again.
  • Reentrancy detectors use the new analysis: lock-aware, with destructive reads, cross-function and created-contract reentrancy, and calls to fixed callees (set only in the constructor, immutable, or by owner-guarded setters) trusted by default; --reentrancy-untrusted-fixed-callees (or Slither(reentrancy_untrusted_fixed_callees=True)) restores view-only trust. read-only-reentrancy reports a view that can observe state half-updated around a call, unless the view itself checks the lock.
  • missing-zero-check decides by the value reaching each sink (state writes, including contract-typed ones, ETH transfers, low-level calls and internal helpers that pass the parameter on) and checks base-contract constructors. A check or call on the address that runs on every path after the sink counts, since a revert undoes the write; a parameter passed through helpers is reported once, at the function that receives it. ecrecover proves the signer non-zero and checks replay protection, including at the callers of internal verifiers (supersedes Detector for ecrecover return value validation and use of nonces #2015).
  • timestamp and incorrect-equality judge comparisons where the tainted value enters: a comparison in a helper is reported once with the call sites that pass the value. Range and overflow checks, and the results of external calls, are not reported.
  • is_protected asks whether a caller other than a privileged one can complete the function.
  • assembly no longer reports Yul functions separately from the function that contains them.
  • locked-ether no longer reports a contract whose only payable function is its constructor.
  • Finding text shows source expressions instead of IR temporaries; literals and function types print as in Solidity.
  • Vyper: 0.4 and later only; --vyper selects the compiler.
  • --print slithir / slithir-ssa print the new text format; slithir-text is removed. --solc-ast, which did not work, is removed.
  • The CLI exits with os._exit after flushing its output, skipping the interpreter's heap teardown; atexit handlers registered by plugins do not run.

Open items

Known limits:

Issues

Issues fixed (148)

Each has a regression test on this branch.

Closes #1927, closes #1775, closes #1800, closes #1566, closes #933, closes #690, closes #1482, closes #2586, closes #1805, closes #1811, closes #1333, closes #1652, closes #3137, closes #834, closes #1954, closes #1138, closes #2300, closes #2497, closes #864, closes #1003, closes #2777, closes #1950, closes #2563, closes #2501, closes #3163, closes #3160, closes #3103, closes #3082, closes #3064, closes #3054, closes #2954, closes #2839, closes #2838, closes #2837, closes #2836, closes #2810, closes #2796, closes #2757, closes #2752, closes #2750, closes #2749, closes #2721, closes #2712, closes #2674, closes #2659, closes #2650, closes #2647, closes #2646, closes #2645, closes #2644, closes #2643, closes #2618, closes #2598, closes #2562, closes #2544, closes #2538, closes #2535, closes #2528, closes #2527, closes #2509, closes #2425, closes #2379, closes #2378, closes #2375, closes #2369, closes #2291, closes #2282, closes #2257, closes #2241, closes #2217, closes #2214, closes #2209, closes #2204, closes #2202, closes #2195, closes #2194, closes #2193, closes #2192, closes #2139, closes #2130, closes #2129, closes #2128, closes #2100, closes #2095, closes #2089, closes #2059, closes #2050, closes #2046, closes #2037, closes #2016, closes #2011, closes #1987, closes #1985, closes #1966, closes #1931, closes #1923, closes #1910, closes #1851, closes #1829, closes #1827, closes #1822, closes #1810, closes #1807, closes #1798, closes #1797, closes #1794, closes #1751, closes #1742, closes #1708, closes #1688, closes #1683, closes #1631, closes #1622, closes #1541, closes #1537, closes #1469, closes #1436, closes #1331, closes #1199, closes #1078, closes #1056, closes #981, closes #934, closes #891, closes #884, closes #883, closes #735, closes #583, closes #582, closes #552, closes #543, closes #515, closes #473, closes #468, closes #434, closes #365, closes #1512, closes #1701, closes #2755, closes #2233, closes #941, closes #865, closes #1916, closes #2780, closes #3041, closes #1338, closes #1646, closes #465

Issue Area Evidence
#1927 Yul CFG Yul return/revert/stop/invalid/selfdestruct end the CFG path (tests/unit/solc_parsing/yul/test_halting_builtins.py)
#1775 Yul / legacy AST legacy-AST (solc < 0.6) inline assembly parsed from source into Yul IR; data dependency sees it (ZosProxy test)
#1800 reentrancy non-reentrant annotation through _tokens[i] (57d40afc0, detector test)
#1566 reentrancy stale token balances read across a reentrant call escalate to no-eth, incl. SafeERC20 encodings (token_balance_delta.sol)
#933 reentrancy token-call hazards tagged [token call] / token_call in JSON
#690 reentrancy token-call hazards tagged in findings
#1482 reentrancy cross-function reentrancy-events test
#2586 typed core API DataLocation enum (string-valued; set_location(str) deprecated)
#1805 typed core API DataLocation, Visibility, ContractKind enums
#1811 typed core API value-type parameters and returns have the default location, not memory
#1333 typed core API Variable.is_dynamic
#1652 typed core API Contract.using_for_directives with source mappings
#3137 filtering / inputs / ecrecover ignore comments matched before path filtering; unused ones only in kept files (tests/unit/core/test_filtering.py)
#834 filtering / inputs / ecrecover /* slither-disable-* */ block comments (test_filtering.py)
#1954 filtering / inputs / ecrecover --diff REF keeps results on changed lines (test_filtering.py)
#1138 filtering / inputs / ecrecover triage database keyed without absolute paths (test_filtering.py)
#2300 filtering / inputs / ecrecover triage keys use element type, name, parent and relative file, not lines
#2497 filtering / inputs / ecrecover --detect a,b sorted by impact; every e2e result checked filterable
#864 filtering / inputs / ecrecover solc JSON output loaded by the SolcOutput platform (slither/solc_parsing/compiler_output.py)
#1003 filtering / inputs / ecrecover solc --combined-json / standard JSON output as targets
#2777 filtering / inputs / ecrecover slither-read-storage out.json on standard JSON
#1950 filtering / inputs / ecrecover ecrecover-malleable where signature bytes key a used-set (e2e 0.8.20, 0.4.25)
#2563 API / IR design all listed items: typed call targets, SolidityCall out of internal_calls, ternary lowering, filtering stage, rename, flows, data flow graph, Call API
#2501 filtering / inputs / ecrecover --solc-ast removed; JSON targets load through SolcOutput
#3163 reentrancy-eth / resolution tests/unit/detectors/test_detector_precision.py, tests/unit/solc_parsing/resolution/test_binding.py
#3160 Vyper frontend tests/e2e/vyper_parsing/test_data/modules/ownable.vy
#3103 using-for / IR typing tests/unit/slithir/test_data/ir/calls.sol
#3082 using-for tests/unit/solc_parsing/resolution/test_binding.py test_using_for_merges_bases_3082
#3064 signatures tests/unit/utils/test_data/signature_types.sol
#3054 incorrect-exp / incorrect-shift tests/e2e/detectors/test_data/incorrect-exp/0.8.28/incorrect_exp_yul.sol, incorrect-shift/0.8.28/shift_yul_operands.sol
#2954 name resolution tests/unit/solc_parsing/resolution/test_binding.py (issues/i2954)
#2839 Yul resolution tests/unit/slithir/test_data/ir/calls.sol
#2838 modifier binding tests/unit/solc_parsing/resolution/test_data/cases/qualified_modifier.sol
#2837 Yul lowering tests/unit/solc_parsing/yul/test_data/external_references.sol
#2836 ternary lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2810 evaluation order tests/unit/slithir/test_data/ir/issue_regressions.sol, tests/unit/slithir/interpreter/test_data/divergences/tuple_component_order.sol
#2796 Vyper frontend tests/e2e/vyper_parsing/test_data/builtins.vy
#2757 name resolution (hang) tests/unit/solc_parsing/resolution/test_binding.py test_bases_bind_by_id_2757
#2752 slither-flat tests/unit/tools/test_flattening_patches.py
#2750 slither-flat tests/unit/tools/test_flattening_patches.py
#2749 slither-flat tests/unit/tools/test_flattening_patches.py
#2721 constant folding / echidna tests/unit/slithir/test_data/bytes_constants.sol
#2712 timestamp tests/unit/detectors/test_detector_precision.py
#2674 slither-mutate tests/tools/mutator/test_mutator.py
#2659 constable-states tests/e2e/detectors/test_data/constable-states/0.8.0/storage_pointer_library.sol
#2650 name resolution tests/unit/solc_parsing/resolution/test_binding.py (issues/i2650)
#2647 ternary lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2646 constant folding tests/unit/slithir/interpreter/test_data/divergences/large_literal_operands.sol
#2645 builtins tests/unit/slithir/test_data/ir/builtin_types.sol
#2644 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2643 tuple lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2618 reentrancy tests/e2e/detectors/test_data/reentrancy-eth/0.7.6/issue_2618_mutex.sol
#2598 storage pointers tests/unit/analyses/ui/storage_pointer/libraries.sol
#2562 name resolution tests/unit/solc_parsing/resolution/test_binding.py (issues/i2562)
#2544 reentrancy tests/e2e/detectors/test_data/reentrancy-no-eth/0.8.28/issue_2544_*.sol
#2538 literal text tests/unit/core/test_literal.py
#2535 unused-import tests/e2e/detectors/test_data/unused-import/0.8.16/ (detector re-registered)
#2528 Vyper 0.4 tests/e2e/vyper_parsing/ (Vyper 0.4.3)
#2527 function type text tests/unit/core/test_function_type.py
#2509 SSA tests/unit/slithir/test_data/ir/ssa_control_flow.sol (test_issue_2509_…)
#2425 timestamp / incorrect-equality tests/unit/detectors/test_detector_precision.py
#2379 Vyper / constable-states tests/unit/detectors/test_vyper_regressions.py
#2378 Vyper frontend tests/e2e/vyper_parsing/test_data/calls.vy
#2375 Vyper frontend tests/e2e/vyper_parsing/test_data/calls.vy
#2369 Yul scoping tests/unit/slithir/interpreter/test_data/divergences/yul_sibling_block_functions.sol
#2291 unused-state tests/e2e/detectors/test_data/unused-state/0.8.28/calldata_slice_bounds.sol
#2282 suicidal (is_protected) tests/e2e/detectors/test_data/suicidal/0.8.28/suicidal_access_control.sol
#2257 PDG printer tests/unit/analyses/dataflow/test_pdg.py
#2241 storage pointers tests/unit/analyses/ui/storage_pointer/libraries.sol
#2217 name resolution tests/unit/solc_parsing/resolution/test_binding.py
#2214 arbitrary-send-eth (is_protected) tests/e2e/detectors/test_data/arbitrary-send-eth/0.8.28/arbitrary_send_eth_sender_argument.sol (part 2 was answered as benign)
#2209 call resolution tests/unit/slithir/test_data/ir/issue_regressions.sol
#2204 name resolution tests/unit/solc_parsing/resolution/test_binding.py (issues/i2204)
#2202 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2195 Vyper frontend tests/e2e/vyper_parsing/test_data/issue_regressions.vy
#2194 Vyper frontend tests/e2e/vyper_parsing/test_data/issue_regressions.vy
#2193 Vyper frontend tests/e2e/vyper_parsing/test_data/issue_regressions.vy
#2192 Vyper frontend tests/e2e/vyper_parsing/test_data/issue_regressions.vy
#2139 unused-return tests/e2e/detectors/test_data/unused-return/0.8.15/unused_return_destructuring.sol
#2130 slither-flat tests/unit/tools/test_flattening_patches.py
#2129 member lowering tests/unit/slithir/test_data/ir/builtin_types.sol
#2128 named arguments tests/unit/slithir/interpreter/test_data/divergences/named_constructor_arguments.sol, named_args_order.sol
#2100 Yul scoping tests/unit/slithir/test_data/ir/issue_regressions.sol
#2095 slither-check-erc tests/unit/tools/test_erc_conformance_getter.py
#2089 using-for types tests/unit/slithir/test_data/ir/using_for_array_length.sol
#2059 CFG tests/unit/slithir/test_data/ir/control_flow.sol
#2050 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#2046 call options tests/unit/slithir/interpreter/test_data/divergences/named_value_and_gas.sol
#2037 constant folding tests/unit/core/test_data/constant_folding/constant_folding_conversions.sol
#2016 literal types tests/unit/slithir/test_data/ir/literal_types.sol
#2011 CLI errors tests/unit/test_main.py
#1987 cache-array-length tests/e2e/detectors/test_data/cache-array-length/0.8.17/storage_alias.sol
#1985 name resolution tests/unit/solc_parsing/resolution/test_binding.py
#1966 member binding tests/unit/slithir/test_data/ir/contract_type_members.sol
#1931 literal types tests/unit/slithir/test_data/ir/literal_types.sol
#1923 call options tests/unit/slithir/interpreter/test_data/divergences/named_value_and_gas.sol
#1910 builtin types tests/unit/slithir/test_data/ir/builtin_types.sol
#1851 CFG / evaluation order tests/unit/slithir/test_data/ir/issue_regressions.sol
#1829 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1827 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1822 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1810 builtins tests/unit/slithir/test_data/ir/builtin_types.sol
#1807 reentrancy tests/e2e/detectors/test_data/reentrancy-eth/0.8.28/issue_1807_privileged_caller.sol
#1798 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1797 ternary lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1794 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1751 detector API tests/unit/detectors/test_scope.py
#1742 data dependency tests/unit/analyses/ui/data_dependency/interprocedural.sol
#1708 CFG tests/unit/slithir/test_data/ir/cfg_terminators.sol
#1688 literal types tests/unit/slithir/test_data/ir/issue_regressions.sol
#1683 SSA tests/unit/slithir/test_ssa_call_effects.py
#1631 CFG tests/unit/slithir/test_data/ir/control_flow.sol, tests/unit/slithir/interpreter/test_data/divergences/empty_if_branch.sol
#1622 name resolution tests/unit/solc_parsing/resolution/test_data/cases/same_names.sol
#1541 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1537 IR lowering tests/unit/slithir/test_data/ir/issue_regressions.sol
#1469 Yul lowering tests/unit/slithir/interpreter/test_data/divergences/calldata_offset.sol
#1436 data dependency / timestamp tests/unit/analyses/ui/data_dependency/lengths_and_literals.sol
#1331 echidna printer tests/e2e/printers/test_printers.py
#1199 cfg printer tests/e2e/printers/test_printers.py
#1078 slithir-ssa printer tests/e2e/printers/test_printers.py
#1056 Yul lowering tests/unit/slithir/interpreter/test_data/divergences/calldata_offset.sol
#981 missing-zero-check tests/e2e/detectors/test_data/missing-zero-check/0.7.6/base_constructor.sol
#934 reentrancy tests/e2e/detectors/test_data/reentrancy-eth/0.8.28/issue_934_cross_contract_state.sol
#891 dead-code tests/e2e/detectors/test_data/dead-code/0.8.0/function_values.sol
#884 uninitialized-local tests/unit/detectors/test_detector_precision.py
#883 external-function tests/e2e/detectors/test_data/external-function/0.6.8/external_function_abstract.sol
#735 reentrancy-benign tests/e2e/detectors/test_data/reentrancy-benign/0.8.28/benign_locked.sol
#583 CFG tests/unit/slithir/test_data/ir/cfg_terminators.sol
#582 Yul lowering tests/unit/slithir/test_data/ir/yul_words.sol
#552 IR (slices) tests/unit/slithir/test_ir_typing.py (IndexRange)
#543 Yul lowering tests/unit/slithir/test_data/ir/yul_words.sol
#515 storage alias API tests/unit/analyses/storage_pointer/test_storage_pointer.py
#473 SSA tests/unit/slithir/test_data/ir/ssa_control_flow.sol
#468 SSA tests/unit/slithir/test_data/ir/ssa_control_flow.sol
#434 SSA call effects tests/unit/slithir/test_ssa_call_effects.py
#365 data dependency (tracker) tests/e2e/detectors/test_data/uninitialized-local/0.8.0/uninitialized_local_variable_fields.sol; sub-issues #1436, #884 fixed here, #778 on master
#1512 constant folding keccak256 of a literal folds to a bytes32 constant that keeps its preimage (Constant.hash_preimage), through SSA and the text round trip (tests/unit/slithir/test_keccak_folding.py)
#1701 expression tree BinaryOperation/UnaryOperation/AssignmentOperation: .operator is the operator, .type the Solidity result type (tests/unit/hir/test_operations.py)
#2755 returned values API returns_source(binding, msg_sender) lists the return values that are msg.sender through locals, casts, merges, tuples and internal and library calls, resolved per binding (an ERC2771 _msgSender override is not); exact=False gives data dependency (tests/unit/analyses/test_returned_values.py)
#2233 printers --printer-filter REGEX on table rows, text and JSON (pyr/detector-cleanup tests)
#941 printers --printer-sort (pyr/detector-cleanup tests)
#865 printers modifiers, require and vars-and-auth skip state-initializer functions (pyr/detector-cleanup tests)
#1916 printers natspec printer; the typed AST keeps event and error documentation (pyr/detector-cleanup tests)
#2780 detectors memory-safe-comment (pyr/detector-cleanup tests)
#3041 incorrect-equality view and pure helpers no longer reported (pyr/detector-cleanup tests)
#1338 costly-loop assignment followed by a return in an if (pyr/detector-cleanup tests)
#1646 unprotected-upgrade checks whether selfdestruct functions are reachable directly (pyr/detector-cleanup tests)
#465 echidna printer state-variable initializer constants reported (pyr/detector-cleanup tests)
Issues fixed without a regression test (16)

Verified by running the issue's reproducer on master and on this branch, or by inspection where noted. These are not auto-closed.

Issue Area Evidence
#1613 static typing inspection: closed unions (SolidityType, AnyExpression, YulStatement) matched exhaustively with assert_never in 10 modules; ty strict at 0 diagnostics in CI
#3019 import alias import {X as Y} base: master AssertionError; tip inherits the alias
#2728 name resolution (hang) UniversalRouter (Sourcify 0x66a9…): master killed at 300 s; tip 2.8 s
#2490 try/catch CFG master TRY -> [2,4,6,8]; tip [2,4,6]
#2477 unused-import issue's project: master FP, tip none, 1 s; detector re-registered (8ebbae1)
#2216 using-for on this.balance solc 0.4.23: master Impossible / Unresolved; tip call.library L.g (fe14188)
#1913 tuple lowering multi-return reassignment uses the right tuple index
#1901 IR lowering Interface.test.selector lowered to a constant
#1795 is_protected mint calling mintFresh(msg.sender, a): master protected, tip not (5c1d9b1)
#1793 IR lowering x = arr.push(1) (solc < 0.6): no dangling temporary
#1511 typed AST inspection: slither/solc_parsing/ast converts both JSON flavors; parser reads no raw JSON
#1486 determinism all_internal_calls() identical under 5 hash seeds
#622 typing in CI inspection: make typecheck (ty, strict) required in CI
#593 IR lowering arr.push().push(): master fails; tip lowers it
#466 literal types / echidna echidna constant compared with an int: master uint256, tip int256
#294 CFG (short-circuit) && / `
Issues partly fixed (3)
Issue Area Fixed here / remaining
#1169 via-IR semantic changes Here: the evaluation-order detector. Remaining: the other listed changes (state-variable initialization order, modifier locals, …).
#443 arbitrary-send-eth Here: each finding shows the taint flow from its source to the destination (explain_tainted), so a reviewer can dismiss it from the output. Remaining: whether to keep or retune the detector's heuristics.
#759 printer CLI (tracker) Here: row filtering and sorting (#2233, #941) and the state-initializer filter (#865). Remaining: the tracker's other ideas.
Not addressed (1)
Issue Note
#1840 needs a run over the reentrancy exploit collection, matching each exploit to a finding; not done

🤖 Generated with Claude Code

0xalpharush and others added 29 commits November 30, 2026 20:08
The frontends no longer run ReadVar, WriteVar, FindCalls and the call
classification on every node: Node.track_expression_uses marks a node,
and the views are computed from its expression when first read. The
function-level views are computed from the nodes' on first read too.
Reading them warns (DeprecationWarning); get_summary keeps its
external calls without warning. Upgrading.md lists the IR
replacements.

SLITHER_SHADOW=1 compares the lazy views with the eager ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uninitialized-storage walked every path of the CFG and kept its state in
node.context, which was never cleared between runs. It now reports a
pointer used where its SSA version may be the declaration's, with the
def-use check of uninitialized-local (reaches_zero).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
unused-state reads the state variables an array length is written
with from constant_value.length_state_variables instead of running
ExportValues itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The detector compared the SSA index of the called value with 0, and for
a struct field it read the index of the reference, which numbers
temporaries: a field called after another field access was missed. It
also reported every state variable as the constructor receives it, even
one initialized at its declaration. A called value is now uninitialized
when its definition (or that of its struct, through merges and copies)
is none, or the constructor's entry value of a state variable without
initializer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The detector followed one path, taking the false branch of each if, so
'if (b) return; _;' was not reported. A modifier is now reported when a
node ending it is reachable from its entry without passing a placeholder
or a revert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'(bool ok, ) = dst.call("")' with ok never read was not reported: the
destructuring read the returned tuple. unchecked-lowlevel now also
reports a call whose success flag goes to locals that no operation reads,
following copies through the SSA def-use chains. Leaving the flag out of
the pattern is still a discard on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A setter that emits its event through an internal helper was reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A setter that emits its event through an internal helper was reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only expression statements of a loop body were searched, so a push in a
declaration ('S storage s = array.push();') went unseen and the loop was
reported; and any read of array.length counted as a change, so a loop
reading it in its body was not. The detector now looks for writes of the
length (push, pop), deletes of the whole array and non-view external
calls in every node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the state the function called in the assert writes itself counted:
assert(f()) with f calling a writer was missed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A function or modifier of a contract is a binding: binding.function is
its declaration and binding.contract the contract it is reached in.
Its calls are Call objects (slither.core.declarations.binding) with
their kind (CallKind) and what they reach there: binding.calls,
calls_at(node) and all_calls(), and Contract.all_calls().
Call.inline_callee is the single answer to the callee an internal or
library call runs, replacing storage_callee and its inline copies.

The tuple forms high_level_calls and all_high_level_calls and
HighLevelCall.destination_contract are deprecated, internal_calls and
library_calls are views over calls, and dispatch.resolve is private.
The in-tree users of the deprecated forms are ported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tx-origin reported a condition reading tx.origin itself, unless the same
condition read msg.sender anywhere. A copy of tx.origin compared with the
owner was missed, and so was 'tx.origin == owner && msg.sender == x',
while 'sender == tx.origin' with a copy of msg.sender was reported. Uses
of tx.origin and its copies (on the SSA definitions) are now reported
unless they are compared with msg.sender or a copy of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'uint8 y; y == 300' is always false and 'y != 300' always true, but
tautology only decided <, >, <= and >=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The return type was matched on its name ('[]', bytes, string), so a
struct holding bytes was taken as static. The ABI rule of the interpreter
(slither.slithir.interpreter.abi.is_dynamic) now decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fixture starts anvil on a free port (boxes share ports), waits
for it to answer, funds the test account with anvil_setBalance and
impersonates it for unsigned transactions. CI installs Foundry for the
tool tests instead of ganache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A private function or state variable of a base contract is not visible in
the derived one, so a local named like it shadows nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The printer listed only the conditions reading msg.sender directly, so a
check through _msgSender() did not appear. A Protected column gives
Function.is_protected, which follows such checks and modifiers. The
conditions are printed as written (Node.source_text), and a callee
reached through several calls is listed once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A high s only matters when the contract identifies a signature by its
bytes: ecrecover-malleable now reports an unbounded s only when the
function or a callee writes state keyed by a value computed from s, or
from what s is computed from (used[keccak256(sig)], used[r][s]), or
stores one. Keys from the digest or the recovered signer (nonces,
used digests, permits like Aave's) are not reported. Impact and
confidence are now Medium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
constant_functions excluded every function calling a helper with a
storage parameter, because all_state_variables_written missed the writes
made through it. It now attributes them to the call site (storage pointer
analysis), so a function passing storage to a helper that only reads it
is constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A body declared in a contract runs in every contract inheriting it.
The text now keeps the binding-invariant form of what its references
reach: the dispatch site of each call (dispatch = kind target from
@declarer) and of each function value of a block. The builder rebuilds
the sites, the comparison includes them, and the corpus round trip
checks that the rebuilt units pass check_dispatch. This is what a
body shared by several bindings needs to round-trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--warn-unused-ignores crashed with KeyError: 'id' once results became
deduplicated across compilation units (found triaging crytic#3137).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but function-id printed
the contracts of every unit, so a target with several units listed each
contract once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but modifiers covered every
unit, so a target with several units printed each one once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but not-pausable covered every
unit, so a target with several units printed each one once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but variable-order covered every
unit, so a target with several units printed each one once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but constructor-calls covered every
unit, so a target with several units printed each one once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slither runs a printer once per compilation unit, but require covered every
unit, so a target with several units printed each one once per unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xalpharush and others added 26 commits December 1, 2026 10:48
…ding

The interpreter runs an internal or modifier call, and reads a function
value, as the binding its frame runs reaches it (Call.target, and
binding.function_value for the dispatch site of a function value)
instead of taking the IR's target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The call graph printer, echidna's constant functions, the upgradeability
initializer check, the reentrancy custom calls and self calls, ecrecover's
wrappers and the binding classes read ir.function or ir.called_function,
which a body shared across contracts resolves in its declarer. They now
take Call.target in the binding they walk. The IR text printer and compare
show the modifier a statement runs in the binding (modifier_of), and the
taint oracle compares the owners of labels by declaration.

The lookups of events, `using for` and `Contract.x` state variables in the
conversion take the declaring contract: names resolve where a body is
written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
keccak256("...") in a function body now folds to a bytes32 Constant
(crytic#1512), which the slot analyses read only as integers: such a slot became
unknown and every storage read depended on its writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slither.core.expressions becomes slither.hir, the typed high-level IR
the Solidity, Yul and Vyper parsers build and the lowering reads.
slither/core/expressions.py re-exports it: the old package and each of
its submodules are the new modules, so code outside Slither keeps
working. Slither itself imports slither.hir, and the import allow-list
test moves to tests/unit/hir with the new path. Upgrading.md documents
the move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The allow-list becomes a freeze: the importers of the expression tree
are grouped by role (producers, synthesized code, holders, lowering,
pre-IR constants, syntax detectors), and a module outside them fails
the test. Slither must import slither.hir rather than its former
location, and the former location must be the same modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An inherited function or modifier is no longer re-parsed per contract.
Each declaration is parsed, lowered and put in SSA form once; a contract
lists a binding of it (slither.core.declarations.bound) that shares the
body and keeps its own contract, calls, caches, SSA links, context,
overrides and reachability.

- SSA is built unit-wide: a declaration sees the state variables of every
  contract running it, a call defines what any binding's callee may
  write, and state versions are numbered across the unit.
- Bindings are linked per contract, also when SSA is read as written.
- this.x() reaches a public variable getter overriding x (Call.target).
- References through dispatch sites are bound in inheriting contracts.
- The IR text frontend binds inherited Solidity functions too.
- dispatch_check no longer compares copies; the id deduplication of
  inherited elements is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A node names its declaration, whose contract is the declarer: the
arbitrary-send-erc20 and weak-prng detectors pass the binding's
contract instead, as the per-contract copies did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BinaryOperation.type and UnaryOperation.type held the operator. The
operator is now .operator; .type is the type of the result, solc's
typeString or Vyper's annotation (crytic#1701).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AssignmentOperation.type held the operator, like BinaryOperation and
UnaryOperation did. The operator is now .operator; .type is the type of
the result, solc's typeString or Vyper's annotation of the target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The accesses of a shared node are filtered to the state variables of
the binding's contract; a library declares none and runs on the storage
of its callers, so its bindings are not filtered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
returned_values(binding) gives the one value each return value is on
every path that returns (a Solidity variable, a parameter, or None),
through copies, address casts, merges, tuples and internal and library
calls resolved in the binding's contract. returns_source(binding,
source) lists the returns that are source; exact=False uses the data
dependency instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A load of a memory location took the references stored at every location
that may alias it, including those above and below it: reading a[i] also
returned the strings stored in a[i].symbol. In a loop that stores strings
into the fields of a struct element, the element then pointed to the
strings, and the field-by-field copy into them nested the struct's fields
under each string field up to the path depth: 11631 paths in
UiPoolDataProviderV3.getReservesData, 27 s of data dependency on Aave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xalpharush
0xalpharush marked this pull request as ready for review December 1, 2026 23:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant