Skip to content

fix(rewards): reconcile CommunityPool to bank balance at InitGenesis#364

Open
amathxbt wants to merge 1 commit into
KiiChain:mainfrom
amathxbt:fix/genesis-reconcile-community-pool
Open

fix(rewards): reconcile CommunityPool to bank balance at InitGenesis#364
amathxbt wants to merge 1 commit into
KiiChain:mainfrom
amathxbt:fix/genesis-reconcile-community-pool

Conversation

@amathxbt

@amathxbt amathxbt commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Root cause: When the bank balance of the rewards module account is lower than the CommunityPool accounting (e.g. after a faulty upgrade restores old genesis state), InitGenesis only logged the mismatch and continued. The chain started with phantom funds in the pool. Every subsequent BeginBlocker call then passed the pool pre-check but failed the bank send, causing a chain halt.

Fix: Cap CommunityPool to the actual bank balance at InitGenesis so the chain starts in a self-consistent state. The discrepancy is still logged at ERROR level for operator visibility.

Files changed

  • x/rewards/keeper/genesis.go — reconcile pool to bank balance instead of just logging

When the bank balance is lower than CommunityPool (e.g. after a faulty
upgrade), BeginBlocker passes the pool pre-check but fails the bank send,
causing a chain halt. Fix: cap CommunityPool to the actual bank balance
at InitGenesis so the chain starts in a self-consistent state.

Closes KiiChain#337
@amathxbt amathxbt requested a review from jhelison as a code owner July 6, 2026 12:13
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@amathxbt, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5f32408-c093-4574-bc87-231cde5dcf3d

📥 Commits

Reviewing files that changed from the base of the PR and between e0d3113 and eb190b7.

📒 Files selected for processing (1)
  • x/rewards/keeper/genesis.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
x/rewards/keeper/genesis.go 0.00% 23 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant