You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which assumes the first leading digits will always be non-empty and confirmed alas that if one passes in the variants of a valid decimal string like ".99" or "10.", the former crashes with
$ go test -run=FormatxDecimal -v
=== RUN TestFormatxDecimal
Callers: /Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1446
Parts: []string{"", "10"}
--- FAIL: TestFormatxDecimal (0.00s)
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 19 [running]:
testing.tRunner.func1.2({0x1446b60, 0xc0000d0288})
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1399 +0x39f
panic({0x1446b60, 0xc0000d0288})
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/runtime/panic.go:884 +0x212
cosmossdk.io/tx/textual/valuerenderer.formatInteger({0x1470b3a?, 0xc0000ba008?})
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/tx/textual/valuerenderer/int.go:33 +0xef
cosmossdk.io/tx/textual/valuerenderer.formatDecimal({0x1470b3a, 0x3})
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/tx/textual/valuerenderer/dec.go:41 +0x16c
cosmossdk.io/tx/textual/valuerenderer.TestFormatxDecimal(0xc00017a000)
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/tx/textual/valuerenderer/dec_test.go:6 +0x31
testing.tRunner(0xc00017a000, 0x14a6280)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1493 +0x35f
exit status 2
FAIL cosmossdk.io/tx/textual/valuerenderer 0.219s
Summary of Bug
While auditing the code in TX_SIGNMODE_TEXTUAL, I read through the code in
cosmos-sdk/tx/textual/valuerenderer/int.go
Lines 32 to 33 in ccc8003
Version
ccc8003
Steps to Reproduce
and the question is, should we support "" and return "0" so that ".99" can work just the way "10." works? Fuzzers will also flag this.
Kindly cc-ing @AmauryM @marbar3778.
The text was updated successfully, but these errors were encountered: