Skip to content

Commit

Permalink
Merge pull request #11688 from vegaprotocol/11687
Browse files Browse the repository at this point in the history
fix: potential division by zero in notional reward metric evaluation …
  • Loading branch information
jeremyletang authored Sep 16, 2024
2 parents 3ed0bf2 + 6011c39 commit 7573960
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- [11665](https://github.com/vegaprotocol/vega/issues/11665) - Delay the final termination of a transfer to the following epoch.
- [11679](https://github.com/vegaprotocol/vega/issues/11679) - Fix calculation of fees in party `stats`.
- [11665](https://github.com/vegaprotocol/vega/issues/11665) - Delay the final termination of a transfer to the following epoch.

- [11687](https://github.com/vegaprotocol/vega/issues/11687) - Fix potential division by zero in notional reward metric evaluation.
## 0.78.1

### 🐛 Fixes
Expand Down
2 changes: 1 addition & 1 deletion core/execution/common/market_activity_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ func calcNotionalAt(n *twNotional, t, tn int64, markPrice *num.Uint) *num.Uint {
}
p1 := num.UintZero().Mul(n.currentEpochTWNotional, tnOverTComp)
var notional *num.Uint
if markPrice != nil && !markPrice.IsZero() {
if markPrice != nil && !markPrice.IsZero() && !(n.price.IsZero() || n.notional.IsZero()) {
notional, _ = num.UintFromDecimal(n.notional.ToDecimal().Div(n.price.ToDecimal()).Mul(markPrice.ToDecimal()))
} else {
notional = n.notional
Expand Down

0 comments on commit 7573960

Please sign in to comment.