Skip to content

Commit

Permalink
fix moar tests
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <[email protected]>
  • Loading branch information
shrenujb committed Mar 4, 2024
1 parent 40eb007 commit 3a6e12b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions protocol/testutil/constants/pricefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,32 @@ var (
Exchange2_Price2_TimeT,
},
},
{
MarketId: MarketId3,
ExchangePrices: []*api.ExchangePrice{
Exchange3_Price3_TimeT,
},
},
}
AtTimeTSingleExchangeSmoothedPrices = map[uint32]uint64{
MarketId0: Exchange0_Price4_TimeT.Price,
MarketId1: Exchange1_Price1_TimeT.Price,
MarketId2: Exchange2_Price2_TimeT.Price,
MarketId3: Exchange3_Price3_TimeT.Price,
}

AtTimeTSingleExchangeSmoothedPricesPlus10 = map[uint32]uint64{
MarketId0: Exchange0_Price4_TimeT.Price + 10,
MarketId1: Exchange1_Price1_TimeT.Price + 10,
MarketId2: Exchange2_Price2_TimeT.Price + 10,
MarketId3: Exchange3_Price3_TimeT.Price + 10,
}

AtTimeTSingleExchangeSmoothedPricesPlus7 = map[uint32]uint64{
MarketId0: Exchange0_Price4_TimeT.Price + 7,
MarketId1: Exchange1_Price1_TimeT.Price + 7,
MarketId2: Exchange2_Price2_TimeT.Price + 7,
MarketId3: Exchange3_Price3_TimeT.Price + 7,
}

MixedTimePriceUpdate = []*api.MarketPriceUpdate{
Expand Down
6 changes: 3 additions & 3 deletions protocol/x/clob/keeper/liquidations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ func TestPlacePerpetualLiquidation(t *testing.T) {
mock.Anything,
).Return(nil)
mockBankKeeper.On(
"SendCoinsFromModuleToModule",
"SendCoins",
mock.Anything,
satypes.ModuleName,
perptypes.InsuranceFundName,
authtypes.NewModuleAddress(satypes.ModuleName),
authtypes.NewModuleAddress(perptypes.InsuranceFundName),
mock.Anything,
).Return(nil)
// Fee collector does not have any funds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func TestUpdateMarketPrices_SkipNonDeterministicCheck_Valid(t *testing.T) {
constants.MarketId0: 11,
constants.MarketId1: constants.ThreeBillion, // no change
constants.MarketId2: constants.FiveBillion, // no change
constants.MarketId3: constants.FiveBillion, // no change
},
},
"Index price trends in the opposite direction of update price from current price, but still updates state": {
Expand All @@ -247,6 +248,7 @@ func TestUpdateMarketPrices_SkipNonDeterministicCheck_Valid(t *testing.T) {
constants.MarketId0: price_4_995_000_001,
constants.MarketId1: constants.ThreeBillion, // no change
constants.MarketId2: constants.FiveBillion, // no change
constants.MarketId3: constants.FiveBillion, // no change
},
},
"Index price crossing = true, old_ticks > 1, new_ticks <= sqrt(old_ticks) = false": {
Expand All @@ -269,6 +271,7 @@ func TestUpdateMarketPrices_SkipNonDeterministicCheck_Valid(t *testing.T) {
constants.MarketId0: price_5_015_000_000,
constants.MarketId1: constants.ThreeBillion, // no change
constants.MarketId2: constants.FiveBillion, // no change
constants.MarketId3: constants.FiveBillion, // no change
},
},
"Index price crossing = true, old_ticks <= 1, new_ticks <= old_ticks = false": {
Expand All @@ -291,6 +294,7 @@ func TestUpdateMarketPrices_SkipNonDeterministicCheck_Valid(t *testing.T) {
constants.MarketId0: price_5_015_000_000,
constants.MarketId1: constants.ThreeBillion, // no change
constants.MarketId2: constants.FiveBillion, // no change
constants.MarketId3: constants.FiveBillion, // no change
},
},
}
Expand Down

0 comments on commit 3a6e12b

Please sign in to comment.