0g-chain/x/pricefeed/abci_test.go
Robert Pirtle af611ca8e1
(v0.26 <- #1851) Optimize Pricefeed EndBlocker (#1895)
* Optimize Pricefeed EndBlocker (#1851)

* optimize pricefeed endblocker to iterate all markets only once to remove
overhead of opening and closing iterator for each market individually.
In addition, extend tests to cover 100% of abci and price updating
behavior.

* use test cases that can't be confused with mean to ensure median is
always used

* update kvtool to master branch

* update changelog

---------

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
2024-05-29 15:44:53 -07:00

21 lines
555 B
Go

package pricefeed_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/pricefeed"
"github.com/kava-labs/kava/x/pricefeed/keeper"
"github.com/kava-labs/kava/x/pricefeed/testutil"
)
func TestEndBlocker_UpdatesMultipleMarkets(t *testing.T) {
testutil.SetCurrentPrices_PriceCalculations(t, func(ctx sdk.Context, keeper keeper.Keeper) {
pricefeed.EndBlocker(ctx, keeper)
})
testutil.SetCurrentPrices_EventEmission(t, func(ctx sdk.Context, keeper keeper.Keeper) {
pricefeed.EndBlocker(ctx, keeper)
})
}