Querier pool endpoints earlier than block 12241034 error from GetLoanCollateralRemainingForPool negative MaxRuneSupply error
Discord thread here:
https://discord.com/channels/838986635756044328/1197079911207272478/1197082340736892948
Example endpoints:
https://thornode-v1.ninerealms.com/thorchain/pool/BTC.BTC?height=12241033
{"error":"rpc error: code = Unknown desc = internal"}
https://thornode-v1.ninerealms.com/thorchain/pool/BTC.BTC?height=12241034
Normal.
https://thornode-v1.ninerealms.com/thorchain/mimir/key/MaxRuneSupply?height=12241033
-1
https://thornode-v1.ninerealms.com/thorchain/mimir/key/MaxRuneSupply?height=12241034
50000000000000000
From the recent!3318 :
https://gitlab.com/thorchain/thornode/-/blame/v1.126.0/x/thorchain/querier.go?page=2#L1289-1294
loanHandler := NewLoanOpenHandler(mgr)
cr, _ := loanHandler.getPoolCR(ctx, pool, cosmos.OneUint())
loanCollateralRemaining, err := loanHandler.GetLoanCollateralRemainingForPool(ctx, pool)
if err != nil {
return nil, fmt.Errorf("fail to fetch remaining loan collateral: %w", err)
}
Neither the getPoolCR
nor the GetLoanCollateralRemainingForPool
call involve a panic, but both return an error for negative MaxRuneSupply
.
getPoolCR
:
https://gitlab.com/thorchain/thornode/-/blob/v1.126.0/x/thorchain/handler_loan_open.go#L367-369
maxRuneSupply := fetchConfigInt64(ctx, h.mgr, constants.MaxRuneSupply)
if maxRuneSupply <= 0 {
return cosmos.ZeroUint(), fmt.Errorf("no max supply set")
GetLoanCollateralRemainingForPool
:
https://gitlab.com/thorchain/thornode/-/blob/v1.126.0/x/thorchain/handler_loan_open.go#L497-499
maxRuneSupply := fetchConfigInt64(ctx, h.mgr, constants.MaxRuneSupply)
if maxRuneSupply <= 0 {
return cosmos.ZeroUint(), fmt.Errorf("no max supply set")
As GetLoanCollateralRemainingForPool
is expected to return an error for most historical blocks,
I currently propose that the GetLoanCollateralRemainingForPool
calls in querier.go
's queryPool
and queryPools
also drop their error like getPoolCR
(with a comment as to why).
Specifically: !3375 (merged)
'Drop querier GetLoanCollateralRemainingForPool
error, since negative MaxRuneSupply
error expected before height 12241034'.