Skip to content

Validate inputs in create_request #5

Description

@iexwr

Context

create_request in src/request.rs stores amount, memo, and expires_in without validating their values. A caller can create a request with amount == 0, expires_in == 0, or an arbitrarily long memo.

Acceptance criteria

  • create_request aborts with a descriptive panic when amount <= 0.
  • create_request aborts when expires_in == 0.
  • memo longer than 128 bytes is rejected.
  • Each case has a unit test in the #[cfg(test)] module of src/request.rs.

Technical notes

  • Check amount with amount <= 0 before writing storage.
  • Cap memo with memo.len() (byte length for String).
  • Soroban panics become transaction failures, so keep messages specific.

Testing

  • Add create_request_rejects_zero_amount, create_request_rejects_zero_expiry, create_request_rejects_long_memo.
  • make test must pass and make lint must stay clean.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveStellar Wave for StackPaybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions