bump: go-waku (#4426)

This commit is contained in:
richΛrd 2023-12-06 13:43:20 -04:00 committed by GitHub
parent 12ba1bdf69
commit 3874e47840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 24 deletions

View File

@ -1 +1 @@
0.171.28 0.171.29

2
go.mod
View File

@ -86,7 +86,7 @@ require (
github.com/mutecomm/go-sqlcipher/v4 v4.4.2 github.com/mutecomm/go-sqlcipher/v4 v4.4.2
github.com/schollz/peerdiscovery v1.7.0 github.com/schollz/peerdiscovery v1.7.0
github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7
github.com/waku-org/go-waku v0.8.1-0.20231201063231-bdd5d02a91a3 github.com/waku-org/go-waku v0.8.1-0.20231206134046-3d73afcd50a3
github.com/wk8/go-ordered-map/v2 v2.1.7 github.com/wk8/go-ordered-map/v2 v2.1.7
github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/v2 v2.2.1
github.com/yeqown/go-qrcode/writer/standard v1.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1

4
go.sum
View File

@ -2097,8 +2097,8 @@ github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 h1:xwY0kW5XZF
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw= github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw=
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE=
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04=
github.com/waku-org/go-waku v0.8.1-0.20231201063231-bdd5d02a91a3 h1:TKP/f+K4xPQIFlPihuX7K/Jtm1EltPVhCSHmRn220EI= github.com/waku-org/go-waku v0.8.1-0.20231206134046-3d73afcd50a3 h1:ck3j0not5znCThv4E76bJlUZHDn96IXABH5fg7CfEQc=
github.com/waku-org/go-waku v0.8.1-0.20231201063231-bdd5d02a91a3/go.mod h1:hem2hnXK5BdabxwJULszM0Rh1Yj+gD9IxjwLCGPPaxs= github.com/waku-org/go-waku v0.8.1-0.20231206134046-3d73afcd50a3/go.mod h1:hem2hnXK5BdabxwJULszM0Rh1Yj+gD9IxjwLCGPPaxs=
github.com/waku-org/go-zerokit-rln v0.1.14-0.20230916173259-d284a3d8f2fd h1:cu7CsUo7BK6ac/v193RIaqAzUcmpa6MNY4xYW9AenQI= github.com/waku-org/go-zerokit-rln v0.1.14-0.20230916173259-d284a3d8f2fd h1:cu7CsUo7BK6ac/v193RIaqAzUcmpa6MNY4xYW9AenQI=
github.com/waku-org/go-zerokit-rln v0.1.14-0.20230916173259-d284a3d8f2fd/go.mod h1:1PdBdPzyTaKt3VnpAHk3zj+r9dXPFOr3IHZP9nFle6E= github.com/waku-org/go-zerokit-rln v0.1.14-0.20230916173259-d284a3d8f2fd/go.mod h1:1PdBdPzyTaKt3VnpAHk3zj+r9dXPFOr3IHZP9nFle6E=
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b h1:KgZVhsLkxsj5gb/FfndSCQu6VYwALrCOgYI3poR95yE= github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b h1:KgZVhsLkxsj5gb/FfndSCQu6VYwALrCOgYI3poR95yE=

View File

@ -52,10 +52,11 @@ import (
const discoveryConnectTimeout = 20 * time.Second const discoveryConnectTimeout = 20 * time.Second
type Peer struct { type Peer struct {
ID peer.ID `json:"peerID"` ID peer.ID `json:"peerID"`
Protocols []protocol.ID `json:"protocols"` Protocols []protocol.ID `json:"protocols"`
Addrs []ma.Multiaddr `json:"addrs"` Addrs []ma.Multiaddr `json:"addrs"`
Connected bool `json:"connected"` Connected bool `json:"connected"`
PubsubTopics []string `json:"pubsubTopics"`
} }
type storeFactory func(w *WakuNode) store.Store type storeFactory func(w *WakuNode) store.Store
@ -857,11 +858,16 @@ func (w *WakuNode) Peers() ([]*Peer, error) {
} }
addrs := utils.EncapsulatePeerID(peerId, w.host.Peerstore().Addrs(peerId)...) addrs := utils.EncapsulatePeerID(peerId, w.host.Peerstore().Addrs(peerId)...)
topics, err := w.host.Peerstore().(*wps.WakuPeerstoreImpl).PubSubTopics(peerId)
if err != nil {
return nil, err
}
peers = append(peers, &Peer{ peers = append(peers, &Peer{
ID: peerId, ID: peerId,
Protocols: protocols, Protocols: protocols,
Connected: connected, Connected: connected,
Addrs: addrs, Addrs: addrs,
PubsubTopics: topics,
}) })
} }
return peers, nil return peers, nil

View File

@ -208,8 +208,16 @@ func (pm *PeerManager) ensureMinRelayConnsPerTopic() {
pm.topicMutex.RLock() pm.topicMutex.RLock()
defer pm.topicMutex.RUnlock() defer pm.topicMutex.RUnlock()
for topicStr, topicInst := range pm.subRelayTopics { for topicStr, topicInst := range pm.subRelayTopics {
curPeers := topicInst.topic.ListPeers()
curPeerLen := len(curPeers) // @cammellos reported that ListPeers returned an invalid number of
// peers. This will ensure that the peers returned by this function
// match those peers that are currently connected
curPeerLen := 0
for _, p := range topicInst.topic.ListPeers() {
if pm.host.Network().Connectedness(p) == network.Connected {
curPeerLen++
}
}
if curPeerLen < waku_proto.GossipSubOptimalFullMeshSize { if curPeerLen < waku_proto.GossipSubOptimalFullMeshSize {
pm.logger.Debug("subscribed topic is unhealthy, initiating more connections to maintain health", pm.logger.Debug("subscribed topic is unhealthy, initiating more connections to maintain health",
zap.String("pubSubTopic", topicStr), zap.Int("connectedPeerCount", curPeerLen), zap.String("pubSubTopic", topicStr), zap.Int("connectedPeerCount", curPeerLen),
@ -341,9 +349,14 @@ func (pm *PeerManager) AddDiscoveredPeer(p service.PeerData, connectNow bool) {
//Check if the peer is already present, if so skip adding //Check if the peer is already present, if so skip adding
_, err := pm.host.Peerstore().(wps.WakuPeerstore).Origin(p.AddrInfo.ID) _, err := pm.host.Peerstore().(wps.WakuPeerstore).Origin(p.AddrInfo.ID)
if err == nil { if err == nil {
pm.logger.Debug("peer already in peerStore", logging.HostID("peer", p.AddrInfo.ID)) enr, err := pm.host.Peerstore().(wps.WakuPeerstore).ENR(p.AddrInfo.ID)
return // Verifying if the enr record is more recent (DiscV5 and peer exchange can return peers already seen)
if err == nil && enr.Record().Seq() > p.ENR.Seq() {
pm.logger.Debug("found discovered peer already in peerStore", logging.HostID("peer", p.AddrInfo.ID))
return
}
} }
supportedProtos := []protocol.ID{} supportedProtos := []protocol.ID{}
if len(p.PubsubTopics) == 0 && p.ENR != nil { if len(p.PubsubTopics) == 0 && p.ENR != nil {
// Try to fetch shard info and supported protocols from ENR to arrive at pubSub topics. // Try to fetch shard info and supported protocols from ENR to arrive at pubSub topics.

View File

@ -217,6 +217,10 @@ func (rlnRelay *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTim
} }
msg.RateLimitProof = b msg.RateLimitProof = b
//If msgTimeStamp is not set, then set it to timestamp of proof
if msg.Timestamp == nil {
msg.Timestamp = proto.Int64(senderEpochTime.Unix())
}
return nil return nil
} }

View File

@ -80,7 +80,7 @@ func (r *Result) GetMessages() []*wpb.WakuMessage {
return r.Messages return r.Messages
} }
type criteriaFN = func(msg *wpb.WakuMessage) (bool, error) type CriteriaFN = func(msg *wpb.WakuMessage) (bool, error)
type HistoryRequestParameters struct { type HistoryRequestParameters struct {
selectedPeer peer.ID selectedPeer peer.ID
@ -195,7 +195,7 @@ func DefaultOptions() []HistoryRequestOption {
return []HistoryRequestOption{ return []HistoryRequestOption{
WithAutomaticRequestID(), WithAutomaticRequestID(),
WithAutomaticPeerSelection(), WithAutomaticPeerSelection(),
WithPaging(true, MaxPageSize), WithPaging(true, DefaultPageSize),
} }
} }
@ -359,7 +359,9 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR
} }
pageSize := params.pageSize pageSize := params.pageSize
if pageSize == 0 || pageSize > uint64(MaxPageSize) { if pageSize == 0 {
pageSize = DefaultPageSize
} else if pageSize > uint64(MaxPageSize) {
pageSize = MaxPageSize pageSize = MaxPageSize
} }
historyRequest.Query.PagingInfo.PageSize = pageSize historyRequest.Query.PagingInfo.PageSize = pageSize
@ -399,7 +401,7 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR
} }
// Find the first message that matches a criteria. criteriaCB is a function that will be invoked for each message and returns true if the message matches the criteria // Find the first message that matches a criteria. criteriaCB is a function that will be invoked for each message and returns true if the message matches the criteria
func (store *WakuStore) Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) { func (store *WakuStore) Find(ctx context.Context, query Query, cb CriteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) {
if cb == nil { if cb == nil {
return nil, errors.New("callback can't be null") return nil, errors.New("callback can't be null")
} }

View File

@ -19,7 +19,9 @@ const StoreID_v20beta4 = libp2pProtocol.ID("/vac/waku/store/2.0.0-beta4")
const StoreENRField = uint8(1 << 1) const StoreENRField = uint8(1 << 1)
// MaxPageSize is the maximum number of waku messages to return per page // MaxPageSize is the maximum number of waku messages to return per page
const MaxPageSize = 20 const MaxPageSize = 100
const DefaultPageSize = 20
var ( var (

View File

@ -30,7 +30,9 @@ func findMessages(query *pb.HistoryQuery, msgProvider MessageProvider) ([]*wpb.W
} }
} }
if query.PagingInfo.PageSize == 0 || query.PagingInfo.PageSize > uint64(MaxPageSize) { if query.PagingInfo.PageSize == 0 {
query.PagingInfo.PageSize = DefaultPageSize
} else if query.PagingInfo.PageSize > uint64(MaxPageSize) {
query.PagingInfo.PageSize = MaxPageSize query.PagingInfo.PageSize = MaxPageSize
} }
@ -84,7 +86,7 @@ type Store interface {
SetHost(h host.Host) SetHost(h host.Host)
Start(context.Context, *relay.Subscription) error Start(context.Context, *relay.Subscription) error
Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error) Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error)
Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) Find(ctx context.Context, query Query, cb CriteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error)
Next(ctx context.Context, r *Result) (*Result, error) Next(ctx context.Context, r *Result) (*Result, error)
Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error) Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error)
Stop() Stop()

2
vendor/modules.txt vendored
View File

@ -1011,7 +1011,7 @@ github.com/waku-org/go-discover/discover/v5wire
github.com/waku-org/go-libp2p-rendezvous github.com/waku-org/go-libp2p-rendezvous
github.com/waku-org/go-libp2p-rendezvous/db github.com/waku-org/go-libp2p-rendezvous/db
github.com/waku-org/go-libp2p-rendezvous/pb github.com/waku-org/go-libp2p-rendezvous/pb
# github.com/waku-org/go-waku v0.8.1-0.20231201063231-bdd5d02a91a3 # github.com/waku-org/go-waku v0.8.1-0.20231206134046-3d73afcd50a3
## explicit; go 1.19 ## explicit; go 1.19
github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/logging
github.com/waku-org/go-waku/waku/persistence github.com/waku-org/go-waku/waku/persistence