fix(thorchain): cap rounded bond rewards by the funded balance

Problem

Independently rounded node rewards can collectively exceed the available bond-reward balance. Clamping the subsequent balance subtraction to zero does not prevent an unfunded award from already being allocated.

Changes

  • Cap each calculated node reward by the remaining network.BondRewardRune balance before fees, payouts, or rebonding.
  • Preserve the existing reward-weighting calculation.
  • Add a five-validator regression covering zero and small reward pools, with bond yield enabled and disabled.
  • Check that distributed rewards match the funded amount and the bond invariant remains intact.

Scope and compatibility

This is a Common THORNode accounting fix extracted from S00 (!5026). It has no dependency on the XMR keygen or recovery changes.

It changes consensus-sensitive reward calculation and must ship through the coordinated application release, not as a Bifrost-only backport.

Verification

  • Focused reward tests passed with mocknet.
  • The new regression passed untagged, repeated three times.
Edited by ZlyDevMaya

Merge request reports

Loading
Loading