ethpandaops / checkpointz

An Ethereum beacon chain checkpoint sync provider
GNU General Public License v3.0
141 stars 31 forks source link

Invalid memory address #159

Closed Faithtosin closed 8 months ago

Faithtosin commented 8 months ago

I'm getting runtime error: invalid memory address or nil pointer dereference with version 0.20.0 and Lodestar v1.16.0.

Full error log below:

2024/03/11 13:01:30 http: panic serving 51.159.85.94:53932: runtime error: invalid memory address or nil pointer dereference
goroutine 821 [running]:
net/http.(*conn).serve.func1()
        /opt/hostedtoolcache/go/1.19.13/x64/src/net/http/server.go:1850 +0xbf
panic({0xc23b80, 0x1549970})
        /opt/hostedtoolcache/go/1.19.13/x64/src/runtime/panic.go:890 +0x262
github.com/ethpandaops/checkpointz/pkg/service/eth.(*Handler).DepositSnapshot(0xc00027e030, {0x10479b0, 0xc000cc14c0})
        /runner/_work/checkpointz/checkpointz/pkg/service/eth/eth.go:189 +0x100
github.com/ethpandaops/checkpointz/pkg/api.(*Handler).handleEthV1BeaconDepositSnapshot(0xc000554ee0, {0x10479b0, 0xc000cc14c0}, 0x0?, {0xc0004acb00?, 0x4000100?, 0x0?}, 0xc000012318?)
        /runner/_work/checkpointz/checkpointz/pkg/api/handler.go:580 +0x126
github.com/ethpandaops/checkpointz/pkg/api.(*Handler).wrappedHandler.func1({0x1046fc8, 0xc000d5ce00}, 0xc0004fbe00, {0x0, 0x0, 0x0})
        /runner/_work/checkpointz/checkpointz/pkg/api/handler.go:111 +0x4c6
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc0000b0a80, {0x1046fc8, 0xc000d5ce00}, 0xc0004fbe00)
        /home/runner/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387 +0x81c
github.com/nanmu42/gzip.(*Handler).WrapHandler.func1({0x1046fc8, 0xc000d5ce00}, 0x7f98d0b677f8?)
        /home/runner/go/pkg/mod/github.com/nanmu42/gzip@v1.2.0/handler.go:252 +0x19a
net/http.HandlerFunc.ServeHTTP(0x0?, {0x1046fc8?, 0xc000d5ce00?}, 0x46852e?)
        /opt/hostedtoolcache/go/1.19.13/x64/src/net/http/server.go:2109 +0x2f
net/http.serverHandler.ServeHTTP({0xc000466de0?}, {0x1046fc8, 0xc000d5ce00}, 0xc0004fbe00)
        /opt/hostedtoolcache/go/1.19.13/x64/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000ccc960, {0x1047a58, 0xc00027e480})
        /opt/hostedtoolcache/go/1.19.13/x64/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /opt/hostedtoolcache/go/1.19.13/x64/src/net/http/server.go:3102 +0x4db
time="2024-03-11T13:01:40Z" level=error msg="Failed to check for new serving checkpoint" error="failed to fetch bundle: failed to download and store deposit snapshot: status code: 404" module=beacon/default

The Latest Finalized and Latest Justified Epoch and Block Roots do not appear on the UI.

philknows commented 8 months ago

I'm not entirely understanding either how the diff between v0.19.2 and v0.20.0 caused this. Any ideas from your side @samcm ?

samcm commented 8 months ago

Fixed in https://github.com/ethpandaops/checkpointz/pull/160 which is building in v0.21.0 now 🎉

The panic could occur if someone requested the deposit snapshot before Checkpointz knew what the finalized checkpoint was