Skip to content

baozi — errors.ts maps 6 error codes to wrong IDL values; BetTooLow/BetTooHigh/BettingFrozen/BettingClosed all point to wrong codes #1077

Description

@realfishsam

Spec Drift — changed_response / auth_change

Exchange: baozi
Affected file: core/src/exchanges/baozi/errors.ts
Reference: Baozi Solana program IDL (current)

Finding

errors.ts maps Baozi on-chain error codes to human-readable names. At least 6 mappings are wrong against the current program IDL:

Error name Code in errors.ts Correct IDL code
BetTooLow 6020 6023
BetTooHigh 6041 6024
BettingFrozen 6040 6014
BettingClosed 6018 6013
(at least 2 more mismatches)

These appear to be carry-over from an earlier IDL version that was renumbered during a program upgrade.

Impact

When the Baozi Solana program returns one of these error codes (e.g., a bet below the minimum size returns 6023), the adapter looks up 6023 in errors.ts, finds a different error name (or nothing), and either surfaces the wrong error message to the user or falls through to a generic "unknown error" path.

Concretely:

  • A bet that is too small shows as the wrong error (or generic) instead of BetTooLow
  • A bet that is too large shows as the wrong error instead of BetTooHigh
  • A frozen-betting state shows as the wrong error instead of BettingFrozen

This makes on-chain failures opaque to end users and to any retry/fallback logic that branches on error type.

What needs updating

  • Audit the full errors.ts mapping against the current Baozi program IDL
  • Correct all mismatched codes (at minimum the 6 listed above)
  • Add a comment referencing the IDL version the mapping was taken from so future drift is detectable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions