umee-network / umee

A Golang implementation of the Umee network, a decentralized universal capital facility in the Cosmos ecosystem.
Apache License 2.0
225 stars 170 forks source link

Price-feeder: DAI is unavailable due to kraken sending expired rates, necessary for peggo. #1261

Closed RafilxTenfen closed 2 years ago

RafilxTenfen commented 2 years ago

Summary of Bug

Getting computed prices with old timestamp data panics

--- FAIL: TestGetComputedPricesPanic (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x63b7e8]

goroutine 58 [running]:
testing.tRunner.func1.2({0x19b51c0, 0x333c5e0})
    /usr/local/go/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
    /usr/local/go/src/testing/testing.go:1399 +0x39f
panic({0x19b51c0, 0x333c5e0})
    /usr/local/go/src/runtime/panic.go:884 +0x212
math/big.(*Int).Mul(0xc001087760, 0xc001087760, 0x0)
    /usr/local/go/src/math/big/int.go:167 +0xa8
github.com/cosmos/cosmos-sdk/types.Dec.MulMut({0xffffffffffffffff?}, {0x0?})
    /home/rafilx/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.0-umee.0.20220812010629-4d5bb2e3f73c/types/decimal.go:289 +0x28
github.com/cosmos/cosmos-sdk/types.Dec.ImmutOp({0x1996c80?}, 0x22ee7d8, {0x1c01831?})
    /home/rafilx/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.0-umee.0.20220812010629-4d5bb2e3f73c/types/decimal.go:232 +0x162
github.com/cosmos/cosmos-sdk/types.Dec.Mul(...)
    /home/rafilx/go/pkg/mod/github.com/umee-network/cosmos-sdk@v0.46.0-umee.0.20220812010629-4d5bb2e3f73c/types/decimal.go:284
github.com/umee-network/umee/price-feeder/oracle.convertCandlesToUSD({{0x258f600, 0xc000eaa220}, 0x7, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
    /home/rafilx/projects/github.com/umee-network/umee/price-feeder/oracle/convert.go:113 +0x3d5
github.com/umee-network/umee/price-feeder/oracle.GetComputedPrices({{0x258f600, 0xc000eaa220}, 0x7, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
    /home/rafilx/projects/github.com/umee-network/umee/price-feeder/oracle/oracle.go:282 +0x67
github.com/umee-network/umee/price-feeder/oracle.TestGetComputedPricesPanic(0xc0014829c0?)
    /home/rafilx/projects/github.com/umee-network/umee/price-feeder/oracle/oracle_test.go:779 +0x838
testing.tRunner(0xc0014829c0, 0x22f05f8)
    /usr/local/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:1493 +0x35f
FAIL    github.com/umee-network/umee/price-feeder/oracle    0.038s
FAIL

Version

Please provide the output of the following commands:

Steps to Reproduce

Steps to reproduce the behavior:

  1. ...

For Admin Use

RafilxTenfen commented 2 years ago

A temporary fix is being placed to solve panic #1262, but we still need to look into the correct behavior of ComputeTVWAP - see - https://github.com/umee-network/umee/pull/1262#issuecomment-1222468475

adamewozniak commented 2 years ago

Going to pick this up & try to see what's going on - this is a case where peggo does not need to be converted from DAI/ETH -> DAI/USD.

adamewozniak commented 2 years ago

Looks like the DAI candle here is expired (before timePeriod here)

This should be resolved by #1276 since FTX has a DAI/USD - I'll prioritize that since it'll help us with USDT too 😄

RafilxTenfen commented 2 years ago

resolved by https://github.com/umee-network/umee/issues/1276