fix(mstaking): detect zero-token exchange rates#526
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates the ChangesInvalid Exchange Rate Detection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #526 +/- ##
==========================================
+ Coverage 38.41% 38.46% +0.04%
==========================================
Files 327 327
Lines 30685 30693 +8
==========================================
+ Hits 11789 11807 +18
+ Misses 17006 16993 -13
- Partials 1890 1893 +3
🚀 New features to boost your workflow:
|
Description
Closes: 0xWeb3boy/Initia-Move-Bug#1
Update
Validator.InvalidExRate()to detect the zero-token exchange-rate state by iterating delegator shares instead of validator tokens.sdk.Coinsdrops zero-amount denoms, so a fully removed token balance is represented by an absent denom rather than a0coin entry.This keeps the guard aligned with the condition it is meant to catch: positive outstanding shares for a denom whose validator token balance is zero.
Validation:
go test ./x/mstaking/types -run TestInvalidExRate -count=1go test ./x/mstaking/types -count=1Breaking change: no.
Author Checklist
I have...
!in the type prefix if API or client breaking change: not applicableReviewers Checklist
I have...