You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
transfer(from, to, amount) in eco-token permits self-transfer; transfer_from rejects it — inconsistent security model #84
Why this matters now: transfer_from explicitly panics with "token: cannot transfer to self" (added in #67). transfer has no such guard. A self-transfer with transfer is a no-op (balance is correctly maintained due to the two-write pattern reading the already-updated value), but the inconsistency is a security model defect: the justification for rejecting self-transfer in transfer_from (allowance drain without token movement) applies equally to transfer (auth signature without value movement). An auditor reviewing the SEP-0041 implementation will flag this inconsistency. It should be fixed before the formal audit.
Problem / What:
In token.rs, transfer does not check if from == to { panic!(...) }. The function correctly handles the double-write (the test test_transfer_to_self passes and the balance is preserved), but a self-transfer burns the caller's require_auth() credential with no economic effect. The fix is a one-line guard matching transfer_from.
Key Challenges:
The existing test test_transfer_to_self asserts that self-transfer succeeds and leaves the balance unchanged — this test must be updated to assert that it panics after the fix.
Ensure the error message matches the transfer_from message for consistency: "token: cannot transfer to self".
Acceptance Criteria:
transfer(from, to, amount) panics with "token: cannot transfer to self" when from == to.
test_transfer_to_self is rewritten as #[should_panic(expected = "token: cannot transfer to self")].
A new positive test confirms valid transfers (from != to) still work.
Hi Maintainer, reviewed the issue in detail. Full stack background with solid experience relevant to this task. No blockers on my end — I'm ready to submit a PR shortly. Please assign.
Activity
Cmitchelle7 commentedon Aug 26, 2026
Hi Maintainer, reviewed the issue in detail. Full stack background with solid experience relevant to this task. No blockers on my end — I'm ready to submit a PR shortly. Please assign.
grantfox-oss commentedon Aug 26, 2026
🦊 GrantFox — @Cmitchelle7 has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #84)Good luck! Track your progress on GrantFox.
docs: add changelog entry for self-transfer fix in transfer() (ecotas…
fix: reject self-transfer in transfer() to match transfer_from (#84) (#…
grantfox-oss commentedon Sep 2, 2026
🎉 This issue has been marked as completed on GrantFox!
@Cmitchelle7's PR #89 was approved and merged by @cybermax4200.
🏆 @Cmitchelle7: You earned 40 FoxPoints for this contribution! Your current tier: Builder (1,262 total points). Track your full progress on GrantFox.
👏 Great work, @Cmitchelle7! Keep contributing to ecotask-network.