documentation

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

FieldValue
Auditor ModelClaude Opus 5.5
Audit Timestamp2026-11-24T08:02:53+02:00
Target NetworkArbitrum One (Chain ID 42161, EVM cancun, Solidity 0.8.24, viaIR, optimizer 200 runs)
Deployed Exchange0x53F312fbd4a06460b76fCBD8719232BD1765C4ae (first code at block 527031640, startBlock 527031637, 20,463 / 24,576 bytes)
Source VerificationVerified on Arbiscan. Independently confirmed byte-for-byte match against local solc 0.8.24 build (apart from immutables) with identical CBOR metadata hash.
Deployed PriceOracleBTC: 0x80b564B653B60D8Cb0D54b4237c74CB2e215893d · ETH: 0xE30AA58aabBD88EEa35D4131a38c0dD1b474d0eF (maxAge = 3600s, sequencer feed 0xFdB6…697D)
Git Commit39b95fd0e2ef36f665ea1360e22dd22af5a32166
Exchange.sol SHA-2565523f1bcfd25dea78cc1fb1836e3ca5e851b3b1923b9039863f110ae8c339a51 (1,469 lines)
PriceOracle.sol SHA-256ffa33bdc18b474db4af1e92c50b58a749a82d5fdfb3f26fa561f19df804eaa2d (141 lines)
Verification Suite103 / 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 DimensionVerdictAssessment
Unprivileged Exploitability0 Critical · 0 High · 0 MediumNo outside party can steal collateral, mint unbacked claims, claim yield twice, forge or replay signatures, or pick a resolution.
Privileged-Key Compromise0 Critical · 0 High · 0 MediumA 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 BackingVerifiedDated 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 SafetyNon-CustodialNo function moves a user’s collateral or units without that user’s signature or call. depositFor only adds.
Market Resolution IntegrityTrustless & PermissionlessWrite-once settle, per-market oracle snapshot, unique expiry round / in-window touch.
Perpetual Rate GovernanceBounded7-day cooldown, +1,000 bps upward step, decayBase snapshot, orders signed at old rate become invalid.
Fund-Lock ResistanceVerifiedEvery 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

#InvariantStatusVerification
1Dated SolvencyHOLDS_settleMint debits yesNet + noNet == fillSize; split/merge 1:1; void pays ⌊(yes+no)/2⌋. 400-step fuzz (AuditPoC.js).
2Perpetual SolvencyHOLDSSame D for Yes payout and No index, including D = 0. Verified by 9-year decay test in AuditPoC4.js.
3Unit ConservationHOLDSΣ yes_u == Σ no_u == openShares while open across all mints, splits, merges, and closes.
4Order Authorization & TermsHOLDS_isOrderSigner (EOA, 100k-gas-capped EIP-1271, ApproveAgent) + _checkTerms on both orders.
5No Overfill or ReplayHOLDSfilled[h] + fillSize ≤ size per leg; dust sweeps do not raise filled past size (AuditPoC5.js).
6Inventory Close SafetyHOLDSClamp only lowers fillSize; dust sweep only moves remainder worth <1 raw USDC; bal == 0 reverts.
7Fee & Gas BoundsHOLDS_checkFee per leg; lifetime gasCharged budget per order.
8Deterministic ResolutionHOLDSWrite-once settle, snapshotted oracle, time-gated voids.
9Reentrancy SafetyHOLDSAll state-changing externals are nonReentrant; ERC-1155 callbacks removed; EIP-1271 staticcall gas-capped.
10Privileged Roles Cannot Create ValueHOLDSBack-dated perpetuals rejected (BadWindow); redeem pays strictly _decayFactor(m).

3. Round 4 Remediations & Round 5 Findings

IDTitleSeverityStatus
C4-H-01redeem treated settledDecay == 0 as no decayHighFixed
C4-L-01Dated hits not voidable; No depends on sequencer feedLowFixed
C4-I-01Unbounded EIP-1271 gasInfoFixed
C4-I-02ERC-1155 surface (static-unit balanceOf, hooks)InfoRemoved
C4-I-04_expNegWad comment wordingInfoFixed
C5-L-0130-day hit void lets losing side take $0.50/share if unsettled for 30 daysLowOpen (mitigated by keeper + permissionless settle(id, 0))
C5-L-02operator and tradeAdmin are single EOAs; immediate setTradeAdminLowOpen (operational — multisig/governance recommended)
C5-L-03Perpetual Yes payout uses D at settle time, not touch timeLowOpen (anyone can settle promptly)
C5-L-04Off-chain trust: taker choice, tif/orderType, 2h LATE_SETTLE_WINDOWLowAcknowledged design

Informational Notes