Skip to content

Feat/creator earnings test consumer integration#1

Open
pharuq411 wants to merge 205 commits into
Mimah97:mainfrom
pharuq411:feat/creator-earnings-test-consumer-integration
Open

Feat/creator earnings test consumer integration#1
pharuq411 wants to merge 205 commits into
Mimah97:mainfrom
pharuq411:feat/creator-earnings-test-consumer-integration

Conversation

@pharuq411
Copy link
Copy Markdown

@pharuq411 pharuq411 commented Jun 1, 2026

Closes MyFanss#947

aji70 and others added 30 commits May 26, 2026 22:22
Adds contract integration tests across four packages
Co-authored-by: Cursor <cursoragent@cursor.com>
 Social links hardening and creators search improvements
This PR delivers four related improvements across API pagination, wallet auth/testing, network mismatch handling, and creator onboarding progress persistence.
Request ID and correlation ID in logs
aji70 and others added 30 commits May 31, 2026 15:32
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
Add seven correctness tests that exercise the three hot execution paths
of the creator-earnings contract (deposit, withdraw, balance read),
following the pattern established by the treasury gas benchmark module.

Soroban metering tracks CPU instructions and memory bytes per invocation.
Correct balance accounting is the observable proxy for gas efficiency:
wrong balances indicate a bad write path, which is also where gas is spent.

Hot-path analysis:
| Function | Dominant cost                         | Storage tier |
|----------|---------------------------------------|--------------|
| deposit  | token cross-contract transfer         | instance     |
| withdraw | auth check + balance read + transfer  | instance     |
| balance  | storage read                          | instance     |

Tests added:
- hot_path_deposit_single_correctness
- hot_path_deposit_repeated_accumulates
- hot_path_withdraw_correctness
- hot_path_full_withdraw_leaves_zero
- hot_path_balance_read_consistent_with_token_client
- hot_path_invalid_amount_rejected_before_transfer
- hot_path_overdraft_rejected

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#946
Add InitializedEvent, AuthorizedAddedEvent, and DepositEvent typed event
structs to the creator-earnings contract. Emit events at the end of
initialize(), add_authorized(), and deposit() alongside the existing
WithdrawEvent in withdraw().
Add unit tests verifying each new event is emitted with correct data.

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, creator-earnings, subscription,
test-consumer, and treasury.

Closes MyFanss#942
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
…-emit-events

feat(creator-earnings): emit events for primary state changes
…unauthorized-revert-tests

test(creator-earnings): add unauthorized caller revert tests
…-snapshot-restore-test

test(creator-earnings): add snapshot/restore consistency tests
…-gas-review

test(creator-earnings): review gas usage for hot paths
…ure-flags

feat: feature flags for new flows
…ics-and-alerting

feat: metrics and alerting
…usury-deposit-event

feat: treasury deposit event
…variants-929

MyFanss#929 content-likes: add invariant property tests
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 integration test via test-consumer