Skip to content

Commit

Permalink
fix_: missing message verified start and stop and go-waku updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem committed Dec 16, 2024
1 parent 616a760 commit c4e9180
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 41 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ require (
github.com/schollz/peerdiscovery v1.7.0
github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7
github.com/urfave/cli/v2 v2.27.2
github.com/waku-org/go-waku v0.8.1-0.20241203032230-6550ff35bc71
github.com/waku-org/go-waku v0.8.1-0.20241216134816-78b522db5063
github.com/wk8/go-ordered-map/v2 v2.1.7
github.com/yeqown/go-qrcode/v2 v2.2.1
github.com/yeqown/go-qrcode/writer/standard v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2152,8 +2152,8 @@ github.com/waku-org/go-libp2p-pubsub v0.12.0-gowaku.0.20240823143342-b0f2429ca27
github.com/waku-org/go-libp2p-pubsub v0.12.0-gowaku.0.20240823143342-b0f2429ca27f/go.mod h1:Oi0zw9aw8/Y5GC99zt+Ef2gYAl+0nZlwdJonDyOz/sE=
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20240110193335-a67d1cc760a0 h1:R4YYx2QamhBRl/moIxkDCNW+OP7AHbyWLBygDc/xIMo=
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20240110193335-a67d1cc760a0/go.mod h1:EhZP9fee0DYjKH/IOQvoNSy1tSHp2iZadsHGphcAJgY=
github.com/waku-org/go-waku v0.8.1-0.20241203032230-6550ff35bc71 h1:P9sQncEeeBqBRQEtiLdgQe5oWcTlAV5IVA5VGMqGslc=
github.com/waku-org/go-waku v0.8.1-0.20241203032230-6550ff35bc71/go.mod h1:zYhLgqwBE3sGP2vP+aNiM5moOKlf/uSoIv36puAj9WI=
github.com/waku-org/go-waku v0.8.1-0.20241216134816-78b522db5063 h1:YxA+0Pc+GO8DH3NvflXE0ocPx2rAzf+gAqOLpVfGcwk=
github.com/waku-org/go-waku v0.8.1-0.20241216134816-78b522db5063/go.mod h1:zYhLgqwBE3sGP2vP+aNiM5moOKlf/uSoIv36puAj9WI=
github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59 h1:jisj+OCI6QydLtFq3Pyhu49wl9ytPN7oAHjMfepHDrA=
github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59/go.mod h1:1PdBdPzyTaKt3VnpAHk3zj+r9dXPFOr3IHZP9nFle6E=
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b h1:KgZVhsLkxsj5gb/FfndSCQu6VYwALrCOgYI3poR95yE=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ github.com/waku-org/go-discover/discover/v5wire
github.com/waku-org/go-libp2p-rendezvous
github.com/waku-org/go-libp2p-rendezvous/db
github.com/waku-org/go-libp2p-rendezvous/pb
# github.com/waku-org/go-waku v0.8.1-0.20241203032230-6550ff35bc71
# github.com/waku-org/go-waku v0.8.1-0.20241216134816-78b522db5063
## explicit; go 1.21
github.com/waku-org/go-waku/logging
github.com/waku-org/go-waku/tests
Expand Down
18 changes: 14 additions & 4 deletions wakuv2/waku.go
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ func (w *Waku) SetTopicsToVerifyForMissingMessages(peerID peer.ID, pubsubTopic s
if !w.cfg.EnableMissingMessageVerification {
return
}

w.logger.Debug("setting criteria for missing msg verifier", zap.String("pubsubTopic", pubsubTopic), zap.Strings("content-topics", contentTopics))
w.missingMsgVerifier.SetCriteriaInterest(peerID, protocol.NewContentFilter(pubsubTopic, contentTopics...))
}

Expand Down Expand Up @@ -1721,12 +1721,22 @@ func (w *Waku) isGoingOnline(state connection.State) bool {
return !state.Offline && !w.onlineChecker.IsOnline()
}

func (w *Waku) isGoingOffline(state connection.State) bool {
return state.Offline && w.onlineChecker.IsOnline()
}

func (w *Waku) ConnectionChanged(state connection.State) {
if w.isGoingOnline(state) {
//TODO: analyze if we need to discover and connect to peers for relay.
w.discoverAndConnectPeers()
if w.cfg.EnableMissingMessageVerification {
w.missingMsgVerifier.Start(w.ctx)
}
}
if w.isGoingOffline(state) && w.cfg.EnableMissingMessageVerification {
w.missingMsgVerifier.Stop()
}
isOnline := !state.Offline

if w.cfg.LightClient {
//TODO: Update this as per https://github.com/waku-org/go-waku/issues/1114
go func() {
Expand All @@ -1743,9 +1753,9 @@ func (w *Waku) ConnectionChanged(state connection.State) {
w.logger.Warn("could not write on connection changed channel")
}
}
// update state
w.onlineChecker.SetOnline(isOnline)
}
// update state
w.onlineChecker.SetOnline(isOnline)
w.state = state
}

Expand Down

0 comments on commit c4e9180

Please sign in to comment.