Skip to content

Refund ecosystem account when invalid topic to reward#815

Merged
guilherme-brandao merged 9 commits intodevfrom
guilherme/engn-3525-189-185-apy-over-12
May 6, 2025
Merged

Refund ecosystem account when invalid topic to reward#815
guilherme-brandao merged 9 commits intodevfrom
guilherme/engn-3525-189-185-apy-over-12

Conversation

@guilherme-brandao
Copy link
Contributor

@guilherme-brandao guilherme-brandao commented May 2, 2025

Purpose of Changes and their Description

This PR modifies the rewards distribution logic to handle cases where a topic is eligible for rewards based on its weight but cannot distribute them due to lack of active participation (e.g., no reward nonce submitted or errors during reward processing).

Previously, these rewards might have remained undistributed in the rewards module. Now, any rewards allocated to a topic that cannot be processed are transferred to the EcosystemModuleName account.

Changes:

  • Added keeper.MoveCoinsFromAlloraRewardsToEcosystem function to facilitate the transfer.
  • Updated rewards.EmitRewards to call the new keeper function when a topic's rewards cannot be processed.
  • Added the test case TestNoActiveParticipantsNoRewardsForTopic to verify that rewards for topics without active participation are correctly moved to the ecosystem module account.

Link(s) to Ticket(s) or Issue(s) resolved by this PR

https://linear.app/alloralabs/issue/ENGN-3525/189-185-apy-over-12percent

Are these changes tested and documented?

  • If tested, please describe how. If not, why tests are not needed.
  • If documented, please describe where. If not, describe why docs are not needed.
  • Added to Unreleased section of CHANGELOG.md?

@guilherme-brandao guilherme-brandao marked this pull request as ready for review May 5, 2025 14:29
guilherme-brandao and others added 2 commits May 5, 2025 21:07
Signed-off-by: Guilherme Brandão <37072140+guilherme-brandao@users.noreply.github.com>
Copy link
Contributor

@xmariachi xmariachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, lgtm!
Approving preemptively.
My only suggestion would be to accumulate the rewards to be given back, to optimize the sending of rewards for all failing topics in one go, instead of having one per failing topic. In practice, since it's such an uncommon scenario, it shouldn't matter that much.

@guilherme-brandao guilherme-brandao merged commit 5932c1f into dev May 6, 2025
11 checks passed
@guilherme-brandao guilherme-brandao deleted the guilherme/engn-3525-189-185-apy-over-12 branch May 6, 2025 14:32
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.

3 participants