Skip to content

Add burn_from unit tests to learn-token #522

Closed

Description

@DeFiVC

Severity: medium
Labels: tests, rust, Stellar Wave

What

Write unit tests for the burn_from function in learn-token, covering successful burn via allowance, insufficient allowance rejection, burn from zero balance, and burn with expired allowance.

Why

burn_from has zero test coverage. It is a public SEP-41 function that spends another address's allowance to burn tokens. Without tests, regressions in allowance deduction or supply tracking could go undetected.

Scope

  • Test burn_from with valid allowance reduces balance, total_supply, and allowance
  • Test burn_from with insufficient allowance panics
  • Test burn_from from zero balance panics
  • Test burn_from with expired allowance panics
  • Test burn_from emits burn_from event with correct topics

Out of scope

Testing the burn event itself (already covered), testing burn (separate function).

Acceptance criteria

  • All 5 test cases pass
  • Tests use #[should_panic(expected = "...")] with specific error messages, not bare #[should_panic]`
  • Tests verify state changes (balance, supply, allowance) and event emission

Technical context

contracts/learn-token/src/lib.rs lines ~540-580 contain the burn_from implementation. The function deducts from the spender's allowance, burns from the owner's balance, and decrements total_supply.

Activity

  1. added
    testsTest additions or improvements
    rustRust language
    Stellar WaveIssues in the Stellar wave program
    mediumFunctionality impaired but workaround exists, edge case, partial feature
    and removed
    Stellar WaveIssues in the Stellar wave program
    on Oct 14, 2026
  2. cindybby18 commented on Oct 19, 2026

    @cindybby18

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

    Hello Maintainer, I’m available and willing to work on this issue. I will carefully review the requirements, follow the contribution guidelines, and do my best to provide a quality solution. Thank you for considering my request

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

  3. OlolaJaco commented on Oct 19, 2026

    @OlolaJaco
    Contributor

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

    I have experience on this

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

  4. drips-wave commented on Oct 19, 2026

    @drips-wave

    Congratulations, @OlolaJaco! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @OlolaJaco: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  5. grantfox-oss commented on Oct 19, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @OlolaJaco's PR #660 was approved and merged by @DeFiVC.

    🏆 @OlolaJaco: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (471 total points). Track your full progress on GrantFox.

    👏 Great work, @OlolaJaco! Keep contributing to ChainLearnOfficial.

  6. drips-wave commented on Oct 19, 2026

    @drips-wave

    This issue has been completed by @OlolaJaco as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @OlolaJaco: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programmediumFunctionality impaired but workaround exists, edge case, partial featurerustRust languagetestsTest additions or improvements

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions