Xconfess/Xconfess

[Wave 6] Add boundary and overflow tests for tipping contract fee arithmetic

Open

#1,665 opened on Jul 28, 2026

 (0 comments) (0 reactions) (0 assignees)TypeScript (187 forks)auto 404
contracthelp wantedsecuritytest

Repository metrics

Stars
 (14 stars)
PR merge metrics
 (PR metrics pending)

Description

Problem

The tipping contract's fee and amount arithmetic hasn't been stress-tested for i128 edge cases: minimum tip amounts, fee rounding direction, and overflow near i128::MAX. A rounding bug here is a direct fund-handling bug.

Tasks

  • Add property-based tests (via proptest or manual boundary tests) for tip amount + fee calculation
  • Explicitly test: tip amount of 1 stroop, fee rounding when the result isn't evenly divisible, amounts near i128::MAX, zero-amount rejection
  • Document the rounding policy (round down vs round up on fees) in a doc comment on the calculation function
  • Add a regression test for any bug found

Acceptance Criteria

  • cargo test --workspace includes new boundary/property tests for tip fee math
  • Rounding policy is documented inline and matches actual contract behavior
  • No panics or silent overflow on any tested boundary value

Labels

contract, security, test, help wanted, Stellar Wave

Contributor guide