test(scenario): fix time-unit and reward-accounting assertions#1264
test(scenario): fix time-unit and reward-accounting assertions#1264
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (4)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|



Description
This PR fixes scenario tests that were using block height skips as if they were wall-clock seconds, and clarifies the staking warmup penalty accounting that was previously mixing separate reward flows into one number.
The changes make the scenario intent explicit by deriving skip heights from
5 seconds / blockand updating the golden outputs to match.Why This Change Is Needed
testing.SkipHeights(N)skipsNblocks. In the GnoVM test environment, one block advances time by 5 seconds. Some scenario tests treatedNas seconds, which made the scenarios run much later than their labels claimed.Two concrete cases were fixed:
SkipHeights(3600)advanced time by 18,000 seconds instead of 3,600 seconds.SkipHeights(7776000)for a 180-day project, but7,776,000blocks at 5 seconds per block is 450 days. The correct block count for 180 days is:Leaving these values as magic numbers made the scenarios easy to misread and could hide regressions around time-sensitive reward logic.
What Changed
blockTimeSeconds = 53600 seconds / 5 seconds per block = 720 blocksCollectReward3,110,400blocks.Does the New Values Are Correct
The corrected launchpad value,
3,110,400, is the exact number of 5-second blocks in 180 days. This matches the launchpad tier model, where the longest tier ends at 180 days.The corrected staking warmup value,
720, is the exact number of 5-second blocks in 3,600 seconds. The resulting collection time is3,605seconds after stake because the stake itself and the later collection happen on block boundaries. This is still inside the cumulative warmup penalty period of12,600seconds, so the test now validates the intended warmup path.The launchpad reward and refund amounts did not change after replacing the 450-day overskip with the correct 180-day skip. That confirms the tests only needed to reach the fully ended project state; the previous extra 270 days were unnecessary and misleading.
The warmup penalty numbers changed because the test now measures the actual
CollectRewardwarmup penalty separately from unrelated community pool emission distribution. The community pool balance delta is intentionally larger than the warmup penalty because it includes both:MintAndDistributeGns