diff --git a/examples/basic2/go.mod b/examples/basic2/go.mod index 1c4916b6..e4a7b8c3 100644 --- a/examples/basic2/go.mod +++ b/examples/basic2/go.mod @@ -126,7 +126,7 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e // indirect github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 // indirect - github.com/status-im/go-zerokit-rln v0.1.3 // indirect + github.com/status-im/go-zerokit-rln v0.1.4 // indirect github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect github.com/status-im/status-go/extkeys v1.1.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect diff --git a/examples/basic2/go.sum b/examples/basic2/go.sum index 78fc7919..9d3a2dc1 100644 --- a/examples/basic2/go.sum +++ b/examples/basic2/go.sum @@ -1618,6 +1618,8 @@ github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Gg github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880/go.mod h1:lYUCd41Gzh6bw8RYlbADWe+LQCvhxnq2e19QWxdDM0k= github.com/status-im/go-zerokit-rln v0.1.3 h1:3UxA29BoMPlBrXw1Cddubmq4XR96ihH9KpnwfzzPtq4= github.com/status-im/go-zerokit-rln v0.1.3/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= +github.com/status-im/go-zerokit-rln v0.1.4 h1:rHrtmm6jl0y5oLswNZHrTmAVmA6Sz16V1QjBTYHmm3Y= +github.com/status-im/go-zerokit-rln v0.1.4/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/noise v1.0.1-handshakeMessages h1:mj1btE58Qk2pS0qz+BHE22HYIOhZoEFNTnRpQeMfHYk= diff --git a/examples/chat2/go.mod b/examples/chat2/go.mod index 9aff9a89..f5af21ef 100644 --- a/examples/chat2/go.mod +++ b/examples/chat2/go.mod @@ -19,7 +19,7 @@ require ( github.com/muesli/reflow v0.3.0 github.com/multiformats/go-multiaddr v0.6.0 github.com/status-im/go-waku v0.0.0-00010101000000-000000000000 - github.com/status-im/go-zerokit-rln v0.1.3 + github.com/status-im/go-zerokit-rln v0.1.4 github.com/urfave/cli/v2 v2.11.2 golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 diff --git a/examples/chat2/go.sum b/examples/chat2/go.sum index f547f3e2..f28aad38 100644 --- a/examples/chat2/go.sum +++ b/examples/chat2/go.sum @@ -1653,6 +1653,8 @@ github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Gg github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880/go.mod h1:lYUCd41Gzh6bw8RYlbADWe+LQCvhxnq2e19QWxdDM0k= github.com/status-im/go-zerokit-rln v0.1.3 h1:3UxA29BoMPlBrXw1Cddubmq4XR96ihH9KpnwfzzPtq4= github.com/status-im/go-zerokit-rln v0.1.3/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= +github.com/status-im/go-zerokit-rln v0.1.4 h1:rHrtmm6jl0y5oLswNZHrTmAVmA6Sz16V1QjBTYHmm3Y= +github.com/status-im/go-zerokit-rln v0.1.4/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/noise v1.0.1-handshakeMessages h1:mj1btE58Qk2pS0qz+BHE22HYIOhZoEFNTnRpQeMfHYk= diff --git a/examples/filter2/go.mod b/examples/filter2/go.mod index f281e4e0..760ce588 100644 --- a/examples/filter2/go.mod +++ b/examples/filter2/go.mod @@ -127,7 +127,7 @@ require ( github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e // indirect github.com/status-im/go-rln v0.0.9 // indirect github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 // indirect - github.com/status-im/go-zerokit-rln v0.1.3 // indirect + github.com/status-im/go-zerokit-rln v0.1.4 // indirect github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 // indirect github.com/status-im/status-go/extkeys v1.1.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect diff --git a/examples/filter2/go.sum b/examples/filter2/go.sum index bfb0403b..c5aed4a3 100644 --- a/examples/filter2/go.sum +++ b/examples/filter2/go.sum @@ -1619,6 +1619,8 @@ github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Gg github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880/go.mod h1:lYUCd41Gzh6bw8RYlbADWe+LQCvhxnq2e19QWxdDM0k= github.com/status-im/go-zerokit-rln v0.1.3 h1:3UxA29BoMPlBrXw1Cddubmq4XR96ihH9KpnwfzzPtq4= github.com/status-im/go-zerokit-rln v0.1.3/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= +github.com/status-im/go-zerokit-rln v0.1.4 h1:rHrtmm6jl0y5oLswNZHrTmAVmA6Sz16V1QjBTYHmm3Y= +github.com/status-im/go-zerokit-rln v0.1.4/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/noise v1.0.1-handshakeMessages h1:mj1btE58Qk2pS0qz+BHE22HYIOhZoEFNTnRpQeMfHYk= diff --git a/go.mod b/go.mod index fe3342a5..d0b35a5b 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( require ( github.com/flynn/noise v1.0.0 github.com/gorilla/mux v1.8.0 - github.com/status-im/go-zerokit-rln v0.1.3 + github.com/status-im/go-zerokit-rln v0.1.4 golang.org/x/text v0.3.7 ) diff --git a/go.sum b/go.sum index 7caf7ab8..e4cd66e5 100644 --- a/go.sum +++ b/go.sum @@ -1643,6 +1643,8 @@ github.com/status-im/go-watchdog v1.2.0-ios-nolibproc h1:BJwZEF7OVKaXc2zErBUAolF github.com/status-im/go-watchdog v1.2.0-ios-nolibproc/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= github.com/status-im/go-zerokit-rln v0.1.3 h1:3UxA29BoMPlBrXw1Cddubmq4XR96ihH9KpnwfzzPtq4= github.com/status-im/go-zerokit-rln v0.1.3/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= +github.com/status-im/go-zerokit-rln v0.1.4 h1:rHrtmm6jl0y5oLswNZHrTmAVmA6Sz16V1QjBTYHmm3Y= +github.com/status-im/go-zerokit-rln v0.1.4/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/noise v1.0.1-handshakeMessages h1:mj1btE58Qk2pS0qz+BHE22HYIOhZoEFNTnRpQeMfHYk= diff --git a/waku/v2/protocol/rln/waku_rln_relay.go b/waku/v2/protocol/rln/waku_rln_relay.go index 6d39b639..2bbd3a0d 100644 --- a/waku/v2/protocol/rln/waku_rln_relay.go +++ b/waku/v2/protocol/rln/waku_rln_relay.go @@ -217,9 +217,18 @@ func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time // verify the proof contentTopicBytes := []byte(msg.ContentTopic) input := append(msg.Payload, contentTopicBytes...) - if !rln.RLN.Verify(input, *msgProof) { + + // TODO: set window of roots + roots := [][32]byte{} + valid, err := rln.RLN.VerifyWithRoots(input, *msgProof, roots) + if err != nil { + rln.log.Debug("could not verify proof", zap.Error(err)) + return MessageValidationResult_Invalid, nil + } + + if !valid { // invalid proof - rln.log.Debug("invalid message: invalid proof") + rln.log.Debug("Invalid proof") return MessageValidationResult_Invalid, nil }