Create and explore imaginative 3D worlds with our new product Dreamfield (opens in a new tab)
Papers
Topics
Authors
Recent
Search
2000 character limit reached

ParityFuzz: Finding Inconsistencies across Solidity Compilers via Fine-Grained Mutation and Differential Analysis

Published 9 May 2026 in cs.SE | (2605.09051v1)

Abstract: The Solidity smart contract ecosystem has rapidly grown, leading to multiple compilers targeting different blockchain platforms or improving compilation efficiency. Although many compilers aim to be compatible with the primary Solidity compiler (Solc), significant inconsistencies in compilation and execution remain. These inconsistencies hinder contract migration, mislead developers during debugging, and may introduce exploitable vulnerabilities, causing financial losses. Existing testing techniques mainly focus on bugs within a single compiler or perform differential testing in the same execution environment. However, they are insufficient for detecting cross-compiler inconsistencies, as they lack mechanisms to explore triggering conditions and compare bytecode across environments. We propose ParityFuzz, a cross-compiler differential testing framework for Solidity. It operates in three stages. First, it derives mutation rules, including syntax- and boundary-oriented rules, by analyzing compilers and execution environments. Second, it uses reinforcement learning to select effective mutation rules for test generation. Third, it compiles and executes programs across multiple compilers, then normalizes and compares results to detect inconsistencies. Our evaluation shows ParityFuzz is efficient and effective. It achieves up to 18x higher compilation success rate and 1.8x higher code coverage than state-of-the-art fuzzers. It uncovers 64 previously unknown inconsistencies across six compilers. Notably, 11 issues have been fixed, and our findings received a bounty from the Polkadot community.

Citations (1)

Summary

  • The paper introduces ParityFuzz, combining LLM-derived syntax and boundary mutation rules, GRPO-based rule selection, and an execution-normalized differential oracle to compare six Solidity compilers across heterogeneous blockchain platforms.
  • ParityFuzz uncovered 64 previously unknown inconsistencies—31 compilation-status, 14 execution-status, and 19 execution-output issues—with 27 confirmed by developers and 11 fixed, including potential denial-of-service and token-balance vulnerabilities.
  • The framework outperformed four existing fuzzers, finding 31 compilation inconsistencies versus at most 5 for competitors while achieving up to 18× higher compilation success and 1.8× greater code coverage, though it relies on Solc as a baseline and manual false-positive filtering.

ParityFuzz addresses a gap in smart-contract compiler testing: the detection of behavioral inconsistencies across Solidity compilers that target different blockchain platforms. While prior fuzzers such as POLYGLOT, FUZZOL, afl-compiler-fuzzer, and solc_ossfuzz detect bugs within a single compiler, or perform differential testing only among compilers targeting the same execution environment, none of them can systematically compare compilers that emit bytecode for heterogeneous executors. ParityFuzz is designed to fill this gap through fine-grained, boundary-aware mutation combined with an execution-based differential oracle.

Motivation and problem formulation

The paper studies six widely deployed Solidity compilers: Solc (EVM), Revive (Polkadot/PolkaVM), Zksolc (ZKsync/ZKEVM), Solang (Solana/SVM), Sold (Everscale/TVM), and Solar (an optimizing Solc reimplementation). The authors estimate that the ecosystems these compilers serve hold over $100 billion in total value locked, motivating the security relevance of cross-compiler consistency.

The central observation is that although compilers produce platform-specific bytecode, their interpretation of Solidity syntax should be consistent. Divergences typically arise at corner cases involving boundary conditions in compiler and executor source code, such as unimplemented!() branches, assertions, and validity checks. The paper classifies inconsistencies into four types:

  • Error Message Inconsistency (EMI): both compilers fail, but one produces a clear diagnostic while the other does not.
  • Compilation Status Inconsistency (CSI): one compiler accepts code that another rejects.
  • Execution Status Inconsistency (ESI): bytecode from one compiler executes while the other's fails at runtime.
  • Execution Output Inconsistency (EOI): both bytecodes execute but yield different results.

A motivating example shows Solc accepting a struct containing a user-defined value type while Solang's storage_align routine reaches an unimplemented!() branch. The authors conclude that triggering inconsistencies requires both syntactically diverse programs and programs that reach boundary conditions — the two properties their mutation strategy is designed to produce.

Framework design

ParityFuzz operates in three stages.

Mutation rule generation

Rules are derived by analyzing the source code of compilers and executors with LLM assistance, in two categories. Syntax-oriented (SO) rules are generated per Solidity language feature (e.g., struct, fixed-size array, internal function) and enumerate mutation points with five action types (insert, increase, replace, modify, clear); they ensure syntactic diversity. Boundary-oriented (BO) rules are built on top of SO rules and target specific boundary conditions.

The stepwise design responds to two challenges with direct LLM analysis of boundary code: rule vagueness (e.g., "insert unsupported types") and incompleteness (a single code block may contain multiple boundary conditions with multiple triggering methods). ParityFuzz embeds one boundary condition and one SO rule per prompt, forcing the LLM to either reuse or refine a clear, simple rule. Boundary condition extraction combines manual identification of explicit conditions (via identifiers such as error, panic, unimplemented, unreachable, assert) with LLM-assisted extraction of implicit ones such as type-casting and out-of-bounds memory access.

Fine-grained mutation

Rule selection is hierarchical: an LLM first identifies which language features a seed program contains, then selects a rule under the chosen feature, ensuring applicability. Mutation is performed by a separate LLM, and programs that fail to compile with Solc are iteratively repaired by feeding compiler diagnostics back to the LLM. The repair step is justified on the grounds that programs must compile with Solc to be capable of revealing cross-compiler differences.

Rule selection is optimized via GRPO-based reinforcement learning fine-tuning of the rule-selection model. The reward assigns +1 to programs triggering an inconsistency, −1 to false positives or Solc compilation failures, and otherwise the Solc-coverage delta between the original and mutated program (bounded to [−1, 1]). GRPO is chosen over PPO to avoid a separate value model, and a direct reward function replaces a learned reward model.

Execution-based detection

Solc serves as the reference compiler. Compilation-result inconsistencies (EMI, CSI) are detected by comparing compiler outputs directly, with clear error messages recognized by keyword matching. Execution-result comparisons require output normalization: SVM outputs are Borsh-encoded while EVM, PolkaVM, and ZKEVM outputs are ABI-encoded, so ParityFuzz decodes both before comparison.

Two design choices control the oracle's precision. First, because Solang and Sold have limited Solc compatibility, CSI is only counted when their error messages are unclear, and ESI is only counted when a program succeeds under Solang but fails under Solc — asymmetric criteria that filter out expected incompatibility. Second, documented design-level differences from Solc (extracted from each compiler's documentation as feature patterns) are filtered out by automated pattern matching, so only undocumented divergences are reported. This false-positive elimination step is admittedly semi-automated and requires manual pattern extraction, a limitation the authors acknowledge.

Evaluation

The evaluation uses a 4,260-program seed corpus assembled from prior work, Solidity's historical bug dataset, and the official Solidity test suite, all compiling under Solc. Experiments ran on an Intel Xeon server with an RTX 4090 for local fine-tuning; ChatGPT-4o generates rules, Qwen2.5-Coder-7B-Instruct selects features, Qwen2.5-Coder-0.5B-Instruct selects rules (fine-tuned via GRPO), and Qwen-coder-plus performs mutation.

Detected inconsistencies (RQ1)

ParityFuzz reported 64 previously unknown inconsistencies: 34 in Solang, 15 in Revive, 9 in Zksolc, 4 in Sold, and 2 in Solar, spanning 31 CSI, 14 ESI, and 19 EOI (no EMI). Twenty-seven were confirmed by developers, 11 fixed, and the Revive findings earned a bug bounty from the Polkadot community. Solang dominates the counts, which the authors attribute to limited maintenance — only two of its reported issues were acknowledged and fixed.

Two case studies illustrate security impact. A Revive ESI arises when delegatecall targets an invalid address: Revive's executor throws CodeNotFound while the EVM proceeds, meaning contracts migrated to Polkadot can have critical operations blocked — a potential denial-of-service vector. A Solang EOI shows that delete data[0] on an array element resets the entire array's length to zero (Solc returns 2, Solang returns 0); in a token-balance contract, deleting one user's entry would erase all balances.

Comparison with state-of-the-art fuzzers (RQ2)

Against POLYGLOT, afl-compiler-fuzzer, FUZZOL, and solc_ossfuzz over a 4-day run counting only novel inconsistencies triggered by mutation, ParityFuzz found 31 compilation-result inconsistencies versus 5 (POLYGLOT), 3 (afl-compiler-fuzzer), 1 (solc_ossfuzz), and 0 (FUZZOL) — a 31× advantage over the next-best tool on execution-inclusive counts. On program quality (1,000 generated programs), ParityFuzz achieves up to an 18× higher compilation success rate and 1.8× greater code coverage than the baselines, attributed to its repair loop and dual rule sets. The authors candidly note one miss: POLYGLOT found an EMI (a Solc error lacking a clear message) by inserting public before constant, a specific mutation ParityFuzz's selector failed to choose. Coverage gains are modest relative to POLYGLOT (15.02%), which the authors argue is expected since their mutations target existing syntactic features rather than drastically restructuring programs; a mutated program with only 1.21% coverage increase still triggered an inconsistency.

Ablation study (RQ3)

Using five variants on 1,000 seeds with one mutation round, full ParityFuzz detected 17 inconsistencies versus 14 (BO rules only, or full rules without RL), 13 (SO rules only), 12 (random rule selection), and 11 (directly LLM-generated rules without the stepwise refinement). Each component — stepwise rule generation, dual rule sets, learned selection, and GRPO fine-tuning — contributes measurably. The gap between stepwise BO rules (14) and direct rules (11) supports the claim that staged prompt construction yields clearer and more complete rules.

Limitations and threats to validity

The paper identifies several constraints. The bundled executors (adapted from compiler test harnesses) differ from production nodes — Revive's bundled executor lacks precompiled contracts, so ripemd160 always returns 0 there, a discrepancy that does not exist on mainnet. False-positive elimination depends on manual pattern extraction from compiler documentation, though the authors note the documentation is concise enough that onboarding a new compiler is inexpensive. Some compilers lack usable execution environments: Sold's test node is non-functional due to bugs, and Solar does not yet generate bytecode, so execution inconsistencies cannot be tested for either. LLM nondeterminism is mitigated by fixed seeds and temperature, with repeated runs reproducing the same findings. An additional unstated dependency is the choice of Solc as the semantic baseline; divergences are defined relative to Solc's behavior, which is itself not a formal specification of Solidity semantics.

Conclusion

ParityFuzz is the first fuzzing framework explicitly targeting inconsistencies across Solidity compilers targeting heterogeneous execution environments. Its combination of LLM-derived syntax- and boundary-oriented mutation rules, GRPO-optimized rule selection, and a normalized cross-executor differential oracle yields strong empirical results: 64 unknown inconsistencies across six compilers, 27 confirmations, 11 fixes, and substantial quantitative improvements over prior fuzzers in both program quality and detection yield. The approach's reliance on manual false-positive filtering, per-compiler executor adaptation, and Solc as the implicit semantic ground truth remain the principal open questions for extending it to additional compilers and execution platforms.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.