Skip to content

fix(slab): export V12.1 SBF tier sizes for mainnet discovery#184

Open
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/slab-tiers-sbf-sizes
Open

fix(slab): export V12.1 SBF tier sizes for mainnet discovery#184
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/slab-tiers-sbf-sizes

Conversation

@0x-SquidSol
Copy link
Copy Markdown
Contributor

@0x-SquidSol 0x-SquidSol commented Apr 13, 2026

Summary

  • SLAB_TIERS_V12_1 computes sizes using HOST/aarch64 constants (engineOff=648, accountSize=320) but mainnet deploys the SBF binary (engineOff=616, accountSize=280)
  • Size difference is ~14% per tier: medium is 331,544 (HOST) vs 290,120 (SBF), large is 1,321,112 vs 1,156,808
  • SLAB_TIERS (the mainnet default) aliased to HOST sizes — discoverMarkets getProgramAccounts dataSize filters would find zero V12.1 slabs on mainnet
  • Fix: Added SLAB_TIERS_V12_1_SBF export computed from SBF constants. Changed SLAB_TIERS to alias SBF sizes. Added both HOST and SBF V12.1 to ALL_TIERS for discovery of slabs from any build target.
  • SLAB_TIERS_V12_1 (HOST) preserved unchanged for test builds and backward compatibility

Test plan

  • Discovery tests pass (60/60) — tier count updated
  • No new test failures introduced (16 pre-existing failures from HOST bitmapOff + ADL mock issues are separate)
  • Verify SBF tier sizes match deployed mainnet slabs
  • Verify discoverMarkets finds V12.1 SBF slabs via dataSize filter

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Updated slab tier configurations to reflect new mainnet SBF layout specifications
    • Enhanced market discovery by extending tier coverage to include both SBF and test slab layouts
    • Refined slab size calculations for improved accuracy in market creation and discovery processes

SLAB_TIERS_V12_1 computes sizes using HOST/aarch64 constants
(engineOff=648, accountSize=320) but mainnet deploys the SBF
binary (engineOff=616, accountSize=280). The size difference is
~14% per tier (e.g., medium: 331,544 HOST vs 290,120 SBF).

Discovery's getProgramAccounts dataSize filters used HOST sizes
and would find zero V12.1 slabs on mainnet since no on-chain
account matches the HOST-computed size.

Added SLAB_TIERS_V12_1_SBF export with SBF-computed sizes.
Changed SLAB_TIERS (the mainnet default) to alias SBF sizes.
Added both HOST and SBF V12.1 sizes to ALL_TIERS for discovery
of slabs from any build target.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f164baf-61aa-4548-95b2-3bd5952a4653

📥 Commits

Reviewing files that changed from the base of the PR and between 2f80d79 and fcf6710.

📒 Files selected for processing (3)
  • src/solana/discovery.ts
  • src/solana/slab.ts
  • test/discovery.test.ts

📝 Walkthrough

Walkthrough

This PR introduces SBF-specific slab tier constants with different layout offsets and updates the discovery module to use these new SBF values as the default while maintaining support for HOST/test builds in tier coverage.

Changes

Cohort / File(s) Summary
SBF Slab Tiers Addition
src/solana/slab.ts
Added new exported SLAB_TIERS_V12_1_SBF lookup table with SBF-specific layout constants (ENGINE_OFF=616, BITMAP_OFF=584, ACCOUNT_SIZE=280) and custom size computation logic for Micro/Small/Medium/Large tiers.
Discovery Tier Updates
src/solana/discovery.ts
Updated SLAB_TIERS export to source micro/small/medium/large sizes from SLAB_TIERS_V12_1_SBF instead of SLAB_TIERS_V12_1, and extended ALL_TIERS to include both SBF and HOST/test layout variants.
Test Assertion Updates
test/discovery.test.ts
Added SLAB_TIERS_V12_1 import and updated tier-count assertion to include SLAB_TIERS_V12_1.length in expected coverage calculation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, hop—new tiers bloom bright,
SBF layouts now take flight!
Micro to Large, all aligned,
Discovery's dual-path redesigned! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: exporting V12.1 SBF tier sizes for mainnet discovery, which is the primary purpose of adding SLAB_TIERS_V12_1_SBF and updating SLAB_TIERS.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant