Feat/creator earnings test consumer integration#1
Open
pharuq411 wants to merge 205 commits into
Open
Conversation
Adds contract integration tests across four packages
…#849) Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…Fanss#851) Co-authored-by: Cursor <cursoragent@cursor.com>
…ss#852) Co-authored-by: Cursor <cursoragent@cursor.com>
Feat/issues 849 852
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
feat: Api versioning
…gging-redact-pii logging redact pii
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
…-tests feat: unit tests
…variants-929 MyFanss#929 content-likes: add invariant property tests
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.
Closes MyFanss#947