-
-
Notifications
You must be signed in to change notification settings - Fork 225
fix(baozi): correct error code mappings from current IDL#1118
fix(baozi): correct error code mappings from current IDL #1118AbhilashG12 wants to merge 1 commit into
Conversation
The Baozi Solana program was upgraded and error codes were renumbered. Changes: - BettingClosed: 6018 → 6013 - BettingFrozen: 6040 → 6014 - BetTooLow: 6020 → 6023 - BetTooHigh: 6041 → 6024 These mappings now match the current on-chain program. Added IDL version comment for future reference. Fixes pmxt-dev#1077
realfishsam
commented
Jun 15, 2026
PR Review: PASS (NOT VERIFIED)
What This Does
This updates Baozi's Solana/Anchor program error-code mapping for closed/frozen betting and min/max bet-size failures. SDK consumers should get the same PMXT error classes/messages for the current program codes instead of generic Baozi program errors.
Blast Radius
Baozi error translation only: core/src/exchanges/baozi/errors.ts. No unified response schemas, SDK shims, router, or auth paths are changed.
Consumer Verification
Before (base branch):
From the patch, the old map handled 6018, 6020, 6040, and 6041. Current program errors 6013, 6014, 6023, and 6024 would fall through to the generic BadRequest("Baozi program error <code>: ...") path in extractAnchorError().
After (PR branch):
After building pmxt-core, I exercised baoziErrorMapper.mapError(new Error("Transaction simulation failed: custom program error: 0x...")) for the changed codes:
6013 BadRequest Betting is closed
6014 BadRequest Betting is frozen
6023 InvalidOrder Bet amount too small
6024 InvalidOrder Bet amount too large
6018 BadRequest Baozi program error 6018: Transaction simulation failed: custom program error: 0x1782
6020 BadRequest Baozi program error 6020: Transaction simulation failed: custom program error: 0x1784
6040 BadRequest Baozi program error 6040: Transaction simulation failed: custom program error: 0x1798
6041 BadRequest Baozi program error 6041: Transaction simulation failed: custom program error: 0x1799
I did not submit a live Baozi transaction to trigger these program errors through the full sidecar trading path, so this is class-level verification rather than end-to-end consumer verification.
Test Results
- Build: PASS (
npm run build --workspace=pmxt-core) - Unit tests: Core Jest PASS (27 suites passed, 652 tests passed); full
npm testends NOT VERIFIED because this runner lacks Pythonpytest - Server starts: PASS during
npm test - E2E smoke: NOT VERIFIED (no live Baozi transaction/error reproduction)
Findings
No blocking findings.
PMXT Pipeline Check
- Field propagation (3-layer): N/A
- OpenAPI sync: N/A
- Financial precision: N/A
- Type safety: OK
- Auth safety: N/A
Semver Impact
patch -- error mapping correction with no public method/signature change.
Risk
I verified the mapper behavior for the new numeric codes, but I could not independently verify the current Baozi IDL/on-chain program code assignments from this checkout, and I did not exercise a real transaction failure through the sidecar.
AbhilashG12
commented
Jun 15, 2026
Thanks for the review!
I understand the verification couldn't include live Baozi transactions.
The error code mappings are based on the current Baozi program IDL. The changes are:
- BettingClosed: 6018 → 6013
- BettingFrozen: 6040 → 6014
- BetTooLow: 6020 → 6023
- BetTooHigh: 6041 → 6024
Class-level verification (as you performed) confirms the mapper works correctly for these codes.
This PR is ready to merge. The live Baozi verification can be done later by someone with test SOL.
Thank you for the thorough review! 🙏
Description
Fixes #1077 : incorrect error code mappings in Baozi exchange to match the current Solana program IDL.
Problem
The Baozi program was upgraded and error codes were renumbered. Current errors.ts uses old codes:
Impact
Solution
Updated the error code mappings: