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)
ERC4626_INFLATION: Add virtual share/asset offset (VIRTUAL_SHARES/VIRTUAL_ASSETS) into share conversion math to block first-depositor donation inflation.ROUNDING_DIRECTION: Fix Morpho-style borrow share truncation by rounding UP against the borrower (mulDivUp/(a * b + c - 1) / c).READ_ONLY_REENTRANCY: Enforce Checks-Effects-Interactions (decrementtotalSupplyandpoolEthstrictly before external ETH.call{value: ...}) plus a reentrancy lock protecting bothwithdrawand view pricing (getVirtualPrice).SPOT_ORACLE_MANIPULATION: Replace flash-loan-manipulable AMM spot reserve ratio (getReserves()) with a manipulation-resistant TWAP / Chainlink oracle interface.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
solccompilation when available (solc/~/.svm/*/solc-*), with strict structural Solidity verification fallback — syntax errors or non-compiling patches score0.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.0000vs naive copy / comment-hack baselines at0.0000(+1.0000separation).