Skip to content

Bug: Negative TAO amounts cause massive staking values #8

@OpenSourceSoul

Description

@OpenSourceSoul

Problem
StakeParams::new_tao() accepts negative TAO amounts without validation. When a negative f64 is cast to u64, it overflows and produces a massive value (close to u64::MAX).

Example
Calling StakeParams::new_tao(hotkey, 1, -1.0) would attempt to stake ~18 billion TAO instead of rejecting the negative amount.

Fix
PR #7 contains the fix:

  • Validates that TAO amount is non-negative
  • Returns Result type for proper error handling
  • Adds tests for negative amount rejection

See: #7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions