Audit Report — Claude Opus 5.5 (v2.1)
Independent smart contract security audit of Arizal Exchange v2.1 on Arbitrum One, including byte-for-byte bytecode verification and Round 4 remediation review.
Audit Metadata
| Field | Value |
|---|---|
| Auditor Model | Claude Opus 5.5 |
| Audit Timestamp | 2026-11-24T08:02:53+02:00 |
| Target Network | Arbitrum One (Chain ID 42161, EVM cancun, Solidity 0.8.24, viaIR, optimizer 200 runs) |
Deployed Exchange | 0x53F312fbd4a06460b76fCBD8719232BD1765C4ae (first code at block 527031640, startBlock 527031637, 20,463 / 24,576 bytes) |
| Source Verification | Verified on Arbiscan. Independently confirmed byte-for-byte match against local solc 0.8.24 build (apart from immutables) with identical CBOR metadata hash. |
Deployed PriceOracle | BTC: 0x80b564B653B60D8Cb0D54b4237c74CB2e215893d · ETH: 0xE30AA58aabBD88EEa35D4131a38c0dD1b474d0eF (maxAge = 3600s, sequencer feed 0xFdB6…697D) |
| Git Commit | 39b95fd0e2ef36f665ea1360e22dd22af5a32166 |
Exchange.sol SHA-256 | 5523f1bcfd25dea78cc1fb1836e3ca5e851b3b1923b9039863f110ae8c339a51 (1,469 lines) |
PriceOracle.sol SHA-256 | ffa33bdc18b474db4af1e92c50b58a749a82d5fdfb3f26fa561f19df804eaa2d (141 lines) |
| Verification Suite | 103 / 103 passing Hardhat tests, including AuditPoC4.js (3 tests) and AuditPoC5.js (4 tests) |
1. Executive Summary & Security Verdict
This audit covers the redeployed v2.1 Exchange at 0x53F312fbd4a06460b76fCBD8719232BD1765C4ae, verifying all Round 4 remediations (C4-H-01, C4-L-01, C4-I-01, C4-I-04), the removal of ERC-1155 in favor of packed internal storage (_pos[marketId][user] = { uint128 yes; uint128 no }), zero-dust close and merge sweeps, and depositFor(recipient, amount).
Result: C4-H-01 is fixed with both attack paths closed by three independent controls. No Critical, High, or Medium findings remain.
| Security Dimension | Verdict | Assessment |
|---|---|---|
| Unprivileged Exploitability | 0 Critical · 0 High · 0 Medium | No outside party can steal collateral, mint unbacked claims, claim yield twice, forge or replay signatures, or pick a resolution. |
| Privileged-Key Compromise | 0 Critical · 0 High · 0 Medium | A compromised tradeAdmin or operator can no longer create unbacked value (back-dating reverts BadWindow). Remaining trust is limited to taker choice, off-chain order flags, and capped fees. |
| 100% Collateral Backing | Verified | Dated markets: $1 per pair. Perpetual markets: u·D + u·(1 − D) = u for every monotone D, including D = 0 (Yes pays 0, No has collected u). Dust sweeps only move existing units. |
| Custody & Withdrawal Safety | Non-Custodial | No function moves a user’s collateral or units without that user’s signature or call. depositFor only adds. |
| Market Resolution Integrity | Trustless & Permissionless | Write-once settle, per-market oracle snapshot, unique expiry round / in-window touch. |
| Perpetual Rate Governance | Bounded | 7-day cooldown, +1,000 bps upward step, decayBase snapshot, orders signed at old rate become invalid. |
| Fund-Lock Resistance | Verified | Every dated market (Hit included) reaches settle or voidMarket (7d for Above/Between, 30d for Hit). Perpetuals keep merge, claimYield, touch settle, and redeem. |
2. Formal Invariant Verification Matrix
| # | Invariant | Status | Verification |
|---|---|---|---|
| 1 | Dated Solvency | HOLDS | _settleMint debits yesNet + noNet == fillSize; split/merge 1:1; void pays ⌊(yes+no)/2⌋. 400-step fuzz (AuditPoC.js). |
| 2 | Perpetual Solvency | HOLDS | Same D for Yes payout and No index, including D = 0. Verified by 9-year decay test in AuditPoC4.js. |
| 3 | Unit Conservation | HOLDS | Σ yes_u == Σ no_u == openShares while open across all mints, splits, merges, and closes. |
| 4 | Order Authorization & Terms | HOLDS | _isOrderSigner (EOA, 100k-gas-capped EIP-1271, ApproveAgent) + _checkTerms on both orders. |
| 5 | No Overfill or Replay | HOLDS | filled[h] + fillSize ≤ size per leg; dust sweeps do not raise filled past size (AuditPoC5.js). |
| 6 | Inventory Close Safety | HOLDS | Clamp only lowers fillSize; dust sweep only moves remainder worth <1 raw USDC; bal == 0 reverts. |
| 7 | Fee & Gas Bounds | HOLDS | _checkFee per leg; lifetime gasCharged budget per order. |
| 8 | Deterministic Resolution | HOLDS | Write-once settle, snapshotted oracle, time-gated voids. |
| 9 | Reentrancy Safety | HOLDS | All state-changing externals are nonReentrant; ERC-1155 callbacks removed; EIP-1271 staticcall gas-capped. |
| 10 | Privileged Roles Cannot Create Value | HOLDS | Back-dated perpetuals rejected (BadWindow); redeem pays strictly _decayFactor(m). |
3. Round 4 Remediations & Round 5 Findings
| ID | Title | Severity | Status |
|---|---|---|---|
C4-H-01 | redeem treated settledDecay == 0 as no decay | High | Fixed |
C4-L-01 | Dated hits not voidable; No depends on sequencer feed | Low | Fixed |
C4-I-01 | Unbounded EIP-1271 gas | Info | Fixed |
C4-I-02 | ERC-1155 surface (static-unit balanceOf, hooks) | Info | Removed |
C4-I-04 | _expNegWad comment wording | Info | Fixed |
C5-L-01 | 30-day hit void lets losing side take $0.50/share if unsettled for 30 days | Low | Open (mitigated by keeper + permissionless settle(id, 0)) |
C5-L-02 | operator and tradeAdmin are single EOAs; immediate setTradeAdmin | Low | Open (operational — multisig/governance recommended) |
C5-L-03 | Perpetual Yes payout uses D at settle time, not touch time | Low | Open (anyone can settle promptly) |
C5-L-04 | Off-chain trust: taker choice, tif/orderType, 2h LATE_SETTLE_WINDOW | Low | Acknowledged design |
Informational Notes
- C5-I-01 — Perpetual creation window: Perpetual markets must be created on chain within 24h of
startTs(handled automatically by the node upon market creation). - C5-I-02 —
depositFor: Third-party funding only adds collateral, but can make an unfunded standing order fillable again — use short expiries or on-chaincancelOrders(). - C5-I-03 — Inventory dust sweep: Moves <1 micro-USDC remainder (at most 999 raw units at 0.1¢, 0–1 raw at ≥50¢) to the buyer without raising
filled. - C5-I-04 — EIP-1271 100k gas cap: Covers Safe/Kernel/ECDSA smart accounts; heavy Solidity WebAuthn verifiers should use RIP-7212 or a session key.