Is Genius a Bug? Cracking the Code of P vs NP

On September 4, 2026, Notional Finance was attacked, resulting in a loss of approximately .73 million. All it took was one unsafe cast to exploit it.

Context

Notional uses fCash to represent cash claims and liabilities at a specific maturity. A cash receiver holds positive fCash balance, while a payer holds negative balance.

Root Cause

The core issue lives in ExchangeRate._convertToETH():

function _convertToETH(Rate memory er, uint256 baseDecimals, int256 balance) internal view returns (int256) {
    uint256 rate = _fetchExchangeRate(er, true);
    uint128 absBalance = uint128(balance.abs()); // Truncation flaw!
    int256 result = int256(SafeCast.toUint128(rate.mul(absBalance)...));
    return balance > 0 ? result : result.neg();
}

The liability reached exactly -2^128. Narrowing this 256-bit absolute value to uint128 overflows and truncates to 0! The free collateral check fc >= 0 passed, allowing an undercollateralized account to establish huge claims and drain reserves.

Key Takeaway: Whenever an EVM contract casts a higher-width integer (like int256 or uint256) into a narrower width (like uint128), it must use OpenZeppelin's SafeCast library or check explicit bounds.