From 4e7909b38b4f24826660c6e549f88d15f558f7a5 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 31 Jul 2023 14:36:36 -0400 Subject: [PATCH] fix: code review --- cmd/waku/flags_rln.go | 2 +- cmd/waku/options.go | 2 +- waku/v2/node/wakunode2_rln.go | 2 +- waku/v2/node/wakuoptions.go | 2 +- waku/v2/node/wakuoptions_rln.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/waku/flags_rln.go b/cmd/waku/flags_rln.go index d5dd3d16..d2c65580 100644 --- a/cmd/waku/flags_rln.go +++ b/cmd/waku/flags_rln.go @@ -73,7 +73,7 @@ func rlnFlags() []cli.Flag { Value: &options.RLNRelay.MembershipContractAddress, }, }, - &cli.IntFlag{ + &cli.Int64Flag{ Name: "rln-relay-bandwidth-threshold", Value: 0, Usage: "Message rate in bytes/sec after which verification of proofs should happen. Use 0 to disable bandwidth rate limits", diff --git a/cmd/waku/options.go b/cmd/waku/options.go index 1877a2ad..29de1953 100644 --- a/cmd/waku/options.go +++ b/cmd/waku/options.go @@ -44,7 +44,7 @@ type RLNRelayOptions struct { ETHPrivateKey *ecdsa.PrivateKey ETHClientAddress string MembershipContractAddress common.Address - BandwidthThreshold int + BandwidthThreshold int64 } // FilterOptions are settings used to enable filter protocol. This is a protocol diff --git a/waku/v2/node/wakunode2_rln.go b/waku/v2/node/wakunode2_rln.go index ef72ed80..9c176da4 100644 --- a/waku/v2/node/wakunode2_rln.go +++ b/waku/v2/node/wakunode2_rln.go @@ -76,7 +76,7 @@ func (w *WakuNode) mountRlnRelay(ctx context.Context) error { var limiter *rate.Limiter if w.opts.rlnRelayBandwidthThreshold != 0 { - limiter = rate.NewLimiter(rate.Limit(w.opts.rlnRelayBandwidthThreshold), w.opts.rlnRelayBandwidthThreshold) + limiter = rate.NewLimiter(rate.Limit(w.opts.rlnRelayBandwidthThreshold), int(w.opts.rlnRelayBandwidthThreshold)) } rlnRelay, err := rln.New(w.Relay(), groupManager, w.opts.rlnRelayPubsubTopic, w.opts.rlnRelayContentTopic, w.opts.rlnSpamHandler, limiter, w.timesource, w.log) diff --git a/waku/v2/node/wakuoptions.go b/waku/v2/node/wakuoptions.go index 4d5fe4bd..2f1c3edc 100644 --- a/waku/v2/node/wakuoptions.go +++ b/waku/v2/node/wakuoptions.go @@ -106,7 +106,7 @@ type WakuNodeParameters struct { keystorePassword string rlnMembershipContractAddress common.Address rlnRegistrationHandler func(tx *types.Transaction) - rlnRelayBandwidthThreshold int + rlnRelayBandwidthThreshold int64 keepAliveInterval time.Duration diff --git a/waku/v2/node/wakuoptions_rln.go b/waku/v2/node/wakuoptions_rln.go index 636ba4fd..497aee29 100644 --- a/waku/v2/node/wakuoptions_rln.go +++ b/waku/v2/node/wakuoptions_rln.go @@ -12,7 +12,7 @@ import ( ) // WithRLNBandwidthThreshold sets the message rate in bytes/sec after which verification of proofs should happen -func WithRLNBandwidthThreshold(rateLimit int) WakuNodeOption { +func WithRLNBandwidthThreshold(rateLimit int64) WakuNodeOption { return func(params *WakuNodeParameters) error { params.rlnRelayBandwidthThreshold = rateLimit return nil