ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.65k stars 3.28k forks source link

Error when doing make op-node as go-libp2p/quic-go are not working well #7025

Closed 0xZangetsudev closed 1 year ago

0xZangetsudev commented 1 year ago

Hello I got these errors when trying to do make op-node without changing anything :

make -C ./op-node op-node
make[1]: Entering directory '/home/zangetsu/data2/optimism/op-node'
env GO111MODULE=on GOOS= GOARCH= go build -v -ldflags "-X main.GitCommit=f37a108c8affd46f0d8011947e226826e196cbdd -X main.GitDate=1692991674 -X github.com/ethereum-optimism/optimism/op-node/version.Version=v0.0.0 -X github.com/ethereum-optimism/optimism/op-node/version.Meta=" -o ./bin/op-node ./cmd/main.go
github.com/quic-go/quic-go/internal/utils/ringbuffer
github.com/quic-go/quic-go/internal/utils/linkedlist
github.com/quic-go/quic-go/internal/protocol
github.com/quic-go/quic-go/internal/utils
github.com/quic-go/quic-go/quicvarint
github.com/quic-go/quic-go/internal/qtls
github.com/quic-go/quic-go/internal/qerr
github.com/quic-go/quic-go/internal/flowcontrol
github.com/quic-go/quic-go/internal/wire
github.com/quic-go/quic-go/logging
github.com/quic-go/quic-go/internal/logutils
github.com/quic-go/quic-go/internal/congestion
github.com/quic-go/quic-go/internal/handshake
github.com/quic-go/quic-go/internal/ackhandler
github.com/quic-go/quic-go
github.com/quic-go/quic-go/qlog
github.com/quic-go/quic-go/http3
github.com/libp2p/go-libp2p/p2p/net/swarm
# github.com/libp2p/go-libp2p/p2p/net/swarm
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/net/swarm/swarm_dial.go:570:19: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/net/swarm/swarm_dial.go:636:16: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/net/swarm/swarm_dial.go:645:58: undefined: quic.VersionDraft29
github.com/libp2p/go-libp2p/p2p/transport/quicreuse
# github.com/libp2p/go-libp2p/p2p/transport/quicreuse
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/config.go:20:45: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/connmgr.go:16:28: undefined: quic.DialContext
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/connmgr.go:50:11: quicConf.StatelessResetKey undefined (type *quic.Config has no field or method StatelessResetKey)
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/connmgr.go:60:21: cannot use quiclogging.NewMultiplexedTracer(tracers...) (value of type logging.Tracer) as func(context.Context, protocol.Perspective, protocol.ConnectionID) logging.ConnectionTracer value in assignment
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/connmgr.go:178:22: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/connmgr.go:179:49: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/listener.go:49:49: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/listener.go:83:9: cannot use ln (variable of type *quic.Listener) as quic.Listener value in assignment
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/listener.go:92:53: conn.ConnectionState().TLS.ConnectionState undefined (type tls.ConnectionState has no field or method ConnectionState)
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/quic_multiaddr.go:23:12: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.27.8/p2p/transport/quicreuse/quic_multiaddr.go:23:12: too many errors
github.com/quic-go/webtransport-go
make[1]: *** [Makefile:12: op-node] Error 1
make[1]: Leaving directory '/home/zangetsu/data2/optimism/op-node'
make: *** [Makefile:35: op-node] Error 2

If I update go-libp2p I get :

make -C ./op-node op-node
make[1]: Entering directory '/home/zangetsu/data2/optimism/op-node'
env GO111MODULE=on GOOS= GOARCH= go build -v -ldflags "-X main.GitCommit=f37a108c8affd46f0d8011947e226826e196cbdd -X main.GitDate=1692991674 -X github.com/ethereum-optimism/optimism/op-node/version.Version=v0.0.0 -X github.com/ethereum-optimism/optimism/op-node/version.Meta=" -o ./bin/op-node ./cmd/main.go
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.30.0/p2p/host/peerstore/pstoreds/addr_book.go:17:2: missing go.sum entry for module providing package github.com/hashicorp/golang-lru/arc/v2 (imported by github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds); to add:
    go get github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds@v0.30.0
p2p/host.go:20:2: no required module provides package github.com/libp2p/go-libp2p/p2p/muxer/mplex; to add it:
    go get github.com/libp2p/go-libp2p/p2p/muxer/mplex
make[1]: *** [Makefile:12: op-node] Error 1
make[1]: Leaving directory '/home/zangetsu/data2/optimism/op-node'
make: *** [Makefile:35: op-node] Error 2

(go get github.com/libp2p/go-libp2p/p2p/muxer/mplex is not defined so it will not work)

if I update quick-go I get :

make -C ./op-node op-node
make[1]: Entering directory '/home/zangetsu/data2/optimism/op-node'
env GO111MODULE=on GOOS= GOARCH= go build -v -ldflags "-X main.GitCommit=f37a108c8affd46f0d8011947e226826e196cbdd -X main.GitDate=1692991674 -X github.com/ethereum-optimism/optimism/op-node/version.Version=v0.0.0 -X github.com/ethereum-optimism/optimism/op-node/version.Meta=" -o ./bin/op-node ./cmd/main.go
github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds
github.com/libp2p/go-libp2p/p2p/transport/quicreuse
github.com/libp2p/go-libp2p/p2p/protocol/identify
# github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/host/peerstore/pstoreds/addr_book.go:205:26: undefined: lru.NewARC
# github.com/libp2p/go-libp2p/p2p/transport/quicreuse
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/config.go:20:45: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/connmgr.go:186:22: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/connmgr.go:187:49: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/connmgr.go:255:14: undefined: quic.OptimizeConn
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/listener.go:49:50: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/listener.go:92:53: conn.ConnectionState().TLS.ConnectionState undefined (type tls.ConnectionState has no field or method ConnectionState)
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/quic_multiaddr.go:23:12: undefined: quic.VersionDraft29
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/transport/quicreuse/quic_multiaddr.go:38:19: undefined: quic.VersionDraft29
# github.com/libp2p/go-libp2p/p2p/protocol/identify
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/protocol/identify/id.go:559:25: type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) bool of func(a, b ma.Multiaddr) bool {…} does not match inferred type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) int for func(a E, b E) int
../../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.29.2/p2p/protocol/identify/obsaddr.go:217:22: type func(first *observedAddr, second *observedAddr) bool of func(first, second *observedAddr) bool {…} does not match inferred type func(a *observedAddr, b *observedAddr) int for func(a E, b E) int
make[1]: *** [Makefile:12: op-node] Error 1
make[1]: Leaving directory '/home/zangetsu/data2/optimism/op-node'
make: *** [Makefile:35: op-node] Error 2

Thanks for your help!

imranshifa commented 1 year ago

did you figure out how to resolve this error?

trianglesphere commented 1 year ago

What is the output of go version. I believe we may have required go 1.20, but current develop is now on go 1.21. (Take a look at the root go.mod for the minimum version you need). Rarely being on a newer version will causes problems (libp2p had that issue), but in general it's ok to be on a newer version, but being on an old version will cause problems.

imranshifa commented 1 year ago

What is the output of go version. I believe we may have required go 1.20, but current develop is now on go 1.21. (Take a look at the root go.mod for the minimum version you need). Rarely being on a newer version will causes problems (libp2p had that issue), but in general it's ok to be on a newer version, but being on an old version will cause problems.

it works with 1.20 but not with the latest 1.21

trianglesphere commented 1 year ago

it works with 1.20 but not with the latest 1.21

@imranshifa what is the commit in the monorepo that you are working with?

ajsutton commented 1 year ago

It's worth noting that since this issue was originally logged, libp2p and quic-go have been updated to be compatible with go 1.21 (and the minimum version bumped to 1.21) so it's very likely this has been fixed.

smartcontracts commented 1 year ago

Going to close this as resolved for now, make sure to use go >1.21 for the current release as of the writing of this comment (please make sure to check the README for the latest minimum versions since they will change after this comment was written).