P2: No chain validation - any chain accepted for Phase 1 #31

Closed
opened 2026-04-09 07:12:16 +02:00 by shoko · 0 comments
Owner

Problem

Phase 1 is supposed to support BNB Chain only, but there's no backend validation:

  • BacktestCreate and SimulationCreate schemas accept any chain string
  • Users can specify "solana", "eth", "base", etc. and the system accepts it

Current Schema (schemas.py)

class BacktestCreate(BaseModel):
    chain: str  # No validation - accepts any chain

Solution

Add chain validation that only allows "bsc" for Phase 1.

Example

@validator('chain')
def chain_must_be_bsc(cls, v):
    if v != 'bsc':
        raise ValueError('Phase 1 only supports BSC (bnb chain)')
    return v

Acceptance Criteria

  • API rejects backtest/simulate requests with non-BSC chain
  • Error message clearly states only BSC is supported
  • BSC chain requests work normally
## Problem Phase 1 is supposed to support **BNB Chain only**, but there's no backend validation: - `BacktestCreate` and `SimulationCreate` schemas accept any chain string - Users can specify "solana", "eth", "base", etc. and the system accepts it ### Current Schema (schemas.py) ```python class BacktestCreate(BaseModel): chain: str # No validation - accepts any chain ``` ## Solution Add chain validation that only allows "bsc" for Phase 1. ### Example ```python @validator('chain') def chain_must_be_bsc(cls, v): if v != 'bsc': raise ValueError('Phase 1 only supports BSC (bnb chain)') return v ``` ## Acceptance Criteria - [ ] API rejects backtest/simulate requests with non-BSC chain - [ ] Error message clearly states only BSC is supported - [ ] BSC chain requests work normally
shoko added the enhancement label 2026-04-09 07:12:16 +02:00
shoko closed this issue 2026-04-09 09:10:55 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/randebu#31