Skip to content

Enforce admin-configured rescue cap from storage #1214

Closed

Description

@greatest0fallt1me

Summary

rescue_capped(admin, token, to, amount, cap) takes the cap as an argument from the same admin whose power it is supposed to limit, so it adds no protection over rescue.

Why this matters

A compromised admin simply passes a large cap; the 'capped' path gives reviewers false confidence.

Scope

Store a per-token cap set via a timelocked or separate-role setter, and have rescue itself enforce it; deprecate the argument-based variant.

Relevant code in CalloraOrg/Callora-Contracts:

  • contracts/rescue/src/lib.rs
  • contracts/rescue/tests/proptest.rs

Priority

Medium

Acceptance criteria

  • Rescue above stored cap fails with ExceedsCap
  • Changing the cap emits an event
  • Argument-based cap removed or ignored
  • Rescue proptests updated to use the stored cap

Validation

cargo test -p callora-rescue

Non-goals

  • Typo-only, formatting-only, or cosmetic changes.
  • Unrelated refactors, dependency upgrades, or broad rewrites.
  • Removing safeguards or weakening validation to make tests pass.

Contributor application

Before coding, describe the affected modules, proposed state/invariant changes, test strategy, compatibility considerations, and an estimate. Wait for assignment before starting implementation.

PR requirements

Use a feature branch and include Closes #<issue-number>. Address every criterion, map criteria to code and tests, explain security and failure-mode handling, and ensure CI passes.

Quality review

A maintainer will assess correctness, completeness, test depth, compatibility, observability, and adverse-case handling. A substantive implementation is required; merge or CI status alone does not guarantee reward eligibility.


Generated by Claude Code

Activity

  1. changed the title [-]Keep leaderboard rank pages deterministic[/-] [+]Add focused test coverage for contracts/settlement/src/errors.rs[/+] on Sep 27, 2026
  2. changed the title [-]Add focused test coverage for contracts/settlement/src/errors.rs[/-] [+]Enforce admin-configured rescue cap from storage[/+] on Sep 27, 2026
  3. Bigtura commented on Sep 27, 2026

    @Bigtura
    Contributor

    @Bigtura has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello, I’ve read through the description and have a clear path forward. I’d be glad to take this on

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Bigtura to this issue.

  4. OLAMIGHTY010 commented on Sep 30, 2026

    @OLAMIGHTY010

    @OLAMIGHTY010 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    I would like to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @OLAMIGHTY010 to this issue.

  5. Viccodes11 commented on Sep 30, 2026

    @Viccodes11

    @Viccodes11 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hello Maintainer, I’ve reviewed the requirements and I’m confident I can resolve this issue effectively. I’d appreciate the opportunity to work on it.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Viccodes11 to this issue.

  6. Rodrigoue9 commented on Oct 3, 2026

    @Rodrigoue9

    Hi @maintainers! I'd like to work on this issue. Here is my proposed technical approach:

    Proposed Technical Approach:

    1. Contract Logic Implementation: Implement the required Soroban smart contract logic in Rust, ensuring strict validation, authorization checks (require_auth), and gas optimization.
    2. Storage Layout & State Management: Maintain safe data key patterns, TTL management, and prevent state inconsistency or unauthorized state mutations.
    3. Events & Error Encoding: Emit strongly typed contract events and return descriptive custom errors for all failure modes.
    4. Comprehensive Test Vectors: Implement Rust unit and integration tests using soroban-sdk::Env verifying both success and failure execution paths.

    Key Files:

    • contracts/**/src/lib.rs (contract entrypoints and interface implementations)
    • contracts/**/src/types.rs or storage.rs (types, data keys, and state)
    • contracts/**/src/test.rs (unit tests and integration vectors)

    Verification & Testing:

    • Run cargo test across all contract crates verifying 100% pass rate.
    • Run cargo clippy --all-targets -- -D warnings and cargo fmt --check.
    • Verify Soroban WASM build: soroban contract build.

    Relevant Track Record:

    I have successfully implemented and merged multiple production PRs across the Stellar ecosystem and Web3 open-source projects (e.g., Bitcoindefi/OpenAO #218, cybermax4200/stellar-did-credit #898 & #900, and FindMalek/sonaraem #416).

    Please feel free to assign this issue to me so I can proceed with the implementation. Thank you!

  7. Ranjeet2063 commented on Oct 6, 2026

    @Ranjeet2063

    Hi,

    I have experience with similar implementations and would like to take this on.

    Solution overview:

    1. Audit storage layout and state invariants ensuring strict auth guards.
    2. Implement deterministic state transitions with safe checked arithmetic.
    3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
    4. Profile instruction and CPU/gas limits under Soroban host environment.

    Let me know if this aligns with the repository guidelines and assign when convenient.

  8. lienhoatienphung-svg commented on Oct 16, 2026

    @lienhoatienphung-svg

    Hi! I have implemented and verified this in #1380 with full unit test coverage and rustfmt compliance.

  9. Stanley471 commented on Oct 16, 2026

    @Stanley471

    @Stanley471 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello maintainer, I'd like to work on this issue. I'll start by reviewing the existing code and conventions in the relevant files before making changes, so my implementation stays consistent with the rest of the codebase. I'll cover the requirements and acceptance criteria as listed, add tests where applicable, and verify everything builds/passes locally before opening the PR

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Stanley471 to this issue.

  10. adeniyioluwaseyi192007-png commented on Oct 16, 2026

    @adeniyioluwaseyi192007-png

    @adeniyioluwaseyi192007-png has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hello Maintainer, I've gone through the issue carefully and understand the expected result.

    I'm confident I can provide a solution that meets the requirements. I'd appreciate an assignment.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @adeniyioluwaseyi192007-png to this issue.

  11. jamal-exe commented on Oct 17, 2026

    @jamal-exe

    @jamal-exe has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi, I’ve carefully examined the issue details and requirements, and I’m confident I can develop a clean, efficient, and maintainable solution. I’ll make sure to consider the existing implementation, follow the project’s conventions, and properly validate the changes before submitting my contribution.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @jamal-exe to this issue.

  12. shekwolonathanielbala-cyber commented on Oct 18, 2026

    @shekwolonathanielbala-cyber

    @shekwolonathanielbala-cyber has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi Maintainer,

    I’d love the opportunity to work on this issue if it’s still available. I’m actively building my OSS contribution history and would appreciate the chance to contribute meaningful work to your project.

    I’m ready to start immediately and aim to deliver a clean, well-tested solution within few hours.

    If it’s unassigned, I’d be grateful if you could assign it to me.

    Thank you for your consideration!

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @shekwolonathanielbala-cyber to this issue.

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 Program issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions