streamingfast / substreams

Powerful Blockchain streaming data engine, based on StreamingFast Firehose technology.
Apache License 2.0
159 stars 45 forks source link

GUI crashes on TAB #181

Closed YaroShkvorets closed 1 year ago

YaroShkvorets commented 1 year ago

Using latest version

~ substreams --version
substreams version dev (Commit 986ae7d, Built 2023-02-10T19:35:01Z)

Running this command with this particular substream: substreams gui -e mainnet.eth.streamingfast.io:443 https://github.com/streamingfast/substreams-eth-block-meta/releases/download/v0.4.0/substreams-eth-block-meta-v0.4.0.spkg db_out -t 10000

Press TAB as soon as it connects. Program crashes with this stack trace:

substreams gui -e mainnet.eth.streamingfast.io:443 https://github.com/streamingfast/substreams-eth-block-meta/releases/download/v0.4.0/substreams-eth-block-meta-v0.4.0.spkg db_out -t 1000
Launching Substreams GUI...
Caught panic:

runtime error: index out of range [-9223372036854775808]

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
    /usr/local/Cellar/go/1.19.5/libexec/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
    /usr/local/Cellar/go/1.19.5/libexec/src/runtime/debug/stack.go:16 +0x19
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
    /Users/shkvo/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.23.1/tea.go:383 +0x95
panic({0x1023e6080, 0xc000f2e888})
    /usr/local/Cellar/go/1.19.5/libexec/src/runtime/panic.go:890 +0x262
github.com/streamingfast/substreams/tui2/components/blockselect.(*BlockSelect).View(0xc0000beb90)
    /Users/shkvo/github/Pinax/streamingFast/substreams/tui2/components/blockselect/blockselect.go:107 +0x789
github.com/streamingfast/substreams/tui2/pages/output.(*Output).View(0xc000a4a780)
    /Users/shkvo/github/Pinax/streamingFast/substreams/tui2/pages/output/output.go:158 +0x65
github.com/streamingfast/substreams/tui2.(*UI).View(0xc000ed2080)
    /Users/shkvo/github/Pinax/streamingFast/substreams/tui2/ui.go:167 +0x409
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc0007202c0, {0x102ab5898?, 0xc000ed2080?}, 0xc000eaa601?)

This line here Looks like we assume that blocks always start at 1, so blk - b.lowBlock here equals -1, underflowing the index here

YaroShkvorets commented 1 year ago

This seems fixed in v1.0.0