Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: publish an up-to-date go library #1271

Open
nicobao opened this issue Jan 6, 2025 · 8 comments
Open

chore: publish an up-to-date go library #1271

nicobao opened this issue Jan 6, 2025 · 8 comments

Comments

@nicobao
Copy link

nicobao commented Jan 6, 2025

Background

I tried go-waku by adding it to my go project with go get github.com/waku-org/go-waku , but it loads v0.9.0 which dates back to 2023, while the latest commit is 3 days ago.

Besides, this old version contains an old version of quic-go that was not compatible with the latest version of go (1.23.2):

± |main {3} U:7 ?:2 ✗| → go run main.go 

# github.com/quic-go/quic-go/internal/qtls
../../../../go/pkg/mod/github.com/quic-go/[email protected]/internal/qtls/go121.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.21 yet. For more details, please see https://github.com/quic-go/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.21 yet. F...) as int value in variable declaration

Details

Could you publish the latest version or at least explain how I can do so? Currently the documentation does not reflect that the library is out of date: https://github.com/waku-org/go-waku/blob/master/docs/api/lightpush.md

Acceptance criteria

go get github.com/waku-org/go-waku should import the latest version of the source code, not a version from more than a year ago.
The documentation on library usage should be in sync with the status of the codebase.

@chair28980 chair28980 added this to Waku Jan 6, 2025
@chaitanyaprem
Copy link
Collaborator

As discussed over discord, we are not releasing go-waku as the only consumer is status-go and we directly select the commit that we want to use.

As a work-around you can get latest master of go-waku by below command

go get github.com/waku-org/go-waku@4ef460cb951a72b2a0be2b3f23347ef8f569ea08

@nicobao
Copy link
Author

nicobao commented Jan 8, 2025

I get another error - I will come back to Waku support after you release a new library based off the nim build, like you said you were working on.
Where can I subscribe to be notified when that happens?

EDIT: I subscribed to receiving notifications upon a new GitHub release. So shall that happen, you'll see me again ;o

@chaitanyaprem
Copy link
Collaborator

I get another error - I will come back to Waku support after you release a new library based off the nim build, like you said you were working on. Where can I subscribe to be notified when that happens?

EDIT: I subscribed to receiving notifications upon a new GitHub release. So shall that happen, you'll see me again ;o

That might be a separate repo based out of https://github.com/waku-org/nwaku

What is the error you are facing? Maybe I can help address it for you to proceed.

@nicobao
Copy link
Author

nicobao commented Jan 8, 2025

I get this error:

# github.com/waku-org/go-waku/waku/v2/protocol/enr
../../../../go/pkg/mod/github.com/waku-org/[email protected]/waku/v2/protocol/enr/localnode.go:50:36: localnode.Entries undefined (type *enode.LocalNode has no field or method Entries, but does have unexported field entries)

This is my main.go:

package main

import (
	"context"
	"fmt"
	"log/slog"
	"os"

	"github.com/waku-org/go-waku/waku/v2/node"
	"github.com/waku-org/go-waku/waku/v2/protocol"
	"github.com/waku-org/go-waku/waku/v2/protocol/pb"
	"github.com/waku-org/go-waku/waku/v2/utils"
	"google.golang.org/protobuf/proto"
)

func main() {
	// Create a logger with contextual fields
	log := slog.New(slog.NewTextHandler(os.Stdout, nil)).With(
		slog.String("app", "our-app-name"),
		slog.String("env", "production"),
	)

	// TODO: load private key
	wakuNode, err := node.New(node.WithLightPush() /*, node.WithPrivateKey(prvKey) */)
	if err != nil {
		log.Error("Exiting: error while loading new Waku node", err)
		os.Exit(1)
	}

	if err := wakuNode.Start(context.Background()); err != nil {
		log.Error("Exiting: error while starting Waku node", err)
		os.Exit(1)
	}
	// TODO: more content topics, better typing descriptions
	cTopic, err := protocol.NewContentTopic("myapp", "1", "messagetype", "proto")
	if err != nil {
		log.Error("Exiting: invalid contentTopic", err)
		os.Exit(1)
	}
	contentTopic := cTopic.String()

	msg := &pb.WakuMessage{
		Payload:      []byte("Hello World"),
		Version:      proto.Uint32(1),
		ContentTopic: contentTopic,
		Timestamp:    utils.GetUnixEpoch(),
	}

	msgId, err := wakuNode.Lightpush().Publish(context.Background(), msg)
	fmt.Printf("%s\n", msgId)
	if err != nil {
		log.Error("Error while pushing message to Waku", err)
	}
}

My go.mod:

module github.com/zkorum/agora/services/broadcast

go 1.23.2

replace github.com/libp2p/go-libp2p-pubsub v0.12.0 => github.com/waku-org/go-libp2p-pubsub v0.12.0-gowaku.0.20240823143342-b0f2429ca27f

require (
	github.com/waku-org/go-waku v0.8.1-0.20241219102436-278907543b02
	google.golang.org/protobuf v1.34.2
)

require (
	github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
	github.com/avast/retry-go/v4 v4.5.1 // indirect
	github.com/beevik/ntp v0.3.0 // indirect
	github.com/benbjohnson/clock v1.3.5 // indirect
	github.com/beorn7/perks v1.0.1 // indirect
	github.com/btcsuite/btcd v0.20.1-beta // indirect
	github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
	github.com/cenkalti/backoff/v3 v3.2.2 // indirect
	github.com/cenkalti/backoff/v4 v4.1.2 // indirect
	github.com/cespare/xxhash/v2 v2.3.0 // indirect
	github.com/containerd/cgroups v1.1.0 // indirect
	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
	github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d // indirect
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
	github.com/deckarep/golang-set v1.8.0 // indirect
	github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
	github.com/docker/go-units v0.5.0 // indirect
	github.com/elastic/gosigar v0.14.3 // indirect
	github.com/ethereum/go-ethereum v1.10.26 // indirect
	github.com/flynn/noise v1.1.0 // indirect
	github.com/francoispqt/gojay v1.2.13 // indirect
	github.com/go-ole/go-ole v1.2.1 // indirect
	github.com/go-stack/stack v1.8.1 // indirect
	github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
	github.com/godbus/dbus/v5 v5.1.0 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/snappy v0.0.4 // indirect
	github.com/google/gopacket v1.1.19 // indirect
	github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/gorilla/websocket v1.5.3 // indirect
	github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
	github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
	github.com/huin/goupnp v1.3.0 // indirect
	github.com/ipfs/go-cid v0.4.1 // indirect
	github.com/ipfs/go-log/v2 v2.5.1 // indirect
	github.com/jackpal/go-nat-pmp v1.0.2 // indirect
	github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
	github.com/jellydator/ttlcache/v3 v3.3.0 // indirect
	github.com/klauspost/compress v1.17.9 // indirect
	github.com/klauspost/cpuid/v2 v2.2.8 // indirect
	github.com/koron/go-ssdp v0.0.4 // indirect
	github.com/libp2p/go-buffer-pool v0.1.0 // indirect
	github.com/libp2p/go-flow-metrics v0.1.0 // indirect
	github.com/libp2p/go-libp2p v0.36.2 // indirect
	github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
	github.com/libp2p/go-libp2p-pubsub v0.12.0 // indirect
	github.com/libp2p/go-msgio v0.3.0 // indirect
	github.com/libp2p/go-nat v0.2.0 // indirect
	github.com/libp2p/go-netroute v0.2.1 // indirect
	github.com/libp2p/go-reuseport v0.4.0 // indirect
	github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
	github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
	github.com/mattn/go-isatty v0.0.20 // indirect
	github.com/miekg/dns v1.1.62 // indirect
	github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
	github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
	github.com/minio/sha256-simd v1.0.1 // indirect
	github.com/mr-tron/base58 v1.2.0 // indirect
	github.com/multiformats/go-base32 v0.1.0 // indirect
	github.com/multiformats/go-base36 v0.2.0 // indirect
	github.com/multiformats/go-multiaddr v0.13.0 // indirect
	github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
	github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
	github.com/multiformats/go-multibase v0.2.0 // indirect
	github.com/multiformats/go-multicodec v0.9.0 // indirect
	github.com/multiformats/go-multihash v0.2.3 // indirect
	github.com/multiformats/go-multistream v0.5.0 // indirect
	github.com/multiformats/go-varint v0.0.7 // indirect
	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
	github.com/onsi/ginkgo/v2 v2.20.0 // indirect
	github.com/opencontainers/runtime-spec v1.2.0 // indirect
	github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
	github.com/pion/datachannel v1.5.8 // indirect
	github.com/pion/dtls/v2 v2.2.12 // indirect
	github.com/pion/ice/v2 v2.3.34 // indirect
	github.com/pion/interceptor v0.1.30 // indirect
	github.com/pion/logging v0.2.2 // indirect
	github.com/pion/mdns v0.0.12 // indirect
	github.com/pion/randutil v0.1.0 // indirect
	github.com/pion/rtcp v1.2.14 // indirect
	github.com/pion/rtp v1.8.9 // indirect
	github.com/pion/sctp v1.8.33 // indirect
	github.com/pion/sdp/v3 v3.0.9 // indirect
	github.com/pion/srtp/v2 v2.0.20 // indirect
	github.com/pion/stun v0.6.1 // indirect
	github.com/pion/transport/v2 v2.2.10 // indirect
	github.com/pion/turn/v2 v2.1.6 // indirect
	github.com/pion/webrtc/v3 v3.3.0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.0 // indirect
	github.com/prometheus/client_golang v1.20.0 // indirect
	github.com/prometheus/client_model v0.6.1 // indirect
	github.com/prometheus/common v0.55.0 // indirect
	github.com/prometheus/procfs v0.15.1 // indirect
	github.com/quic-go/qpack v0.4.0 // indirect
	github.com/quic-go/quic-go v0.46.0 // indirect
	github.com/quic-go/webtransport-go v0.8.0 // indirect
	github.com/raulk/go-watchdog v1.3.0 // indirect
	github.com/rjeczalik/notify v0.9.3 // indirect
	github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
	github.com/spaolacci/murmur3 v1.1.0 // indirect
	github.com/stretchr/testify v1.9.0 // indirect
	github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
	github.com/tklauser/go-sysconf v0.3.5 // indirect
	github.com/tklauser/numcpus v0.2.2 // indirect
	github.com/waku-org/go-discover v0.0.0-20240506173252-4912704efdc5 // indirect
	github.com/waku-org/go-libp2p-rendezvous v0.0.0-20240110193335-a67d1cc760a0 // indirect
	github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59 // indirect
	github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b // indirect
	github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230916171929-1dd9494ff065 // indirect
	github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230916171518-2a77c3734dd1 // indirect
	github.com/wk8/go-ordered-map v1.0.0 // indirect
	github.com/wlynxg/anet v0.0.4 // indirect
	go.uber.org/dig v1.18.0 // indirect
	go.uber.org/fx v1.22.2 // indirect
	go.uber.org/mock v0.4.0 // indirect
	go.uber.org/multierr v1.11.0 // indirect
	go.uber.org/zap v1.27.0 // indirect
	golang.org/x/crypto v0.26.0 // indirect
	golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
	golang.org/x/mod v0.20.0 // indirect
	golang.org/x/net v0.28.0 // indirect
	golang.org/x/sync v0.8.0 // indirect
	golang.org/x/sys v0.24.0 // indirect
	golang.org/x/text v0.17.0 // indirect
	golang.org/x/time v0.5.0 // indirect
	golang.org/x/tools v0.24.0 // indirect
	gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
	lukechampine.com/blake3 v1.3.0 // indirect
)

So there will be a new repo with the go library derived from https://github.com/waku-org/nwaku ? It won't be published in this repo or in https://github.com/waku-org/nwaku ?

@nicobao
Copy link
Author

nicobao commented Jan 8, 2025

Btw, our backend is in NodeJS, so I'd rather broadcast the data using js-waku, but I think it's only for browser environments?
I tried using it but I get this error: waku-org/js-waku#2199

@chaitanyaprem
Copy link
Collaborator

I get this error:

Ah, that error occurs because you did not replace go-ethereum

replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.15

can you add the above line to your go.mod and let me know if you still face the error?

@chaitanyaprem
Copy link
Collaborator

So there will be a new repo with the go library derived from https://github.com/waku-org/nwaku ? It won't be published in this repo or in https://github.com/waku-org/nwaku ?

looks like this will be the go library repo that uses nwaku https://github.com/waku-org/waku-go-bindings

@nicobao
Copy link
Author

nicobao commented Jan 9, 2025

So there will be a new repo with the go library derived from https://github.com/waku-org/nwaku ? It won't be published in this repo or in https://github.com/waku-org/nwaku ?

looks like this will be the go library repo that uses nwaku https://github.com/waku-org/waku-go-bindings

I just subscribed to receive a notification whenever a release occurs!

I get this error:

Ah, that error occurs because you did not replace go-ethereum

replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.15

can you add the above line to your go.mod and let me know if you still face the error?

Oh yes, I did not replace go-ethereum. Out of curiosity, what is go-ethereum needed for btw?
I'll try this asap!
In any case, I'm committed to integrate Waku, I think it's the perfect tool for our use-case.

Thank you so much for your patience and for your prompt help 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants