test(creator-earnings): add unauthorized caller revert tests#1275
Merged
aji70 merged 2 commits intoMay 31, 2026
Merged
Conversation
|
@Xaxxoo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
ff63a93 to
6500d79
Compare
Add five targeted revert tests: - test_unauthorized_add_authorized_reverts: non-admin cannot add depositors - test_double_initialize_reverts: second initialize reverts with AlreadyInitialized - test_non_creator_cannot_withdraw_other_creators_funds: impersonator cannot withdraw - test_deposit_zero_amount_reverts: zero-amount deposit reverts with InvalidAmount - test_withdraw_zero_amount_reverts: zero-amount withdrawal reverts with InvalidAmount Also fixes a pre-existing compile error in content-likes: missing `contracttype` import and invalid `panic_with_error!` string literal (replaced with `Error::AlreadyInitialized`). Applies cargo fmt to pre-existing formatting violations across content-access, content-likes, subscription, test-consumer, and treasury. Closes MyFanss#941
6500d79 to
6cea981
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive unauthorized-caller revert tests to the
creator-earningscontract, covering all protected entry points:add_authorized(auth guard)initializereverts withAlreadyInitializedbefore auth checkdepositreverts withInvalidAmount(pre-auth guard)withdrawreverts withInvalidAmount(pre-auth guard)Test plan
test_unauthorized_add_authorized_reverts— passestest_double_initialize_reverts— passestest_non_creator_cannot_withdraw_other_creators_funds— passestest_deposit_zero_amount_reverts— passestest_withdraw_zero_amount_reverts— passesCloses #941