rpc poller crashes on startup
Opened this issue · 0 comments
matthewdarwin commented
With the following config
reader-node-arguments: "fetch rpc https://lb.drpc.org/ogrpc?network=solana&dkey=xxxxxxxxxxxx --state-dir=/var/lib/firehose"
The RPC poller crashes on startup.
2024-08-07T14:54:09.923Z INFO (firesol) fetched block {"block_num": 0, "block_hash": "4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZAMdL4VZHirAn"}
2024-08-07T14:54:09.923Z WARN (firesol) unable to load cursor file, initializing a new forkdb {"start_block": "#0 (4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZAMdL4VZHirAn)", "lib": "#0 (4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZAMdL4VZHirAn)", "error": "unable to open cursor file /var/lib/dfuse/cursor.json: open /var/lib/dfuse/cursor.json: no such file or directory"}
2024-08-07T14:54:09.923Z INFO (firesol) about to fetch block {"block_to_fetch": 0}
2024-08-07T14:54:09.923Z INFO (firesol) requesting block {"block_num": 0}
2024-08-07T14:54:09.923Z INFO (firesol) checking if block is available {"request_block_num": 0, "latest_confirmed_slot": 0}
2024-08-07T14:54:09.923Z INFO (firesol) optimistically fetching block {"block_num": 0}
2024-08-07T14:54:09.923Z INFO (firesol) checking if block is available {"request_block_num": 1, "latest_confirmed_slot": 0}
2024-08-07T14:54:09.923Z INFO (firesol) fetching block {"block_num": 0}
2024-08-07T14:54:09.923Z INFO (firesol) fetching block {"block_num": 0, "latest_finalized_slot": 0, "latest_confirmed_slot": 0}
2024-08-07T14:54:10.211Z INFO (firesol) fetched block {"block_num": 0, "block_hash": "4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZAMdL4VZHirAn"}
2024-08-07T14:54:10.225Z INFO (firesol) block was optimistically polled {"block_num": 0}
2024-08-07T14:54:10.225Z INFO (firesol) processing block {"block": "#0 (4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZAMdL4VZHirAn)", "lib_num": 0}
panic: runtime error: index out of range [-1]
goroutine 1 [running]:
github.com/streamingfast/firehose-core/blockpoller.(*BlockPoller).saveState(0xc000b95c00, {0x2b7ac40, 0x0, 0x0?})
#011/local/golang/pkg/github.com/streamingfast/firehose-core@v1.5.6/blockpoller/state_file.go:60 +0x96c
github.com/streamingfast/firehose-core/blockpoller.(*BlockPoller).processBlock(0xc000b95c00, 0xc000ab7800, 0xc000dba960)
#011/local/golang/pkg/github.com/streamingfast/firehose-core@v1.5.6/blockpoller/poller.go:180 +0x979
github.com/streamingfast/firehose-core/blockpoller.(*BlockPoller).run(0xc000b95c00, {0x1e4b380?, 0xc000d955a8?}, 0xa)
#011/local/golang/pkg/github.com/streamingfast/firehose-core@v1.5.6/blockpoller/poller.go:134 +0x305
github.com/streamingfast/firehose-core/blockpoller.(*BlockPoller).Run(0xc000b95c00, {0x1e4de10, 0x2b7ac40}, 0x0, 0xa)
#011/local/golang/pkg/github.com/streamingfast/firehose-core@v1.5.6/blockpoller/poller.go:88 +0x278
github.com/streamingfast/firehose-solana/cmd/firesol/rpc.NewFetchCmd.fetchRunE.func2(0xc00063f808, {0xc000a95200, 0x2, 0x17db4a2?})
#011/tmp/build.1722876007.1686892/firehose-solana/cmd/firesol/rpc/fetcher.go:67 +0x7e7
github.com/spf13/cobra.(*Command).execute(0xc00063f808, {0xc000a95170, 0x3, 0x3})
#011/local/golang/pkg/github.com/spf13/cobra@v1.7.0/command.go:940 +0x882
github.com/spf13/cobra.(*Command).ExecuteC(0x2b000a0)
#011/local/golang/pkg/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
#011/local/golang/pkg/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
#011/tmp/build.1722876007.1686892/firehose-solana/cmd/firesol/main.go:31 +0x1a
Setting the start block to 1 makes it work.
Default start block should be 1?