Skip to content

test(creator-earnings): add snapshot/restore consistency tests#1276

Merged
aji70 merged 2 commits into
MyFanss:mainfrom
Xaxxoo:feat/944-creator-earnings-snapshot-restore-test
May 31, 2026
Merged

test(creator-earnings): add snapshot/restore consistency tests#1276
aji70 merged 2 commits into
MyFanss:mainfrom
Xaxxoo:feat/944-creator-earnings-snapshot-restore-test

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Add three snapshot/restore consistency tests to the creator-earnings contract, verifying that internal state remains deterministic across sequences of deposits and withdrawals:

  • test_snapshot_restore_consistency — deposits to a mid-state snapshot, partially withdraws, re-deposits the same amount, and asserts the balance is restored to the snapshot value
  • test_sequential_deposits_accumulate_consistently — verifies that repeated deposits sum correctly and a full withdrawal returns the balance to exactly zero
  • test_multi_creator_balances_independent — asserts that deposits and withdrawals for one creator do not alter the snapshot of another creator's balance

Test plan

  • test_snapshot_restore_consistency — passes
  • test_sequential_deposits_accumulate_consistently — passes
  • test_multi_creator_balances_independent — passes
  • All existing tests continue to pass (no regressions)

Closes #944

@drips-wave

drips-wave Bot commented May 31, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Xaxxoo Xaxxoo force-pushed the feat/944-creator-earnings-snapshot-restore-test branch 2 times, most recently from 75b54b7 to 01ebbfb Compare May 31, 2026 17:24
Add three consistency tests to the creator-earnings contract:
- test_snapshot_restore_consistency: deposit, withdraw, re-deposit restores
  the internal balance to the recorded mid-state snapshot
- test_sequential_deposits_accumulate_consistently: repeated deposits sum
  correctly and a full withdrawal returns balance to zero
- test_multi_creator_balances_independent: operations on one creator do not
  affect another creator's balance snapshot

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#944
@Xaxxoo Xaxxoo force-pushed the feat/944-creator-earnings-snapshot-restore-test branch from 01ebbfb to 3a6899d Compare May 31, 2026 17:27
@aji70 aji70 merged commit 957bf6b into MyFanss:main May 31, 2026
4 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contract creator-earnings: Add snapshot/restore consistency test

2 participants