Back
Challenge 16 - Checked Product Helper
MediumCPMMSafety16 / 20

Challenge 16: Checked Product Helper

Unchecked arithmetic is dangerous in financial code.

Task

Implement checked_product.

Rules

  • Use checked_mul.
  • Return Ok(product) when multiplication succeeds.
  • Return Err("overflow") otherwise.

Why this matters

Many Solana program bugs start with safe-looking arithmetic that fails at large values.

LanguageRust
Loading editor...
Run works without login. Submit requires sign-in so completion can be saved.
Run cases to compare your output against each configured input. Submit saves progress only when every case passes.
    Challenge 16 - Checked Product Helper · CPMM Exercise | learn.sol