From 04d7de0542e822446c3b84d8a7611c91d4ef1813 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Thu, 8 Aug 2024 11:10:04 +0100 Subject: [PATCH] Merge pull request #11539 from vegaprotocol/fix_spot_spam_bug fix: order spam check for spot fixed --- CHANGELOG.md | 7 +++++++ core/execution/spot/market.go | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64116d62f1..4bf41603da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.77.7 + +### 🐛 Fixes + +- [11540](https://github.com/vegaprotocol/vega/issues/11540) - Fix spam check for spots to use not double count quantum. + + ## 0.77.6 ### 🐛 Fixes diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index a2e40ab43d..a286de1b4e 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -3346,10 +3346,9 @@ func (m *Market) checkOrderForSpam(side types.Side, orderPrice *num.Uint, orderS price, _ = num.UintFromDecimal(orderPrice.ToDecimal().Mul(m.priceFactor)) } - minQuantum := assetQuantum.Mul(quantumMultiplier) value := num.UintZero().Mul(num.NewUint(orderSize), price).ToDecimal() value = value.Div(m.positionFactor) - required := minQuantum.Mul(assetQuantum) + required := assetQuantum.Mul(quantumMultiplier) if value.LessThan(required) { return fmt.Errorf(fmt.Sprintf("order value (%s) is less than minimum holding requirement for spam (%s)", value.String(), required.String())) }