|
1 | 1 | package types_test |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "math" |
4 | 5 | "testing" |
5 | 6 |
|
6 | 7 | "github.com/dydxprotocol/v4-chain/protocol/dtypes" |
@@ -80,6 +81,42 @@ func TestValidateQuotingParams(t *testing.T) { |
80 | 81 | }, |
81 | 82 | expectedErr: types.ErrInvalidActivationThresholdQuoteQuantums, |
82 | 83 | }, |
| 84 | + "Failure - SkewFactorPpm is high. Product of SkewFactorPpm and OrderSizePctPpm is above threshold.": { |
| 85 | + params: types.QuotingParams{ |
| 86 | + Layers: 2, |
| 87 | + SpreadMinPpm: 3_000, |
| 88 | + SpreadBufferPpm: 1_500, |
| 89 | + SkewFactorPpm: 20_000_000, |
| 90 | + OrderSizePctPpm: 100_000, |
| 91 | + OrderExpirationSeconds: 5, |
| 92 | + ActivationThresholdQuoteQuantums: dtypes.NewInt(1), |
| 93 | + }, |
| 94 | + expectedErr: types.ErrInvalidSkewFactor, |
| 95 | + }, |
| 96 | + "Failure - OrderSizePctPpm is high. Product of SkewFactorPpm and OrderSizePctPpm is above threshold.": { |
| 97 | + params: types.QuotingParams{ |
| 98 | + Layers: 2, |
| 99 | + SpreadMinPpm: 3_000, |
| 100 | + SpreadBufferPpm: 1_500, |
| 101 | + SkewFactorPpm: 2_000_000, |
| 102 | + OrderSizePctPpm: 1_000_000, |
| 103 | + OrderExpirationSeconds: 5, |
| 104 | + ActivationThresholdQuoteQuantums: dtypes.NewInt(1), |
| 105 | + }, |
| 106 | + expectedErr: types.ErrInvalidSkewFactor, |
| 107 | + }, |
| 108 | + "Failure - Both OrderSizePctPpm and SkewFactorPpm are MaxUint32. The product is above the threshold.": { |
| 109 | + params: types.QuotingParams{ |
| 110 | + Layers: 2, |
| 111 | + SpreadMinPpm: 3_000, |
| 112 | + SpreadBufferPpm: 1_500, |
| 113 | + SkewFactorPpm: math.MaxUint32, |
| 114 | + OrderSizePctPpm: math.MaxUint32, |
| 115 | + OrderExpirationSeconds: 5, |
| 116 | + ActivationThresholdQuoteQuantums: dtypes.NewInt(1), |
| 117 | + }, |
| 118 | + expectedErr: types.ErrInvalidSkewFactor, |
| 119 | + }, |
83 | 120 | } |
84 | 121 |
|
85 | 122 | for name, tc := range tests { |
|
0 commit comments