Add reward Gini coefficient, seasonal multiplier, staker bio, sunset workflow - #325
Merged
Rickyy1017 merged 1 commit intoJul 28, 2026
Conversation
|
@JessicaOmoyeme 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! 🚀 |
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
get_reward_gini_coefficient()— admin-gated bps approximation of reward distribution fairness across active stakers, via insertion sort (bounded at 100 stakers).add_season/remove_season/get_seasons/get_active_season) that stack with the existing campaign boost, with time-weighted accrual across season boundaries.set_staker_bio/get_staker_bio/clear_staker_bio, a short free-text note per position that persists after unstake.Active->SunsetAnnounced->GracePeriodActive->ForceResolutionActive->Closed) withannounce_sunset/start_grace_period/start_force_resolution/force_resolve_position/close_pool.New storage (
Season,SunsetState) uses raw symbol-keyed instance/persistent storage rather than newDataKeyvariants, sinceDataKeyis already at Soroban's 50-variant cap. New error cases land inVaultFeatureErrorfor the same reason (VaultErrorandVaultExtErrorare both already at the cap).Also fixes a pre-existing bug uncovered while wiring up the season multiplier: the actual reward-accrual path (
reward_dust_for_ledgers) silently ignored the campaign multiplier entirely — only a separate, shadowed/discarded local variable applied it. Without this fix the season multiplier (and the existing campaign boost) would compute correctly for preview/simulation calls but never actually affect real accrued rewards.Note on build state
maincurrently has ~66 pre-existing compile errors in unrelated code (issues in the #266-273 area: insurance completions, matching program, cohort stats, anti-sybil min stake age, pool merger, and a broken duplicate staker-bio stub referencing a nonexistentstorage::Storagemodule). These predate this branch and are out of scope here. This PR was verified to add zero new errors on top of that baseline — in fact one fewer, since the broken duplicate bio stub (which collided with this PR's real implementation) was removed.Issues Resolved
Closes #275
Closes #276
Closes #274
Closes #298
Test plan
src/test.rs(equal/unequal Gini distributions, admin-auth gate, season boost/base-rate/boundary-crossing, bio set/get/clear/persistence/length-limit, full sunset workflow/force-resolve payout/close-with-positions-remaining/queries-after-close).cargo test --features testutilscannot currently run to completion — blocked by the pre-existing unrelated compile errors onmaindescribed above, not by this PR's changes.