Does a negative MaxRuneSupply cause handler_loan_open validate to panic?
Referring to here:
maxAmt := fetchConfigInt64(ctx, h.mgr, constants.MaxRuneSupply)
runeBurnt := common.SafeSub(cosmos.NewUint(uint64(maxAmt)), supply)
An int64 can be positive or negative;
a negative Mimir key value (whether fetchConfigInt64
or GetConfigInt64
) causes the key's value to fall back to the Constant's value,
but MaxRuneSupply is the only Constant with a negative value (-1).
There is a check for being non-positive, but this is only in openLoan
and not in validate
.
Trying in the Go Playground:
https://go.dev/play/p/m_J7E4L557f
fmt.Println(uint64(int64(-1)))
./prog.go:8:21: cannot convert int64(-1) (constant -1 of type int64) to type uint64
Go build failed.
What effects in practice would this have on THORNode operation, and would it be appropriate to put a negative-value check into validate
as well?
(For this Issue, I currently propose !2909 (merged).)