Commit d55a0f4
fix(nns): Drive node provider rewards mint to completion in golden state upgrade test (#10723)
## Problem
`test_upgrade_canisters_with_golden_nns_state` was failing in CI with:
```
After upgrading and advancing time, node provider rewards timestamp did not increase.
Before: 1781451541, After: 1781451541
```
(panic at
`rs/nns/integration_tests/src/upgrade_canisters_with_golden_nns_state.rs:556`)
## Root cause
`advance_time_to_allow_for_voting_and_node_rewards` jumps the state
machine clock ~1–2 months forward to trigger the monthly node provider
rewards distribution, then ticks a **fixed 100 times** expecting the
mint to have completed. That is not enough ticks:
- The mint (in the governance heartbeat) can only validate once the
**node-rewards canister has synced** its node metrics up to the
requested period — its sync runs on an hourly timer, so it needs several
ticks to fire and complete after the abrupt time jump. Until then the
node-rewards canister rejects the request with `"Metrics and registry
are not synced up to to_date"`.
- Once it validates, the mint makes **one inter-canister call per day**
in the reward period (which spans ~55 days here, because the golden
state's last reward is well behind the test's execution date) plus **one
ledger transfer per node provider**.
When the mint does not finish within the 100-tick budget, the reward
timestamp is never updated (the mint error is only logged, not fatal),
and the `assert_increased` check on the node provider rewards timestamp
fails. This gets worse the staler the pinned golden state is relative to
the test's run date.
## Fix
Replace the fixed `for _ in 0..100` tick loop with
`tick_until_node_provider_rewards_distributed`, which ticks (1s/tick)
and polls the reward timestamp until a new reward is actually
distributed (timestamp increases past the previous one), up to a
generous cap (`MAX_TICKS = 2000`). This makes the wait adaptive to how
stale the golden state is, while still failing with the same informative
assertion in `check_all` if no reward is ever distributed.
Behavior for the passing case is preserved: the distribution is still
triggered at the same moment; only the wait is now adaptive instead of a
fixed count.
## Testing
- `rustfmt` clean.
- `bazel build
//rs/nns/integration_tests:upgrade_canisters_with_golden_nns_state`
passes.
- The test itself is a `manual`/nightly golden-state test (requires
downloading the golden NNS state) and was not run locally.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 44c49ca commit d55a0f4
1 file changed
Lines changed: 43 additions & 4 deletions
Lines changed: 43 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
462 | 469 | | |
463 | 470 | | |
464 | 471 | | |
| |||
471 | 478 | | |
472 | 479 | | |
473 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
474 | 513 | | |
475 | 514 | | |
476 | 515 | | |
| |||
0 commit comments