Commit 842b5cd
committed
nonce staking guards, iter close (#922)
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v ✰ Thanks for creating a PR! You're awesome! ✰
v Please note that maintainers will only review those PRs with a
completed PR template.
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
## Purpose of Changes and their Description
Includes: nil guards in nonce paths, safer reputer nonce deref,
prune-worker no-op consistency, missing iter.Close().
## Are these changes tested and documented?
- [x] If tested, please describe how. If not, why tests are not needed.
-- unit tests modified accordingly
- [ ] If documented, please describe where. If not, describe why docs
are not needed. -- no need, no func change
- [ ] Added to `Unreleased` section of `CHANGELOG.md`? -- no need , no
func change
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Modularized the emissions keeper into focused sub-keepers and added
robust nonce/staking guards to prevent nil derefs and window
inconsistencies. No external message or query API changes; improves
safety, clarity, and testability.
- **Refactors**
- Split monolithic Keeper into sub-keepers: Params, Topic, Staking,
Scores, Nonce, Regrets, ReputerLoss, Weights, Banking, and
ActorPenalties.
- Rewired Msg/Query servers and tests to use injected sub-keepers and
simple getters (e.g., GetParamsKeeper()).
- Moved EMA score logic, weights, staking, topics, regrets, and nonce
management into dedicated files with constructor funcs.
- **Bug Fixes**
- Added nil input checks and nil-safe iteration across nonce methods
(Fulfill/Add/Is*/Prune) to prevent panics; PruneWorkerNonces now no-ops
when empty.
- Closed a missing iterator in staking
(GetDelegateStakeRemovalForDelegatorReputerAndTopicId).
<sup>Written for commit 903d5df.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->1 parent aed8585 commit 842b5cd
3 files changed
Lines changed: 34 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
| |||
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
| |||
172 | 181 | | |
173 | 182 | | |
174 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
175 | 187 | | |
176 | 188 | | |
177 | 189 | | |
| |||
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
183 | | - | |
| 195 | + | |
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
| |||
197 | 209 | | |
198 | 210 | | |
199 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
200 | 215 | | |
201 | 216 | | |
202 | 217 | | |
| |||
236 | 251 | | |
237 | 252 | | |
238 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
239 | 257 | | |
240 | 258 | | |
241 | 259 | | |
242 | 260 | | |
243 | 261 | | |
244 | 262 | | |
245 | 263 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | 264 | | |
250 | 265 | | |
251 | 266 | | |
252 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
253 | 271 | | |
254 | 272 | | |
255 | 273 | | |
| |||
381 | 399 | | |
382 | 400 | | |
383 | 401 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 402 | + | |
| 403 | + | |
388 | 404 | | |
389 | 405 | | |
390 | 406 | | |
| |||
420 | 436 | | |
421 | 437 | | |
422 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
423 | 442 | | |
424 | 443 | | |
425 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
663 | 661 | | |
664 | 662 | | |
665 | 663 | | |
666 | | - | |
| 664 | + | |
667 | 665 | | |
668 | 666 | | |
669 | 667 | | |
670 | 668 | | |
671 | 669 | | |
672 | 670 | | |
673 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
674 | 677 | | |
675 | 678 | | |
676 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
| 516 | + | |
516 | 517 | | |
517 | 518 | | |
518 | 519 | | |
| |||
0 commit comments