Skip to content

Commit

Permalink
feat: zerokit RLN
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Oct 4, 2022
1 parent 5af5e89 commit 3cbaf45
Show file tree
Hide file tree
Showing 28 changed files with 192 additions and 426 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/rln.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ You will see a different value than `165886530` on your screen.
If two messages sent by the same chat2 client happen to have the same RLN epoch value, then one of them will be detected as spam and won't be routed (by test fleets in this test setting).
You'll also see a `ERROR: validation failed` message
At the time of this tutorial, the epoch duration is set to `10` seconds.
You can inspect the current epoch value by checking the following [constant variable](https://github.com/status-im/go-rln/blob/main/rln/types.go#L194) in the go-rln codebase.
You can inspect the current epoch value by checking the following [constant variable](https://github.com/status-im/go-zerokit-rln/blob/main/rln/types.go#L194) in the go-rln codebase.
Thus, if you send two messages less than `10` seconds apart, they are likely to get the same `rln epoch` values.

After sending a chat message, you may experience some delay before the next chat prompt appears.
Expand Down
2 changes: 1 addition & 1 deletion examples/basic2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ require (
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
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-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.2 // 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
Expand Down
6 changes: 4 additions & 2 deletions examples/basic2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,12 @@ github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e h1:fDm8hqKGF
github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e/go.mod h1:u1s0ACIlweIjmJrgXyljRPSOflZLaS6ezb044+92W3c=
github.com/status-im/go-ethereum v1.10.4-status.2 h1:uvcD2U7skYqPQviARFb4w3wZyFSYLs/pfVrJaRSDcCA=
github.com/status-im/go-ethereum v1.10.4-status.2/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
github.com/status-im/go-rln v0.0.9 h1:qDmFJoFS/1PGNDB0pEjlRDRNZUpIFBAde2f3fIixCbA=
github.com/status-im/go-rln v0.0.9/go.mod h1:t8Bf4nNAuQh9VlEiz/rgFVtEz7sjEfcd62MIuEnZn8U=
github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Ggyf88sYbHV3q/qVNMNsq+JMiar1WRkiDTr+VdTPyVk=
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.1 h1:vSWYAlfgiZHhmDXwcOP41GtEJEhxR0P+pWGuNnbH8F4=
github.com/status-im/go-zerokit-rln v0.1.1/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI=
github.com/status-im/go-zerokit-rln v0.1.2 h1:o1r9+MChdr5U2+T0sSojmNzgDvAUgtwIWAvpDDvkYsg=
github.com/status-im/go-zerokit-rln v0.1.2/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=
Expand Down
2 changes: 1 addition & 1 deletion examples/chat2/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/status-im/go-rln/rln"
"github.com/status-im/go-waku/waku/v2/dnsdisc"
"github.com/status-im/go-waku/waku/v2/node"
"github.com/status-im/go-waku/waku/v2/protocol"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/status-im/go-waku/waku/v2/protocol/relay"
"github.com/status-im/go-waku/waku/v2/protocol/store"
"github.com/status-im/go-waku/waku/v2/utils"
"github.com/status-im/go-zerokit-rln/rln"
"golang.org/x/crypto/pbkdf2"
"google.golang.org/protobuf/proto"
)
Expand Down
4 changes: 3 additions & 1 deletion examples/chat2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ replace github.com/ethereum/go-ethereum v1.10.21 => github.com/status-im/go-ethe

replace github.com/flynn/noise v1.0.0 => github.com/status-im/noise v1.0.1-handshakeMessages

replace github.com/status-im/go-zerokit-rln => ../../../go-zerokit-rln

require (
github.com/charmbracelet/bubbles v0.13.0
github.com/charmbracelet/bubbletea v0.22.0
Expand All @@ -18,8 +20,8 @@ require (
github.com/libp2p/go-libp2p-core v0.19.1
github.com/muesli/reflow v0.3.0
github.com/multiformats/go-multiaddr v0.6.0
github.com/status-im/go-rln v0.1.1
github.com/status-im/go-waku v0.0.0-00010101000000-000000000000
github.com/status-im/go-zerokit-rln v0.1.2
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
Expand Down
4 changes: 2 additions & 2 deletions examples/chat2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1688,10 +1688,10 @@ github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e h1:fDm8hqKGF
github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e/go.mod h1:u1s0ACIlweIjmJrgXyljRPSOflZLaS6ezb044+92W3c=
github.com/status-im/go-ethereum v1.10.4-status.2 h1:uvcD2U7skYqPQviARFb4w3wZyFSYLs/pfVrJaRSDcCA=
github.com/status-im/go-ethereum v1.10.4-status.2/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
github.com/status-im/go-rln v0.1.1 h1:Evbma0GZ0dgzbKcm92SWzHMZ4pOlVBxH1+z9eQAd1i4=
github.com/status-im/go-rln v0.1.1/go.mod h1:t8Bf4nNAuQh9VlEiz/rgFVtEz7sjEfcd62MIuEnZn8U=
github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Ggyf88sYbHV3q/qVNMNsq+JMiar1WRkiDTr+VdTPyVk=
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.1 h1:vSWYAlfgiZHhmDXwcOP41GtEJEhxR0P+pWGuNnbH8F4=
github.com/status-im/go-zerokit-rln v0.1.1/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=
Expand Down
2 changes: 1 addition & 1 deletion examples/chat2/rln-credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path/filepath"

"github.com/ethereum/go-ethereum/common"
"github.com/status-im/go-rln/rln"
"github.com/status-im/go-zerokit-rln/rln"
)

type membershipKeyPair struct {
Expand Down
1 change: 1 addition & 0 deletions examples/filter2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +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.2 // 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
Expand Down
5 changes: 4 additions & 1 deletion examples/filter2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,13 @@ github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e h1:fDm8hqKGF
github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e/go.mod h1:u1s0ACIlweIjmJrgXyljRPSOflZLaS6ezb044+92W3c=
github.com/status-im/go-ethereum v1.10.4-status.2 h1:uvcD2U7skYqPQviARFb4w3wZyFSYLs/pfVrJaRSDcCA=
github.com/status-im/go-ethereum v1.10.4-status.2/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
github.com/status-im/go-rln v0.0.9 h1:qDmFJoFS/1PGNDB0pEjlRDRNZUpIFBAde2f3fIixCbA=
github.com/status-im/go-rln v0.0.9/go.mod h1:t8Bf4nNAuQh9VlEiz/rgFVtEz7sjEfcd62MIuEnZn8U=
github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Ggyf88sYbHV3q/qVNMNsq+JMiar1WRkiDTr+VdTPyVk=
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.1 h1:vSWYAlfgiZHhmDXwcOP41GtEJEhxR0P+pWGuNnbH8F4=
github.com/status-im/go-zerokit-rln v0.1.1/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI=
github.com/status-im/go-zerokit-rln v0.1.2 h1:o1r9+MChdr5U2+T0sSojmNzgDvAUgtwIWAvpDDvkYsg=
github.com/status-im/go-zerokit-rln v0.1.2/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=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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-rln v0.1.1
github.com/status-im/go-zerokit-rln v0.1.2
golang.org/x/text v0.3.7
)

Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1671,12 +1671,14 @@ github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e h1:fDm8hqKGF
github.com/status-im/go-discover v0.0.0-20220406135310-85a2ce36f63e/go.mod h1:u1s0ACIlweIjmJrgXyljRPSOflZLaS6ezb044+92W3c=
github.com/status-im/go-ethereum v1.10.4-status.2 h1:uvcD2U7skYqPQviARFb4w3wZyFSYLs/pfVrJaRSDcCA=
github.com/status-im/go-ethereum v1.10.4-status.2/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
github.com/status-im/go-rln v0.1.1 h1:Evbma0GZ0dgzbKcm92SWzHMZ4pOlVBxH1+z9eQAd1i4=
github.com/status-im/go-rln v0.1.1/go.mod h1:t8Bf4nNAuQh9VlEiz/rgFVtEz7sjEfcd62MIuEnZn8U=
github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880 h1:Ggyf88sYbHV3q/qVNMNsq+JMiar1WRkiDTr+VdTPyVk=
github.com/status-im/go-waku-rendezvous v0.0.0-20220817210730-9b9b02b1e880/go.mod h1:lYUCd41Gzh6bw8RYlbADWe+LQCvhxnq2e19QWxdDM0k=
github.com/status-im/go-watchdog v1.2.0-ios-nolibproc h1:BJwZEF7OVKaXc2zErBUAolFSGzwrTBbWnN8e/6MER5E=
github.com/status-im/go-watchdog v1.2.0-ios-nolibproc/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI=
github.com/status-im/go-zerokit-rln v0.1.1 h1:vSWYAlfgiZHhmDXwcOP41GtEJEhxR0P+pWGuNnbH8F4=
github.com/status-im/go-zerokit-rln v0.1.1/go.mod h1:buDqUAAFez13mhNTGAJKD03XyEe8PdlTKdsTbfi8imI=
github.com/status-im/go-zerokit-rln v0.1.2 h1:o1r9+MChdr5U2+T0sSojmNzgDvAUgtwIWAvpDDvkYsg=
github.com/status-im/go-zerokit-rln v0.1.2/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=
Expand Down
2 changes: 1 addition & 1 deletion waku/node_rln.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"crypto/ecdsa"
"errors"

"github.com/status-im/go-rln/rln"
"github.com/status-im/go-waku/waku/v2/node"
"github.com/status-im/go-zerokit-rln/rln"
"go.uber.org/zap"
)

Expand Down
4 changes: 2 additions & 2 deletions waku/persistence/migrations/bindata.go

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

2 changes: 1 addition & 1 deletion waku/rln-credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/common"
"github.com/status-im/go-rln/rln"
"github.com/status-im/go-zerokit-rln/rln"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion waku/v2/node/wakunode2_rln.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"encoding/hex"
"errors"

r "github.com/status-im/go-rln/rln"
"github.com/status-im/go-waku/waku/v2/protocol/rln"
r "github.com/status-im/go-zerokit-rln/rln"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion waku/v2/node/wakuoptions_rln.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"crypto/ecdsa"

"github.com/ethereum/go-ethereum/common"
r "github.com/status-im/go-rln/rln"
"github.com/status-im/go-waku/waku/v2/protocol/rln"
r "github.com/status-im/go-zerokit-rln/rln"
)

// WithStaticRLNRelay enables the Waku V2 RLN protocol in offchain mode
Expand Down
96 changes: 75 additions & 21 deletions waku/v2/protocol/pb/waku_message.pb.go

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

1 change: 1 addition & 0 deletions waku/v2/protocol/pb/waku_message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ message RateLimitProof {
bytes share_x = 4;
bytes share_y = 5;
bytes nullifier = 6;
bytes rln_identifier = 7;
}

message WakuMessage {
Expand Down
Loading

0 comments on commit 3cbaf45

Please sign in to comment.