Skip to content

feat(tieredrewards): add full genesis export/import for tieredrewards module#1248

Closed
JayT106 wants to merge 31 commits intofeat/tokenomicfrom
jt/tieredrewards-stores
Closed

feat(tieredrewards): add full genesis export/import for tieredrewards module#1248
JayT106 wants to merge 31 commits intofeat/tokenomicfrom
jt/tieredrewards-stores

Conversation

@JayT106
Copy link
Copy Markdown
Contributor

@JayT106 JayT106 commented Mar 20, 2026

Based on #1242

Summary

  • Extend GenesisState proto with tiers, positions, next_position_id, validator_reward_ratios, and unbonding_mappings fields, plus new ValidatorRewardRatioEntry and UnbondingMapping wrapper messages
  • Rewrite InitGenesis to restore all primary store data and rebuild derived indexes (PositionsByOwner, PositionsByTier, PositionsByValidator, PositionCountByTier) via SetPosition
  • Rewrite ExportGenesis to walk all primary collections; derived indexes are intentionally omitted (single source of truth, smaller genesis files)
  • Expand ValidateGenesis with cross-reference checks (position→tier, unbonding→position), duplicate ID detection, sequence bounds, and validator address validation

randy-cro and others added 30 commits March 12, 2026 17:38
…Tier, MsgDeleteTier and MsgUpdateTier to update tiers + add Tier and Position persistence and indexes
… and disallow transfer if delegator has an active incoming redelegation to the validator
…ockTier and MsgCommitDelegationToTier + some refactoring
…nds are transferred fresh from the tieredrewards module acc
… address only for IsDelegated as validation already accounts for correctness
Export all primary store data (tiers, positions, sequence,
validator reward ratios, unbonding mappings) and rebuild derived
indexes (PositionsByOwner, PositionsByTier, PositionsByValidator,
PositionCountByTier) on InitGenesis via SetPosition.

Add comprehensive ValidateGenesis with cross-reference checks
and full round-trip + secondary-index-rebuild keeper tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JayT106 JayT106 requested a review from a team as a code owner March 20, 2026 19:19
@JayT106 JayT106 requested review from ApacCronos and XinyuCRO and removed request for a team March 20, 2026 19:19
@JayT106 JayT106 changed the base branch from master to feat/tokenomic March 20, 2026 19:20
@github-actions
Copy link
Copy Markdown

@JayT106 your pull request is missing a changelog!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JayT106 JayT106 changed the title add full genesis export/import for tieredrewards module feat: add full genesis export/import for tieredrewards module Mar 20, 2026
@JayT106 JayT106 changed the title feat: add full genesis export/import for tieredrewards module feat(tieredrewards): add full genesis export/import for tieredrewards module Mar 20, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 28.75000% with 1995 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.71%. Comparing base (a51fa2f) to head (1c30742).
⚠️ Report is 1 commits behind head on feat/tokenomic.

Files with missing lines Patch % Lines
x/tieredrewards/types/types.pb.go 0.63% 1104 Missing ⚠️
x/tieredrewards/types/genesis.pb.go 0.41% 475 Missing ⚠️
x/tieredrewards/keeper/msg_server.go 60.28% 55 Missing and 57 partials ⚠️
x/tieredrewards/keeper/rewards.go 53.42% 67 Missing and 35 partials ⚠️
x/tieredrewards/keeper/position.go 54.00% 25 Missing and 21 partials ⚠️
x/tieredrewards/keeper/hooks.go 44.44% 32 Missing and 3 partials ⚠️
x/tieredrewards/types/msgs.go 36.17% 30 Missing ⚠️
x/tieredrewards/keeper/genesis.go 63.49% 11 Missing and 12 partials ⚠️
x/tieredrewards/types/position.go 67.16% 21 Missing and 1 partial ⚠️
x/tieredrewards/keeper/transfer_delegation.go 66.66% 7 Missing and 7 partials ⚠️
... and 7 more
Additional details and impacted files
@@                Coverage Diff                 @@
##           feat/tokenomic    #1248      +/-   ##
==================================================
- Coverage           34.69%   26.71%   -7.99%     
==================================================
  Files                 130      142      +12     
  Lines               17387    25775    +8388     
==================================================
+ Hits                 6032     6885     +853     
- Misses              10243    17598    +7355     
- Partials             1112     1292     +180     
Flag Coverage Δ
integration_tests 17.71% <5.96%> (-7.39%) ⬇️
integration_tests_byzantine 9.04% <5.64%> (-3.00%) ⬇️
integration_tests_gov 9.16% <5.42%> (-3.10%) ⬇️
integration_tests_grpc 9.14% <5.21%> (-3.12%) ⬇️
integration_tests_ibc 18.39% <5.21%> (-7.65%) ⬇️
integration_tests_ledger 9.14% <5.21%> (-3.12%) ⬇️
integration_tests_slow 9.18% <5.64%> (-3.07%) ⬇️
integration_tests_solomachine 9.02% <5.21%> (-3.06%) ⬇️
integration_tests_upgrade 9.14% <5.21%> (-3.12%) ⬇️
unit_tests 9.63% <27.35%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thomas-nguy
Copy link
Copy Markdown
Contributor

closing this PR to facilitate the review

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