From 041c7be67dfb8ec78d1f39581b9e5cafa3b58a8f Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Sat, 26 Nov 2022 17:08:49 -0400 Subject: [PATCH] fix: RLN Merkle Root window --- go.mod | 2 +- go.sum | 2 ++ waku/v2/protocol/rln/waku_rln_relay.go | 6 ++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index fc90c3f1..a0eb2a5a 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( require ( github.com/gorilla/mux v1.8.0 github.com/waku-org/go-discover v0.0.0-20221027130446-2f43d5f6c73f - github.com/waku-org/go-zerokit-rln v0.1.6 + github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg github.com/waku-org/noise v1.0.2 golang.org/x/text v0.4.0 ) diff --git a/go.sum b/go.sum index b0e4f64b..307bfcd0 100644 --- a/go.sum +++ b/go.sum @@ -1520,6 +1520,8 @@ github.com/waku-org/go-discover v0.0.0-20221027130446-2f43d5f6c73f h1:YHIrSqs8Ao github.com/waku-org/go-discover v0.0.0-20221027130446-2f43d5f6c73f/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw= github.com/waku-org/go-zerokit-rln v0.1.6 h1:r8B6S83WJIioxEj1wSruhx+eg47HpSrIwuhi6yaRvy0= github.com/waku-org/go-zerokit-rln v0.1.6/go.mod h1:T1wLR/VuTcxLkDv0O7JvR0N/9y7GHM2IeU7LjnWZxek= +github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg h1:2vVIBCtBih2w1K9ll8YnToTDZvbxcgbsClsPlJS/kkg= +github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg/go.mod h1:GlyaVeEWNEBxVJrWC6jFTvb4LNb9d9qnjdS6EiWVUvk= github.com/waku-org/noise v1.0.2 h1:7WmlhpJ0eliBzwzKz6SoTqQznaEU2IuebHF3oCekqqs= github.com/waku-org/noise v1.0.2/go.mod h1:emThr8WZLeAtKqFW+/nXfHn9VucuXTh8aHap03UXP84= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= diff --git a/waku/v2/protocol/rln/waku_rln_relay.go b/waku/v2/protocol/rln/waku_rln_relay.go index 87e6f534..6017c868 100644 --- a/waku/v2/protocol/rln/waku_rln_relay.go +++ b/waku/v2/protocol/rln/waku_rln_relay.go @@ -229,9 +229,7 @@ func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time contentTopicBytes := []byte(msg.ContentTopic) input := append(msg.Payload, contentTopicBytes...) - // TODO: set window of roots - roots := [][32]byte{} - valid, err := rln.RLN.VerifyWithRoots(input, *msgProof, roots) + valid, err := rln.RLN.VerifyWithRoots(input, *msgProof, rln.validMerkleRoots) if err != nil { rln.log.Debug("could not verify proof", zap.Error(err)) return MessageValidationResult_Invalid, nil @@ -312,7 +310,7 @@ func (r *WakuRLNRelay) MembershipContractAddress() common.Address { return r.membershipContractAddress } -func (r *WakuRLNRelay) insertMember(pubkey [32]byte) error { +func (r *WakuRLNRelay) insertMember(pubkey r.IDCommitment) error { r.log.Debug("a new key is added", zap.Binary("pubkey", pubkey[:])) // assuming all the members arrive in order err := r.RLN.InsertMember(pubkey)