Market Capacity#
The one canonical market size and the account-allocation prelude.
What capacity is#
Every market has exactly one size, defined in
program/src/state/canonical_market.rs:
| Item | Value |
|---|---|
| Trader seats | 8,193 (MARKET_SEATS) |
| Trader-ledger seat | 152 bytes (buckets, index fields, session) |
| Trader-ledger account | 1,247,528 bytes (64-byte header, two 1,064-byte bitmaps, and seats) |
| Order slots per arena | 4,096 (ORDERS_PER_ARENA) |
| Order slots, both sides | 8,192 (MARKET_ORDER_SLOTS) |
| Deep-orderbook account | 1,376,448 bytes (128-byte header + 2 arenas) |
The book account size is 192 + 336 * capacity bytes at the one canonical
capacity of 4,096 orders per arena.
Creators choose no capacity. There are no seat tiers, no book tiers, and no
num_seats, bids_size, or asks_size fields on CreateMarket. Every ledger
and book loader requires the exact account length and stored capacity, so an
oversized or undersized account is rejected.
The seat count is one more than the order-slot count (MARKET_SEATS > MARKET_ORDER_SLOTS, a compile-time assertion). Each locked seat is backed by at
least one live order, so a full ledger always contains a seat with no live-order
lock and permissionless admission keeps progressing.
Rent is the Solana rent-exempt minimum, (128 + size) * lamports_per_byte_year * 2.
At 6,960 lamports per stored byte the ledger locks about 8.23 SOL and the book
about 9.13 SOL. At 696 lamports per byte, the figures are about 0.823 and
0.913 SOL.
Rent figures are planning values, not constants. Do not embed them in code;
call calibrateRentRate / rentExemptLamports from @seesaw/core, which derive
the figure from a live getMinimumBalanceForRentExemption probe. See
constants for the calling pattern.
Monitor trader-ledger occupancy by market and alert before the ledger reaches 90% occupied. The strict headroom invariant means a full ledger contains at least one slot with no live-order lock. An all-zero slot is recycled by the allocator; otherwise a keeper may drain each nonzero free bucket in full to that slot owner's mint-matched token account. The last drain clears the slot, and clients can atomically bundle that drain with a new admission to avoid a race. Partial drains, locked slots, and redirection to the keeper remain forbidden. Existing balances remain governed by the normal settlement, withdrawal, cancel, reduce, reclaim, and redemption paths. User-facing surfaces should describe an admission failure as market capacity being full, not as lost funds.
Bulk-cancellation status#
CancelOwnerOrders (0x55) walks the owner's indexed orders and refunds bid
collateral and ask shares to the ledger free balances. Begin captures the
book's insertion-sequence cutoff and runs the first step. Each step can
examine up to 64 orders and remove up to 32. Use the finalized transaction's
program return data or its CancelSessionProgressed event to check complete.
Continue while complete is false, even if the last step cancelled no orders.
To recover a session after restarting, read the trader seat and continue
with its active nonce and the same owner or strategy scope. Orders placed at
or after the cutoff stay outside the session. The owner can abort an active
session or begin a new one. To move refunded balances to the wallet, review
the ledger balances and submit WithdrawFunds or WithdrawShares.
See the ABI inventory for the route and the bounded-work release record (unavailable reference) for acceptance status.
Refundable rent#
The creator pre-pays the ledger rent. When the market is closed after
resolution (CloseMarket), the trader_ledger rent (along with the market,
orderbook, and vault rent) is returned to the creator.
Allocation preludes#
Solana caps account growth at MAX_PERMITTED_DATA_INCREASE (10,240 bytes) per
top-level instruction. Before CreateMarket, callers must invoke
EnsureTraderLedgerSpace (0x2B) ceil(1247528 / 10240) = 122 times and
EnsureDeepOrderbookSpace (0x2C) ceil(1376448 / 10240) = 135 times to grow
the PDAs in chunks. Neither instruction carries a size: the target is compiled
in, and the payload is either empty (external-receipt form) or the 48-byte
native market binding [feed_id:32][duration_seconds:u64][preparation_timestamp_us:u64]. Both
are idempotent and a no-op once the PDA is at the canonical size. CreateMarket
rejects a child that is not exactly pre-grown. Each order slot is 128 bytes,
including its 16-byte client_order_id.
The prelude count is large, so split it across transactions before the final
CreateMarket. An abandoned native preallocation can be closed and refunded to
its creator with ClosePreallocatedChild (0x3A).
The TypeScript (@seesaw/core), Rust (sdk-rust), and Python (sdk-python)
SDKs provide allocation planners for this transaction sequence. See the
SDK create-market example.
CU launch-tier evidence#
Status. The artifact formats below predate the canonical market size and still enumerate seven book capacities. The validators remain on that shape until the bounded-work packages (OB-P02 onward) define the replacement evidence; a release candidate is blocked in the meantime by the
ob-bounded-workrelease blocker (seedocs/internal/release-blockers/ob-bounded-work.md).
Before a release-candidate signoff can raise the first-party launch tier above
the documented launch policy, operators must attach a STRAT-4 CU launch-tier
artifact and point SEESAW_CU_LAUNCH_TIER_EVIDENCE_FILE at it when running
RELEASE_CANDIDATE=1 scripts/production-readiness-check.sh.
The measurement command must be the release BPF CU regression gate:
BPF_OUT_DIR="$(pwd)/target/deploy" cargo test -p seesaw --release --features test-sbf \
--test cu_benchmark release_sbf_cross_tier_upper_bound_unique_maker_fill_guard \
-- --nocapture --test-threads=1
The artifact is JSON with this shape:
{
"releaseCommit": "0123456789abcdef0123456789abcdef01234567",
"sourceTree": "fedcba9876543210fedcba9876543210fedcba98",
"binarySha256": "<sha256 of the measured target/deploy/seesaw.so>",
"generatedAt": "2026-07-04T00:00:00Z",
"command": "BPF_OUT_DIR=target/deploy cargo test --release --test cu_regression --features test-sbf",
"maxLaunchDeepOrderbookCapacity": 1024,
"deepOrderbookTierMeasurements": [
{ "capacity": 64, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 128, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 256, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 512, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 1024, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 2048, "measuredCu": 123456, "sampleCount": 3, "status": "pass" },
{ "capacity": 4096, "measuredCu": 123456, "sampleCount": 3, "status": "pass" }
]
}
Validate the artifact offline before release signoff:
node scripts/security/validate_cu_launch_tier_evidence.mjs <artifact.json> \
--artifact target/deploy/seesaw.so --expected-commit "$(git rev-parse HEAD)"
binarySha256 and sourceTree bind the measurement to the exact SBF artifact
and source it ran on; the release gate fails when either differs from the
artifact and commit being released.
Reclaim-frontier launch evidence#
ReclaimExpiredOrder unwinds one exact order ID. ReclaimExpiredOrders is a
separate batch route. The BOOK-008 evidence format below is the existing
release validator's historical seven-capacity schema. Set
SEESAW_RECLAIM_FRONTIER_EVIDENCE_FILE to the measured artifact when invoking
that validator through the release checks.
{
"releaseCommit": "0123456789abcdef0123456789abcdef01234567",
"generatedAt": "2026-08-09T12:00:00Z",
"command": "BPF_OUT_DIR=target/deploy cargo test -p seesaw --release --features test-sbf --test security_deep_orderbook_v3_attacks -- --nocapture",
"config": { "minRestingNotional": 2, "reclaimBountyBps": 10, "reclaimBountyMax": 100000 },
"profile": {
"priorityMicroLamportsPerCu": 1000000,
"keeperCount": 3,
"attackerEligibleOrdersPerSecond": 2,
"successfulReclaimsPerSecond": 4,
"worstReclaimTransactionFee": 1000,
"minimumEligibleRefund": 1250000,
"minimumObservedBounty": 1250,
"p99ReclaimableAgeSeconds": 30,
"maxReclaimableAgeSeconds": 120,
"maxConsecutiveDenialSlots": 2,
"maxPlacementDenialSeconds": 5
},
"measurements": [{ "capacity": 64, "staleFrontierOrders": 64, "successfulReclaims": 64 }]
}
The validator expects one measurements entry for each of 64, 128, 256, 512,
1,024, 2,048, and 4,096. Live markets all use 4,096 orders per arena.
The artifact records the live minimum-notional and reclaim-bounty inputs, the
measured transaction fee at exactly 1,000,000 micro-lamports/CU, and each
capacity in its schema with at least 64 stale-frontier orders. Its validator fails
closed unless the signed profile records all of: at least three keepers,
successful reclaim throughput at least twice eligible stale-order creation,
observed and configured bounty at least 1.25 times the measured fee, p99/max
reclaimable ages no greater than 30/120 seconds, and placement denial no more
than two slots/five seconds. No SOL/USD conversion, priority-fee forecast, or
unmeasured keeper cost is inferred by this gate.
node scripts/security/validate_reclaim_frontier_evidence.mjs <artifact.json>
If the configured minimum eligible refund cannot produce the required bounty at the measured fee, the artifact is rejected. The release remains blocked; raising scan limits or asserting that keepers will subsidize the gap is not an acceptable substitute for a bounded-progress design and fresh evidence.