From ccad95c37746b2932fc8214dcdb459b5aa0985a2 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Tue, 19 Mar 2024 14:07:56 +0200 Subject: [PATCH] wip --- x/dex/keeper/limit_order_expiration_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/x/dex/keeper/limit_order_expiration_test.go b/x/dex/keeper/limit_order_expiration_test.go index 7bcbca891..de8aa2cad 100644 --- a/x/dex/keeper/limit_order_expiration_test.go +++ b/x/dex/keeper/limit_order_expiration_test.go @@ -5,6 +5,7 @@ import ( "time" "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/neutron-org/neutron/v3/x/dex/keeper" @@ -102,7 +103,7 @@ func (s *DexTestSuite) TestPurgeExpiredLimitOrders() { keeper := s.App.DexKeeper now := time.Now().UTC() ctx := s.Ctx.WithBlockTime(now) - ctx = ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000)) + ctx = ctx.WithBlockGasMeter(storetypes.NewGasMeter(1000000)) yesterday := now.AddDate(0, 0, -1) tomorrow := now.AddDate(0, 0, 1) @@ -144,7 +145,7 @@ func (s *DexTestSuite) TestPurgeExpiredLimitOrdersAtBlockGasLimit() { now := time.Now().UTC() ctx := s.Ctx.WithBlockTime(now) gasLimit := 1000000 - ctx = ctx.WithBlockGasMeter(sdk.NewGasMeter(uint64(gasLimit))) + ctx = ctx.WithBlockGasMeter(storetypes.NewGasMeter(uint64(gasLimit))) timeRequiredToPurgeOneNonJIT := 35000 gasUsed := gasLimit - types.GoodTilPurgeGasBuffer - timeRequiredToPurgeOneNonJIT @@ -160,7 +161,7 @@ func (s *DexTestSuite) TestPurgeExpiredLimitOrdersAtBlockGasLimit() { createLimitOrderExpirationAndTranches(&keeper, ctx, expTimes) // IF blockGasMeter is nearing the GoodTilPurgeBuffer - ctx = ctx.WithGasMeter(sdk.NewGasMeter(uint64(gasLimit))) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(uint64(gasLimit))) ctx.BlockGasMeter().ConsumeGas(uint64(gasUsed), "stub block gas usage") // WHEN PurgeExpiredLimitOrders is run @@ -182,7 +183,7 @@ func (s *DexTestSuite) TestPurgeExpiredLimitOrdersAtBlockGasLimitOnlyJIT() { now := time.Now().UTC() ctx := s.Ctx.WithBlockTime(now) gasLimt := 1000000 - ctx = ctx.WithBlockGasMeter(sdk.NewGasMeter(uint64(gasLimt))) + ctx = ctx.WithBlockGasMeter(storetypes.NewGasMeter(uint64(gasLimt))) gasUsed := gasLimt - types.GoodTilPurgeGasBuffer - 30000 expTimes := []time.Time{ @@ -196,7 +197,7 @@ func (s *DexTestSuite) TestPurgeExpiredLimitOrdersAtBlockGasLimitOnlyJIT() { } createLimitOrderExpirationAndTranches(&keeper, ctx, expTimes) - ctx = ctx.WithGasMeter(sdk.NewGasMeter(100000)) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(100000)) ctx.BlockGasMeter().ConsumeGas(uint64(gasUsed), "stub block gas usage") keeper.PurgeExpiredLimitOrders(ctx, now)