chore: upgrade RLN dep

This commit is contained in:
Richard Ramos 2023-04-03 13:07:09 -04:00 committed by RichΛrd
parent 14a6f45be4
commit 6796936f5e
5 changed files with 24 additions and 15 deletions

View File

@ -136,7 +136,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). 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 You'll also see a `ERROR: validation failed` message
At the time of this tutorial, the epoch duration is set to `10` seconds. 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-zerokit-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/waku-org/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. 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. After sending a chat message, you may experience some delay before the next chat prompt appears.

5
go.mod
View File

@ -30,7 +30,6 @@ require (
require ( require (
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98
github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg
golang.org/x/text v0.7.0 golang.org/x/text v0.7.0
) )
@ -39,6 +38,7 @@ require (
github.com/go-chi/chi/v5 v5.0.0 github.com/go-chi/chi/v5 v5.0.0
github.com/lib/pq v1.10.4 github.com/lib/pq v1.10.4
github.com/waku-org/go-noise v0.0.4 github.com/waku-org/go-noise v0.0.4
github.com/waku-org/go-zerokit-rln v0.1.9
) )
require ( require (
@ -58,6 +58,9 @@ require (
github.com/quic-go/webtransport-go v0.5.2 // indirect github.com/quic-go/webtransport-go v0.5.2 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect github.com/rjeczalik/notify v0.9.1 // indirect
github.com/status-im/status-go/extkeys v1.1.2 // indirect github.com/status-im/status-go/extkeys v1.1.2 // indirect
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230331231302-258cacb91327 // indirect
github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230331223149-f90e66aebb0d // indirect
github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230331181847-cba74520bae9 // indirect
go.uber.org/dig v1.15.0 // indirect go.uber.org/dig v1.15.0 // indirect
go.uber.org/fx v1.18.2 // indirect go.uber.org/fx v1.18.2 // indirect
nhooyr.io/websocket v1.8.7 // indirect nhooyr.io/websocket v1.8.7 // indirect

10
go.sum
View File

@ -1566,8 +1566,14 @@ 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-noise v0.0.4 h1:ZfQDcCw8pazm89EBl5SXY7GGAnzDQb9AHFXlw3Ktbvk= github.com/waku-org/go-noise v0.0.4 h1:ZfQDcCw8pazm89EBl5SXY7GGAnzDQb9AHFXlw3Ktbvk=
github.com/waku-org/go-noise v0.0.4/go.mod h1:+PWRfs2eSOVwKrPcQlfhwDngSh3faL/1QoxvoqggEKc= github.com/waku-org/go-noise v0.0.4/go.mod h1:+PWRfs2eSOVwKrPcQlfhwDngSh3faL/1QoxvoqggEKc=
github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg h1:2vVIBCtBih2w1K9ll8YnToTDZvbxcgbsClsPlJS/kkg= github.com/waku-org/go-zerokit-rln v0.1.9 h1:eMp43ThdVC8qcr4l398x3oR98RGdzAkMR/1hDlpjciU=
github.com/waku-org/go-zerokit-rln v0.1.7-wakuorg/go.mod h1:GlyaVeEWNEBxVJrWC6jFTvb4LNb9d9qnjdS6EiWVUvk= github.com/waku-org/go-zerokit-rln v0.1.9/go.mod h1:MUW+wB6Yj7UBMdZrhko7oHfUZeY2wchggXYjpUiMoac=
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230331231302-258cacb91327 h1:Q5XQqo+PEmvrybT8D7BEsKCwIYDi80s+00Q49cfm9Gs=
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230331231302-258cacb91327/go.mod h1:KYykqtdApHVYZ3G0spwMnoxc5jH5eI3jyO9SwsSfi48=
github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230331223149-f90e66aebb0d h1:Kcg85Y2xGU6hqZ/kMfkLQF2jAog8vt+tw1/VNidzNtE=
github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230331223149-f90e66aebb0d/go.mod h1:7cSGUoGVIla1IpnChrLbkVjkYgdOcr7rcifEfh4ReR4=
github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230331181847-cba74520bae9 h1:u+YUlWDltHiK5upSb7M6mStc84zdc4vTCNNOz7R5RaY=
github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230331181847-cba74520bae9/go.mod h1:+LeEYoW5/uBUTVjtBGLEVCUe9mOYAlu5ZPkIxLOSr5Y=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=

View File

@ -16,7 +16,7 @@ func RlnRelayStatic(
ctx context.Context, ctx context.Context,
relay *relay.WakuRelay, relay *relay.WakuRelay,
group []r.IDCommitment, group []r.IDCommitment,
memKeyPair r.MembershipKeyPair, memKeyPair r.IdentityCredential,
memIndex r.MembershipIndex, memIndex r.MembershipIndex,
pubsubTopic string, pubsubTopic string,
contentTopic string, contentTopic string,
@ -84,7 +84,7 @@ func RlnRelayDynamic(
ethClientAddr string, ethClientAddr string,
ethAccountPrivateKey *ecdsa.PrivateKey, ethAccountPrivateKey *ecdsa.PrivateKey,
memContractAddr common.Address, memContractAddr common.Address,
memKeyPair *r.MembershipKeyPair, memKeyPair *r.IdentityCredential,
memIndex r.MembershipIndex, memIndex r.MembershipIndex,
pubsubTopic string, pubsubTopic string,
contentTopic string, contentTopic string,

View File

@ -37,7 +37,7 @@ type WakuRLNRelay struct {
ctx context.Context ctx context.Context
timesource timesource.Timesource timesource timesource.Timesource
membershipKeyPair *r.MembershipKeyPair membershipKeyPair *r.IdentityCredential
// membershipIndex denotes the index of a leaf in the Merkle tree // membershipIndex denotes the index of a leaf in the Merkle tree
// that contains the pk of the current peer // that contains the pk of the current peer
@ -73,14 +73,14 @@ func (rln *WakuRLNRelay) Stop() {
} }
} }
func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.MembershipKeyPair, r.MembershipIndex, error) { func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.IdentityCredential, r.MembershipIndex, error) {
// static group // static group
groupKeys := r.STATIC_GROUP_KEYS groupKeys := r.STATIC_GROUP_KEYS
groupSize := r.STATIC_GROUP_SIZE groupSize := r.STATIC_GROUP_SIZE
// validate the user-supplied membership index // validate the user-supplied membership index
if rlnRelayMemIndex >= r.MembershipIndex(groupSize) { if rlnRelayMemIndex >= r.MembershipIndex(groupSize) {
return nil, r.MembershipKeyPair{}, 0, errors.New("wrong membership index") return nil, r.IdentityCredential{}, 0, errors.New("wrong membership index")
} }
// prepare the outputs from the static group keys // prepare the outputs from the static group keys
@ -88,7 +88,7 @@ func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.Member
// create a sequence of MembershipKeyPairs from the group keys (group keys are in string format) // create a sequence of MembershipKeyPairs from the group keys (group keys are in string format)
groupKeyPairs, err := toMembershipKeyPairs(groupKeys) groupKeyPairs, err := toMembershipKeyPairs(groupKeys)
if err != nil { if err != nil {
return nil, r.MembershipKeyPair{}, 0, errors.New("invalid data on group keypairs") return nil, r.IdentityCredential{}, 0, errors.New("invalid data on group keypairs")
} }
// extract id commitment keys // extract id commitment keys
@ -231,7 +231,7 @@ func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time
contentTopicBytes := []byte(msg.ContentTopic) contentTopicBytes := []byte(msg.ContentTopic)
input := append(msg.Payload, contentTopicBytes...) input := append(msg.Payload, contentTopicBytes...)
valid, err := rln.RLN.VerifyWithRoots(input, *msgProof, rln.validMerkleRoots) valid, err := rln.RLN.Verify(input, *msgProof, rln.validMerkleRoots...)
if err != nil { if err != nil {
rln.log.Debug("could not verify proof", zap.Error(err)) rln.log.Debug("could not verify proof", zap.Error(err))
return MessageValidationResult_Invalid, nil return MessageValidationResult_Invalid, nil
@ -300,7 +300,7 @@ func (rln *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTime tim
return nil return nil
} }
func (r *WakuRLNRelay) MembershipKeyPair() *r.MembershipKeyPair { func (r *WakuRLNRelay) MembershipKeyPair() *r.IdentityCredential {
return r.membershipKeyPair return r.membershipKeyPair
} }
@ -413,11 +413,11 @@ func (r *WakuRLNRelay) addValidator(
return relay.PubSub().RegisterTopicValidator(pubsubTopic, validator) return relay.PubSub().RegisterTopicValidator(pubsubTopic, validator)
} }
func toMembershipKeyPairs(groupKeys [][]string) ([]r.MembershipKeyPair, error) { func toMembershipKeyPairs(groupKeys [][]string) ([]r.IdentityCredential, error) {
// groupKeys is sequence of membership key tuples in the form of (identity key, identity commitment) all in the hexadecimal format // groupKeys is sequence of membership key tuples in the form of (identity key, identity commitment) all in the hexadecimal format
// the ToMembershipKeyPairs proc populates a sequence of MembershipKeyPairs using the supplied groupKeys // the ToMembershipKeyPairs proc populates a sequence of MembershipKeyPairs using the supplied groupKeys
groupKeyPairs := []r.MembershipKeyPair{} groupKeyPairs := []r.IdentityCredential{}
for _, pair := range groupKeys { for _, pair := range groupKeys {
idKey, err := utils.DecodeHexString(pair[0]) idKey, err := utils.DecodeHexString(pair[0])
if err != nil { if err != nil {
@ -428,7 +428,7 @@ func toMembershipKeyPairs(groupKeys [][]string) ([]r.MembershipKeyPair, error) {
return nil, err return nil, err
} }
groupKeyPairs = append(groupKeyPairs, r.MembershipKeyPair{IDKey: r.IDKey(r.Bytes32(idKey)), IDCommitment: r.IDCommitment(r.Bytes32(idCommitment))}) groupKeyPairs = append(groupKeyPairs, r.IdentityCredential{IDSecretHash: r.IDSecretHash(r.Bytes32(idKey)), IDCommitment: r.IDCommitment(r.Bytes32(idCommitment))})
} }
return groupKeyPairs, nil return groupKeyPairs, nil