0

Solidity Patch Swe Env

Fresh

Verifiers v1 executable Solidity vulnerability repair SWE environment: models must patch real DeFi security flaws (ERC-4626 inflation, Morpho debt ...

Type
RL Env
Publisher
Primew
License
mit
Size
v0.1.0
Published
Nov 2026
Updated
Nov 2026

Cite

Notes

Only stored in your browser.

solidity-patch-swe-env (verifiers v1)

Executable Solidity Smart-Contract Vulnerability Repair (SWE) RL environment for the Prime Intellect Environments Hub.

Overview

Unlike classification-only audit benchmarks, this environment requires the model to output a complete, compilable, patched Solidity ^0.8.24 contract inside <patch>...</patch> that fixes a concrete DeFi vulnerability while preserving the contract's exact public ABI and functional invariants.

5 Parameterized DeFi Bug-Repair Classes (40 Deterministic Tasks)

  1. ERC4626_INFLATION: Add virtual share/asset offset (VIRTUAL_SHARES / VIRTUAL_ASSETS) into share conversion math to block first-depositor donation inflation.
  2. ROUNDING_DIRECTION: Fix Morpho-style borrow share truncation by rounding UP against the borrower (mulDivUp / (a * b + c - 1) / c).
  3. READ_ONLY_REENTRANCY: Enforce Checks-Effects-Interactions (decrement totalSupply and poolEth strictly before external ETH .call{value: ...}) plus a reentrancy lock protecting both withdraw and view pricing (getVirtualPrice).
  4. SPOT_ORACLE_MANIPULATION: Replace flash-loan-manipulable AMM spot reserve ratio (getReserves()) with a manipulation-resistant TWAP / Chainlink oracle interface.
  5. ORACLE_DECIMAL_MISMATCH: Normalize 6- or 8-decimal Chainlink price feeds to 18 decimals (10 ** (18 - decimals)) and enforce positive price validation (price > 0).

Anti-Reward-Hacking Verifier Gates

  • Hard Compile Gate: Real solc compilation when available (solc / ~/.svm/*/solc-*), with strict structural Solidity verification fallback — syntax errors or non-compiling patches score 0.0.
  • ABI Preservation Gate: Deleting or renaming the contract or target function scores 0.0.
  • Unpatched / Comment-Hack Gate: Copying the buggy code or inserting comments without fixing the actual expression scores 0.0.
  • Clean Separation: Verified reference patch policy scores 1.0000 vs naive copy / comment-hack baselines at 0.0000 (+1.0000 separation).