Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy04 committed Aug 20, 2024
1 parent 0c550b3 commit 5258b14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
"fmt"
"sync"

clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types"
Expand Down Expand Up @@ -40,7 +41,13 @@ func (ls *DaemonLiquidationInfo) Update(
ls.negativeTncSubaccountIds = make([]satypes.SubaccountId, 0)
ls.subaccountsWithPositions = make(map[uint32]*clobtypes.SubaccountOpenPositionInfo)
} else if blockHeight < ls.blockHeight {
panic("UpdateLiquidatableSubaccountIds: block height cannot be less than the current block height")
panic(
fmt.Sprintf(
"UpdateLiquidatableSubaccountIds: block height %d cannot be less than the current block height %d",
blockHeight,
ls.blockHeight,
),
)
}
ls.UpdateBlockHeight(blockHeight)

Expand Down
3 changes: 3 additions & 0 deletions protocol/x/clob/e2e/withdrawal_gating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ func TestWithdrawalGating_NegativeTncSubaccount_BlocksThenUnblocks(t *testing.T)
}

_, err := tApp.App.Server.LiquidateSubaccounts(ctx, &api.LiquidateSubaccountsRequest{
BlockHeight: 3,
LiquidatableSubaccountIds: tc.liquidatableSubaccountIds,
NegativeTncSubaccountIds: tc.negativeTncSubaccountIds,
SubaccountOpenPositionInfo: clobtest.GetOpenPositionsFromSubaccounts(tc.subaccounts),
Expand Down Expand Up @@ -513,6 +514,8 @@ func TestWithdrawalGating_NegativeTncSubaccount_BlocksThenUnblocks(t *testing.T)
// unblocked after the withdrawal gating period passes.
if tc.expectedErr != "" {
_, err = tApp.App.Server.LiquidateSubaccounts(ctx, &api.LiquidateSubaccountsRequest{
BlockHeight: tc.expectedNegativeTncSubaccountSeenAtBlock[tc.gatedPerpetualId] +
satypes.WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_NEGATIVE_TNC_SUBACCOUNT_SEEN_BLOCKS,
LiquidatableSubaccountIds: tc.liquidatableSubaccountIds,
NegativeTncSubaccountIds: []satypes.SubaccountId{},
SubaccountOpenPositionInfo: clobtest.GetOpenPositionsFromSubaccounts(tc.subaccounts),
Expand Down

0 comments on commit 5258b14

Please sign in to comment.