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
test(contract): review gas usage for creator-earnings hot paths
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#946
0 commit comments