-
Notifications
You must be signed in to change notification settings - Fork 81
feat(mix): cover traffic with constant rate and spam protection toggle #3807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: poc/mix-spam-protection
Are you sure you want to change the base?
Changes from all commits
2033358
5090fed
acab100
8add44d
a9d5f3f
320c13f
fe0a90e
15d341c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
| # Check cover traffic metrics from all mix nodes. | ||
| # Ports: 8008 + ports-shift (1-5) = 8009-8013 | ||
|
|
||
| echo "=== Cover Traffic Metrics ===" | ||
| echo "" | ||
|
|
||
| for i in 1 2 3 4 5; do | ||
| port=$((8008 + i)) | ||
| echo "--- Node $i (port $port) ---" | ||
| metrics=$(curl -s "http://127.0.0.1:$port/metrics" 2>/dev/null) | ||
| if [ -z "$metrics" ]; then | ||
| echo " (unreachable)" | ||
| else | ||
| echo "$metrics" | grep -E "mix_cover_|mix_slot_" | grep -v "^#" || echo " (no cover metrics yet)" | ||
| fi | ||
| echo "" | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {.used.} | ||
|
|
||
| import | ||
| std/sequtils, | ||
| std/[options, sequtils], | ||
| testutils/unittests, | ||
| chronicles, | ||
| chronos, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {.used.} | ||
|
|
||
| import | ||
| std/net, | ||
| std/[net, options], | ||
| testutils/unittests, | ||
| chronos, | ||
| libp2p/crypto/crypto, | ||
|
|
||
| +190 −0 | LICENSE-APACHE-v2 | |
| +21 −0 | LICENSE-MIT | |
| +5 −5 | mix_rln_spam_protection.nimble | |
| +116 −26 | src/mix_rln_spam_protection/spam_protection.nim | |
| +41 −1 | tests/test_all.nim |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is interesting. Any reason why these functions were removed? Shouldn't we adapt to whatever is considered the most idiomatic, or use a different library?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot to mention that this was. temporary hack that was done to avoid changes to be made in rest of logos delivery code. This file should be removed before merging as i assume this would get fixed by some other PR in master. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Compatibility shims for std/options | ||
| # The results library removed valueOr/withValue support for Option[T]. | ||
| # These templates restore that functionality. | ||
|
|
||
| {.push raises: [].} | ||
|
|
||
| import std/options | ||
|
|
||
| template valueOr*[T](self: Option[T], def: untyped): T = | ||
| let tmp = self | ||
| if tmp.isSome(): | ||
| tmp.get() | ||
| else: | ||
| def | ||
|
|
||
| template withValue*[T](self: Option[T], value, body: untyped): untyped = | ||
| let tmp = self | ||
| if tmp.isSome(): | ||
| let value {.inject.} = tmp.get() | ||
| body | ||
|
|
||
| template withValue*[T](self: Option[T], value, body, elseBody: untyped): untyped = | ||
| let tmp = self | ||
| if tmp.isSome(): | ||
| let value {.inject.} = tmp.get() | ||
| body | ||
| else: | ||
| elseBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truly a nitpick, but I'm trying to parse the configuration here and elsewhere, and I don't understand the change of "Lower" to "Higher" here. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this was something i added initially to simulate a spammer but later realized that there is no way to simulate it as zerokit itself seems to have a check once a user crosses his own message limit, it doesnt generate proofs. So, right now this is more of useless code, will try to remove it.